fix(shader): preserve raw fragment exports for integer attachments #6235

Closed
firesand wants to merge 1 commit from upstream-pr/6235 into main
firesand commented 2026-10-15 06:09:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by firesand on 2026-10-15T06:09:42Z.


What

Raw32 fragment exports currently get a floating-point SPIR-V interface even when the color attachment is UINT or SINT: the interface is selected from the export encoding alone, with only UINT16 mode 7 treated as integer. Carry the attachment's numeric type into shader preparation so modes 1/2/3/9 preserve unsigned words or bitcast signed words through matching output interfaces. Keep packed UNORM on its existing logical-float/packing path.

Include the numeric type in draw and shader cache identities, and serialize it in request format 30. Older captures keep their previous automatic mode-based behavior. Reject compressed raw32 integer exports; signed16 mode 8, integer blending and integer alpha-to-coverage remain unsupported.

The GPU regression covers raw signed/unsigned bits, defined-channel mappings, separate UINT/SINT MRTs and one registered shader switching float→UINT→SINT→float without reusing an incompatible interface. It also covers compressed-raw32 refusal and existing UINT16 preparation. Existing graphics fixtures now distinguish integer attachments from float and packed UNORM attachments.

Semantics: AMD's SI register reference, SPI_SHADER_COL_FORMAT at 0x28714, permits float or signed/unsigned integer raw32 formats. Pinned Mesa export lowering preserves the 32-bit values and defines the R/RG/GFX10+RA placement; format selection selects the corresponding raw formats. RDNA2 ISA §11.1/Table 56 defines compressed exports as 16-bit components. Missing-component defaults have not been verified on native hardware; tests exclude those channels and the limitation is recorded in docs/dev/debt/shader.md. Vulkan readbacks do not constitute a native console oracle.

Related work: #5200 changes reversed-component-order blending and touches shared state/cache/serializer files. It does not implement this integer-output fix. No dependency on it is introduced; merging either may require rebasing the other. Targeted open-PR searches found no direct duplicate.

Tested

Release build and patched libs target passed. The final 1,230-test CTest run completed with 1,217 passed, 12 expected device/display skips, and one allocator failure. All changed shader, cache, serialization and graphics tests passed. guest_allocator_failures reports malloc(300 GiB): succeeded despite RLIMIT_DATA; the same unchanged test fails identically on main on this host. Its cause is outside this patch and remains unresolved. CTest therefore exits 8; this is not an all-green run.

  • Base: d92a8dad390af1807cc91622b924252141816a5a; candidate: 911920f04450f7e063235a988fe79681d210e261 (one commit). Remote main was rechecked after validation.
  • Linux/Gentoo, NVIDIA GeForce RTX 4090, driver 615.78.08; Release GCC build with SPIRV-Tools enabled.
  • Baseline reproduction: main's PreparedExports fixture, changed only to use raw mode 9 and run the integer case, fails with runtime export mapping uses the wrong scalar type before drawing. The candidate's --raw32-integer case passes with GPU readback. The two-line baseline patch is included below.
  • Full suite: ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure --timeout 120 -j1; 234.87 seconds. Skip checker accepts all 12 skips: one missing VK_EXT_shader_stencil_export and 11 offscreen display tests.
  • Prepared export GPU tests also pass with APS5_NO_GPL=1. Conventions, test registration (883 executables) and whitespace checks pass. Validation excerpts and the baseline reproduction patch are included below; full JUnit and build logs are retained locally.
  • No performance claim, gameplay-fix claim or game data is included. The earlier Zero Company investigation exercised raw integer targets, but did not establish that this fixes its rendering corruption.
  • Windows, lavapipe and other GPU vendors are not tested locally. Full upstream Linux/Windows PR CI requires a maintainer's manual workflow after submission.

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; silent stubs are unchanged
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4090, driver 615.78.08, Gentoo Linux
  • AI-assisted: yes (OpenAI Codex); source review and test evidence are included
Validation excerpts and baseline reproduction

Final candidate 911920f04, GCC 16.2.1, Gentoo Linux, kernel 7.2.9-cachyos-dist, NVIDIA RTX 4090 driver 615.78.08:

