Skip to content

Commit

Permalink
[front/spir-v] Obey the is_depth field of OpTypeImage (#2341)
Browse files Browse the repository at this point in the history
* [front/spir-v] Obey the is_depth field of OpTypeImage

* Add changed tests
  • Loading branch information
expenses authored May 22, 2023
1 parent 423a069 commit ce48588
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
6 changes: 4 additions & 2 deletions src/front/spv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4708,7 +4708,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
let id = self.next()?;
let sample_type_id = self.next()?;
let dim = self.next()?;
let _is_depth = self.next()?;
let is_depth = self.next()?;
let is_array = self.next()? != 0;
let is_msaa = self.next()? != 0;
let _is_sampled = self.next()?;
Expand Down Expand Up @@ -4740,7 +4740,9 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
.ok_or(Error::InvalidImageBaseType(base_handle))?;

let inner = crate::TypeInner::Image {
class: if format != 0 {
class: if is_depth == 1 {
crate::ImageClass::Depth { multi: is_msaa }
} else if format != 0 {
crate::ImageClass::Storage {
format: map_image_format(format)?,
access: crate::StorageAccess::default(),
Expand Down
11 changes: 4 additions & 7 deletions tests/out/analysis/shadow.info.ron
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@
(
bits: 64,
),
(
bits: 64,
),
],
functions: [
(
Expand Down Expand Up @@ -190,7 +187,7 @@
),
ref_count: 1,
assignable_global: Some(1),
ty: Handle(30),
ty: Handle(7),
),
(
uniformity: (
Expand All @@ -201,7 +198,7 @@
),
ref_count: 1,
assignable_global: Some(2),
ty: Handle(31),
ty: Handle(30),
),
(
uniformity: (
Expand Down Expand Up @@ -1256,7 +1253,7 @@
),
ref_count: 0,
assignable_global: Some(1),
ty: Handle(30),
ty: Handle(7),
),
(
uniformity: (
Expand All @@ -1267,7 +1264,7 @@
),
ref_count: 0,
assignable_global: Some(2),
ty: Handle(31),
ty: Handle(30),
),
(
uniformity: (
Expand Down
17 changes: 3 additions & 14 deletions tests/out/ir/shadow.ron
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
inner: Image(
dim: D2,
arrayed: true,
class: Sampled(
kind: Float,
class: Depth(
multi: false,
),
),
Expand Down Expand Up @@ -269,16 +268,6 @@
space: Private,
),
),
(
name: None,
inner: Image(
dim: D2,
arrayed: true,
class: Depth(
multi: false,
),
),
),
(
name: None,
inner: Sampler(
Expand Down Expand Up @@ -616,7 +605,7 @@
group: 0,
binding: 2,
)),
ty: 30,
ty: 7,
init: None,
),
(
Expand All @@ -626,7 +615,7 @@
group: 0,
binding: 3,
)),
ty: 31,
ty: 30,
init: None,
),
(
Expand Down

0 comments on commit ce48588

Please sign in to comment.