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

Merged
MarcZX10 merged 2 commits from upstream-pr/7831 into main 2026-10-23 05:37:02 +00:00
MarcZX10 commented 2026-10-19 09:29:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T09:29:32Z.


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

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: #7825
  • Unblocks: none
  • GPUs tested: n/a; no GPU tests ran in this environment
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4918796992 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-19T09:29:32Z. --- ### 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 - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: #7825 - [x] Unblocks: none - [x] GPUs tested: n/a; no GPU tests ran in this environment - [x] AI-assisted: yes
LeandroLP23 commented 2026-10-19 10:44:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-19T10:44:02Z.


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 118266aec (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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6265382657 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6265382657). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-19T10:44:02Z. --- 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` 118266aec (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 commented 2026-10-19 14:11:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by root-over on 2026-10-19T14:11:39Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6269269566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6269269566). Originally posted by [root-over](https://github.com/root-over) on 2026-10-19T14:11:39Z. --- 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 commented 2026-10-19 14:32:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T14:32:31Z.


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)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6269726979 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6269726979). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-19T14:32:31Z. --- 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 commented 2026-10-19 14:32:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by root-over on 2026-10-19T14:32:59Z.


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 #7722 addresses.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6269736867 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6269736867). Originally posted by [root-over](https://github.com/root-over) on 2026-10-19T14:32:59Z. --- 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 #7722 addresses.
MarcZX10 commented 2026-10-19 16:52:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T16:52:06Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6272473800 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6272473800). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-19T16:52:06Z. --- 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.
MarcZX10 commented 2026-10-20 08:04:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T08:04:58Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6286391409 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6286391409). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T08:04:58Z. --- 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 commented 2026-10-20 08:05:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T08:05:09Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6286395073 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6286395073). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T08:05:09Z. --- 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.
adriadam10 commented 2026-10-20 11:26:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T11:26:27Z.

Review: CHANGES_REQUESTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5584355731 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#pullrequestreview-5584355731). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-20T11:26:27Z. **Review:** CHANGES_REQUESTED --- 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 commented 2026-10-20 18:14:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T18:14:27Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6297886140 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6297886140). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T18:14:27Z. --- 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 commented 2026-10-20 18:44:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T18:44:02Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6298489746 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6298489746). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T18:44:02Z. --- 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 commented 2026-10-20 20:39:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T20:39:18Z.


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?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300973755 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6300973755). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T20:39:18Z. --- 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 commented 2026-10-20 21:10:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T21:10:39Z.


@adriadam10 could you take another look? Your remaining point is addressed on b4b231470e: 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6301563543 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6301563543). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T21:10:39Z. --- @adriadam10 could you take another look? Your remaining point is addressed on b4b231470e: `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 commented 2026-10-20 22:40:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T22:40:03Z.


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?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6303376026 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6303376026). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T22:40:03Z. --- 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?
MarcZX10 commented 2026-10-21 01:37:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T01:37:51Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5593929638 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#pullrequestreview-5593929638). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T01:37:51Z. **Review:** COMMENTED --- 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 commented 2026-10-21 01:43:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T01:43:03Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6305925743 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6305925743). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T01:43:03Z. --- 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 commented 2026-10-21 01:44:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T01:44:48Z.


CI has now completed on exact head b67f0d277d5da3a216b5bf09626598c3242c6ad7: 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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6305948651 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6305948651). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T01:44:48Z. --- CI has now completed on exact head b67f0d277d5da3a216b5bf09626598c3242c6ad7: 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.
thuanquang commented 2026-10-21 06:40:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-21T06:40:16Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309787418 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6309787418). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-21T06:40:16Z. --- 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.
MarcZX10 commented 2026-10-21 07:27:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T07:27:38Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310527977 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6310527977). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T07:27:38Z. --- 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.
adriadam10 commented 2026-10-21 17:47:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T17:47:18Z.

Review: CHANGES_REQUESTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5603874406 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#pullrequestreview-5603874406). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-21T17:47:18Z. **Review:** CHANGES_REQUESTED --- 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 commented 2026-10-22 14:44:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ryanc2112 on 2026-10-22T14:44:47Z.


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.

  • agc_driver_pixel_sample_iteration on main fails with the numbers 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 the PR: pixel sample iteration tests passed (21 draws), 3/3.
  • Interpolation / barycentric / sample-order set (11 tests): the only difference is pixel_sample_iteration fail → pass; the remaining failure, sample_order_recipe_depth_locations (#9759), fails the same on both.
  • All agc_* + texture_format_lookup (867 on both): failures 5 on main → 4 with the PR, the only change being pixel_sample_iteration. No new failures; identical validation output (6× VUID-VkWriteDescriptorSet-descriptorType-00337 on both, from #9759's test).

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6343583827 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7831#issuecomment-6343583827). Originally posted by [ryanc2112](https://github.com/ryanc2112) on 2026-10-22T14:44:47Z. --- **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`. - `agc_driver_pixel_sample_iteration` on `main` fails with the numbers 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 the PR: `pixel sample iteration tests passed (21 draws)`, 3/3. - Interpolation / barycentric / sample-order set (11 tests): the only difference is `pixel_sample_iteration` fail → pass; the remaining failure, `sample_order_recipe_depth_locations` (#9759), fails the same on both. - All `agc_*` + `texture_format_lookup` (867 on both): failures 5 on `main` → 4 with the PR, the only change being `pixel_sample_iteration`. No new failures; identical validation output (6× `VUID-VkWriteDescriptorSet-descriptorType-00337` on both, from #9759's test). AI-assisted: yes.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!7831
No description provided.