From 7f7ed001f42207c1fc8ed2c7e1b09de8bf7249e8 Mon Sep 17 00:00:00 2001 From: khyperia Date: Fri, 16 Apr 2021 13:33:28 +0200 Subject: [PATCH] Add needed capability --- crates/spirv-std/src/runtime_array.rs | 2 ++ tests/ui/storage_class/runtime_descriptor_array.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/crates/spirv-std/src/runtime_array.rs b/crates/spirv-std/src/runtime_array.rs index 168525a671..d5bddbeb1a 100644 --- a/crates/spirv-std/src/runtime_array.rs +++ b/crates/spirv-std/src/runtime_array.rs @@ -12,6 +12,7 @@ pub struct RuntimeArray { // Index/IndexMut are marked as safe functions. impl RuntimeArray { #[spirv_std_macros::gpu_only] + #[allow(clippy::empty_loop)] pub unsafe fn index(&self, index: usize) -> &T { asm! { "%result = OpAccessChain _ {arr} {index}", @@ -24,6 +25,7 @@ impl RuntimeArray { } #[spirv_std_macros::gpu_only] + #[allow(clippy::empty_loop)] pub unsafe fn index_mut(&mut self, index: usize) -> &mut T { asm! { "%result = OpAccessChain _ {arr} {index}", diff --git a/tests/ui/storage_class/runtime_descriptor_array.rs b/tests/ui/storage_class/runtime_descriptor_array.rs index 4171a5d678..8b7b7f2b0e 100644 --- a/tests/ui/storage_class/runtime_descriptor_array.rs +++ b/tests/ui/storage_class/runtime_descriptor_array.rs @@ -8,6 +8,12 @@ pub fn main( #[spirv(descriptor_set = 0, binding = 2)] sized_slice: &[Image2d; 5], output: &mut glam::Vec4, ) { + unsafe { + asm!( + "OpCapability RuntimeDescriptorArray", + "OpExtension \"SPV_EXT_descriptor_indexing\"" + ) + } let img = unsafe { slice.index(5) }; let v2 = glam::Vec2::new(0.0, 1.0); *output = img.sample(*sampler, v2);