fix(libSceAgcDriver): accept unclamped normalized color target formats #6875

Merged
pushkarreddyy merged 1 commit from upstream-pr/6875 into main 2026-10-17 20:55:51 +00:00
pushkarreddyy commented 2026-10-16 15:21:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-16T15:21:03Z.


What

Accepts CB_COLOR_INFO normalized color target configurations (UNORM and SNORM) where BLEND_CLAMP (bit 15) is clear when blending is disabled (ENABLE clear or BLEND_BYPASS set). Vulkan converts unblended shader values and clamps to the normalized target range automatically. If blending is enabled on an unclamped normalized slot, DecodeState throws with the slot and register context (CB_COLOR_INFO, CB_BLENDn_CONTROL) because Vulkan clamps blend inputs prior to blending whereas AMD hardware with BLEND_CLAMP clear does not.

Tested

Added unit test in core/libs/prx/libSceAgcDriver/tests/Graphics.cpp verifying that an unclamped UNORM color target decodes successfully without blending, and verifying that enabling blending on the unclamped slot throws blending unclamped normalized color is not implemented. Verified that python tools/check_conventions.py --base origin/main passes with zero errors.

Checklist

  • Depends on: none
  • AI-assisted: yes
  • Unblocks: PPSA26344 #675
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4890474325 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-16T15:21:03Z. --- ### What Accepts `CB_COLOR_INFO` normalized color target configurations (UNORM and SNORM) where `BLEND_CLAMP` (bit 15) is clear when blending is disabled (ENABLE clear or `BLEND_BYPASS` set). Vulkan converts unblended shader values and clamps to the normalized target range automatically. If blending is enabled on an unclamped normalized slot, `DecodeState` throws with the slot and register context (`CB_COLOR_INFO`, `CB_BLENDn_CONTROL`) because Vulkan clamps blend inputs prior to blending whereas AMD hardware with `BLEND_CLAMP` clear does not. ### Tested Added unit test in `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` verifying that an unclamped UNORM color target decodes successfully without blending, and verifying that enabling blending on the unclamped slot throws `blending unclamped normalized color is not implemented`. Verified that `python tools/check_conventions.py --base origin/main` passes with zero errors. ### Checklist - [x] Depends on: none - [x] AI-assisted: yes - [x] Unblocks: PPSA26344 #675
github-actions[bot] commented 2026-10-16 15:29:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T15:29:47Z.


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 6194 docs/dev/debt/libSceAgcDriver.md L168
PR 6273 docs/dev/debt/libSceAgcDriver.md L168
PR 6445 docs/dev/debt/libSceAgcDriver.md L168
PR 6492 docs/dev/debt/libSceAgcDriver.md L168
PR 6548 docs/dev/debt/libSceAgcDriver.md L168
PR 6601 docs/dev/debt/libSceAgcDriver.md L168
PR 6636 docs/dev/debt/libSceAgcDriver.md L168
PR 6783 docs/dev/debt/libSceAgcDriver.md L168
PR 6867 docs/dev/debt/libSceAgcDriver.md L168
PR 6887 docs/dev/debt/libSceAgcDriver.md L168
PR 6946 docs/dev/debt/libSceAgcDriver.md L168
PR 6947 docs/dev/debt/libSceAgcDriver.md L168
PR 6959 docs/dev/debt/libSceAgcDriver.md L168
PR 6965 docs/dev/debt/libSceAgcDriver.md L168
PR 6973 docs/dev/debt/libSceAgcDriver.md L168
PR 6987 docs/dev/debt/libSceAgcDriver.md L168
PR 6989 docs/dev/debt/libSceAgcDriver.md L168
PR 6995 docs/dev/debt/libSceAgcDriver.md L168
PR 7002 docs/dev/debt/libSceAgcDriver.md L168
PR 7258 docs/dev/debt/libSceAgcDriver.md L168

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 1191 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4650 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5441 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 5500 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6222 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6297 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6320 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6535 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6563 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6647 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6218863646 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6218863646). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T15:29:47Z. --- <!-- pr-overlap --> 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 6194](https://www.github.com/boykopovar/AnyPS5/pull/6194) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6273](https://www.github.com/boykopovar/AnyPS5/pull/6273) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6445](https://www.github.com/boykopovar/AnyPS5/pull/6445) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6492](https://www.github.com/boykopovar/AnyPS5/pull/6492) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6548](https://www.github.com/boykopovar/AnyPS5/pull/6548) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6601](https://www.github.com/boykopovar/AnyPS5/pull/6601) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6636](https://www.github.com/boykopovar/AnyPS5/pull/6636) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6783](https://www.github.com/boykopovar/AnyPS5/pull/6783) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6867](https://www.github.com/boykopovar/AnyPS5/pull/6867) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6887](https://www.github.com/boykopovar/AnyPS5/pull/6887) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6946](https://www.github.com/boykopovar/AnyPS5/pull/6946) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6959](https://www.github.com/boykopovar/AnyPS5/pull/6959) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6965](https://www.github.com/boykopovar/AnyPS5/pull/6965) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6973](https://www.github.com/boykopovar/AnyPS5/pull/6973) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6987](https://www.github.com/boykopovar/AnyPS5/pull/6987) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6989](https://www.github.com/boykopovar/AnyPS5/pull/6989) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 6995](https://www.github.com/boykopovar/AnyPS5/pull/6995) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 7002](https://www.github.com/boykopovar/AnyPS5/pull/7002) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | | [PR 7258](https://www.github.com/boykopovar/AnyPS5/pull/7258) | `docs/dev/debt/libSceAgcDriver.md` [L168](https://github.com/boykopovar/AnyPS5/blob/922dc8999ea024c9d5bce46049aa22d6dd72f534/docs/dev/debt/libSceAgcDriver.md#L168) | | | 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 1191](https://www.github.com/boykopovar/AnyPS5/pull/1191) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 2434](https://www.github.com/boykopovar/AnyPS5/pull/2434) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4448](https://www.github.com/boykopovar/AnyPS5/pull/4448) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 4650](https://www.github.com/boykopovar/AnyPS5/pull/4650) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 5058](https://www.github.com/boykopovar/AnyPS5/pull/5058) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 5441](https://www.github.com/boykopovar/AnyPS5/pull/5441) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 5500](https://www.github.com/boykopovar/AnyPS5/pull/5500) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6297](https://www.github.com/boykopovar/AnyPS5/pull/6297) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6320](https://www.github.com/boykopovar/AnyPS5/pull/6320) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6535](https://www.github.com/boykopovar/AnyPS5/pull/6535) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6563](https://www.github.com/boykopovar/AnyPS5/pull/6563) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6647](https://www.github.com/boykopovar/AnyPS5/pull/6647) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6808](https://www.github.com/boykopovar/AnyPS5/pull/6808) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` |
jotitadev commented 2026-10-16 16:24:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T16:24:51Z.

Review: COMMENTED


The description reports only the conventions check, so here is a run of the new case.

Machine: NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON. Head c5ccbb0d8 (based on current main 452494439).

Tree agc_driver_graphics
PR passes 2/2
PR test, main's State.cpp fails 2/2: AGC graphics: unclamped normalized color is unsupported

So the new case reaches the removed check and fails without the change. It only decodes the target (DecodeColorBuffer). Nothing draws or blends into an unclamped UNORM target, so this run does not show how blending behaves with BLEND_CLAMP clear.

Not run: Windows, AMD, lavapipe, the full suite, the title from #675.

GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), Ubuntu 26.04

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5550650385 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#pullrequestreview-5550650385). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-16T16:24:51Z. **Review:** COMMENTED --- The description reports only the conventions check, so here is a run of the new case. **Machine:** NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, Ubuntu 26.04, i7-8700, GCC 15.2, Release, `BUILD_TESTING=ON`. Head `c5ccbb0d8` (based on current `main` `452494439`). | Tree | `agc_driver_graphics` | |---|---| | PR | passes 2/2 | | PR test, `main`'s `State.cpp` | fails 2/2: `AGC graphics: unclamped normalized color is unsupported` | So the new case reaches the removed check and fails without the change. It only decodes the target (`DecodeColorBuffer`). Nothing draws or blends into an unclamped UNORM target, so this run does not show how blending behaves with `BLEND_CLAMP` clear. Not run: Windows, AMD, lavapipe, the full suite, the title from #675. GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), Ubuntu 26.04 Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
SandstromPL commented 2026-10-16 17:03:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-16T17:03:18Z.


