Shader translator: Structured buffer stride support incomplete, causes black frames #3366
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Mdemets on 2026-11-26T20:36:30Z.
Shader translator: Structured buffer stride support incomplete, causes black frames
Summary
Commit 4c52e97 "GPU: Bind the stride of root-selected shader buffers" added support for handling structured buffers with unknown strides, but the implementation was left incomplete. The stride discovery mechanism exists, but the stride values are never populated from the descriptor heap. This causes shaders accessing structured buffers to fail translation with "a structured buffer of unknown stride is not supported", dropping all draws and producing black frames.
Impact
translate_with_view_strides(), so shaders fail to translate entirelyRoot Cause
What commit 4c52e97 added:
StructuredBindingtype to identify buffer bindingstranslate_with_view_strides()function that accepts a stride callbackfind_stride_bindings()to probe shaders and discover which bindings are accessedWhat was left incomplete:
Pending::strideswith actual stride values from descriptorsshader_cache.rsstill usestranslate_with_wave32()(line 94) instead oftranslate_with_view_strides()Pending::specialize_shaders()expects strides butPending::stridesis initialized empty and never filledCode Analysis
In
crates/victory-gpu/src/pipeline/make.rs:Line 72: Strides initialized empty:
Line 87-98: Pipeline attempts to make without strides, discovers bindings, but never populates strides:
Line 140-148:
specialize_shaders()does binary search on strides, but it's empty:In
crates/victory-gpu/src/shader_cache.rs:Line 94: Cache uses basic translator without stride callback:
Should be:
Solution
Part 1: Populate strides in pipeline
Add
Pending::populate_strides_from_descriptors()method:After line 92, once bindings are discovered:
New method:
This requires access to the descriptor heap, which should be available via:
crate::descriptor::Heapcrate::descriptor::selected_buffer()Part 2: Wire stride support into shader cache
Update
shader_cache.rsline 94 to usetranslate_with_view_strides()with a default or conservative stride assumption. However, this is tricky because:Part 3: Make pipeline always specialize
Ensure the pipeline always calls
specialize_shaders()when stride bindings are discovered, rather than giving up after the first attempt.Testing
Repro steps:
VICTORY_CAPTUREandVICTORY_AUDIO_CAPTUREReferences
crates/victory-gpu/src/shader_cache.rs(line 94)crates/victory-gpu/src/pipeline/make.rs(lines 72, 87-98, 128-154)crates/victory-gpu/src/descriptor/host.rs(BufferRead struct, selected_buffer fn)crates/victory-shader/src/emit/mod.rs(translate_with_view_strides function)Imported from Marvisak/VIctory. Originally posted by Ingenioeren on 2026-11-27T00:42:38Z.
I checked this against upstream main
63bcca4. The cited4c52e97commit is on a diverged branch. Commit comparisonOn main, the heap-indexed path loads the stride at execution time from the
VIEW_STRIDESroot SRV. The host records the stride from the descriptor in its heap table and binds that table at draw or dispatch time. The shader cache can therefore keep one translation for this path. Stride lowering · Host metadata · Runtime bindingTwo synthetic checks passed. The same compiled compute pipeline read the expected values on all 32 lanes across strides of 12, 20 and 12 bytes on both an RX 6750 XT and Windows WARP. Separately, the production heap metadata writer recorded 12, then 20, then cleared the slot to 0 on WARP.
This establishes the heap-indexed case on upstream. The lowering still rejects some sources whose stride it cannot resolve, including a
Source::Phiin this path. Could you share the exact VIctory build commit and the first refused shader's hash, stage and error offset? Those would help tell whether this is a branch difference or an uncovered binding shape. The tests above used no game files.AI-assisted synthetic verification with OpenAI Codex.