fix(shader): evaluate signed comparisons in SRT expressions #2072

Merged
STUPIDCONTEM merged 1 commit from upstream-pr/2072 into main 2026-10-10 08:07:31 +00:00
STUPIDCONTEM commented 2026-10-09 06:51:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by STUPIDCONTEM on 2026-10-09T06:51:54Z.


Evidence review (2026-10-09)

Game/title evidence has not been established. Validation below is host regression/build evidence only; it does not establish title compatibility. Older checked items and test results describe their stated revisions, not current merge readiness.

Game/title ID: none verified. No PS5 title execution is claimed.

What

The generic shader-resource evaluator cannot resolve descriptor expressions containing SLessThan32, even though the IR translator and SPIR-V backend support that comparison. Add signed 32-bit comparison of the operand bit patterns, returning the existing Boolean encoding.

This implements the specific missing operation identified by johnmaia in the EVO PLAYER report. Semantics follow the normative SPIR-V OpSLessThan instruction, which the existing EmitSLessThan32 backend emits. No new instruction decoding or shader fallback is introduced.

Tested

Windows 10 Pro 19045, WinLibs GCC 15.2.0 UCRT posix SEH r7, Release, BUILD_TESTING=ON. Independent branch from f145139676a48306681d3a4d5fabf83938759daf.

  • Extended agc_shader_memory calls the actual runtime descriptor evaluator with signed comparisons beneath SelectU32 descriptor dwords. Inputs INT_MIN, -1, 0 and INT_MAX exercise both signed order and equality boundaries for x<0, INT_MIN<x and x<INT_MAX.
  • The regression fails on unchanged upstream with an unevaluable descriptor expression and passes three focused runs with this change.
  • Default and explicit libs builds passed; full CTest: 488/488, 27.59 seconds. Committed-head conventions, whitespace and test-registration checks passed.
  • Parent independently reviewed source semantics, wired the regression into the test runner and verified baseline/fixed behavior; another agent reviewed the signed boundary expectations.

No native RDNA2/PS5 measurement or title run was performed. The hardware-validation limitation is recorded in TechnicalDebt. This is a narrow evaluator fix, not a claim that EVO PLAYER renders end to end.

Open #1341 adds a compiled SRT-expression path but does not whitelist this signed opcode; this remains available through its generic fallback. #757 changes image-table offsets and #2071 prepares combined shader layouts; neither implements this operator.