@pushkarreddyy Thanks for picking up stop 3! For a slot that doesn't blend, I think this draws the same as the console. AMD describes BLEND_CLAMP as a source clamp "prior to blending, in addition to the post-blend clamp" (CIK register reference, p. 233). Without blending, Vulkan writes the shader's value as is (framebuffer.adoc L741-L743) and clamps it to [0, 1] or [-1, 1] when converting it to the normalized format (fundamentals.adoc L1754-L1785), so both should end up with the same clamped value. Two caveats: that reference is for GFX7 (Sea Islands) and I found no GFX10 description of the bit, and none of this is measured on a console.

The catch is that deleting the Require also lets through a blending UNORM/SNORM slot, and sRGB targets. By the same AMD definition, with the bit clear the CB skips the clamp before blending. Vulkan, though, always clamps the source, destination and factors before blending into a normalized attachment (framebuffer.adoc L745-L749). So a float or FP16 export outside the range can blend differently: SRC_ALPHA/ONE_MINUS_SRC_ALPHA with rgb 2.0 and alpha 0.5 over a 0 destination gives 1.0 by AMD's definition but 0.5 on Vulkan. The debt line's reasoning (Vulkan clamps anyway) holds for a plain UNORM/SNORM write, but for a blended slot that clamp is exactly where the two differ. As jotitadev noted, the new test only decodes the target, so it doesn't cover blending. Since CONTRIBUTING asks that every function either does exactly what it is supposed to or throws, I'd keep refusing the blended one.

