Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions crates/spirv-std/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/compiletests/ui/image/gather_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | let r1: glam::Vec4 = image1d.gather(*sampler, 0.0f32, 0);
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 4, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT, COMPONENTS>::gather`
--> $SPIRV_STD_SRC/image.rs:212:15
--> $SPIRV_STD_SRC/image.rs:198:15
|
LL | pub fn gather<F>(
| ------ required by a bound in this associated function
Expand All @@ -28,7 +28,7 @@ LL | let r2: glam::Vec4 = image3d.gather(*sampler, v3, 0);
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 4, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#1}::{constant#0}, SAMPLED, FORMAT, COMPONENTS>::gather`
--> $SPIRV_STD_SRC/image.rs:212:15
--> $SPIRV_STD_SRC/image.rs:198:15
|
LL | pub fn gather<F>(
| ------ required by a bound in this associated function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LL | *output = image.query_levels();
Image<SampledType, 2, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 3, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>::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
Expand Down
2 changes: 1 addition & 1 deletion tests/compiletests/ui/image/query/query_lod_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LL | *output = image.query_lod(*sampler, glam::Vec2::new(0.0, 1.0));
Image<SampledType, 2, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 3, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>::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
Expand Down
2 changes: 1 addition & 1 deletion tests/compiletests/ui/image/query/query_size_err.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LL | *output = image.query_size();
Image<SampledType, 2, DEPTH, ARRAYED, 0, 2, FORMAT, COMPONENTS>
and 6 others
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT, COMPONENTS>::query_size`
--> $SPIRV_STD_SRC/image.rs:1028:15
--> $SPIRV_STD_SRC/image.rs:1014:15
|
LL | pub fn query_size<Size: ImageSizeQuery<u32, DIM, ARRAYED> + Default>(&self) -> Size
| ---------- required by a bound in this associated function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LL | *output = image.query_size_lod(0);
Image<SampledType, 2, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `Image::<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#7}::{constant#0}, SAMPLED, FORMAT, COMPONENTS>::query_size_lod`
--> $SPIRV_STD_SRC/image.rs:1074:15
--> $SPIRV_STD_SRC/image.rs:1060:15
|
LL | pub fn query_size_lod<Size: ImageSizeQuery<u32, DIM, ARRAYED> + Default>(
| -------------- required by a bound in this associated function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LL | *output = rect_sampled.query_size_lod(0);
Image<SampledType, 2, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
Image<SampledType, 3, DEPTH, ARRAYED, 0, SAMPLED, FORMAT, COMPONENTS>
note: required by a bound in `SampledImage::<Image<SampledType, DIM, DEPTH, ARRAYED, spirv_std::::image::{impl#9}::{constant#0}, SAMPLED, FORMAT, COMPONENTS>>::query_size_lod`
--> /image.rs:1239:12
--> /image.rs:1225:12
|
LL | pub fn query_size_lod<Size: ImageSizeQuery<u32, DIM, ARRAYED> + Default>(
| -------------- required by a bound in this associated function
Expand Down