Shader: compressed FMASK/CMASK image reads remain unsupported (PPSA99902) #3219

Open
opened 2026-10-11 01:54:17 +00:00 by Amoenus · 1 comment
Amoenus commented 2026-10-11 01:54:17 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-11T01:54:17Z.


PR coverage and remaining scope - 1 November 2026

Already merged: #6674 fixes the original constant-result bug for supported uncompressed FMASK; #8429 extends uncompressed reads to storage widths/sample modes up to8 samples; our #7948 provides the expanded FMASK view for an exact tracked eight-fragment native color owner.

Open narrower extension: #10233 adds the corresponding compressed native-owner path for two-sample targets. It does not implement general standalone guest FMASK/CMASK metadata decoding. The older metadata-snapshot proposal #4790 is closed and unmerged; it is historical reference, not a pending merge candidate.

Remaining gap: compressed FMASK without a matching resident native target still throws on source-checked main 26fa1212b82f. General standalone compressed decoding/publication remains unsupported; the exact native-owner limitations are recorded in debt. No currently verified PR resolves that complete remaining scope.

The lack of a closing PR does not mean this issue received no implementation work. Keep open for the remaining compressed paths. Later Sonic observations in #3036/#4443 are composed-fork results and do not demonstrate that this whole capability is supported on main. This is a PR/source status audit, not a new GPU or title run. AI-assisted: yes (Codex).

Focused native-owner candidate — final qualification, 2026-10-19 UTC: a69c022c3a, one commit on main 88a6b34bc5, is pushed to our fork. Full Windows default and explicit libraries/relinker builds pass. Three fresh native-FMASK processes per actual GPU pass, including direct/registered/prepared dispatches, repeated lookup, recipe exclusion, descriptor mismatches, native sample/guest metadata preservation and same-value FMASK-store refusal, including previously prepared work.

