fix(recompiler): declare pixel shader inputs at their parameter slots #137
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/137"
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 boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-29T00:33:29Z.
What
SPI_PS_INPUT_CNTL_n.OFFSET(bits 0 to 5) names the parameter slot that pixel input n reads. Several inputs may read one slot, and an input may read a slot the vertex stage never exports. With OFFSET bit 5 set andFLAT_SHADEclear, the input is theDEFAULT_VALconstant instead (bits 8 to 9: 0000, 0001, 1110, 1111). With OFFSET bit 5 andFLAT_SHADEboth set, the input is a pass-through: the slot in the low bits is read with its three vertices unchanged, sov_interp_movP0, P10 and P20 return vertices 0, 1 and 2 rather than P0, P1−P0 and P2−P0. The PS5 compiler writes such inputs as 0x422 and 0x423.Main's mapping (
PixelInputLocationinSpirvInputOutput.cpp) mishandled three cases:Now:
BaryCoordKHRand/orBaryCoordNoPerspKHR, each declared only when used).v_interp_p1/p2has no exact translation and throws.DEFAULT_VALconstant and declare nothing. Asking for a defaulted input's Location throws.DescribeFragmentParameters(used by the rect-list shaders) reports the slot as both source and location.The pass-through case was found because PPSA21564's intro video went black: one of its pixel shaders reads input 0x423 (slot 3, flat) with
v_interp_mov p0/p10/p20and unpacks each vertex as 16-bit integers. An earlier revision of this PR treated every OFFSET bit 5 as a default, so that input became the constant 0.A slot the vertex stage never exports is still rejected by validation here. The separate PR
fix/agc-unexported-pixel-inputshandles that.Tested
agc_shader_memorygainsverifyPixelParameterSlots:It fails on the base branch ("inputs reading one slot were not declared once at the slot").
agc_driver_graphics_testspixelParameterSlotTestsruns the same shapes throughDecodePixelStageInfoandValidateShadersagainst a vertex module, including the control words (0x0, 0x400, 0x22, 0x320), and the pass-through case validated against a vertex module that exports slot 3. Without the pass-through change it fails with "a pass-through input (OFFSET bit 5 with FLAT_SHADE) was not read per vertex at its slot". Run on a throwaway merge with #113, where 58/58 pass.ctest: 57/57 pass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-29T01:56:51Z.
Moving this to draft: in a game test, the change it comes from blanks Astro Bot's intro. I'm narrowing down which part is responsible and will update or close this PR.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-29T03:38:22Z.
Ready again. The blank intro came from this PR: OFFSET bit 5 together with FLAT_SHADE means pass-through (the slot's three vertices unchanged), not DEFAULT_VAL. That's fixed and covered by tests; the description is updated.