Suggestion, against main 143f13055 (its State.cpp is the same as this PR's base). On your branch, the second hunk means putting the Require back with number <= 1u added:

@@ DecodeState, before result.blends[color.exportIndex] = state; (L1261)
+        if (const auto info = read(cx, 0x31c + slot * 0xfu); state.blendEnable && (info & 0x8000u) == 0 && ((info >> 8u) & 7u) <= 1u) {
+            char detail[80];
+            std::snprintf(detail, sizeof(detail), " (CB_COLOR_INFO 0x%08x, CB_BLEND%u_CONTROL 0x%08x)", info, slot, blend);
+            throw std::runtime_error(std::string("AGC graphics: blending unclamped normalized color is not implemented") + detail);
+        }
@@ DecodeColorBuffer (L1420)
-    Require((info & 0x8000u) != 0 || number == 7 || number == 4 || number == 5, "unclamped normalized color is unsupported");
+    Require((info & 0x8000u) != 0 || number <= 1u || number == 7 || number == 4 || number == 5, "unclamped normalized color is unsupported");

This accepts UNORM/SNORM with BLEND_CLAMP clear when the slot doesn't blend (ENABLE clear or BLEND_BYPASS set), CB metadata passes included. A blended one throws, with its blend state in the message. sRGB stays refused: I found no source for how the post-blend clamp combines with the sRGB encode, and Yōtei's target is UNORM. Your test should still pass with it, since it decodes a UNORM target. I also have host-side tests for the other cases (blending, BLEND_BYPASS, SNORM, sRGB, a fast-clear eliminate, clamped and float targets still blending) and a debt line with the sources. They passed on an older main, and I'll re-run them on current main before sharing. If they're useful, I can send them as a diff or a branch on my fork for you to pull in; I'd rather this land here than open a second PR.

One trade-off to be upfront about: teepean's report got past this stop with a local patch that draws the target clamped, but whether Yōtei's slot actually blends is still open. My question on #675 asking for CB_BLENDn_CONTROL and the export format hasn't had an answer yet. If it does blend, Yōtei would stop here again with the narrower check, so the Unblocks line depends on that answer; the new message would at least show its blend state.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6220604506 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6220604506). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-16T17:03:18Z. --- @pushkarreddyy Thanks for picking up stop 3! For a slot that doesn't blend, I think this draws the same as the console. AMD describes `BLEND_CLAMP` as a source clamp "prior to blending, in addition to the post-blend clamp" ([CIK register reference](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/programmer-references/CIK_3D_registers_v2.pdf), p. 233). Without blending, Vulkan writes the shader's value as is ([framebuffer.adoc L741-L743](https://github.com/KhronosGroup/Vulkan-Docs/blob/193ebe195f47ffc5004683d1659e71c725658c4d/chapters/framebuffer.adoc?plain=1#L741-L743)) and clamps it to [0, 1] or [-1, 1] when converting it to the normalized format ([fundamentals.adoc L1754-L1785](https://github.com/KhronosGroup/Vulkan-Docs/blob/193ebe195f47ffc5004683d1659e71c725658c4d/chapters/fundamentals.adoc?plain=1#L1754-L1785)), so both should end up with the same clamped value. Two caveats: that reference is for GFX7 (Sea Islands) and I found no GFX10 description of the bit, and none of this is measured on a console. The catch is that deleting the `Require` also lets through a **blending** UNORM/SNORM slot, and sRGB targets. By the same AMD definition, with the bit clear the CB skips the clamp before blending. Vulkan, though, always clamps the source, destination and factors before blending into a normalized attachment ([framebuffer.adoc L745-L749](https://github.com/KhronosGroup/Vulkan-Docs/blob/193ebe195f47ffc5004683d1659e71c725658c4d/chapters/framebuffer.adoc?plain=1#L745-L749)). So a float or FP16 export outside the range can blend differently: `SRC_ALPHA`/`ONE_MINUS_SRC_ALPHA` with rgb 2.0 and alpha 0.5 over a 0 destination gives 1.0 by AMD's definition but 0.5 on Vulkan. The debt line's reasoning (Vulkan clamps anyway) holds for a plain UNORM/SNORM write, but for a blended slot that clamp is exactly where the two differ. As jotitadev noted, the new test only decodes the target, so it doesn't cover blending. Since [CONTRIBUTING](https://github.com/boykopovar/AnyPS5/blob/143f130553e02eb10067afebdcb1480a468a220b/CONTRIBUTING.md?plain=1#L6) asks that every function either does exactly what it is supposed to or throws, I'd keep refusing the blended one. Suggestion, against `main` 143f13055 (its `State.cpp` is the same as this PR's base). On your branch, the second hunk means putting the `Require` back with `number <= 1u` added: ```diff @@ DecodeState, before result.blends[color.exportIndex] = state; (L1261) + if (const auto info = read(cx, 0x31c + slot * 0xfu); state.blendEnable && (info & 0x8000u) == 0 && ((info >> 8u) & 7u) <= 1u) { + char detail[80]; + std::snprintf(detail, sizeof(detail), " (CB_COLOR_INFO 0x%08x, CB_BLEND%u_CONTROL 0x%08x)", info, slot, blend); + throw std::runtime_error(std::string("AGC graphics: blending unclamped normalized color is not implemented") + detail); + } @@ DecodeColorBuffer (L1420) - Require((info & 0x8000u) != 0 || number == 7 || number == 4 || number == 5, "unclamped normalized color is unsupported"); + Require((info & 0x8000u) != 0 || number <= 1u || number == 7 || number == 4 || number == 5, "unclamped normalized color is unsupported"); ``` This accepts UNORM/SNORM with `BLEND_CLAMP` clear when the slot doesn't blend (`ENABLE` clear or `BLEND_BYPASS` set), CB metadata passes included. A blended one throws, with its blend state in the message. sRGB stays refused: I found no source for how the post-blend clamp combines with the sRGB encode, and Yōtei's target is UNORM. Your test should still pass with it, since it decodes a UNORM target. I also have host-side tests for the other cases (blending, `BLEND_BYPASS`, SNORM, sRGB, a fast-clear eliminate, clamped and float targets still blending) and a debt line with the sources. They passed on an older `main`, and I'll re-run them on current `main` before sharing. If they're useful, I can send them as a diff or a branch on my fork for you to pull in; I'd rather this land here than open a second PR. One trade-off to be upfront about: teepean's [report](https://github.com/boykopovar/AnyPS5/discussions/675#discussioncomment-18940918) got past this stop with a local patch that draws the target clamped, but whether Yōtei's slot actually blends is still open. My [question on #675](https://github.com/boykopovar/AnyPS5/discussions/675#discussioncomment-18945097) asking for `CB_BLENDn_CONTROL` and the export format hasn't had an answer yet. If it does blend, Yōtei would stop here again with the narrower check, so the Unblocks line depends on that answer; the new message would at least show its blend state. AI-assisted: yes (Claude Code)
pushkarreddyy commented 2026-10-16 17:37:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-16T17:37:53Z.


@SandstromPL Thanks a lot for the detailed architectural review and register references!

I have updated the branch with your suggestion:

  1. In DecodeColorBuffer, restored the Require with
    umber <= 1u added to accept unclamped UNORM and SNORM targets while keeping sRGB refused.
  2. In DecodeState, added the check before
    esult.blends[color.exportIndex] = state; to throw AGC graphics: blending unclamped normalized color is not implemented (CB_COLOR_INFO 0x%08x, CB_BLEND%u_CONTROL 0x%08x) if state.blendEnable is set and BLEND_CLAMP is clear on normalized targets.
  3. Updated unit tests in core/libs/prx/libSceAgcDriver/tests/Graphics.cpp to verify both the unblended UNORM decode and that DecodeState throws when blending is enabled on that slot.
  4. Updated docs/dev/debt/libSceAgcDriver.md and the PR description with the refined blending and hardware clamping rationale.

If you have additional host-side test cases you'd like to include here, please feel free to share the diff or branch and I will gladly integrate them. All CI checks are passing green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6221197633 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6221197633). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-16T17:37:53Z. --- @SandstromPL Thanks a lot for the detailed architectural review and register references! I have updated the branch with your suggestion: 1. In DecodeColorBuffer, restored the Require with umber <= 1u added to accept unclamped UNORM and SNORM targets while keeping sRGB refused. 2. In DecodeState, added the check before esult.blends[color.exportIndex] = state; to throw AGC graphics: blending unclamped normalized color is not implemented (CB_COLOR_INFO 0x%08x, CB_BLEND%u_CONTROL 0x%08x) if state.blendEnable is set and BLEND_CLAMP is clear on normalized targets. 3. Updated unit tests in core/libs/prx/libSceAgcDriver/tests/Graphics.cpp to verify both the unblended UNORM decode and that DecodeState throws when blending is enabled on that slot. 4. Updated docs/dev/debt/libSceAgcDriver.md and the PR description with the refined blending and hardware clamping rationale. If you have additional host-side test cases you'd like to include here, please feel free to share the diff or branch and I will gladly integrate them. All CI checks are passing green.
Dextroid17 commented 2026-10-16 17:54:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-16T17:54:29Z.


@pushkarreddyy The new blending case in cmaskTests() fails on the current head 5406e55ad, before it reaches the check it is meant to make:

AGC graphics: unexpected failure: AGC graphics: missing register in context bank at DWORD 0x105 (261)

makeState() does not set CB_BLEND_RED..CB_BLEND_ALPHA (context 0x105–0x108). Once 0x1e0 turns blending on, DecodeState reads them and throws "missing register" before it gets to the new refusal. expectFailure then rejects that message, because it is not the one it was told to expect. Setting the four registers right after the 0x1e0 line fixes it:

        for (std::uint32_t i = 0; i < 4; ++i) unclamped.context[0x105 + i] = 0;

Run on Linux with lavapipe (Mesa 26.2.4), ctest -R '^agc_driver_graphics$', 3 runs per tree, all on 5406e55ad:

tree                                          result
as is                                         fail, "missing register ... 0x105"
+ the line above                              pass
+ the line above, blend refusal removed       fail, "expected graphics rejection: blending unclamped normalized color is not implemented"
+ the line above, DecodeColorBuffer change     fail, "unclamped normalized color is unsupported"
  reverted
+ the line above, State.cpp from 452494439    fail, "unclamped normalized color is unsupported"

So with that line added, the test passes with your change and fails without either half of it.

The linux build job runs only on pushes to main and manual runs (build.yml L294), so it is skipped on pull requests and the green checks here do not include this test.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6221499320 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6221499320). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-16T17:54:29Z. --- @pushkarreddyy The new blending case in `cmaskTests()` fails on the current head `5406e55ad`, before it reaches the check it is meant to make: ``` AGC graphics: unexpected failure: AGC graphics: missing register in context bank at DWORD 0x105 (261) ``` `makeState()` does not set `CB_BLEND_RED`..`CB_BLEND_ALPHA` (context 0x105–0x108). Once `0x1e0` turns blending on, `DecodeState` reads them and throws "missing register" before it gets to the new refusal. `expectFailure` then rejects that message, because it is not the one it was told to expect. Setting the four registers right after the `0x1e0` line fixes it: ```cpp for (std::uint32_t i = 0; i < 4; ++i) unclamped.context[0x105 + i] = 0; ``` Run on Linux with lavapipe (Mesa 26.2.4), `ctest -R '^agc_driver_graphics$'`, 3 runs per tree, all on `5406e55ad`: ``` tree result as is fail, "missing register ... 0x105" + the line above pass + the line above, blend refusal removed fail, "expected graphics rejection: blending unclamped normalized color is not implemented" + the line above, DecodeColorBuffer change fail, "unclamped normalized color is unsupported" reverted + the line above, State.cpp from 452494439 fail, "unclamped normalized color is unsupported" ``` So with that line added, the test passes with your change and fails without either half of it. The `linux` build job runs only on pushes to `main` and manual runs (`build.yml` L294), so it is skipped on pull requests and the green checks here do not include this test. AI-assisted: yes
pushkarreddyy commented 2026-10-16 18:01:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-16T18:01:17Z.


