Repository navigation
Conflicting Output Location Assignment #481
Description
Activity
I'm aware that this is an issue for a while, but haven't gotten around to fixing it. Basically, we're assigning a new output location for each output parameter, regardless of it's size, even though for every
Vec4you output it should increase by one. Also you can''t manually overwrite output locations, so there's no way currently to emit two structs that are larger thanVec4. You can only decompose one of the structs into Vec4 and recompose it in the fragment shader.
I'm also unsure how easy it is to fix, since the entry point interface code needs refactoring anyway, so if possible, I may delay fixing this until it is rewritten.So, I realize an option here is to combine the two outputs into a parent structure here, but the issue is I cant seem to slap
#[spirv(flat)]or other attributes inside the output struct - e.g.pub struct CombinedOut { #[spirv(flat)] // Cant figure out how to do this material: BlinnPhongMaterialData; vertex: BlinnPhongVertexData; }
I could unblock a bit if I could figure it out, but nothing I've tried so far helps in this case
You also can't use
#[spirv(flat)]within a struct, needs to be used directly on an entry point param. Ran into this exact issue myself previously, though could get away with a single flat u32. I'll have a look tomorrow, maybe this is more trivial to fix than I think it is, the current entry point code is just a bit of a mess.Yea... the current situation isn't great, we really need a rethink on the entry point interface. Arguably even more important is a proper a model on what things can and cannot be read / written to a buffer, passed to a fragment shader, or pushed through subgroup intrinsics. So far we're only solved the latter.
This was a surprisingly trivial fix, please try this branch: #482
spirv-std = { git = "https://github.com/Rust-GPU/rust-gpu", branch = "location-assignment" } spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", branch = "location-assignment" }(or if you're using
cargo-gpu, ignore thespirv-builderdep)
Expected Behaviour
I've used multiple vertex -> fragment outputs before with simpler data structures, but my attempt to pass two
&mut Structseem to be failing withconflicting output locations.Example & Steps To Reproduce
Relevant source code:
System Info
e97524f6b4816056b3edaa70c3e0e0c656392c05rustc 1.90.0-nightly (35f603652 2025-06-29)fedoraNVIDIA RTX 4090SPIRV-Tools v2025.4 v2025.4-0-g7f2d9ee9Backtrace