Skip to content

fix(shader): normalize offset perspective barycentrics after interpolation - #7831

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
MarcZX10:codex/fix-perspective-offset-barycentrics-7825
Oct 23, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
MarcZX10:codex/fix-perspective-offset-barycentrics-7825

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Fixes perspective-correct barycentric reads at sample and center offsets when the host lacks native fragment barycentric support. The emulation path interpolates reciprocal clip-W weighted vertex basis values with NoPerspective, then normalizes the selected component to recover perspective-correct barycentrics. Geometry and tessellation emulation layouts are updated, along with shader disk cache format and layout regression checks.

Tested

Linux, AnyPS5 shader recompiler/AGC driver. cmake --build /tmp/AnyPS5-7794-build --target agc_driver_pixel_sample_iteration_tests agc_driver_graphics_tests --parallel 4 passed. python3 tools/check_conventions.py --base upstream/main and git diff --check passed. Targeted CTest launch aborted before test code because this host's Xeon E5-1620 v2 lacks AnyPS5's required AVX2/BMI/FMA CPU features. No RADV GPU is available here; GPU validation remains outstanding.

Checklist

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6858 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 7395 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 8939 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 9457 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 9633 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 9749 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 9790 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 9897 core/shader/recompiler/ShaderDiskCache.cpp L142-143
PR 9969 core/shader/recompiler/ShaderDiskCache.hpp L16
PR 10000 core/shader/recompiler/ShaderDiskCache.hpp L16

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1395 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4072 core/shader/recompiler/Recompiler.cpp
PR 5021 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 5441 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5609 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 6146 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6188 core/shader/recompiler/Recompiler.hpp
PR 6194 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 6412 core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ShaderInfo.hpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6488 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 6539 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6741 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6804 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6924 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 6959 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 6970 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
PR 7201 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 7256 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7410 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
PR 7550 core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 7642 core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ShaderInfo.hpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 7684 core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
PR 8004 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 8077 core/shader/recompiler/ShaderDiskCache.cpp
PR 8395 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8608 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8612 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 8999 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9020 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 9193 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 9335 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 9356 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 9387 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 9412 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9489 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9508 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 9675 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9748 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
core/shader/recompiler/Optimization/src/ShaderInfoCollector.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp
core/shader/recompiler/ShaderDiskCache.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 9852 core/shader/recompiler/Recompiler.hpp
core/shader/recompiler/ShaderDiskCache.cpp

