Commit Graph

10 Commits

Author SHA1 Message Date
Alex d809958b27 fix(shader): fold BitReverse32 of an immediate
A descriptor dword built by S_BREV_B32, V_BFREV_B32 or S_BREV_B64 from a
constant stayed a runtime value, so the resource could not be resolved
and the shader failed to prepare. The constant folder now reverses the
bits of an immediate the way the hardware does (D[31-i] = S0[i]), like
the existing BitCount32 fold. ConstantBitTest covers the fold.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-11 05:23:40 -04:00
Morten Holm 93b0f48d37 fix(shader): keep s_cselect_b64 of two masks as a lane bit and fold constant masks
A select of exec and zero gives a mask that is the same for every lane. Reading
it back went through a lane number, which Metal does not have in a vertex
shader, so MoltenVK rejected the shader. The select now stores the lane bit and
marks the pair as a mask, a constant mask word reads as a constant, and the
constant folder removes the bit test on an all-zero or all-one word.

agc_scalar_select_mask runs the translated IR over a wave and pins the lane
values for scc set and clear, a source that differs per lane, the two wave64
halves differing, a destination that is also a source, and constant and
literal sources.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-10 10:15:05 +02:00
fisherjoey 79653e00be fix(shader): carry a packed pixel ancillary through a phi into field extracts 2026-10-10 00:14:18 -06:00
Joey Fisher 6b41cf4dbf fix(shader): lower the packed pixel ancillary extracts when a masked copy blocks the whole word 2026-10-09 16:25:28 -06:00
Michon d8b1ad71d8 fix(recompiler): lower the ancillary word only where every reader extracts a modelled field
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 00:11:23 +02:00
Michon 9905f5ddd7 feat(recompiler): pixel ancillary word used whole
A use of the packed ancillary VGPR other than a constant field extract (the word passed through a
select before its sample number is extracted) reads the word rebuilt from the sample number (bit 8)
and the render target index (bit 16). Extracts of other bits straight from the word stay refused, and
the refusal now names the uses.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 00:11:13 +02:00
Michon 3d014251a5 fix(shader): lower only exact sample id and layer field extracts of the packed pixel ancillary
Any other live use of the packed register keeps throwing, as on main, instead of
reading SampleId << 8 | Layer << 16 with the other bits zero. The field range
check no longer underflows for an extract that starts past a field's end.
Adds the pixel_ancillary recompiler test.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 17:18:02 +02:00
Michon 5a6e2b8eb5 fix(shader): packed pixel ancillary as SampleId and Layer, gl_Layer via Geometry, Z export formats
Bit-field extracts of the packed ancillary VGPR become gl_SampleID and gl_Layer reads. A pixel
shader reading gl_Layer needs the Geometry capability instead of ShaderLayer and SPIR-V 1.5, and
the Geometry capability is available whenever the geometryShader feature is. 32-bit
SPI_SHADER_Z_FORMATs and 32_ABGR are accepted with the depth and sample-mask export enables.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 17:18:02 +02:00
boykopovar 38fdbc2a55 feat(shader): constants folding + dead code eliminating 2026-09-17 12:45:10 +03:00
boykopovar d084eed394 feat(shader): rdna memory op decoder impl 2026-09-15 07:07:50 +03:00
Renamed from core/shader/recompilier/Optimization/src/ConstantFolder.cpp (Browse further)