shader,gpu: trim shader code tables and guard pixel HDR & compose NaNs #75
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Androtim--MiniVI!75
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/75/head"
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?
@Androtim on GitHub · 2026-11-29 04:03 UTC · original
Androtim:feat/iter75-hdr-clamp-compose-nan-code-table→main· +200 −64 · 5 files · 2 commits · merged 2026-11-29 14:31 UTCSummary
Focused extraction of three visual correctness and shader-emission hardening fixes (with mbient.rs omitted so there is zero conflict with PR #69):
Rig Specs Tested On
Run Settings & Profile
@Androtim on GitHub · 2026-11-29 04:16 UTC · original · edited 2026-11-29 08:03 UTC
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
CI is passing and the logic across all three changes looks solid and well-scoped:
Compositor NaN-safe saturate (
crates/victory-gpu/src/compose.rs):clean1uses(asuint(x) & 0x7FFFFFFFu) > 0x7F800000uto detect NaN (mapping it to1.0) while lettingsaturate(x)clamp finite values and±Inf(+Inf -> 1.0,-Inf -> 0.0), gated byVICTORY_COMPOSE_NAN(default on,0disables).root_signature_attaches_to_ps_and_compiles_for_both_clean_modesverifiesD3DCompilesucceeds for bothvs_5_1andps_5_1underCLEAN=0andCLEAN=1.Pixel HDR output clamp (
crates/victory-shader/src/emit/hdr.rs,lower.rs,shader_cache.rs):Lower::clamp_hdrclamps pixel shaderSV_Targetfloat outputs (!mesh && HwStage::Ps && el.kind == 16 && el.comp == 9) to[-65024.0, 65024.0]viaFMax/FMinand replaces NaN with65024.0viais_nan_f32, gated byVICTORY_HDR_CLAMP(default on,0disables).VICTORY_HDR_CLAMPis added toshader_cache::build(), invalidating older unclamped cache entries and keeping toggle combinations distinct.Constant code-table trimming (
crates/victory-shader/src/emit/hdr.rs,emit/mod.rs):code_table_starttrims leading instruction bytes from emitted DXILcodeconstant arrays when no fixed-offsetCODEload reads belowcode_end, covered bythe_code_table_starts_after_the_instructions.code_dwordandclamp_hdrintoemit/hdr.rskeepslower.rsclean.Notes for Local GPU Verification
VICTORY_HDR_CLAMPandVICTORY_COMPOSE_NANare enabled by default and modify pixel shader DXIL / compositor HLSL output (including mapping NaN to65024.0on all floatSV_Targetoutputs, not only 16-bit HDR targets). A real-GPU smoke test is warranted to confirm no visual regressions on G-buffer/UI targets and that shaders with dynamicCODEloads still render identically with trimmed constant tables.Generated with Antigravity CLI (
agy).@Androtim on GitHub · 2026-11-29 06:08 UTC · original
Fixed the HLSL
[RootSignature(RS)]placement incrates/victory-gpu/src/compose.rsso the attribute attaches directly tofloat4 ps(V v) : SV_Targetinstead of helperclean1(float), extractedcompile_with, and addedcompose::tests::root_signature_attaches_to_ps_and_compiles_for_both_clean_modescovering bothCLEAN=0andCLEAN=1.Verification Summary
cargo xtask policy:asset policy: 302 files okcargo test -p victory-gpu --lib --features diagnostics --locked -- compose:: --nocapture: 2 passed; 0 failed (root_signature_attaches_to_ps_and_compiles_for_both_clean_modes+ live D3D12composes_scaled_premultiplied_plane_on_gpureadback)cargo test -p victory-shader --lib --locked -- the_code_table_starts_after_the_instructions: 1 passed; 0 failedcargo clippy --workspace --all-targets --locked -- -D warnings: 0 warningscargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings: 0 warnings--release+objdump -p: only Windows system DLLs (zero MinGW runtime DLLs)pr75-compose-rs-fix): 11/11 gates PASS12.1 fps(82.5 ms) vs8.9 fpsbaseline (+3.20 fps)05871 MB/6947 MBmin budget (over=0 MB,room_false=7.7%)1954vs7121baseline (-5167,41947uploaded)mapped()stalls:7.18 ms/world_sec24):lit=18/24,luma=105.68,near_black=0.0%,edge_energy=7.05,magenta=0.0%(inspectedframe-8791.png,frame-8831.png,frame-8863.png: clean UI compose overlay, natural lighting, zero black specks or bloom flares)@Androtim on GitHub · 2026-11-29 07:26 UTC · original
Rebased cleanly onto
origin/main(c20129f, new head4461f6e), keeping botharray_calculate_lod_passes_undef_for_slice_coordandthe_code_table_starts_after_the_instructionsincrates/victory-shader/src/emit/mod.rs, and re-verified everything:cargo xtask policy:304 files okcargo test -p victory-shader --lib --locked -- the_code_table_starts_after_the_instructions array_calculate_lod_passes_undef_for_slice_coord: 2 passed; 0 failedcargo test -p victory-gpu --lib --features diagnostics --locked -- compose::: 2 passed; 0 failedcargo clippy --workspace --all-targets -- -D warnings&--features diagnostics: 0 warnings--release+objdump -p: standard Windows system DLLs onlypr75-rebased-c20129f): 11/11 gates PASS12.5 fps(79.9 ms, vs8.9 fpsbaseline,+3.60 fps)5881 MB/6956 MBbudget (over=0 MB)2002(vs7121baseline) |mapped()stall rate:5.94 ms/suntranslated=1| Crashes / host texture errors:0/0frame-8275.png,frame-8315.png, median luma103.51, edge energy7.23,0.0%near-black/magenta): clean daylight rendering with no NaN artifacts.@Androtim on GitHub · 2026-11-29 14:31 UTC · original
Automated RTX 4060 Ti 8 GB Wave 3 A/B hardware verification passed (
playtest/wave3vsorigin/mainc7ed150— 5/5 A/B gates PASS):cargo test(RTX 4060 Ti):victory-gpu542 passed, 0 failed (36 ignored);victory-shader323 passed, 0 Wave 3 regressions (the 3 PSV0 validation failures inemit::rect::testsandemit::barycentric_testsalso fail identically onorigin/mainc7ed150).scripts/verify-world.ps1, DLSS Quality + golden autosave):10.25 fpsvs10.7 fpsbaseline (min FPS improved6.9vs4.2, preparing45.35 msvs50.3 ms)5948 MBvs6073 MB(-125 MB,0 MBover budget)final_waiting=5487vs7350(-1863);no room for new ones38vs43mapped_rate=20.95 ms/svs37.22 ms/s(-44%)frame-10645.png,frame-10669.png), luma82.77vs23.2, edge energy2.27vs1.81, magenta0.0%.