@Dextroid17 Thank you so much for the precise catch and host verification!

I have updated cmaskTests() in core/libs/prx/libSceAgcDriver/tests/Graphics.cpp to initialize the blend constant context registers (�x105..0x108) right after setting �x1e0, amended the commit, and pushed. All conventions and CI checks are passing green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6221625410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6221625410). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-16T18:01:17Z. --- @Dextroid17 Thank you so much for the precise catch and host verification! I have updated cmaskTests() in core/libs/prx/libSceAgcDriver/tests/Graphics.cpp to initialize the blend constant context registers (�x105..0x108) right after setting �x1e0, amended the commit, and pushed. All conventions and CI checks are passing green.
SandstromPL commented 2026-10-16 18:24:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-16T18:24:38Z.


@pushkarreddyy Thanks for taking the suggestion, and @Dextroid17 for the register catch! Here are the extra host-side cases, as promised, re-run on current main. They're one new function in tests/Graphics.cpp, UnclampedNormalizedColorTests(), called after BlendBypassTests(). The diff below applies to your head 96a2a3890. Beyond what cmaskTests() now covers, it checks:

  • the draw precheck (DrawRejection) and a fast-clear eliminate pass over the unclamped UNORM target;
  • the full message, with CB_COLOR_INFO and CB_BLEND0_CONTROL;
  • BLEND_BYPASS on a blending slot;
  • SNORM, accepted without blending and refused with it;
  • sRGB still refused;
  • a clamped UNORM target and a 16 float target that still blend.