@github-actions github-actions Bot added shader core/shader agc libSceAgc* fix error Closes an issue (Fixes #N) labels Oct 19, 2026
@LeandroLP23

Copy link
Copy Markdown
Contributor

First GPU run, on AMD and Windows. AMD Radeon 860M (RDNA 3.5, 1002:1114), driver 32.0.13058.8001, Windows 11, WinLibs GCC 15.2.0, Release, ANYPS5_NO_SHADER_CACHE=1. Head merged into main 118266a (clean merge). "Main's sources" means this PR's test files over main's other files.

  • agc_driver_pixel_sample_iteration and agc_driver_graphics pass 3 of 3.
  • I couldn't run a before/after: the new Graphics.cpp checks don't build against main's sources. They use the new BarycentricEmulation layout, e.g. reciprocalWLocation.

AI-assisted: yes (Claude Code)

@root-over

Copy link
Copy Markdown
Contributor

RADV run, the case from #7825: Linux (Ubuntu, kernel 7.0), Ryzen 5 5625U iGPU (Vega, RADV RENOIR, Mesa 26.0.8, no fragmentShaderBarycentric), GCC 15.2.0, Release. main 04078b107 against main with this head (c56766911) merged (a clean merge), same build directory. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, ctest -V, each device selected with VK_DRIVER_FILES.

Test main, RADV this PR, RADV main, lavapipe this PR, lavapipe
agc_driver_pixel_sample_iteration Failed Passed Passed Passed
agc_driver_pixel_barycentric_emulation Passed Passed Passed Passed
agc_driver_graphics Passed Passed Passed Passed
agc_fragment_barycentric Passed Passed Passed Passed

On main RADV still fails as reported in #7825: 4x PERSP_SAMPLE, POS and ANCILLARY run once per pixel: pixel (0, 0) slot 0 read the barycentrics (0.001464, 0.998083), expected (0.001473, 0.997545) at (0.375000, 0.125000). With this PR, pixel_sample_iteration and pixel_barycentric_emulation pass 5 of 5 on RADV (--repeat until-fail:5).

None of the four logs contains VUID-. VK_LAYER_KHRONOS_validation isn't installed on this machine, though, so this run doesn't count as a validation-layer comparison.

@savvaniss

Copy link
Copy Markdown
Contributor

AMD and Intel Windows data: the 29 tests built from tests/Graphics.cpp pass with this PR on an AMD RX 9070 XT and an Intel UHD 770.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. This head c56766911 merged into main 85029a00f.

Tests, ×3 UHD 770 RX 9070 XT
This head: the 29 tests built from tests/Graphics.cpp 29 of 29 pass 29 of 29 pass

There is no run without the change: the test diff uses the new BarycentricEmulationLayout::reciprocalWLocation and the new BarycentricEmulation initializer, so it does not build on main alone.

AI-assisted: yes (Claude Code)

@root-over

Copy link
Copy Markdown
Contributor

Follow-up with VK_LAYER_KHRONOS_validation now installed: same machine, same four tests, current main bcdee66d1 against main with c56766911 merged, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -V, on RADV and lavapipe.

  • Results match my earlier run. agc_driver_pixel_sample_iteration fails on main with RADV and passes with this PR. Everything else passes on both builds and both drivers.
  • None of the four logs contains was not found but was requested by env var VK_INSTANCE_LAYERS.
  • Each log has the same 12 VUID-VkGraphicsPipelineCreateInfo-pLibraries-06681 errors, all from agc_driver_pixel_barycentric_emulation, with or without this PR and on both drivers ("descriptor set layout at index 1 ... in the fragment shader state is NULL"). This PR adds no new VUID-. The existing error looks like what fix(agc): keep each descriptor set slot in one of a split pipeline library pair #7722 addresses.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Thanks for the AMD/Windows, RADV, lavapipe, Intel, and validation-layer runs. Together they show the target agc_driver_pixel_sample_iteration regression on main and a pass with this change on RADV and AMD, while the broader graphics tests pass on the reported devices. The 12 VUID-VkGraphicsPipelineCreateInfo-pLibraries-06681 messages reproduce on both versions and are not introduced by this PR. I also note there is no source-only baseline for the new-layout tests because they depend on this PR’s BarycentricEmulation layout.

@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 19, 2026
@MarcZX10
MarcZX10 force-pushed the codex/fix-perspective-offset-barycentrics-7825 branch from c567669 to 53643d3 Compare October 20, 2026 08:04
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 20, 2026
@MarcZX10

Copy link
Copy Markdown
Contributor Author

Rebased this PR onto current main as 53643d3b. The conflict resolution keeps both this change’s reciprocal-W interpolation and main’s mesh barycentric position inputs; the cache encoder/decoder preserve both metadata additions in matching order. check_conventions.py and git diff --check pass on the new head. The AMD, Intel, RADV and lavapipe test results above were from c56766911, before rebase, and have not been rerun on this head. This host cannot run the focused test executables because its Xeon E5-1620 v2 lacks the project’s required AVX2/BMI/FMA features; the filesystem also has only 1.2 GiB free, so a clean rebuild is not available here.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Rebased this PR onto current main as 53643d3. The conflict resolution keeps both this change’s reciprocal-W interpolation and main’s mesh barycentric position inputs; the cache encoder/decoder preserve both metadata additions in matching order. check_conventions.py and git diff --check pass on the new head. The AMD, Intel, RADV and lavapipe test results above were from c567669, before rebase, and have not been rerun on this head. This host cannot run the focused test executables because its Xeon E5-1620 v2 lacks the project’s required AVX2/BMI/FMA features; the filesystem also has only 1.2 GiB free, so a clean rebuild is not available here.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked against current main: the reciprocal-W normalization and main's mesh barycentric inputs still coexist, and the merge is clean. One point left:

  • core/shader/recompiler/ShaderDiskCache.hpp:16: the PR adds ShaderInfo::smoothOffsetBarycentrics and BarycentricEmulation::smoothOffset to the serialized format but doesn't bump FormatVersion (still 41 on main), so existing v41 caches would be decoded misaligned. Bump it to 42.

With that, this is ready to merge.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Addressed the cache-format review in b4b231470e: the changed ShaderInfo and BarycentricEmulation serialization now use format version 44, and the existing disk-cache test verifies that the immediately previous format is rejected.

I used 44 rather than 42 because two other open cache-format changes already occupy the intervening versions: #7689 uses 43, and #6924 also changes serialized cache records. This keeps the format identifier distinct regardless of merge order. The code change is one focused commit; I did not add merge or empty commits.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Thanks for catching the cache compatibility issue. The current head b4b231470e bumps ShaderDiskCache::FormatVersion from 41 to 44, so existing v41 entries are rejected instead of decoded with the added fields. I used 44 because the open #6924 and #7689 branches reserve 42 and 43 respectively. The updated head passes the local conventions check and git diff --check.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

The current PR head b4b231470e already addresses this: fix(shader): bump cache format for barycentric metadata changes FormatVersion from 41 to 44. I verified the current head file. This is above the requested 42 because main has advanced the cache format since the review. Could you recheck the current head and update the review state if this resolves your remaining concern?

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@adriadam10 could you take another look? Your remaining point is addressed on b4b2314: ShaderDiskCache.hpp now bumps FormatVersion to 44 for the new smoothOffsetBarycentrics / smoothOffset fields, and the serialization matches it. From our side the change reads correctly: offset smooth barycentrics are interpolated as lambda/w without perspective and then normalized, so they come out perspective-correct, and the path only runs where barycentrics are emulated.

Once you're happy, it goes to full CI on this head. Several open PRs bump the same FormatVersion, so whichever lands later takes the next free number.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

The cache-format issue is fixed on current head b4b231470e21d852a1d000e067660ec006f86a98; it uses format version 44 so the newly serialized barycentric fields do not collide with the other open version bumps. The exact-head focused Linux tests and validation comparison are in the thread, and the separate runtime check reports the targeted pixel-sample test passing on RADV. Could you re-review this head and confirm the cache-version point is clear?

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 21, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rechecked the current head b4b231470e21d852a1d000e067660ec006f86a98: the serialized barycentric fields now bump the cache format from 41 to 44, so the v41 misdecode concern is addressed. The author-facing follow-ups here have asked for a re-review several times; reviewer adriadam10 should now be able to dismiss the old CHANGES_REQUESTED state if satisfied.

@MarcZX10
MarcZX10 force-pushed the codex/fix-perspective-offset-barycentrics-7825 branch from b4b2314 to b67f0d2 Compare October 21, 2026 01:42
@MarcZX10

Copy link
Copy Markdown
Contributor Author

Rebased the PR onto current main (557682ca44b08c51e5a51a42ecb2d8a9e3d41f9c) after resolving the sole conflict in ShaderDiskCache.hpp. Current main uses format 42; this PR keeps format 44 because the new serialized barycentric fields need their own invalidating version above the intervening open format changes. The two original commits remain authored by MarcZX10. git diff --check and python3 tools/check_conventions.py --base upstream/main pass on head b67f0d277d5da3a216b5bf09626598c3242c6ad7. The CI checks have not completed yet.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

CI has now completed on exact head b67f0d2: eligibility, conventions, labels and the progress report pass. Runtime build jobs (Linux, Windows, relinker, register-context and write-watch) were skipped by workflow gating, so this is not a runtime validation result. The outstanding review state is still the cache-version request; current main is format 42 and this PR uses 44 to avoid the other open serialization changes.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 21, 2026
@thuanquang

Copy link
Copy Markdown
Contributor

A Windows GPU run, since the PR's runtime CI jobs were skipped. It ran on an RX 6700 XT (gfx1031), AMD Windows driver 32.0.21045.5002, Windows 11 26200, MinGW GCC 15.2.0, Release, ANYPS5_REQUIRE_VULKAN=1, comparing main ec7eacc62 with main merged with this head b67f0d277 (the merge is clean).

AMD's driver reports fragmentShaderBarycentric, so the emulation path doesn't run here by default. For the emulation runs I forced it locally: FragmentShaderBarycentricUsable returned false, a change that is not committed.

Four tests: agc_driver_pixel_sample_iteration, agc_driver_pixel_barycentric_emulation, agc_driver_mesh_barycentric_emulation and agc_driver_pixel_sample_coverage. All four pass 3 of 3 in every setup:

Tree Path Result
main emulation forced 4 of 4, 3 runs
this PR native barycentrics 4 of 4, 3 runs
this PR emulation forced 4 of 4, 3 runs

agc_driver_pixel_sample_iteration runs all 21 draws under emulation.

So AMD's proprietary compiler doesn't show the RADV behaviour from #7825: main's emulation already passes there, and this PR keeps it passing on both paths.

Not run: the validation layer, RADV, and titles.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 21, 2026
@MarcZX10

Copy link
Copy Markdown
Contributor Author

Thanks for the independent Windows GPU matrix. The forced emulation runs exercise the path implicated by #7825 on gfx1031, while the native runs check the driver-supported path; the 3/3 results are useful and clearly scoped. I have asked @adriadam10 to reassess the cache-version correction and this additional evidence together.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 21, 2026

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The normalization and the serialized-field changes look right. One point left:

  • core/shader/recompiler/ShaderDiskCache.hpp:16: main already reached FormatVersion 44, so the PR's 44 no longer invalidates anything and v44 caches would be decoded misaligned. Bump it to 45 (the existing test then still checks the previous version is rejected).

With that, this is ready to merge.

@ryanc2112

Copy link
Copy Markdown
Contributor

RADV / Polaris run at b67f0d277: this device has no fragmentShaderBarycentric, so the pixel shader takes the barycentric emulation path natively, the #7825 case. SteamOS 3.8.28, AMD Radeon RX 570 (RADV POLARIS10), Mesa 26.2.5, GCC 16.2.1, Release, merged onto main 4777caca3 (clean) vs main, with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.

AI-assisted: yes.

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Updated the cache format to 45 on this PR so it invalidates v44 entries containing the old serialized layout, as requested in the latest review. The other active schema changes need merge-order coordination: #9889 and #9897 also currently set 45, while #9852 changes serialized fields but currently leaves the format at 44. If another schema change lands first, this branch will need to rebase and use the next version on the resulting main. Please coordinate the merge order; this update is based on current main at v44.

@adriadam10
adriadam10 force-pushed the codex/fix-perspective-offset-barycentrics-7825 branch from bd2d457 to 62bd463 Compare October 23, 2026 05:12
@adriadam10
adriadam10 merged commit 0db47b2 into boykopovar:main Oct 23, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

The cache format is now 45 as requested (main is at 44, so v44 entries are invalidated; the existing disk-cache test checks the previous version is rejected). The only conflict with main was FormatVersion; rebased onto current main and built and ran the tests there. Reciprocal-W normalization and the encoder/decoder field order checked again; merged.

oneandonlydean pushed a commit that referenced this pull request Nov 21, 2026
Keeps this branch's FormatVersion above main's 45 (#7831's barycentric bump).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* fix error Closes an issue (Fixes #N) shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agc_driver_pixel_sample_iteration fails on RADV without fragmentShaderBarycentric: InterpolateAtOffset of perspective barycentrics is extrapolated

8 participants