OLD-5237: rdna2spirv: the PS FRONT_FACE VGPR holds 0xffffffff / 0 (SHADER-892) #1415
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1415"
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 ubiquitarianism/leonida. Originally posted by Tortoche on 2026-11-24T23:43:12Z.
Item ID:
OLD-5237(SHADER-892)Carried forward from Draft #40 (
old-pr/5237byrafaelpssz), rebased ontomain(58be9cdf8) with original commit authorship preserved.Claimed in #14: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143844913
AI-assisted: yes
Summary
tools/rdna2spirv.py: storeOpSelect %uint %ff 0xffffffff 0into the pixel shaderFRONT_FACEsystem VGPR (SPI_BARYC_CNTL.FRONT_FACE_ALL_BITS = 1), matching how all 345 corpus shaders that read it test it against integer 0 (v_cmp_ne_u32/v_cmp_eq_u32).tests/test_ps_front_face.py: hand-written synthetic pixel shader test verifyingOpSelect %uint %ff 0xffffffff 0intov4and absence of the old float form (%ffm1).docs/design.md: updated thePS system inputscontract row to document0xffffffff/0and the corpus count.Tests Executed (Linux, CPU/translator/runtime-build suites; no local GPU or game-data run performed)
python -I scripts/run_semantic_tests.py tests/semantic: 470 files, 6168 tests, 0 files failed (exit 0; 4060 s with 4 jobs)python -I tests/test_ps_front_face.py: 1/1 passed (Ran 1 test in 0.022s,OK)python -I tests/test_shader_meta.py: 28/28 passed (Ran 28 tests in 0.348s,OK)python -I tests/test_docs_links.py: 16/16 passed (Ran 16 tests in 0.981s,OK)python -I tests/test_design_contract_rows.py: 5/5 passed (Ran 5 tests in 0.025s,OK)python -I tests/test_text_write_line_endings.py: 3/3 passed (Ran 3 tests in 257.636s,OK)node --test tests/test_viewer_streaming.cjs: 57/57 passed (tests 57, pass 57, fail 0)python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/test_ps_front_face.py docs/design.md: passed (exit 0, zero game data)python -m compileall -q make_game.py tools tests: passed (exit 0)ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure: 68/71 passed, 2 skipped (shader_library_corpus,vk_sync_validation), 1 timeout (36 - xdxr_build_checkat 1502.94s under CPU contention); re-run isolatedctest --test-dir runtime/build -C RelWithDebInfo -R '^xdxr_build_check$' --output-on-failure: 2/2 passed (xdxr_build3.48s,xdxr_build_check617.85s) -> 69 passed, 2 skipped, 0 failed.Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-24T23:48:54Z.
Tested
739d6058eon Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), againstmain364ab4eab(translator-only PR; binaries from the build at66d4f5aa3, and no C++ inruntime/testused by these fixtures changed in between):python3 -I tests/test_ps_front_face.py: 1/1 OK at this head. The same file copied ontomain's tree fails:AssertionError: unexpectedly None : FRONT_FACE is not stored as a uint select— it does distinguish the two revisions.--filter ps_bary1/1 PASS (4096/4096 pixels match);--filter ps_texture_sample2/2 PASS (ps_texture_sampleOK,ps_texture_sample_d164096/4096 exact).ps_ij_computedSKIP — computed I/J pairs needPerVertexKHRinputs and neither--bary-fallbacknor--f16-interp-fallbackwas enabled.ps_baryrun withmain'stools/rdna2spirv.pyin the same tree is also 4096/4096 PASS, so this fixture does not distinguish the two revisions here; the new unit test is the only local evidence of the change.AI-assisted; synthetic fixtures only, no game data.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T13:01:12Z.
#1415 | head
caa7d811253ee7cb276633cea87a0d56bda078b0(merged cleanly ontomaind48a957bb9988afce424552a3c0c8d01ef12320f) | Windows 11 (10.0.26200), CPython3.12.10,spirv-val(1.4.363.1), NVIDIA GeForce RTX 3090 (Vulkan1.4.341, driver610.88,subgroup 32..32,LEONIDA_VK_VALIDATION=1)main(d48a957bb9988afce424552a3c0c8d01ef12320f):tests/test_ps_front_face.py:FAILED (failures=1)(FRONT_FACE is not stored as a uint select).vk_harness(LEONIDA_VK_VALIDATION=1) drawing both front-facing (FrontFacing = true) and back-facing (FrontFacing = false) fullscreen triangles throughps_front_face(v_cmp_ne_u32_e32 vcc_lo, 0, v4; v_cndmask_b32_e64 v0, 0, 1.0, vcc_lo): back-facing draw erroneously outputs1.0(0x3f800000) on all4096/4096pixels because-1.0(0xbf800000) compares non-zero.PR + main:python -I tests/test_ps_front_face.py -v: pass (OK).vk_harness(LEONIDA_VK_VALIDATION=1,spirv-valclean) exporting(v0, v0, v4, v4): front-facing draw outputs(0x3f800000, 0x3f800000, 0xffffffff, 0xffffffff)(4096/4096pixels exact) and back-facing draw outputs(0x0, 0x0, 0x0, 0x0)(4096/4096pixels exact,0Khronos validation errors).scripts/check_no_game_data.py,test_docs_encoding.py, andtest_text_write_line_endings.py: pass (0CRLF).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T00:30:27Z.
Tested
caa7d8112merged (no commit) withmain829530dbd: Python 3.12.4, Windows 11 10.0.26300, CPU only, withLLVM_MC(conda-forge llvm-tools) and SPIRV-Tools from the Vulkan SDK 1.4.363.1.check_no_game_data.pyis clean.tests/test_ps_front_face.pypasses.tools/rdna2spirv.pyback tomain, it fails:FRONT_FACE is not stored as a uint select.scripts/run_semantic_tests.py tests/semantic -j 4, 522 files, 6484 tests) fails onlytest_valu_cvt_f16_int16_mods, both on the merge and on plainmain.No blocker from my side.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T11:52:03Z.
Tested green here earlier on this same head (see my comment above). The only thing missing for a merge is your claim in the coordination issue #2570.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T14:18:52Z.
Ready for testing: merges cleanly with
main3535eb5c4. Not inmainyet:git cherryfinds 2 commit(s) not there, and 1 of the 39 lines it adds are already present. No duplicate found: its claimOLD-5237appears in no other open pull request and in nomaincommit.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T14:26:06Z.
Independent GPU check on
caa7d8112integrated withddfe24fba. The baseline uses the same Vulkan harness and input with onlytools/rdna2spirv.pyrestored fromddfe24fba.I rendered a 64×64 fullscreen triangle in both windings. Two hand-written PS inputs consume
SV_IsFrontFaceby itself (v2) and afterSV_Position.xy(v4). The shaders export the results of three integer comparisons as RGB:face == 0xffffffff,face == 0, andface != 0. A GLSL fragment shader usinggl_FrontFacingsupplies the reference for each winding.The baseline produced RGBA
(0, 0, 1, 1)on both windings. The PR matched the front reference(1, 0, 1, 1)and the back reference(0, 1, 0, 1)at every pixel for both input layouts. All four translated fragments passedspirv-val --target-env vulkan1.3, and the draw logs showed no Vulkan validation errors.test_ps_front_face.pyfailed with the baseline translator and passed with the PR.test_shader_meta.pypassed 30/30 on the integration.AI-assisted test, run offline with synthetic inputs.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T15:52:06Z.
RUN report for #1415 (OLD-5237 / SHADER-892, rdna2spirv PS FRONT_FACE)
Heads: PR head
caa7d8112(base604ddff0b); origin/mainc22a0a732, merged locally withgit merge --no-ff(clean, 3 files).Kind: Python translator change plus a new test and a docs row (
tools/rdna2spirv.py,tests/test_ps_front_face.py,docs/design.md).Commands (one process per file):
python -I -B tests/<file>fortest_ps_front_face.py,test_shader_meta.py,test_docs_links.py,test_design_contract_rows.py,test_text_write_line_endings.py; on the merged tree alsopython -I scripts/run_semantic_tests.py tests/semantic -j 8.Results:
tools/rdna2spirv.pyanddocs/design.mdreverted to the PR base, new test kept; behavioural, no new API):test_ps_front_face.pyFAILED (1 failure:FRONT_FACE is not stored as a uint select).test_design_contract_rows.pystays OK with the old docs row.test_ps_front_face.py1 OK,test_shader_meta.py28 OK,test_docs_links.py16 OK,test_design_contract_rows.py5 OK,test_text_write_line_endings.py3 OK.test_interp_computed_ij_fallback(2 failures): pre-existing, it fails the same way (exit 1, 3 of 3 runs) on plain mainc22a0a732.test_salu_orn2_saveexec_b64: the Python process crashed under load (exit code 0xC0000409 inspirv_mini_interp.py, a CPython crash, not a test assertion); rerun alone it passes 3 of 3 on the merged tree and on plain main. Treated as a machine flake, not caused by the PR.Machine: Windows 11 Pro x64, RTX 3090 24 GB, NVIDIA 621.40, Python 3.13.12 (
python -I).Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T19:18:43Z.
Tested
caa7d8112merged (no commit) withmain7c330c76d: Python 3.12, Windows 11 10.0.26300, CPU only. Ran the PR's tests plus every test file that imports the changed tools, with the PR and with its tools back tomain.tests/test_ps_front_face.pyFAILED (failures=1)withtools/back tomain; green with the PR (1 OK).test_mesh_serial_waves.py(6 failures) andtest_rdna2_decode.py(1 error) fail onmaintoo..asmfixture intests/semantic/and a row in the contract table ofdocs/design.md. Please check those are in before merge.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:41:16Z.
Review: APPROVED
Reviewed the diff against
main:tools/rdna2spirv.py:16459-16465cleanly switches PSFRONT_FACEfrom±1.0to0xFFFFFFFF/0, matching all 345 corpus shaders that test it as an integer against 0, withtests/test_ps_front_face.pyand thedocs/design.mdcontract table updated. Clean-room verified. Approving; please merge/rebase currentmainso CI runs green before merge.(AI-assisted review.)