fix(shader): rect lists take explicitly interpolated fragment parameters and refuse only custom ones #261

Merged
MichonGoddijn231849 merged 1 commit from upstream-pr/261 into main 2026-10-02 19:23:14 +00:00
MichonGoddijn231849 commented 2026-10-01 20:21:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-01T20:21:02Z.


What

With fragment-shader barycentrics (#142), v_interp_p1/p2 interpolate explicitly, so every interpolated fragment parameter is read per vertex (PerVertexKHR). BuildRectListShaders refused every per-vertex parameter (custom per-vertex interpolation is unsupported). On a device with the barycentric feature, every rect-list draw whose fragment shader interpolates a parameter with v_interp_p1/p2 was therefore skipped.

The rect-list tessellation stage writes each generated corner's parameter value: the three input vertices' own, and the fourth corner's from the parallelogram barycentrics. That is what a per-vertex read of the two generated triangles needs, so explicitly interpolated parameters now go through it like the others.

Custom parameters (custom interpolation or passthrough, InputIsCustom) stay refused, since the fourth corner has no value of its own for them. FragmentParameter gains a custom flag for that (also in the disk cache entry), and the rect-list check tests it instead of perVertex.

Graphics.cpp: a per-vertex parameter builds rect-list shaders, and a custom per-vertex one is still refused.

GTA V draws rect lists into its HDR scene target. On current main with an RTX 5080 (which has the barycentric feature) those draws were skipped, and the world rendered black: scene luminance 0, auto-exposure at its upper clamp.

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.

  • GTA V (PPSA04264), North Yankton prologue, with #290–#295, #231, #232 and #249. I read the scene luminance back from its GPU image every frame:
    • Before: 0 (a black world), with Rect-list SPIR-V: custom per-vertex interpolation is unsupported into the HDR target.
    • After: 9–34, the same as with #142 reverted, and no such skips.
  • ctest: all tests pass.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4709126386 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/261). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-01T20:21:02Z. --- ### What With fragment-shader barycentrics (#142), `v_interp_p1/p2` interpolate explicitly, so every interpolated fragment parameter is read per vertex (`PerVertexKHR`). `BuildRectListShaders` refused every per-vertex parameter (`custom per-vertex interpolation is unsupported`). On a device with the barycentric feature, every rect-list draw whose fragment shader interpolates a parameter with `v_interp_p1/p2` was therefore skipped. The rect-list tessellation stage writes each generated corner's parameter value: the three input vertices' own, and the fourth corner's from the parallelogram barycentrics. That is what a per-vertex read of the two generated triangles needs, so explicitly interpolated parameters now go through it like the others. Custom parameters (custom interpolation or passthrough, `InputIsCustom`) stay refused, since the fourth corner has no value of its own for them. `FragmentParameter` gains a `custom` flag for that (also in the disk cache entry), and the rect-list check tests it instead of `perVertex`. `Graphics.cpp`: a per-vertex parameter builds rect-list shaders, and a custom per-vertex one is still refused. GTA V draws rect lists into its HDR scene target. On current `main` with an RTX 5080 (which has the barycentric feature) those draws were skipped, and the world rendered black: scene luminance 0, auto-exposure at its upper clamp. ### Tested Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0. - GTA V (PPSA04264), North Yankton prologue, with #290–#295, #231, #232 and #249. I read the scene luminance back from its GPU image every frame: - Before: 0 (a black world), with `Rect-list SPIR-V: custom per-vertex interpolation is unsupported` into the HDR target. - After: 9–34, the same as with #142 reverted, and no such skips. - `ctest`: all tests pass. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!261
No description provided.