Run on Ubuntu 24.04, GCC 13.3, Release, with your head merged into main 93e54cedd (no conflicts). agc_driver_graphics passes 3 of 3 runs on an RTX 3050 Ti (580.178.04) and 3 of 3 on lavapipe. Each change below to State.cpp makes it fail. The last four aren't caught by the current test:

Change to State.cpp agc_driver_graphics fails with
main's version unclamped normalized color is unsupported
also accept sRGB (number == 6) expected graphics rejection: unclamped normalized color is unsupported
blending throw without the UNORM/SNORM test blending unclamped normalized color is not implemented (CB_COLOR_INFO 0x00000708, ...)
accept UNORM only (number == 0u) unclamped normalized color is unsupported (the SNORM case)
message without the register values unexpected failure: ... blending unclamped normalized color is not implemented

Two notes:

  • Your cmaskTests() block overlaps with the first case and the blending case, so keeping it or dropping it both work.
  • On your head alone (base 452494439), agc_driver_graphics stopped here before reaching these cases, on an unrelated ShaderRecompiler::Recompile: VOP2 opcode is not implemented. main's Linux push builds failed the same way at d006610ee and 143f13055, and no longer do on 93e54cedd. Merged with current main, it passes.
Diff (43 lines, tests/Graphics.cpp)
diff --git a/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp b/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
index 0826f9ddd..5c32b8ea9 100644
--- a/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
+++ b/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
@@ -1328,6 +1328,48 @@ void BlendBypassTests() {
     Require(!bypassed.blends.at(0).blendEnable && bypassed.blends.at(0).colorWriteMask != 0, "a target with BLEND_BYPASS still blends");
 }
 