request_serializer: PASS (0.00242282 s)
agc_shader_memory: PASS (1.35515 s)
agc_shader_disk_cache: PASS (1.68978 s)
agc_driver_graphics: PASS (3.67467 s)
agc_driver_front_face_all_bits: PASS (0.150003 s)
agc_driver_prepared_exports: PASS (0.356375 s)
Full suite: 1230 total; 1217 passed; 12 skipped; 1 failed; 234.87 s
Only failure: guest_allocator_failures
malloc(300 GiB): succeeded despite RLIMIT_DATA
12 skips accepted by tools/check_skips.py
Conventions and test registration: PASS

Independent build from base d92a8dad3 with unchanged production code and only this fixture patch:

diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/PreparedExports.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/PreparedExports.cpp
index bdbfd1362..43f397b46 100644
--- a/core/libs/prx/libSceAgcDriver/tests/execution/PreparedExports.cpp
+++ b/core/libs/prx/libSceAgcDriver/tests/execution/PreparedExports.cpp
@@ -28,7 +28,7 @@ void Run(AgcDriver::VulkanDevice& device, bool integer) {
     const auto vertex = Recompile(vertexRequest);
     const std::array<std::uint32_t, 4> values = integer ? std::array<std::uint32_t, 4>{11, 22, 33, 44} : std::array<std::uint32_t, 4>{0, 0x3e800000u, 0x3f000000u, 0x3f800000u};
     const std::array<std::uint32_t, 13> code{0x7e0002ffu, values[0], 0x7e0202ffu, values[1], 0x7e0402ffu, values[2], 0x7e0602ffu, values[3], 0xf800100fu, 0x03020100u, 0xf800183fu, 0x03020100u, 0xbf810000u};
-    AgcDriver::Registers context{{0x1b6, 0x8000}, {0x1b3, 0}, {0x1b4, 0}, {0x203, 0}, {0x1c5, integer ? 0x7007u : 0x9009u}};
+    AgcDriver::Registers context{{0x1b6, 0x8000}, {0x1b3, 0}, {0x1b4, 0}, {0x203, 0}, {0x1c5, integer ? 0x9009u : 0x9009u}};
     RecompileRequest request{{ShaderStage::Fragment, 0x20000, code, 0, {}}, {32, 0, {}, {}, AgcDriver::Graphics::DecodePixelStageInfo(context, {}), {}, {}}, device.Target(), PixelPushLayout(0u, device.Target())};
     const auto handle = PrepareShader(request);
     const auto& artifact = GetPreparedArtifact(*handle);
@@ -117,7 +117,6 @@ int main() {
     try {
         auto device = OpenVulkanTestDevice();
         if (!device) return VulkanTestSkipped;
-        Run(*device, false);
         Run(*device, true);
         std::cout << "prepared fragment export mapping tests passed\n";
     } catch (const std::exception& error) {
cmake --build build --target agc_driver_prepared_exports_tests guest_allocator_failures_tests --parallel 6
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure --timeout 120 -j1 -R "^(agc_driver_prepared_exports|guest_allocator_failures)$"

Baseline results:

guest_allocator_failures: FAIL
malloc(300 GiB): succeeded despite RLIMIT_DATA
agc_driver_prepared_exports: FAIL before Draw
AGC graphics: runtime export mapping uses the wrong scalar type

Candidate direct regression:

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 build/tests/agc_driver_prepared_exports_tests --raw32-integer
prepared exports: type=uint mode=9 shared-registration=0 mixed=0
raw32 integer fragment export tests passed

The candidate fixture supplies the new numeric-type field and checks GPU readback. Main's original API lacks that field; its test-only reproduction checks the resulting SPIR-V scalar mismatch before drawing. No game assets or title-specific patches are required.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4869032932 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6235). Originally posted by [firesand](https://github.com/firesand) on 2026-10-15T06:09:42Z. --- ### What Raw32 fragment exports currently get a floating-point SPIR-V interface even when the color attachment is UINT or SINT: the interface is selected from the export encoding alone, with only UINT16 mode 7 treated as integer. Carry the attachment's numeric type into shader preparation so modes 1/2/3/9 preserve unsigned words or bitcast signed words through matching output interfaces. Keep packed UNORM on its existing logical-float/packing path. Include the numeric type in draw and shader cache identities, and serialize it in request format 30. Older captures keep their previous automatic mode-based behavior. Reject compressed raw32 integer exports; signed16 mode 8, integer blending and integer alpha-to-coverage remain unsupported. The GPU regression covers raw signed/unsigned bits, defined-channel mappings, separate UINT/SINT MRTs and one registered shader switching float→UINT→SINT→float without reusing an incompatible interface. It also covers compressed-raw32 refusal and existing UINT16 preparation. Existing graphics fixtures now distinguish integer attachments from float and packed UNORM attachments. **Semantics:** AMD's [SI register reference](https://www.x.org/docs/AMD/old/SI_3D_registers.pdf), SPI_SHADER_COL_FORMAT at 0x28714, permits float or signed/unsigned integer raw32 formats. Pinned [Mesa export lowering](https://gitlab.freedesktop.org/mesa/mesa/-/blob/234055882d7a25f843369c1022a1f5ed149b90cd/src/gallium/drivers/radeonsi/si_shader_llvm_ps.c#L232-L323) preserves the 32-bit values and defines the R/RG/GFX10+RA placement; [format selection](https://gitlab.freedesktop.org/mesa/mesa/-/blob/234055882d7a25f843369c1022a1f5ed149b90cd/src/amd/common/ac_shader_util.c#L723-L747) selects the corresponding raw formats. [RDNA2 ISA](https://gpuopen.com/download/rdna2-shader-instruction-set-architecture.pdf) §11.1/Table 56 defines compressed exports as 16-bit components. Missing-component defaults have not been verified on native hardware; tests exclude those channels and the limitation is recorded in docs/dev/debt/shader.md. Vulkan readbacks do not constitute a native console oracle. **Related work:** [#5200](https://github.com/boykopovar/AnyPS5/pull/5200) changes reversed-component-order blending and touches shared state/cache/serializer files. It does not implement this integer-output fix. No dependency on it is introduced; merging either may require rebasing the other. Targeted open-PR searches found no direct duplicate. ### Tested Release build and patched `libs` target passed. The final 1,230-test CTest run completed with **1,217 passed, 12 expected device/display skips, and one allocator failure**. All changed shader, cache, serialization and graphics tests passed. `guest_allocator_failures` reports `malloc(300 GiB): succeeded despite RLIMIT_DATA`; the same unchanged test fails identically on main on this host. Its cause is outside this patch and remains unresolved. CTest therefore exits 8; this is not an all-green run. - Base: `d92a8dad390af1807cc91622b924252141816a5a`; candidate: `911920f04450f7e063235a988fe79681d210e261` (one commit). Remote main was rechecked after validation. - Linux/Gentoo, NVIDIA GeForce RTX 4090, driver 615.78.08; Release GCC build with SPIRV-Tools enabled. - Baseline reproduction: main's PreparedExports fixture, changed only to use raw mode 9 and run the integer case, fails with `runtime export mapping uses the wrong scalar type` before drawing. The candidate's `--raw32-integer` case passes with GPU readback. The two-line baseline patch is included below. - Full suite: `ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure --timeout 120 -j1`; 234.87 seconds. Skip checker accepts all 12 skips: one missing `VK_EXT_shader_stencil_export` and 11 offscreen display tests. - Prepared export GPU tests also pass with `APS5_NO_GPL=1`. Conventions, test registration (883 executables) and whitespace checks pass. Validation excerpts and the baseline reproduction patch are included below; full JUnit and build logs are retained locally. - No performance claim, gameplay-fix claim or game data is included. The earlier Zero Company investigation exercised raw integer targets, but did not establish that this fixes its rendering corruption. - Windows, lavapipe and other GPU vendors are not tested locally. Full upstream Linux/Windows PR CI requires a maintainer's manual workflow after submission. ### 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; silent stubs are unchanged - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4090, driver 615.78.08, Gentoo Linux - [x] AI-assisted: yes (OpenAI Codex); source review and test evidence are included <details> <summary>Validation excerpts and baseline reproduction</summary> Final candidate `911920f04`, GCC 16.2.1, Gentoo Linux, kernel 7.2.9-cachyos-dist, NVIDIA RTX 4090 driver 615.78.08: ```text request_serializer: PASS (0.00242282 s) agc_shader_memory: PASS (1.35515 s) agc_shader_disk_cache: PASS (1.68978 s) agc_driver_graphics: PASS (3.67467 s) agc_driver_front_face_all_bits: PASS (0.150003 s) agc_driver_prepared_exports: PASS (0.356375 s) Full suite: 1230 total; 1217 passed; 12 skipped; 1 failed; 234.87 s Only failure: guest_allocator_failures malloc(300 GiB): succeeded despite RLIMIT_DATA 12 skips accepted by tools/check_skips.py Conventions and test registration: PASS ``` Independent build from base `d92a8dad3` with unchanged production code and only this fixture patch: ```diff diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/PreparedExports.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/PreparedExports.cpp index bdbfd1362..43f397b46 100644 --- a/core/libs/prx/libSceAgcDriver/tests/execution/PreparedExports.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/execution/PreparedExports.cpp @@ -28,7 +28,7 @@ void Run(AgcDriver::VulkanDevice& device, bool integer) { const auto vertex = Recompile(vertexRequest); const std::array<std::uint32_t, 4> values = integer ? std::array<std::uint32_t, 4>{11, 22, 33, 44} : std::array<std::uint32_t, 4>{0, 0x3e800000u, 0x3f000000u, 0x3f800000u}; const std::array<std::uint32_t, 13> code{0x7e0002ffu, values[0], 0x7e0202ffu, values[1], 0x7e0402ffu, values[2], 0x7e0602ffu, values[3], 0xf800100fu, 0x03020100u, 0xf800183fu, 0x03020100u, 0xbf810000u}; - AgcDriver::Registers context{{0x1b6, 0x8000}, {0x1b3, 0}, {0x1b4, 0}, {0x203, 0}, {0x1c5, integer ? 0x7007u : 0x9009u}}; + AgcDriver::Registers context{{0x1b6, 0x8000}, {0x1b3, 0}, {0x1b4, 0}, {0x203, 0}, {0x1c5, integer ? 0x9009u : 0x9009u}}; RecompileRequest request{{ShaderStage::Fragment, 0x20000, code, 0, {}}, {32, 0, {}, {}, AgcDriver::Graphics::DecodePixelStageInfo(context, {}), {}, {}}, device.Target(), PixelPushLayout(0u, device.Target())}; const auto handle = PrepareShader(request); const auto& artifact = GetPreparedArtifact(*handle); @@ -117,7 +117,6 @@ int main() { try { auto device = OpenVulkanTestDevice(); if (!device) return VulkanTestSkipped; - Run(*device, false); Run(*device, true); std::cout << "prepared fragment export mapping tests passed\n"; } catch (const std::exception& error) { ``` ```sh cmake --build build --target agc_driver_prepared_exports_tests guest_allocator_failures_tests --parallel 6 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure --timeout 120 -j1 -R "^(agc_driver_prepared_exports|guest_allocator_failures)$" ``` Baseline results: ```text guest_allocator_failures: FAIL malloc(300 GiB): succeeded despite RLIMIT_DATA agc_driver_prepared_exports: FAIL before Draw AGC graphics: runtime export mapping uses the wrong scalar type ``` Candidate direct regression: ```sh ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 build/tests/agc_driver_prepared_exports_tests --raw32-integer ``` ```text prepared exports: type=uint mode=9 shared-registration=0 mixed=0 raw32 integer fragment export tests passed ``` The candidate fixture supplies the new numeric-type field and checks GPU readback. Main's original API lacks that field; its test-only reproduction checks the resulting SPIR-V scalar mismatch before drawing. No game assets or title-specific patches are required. </details>
adriadam10 commented 2026-10-18 19:21:41 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


Thanks, the approach (carry the attachment's numeric type into the request and cache keys) looks right. Points to fix before this can merge:

  • Conflicts with main in 9 files (State.cpp, ShaderValidation.cpp, SpirvModuleEmitter.cpp, Recompiler.hpp, RequestSerializer.cpp, DrawRegisterKey.cpp, Graphics.cpp, ShaderMemory.cpp, RequestSerializerTests.cpp). main is already at request serialization version 32 (this PR bumps 29 to 30), so the version, the base64 prefixes and the byte-level fixtures in RequestSerializerTests.cpp/ShaderMemory.cpp need redoing on top of 32, with older versions still replaying.
  • ColorOutputTypeOf (State.cpp:1081) is incomplete. main already decodes VK_FORMAT_R8G8_UINT (State.cpp:800) but it is missing from the Uint cases, so an 8_8 UINT target falls back to Float (also reported by @Amoenus on 911920f04, with a proposed fix). Only R32_SINT is Sint: every other SINT format the decoder can produce would silently get a float interface. Please derive the type from the format family (or list every UINT/SINT format the decoder returns) and add a test row per format.

Welcome to push the rebased version.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5564574015 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6235#pullrequestreview-5564574015). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-18T19:21:41Z. **Review:** CHANGES_REQUESTED --- Thanks, the approach (carry the attachment's numeric type into the request and cache keys) looks right. Points to fix before this can merge: - **Conflicts with `main`** in 9 files (`State.cpp`, `ShaderValidation.cpp`, `SpirvModuleEmitter.cpp`, `Recompiler.hpp`, `RequestSerializer.cpp`, `DrawRegisterKey.cpp`, `Graphics.cpp`, `ShaderMemory.cpp`, `RequestSerializerTests.cpp`). `main` is already at request serialization version 32 (this PR bumps 29 to 30), so the version, the base64 prefixes and the byte-level fixtures in `RequestSerializerTests.cpp`/`ShaderMemory.cpp` need redoing on top of 32, with older versions still replaying. - **`ColorOutputTypeOf` (`State.cpp:1081`) is incomplete.** `main` already decodes `VK_FORMAT_R8G8_UINT` (`State.cpp:800`) but it is missing from the Uint cases, so an 8_8 UINT target falls back to Float (also reported by @Amoenus on `911920f04`, with a proposed fix). Only `R32_SINT` is Sint: every other SINT format the decoder can produce would silently get a float interface. Please derive the type from the format family (or list every UINT/SINT format the decoder returns) and add a test row per format. Welcome to push the rebased version.
DavidSamir commented 2026-10-21 18:19:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-21T18:19:32Z.


A title that hits this: Art Swap PPSA99318 v1.2.0 writes a float fragment output into an R8_UINT color attachment.

  • Radeon 680M (Windows 11, AMD driver 32.0.21030.2001), with the mesh fallback, as this iGPU has no mesh shaders: it runs 60 s, with no VUID errors. The validation layer reports only this warning, 6 times:
    Validation Warning: [ Undefined-Value-ShaderFragmentOutputMismatch-DynamicRendering ] | MessageID = 0x1012616b
    vkCmdDraw(): Inside [VK_SHADER_STAGE_FRAGMENT_BIT] [Output variable, Location 0, "out_mrt_0"] with a numeric type of FLOAT but VkRenderingInfo::pColorAttachments[0].imageView is created with VK_FORMAT_R8_UINT (numeric type of UINT) which does not match and the resulting values written will be undefined.
    
    The AMD driver tolerates it, and the values written are undefined.
  • Apple M2 (MoltenVK): Metal rejects the pipeline, and the title dies at 11 s with output of type float4 is not compatible with a MTLPixelFormatR8Uint color attachment.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6323304656 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6235#issuecomment-6323304656). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-21T18:19:32Z. --- A title that hits this: **Art Swap PPSA99318 v1.2.0** writes a float fragment output into an `R8_UINT` color attachment. - **Radeon 680M** (Windows 11, AMD driver 32.0.21030.2001), with the mesh fallback, as this iGPU has no mesh shaders: it runs 60 s, with no VUID errors. The validation layer reports only this warning, 6 times: ``` Validation Warning: [ Undefined-Value-ShaderFragmentOutputMismatch-DynamicRendering ] | MessageID = 0x1012616b vkCmdDraw(): Inside [VK_SHADER_STAGE_FRAGMENT_BIT] [Output variable, Location 0, "out_mrt_0"] with a numeric type of FLOAT but VkRenderingInfo::pColorAttachments[0].imageView is created with VK_FORMAT_R8_UINT (numeric type of UINT) which does not match and the resulting values written will be undefined. ``` The AMD driver tolerates it, and the values written are undefined. - **Apple M2** (MoltenVK): Metal rejects the pipeline, and the title dies at 11 s with `output of type float4 is not compatible with a MTLPixelFormatR8Uint color attachment`. AI-assisted: yes
DavidSamir commented 2026-10-22 02:30:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T02:30:15Z.


Another title on Apple M2 (macOS 26, MoltenVK, Rosetta) that stops on this: PS5CEMU-HAR PPSA99360 5.0.0, converted with --trap-sdk-syscall-stubs, stops at 4 s with MoltenVK's output of type float4 is not compatible with a MTLPixelFormatR8Uint color attachment from vkCreateGraphicsPipelines (result -3), the same as Art Swap above. Not run with this PR applied.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6331240511 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6235#issuecomment-6331240511). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-22T02:30:15Z. --- Another title on Apple M2 (macOS 26, MoltenVK, Rosetta) that stops on this: PS5CEMU-HAR PPSA99360 5.0.0, converted with `--trap-sdk-syscall-stubs`, stops at 4 s with MoltenVK's `output of type float4 is not compatible with a MTLPixelFormatR8Uint color attachment` from `vkCreateGraphicsPipelines` (result -3), the same as Art Swap above. Not run with this PR applied.
adriadam10 commented 2026-10-24 01:47:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-24T01:47:19Z.

Review: CHANGES_REQUESTED


Still blocked on a rebase, and it is no longer mechanical. Checked against current main:

  • Conflicts in 12 files (29 hunks), not only the serializer: State.cpp, State.hpp, ShaderValidation.cpp, Recompiler.hpp, CacheKey.hpp, DrawRegisterKey.cpp, SpirvModuleEmitter.cpp, RequestSerializer.cpp and four test files. main is at request serialization version 46 (this PR bumps 29 to 30), so the version, the base64 prefixes and the byte-level fixtures need redoing on top of 46, with older versions still replaying.
  • main now has its own integer-export mechanism: ColorTarget::uintExport (State.hpp:67, set from slotExport == 7 in State.cpp:1492, added in 45541350bb) and the matching vertex:u32x4 check in ShaderValidation.cpp:728-730. This PR's ColorOutputType overlaps it. Please fold one into the other (for example derive uintExport from the new per-attachment type, or drop it) so there is one place that decides the interface, keeping the "blending into an unsigned integer target is unsupported" check and the UINT16_ABGR tests working.
  • ColorOutputTypeOf (State.cpp:1081) is incomplete (unchanged from our earlier comment): VK_FORMAT_R8G8_UINT falls back to Float, and only R32_SINT is Sint. Derive the type from the format family, or list every UINT/SINT format the decoder returns, and add a test row per format.

Alexius0815 posted a rebase of this commit (https://github.com/Alexius0815/AnyPS5/tree/contrib/integer-attachment-exports) that can be a starting point, but it predates the uintExport interaction and the current serializer version. Welcome to push the rebased version.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5636250270 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6235#pullrequestreview-5636250270). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-24T01:47:19Z. **Review:** CHANGES_REQUESTED --- Still blocked on a rebase, and it is no longer mechanical. Checked against current `main`: - **Conflicts in 12 files** (29 hunks), not only the serializer: `State.cpp`, `State.hpp`, `ShaderValidation.cpp`, `Recompiler.hpp`, `CacheKey.hpp`, `DrawRegisterKey.cpp`, `SpirvModuleEmitter.cpp`, `RequestSerializer.cpp` and four test files. `main` is at request serialization version 46 (this PR bumps 29 to 30), so the version, the base64 prefixes and the byte-level fixtures need redoing on top of 46, with older versions still replaying. - **`main` now has its own integer-export mechanism**: `ColorTarget::uintExport` (`State.hpp:67`, set from `slotExport == 7` in `State.cpp:1492`, added in 45541350bb) and the matching `vertex:u32x4` check in `ShaderValidation.cpp:728-730`. This PR's `ColorOutputType` overlaps it. Please fold one into the other (for example derive `uintExport` from the new per-attachment type, or drop it) so there is one place that decides the interface, keeping the "blending into an unsigned integer target is unsupported" check and the UINT16_ABGR tests working. - **`ColorOutputTypeOf` (`State.cpp:1081`) is incomplete** (unchanged from our earlier comment): `VK_FORMAT_R8G8_UINT` falls back to Float, and only `R32_SINT` is Sint. Derive the type from the format family, or list every UINT/SINT format the decoder returns, and add a test row per format. Alexius0815 posted a rebase of this commit (https://github.com/Alexius0815/AnyPS5/tree/contrib/integer-attachment-exports) that can be a starting point, but it predates the `uintExport` interaction and the current serializer version. Welcome to push the rebased version.
MarcZX10 commented 2026-11-23 02:55:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T02:55:22Z.

Review: CHANGES_REQUESTED


Reviewed — comments

Changes are required before merge: resolve the signed integer attachment format mapping before treating signed raw32 output as supported.

What I ran

Reviewed head 911920f04450f7e063235a988fe79681d210e261. No commands or tests were run in this review; author-reported validation is not treated as a run performed here.

Results

Check Result Note
Source review passed Changed shader and graphics paths inspected
Build and tests not run Author reports one allocator failure

Findings

Blocking

  • ColorOutputTypeOf classifies only VK_FORMAT_R32_SINT as signed, while unsigned formats include multiple component widths and counts. A signed attachment such as VK_FORMAT_R32G32B32A32_SINT therefore resolves to Float, causing the output interface and validation expectation to disagree with the integer attachment. This contradicts the stated signed integer attachment support and can reject valid shader output preparation or emit an incompatible float interface. Handle all supported signed integer formats consistently (or explicitly reject unsupported formats). Evidence: core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp:113.

Non-blocking

None.

Not verified

Full text was read for all changed files marked included in the manifest except core/libs/prx/libSceAgcDriver/tests/Graphics.cpp, which the manifest marks excluded as too large. The changed hunks and relevant lines for the blocker were reviewed. No build, tests, negative control, native console behavior, or external CI was verified. Author-reported test results appear in the PR description.

To get this to a good state

Add signed-format classification for the supported Vulkan signed integer formats, or reject the unsupported ones explicitly, then rerun the shader and graphics tests covering signed integer attachments.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6016067523 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6235#pullrequestreview-6016067523). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T02:55:22Z. **Review:** CHANGES_REQUESTED --- # Reviewed — comments Changes are required before merge: resolve the signed integer attachment format mapping before treating signed raw32 output as supported. ## What I ran Reviewed head `911920f04450f7e063235a988fe79681d210e261`. No commands or tests were run in this review; author-reported validation is not treated as a run performed here. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Changed shader and graphics paths inspected | | Build and tests | not run | Author reports one allocator failure | ## Findings ### Blocking - `ColorOutputTypeOf` classifies only `VK_FORMAT_R32_SINT` as signed, while unsigned formats include multiple component widths and counts. A signed attachment such as `VK_FORMAT_R32G32B32A32_SINT` therefore resolves to `Float`, causing the output interface and validation expectation to disagree with the integer attachment. This contradicts the stated signed integer attachment support and can reject valid shader output preparation or emit an incompatible float interface. Handle all supported signed integer formats consistently (or explicitly reject unsupported formats). Evidence: `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp:113`. ### Non-blocking None. ## Not verified Full text was read for all changed files marked included in the manifest except `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`, which the manifest marks excluded as too large. The changed hunks and relevant lines for the blocker were reviewed. No build, tests, negative control, native console behavior, or external CI was verified. Author-reported test results appear in the PR description. ## To get this to a good state Add signed-format classification for the supported Vulkan signed integer formats, or reject the unsupported ones explicitly, then rerun the shader and graphics tests covering signed integer attachments.

Pull request closed

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!6235
No description provided.