Shaders: support narrow 8/16-bit buffer_load_* on constant buffers #352
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!352
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-352"
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?
@AscilCH on GitHub · 2026-11-24 23:49 UTC · original
AscilCH:fix/shader-cbv-narrow-buffer-loads→main· +235 −28 · 2 files · 1 commits · openProblem
In
crates/victory-shader/src/emit/lower.rs,Lower::bufferhandledResourceType::Cbvbefore checkingnarrow(buffer_load_ubyte,buffer_load_sbyte,buffer_load_ushort,buffer_load_sshort). As a result, narrow loads from a CBV returned the raw 32-bitcbuffer_dwordwithout byte shifting, 16-bit boundary straddling, masking, or sign extension.Fix
Lower::narrow_load(byte, bits, signed, read_dword)and share it between theResourceType::Cbvpath (cbuffer_dword) and the raw buffer path (rawBufferLoad.f32).ResourceType::Cbvbranch with!store && atomic.is_none().emit::valu_tests::cbv_narrow_buffer_loads_extract_and_sign_extendtestingbuffer_load_{ubyte,sbyte,ushort,sshort}on a CBV across offsets0, 1, 2, 3, 4, 5, 7, 15, 16, 19(including dword-boundary straddle at offset3and 16-byte CBV-row straddle at offset15).Verification
cargo test -p victory-shader --locked cbv_narrow_buffer_loads_extract_and_sign_extend: passed (hardware D3D12 + WARP +dxil.dll)cargo xtask policy: 169 files okcargo clippy -p victory-shader --all-targets --locked -- -D warnings: cleancargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: clean(AI-assisted; synthetic tests only, no game data.)
@BTekV4 on GitHub · 2026-11-25 00:48 UTC · original
Tested this PR on top of
31714de(i.e. after yesterday's3bff182and31714demerges), with #376 for the per-pipeline diagnostics. Hardware: RTX 5070 Ti, Windows 11, direct D3D12. Same automated run for every build: the prologue, withApressed by a script so the world actually loads (~5000 draws/frame, 150 s).Result: no measurable change on this title.
missing-shader10,pipeline-refused7,mesh-pipeline-refused1 — identical to the same build without this PR.main+ #376):a8826150ef94847amain+ #376 + PR):a9b7877c0c3c4cd6The class this PR targets no longer shows up in the run. After the two commits merged yesterday, the
a whole-wave section step the simulation does not follow(15 occurrences) anda lane mask exchanged where not every lane runs(15) failures are gone. What remains is:a descriptor read only as data(pixel)a descriptor's address or format read as dataa lane mask exchanged where not every lane runsa lane mask holding lanes elsewhere read as datapipeline-refused, allE_INVALIDARG (0x80070057)on compute pipelinesSo this may be superseded — worth checking before merging, unless it covers forms this scene does not exercise (the test cases suggest it covers more than the prologue does).
Two practical notes:
31714dethis PR conflicts only incrates/victory-shader/src/emit/valu_tests.rs(a test file); the functional code applies cleanly, so a rebase is trivial.shader-diag.jsonl(34k records, 11.8 MB) are in #394.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.