+void UnclampedNormalizedColorTests() {
+    using AgcDriver::Graphics::DecodeState;
+    constexpr std::uint32_t blending = (1u << 30u) | 4u | (5u << 8u);
+    const auto target = [](std::uint32_t info) {
+        auto queue = makeState();
+        for (std::uint32_t constant = 0x105; constant < 0x109; ++constant) queue.context[constant] = 0;
+        queue.context[0x31c] = info;
+        queue.context[0x1b3] = 2;
+        queue.context[0x1b4] = 2;
+        return queue;
+    };
+    auto queue = target(0x0000000cu);
+    auto state = DecodeState(queue);
+    Require(state.colors.size() == 1 && state.colors[0].format == VK_FORMAT_R8G8_UNORM && !state.blends.at(0).blendEnable && state.blends.at(0).colorWriteMask != 0, "an 8_8 UNORM target with BLEND_CLAMP clear (CB_COLOR_INFO 0x0000000c, PPSA26344) was refused without blending");
+    const auto rejection = AgcDriver::Graphics::DrawRejection(queue, false);
+    Require(rejection.empty(), "the precheck refused an unclamped UNORM target that does not blend: " + rejection);
+    Require(AgcDriver::Graphics::DecodeColorBuffer(queue.context, 0).format == VK_FORMAT_R8G8_UNORM, "an unclamped UNORM target was refused outside a draw");
+    auto eliminate = target(0x0000000cu);
+    eliminate.context[0x0] = 0;
+    eliminate.context[0x202] = 0xcc0020;
+    const auto pass = AgcDriver::Graphics::DecodeColorMetadataPass(eliminate);
+    Require(pass.has_value() && pass->mode == AgcDriver::Graphics::ColorMetadataPass::Mode::EliminateFastClear && pass->targets.size() == 1 && pass->targets[0].format == VK_FORMAT_R8G8_UNORM, "a fast-clear eliminate over an unclamped UNORM target was refused");
+    queue.context[0x1e0] = blending;
+    expectFailure([&] { DecodeState(queue); }, "blending unclamped normalized color is not implemented (CB_COLOR_INFO 0x0000000c, CB_BLEND0_CONTROL 0x40000504)");
+    queue.context[0x31c] |= 0x10000u;
+    state = DecodeState(queue);
+    Require(!state.blends.at(0).blendEnable && state.blends.at(0).colorWriteMask != 0, "an unclamped UNORM target with BLEND_BYPASS was refused or blended");
+    queue = target(0x0000010cu);
+    Require(DecodeState(queue).colors.at(0).format == VK_FORMAT_R8G8_SNORM, "an unclamped SNORM target that does not blend was refused");
+    queue.context[0x1e0] = blending;
+    expectFailure([&] { DecodeState(queue); }, "blending unclamped normalized color is not implemented");
+    queue = target(0x00000604u);
+    expectFailure([&] { DecodeState(queue); }, "unclamped normalized color is unsupported");
+    queue = target(0x0000800cu);
+    queue.context[0x1e0] = blending;
+    Require(DecodeState(queue).blends.at(0).blendEnable, "a clamped UNORM target stopped blending");
+    queue = target(0x00000708u);
+    queue.context[0x1e0] = blending;
+    state = DecodeState(queue);
+    Require(state.colors.at(0).format == VK_FORMAT_R16_SFLOAT && state.blends.at(0).blendEnable, "a 16 float target, which keeps BLEND_CLAMP clear, stopped blending");
+}
+
 void OpaqueDestinationAlphaTests() {
     auto queue = makeState();
     for (std::uint32_t constant = 0x105; constant < 0x109; ++constant) queue.context[constant] = 0;
@@ -7844,6 +7886,7 @@ int main(int argc, char** argv) {
         OpaqueDestinationAlphaTests();
         Color1555TargetTests();
         BlendBypassTests();
+        UnclampedNormalizedColorTests();
         CompactedExportTests();
         ReversedComponentOrderTests();
         ReversedComponentOrderBlendTests();

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222037717 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6222037717). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-16T18:24:38Z. --- @pushkarreddyy Thanks for taking the suggestion, and @Dextroid17 for the register catch! Here are the extra host-side cases, as promised, re-run on current `main`. They're one new function in `tests/Graphics.cpp`, `UnclampedNormalizedColorTests()`, called after `BlendBypassTests()`. The diff below applies to your head 96a2a3890. Beyond what `cmaskTests()` now covers, it checks: - the draw precheck (`DrawRejection`) and a fast-clear eliminate pass over the unclamped UNORM target; - the full message, with `CB_COLOR_INFO` and `CB_BLEND0_CONTROL`; - `BLEND_BYPASS` on a blending slot; - SNORM, accepted without blending and refused with it; - sRGB still refused; - a clamped UNORM target and a 16 float target that still blend. Run on Ubuntu 24.04, GCC 13.3, Release, with your head merged into `main` 93e54cedd (no conflicts). `agc_driver_graphics` passes 3 of 3 runs on an RTX 3050 Ti (580.178.04) and 3 of 3 on lavapipe. Each change below to `State.cpp` makes it fail. The last four aren't caught by the current test: | Change to `State.cpp` | `agc_driver_graphics` fails with | |---|---| | `main`'s version | `unclamped normalized color is unsupported` | | also accept sRGB (`number == 6`) | `expected graphics rejection: unclamped normalized color is unsupported` | | blending throw without the UNORM/SNORM test | `blending unclamped normalized color is not implemented (CB_COLOR_INFO 0x00000708, ...)` | | accept UNORM only (`number == 0u`) | `unclamped normalized color is unsupported` (the SNORM case) | | message without the register values | `unexpected failure: ... blending unclamped normalized color is not implemented` | Two notes: - Your `cmaskTests()` block overlaps with the first case and the blending case, so keeping it or dropping it both work. - On your head alone (base 452494439), `agc_driver_graphics` stopped here before reaching these cases, on an unrelated `ShaderRecompiler::Recompile: VOP2 opcode is not implemented`. `main`'s Linux push builds failed the same way at d006610ee and 143f13055, and no longer do on 93e54cedd. Merged with current `main`, it passes. <details><summary>Diff (43 lines, <code>tests/Graphics.cpp</code>)</summary> ```diff diff --git a/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp b/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp index 0826f9ddd..5c32b8ea9 100644 --- a/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/Graphics.cpp @@ -1328,6 +1328,48 @@ void BlendBypassTests() { Require(!bypassed.blends.at(0).blendEnable && bypassed.blends.at(0).colorWriteMask != 0, "a target with BLEND_BYPASS still blends"); } +void UnclampedNormalizedColorTests() { + using AgcDriver::Graphics::DecodeState; + constexpr std::uint32_t blending = (1u << 30u) | 4u | (5u << 8u); + const auto target = [](std::uint32_t info) { + auto queue = makeState(); + for (std::uint32_t constant = 0x105; constant < 0x109; ++constant) queue.context[constant] = 0; + queue.context[0x31c] = info; + queue.context[0x1b3] = 2; + queue.context[0x1b4] = 2; + return queue; + }; + auto queue = target(0x0000000cu); + auto state = DecodeState(queue); + Require(state.colors.size() == 1 && state.colors[0].format == VK_FORMAT_R8G8_UNORM && !state.blends.at(0).blendEnable && state.blends.at(0).colorWriteMask != 0, "an 8_8 UNORM target with BLEND_CLAMP clear (CB_COLOR_INFO 0x0000000c, PPSA26344) was refused without blending"); + const auto rejection = AgcDriver::Graphics::DrawRejection(queue, false); + Require(rejection.empty(), "the precheck refused an unclamped UNORM target that does not blend: " + rejection); + Require(AgcDriver::Graphics::DecodeColorBuffer(queue.context, 0).format == VK_FORMAT_R8G8_UNORM, "an unclamped UNORM target was refused outside a draw"); + auto eliminate = target(0x0000000cu); + eliminate.context[0x0] = 0; + eliminate.context[0x202] = 0xcc0020; + const auto pass = AgcDriver::Graphics::DecodeColorMetadataPass(eliminate); + Require(pass.has_value() && pass->mode == AgcDriver::Graphics::ColorMetadataPass::Mode::EliminateFastClear && pass->targets.size() == 1 && pass->targets[0].format == VK_FORMAT_R8G8_UNORM, "a fast-clear eliminate over an unclamped UNORM target was refused"); + queue.context[0x1e0] = blending; + expectFailure([&] { DecodeState(queue); }, "blending unclamped normalized color is not implemented (CB_COLOR_INFO 0x0000000c, CB_BLEND0_CONTROL 0x40000504)"); + queue.context[0x31c] |= 0x10000u; + state = DecodeState(queue); + Require(!state.blends.at(0).blendEnable && state.blends.at(0).colorWriteMask != 0, "an unclamped UNORM target with BLEND_BYPASS was refused or blended"); + queue = target(0x0000010cu); + Require(DecodeState(queue).colors.at(0).format == VK_FORMAT_R8G8_SNORM, "an unclamped SNORM target that does not blend was refused"); + queue.context[0x1e0] = blending; + expectFailure([&] { DecodeState(queue); }, "blending unclamped normalized color is not implemented"); + queue = target(0x00000604u); + expectFailure([&] { DecodeState(queue); }, "unclamped normalized color is unsupported"); + queue = target(0x0000800cu); + queue.context[0x1e0] = blending; + Require(DecodeState(queue).blends.at(0).blendEnable, "a clamped UNORM target stopped blending"); + queue = target(0x00000708u); + queue.context[0x1e0] = blending; + state = DecodeState(queue); + Require(state.colors.at(0).format == VK_FORMAT_R16_SFLOAT && state.blends.at(0).blendEnable, "a 16 float target, which keeps BLEND_CLAMP clear, stopped blending"); +} + void OpaqueDestinationAlphaTests() { auto queue = makeState(); for (std::uint32_t constant = 0x105; constant < 0x109; ++constant) queue.context[constant] = 0; @@ -7844,6 +7886,7 @@ int main(int argc, char** argv) { OpaqueDestinationAlphaTests(); Color1555TargetTests(); BlendBypassTests(); + UnclampedNormalizedColorTests(); CompactedExportTests(); ReversedComponentOrderTests(); ReversedComponentOrderBlendTests(); ``` </details> AI-assisted: yes (Claude Code)
pushkarreddyy commented 2026-10-16 18:45:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-16T18:45:11Z.


@SandstromPL Thank you so much for putting together this comprehensive test suite!

I have integrated UnclampedNormalizedColorTests() into core/libs/prx/libSceAgcDriver/tests/Graphics.cpp, hooked it into main() right after BlendBypassTests(), cleaned up the initial block in cmaskTests(), rebased on latest origin/main, amended the commit, and pushed. All CI checks are passing green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222390630 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6222390630). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-16T18:45:11Z. --- @SandstromPL Thank you so much for putting together this comprehensive test suite! I have integrated UnclampedNormalizedColorTests() into core/libs/prx/libSceAgcDriver/tests/Graphics.cpp, hooked it into main() right after BlendBypassTests(), cleaned up the initial block in cmaskTests(), rebased on latest origin/main, amended the commit, and pushed. All CI checks are passing green.
pushkarreddyy commented 2026-10-17 11:11:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T11:11:50Z.