Final matrix: 36 passes (27 verified GPU, 9 CPU), plus nine unchanged AMD DCC-clear baseline assertions (#7936). GPU runs require Vulkan, disable application shader caching, load Khronos validation and retain verbose output; zero VUID/errors/warnings. The fixture-only control leaves main 7b18fa8d5d production unchanged and refuses the capability in all six processes. Controls remain at their actual pins; older extra regression runs are not claimed as current-main comparisons. Candidate regressions cover raw FMASK, native sample reads, all three DCC sizes, graphics/descriptor decoding, shader memory and request serialization.

Cppcheck then clang-tidy cover all seven changed C++ units: no parse/configuration failures or clang-tidy diagnostics. Three Cppcheck findings were inspected: existing conditional batch flow, a throwing-Require allocation-check false positive and an unchanged pass-by-value suggestion. Conventions pass. Executable-code insertion conflicts reported by the overlap tool were removed; nearby debt text and stale shared-file comparisons were reviewed separately. Attribution to #4790 is retained; standalone compressed decoding/publication remains unsupported, so the general gap stays open.

Publication: native-owner-only PR #7948 is now open at this qualified fork commit; the same creation request succeeded after a short wait. There is no new unchanged-PR-head game-run claim. Main subsequently reached c017549dc1 (host-import eviction bookkeeping); a clean merge was checked, but these results remain pinned to the tested head/base. Earlier Sonic menu/movie/loading evidence is a separate integration result, with its Mesh-preparation stop and guest-wait symptoms retained. AI-assisted: yes (Codex).

Native-owner-only extraction is now complete and qualified on the fork; see the maintained control/candidate block above and central title record. The earlier integration retains separately attributed standalone decoder work and reaches Sonic menu/movie/loading before a distinct Mesh-preparation stop. That historical result is not a current candidate title-run claim. General compressed FMASK decoding and console equivalence remain open.

Current remaining gap (2026-10-19 UTC)

Merged #6674 fixes the synthetic constant for supported uncompressed FMASK reads and adds the missing refusal for compression. Compressed FMASK/CMASK reads remain unimplemented, so this issue stays open for that part; the original fixed-result observations below are historical.

Fresh ordinary Sonic Unleashed Recompiled PPSA99902 / 01.003.000 startup now reaches the refusal with unmodified mainb7a75819f3 runtime libraries from a separate clean source/build:

[videoout] presentation failed: shader 0x20be36e00 stage 5: FMASK CMASK compression is not implemented

22.334s, natural0xC0000409; Sonic Team/Hedgehog Engine logos and a final black capture, no menu/gameplay. RTX5080/driver610.62, Windows11 Enterprise26200, Khronos1.4.363. This retains thea515 converted app/guestlibc and original assets/configs; not a fresh main conversion. All127 archived libraries match the main build;145 prior files restored;562 expected hashes verified. Main also logs10mip-chain validation errors (VUID-VkImageCreateInfo-mipLevels-00958) and10fragment-output warnings: this is not validation-clean. The composed115d/mainb7 run separately reaches the same refusal at NOW LOADING after30.448s with0VUID/errors/warnings. No timings are treated as a speed comparison.

Full current observations, log hashes and test pins are maintained in7260. Existing closed #4790 contains the earlier metadata-aware subset; its maintainer requested a title/log before reopening. The author is being contacted with this evidence, preserving the original work rather than opening a duplicate. This does not validate the old PR on current main or establish its title effect, hardware semantics or performance.

The current materializer refusal is deliberate. Any follow-up needs supported metadata interpretation backed by the pinned PAL/Mesa references and hardware evidence, exact-main/control tests and title replay; removing the throw or restoring a constant is not a fix. Mainc82ffb0f20 arrived after the frozen tests and does not edit this materializer; no c82 runtime result is claimed.

AI-assisted validation/report: yes, Codex.

Historical analysis and conditional observations, retained at their original source pins

Source-defined correctness gap

A direct FMASK image read currently emits a fixed identity sample mapping even when its CMASK metadata describes a DCC fast-clear state. The metadata should be modeled, or the unsupported state should throw.

Confirmed by source inspection on current upstream d31b57a4cae47a966b74cde9a83b692261df8930:

AMD PAL c5e800072a32f68b6ccc4422936d96167c6e0728 Gfx9Cmask::FastClearValueDcc defines CMASK 0xCC for a DCC fast-clear state with zero FMASK pointers across the tile. GFX10 FMASK SRD construction supplies CMASK as the metadata of a compressed, shader-readable FMASK view.

Conditional startup evidence

PPSA99902, Windows 11 / RTX 5080. Runtime used local diagnostic stack 27dd8c5c based on upstream 2a38c0bd, with raw graphics and local library fixes. Current d31b57a4 was inspected statically; stock current-main startup was not tested.

Two uncached runs captured the matching FMASK/MSAA shader descriptors before binding. The subsequent refused sampler descriptor was correlated with that snapshot:

  • FMASK raw format166, eight-sample/eight-fragment view, 3840x2160, compression enabled and metadata pipe-aligned.
  • All 8,355,840 raw FMASK words, including padding: 0x76543210.
  • All 81,920 bytes in the source-derived CMASK range: 0xCC.
  • Raw/synchronized copies and repeat captures were identical. No pending recorder/storage writes, flush or wait was reported; tracked generations stayed stable during capture.

This CMASK state differs from PAL's eight-sample/eight-fragment initialization value, 0xFF. Identity bytes in raw FMASK alone therefore do not establish the logical sampled mapping.

Both runs stopped at the unchanged compressed-MSAA binding refusal tracked in #3036 (28.855 / 28.707 s). The affected shader did not execute. Hardware FMASK image-load outputs and a gameplay effect are unmeasured. CMASK geometry follows the existing GFX10 non-RB+ 16-pipe source assumption; the console configuration and complete DCC extent remain unknown. Private descriptors, addresses, shaders and captures are retained locally.

Validation and coverage

Temporary diagnostics were removed byte-for-byte. Full 120-library and 71 selected-target rebuilds completed; 79 test groups x five cold repeats = 395 passes, zero skips, maximum 4.17 s, Vulkan/all-MSAA cases required on RTX 5080. Two unchanged PAL initial/expanded-pattern functions also passed 135 source-only checks; a changed pattern was detected. These checks are not hardware FMASK decoding validation.

Suggested behavioral coverage: identity raw FMASK plus CMASK 0xCC; transition from 0xFF to 0xCC at unchanged addresses; mixed tiles and metadata-write invalidation. Handle supported metadata states from exact sources/hardware evidence and throw for cases whose semantics remain unknown.

The reviewed issue search found #3036 for descriptor shape/binding and #2755 for AMD pipeline-LTO tests. #2470 models single-sample color-target CMASK clears; #419 explicitly leaves guest FMASK unread/unwritten; #2258 covers compilation. No matching FMASK/CMASK read fix was established in this bounded review, which does not exhaust all forks.

AI-assisted investigation and diagnostic harness. No PR accompanies this report.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5797097725 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3219). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-11T01:54:17Z. --- ### PR coverage and remaining scope - 1 November 2026 **Already merged:** #6674 fixes the original constant-result bug for supported uncompressed FMASK; #8429 extends uncompressed reads to storage widths/sample modes up to8 samples; our #7948 provides the expanded FMASK view for an exact tracked eight-fragment native color owner. **Open narrower extension:** #10233 adds the corresponding compressed native-owner path for two-sample targets. It does not implement general standalone guest FMASK/CMASK metadata decoding. The older metadata-snapshot proposal #4790 is closed and unmerged; it is historical reference, not a pending merge candidate. **Remaining gap:** compressed FMASK without a matching resident native target still [throws on source-checked main `26fa1212b82f`](https://github.com/boykopovar/AnyPS5/blob/26fa1212b82f76dd49cf12d65e445d6ff3e0844c/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L770). General standalone compressed decoding/publication remains unsupported; the exact native-owner limitations are [recorded in debt](https://github.com/boykopovar/AnyPS5/blob/f21ef7c99c5af648c5a41bddb18ce118b8e60c46/docs/dev/debt/libSceAgcDriver.md#L196). No currently verified PR resolves that complete remaining scope. The lack of a closing PR does not mean this issue received no implementation work. Keep open for the remaining compressed paths. Later Sonic observations in #3036/#4443 are composed-fork results and do not demonstrate that this whole capability is supported on main. This is a PR/source status audit, not a new GPU or title run. AI-assisted: yes (Codex). <!-- codex-native-fmask-mainbcde-control-v1 --> **Focused native-owner candidate — final qualification, 2026-10-19 UTC:** [a69c022c3a](https://github.com/Amoenus/AnyPS5/commit/a69c022c3a6ad4732a6a5d0942552415a080a7e3), one commit on main `88a6b34bc5`, is pushed to our fork. Full Windows default and explicit libraries/relinker builds pass. Three fresh native-FMASK processes per actual GPU pass, including direct/registered/prepared dispatches, repeated lookup, recipe exclusion, descriptor mismatches, native sample/guest metadata preservation and same-value FMASK-store refusal, including previously prepared work. Final matrix: **36 passes (27 verified GPU, 9 CPU), plus nine unchanged AMD DCC-clear baseline assertions (#7936)**. GPU runs require Vulkan, disable application shader caching, load Khronos validation and retain verbose output; zero VUID/errors/warnings. The [fixture-only control](https://github.com/Amoenus/AnyPS5/commit/6013d0ac7b1f12bd356652880d8148a8ab7c5c41) leaves main `7b18fa8d5d` production unchanged and refuses the capability in all six processes. Controls remain at their actual pins; older extra regression runs are not claimed as current-main comparisons. Candidate regressions cover raw FMASK, native sample reads, all three DCC sizes, graphics/descriptor decoding, shader memory and request serialization. Cppcheck then clang-tidy cover all seven changed C++ units: no parse/configuration failures or clang-tidy diagnostics. Three Cppcheck findings were inspected: existing conditional batch flow, a throwing-Require allocation-check false positive and an unchanged pass-by-value suggestion. Conventions pass. Executable-code insertion conflicts reported by the overlap tool were removed; nearby debt text and stale shared-file comparisons were reviewed separately. Attribution to #4790 is retained; standalone compressed decoding/publication remains unsupported, so the general gap stays open. **Publication:** [native-owner-only PR #7948](https://github.com/boykopovar/AnyPS5/pull/7948) is now open at this qualified fork commit; the same creation request succeeded after a short wait. There is no new unchanged-PR-head game-run claim. Main subsequently reached `c017549dc1` (host-import eviction bookkeeping); a clean merge was checked, but these results remain pinned to the tested head/base. Earlier Sonic menu/movie/loading evidence is a separate integration result, with its Mesh-preparation stop and guest-wait symptoms retained. AI-assisted: yes (Codex). <!-- /codex-native-fmask-mainbcde-control-v1 --> <!-- codex-fmask-main5c6c-local-adaptation-v1 --> Native-owner-only extraction is now complete and qualified on the [fork](https://github.com/Amoenus/AnyPS5/commit/a69c022c3a6ad4732a6a5d0942552415a080a7e3); see the maintained control/candidate block above and [central title record](https://github.com/boykopovar/AnyPS5/issues/7260). The earlier integration retains separately attributed standalone decoder work and reaches Sonic menu/movie/loading before a distinct Mesh-preparation stop. That historical result is not a current candidate title-run claim. General compressed FMASK decoding and console equivalence remain open. <!-- /codex-fmask-main5c6c-local-adaptation-v1 --> <!-- codex-cmask-current-mainb7-v1 --> ## Current remaining gap (2026-10-19 UTC) Merged **#6674** fixes the synthetic constant for supported uncompressed FMASK reads and adds the missing refusal for compression. **Compressed FMASK/CMASK reads remain unimplemented**, so this issue stays open for that part; the original fixed-result observations below are historical. Fresh ordinary Sonic Unleashed Recompiled **PPSA99902 / 01.003.000** startup now reaches the refusal with **unmodified mainb7a75819f3 runtime libraries** from a separate clean source/build: ```text [videoout] presentation failed: shader 0x20be36e00 stage 5: FMASK CMASK compression is not implemented ``` **22.334s**, natural0xC0000409; Sonic Team/Hedgehog Engine logos and a final black capture, no menu/gameplay. RTX5080/driver610.62, Windows11 Enterprise26200, Khronos1.4.363. This retains thea515 converted app/guestlibc and original assets/configs; **not a fresh main conversion**. All127 archived libraries match the main build;145 prior files restored;562 expected hashes verified. Main also logs10mip-chain validation errors (`VUID-VkImageCreateInfo-mipLevels-00958`) and10fragment-output warnings: this is not validation-clean. The composed115d/mainb7 run separately reaches the same refusal at NOW LOADING after30.448s with0VUID/errors/warnings. No timings are treated as a speed comparison. [Full current observations, log hashes and test pins are maintained in7260](https://github.com/boykopovar/AnyPS5/issues/7260). Existing closed **#4790** contains the earlier metadata-aware subset; its maintainer requested a title/log before reopening. The author is being contacted with this evidence, preserving the original work rather than opening a duplicate. This does **not** validate the old PR on current main or establish its title effect, hardware semantics or performance. The current [materializer refusal](https://github.com/boykopovar/AnyPS5/blob/b7a75819f3efad870a3372eb0e2aba1d0e956657/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L215) is deliberate. Any follow-up needs supported metadata interpretation backed by the pinned PAL/Mesa references and hardware evidence, exact-main/control tests and title replay; removing the throw or restoring a constant is not a fix. Mainc82ffb0f20 arrived after the frozen tests and does not edit this materializer; no c82 runtime result is claimed. AI-assisted validation/report: yes, Codex. <!-- /codex-cmask-current-mainb7-v1 --> <details> <summary>Historical analysis and conditional observations, retained at their original source pins</summary> ## Source-defined correctness gap A direct FMASK image read currently emits a fixed identity sample mapping even when its CMASK metadata describes a DCC fast-clear state. The metadata should be modeled, or the unsupported state should throw. Confirmed by source inspection on current upstream `d31b57a4cae47a966b74cde9a83b692261df8930`: - [SpirvImageEmitter.cpp, FMASK branch](https://github.com/boykopovar/AnyPS5/blob/d31b57a4cae47a966b74cde9a83b692261df8930/core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp#L1576-L1587) constructs `0x76543210`, `0xfedcba98`, zero, zero for a 32-bit image read. - [DescriptorBindingBuilder.cpp](https://github.com/boykopovar/AnyPS5/blob/d31b57a4cae47a966b74cde9a83b692261df8930/core/shader/recompiler/Optimization/src/DescriptorBindingBuilder.cpp#L349) excludes that FMASK mode from physical sampled-image bindings. The materializer selects this mode for a compatible direct FMASK descriptor. AMD PAL `c5e800072a32f68b6ccc4422936d96167c6e0728` [Gfx9Cmask::FastClearValueDcc](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/hw/gfxip/gfx9/gfx9MaskRam.h#L517-L519) defines CMASK `0xCC` for a DCC fast-clear state with zero FMASK pointers across the tile. [GFX10 FMASK SRD construction](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/hw/gfxip/gfx9/gfx9Device.cpp#L4993-L5008) supplies CMASK as the metadata of a compressed, shader-readable FMASK view. ## Conditional startup evidence PPSA99902, Windows 11 / RTX 5080. Runtime used local diagnostic stack `27dd8c5c` based on upstream `2a38c0bd`, with raw graphics and local library fixes. Current `d31b57a4` was inspected statically; stock current-main startup was not tested. Two uncached runs captured the matching FMASK/MSAA shader descriptors before binding. The subsequent refused sampler descriptor was correlated with that snapshot: - FMASK raw format166, eight-sample/eight-fragment view, 3840x2160, compression enabled and metadata pipe-aligned. - All 8,355,840 raw FMASK words, including padding: `0x76543210`. - All 81,920 bytes in the source-derived CMASK range: `0xCC`. - Raw/synchronized copies and repeat captures were identical. No pending recorder/storage writes, flush or wait was reported; tracked generations stayed stable during capture. This CMASK state differs from PAL's [eight-sample/eight-fragment initialization value](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/hw/gfxip/gfx9/gfx9MaskRam.cpp#L4799-L4827), `0xFF`. Identity bytes in raw FMASK alone therefore do not establish the logical sampled mapping. Both runs stopped at the unchanged compressed-MSAA binding refusal tracked in #3036 (28.855 / 28.707 s). The affected shader did not execute. Hardware FMASK image-load outputs and a gameplay effect are unmeasured. CMASK geometry follows the existing GFX10 non-RB+ 16-pipe source assumption; the console configuration and complete DCC extent remain unknown. Private descriptors, addresses, shaders and captures are retained locally. ## Validation and coverage Temporary diagnostics were removed byte-for-byte. Full 120-library and 71 selected-target rebuilds completed; 79 test groups x five cold repeats = **395 passes, zero skips, maximum 4.17 s**, Vulkan/all-MSAA cases required on RTX 5080. Two unchanged PAL initial/expanded-pattern functions also passed 135 source-only checks; a changed pattern was detected. These checks are not hardware FMASK decoding validation. Suggested behavioral coverage: identity raw FMASK plus CMASK `0xCC`; transition from `0xFF` to `0xCC` at unchanged addresses; mixed tiles and metadata-write invalidation. Handle supported metadata states from exact sources/hardware evidence and throw for cases whose semantics remain unknown. The reviewed issue search found #3036 for descriptor shape/binding and #2755 for AMD pipeline-LTO tests. #2470 models single-sample color-target CMASK clears; #419 explicitly leaves guest FMASK unread/unwritten; #2258 covers compilation. No matching FMASK/CMASK read fix was established in this bounded review, which does not exhaust all forks. AI-assisted investigation and diagnostic harness. No PR accompanies this report. </details>
Amoenus commented 2026-10-11 02:07:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-11T02:07:27Z.


