-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I'm surprised I haven't hit this earlier, but it's not possible to pass an array as a slice. Is this a known limitation? Is there an easy workaround?
Expected Behaviour
I would expect to be able to pass an array like [u32; 3] as a parameter to a function that takes a slice.
Example & Steps To Reproduce
Here is a minimal reproducible example:
#![no_std]
#![allow(unexpected_cfgs)]
fn do_work(data: &[u32], slab: &mut [u32]) {
slab[0] = data[0];
slab[1] = data[1];
slab[2] = data[2];
}
#[spirv(compute(threads(16)))]
pub fn compute_shader(
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] slab: &mut [u32],
#[spirv(global_invocation_id)] global_id: glam::UVec3,
) {
let data = [global_id.x, global_id.y, global_id.z];
do_work(&data, slab);
}System Info
- Rustc version:
1.90 - spirv-std: from the latest
main,b3eda4df9814b6176d3c0844eb67f70a22ebb378as of this writing - SPIR-V version:
β― spirv-val --version SPIRV-Tools v2025.3 unknown hash, 2025-06-23T19:59:33+00:00 Targets: SPIR-V 1.0 SPIR-V 1.1 SPIR-V 1.2 SPIR-V 1.3 SPIR-V 1.4 SPIR-V 1.5 SPIR-V 1.6 SPIR-V 1.2 (under OpenCL 2.2 Full Profile semantics) SPIR-V 1.0 (under Vulkan 1.0 semantics) SPIR-V 1.3 (under Vulkan 1.1 semantics) SPIR-V 1.4 (under Vulkan 1.1 semantics) SPIR-V 1.5 (under Vulkan 1.2 semantics) SPIR-V 1.6 (under Vulkan 1.3 semantics) SPIR-V 1.6 (under Vulkan 1.4 semantics)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working