@SandstromPL @adriadam10 All test suites provided by SandstromPL are integrated, and the PR is rebased on latest origin/main with all CI checks passing cleanly. Ready for validation/merge when convenient!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6233211077 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6233211077). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-17T11:11:50Z. --- @SandstromPL @adriadam10 All test suites provided by SandstromPL are integrated, and the PR is rebased on latest origin/main with all CI checks passing cleanly. Ready for validation/merge when convenient!
SandstromPL commented 2026-10-17 11:26:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-17T11:26:42Z.


@pushkarreddyy thanks for pulling them in. I validated the current head (9fb282064). Compared with the previous head, it's a pure rebase: State.cpp and the test function are the same.

On Ubuntu 24.04, GCC 13.3, Release:

  • agc_driver_graphics passes 3 of 3 on an RTX 3050 Ti (NVIDIA 580.178.04) and on lavapipe.
  • With main's State.cpp and this PR's tests, it fails with "unclamped normalized color is unsupported", so the tests cover the change.

@adriadam10 from my side it's ready for the full Build.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6233336294 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6233336294). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-17T11:26:42Z. --- @pushkarreddyy thanks for pulling them in. I validated the current head (9fb282064). Compared with the previous head, it's a pure rebase: `State.cpp` and the test function are the same. On Ubuntu 24.04, GCC 13.3, Release: - `agc_driver_graphics` passes 3 of 3 on an RTX 3050 Ti (NVIDIA 580.178.04) and on lavapipe. - With `main`'s `State.cpp` and this PR's tests, it fails with "unclamped normalized color is unsupported", so the tests cover the change. @adriadam10 from my side it's ready for the full Build. AI-assisted: yes (Claude Code)
pushkarreddyy commented 2026-10-17 14:42:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T14:42:50Z.