Isolated native FMASK reproducer

A synthetic compute shader now reproduces this independently of the title's compressed-color sampler. It uses ordinary IMAGE_LOAD (f0001f08 00020602) and stores all four result words for 32 lanes. FMASK format is 166 (32-bit, eight samples/eight fragments), 128x64, 2D/Z_64KB_X, identity swizzle. FMASK and CMASK allocations retain the same addresses across cases; no game code/data is included.

Observed first result word:

Case Raw FMASK CMASK / compression Observed
Expanded 76543210 FF, enabled 76543210
Fast clear, same addresses 76543210 CC, enabled 76543210
Zero mapping 00000000 compression disabled 76543210
One-fragment mapping 11111111 compression disabled 76543210
Mixed mapping 11111100 compression disabled 76543210
Expanded again 76543210 FF, enabled 76543210

The remaining FMASK result words are always fedcba98,0,0. Ordinary R32_UINT controls at the same data address correctly read two different values before and after these cases, so the fixture verifies real memory reads and result stores.

The expected sample mapping comes from exact reference source: PAL's CMASK CC definition, Mesa's CMASK/FMASK codes and uncompressed-versus-expanded distinction, and logical-to-physical sample extraction. The correctness modes compare only the first result word; unspecified remaining-channel behavior is not asserted.

