How do you index into a &[&T] and deref a element? #529
-
#[spirv(vertex)] pub fn vertex( #[spirv(instance_index)] instance: u32, #[spirv(uniform, descriptor_set = 0, binding = 0)] array_of_refs: &[&u32], ) { let val = *array_of_refs[instance as usize]; // Error }I'll be frank, I don't quite get the Spir-V validation error. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
| Well I just realized that this is due: #[spirv(vertex)] pub fn vertex( #[spirv(instance_index)] instance: u32, #[spirv(storage_buffer, descriptor_set = 0, binding = 0)] array_of_refs: &[&u32], ) { let val = *array_of_refs[instance as usize]; // Error }I still get: |
Beta Was this translation helpful? Give feedback.
-
| It's not supported yet? |
Beta Was this translation helpful? Give feedback.
-
| I don't understand what Here's some valid entry point args:
( Or do you actually want "a buffer device address (BDA) pointer pointing to many (BDA pointers pointing to (T))", cause we don't have support for BDA yet. |
Beta Was this translation helpful? Give feedback.
I don't understand what
&[&T]should do, in terms offunctionentry point signature. Like what are you trying to express, in plain English?Here's some valid entry point args:
&T/TypedBuffer<T>: a buffer descriptor pointing to (a single T)&[T]/TypedBuffer<[T]>: a buffer descriptor pointing to (many Ts)&RuntimeArray<TypedBuffer<T>>an array of (buffer descriptors pointing to (a single T)), using descriptor_indexing&RuntimeArray<TypedBuffer<[T]>>an array of (buffer descriptors pointing to (many Ts)), using descriptor_indexing(
RuntimeArrayshould really be namedDescriptorArrayIMO)Or do you actually want "a buffer device address (BDA) pointer pointing to many (BDA pointers point…