Thank you @Dextroid17 for the approval and @SandstromPL for the independent validation on both RTX 3050 Ti and lavapipe! Much appreciated!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6235233406 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6235233406). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-17T14:42:50Z. --- Thank you @Dextroid17 for the approval and @SandstromPL for the independent validation on both RTX 3050 Ti and lavapipe! Much appreciated!
Neithennn commented 2026-10-17 16:38:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Neithennn on 2026-10-17T16:38:14Z.


Windows NVIDIA run, since GPUs tested is empty in the description.

Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), AMD Ryzen 7 5800X, WinLibs GCC 15.2.0 r7, Ninja, Release, bundled dependencies, BUILD_TESTING=ON, ANYPS5_NO_SHADER_CACHE=1. Head 9fb282064 merged onto main f51724078; full build succeeds.

  • agc_driver_graphics (which holds the new unclamped UNORM color target checks) passes, with ANYPS5_REQUIRE_VULKAN=1.
  • Color target tests agc_driver_packed_unorm_color_target, agc_driver_color1555_target, agc_driver_srgb8_color_target, agc_driver_uint8x4_color_target, agc_driver_uint8x4_color_target_no_resident: pass.
  • Full ctest -j 8: 1398/1398. Unchanged main on the same machine: 1398/1398.

No title run.

AI-assisted: yes (runs done with Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6236810029 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6875#issuecomment-6236810029). Originally posted by [Neithennn](https://github.com/Neithennn) on 2026-10-17T16:38:14Z. --- Windows NVIDIA run, since `GPUs tested` is empty in the description. Windows 11 Pro 26200, NVIDIA GeForce RTX 4080 (driver 617.42), AMD Ryzen 7 5800X, WinLibs GCC 15.2.0 r7, Ninja, Release, bundled dependencies, `BUILD_TESTING=ON`, `ANYPS5_NO_SHADER_CACHE=1`. Head `9fb282064` merged onto main `f51724078`; full build succeeds. - `agc_driver_graphics` (which holds the new unclamped UNORM color target checks) passes, with `ANYPS5_REQUIRE_VULKAN=1`. - Color target tests `agc_driver_packed_unorm_color_target`, `agc_driver_color1555_target`, `agc_driver_srgb8_color_target`, `agc_driver_uint8x4_color_target`, `agc_driver_uint8x4_color_target_no_resident`: pass. - Full `ctest -j 8`: 1398/1398. Unchanged main on the same machine: 1398/1398. No title run. AI-assisted: yes (runs done with 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!6875
No description provided.