Windows 11 / RTX 5080 / GCC 15.2: five repetitions yielded 5,120 successful observation comparisons, 20 expected correctness failures (four contracts x five), and five caught deliberately wrong ordinary-texture controls. Longest process was 0.262 s; Vulkan required, shader cache disabled, request.useCache=false. The observation mode records the bug; it is not a passing correctness test.

Runtime is the local experimental stack at 27dd8c5cd70a25c2bba781c2bddf6150732a00d3, based on 2a38c0bd. Current main 6040a9626e6f5c6bac7ffac2085c0a07994d8b45 was reviewed statically: emitter/materializer are identical after newline normalization; binding differs only in multisampled image dimensions, which this 2D FMASK fixture does not exercise. Current main was not runtime rebuilt. This measures AnyPS5's generated Vulkan shader, not PS5/AMD hardware FMASK semantics or game rendering.

No production edits, guard bypass, PR or push. Source is clean and the 123 baseline runtime files, guest module and original eboot were rehashed. AI-assisted investigation.

Standalone synthetic probe

Save as FmaskRuntimeProbe.cpp outside the repository. Compile with the existing agc_driver_runtime_images_tests target's include/link flags (the probe uses its existing Vulkan test helper). The tested Windows invocation is below the source.

#include "prx/libSceAgcDriver/Graphics/include/Draw.hpp"
#include "Recompiler.hpp"
#include "VulkanTestDevice.hpp"
#include <algorithm>
#include <array>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <span>
#include <vector>

namespace {
using AgcDriver::Graphics::Require;
std::uint32_t sourceContract = 0u;
bool negativeControl = false;
alignas(256) std::array<std::uint32_t, 128> input{};
alignas(256) std::array<std::uint32_t, 128> output{};
alignas(4096) std::array<std::uint32_t, 32768> fmaskStorage{};
alignas(4096) std::array<std::uint8_t, 131072> cmaskStorage{};
const std::span<std::uint32_t, 16384> fmask(fmaskStorage.data() + (((0u - reinterpret_cast<std::uintptr_t>(fmaskStorage.data())) & 0xffffu) / 4u), 16384u);
const std::span<std::uint8_t, 65536> cmask(cmaskStorage.data() + ((0u - reinterpret_cast<std::uintptr_t>(cmaskStorage.data())) & 0xffffu), 65536u);
constexpr std::array<std::uint32_t, 10> code{0x34020084u, 0xe0381000u, 0x80000201u, 0xbf8c3f70u, 0xf0001f08u, 0x00020602u, 0xbf8c3f70u, 0xe0781000u, 0x80010601u, 0xbf810000u};
std::array<std::uint32_t, 4> Buffer(const void* data, std::uint32_t bytes) {
    const auto address = reinterpret_cast<std::uintptr_t>(data);
    return {static_cast<std::uint32_t>(address), static_cast<std::uint32_t>(address >> 32u) & 0xffffu, bytes, 0x31016facu};
}
void Run(AgcDriver::VulkanDevice& device, std::uint32_t format, bool compressed, std::uint8_t cmaskByte, std::uint32_t fmaskWord, const char* name) {
    std::fill(fmask.begin(), fmask.end(), fmaskWord);
    std::fill(cmask.begin(), cmask.end(), cmaskByte);
    output.fill(0xdeadbeefu);
    for (std::uint32_t lane = 0; lane < 32u; ++lane) {
        input[lane * 4u] = lane * 3u;
        input[lane * 4u + 1u] = lane;
        input[lane * 4u + 2u] = 0u;
        input[lane * 4u + 3u] = 0u;
    }
    const auto address = reinterpret_cast<std::uintptr_t>(fmask.data());
    const auto meta = reinterpret_cast<std::uintptr_t>(cmask.data()) >> 8u;
    std::array<std::uint32_t, 8> image{
        static_cast<std::uint32_t>(address >> 8u),
        (static_cast<std::uint32_t>(address >> 40u) & 0xffu) | (format << 20u) | (3u << 30u),
        31u | (63u << 14u),
        0xfacu | ((format == 166u ? 24u : 0u) << 20u) | (9u << 28u),
        0u, 0u,
        compressed ? (1u << 19u) | (1u << 21u) | (static_cast<std::uint32_t>(meta & 0xffu) << 24u) : 0u,
        compressed ? static_cast<std::uint32_t>(meta >> 8u) : 0u
    };
    std::vector<std::uint32_t> userData(16u, 0u);
    const auto in = Buffer(input.data(), sizeof(input));
    const auto out = Buffer(output.data(), sizeof(output));
    std::copy(in.begin(), in.end(), userData.begin());
    std::copy(out.begin(), out.end(), userData.begin() + 4u);
    std::copy(image.begin(), image.end(), userData.begin() + 8u);
    const std::span<const std::uint32_t> words(code);
    const std::array<ShaderRecompiler::MemoryRegion, 1> memory{{{reinterpret_cast<std::uintptr_t>(code.data()), std::as_bytes(words)}}};
    const ShaderRecompiler::ShaderComputeStageInfo compute{{32u, 1u, 1u}, 0u, {false, false, false}, false, 1u};
    ShaderRecompiler::RecompileRequest request{
        {ShaderRecompiler::ShaderStage::Compute, reinterpret_cast<std::uintptr_t>(code.data()), words, 0u, {}},
        {32u, 0u, userData, compute, std::nullopt, std::nullopt, memory},
        device.Target(), {0u, 0u, 0u, 128u}
    };
    request.useCache = false;
    const auto shader = ShaderRecompiler::Recompile(request);
    device.Dispatch(shader, 1u, 1u, 1u, {}, reinterpret_cast<std::uintptr_t>(code.data()));
    device.WaitIdle();
    auto expected = format == 166u ? std::array<std::uint32_t, 4>{0x76543210u, 0xfedcba98u, 0u, 0u} : std::array<std::uint32_t, 4>{fmaskWord, 0u, 0u, 1u};
    if (sourceContract == 1u && format == 166u && compressed && cmaskByte == 0xccu) expected[0] = 0u;
    if (sourceContract == 2u && format == 166u && !compressed && fmaskWord == 0u) expected[0] = fmaskWord;
    if (sourceContract == 3u && format == 166u && !compressed && fmaskWord == 0x11111111u) expected[0] = fmaskWord;
    if (sourceContract == 4u && format == 166u && !compressed && fmaskWord == 0x11111100u) expected[0] = fmaskWord;
    if (negativeControl && format == 20u) expected[0] ^= 1u;
    for (std::uint32_t lane = 0; lane < 32u; ++lane) {
        for (std::uint32_t component = 0; component < 4u; ++component) {
            Require(output[lane * 4u + component] == expected[component], std::string(name) + " observed output differs from diagnostic prediction: lane=" + std::to_string(lane) + " component=" + std::to_string(component) + " value=" + std::to_string(output[lane * 4u + component]));
        }
    }
    std::printf("case=%s format=%u compressed=%u cmask=%02x raw=%08x result=%08x,%08x,%08x,%08x lanes=32\n", name, format, compressed, cmaskByte, fmaskWord, output[0], output[1], output[2], output[3]);
}
}
int main(int argc, char** argv) {
    try {
        if (argc == 2) {
            sourceContract = std::string(argv[1]) == "--source-contract" ? 1u : std::string(argv[1]) == "--source-zero" ? 2u : std::string(argv[1]) == "--source-other" ? 3u : std::string(argv[1]) == "--source-mixed" ? 4u : 0u;
            negativeControl = std::string(argv[1]) == "--negative-control";
            Require(sourceContract || negativeControl, "unknown probe argument");
        } else Require(argc == 1, "unexpected probe arguments");
        const auto device = OpenVulkanTestDevice();
        if (!device) return VulkanTestSkipped;
        Run(*device, 20u, false, 0xffu, 0x13579bdfu, "ordinary-r32-positive-control");
        Run(*device, 166u, true, 0xffu, 0x76543210u, "expanded-fmask");
        Run(*device, 166u, true, 0xccu, 0x76543210u, "cmask-fast-clear-same-address");
        Run(*device, 166u, false, 0xffu, 0u, "uncompressed-zero-fmask");
        Run(*device, 166u, false, 0xffu, 0x11111111u, "uncompressed-other-fmask");
        Run(*device, 166u, false, 0xffu, 0x11111100u, "uncompressed-mixed-fmask");
        Run(*device, 166u, true, 0xffu, 0x76543210u, "expanded-restored-same-address");
        Run(*device, 20u, false, 0xffu, 0x2468ace0u, "ordinary-r32-changed-same-address-control");
        std::puts("diagnostic observation checks=1024; this reproduces current behavior, not a passing correctness test");
        return 0;
    } catch (const std::exception& error) {
        std::cerr << error.what() << '\n';
        return 1;
    }
}

