entry point fn with too many params fails
还没有人认领这个 Issue。
评估
调研方向
首先,使用提供的 cs_main 入口点及其 RuntimeArray 参数复现报告中的 rust-gpu 构建。检查生成的 SPIR-V 中 albedo_tex_table 附近的内容以及 Vulkan 的 OpTypeRuntimeArray 错误;当着色器能够编译且不会为运行时数组创建非法的 OpVariable 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
I am trying to convert a project of mine from wgsl to rust-gpu. I got the basics done, but I have a shader I can't get to compile
This is the entry point
#[spirv(compute(threads(8, 8, 1)))]
pub fn cs_main(
#[spirv(global_invocation_id)] gid: UVec3,
#[spirv(uniform, descriptor_set = 1, binding = 0)] globals: &SBGlobalData,
#[spirv(uniform, descriptor_set = 2, binding = 0)] camera: &SBCameraData,
#[spirv(storage_buffer, descriptor_set = 3, binding = 0)] tlas_nodes: &[BvhNode],
#[spirv(storage_buffer, descriptor_set = 3, binding = 1)] tlas_instances: &[TlasInstance],
#[spirv(storage_buffer, descriptor_set = 3, binding = 2)] blas_nodes: &[BvhNode],
#[spirv(storage_buffer, descriptor_set = 3, binding = 3)] blas_tris: &[Triangle],
#[spirv(descriptor_set = 3, binding = 4)] rt_out: &Image!(2D, format = rgba16f, sampled = false, arrayed = false, multisampled = false),
#[spirv(uniform, descriptor_set = 3, binding = 5)] rt_consts: &RaytracerConsts,
#[spirv(uniform, descriptor_set = 3, binding = 6)] mat_consts: &RtLightConsts,
#[spirv(storage_buffer, descriptor_set = 3, binding = 7)] rt_materials: &[RtMaterialEntry],
#[spirv(descriptor_set = 3, binding = 8)] albedo_sampler: &Sampler,
#[spirv(descriptor_set = 4, binding = 0)] albedo_tex_table: &RuntimeArray<Image!(2D, type = f32, sampled = true, arrayed = false, multisampled = false)>,
) {
Expected Behaviour
Shader compiles fine
Example & Steps To Reproduce
This is the errors I am getting
info: latest update on 2026-04-11 for version 1.96.0-nightly (02c7f9bec 2026-04-10)
info: component rust-src is up to date
warn: skipping unavailable component rust-std for target spirv-unknown-vulkan1.2
Compiling shader-bench-rsgpu-user v0.1.0 (F:\rust\ideas\shader-bench\projects\raytracer-rs\.shader-bench\shader-cache\rust-gpu-build\ce910f26f4188d71)
warning: an unknown error occurred
|
= note: spirv-opt failed, leaving as unoptimized
error: [VUID-StandaloneSpirv-OpTypeRuntimeArray-04680] OpVariable, <id> '14[%albedo_tex_table]', is attempting to create memory for an illegal type, OpTypeRuntimeArray.
For Vulkan OpTypeRuntimeArray can only appear as the final member of an OpTypeStruct, thus cannot be instantiated via OpVariable
%albedo_tex_table = OpVariable %_ptr_UniformConstant__runtimearr_94 UniformConstant
Bonus: u32.saturated_sub is not implemented btw
System Info
Windows + custom compiler wrap to compile rust-gpu shader at runtime without having my whole workspace on the specific nightly toolchain
- 主要语言
- Rust
- 星标
- 3.4k
- 派生
- 126
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Rust-GPU/rust-gpu 的其他 Issue
-
enhancement
难度 1/5 1 小时以内 新手友好度 68/100
-
enhancement
-
bug
难度 3/5 1-2 天 新手友好度 48/100
-
bug
难度 4/5 3-5 天 新手友好度 48/100
-
Register fusion 未关闭enhancement
难度 5/5 一周以上 新手友好度 28/100
查看 Rust-GPU/rust-gpu 的全部 Issue
相似的 Issue
-
risk:low runtime status:in-progress type:test
难度 1/5 1 小时以内 新手友好度 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 1/5 1 小时以内 新手友好度 72/100
bevyengine/bevy#25861 ·