destructurizing structs containing opaque types
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.4k
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
I'd love to be able to pack opaque types like depth into structs, but whenever I do, this happens:
error: error:0:0 - [VUID-StandaloneSpirv-None-04667] In Vulkan, OpTypeStruct must not contain an opaque type.
%material__screen_space_shadows__directional__SSSDirectionalLight____ = OpTypeStruct %renderer__camera__Camera %v3float %v2uint %v2uint %uint %uint %float %_ptr_UniformConstant_192
|
= note: spirv-val failed
I know you're already inlining all methods that reference opaque types, as one cannot simply pass an opaque type to a function in glsl. Could we also get that for structs?
Example use-case: Custom Samplers (or buffer loaders). Right now you are forced to pass the image to sample from to every single sample call, as you can't store the image in the custom sampler's struct. Often when constructing your sampler you want to pass in the image anyway, to load some metadata about it (eg. size) that will be constant throughout all sampling operations. And let's just hope noone accidentally passes in a different image for sampling than the one used to construct the sampler...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing handling that inlines methods referencing opaque types, then inspect the generated SPIR-V structure shown in the report and the spirv-val failure. Done should allow structs containing opaque types, including custom samplers, without requiring the image to be passed to every sampling call.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100