Windows command, from a configured repository with the full build-review libraries already built and the supported Winlibs toolchain on PATH:

$includes = @(
  'core/libs', 'core/shader/recompiler',
  'core/libs/prx/libSceAgcDriver/tests/execution',
  '3rdparty/Vulkan-Headers/include', '3rdparty/SPIRV-Headers/include',
  'build-review/3rdparty/SDL2/include',
  'build-review/3rdparty/SDL2/include/SDL2',
  'build-review/3rdparty/SDL2/include-config-release/SDL2'
) | ForEach-Object { '-I' + (Join-Path $PWD $_) }
$system = @('m','kernel32','user32','gdi32','winmm','imm32','ole32',
  'oleaut32','version','uuid','advapi32','setupapi','shell32','dinput8',
  'winspool','comdlg32') | ForEach-Object { '-l' + $_ }
$probe = Read-Host 'Absolute path to FmaskRuntimeProbe.cpp'
g++ -DAPS5_ENABLE_TIMING_LOG=0 @includes -O3 -DNDEBUG -std=c++20 `
  -fno-asynchronous-unwind-tables $probe -o FmaskRuntimeProbe.exe `
  build-review/core/libs/libs/implib/liblibSceAgcDriver.dll.a `
  build-review/3rdparty/SDL2/libSDL2.a `
  build-review/core/libs/libs/implib/liblibc.dll.a @system
if ($LASTEXITCODE -ne 0) { throw 'Compile failed' }
objcopy --rename-section .eh_frame=.ehfram FmaskRuntimeProbe.exe
if ($LASTEXITCODE -ne 0) { throw 'objcopy failed' }
$env:PATH = (Join-Path $PWD 'build-review/core/libs/libs/unpatched') + ';' + $env:PATH
$env:ANYPS5_GPU = 'RTX 5080'
$env:ANYPS5_REQUIRE_VULKAN = '1'
$env:ANYPS5_NO_SHADER_CACHE = '1'
./FmaskRuntimeProbe.exe
./FmaskRuntimeProbe.exe --source-contract
./FmaskRuntimeProbe.exe --source-zero
./FmaskRuntimeProbe.exe --source-other
./FmaskRuntimeProbe.exe --source-mixed
./FmaskRuntimeProbe.exe --negative-control

Observation exits 0; each source-contract mode and the negative control exits 1 on the tested stack. These expected failures should become passing behavioral coverage when the general FMASK implementation is added. Linux/lavapipe was not tested.

Follow-up: source-derived CMASK addressing validated

For pipe-aligned SW_64KB_Z_X, GFX10 non-RB+ with 16 pipes and 256-byte interleave, PAL's unchanged CMASK address implementation gives the same x/y equation for all 13 FMASK sample/fragment formats. Array layers add nibble XOR ((z & 8) << 6) | ((z & 4) << 8) | ((z & 2) << 10) | ((z & 1) << 12); pipe XOR adds (pipeXor & 15) << 9 in nibble units, where pipeXor is in 256-byte units. The slice stride remains twice the CMASK slice byte size in nibble units.

Local addressing helpers matched that reference across 171,012,400 coordinate comparisons, including selected boundary coordinates for every layer through 8191 and all 256 pipe/bank XOR unit values. Invalid inputs were rejected; three mutated addressing variants were caught. This is source comparison for the specified configuration, not a console measurement or coverage of other GPU configurations.

