Repository navigation
shader_meta: fold s_brev_b32 so a literal S# built with it reaches literal_samplers (SHADER-769) - #4289
Conversation
…teral_samplers (SHADER-769)
|
Tested 8479d6c on Windows, CPython 3.14.7, CPU only (no GPU, no game files): pass.
I translated synthetic pixel-shader listings with
One related gap, not from this pull request (the parent has it too): AI-assisted. |
|
Tested
AI-assisted review. |
|
Tested
Diff reviewed: AI-assisted. |
|
Corpus check of
For #2887, this means about half again as many shaders have their static samplers registered by the layer once this lands. LGTM from the data side. |
Claimed in the coordination issue as: SHADER-769
What and why
tools/shader_meta.py(_step_state) tracked constants throughs_mov_b32,s_movk_i32, the scalar ALU ops ands_mulk_i32, but nots_brev_b32. A literal S# with one dword built bys_brev_b32therefore lost that dword's constant and was left out ofliteral_samplersin the index. The census in #4268 counts 28,659 such literal S# sites in 6,824 shaders, which a layer registering literal samplers from the index (#2887) would miss.s_brev_b32 d, srcnow recordsdas the bit-reversed constant whensrcis an immediate or an SGPR holding a known constant (RDNA2 ISA SOP1: D[31:0] = S0[0:31]; no SCC). Any other source leavesdunknown, as before.Tested
python -I tests/test_shader_meta.py: 21 tests pass. Two new tests on hand-written listings:s_brev_b32of an immediate (1gives0x80000000) and of a constant SGPR (0x3gives0xC0000000) both reachliteral_samplers;s_brev_b32of a user SGPR leaves no literal S#. The first fails onmain(KeyError: 'literal_samplers').python -I tests/test_shader_meta_operands.py,python -m compileall -q make_game.py tools tests,python -I scripts/check_no_game_data.py: pass.Checklist
docs/design.md, with how it was confirmed. (Not applicable: index metadata only, no translator rule.)