How do you index into a &[&T] and deref a element? #529
Answered
by
Firestar99
codecnotsupported
asked this question in
Q&A
#[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. |
Answered by
Firestar99
Feb 13, 2026
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: |
0 replies
|
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. |
4 replies
Answer selected by
codecnotsupported
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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…