On the Windows/RTX 5080 validation stack based on upstream 84cc975e, full libraries built and 90 regression groups passed five times each, with no skips and a 4.17-second maximum per run. A controlled game comparison changed only the graphics driver: before 29.21 seconds / after 29.23 seconds, both stopping at the existing compressed multisampled texture refusal, without timeout. FMASK resource binding and metadata-aware decoding remain unimplemented; this addressing component does not resolve the issue or advance startup. No PR was opened.

Follow-up: local metadata-aware FMASK read subset validated

A local implementation based on upstream aac0f1b8 now binds Fmask32_S8_F8 as a per-pixel integer texture snapshot instead of emitting the fixed FMASK constant. It synchronizes and reads FMASK plus CMASK: CMASK 0xC yields zero fragment indices, while 0xF yields the stored indices. The implementation covers 2D/2D-array images, one mip, zero/X destination selectors and the source-derived GFX10 non-RB+ 16-pipe SW_64KB_Z_X configuration. Unsupported formats, selectors, compression codes and reserved fragment indices throw. Compressed color decoding is still unsupported.

Sources: PAL's FMASK-to-surface layout conversion, PAL's 32-bit FMASK destination selectors, the CMASK address and clear-state sources above, and Mesa's fragment-index extraction. PAL's public FMASK address entry point is unimplemented; the reference uses the unchanged surface address implementation with PAL's own FMASK layout conversion, rather than treating that entry point as an oracle.

Validation on Windows/RTX 5080 with shader caching disabled:

  • Full 120-library build and 92 relevant regression groups repeated five times: 460 passes, no skips, maximum 4.14 seconds per test.
  • Native GFX10 image-load tests: 13 read cases, including nonuniform pixels, mixed CMASK tiles, array views starting at layer 1, metadata changes at the same addresses and ordinary R32 controls. Across five runs: 8,320 component comparisons, 25 checked unsupported-input refusals and five negative controls; the FMASK test took 0.25–0.27 seconds per run.
  • 104,675,820 pixel comparisons against unchanged PAL addressing across 240 cases, varying dimensions, layers and pipe/bank XOR. Three deliberately broken variants (clear state, layer stride, pipe XOR) were detected.
  • The earlier native reproducer now passes its source-based expectations and rejects its old fixed-constant expectations.

The controlled game replay changed only the graphics driver; 119 libraries were byte-identical. Before 29.52 seconds / after 29.25 seconds, both reached the same compressed multisampled color-texture refusal without timeout. Therefore this subset corrects the synthetic FMASK reads but has not advanced game startup or resolved this issue in full. Baseline runtime files were restored and hash verified.

