diff --git a/crates/spirv-std/src/image.rs b/crates/spirv-std/src/image.rs index f1f72f676e..5e5d51386a 100644 --- a/crates/spirv-std/src/image.rs +++ b/crates/spirv-std/src/image.rs @@ -143,21 +143,7 @@ impl< where I: Integer, { - let mut result = SampledType::Vec4::default(); - unsafe { - asm! { - "OpDecorate %image NonUniform", - "OpDecorate %result NonUniform", - "%image = OpLoad _ {this}", - "%coordinate = OpLoad _ {coordinate}", - "%result = OpImageFetch typeof*{result} %image %coordinate", - "OpStore {result} %result", - result = in(reg) &mut result, - this = in(reg) self, - coordinate = in(reg) &coordinate, - } - } - result.truncate_into() + self.fetch_with_lod(coordinate, 0) } /// Fetch a single texel at a mipmap `lod` with a sampler set at compile time diff --git a/tests/compiletests/ui/image/gather_err.stderr b/tests/compiletests/ui/image/gather_err.stderr index e2c603b229..295ff4ad9d 100644 --- a/tests/compiletests/ui/image/gather_err.stderr +++ b/tests/compiletests/ui/image/gather_err.stderr @@ -9,7 +9,7 @@ LL | let r1: glam::Vec4 = image1d.gather(*sampler, 0.0f32, 0); Image Image note: required by a bound in `Image::::gather` - --> $SPIRV_STD_SRC/image.rs:212:15 + --> $SPIRV_STD_SRC/image.rs:198:15 | LL | pub fn gather( | ------ required by a bound in this associated function @@ -28,7 +28,7 @@ LL | let r2: glam::Vec4 = image3d.gather(*sampler, v3, 0); Image Image note: required by a bound in `Image::::gather` - --> $SPIRV_STD_SRC/image.rs:212:15 + --> $SPIRV_STD_SRC/image.rs:198:15 | LL | pub fn gather( | ------ required by a bound in this associated function diff --git a/tests/compiletests/ui/image/query/query_levels_err.stderr b/tests/compiletests/ui/image/query/query_levels_err.stderr index 7b3d0c0e86..d75ac3e23d 100644 --- a/tests/compiletests/ui/image/query/query_levels_err.stderr +++ b/tests/compiletests/ui/image/query/query_levels_err.stderr @@ -10,7 +10,7 @@ LL | *output = image.query_levels(); Image Image note: required by a bound in `Image::::query_levels` - --> $SPIRV_STD_SRC/image.rs:964:15 + --> $SPIRV_STD_SRC/image.rs:950:15 | LL | pub fn query_levels(&self) -> u32 | ------------ required by a bound in this associated function diff --git a/tests/compiletests/ui/image/query/query_lod_err.stderr b/tests/compiletests/ui/image/query/query_lod_err.stderr index 5387b12746..f6596b2435 100644 --- a/tests/compiletests/ui/image/query/query_lod_err.stderr +++ b/tests/compiletests/ui/image/query/query_lod_err.stderr @@ -10,7 +10,7 @@ LL | *output = image.query_lod(*sampler, glam::Vec2::new(0.0, 1.0)); Image Image note: required by a bound in `Image::::query_lod` - --> $SPIRV_STD_SRC/image.rs:993:15 + --> $SPIRV_STD_SRC/image.rs:979:15 | LL | pub fn query_lod( | --------- required by a bound in this associated function diff --git a/tests/compiletests/ui/image/query/query_size_err.stderr b/tests/compiletests/ui/image/query/query_size_err.stderr index 3a799174ba..a8126b9581 100644 --- a/tests/compiletests/ui/image/query/query_size_err.stderr +++ b/tests/compiletests/ui/image/query/query_size_err.stderr @@ -15,7 +15,7 @@ LL | *output = image.query_size(); Image and 6 others note: required by a bound in `Image::::query_size` - --> $SPIRV_STD_SRC/image.rs:1028:15 + --> $SPIRV_STD_SRC/image.rs:1014:15 | LL | pub fn query_size + Default>(&self) -> Size | ---------- required by a bound in this associated function diff --git a/tests/compiletests/ui/image/query/query_size_lod_err.stderr b/tests/compiletests/ui/image/query/query_size_lod_err.stderr index b24e99ff32..5c941559ae 100644 --- a/tests/compiletests/ui/image/query/query_size_lod_err.stderr +++ b/tests/compiletests/ui/image/query/query_size_lod_err.stderr @@ -10,7 +10,7 @@ LL | *output = image.query_size_lod(0); Image Image note: required by a bound in `Image::::query_size_lod` - --> $SPIRV_STD_SRC/image.rs:1074:15 + --> $SPIRV_STD_SRC/image.rs:1060:15 | LL | pub fn query_size_lod + Default>( | -------------- required by a bound in this associated function diff --git a/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.stderr b/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.stderr index 8bb805378c..9eb274f82a 100644 --- a/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.stderr +++ b/tests/compiletests/ui/image/query/sampled_image_rect_query_size_lod_err.stderr @@ -10,7 +10,7 @@ LL | *output = rect_sampled.query_size_lod(0); Image Image note: required by a bound in `SampledImage::>::query_size_lod` - --> /image.rs:1239:12 + --> /image.rs:1225:12 | LL | pub fn query_size_lod + Default>( | -------------- required by a bound in this associated function