Checklist

  • Based on current main; no other open PR implements the same change
  • One topic per PR; follow-ups go in a new PR
  • No comments added to code; hardware-validation limitation recorded in TechnicalDebt
  • Unimplemented paths throw; no silent stubs added
  • No investigation notes, reports or images added to the repository
  • No third-party code added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes; parent independently reviewed and tested the final change.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4797110549 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2072). Originally posted by [STUPIDCONTEM](https://github.com/STUPIDCONTEM) on 2026-10-09T06:51:54Z. --- ### Evidence review (2026-10-09) Game/title evidence has not been established. Validation below is host regression/build evidence only; it does not establish title compatibility. Older checked items and test results describe their stated revisions, not current merge readiness. Game/title ID: **none verified**. No PS5 title execution is claimed. ### What The generic shader-resource evaluator cannot resolve descriptor expressions containing `SLessThan32`, even though the IR translator and SPIR-V backend support that comparison. Add signed 32-bit comparison of the operand bit patterns, returning the existing Boolean encoding. This implements the specific missing operation identified by johnmaia in the [EVO PLAYER report](https://github.com/boykopovar/AnyPS5/issues/1578#issuecomment-6072163434). Semantics follow the normative [SPIR-V OpSLessThan instruction](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpSLessThan), which the existing `EmitSLessThan32` backend emits. No new instruction decoding or shader fallback is introduced. ### Tested Windows 10 Pro 19045, WinLibs GCC 15.2.0 UCRT posix SEH r7, Release, BUILD_TESTING=ON. Independent branch from `f145139676a48306681d3a4d5fabf83938759daf`. - Extended `agc_shader_memory` calls the actual runtime descriptor evaluator with signed comparisons beneath `SelectU32` descriptor dwords. Inputs INT_MIN, -1, 0 and INT_MAX exercise both signed order and equality boundaries for x<0, INT_MIN<x and x<INT_MAX. - The regression fails on unchanged upstream with an unevaluable descriptor expression and passes three focused runs with this change. - Default and explicit `libs` builds passed; full CTest: **488/488**, 27.59 seconds. Committed-head conventions, whitespace and test-registration checks passed. - Parent independently reviewed source semantics, wired the regression into the test runner and verified baseline/fixed behavior; another agent reviewed the signed boundary expectations. No native RDNA2/PS5 measurement or title run was performed. The hardware-validation limitation is recorded in TechnicalDebt. This is a narrow evaluator fix, not a claim that EVO PLAYER renders end to end. Open #1341 adds a compiled SRT-expression path but does not whitelist this signed opcode; this remains available through its generic fallback. #757 changes image-table offsets and #2071 prepares combined shader layouts; neither implements this operator. ### Checklist - [x] Based on current `main`; no other open PR implements the same change - [x] One topic per PR; follow-ups go in a new PR - [x] No comments added to code; hardware-validation limitation recorded in TechnicalDebt - [x] Unimplemented paths throw; no silent stubs added - [x] No investigation notes, reports or images added to the repository - [x] No third-party code added - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes; parent independently reviewed and tested the final change.
adriadam10 commented 2026-10-10 05:59:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T05:59:20Z.

Review: CHANGES_REQUESTED


Checked: the SLessThan32 case in SrtEvaluator.cpp is correct and the new verifySignedSrtComparison test fails on main and passes with the change (built and ran agc_shader_memory plus the AGC/AgcDriver ctest scope locally, all green).

Two things to fix before this can merge:

  • The conventions check fails: the checklist item "Based on current main; no other open PR implements the same change" is unchecked. Please verify it against current main and tick it, and drop the "(historical base; current readiness not asserted)" qualifier, which the check reads as unchecked.
  • docs/dev/TechnicalDebt.md:259 sits right after line 258, which #1873 and #1924 also edit, so it will conflict as soon as one of them lands. Move it a few lines away from that spot (not at the end of the section).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5477878971 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2072#pullrequestreview-5477878971). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T05:59:20Z. **Review:** CHANGES_REQUESTED --- Checked: the `SLessThan32` case in `SrtEvaluator.cpp` is correct and the new `verifySignedSrtComparison` test fails on `main` and passes with the change (built and ran `agc_shader_memory` plus the AGC/AgcDriver ctest scope locally, all green). Two things to fix before this can merge: - The `conventions` check fails: the checklist item "Based on current `main`; no other open PR implements the same change" is unchecked. Please verify it against current `main` and tick it, and drop the "(historical base; current readiness not asserted)" qualifier, which the check reads as unchecked. - `docs/dev/TechnicalDebt.md:259` sits right after line 258, which #1873 and #1924 also edit, so it will conflict as soon as one of them lands. Move it a few lines away from that spot (not at the end of the section).
adriadam10 commented 2026-10-10 08:07:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T08:07:27Z.

Review: APPROVED


Re-checked on the new head: SLessThan32 in SrtEvaluator.cpp is correct (signed compare of the 32-bit patterns), verifySignedSrtComparison fails without the change and passes with it, agc_shader_memory and the AGC/AgcDriver ctest scope are green, no other open PR adds this opcode, and the TechnicalDebt line is now clear of #1873/#1924.

The conventions failure was only the unticked "Based on current main" checklist item with the "historical base" qualifier; I verified it (clean merge onto current main, no overlap) and ticked it in the description. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5478266895 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2072#pullrequestreview-5478266895). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T08:07:27Z. **Review:** APPROVED --- Re-checked on the new head: `SLessThan32` in `SrtEvaluator.cpp` is correct (signed compare of the 32-bit patterns), `verifySignedSrtComparison` fails without the change and passes with it, `agc_shader_memory` and the AGC/AgcDriver ctest scope are green, no other open PR adds this opcode, and the TechnicalDebt line is now clear of #1873/#1924. The `conventions` failure was only the unticked "Based on current `main`" checklist item with the "historical base" qualifier; I verified it (clean merge onto current `main`, no overlap) and ticked it in the description. Merging once CI is green.
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!2072
No description provided.