Skip to content

Commit 3389d2b

Browse files
committed
Use fetch_with to simplify implementation.
1 parent ba4bfe7 commit 3389d2b

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

crates/spirv-std/src/image.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,22 +174,7 @@ impl<
174174
where
175175
I: Integer,
176176
{
177-
let mut result = SampledType::Vec4::default();
178-
unsafe {
179-
asm! {
180-
"OpDecorate %image NonUniform",
181-
"OpDecorate %result NonUniform",
182-
"%image = OpLoad _ {this}",
183-
"%coordinate = OpLoad _ {coordinate}",
184-
"%result = OpImageFetch typeof*{result} %image %coordinate Lod {lod}",
185-
"OpStore {result} %result",
186-
result = in(reg) &mut result,
187-
this = in(reg) self,
188-
coordinate = in(reg) &coordinate,
189-
lod = in(reg) lod,
190-
}
191-
}
192-
result.truncate_into()
177+
self.fetch_with(coordinate, sample_with::lod(lod))
193178
}
194179
}
195180

0 commit comments

Comments
 (0)