Rust-GPU / Rust-GPU/rust-gpu

Try to map `spirv-val` output to Rust code

Open
#323 19 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

I just got an error that looks like this:

error: error:0:0 - OpInBoundsAccessChain result type (OpTypeStruct) does not match the type that results from indexing into the base <id> (OpTypeArray).
         %2764 = OpInBoundsAccessChain %_ptr_Function__struct_33 %2763 %uint_0
  |
  = note: spirv-val failed
  = note: module `.../spirv-unknown-vulkan1.2/debug/deps/....spv`

Unfortunately, the output isn't all that helpful, don't know how to debug it except commenting-out pieces of code until the error goes away. However, I do have a suspicion that _ptr_Function__struct_33 might be something that codegen controls, which in turn might mean ability to translate it back to something like the name of the data structure or file and line of code.

Also maybe debug builds could use something more descriptive than struct_33 to help with debugging, like a mangling scheme.

I'm compiling with these options:

let backend = cargo_gpu::Install::from_shader_crate(shader_crate.clone()).run()?;

let spirv_builder = backend
    .to_spirv_builder(shader_crate, "spirv-unknown-vulkan1.2")
    .print_metadata(MetadataPrintout::DependencyOnly)
    .spirv_metadata(SpirvMetadata::NameVariables)
    .release(false);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the cargo_gpu::Install flow and the to_spirv_builder(...).spirv_metadata(SpirvMetadata::NameVariables) configuration, then inspect how the emitted spirv-val diagnostics expose _ptr_Function__struct_33. Define a concrete mapping or naming behavior and verify it against the shown OpInBoundsAccessChain failure; the issue is done when generated diagnostics identify relevant Rust source context or provide more descriptive debug names.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.