This work was AI assisted and remains local. No PR was opened. These are source-reference and NVIDIA-host execution results, not AMD/PS5 hardware measurements or Linux/lavapipe validation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104473247 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3219#issuecomment-6104473247). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-11T02:07:27Z. --- ### Isolated native FMASK reproducer A synthetic compute shader now reproduces this independently of the title's compressed-color sampler. It uses ordinary `IMAGE_LOAD` (`f0001f08 00020602`) and stores all four result words for 32 lanes. FMASK format is **166 (32-bit, eight samples/eight fragments)**, 128x64, 2D/Z_64KB_X, identity swizzle. FMASK and CMASK allocations retain the same addresses across cases; no game code/data is included. Observed first result word: | Case | Raw FMASK | CMASK / compression | Observed | | --- | --- | --- | --- | | Expanded | `76543210` | `FF`, enabled | `76543210` | | Fast clear, same addresses | `76543210` | `CC`, enabled | `76543210` | | Zero mapping | `00000000` | compression disabled | `76543210` | | One-fragment mapping | `11111111` | compression disabled | `76543210` | | Mixed mapping | `11111100` | compression disabled | `76543210` | | Expanded again | `76543210` | `FF`, enabled | `76543210` | The remaining FMASK result words are always `fedcba98,0,0`. Ordinary R32_UINT controls at the same data address correctly read two different values before and after these cases, so the fixture verifies real memory reads and result stores. The expected sample mapping comes from exact reference source: PAL's [CMASK CC definition](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/hw/gfxip/gfx9/gfx9MaskRam.h#L517), Mesa's [CMASK/FMASK codes and uncompressed-versus-expanded distinction](https://gitlab.freedesktop.org/mesa/mesa/-/blob/97a4815468a2a306306c3d9fe042062af381b6f7/src/amd/common/ac_descriptors.h#L52), and [logical-to-physical sample extraction](https://gitlab.freedesktop.org/mesa/mesa/-/blob/97a4815468a2a306306c3d9fe042062af381b6f7/src/compiler/nir/nir_lower_tex.c#L1297). The correctness modes compare only the first result word; unspecified remaining-channel behavior is not asserted. **Windows 11 / RTX 5080 / GCC 15.2:** five repetitions yielded 5,120 successful observation comparisons, **20 expected correctness failures** (four contracts x five), and five caught deliberately wrong ordinary-texture controls. Longest process was 0.262 s; Vulkan required, shader cache disabled, `request.useCache=false`. The observation mode records the bug; it is not a passing correctness test. Runtime is the local experimental stack at `27dd8c5cd70a25c2bba781c2bddf6150732a00d3`, based on `2a38c0bd`. Current main `6040a9626e6f5c6bac7ffac2085c0a07994d8b45` was reviewed statically: emitter/materializer are identical after newline normalization; binding differs only in multisampled image dimensions, which this 2D FMASK fixture does not exercise. Current main was not runtime rebuilt. This measures AnyPS5's generated Vulkan shader, **not** PS5/AMD hardware FMASK semantics or game rendering. No production edits, guard bypass, PR or push. Source is clean and the 123 baseline runtime files, guest module and original eboot were rehashed. AI-assisted investigation. <details><summary>Standalone synthetic probe</summary> Save as `FmaskRuntimeProbe.cpp` outside the repository. Compile with the existing `agc_driver_runtime_images_tests` target's include/link flags (the probe uses its existing Vulkan test helper). The tested Windows invocation is below the source. ```cpp #include "prx/libSceAgcDriver/Graphics/include/Draw.hpp" #include "Recompiler.hpp" #include "VulkanTestDevice.hpp" #include <algorithm> #include <array> #include <cstdint> #include <cstdio> #include <iostream> #include <span> #include <vector> namespace { using AgcDriver::Graphics::Require; std::uint32_t sourceContract = 0u; bool negativeControl = false; alignas(256) std::array<std::uint32_t, 128> input{}; alignas(256) std::array<std::uint32_t, 128> output{}; alignas(4096) std::array<std::uint32_t, 32768> fmaskStorage{}; alignas(4096) std::array<std::uint8_t, 131072> cmaskStorage{}; const std::span<std::uint32_t, 16384> fmask(fmaskStorage.data() + (((0u - reinterpret_cast<std::uintptr_t>(fmaskStorage.data())) & 0xffffu) / 4u), 16384u); const std::span<std::uint8_t, 65536> cmask(cmaskStorage.data() + ((0u - reinterpret_cast<std::uintptr_t>(cmaskStorage.data())) & 0xffffu), 65536u); constexpr std::array<std::uint32_t, 10> code{0x34020084u, 0xe0381000u, 0x80000201u, 0xbf8c3f70u, 0xf0001f08u, 0x00020602u, 0xbf8c3f70u, 0xe0781000u, 0x80010601u, 0xbf810000u}; std::array<std::uint32_t, 4> Buffer(const void* data, std::uint32_t bytes) { const auto address = reinterpret_cast<std::uintptr_t>(data); return {static_cast<std::uint32_t>(address), static_cast<std::uint32_t>(address >> 32u) & 0xffffu, bytes, 0x31016facu}; } void Run(AgcDriver::VulkanDevice& device, std::uint32_t format, bool compressed, std::uint8_t cmaskByte, std::uint32_t fmaskWord, const char* name) { std::fill(fmask.begin(), fmask.end(), fmaskWord); std::fill(cmask.begin(), cmask.end(), cmaskByte); output.fill(0xdeadbeefu); for (std::uint32_t lane = 0; lane < 32u; ++lane) { input[lane * 4u] = lane * 3u; input[lane * 4u + 1u] = lane; input[lane * 4u + 2u] = 0u; input[lane * 4u + 3u] = 0u; } const auto address = reinterpret_cast<std::uintptr_t>(fmask.data()); const auto meta = reinterpret_cast<std::uintptr_t>(cmask.data()) >> 8u; std::array<std::uint32_t, 8> image{ static_cast<std::uint32_t>(address >> 8u), (static_cast<std::uint32_t>(address >> 40u) & 0xffu) | (format << 20u) | (3u << 30u), 31u | (63u << 14u), 0xfacu | ((format == 166u ? 24u : 0u) << 20u) | (9u << 28u), 0u, 0u, compressed ? (1u << 19u) | (1u << 21u) | (static_cast<std::uint32_t>(meta & 0xffu) << 24u) : 0u, compressed ? static_cast<std::uint32_t>(meta >> 8u) : 0u }; std::vector<std::uint32_t> userData(16u, 0u); const auto in = Buffer(input.data(), sizeof(input)); const auto out = Buffer(output.data(), sizeof(output)); std::copy(in.begin(), in.end(), userData.begin()); std::copy(out.begin(), out.end(), userData.begin() + 4u); std::copy(image.begin(), image.end(), userData.begin() + 8u); const std::span<const std::uint32_t> words(code); const std::array<ShaderRecompiler::MemoryRegion, 1> memory{{{reinterpret_cast<std::uintptr_t>(code.data()), std::as_bytes(words)}}}; const ShaderRecompiler::ShaderComputeStageInfo compute{{32u, 1u, 1u}, 0u, {false, false, false}, false, 1u}; ShaderRecompiler::RecompileRequest request{ {ShaderRecompiler::ShaderStage::Compute, reinterpret_cast<std::uintptr_t>(code.data()), words, 0u, {}}, {32u, 0u, userData, compute, std::nullopt, std::nullopt, memory}, device.Target(), {0u, 0u, 0u, 128u} }; request.useCache = false; const auto shader = ShaderRecompiler::Recompile(request); device.Dispatch(shader, 1u, 1u, 1u, {}, reinterpret_cast<std::uintptr_t>(code.data())); device.WaitIdle(); auto expected = format == 166u ? std::array<std::uint32_t, 4>{0x76543210u, 0xfedcba98u, 0u, 0u} : std::array<std::uint32_t, 4>{fmaskWord, 0u, 0u, 1u}; if (sourceContract == 1u && format == 166u && compressed && cmaskByte == 0xccu) expected[0] = 0u; if (sourceContract == 2u && format == 166u && !compressed && fmaskWord == 0u) expected[0] = fmaskWord; if (sourceContract == 3u && format == 166u && !compressed && fmaskWord == 0x11111111u) expected[0] = fmaskWord; if (sourceContract == 4u && format == 166u && !compressed && fmaskWord == 0x11111100u) expected[0] = fmaskWord; if (negativeControl && format == 20u) expected[0] ^= 1u; for (std::uint32_t lane = 0; lane < 32u; ++lane) { for (std::uint32_t component = 0; component < 4u; ++component) { Require(output[lane * 4u + component] == expected[component], std::string(name) + " observed output differs from diagnostic prediction: lane=" + std::to_string(lane) + " component=" + std::to_string(component) + " value=" + std::to_string(output[lane * 4u + component])); } } std::printf("case=%s format=%u compressed=%u cmask=%02x raw=%08x result=%08x,%08x,%08x,%08x lanes=32\n", name, format, compressed, cmaskByte, fmaskWord, output[0], output[1], output[2], output[3]); } } int main(int argc, char** argv) { try { if (argc == 2) { sourceContract = std::string(argv[1]) == "--source-contract" ? 1u : std::string(argv[1]) == "--source-zero" ? 2u : std::string(argv[1]) == "--source-other" ? 3u : std::string(argv[1]) == "--source-mixed" ? 4u : 0u; negativeControl = std::string(argv[1]) == "--negative-control"; Require(sourceContract || negativeControl, "unknown probe argument"); } else Require(argc == 1, "unexpected probe arguments"); const auto device = OpenVulkanTestDevice(); if (!device) return VulkanTestSkipped; Run(*device, 20u, false, 0xffu, 0x13579bdfu, "ordinary-r32-positive-control"); Run(*device, 166u, true, 0xffu, 0x76543210u, "expanded-fmask"); Run(*device, 166u, true, 0xccu, 0x76543210u, "cmask-fast-clear-same-address"); Run(*device, 166u, false, 0xffu, 0u, "uncompressed-zero-fmask"); Run(*device, 166u, false, 0xffu, 0x11111111u, "uncompressed-other-fmask"); Run(*device, 166u, false, 0xffu, 0x11111100u, "uncompressed-mixed-fmask"); Run(*device, 166u, true, 0xffu, 0x76543210u, "expanded-restored-same-address"); Run(*device, 20u, false, 0xffu, 0x2468ace0u, "ordinary-r32-changed-same-address-control"); std::puts("diagnostic observation checks=1024; this reproduces current behavior, not a passing correctness test"); return 0; } catch (const std::exception& error) { std::cerr << error.what() << '\n'; return 1; } } ``` Windows command, from a configured repository with the full `build-review` libraries already built and the supported Winlibs toolchain on PATH: ```powershell $includes = @( 'core/libs', 'core/shader/recompiler', 'core/libs/prx/libSceAgcDriver/tests/execution', '3rdparty/Vulkan-Headers/include', '3rdparty/SPIRV-Headers/include', 'build-review/3rdparty/SDL2/include', 'build-review/3rdparty/SDL2/include/SDL2', 'build-review/3rdparty/SDL2/include-config-release/SDL2' ) | ForEach-Object { '-I' + (Join-Path $PWD $_) } $system = @('m','kernel32','user32','gdi32','winmm','imm32','ole32', 'oleaut32','version','uuid','advapi32','setupapi','shell32','dinput8', 'winspool','comdlg32') | ForEach-Object { '-l' + $_ } $probe = Read-Host 'Absolute path to FmaskRuntimeProbe.cpp' g++ -DAPS5_ENABLE_TIMING_LOG=0 @includes -O3 -DNDEBUG -std=c++20 ` -fno-asynchronous-unwind-tables $probe -o FmaskRuntimeProbe.exe ` build-review/core/libs/libs/implib/liblibSceAgcDriver.dll.a ` build-review/3rdparty/SDL2/libSDL2.a ` build-review/core/libs/libs/implib/liblibc.dll.a @system if ($LASTEXITCODE -ne 0) { throw 'Compile failed' } objcopy --rename-section .eh_frame=.ehfram FmaskRuntimeProbe.exe if ($LASTEXITCODE -ne 0) { throw 'objcopy failed' } $env:PATH = (Join-Path $PWD 'build-review/core/libs/libs/unpatched') + ';' + $env:PATH $env:ANYPS5_GPU = 'RTX 5080' $env:ANYPS5_REQUIRE_VULKAN = '1' $env:ANYPS5_NO_SHADER_CACHE = '1' ./FmaskRuntimeProbe.exe ./FmaskRuntimeProbe.exe --source-contract ./FmaskRuntimeProbe.exe --source-zero ./FmaskRuntimeProbe.exe --source-other ./FmaskRuntimeProbe.exe --source-mixed ./FmaskRuntimeProbe.exe --negative-control ``` Observation exits 0; each source-contract mode and the negative control exits 1 on the tested stack. These expected failures should become passing behavioral coverage when the general FMASK implementation is added. Linux/lavapipe was not tested. </details> ### Follow-up: source-derived CMASK addressing validated For pipe-aligned `SW_64KB_Z_X`, GFX10 non-RB+ with 16 pipes and 256-byte interleave, [PAL's unchanged CMASK address implementation](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/imported/addrlib/src/gfx10/gfx10addrlib.cpp#L515) gives the same x/y equation for all 13 FMASK sample/fragment formats. Array layers add nibble XOR `((z & 8) << 6) | ((z & 4) << 8) | ((z & 2) << 10) | ((z & 1) << 12)`; pipe XOR adds `(pipeXor & 15) << 9` in nibble units, where `pipeXor` is in 256-byte units. The slice stride remains twice the CMASK slice byte size in nibble units. Local addressing helpers matched that reference across 171,012,400 coordinate comparisons, including selected boundary coordinates for every layer through 8191 and all 256 pipe/bank XOR unit values. Invalid inputs were rejected; three mutated addressing variants were caught. This is source comparison for the specified configuration, not a console measurement or coverage of other GPU configurations. On the Windows/RTX 5080 validation stack based on upstream `84cc975e`, full libraries built and 90 regression groups passed five times each, with no skips and a 4.17-second maximum per run. A controlled game comparison changed only the graphics driver: before 29.21 seconds / after 29.23 seconds, both stopping at the existing compressed multisampled texture refusal, without timeout. FMASK resource binding and metadata-aware decoding remain unimplemented; this addressing component does not resolve the issue or advance startup. No PR was opened. ### Follow-up: local metadata-aware FMASK read subset validated A local implementation based on upstream `aac0f1b8` now binds `Fmask32_S8_F8` as a per-pixel integer texture snapshot instead of emitting the fixed FMASK constant. It synchronizes and reads FMASK plus CMASK: CMASK `0xC` yields zero fragment indices, while `0xF` yields the stored indices. The implementation covers 2D/2D-array images, one mip, zero/X destination selectors and the source-derived GFX10 non-RB+ 16-pipe `SW_64KB_Z_X` configuration. Unsupported formats, selectors, compression codes and reserved fragment indices throw. Compressed color decoding is still unsupported. Sources: [PAL's FMASK-to-surface layout conversion](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/imported/addrlib/src/core/addrlib2.cpp#L877), [PAL's 32-bit FMASK destination selectors](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/hw/gfxip/gfx9/gfx9Device.cpp#L4973), the CMASK address and clear-state sources above, and [Mesa's fragment-index extraction](https://gitlab.freedesktop.org/mesa/mesa/-/blob/97a4815468a2a306306c3d9fe042062af381b6f7/src/compiler/nir/nir_lower_tex.c#L1297). PAL's public FMASK address entry point is unimplemented; the reference uses the unchanged surface address implementation with PAL's own FMASK layout conversion, rather than treating that entry point as an oracle. Validation on Windows/RTX 5080 with shader caching disabled: - Full 120-library build and 92 relevant regression groups repeated five times: 460 passes, no skips, maximum 4.14 seconds per test. - Native GFX10 image-load tests: 13 read cases, including nonuniform pixels, mixed CMASK tiles, array views starting at layer 1, metadata changes at the same addresses and ordinary R32 controls. Across five runs: 8,320 component comparisons, 25 checked unsupported-input refusals and five negative controls; the FMASK test took 0.25–0.27 seconds per run. - 104,675,820 pixel comparisons against unchanged PAL addressing across 240 cases, varying dimensions, layers and pipe/bank XOR. Three deliberately broken variants (clear state, layer stride, pipe XOR) were detected. - The earlier native reproducer now passes its source-based expectations and rejects its old fixed-constant expectations. The controlled game replay changed only the graphics driver; 119 libraries were byte-identical. Before 29.52 seconds / after 29.25 seconds, both reached the same compressed multisampled color-texture refusal without timeout. Therefore this subset corrects the synthetic FMASK reads but has **not advanced game startup** or resolved this issue in full. Baseline runtime files were restored and hash verified. This work was AI assisted and remains local. No PR was opened. These are source-reference and NVIDIA-host execution results, not AMD/PS5 hardware measurements or Linux/lavapipe validation.
Sign in to join this conversation.
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#3219
No description provided.