Repository navigation
fix(recompiler): declare pixel shader inputs at their parameter slots - #137
Merged
boykopovar merged 2 commits intoOct 1, 2026
Merged
boykopovar merged 2 commits into
boykopovar merged 2 commits into
Conversation
oneandonlydean
marked this pull request as draft
September 29, 2026 01:56
Collaborator
Author
|
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. |
6 tasks done
9 tasks done
oneandonlydean
force-pushed
the
fix/pixel-inputs-at-parameter-slots
branch
from
September 29, 2026 03:38
8e7b935 to
ee7ddfd
Compare
oneandonlydean
marked this pull request as ready for review
September 29, 2026 03:38
Collaborator
Author
|
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. |
oneandonlydean
force-pushed
the
fix/pixel-inputs-at-parameter-slots
branch
from
September 29, 2026 21:59
ee7ddfd to
e37ea6e
Compare
oneandonlydean
force-pushed
the
fix/pixel-inputs-at-parameter-slots
branch
2 times, most recently
from
September 30, 2026 11:12
aa4e59b to
dd9f57b
Compare
SPI_PS_INPUT_ENA/ADDR with PERSP_CENTROID (bit 2) or LINEAR_CENTROID (bit 6) was rejected; PPSA21564 binds 0x326 (perspective center and centroid, linear center, POS_X/Y). The PS input VGPR layout now follows the hardware rule: SPI_PS_INPUT_ADDR places every input it names in SPI order (two VGPRs per I/J pair, three for the pull model, one otherwise), loaded or not, and ENA & ADDR selects the loaded ones. ShaderPixelStageInfo carries inputAddr (replacing perspectiveCenterVgpr) plus perspectiveCentroid and linearCentroid; the recompiler places each loaded input with PixelInputVgpr. This also fixes the system inputs, which were always written from v0 (psSystemInputBase was never set), so POS_X overwrote the center I in any draw with barycentrics enabled. Draws are rasterized single-sampled, where the centroid is the pixel center: with fragment barycentrics the centroid pairs carry the center barycentrics (BaryCoordKHR for perspective; the linear center and centroid pairs now get BaryCoordNoPerspKHR). NoPerspective was decided for every parameter by one flag (LINEAR_CENTER loaded). v_interp_p2 now records whether it reads the J of a linear or a perspective pair, and a parameter is NoPerspective when it is read through a linear pair; parameters read through neither keep the old rule. A parameter read through both kinds of pair throws. Only pixel stages consult this. The request serializer moves to version 5 (older requests read back with their loaded inputs as the layout); the cache key and the driver's draw key compare and hash the new fields. The unsupported-input error names ENA and ADDR.
SPI_PS_INPUT_CNTL_n.OFFSET (bits 0-5) names the parameter slot pixel
input n reads, so several inputs may read one slot and an input may read
a slot the vertex stage never exports. With OFFSET bit 5 set and
FLAT_SHADE clear the input is the DEFAULT_VAL constant instead (bits 8-9:
0000, 0001, 1110, 1111). With OFFSET bit 5 and FLAT_SHADE both set the
slot in the low bits is passed through with its three vertices unchanged:
v_interp_mov P0, P10 and P20 read vertices 0, 1 and 2 rather than P0,
P1-P0 and P2-P0. The PS5 compiler writes such inputs as 0x422 and 0x423.
The old mapping masked OFFSET to five bits, so a defaulted input landed
on a real slot, and gave the second of two inputs reading one slot either
the same Location (two variables, "duplicate shader interface location")
or, when one was flat, a free Location the vertex stage never wrote
("graphics interfaces disagree at location N").
Now one input variable is declared per slot actually read, at Location =
slot, and inputs reading that slot share it. A slot read both flat and
interpolated (or through the perspective and linear pairs) is read per
vertex: flat readers take the provoking vertex, the others interpolate
with the barycentrics of their own pair. Pass-through inputs are read per
vertex at their slot without subtracting vertex 0, and reading one with
v_interp_p1/p2 is refused. Defaulted inputs read their DEFAULT_VAL
constant and declare nothing; inputs the program never reads are no
longer declared.
oneandonlydean
force-pushed
the
fix/pixel-inputs-at-parameter-slots
branch
from
September 30, 2026 19:48
dd9f57b to
6a33a3d
Compare
8 of 9 tasks
9 tasks done
pidsmandaks-ux
added a commit
to pidsmandaks-ux/AnyPS5
that referenced
this pull request
Oct 1, 2026
Import generic pixel-input compatibility fixes from upstream PRs boykopovar#136 and boykopovar#137.
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Oct 1, 2026
…opovar#208 test layout, our merged PRs) into astrobot Conflicts resolved: - Driver.cpp: upstream split it into Execution/src/Driver/*; astrobot's driver changes are ported into the split files (flip throttle APS5_MAX_QUEUED_FLIPS, dispatch tolerance, NoteProgram, metadata-pass switch and DB HTILE blits, depth state in the draw register key, HTILE fill clears, wait outcome counters, opt-in deferred EOP interrupts). boykopovar#192's KnownDrawRejection is taken. - Our merged PRs take upstream's reviewed versions: boykopovar#124 shader fusion, boykopovar#128 videoout open param, boykopovar#132 CB metadata passes, boykopovar#138 EOP events, boykopovar#176 GE_INDX_OFFSET, boykopovar#136/boykopovar#137 pixel inputs and NoPerspective by I/J pair, boykopovar#133 mesh tests. boykopovar#142's interpolation validation is upstream's. - Depth: astrobot's DepthTarget model stays; upstream's DepthSurface module is dropped again, boykopovar#188's 16-bit depth-bit reads are kept on top. - Videodec2: upstream's ffmpeg-core version (boykopovar#42 rework); 3rdparty/FFmpeg stays for libSceAvPlayer only. - Tests follow boykopovar#208's layout (add_test_executable, build/tests); the AvPlayer, GDS and wave tests are defined the same way. - Shader disk cache format 5 and request serialization version 7 cover both sides' fields. - Duplicates the auto-merge produced (state decoders, RequestInputInfo, structurizer helpers, image offsets, opcode enum, tests) are removed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 test(agc): link agc_driver_graphics_tests again, run it under ctest and bring its stale expectations up to date #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 repository