Repository navigation
feat(agc): draw PS4 EQAA and one-fragment color targets - #18176
Conversation
A PS4 (GCN) color target with fewer fragments than samples (CB_COLOR_ATTRIB NUM_FRAGMENTS below NUM_SAMPLES) threw "GCN color targets with fewer fragments than samples (EQAA) are not implemented". It now decodes as the AGC path's EQAA and one-fragment targets do: 2 or 4 fragments are drawn at the coverage sample count with the color memory guarded over the stored fragments, and 1 fragment is drawn as one sample. EQAA needs COMPRESSION and a CB_COLOR_FMASK base. The FMASK guard of the AGC path is sized with the SW_64KB_Z_X layout, which does not hold for GCN tiling. A GCN target records its FMASK size from CB_COLOR_FMASK_SLICE instead: tile max + 1 times 64 pixels of 2 bits per sample for 2 fragments, 4 for 4, and 1 bit for each of 8 samples for one fragment, as addrlib's SiLib::HwlComputeFmaskBits and ac_surface.c lay it out. The 32-bit field fills padding in ColorTarget, so the pipeline state size and the recipe codec do not change. GcnColorTarget covers the decode of 4/2, 8/2, 8/4 and 4/1 targets and the refusals. GcnEqaaColorTarget draws a fast-cleared 4-sample 2-fragment target in PS4 mode, resolves it like a 4x target drawn the same way, and checks that the FMASK guards of it and of a one-fragment target end at the size CB_COLOR_FMASK_SLICE gives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Windows check of head Setup: Windows 11 Enterprise 22621, AMD RX 6700 XT, AMD driver 26.10.1, MinGW-w64 GCC 15.2 UCRT, Release build.
AI-assisted: yes. |
|
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.
|
|
GTA V (CUSA00419 01.57) with this PR, on Windows with an RTX 5080, as you asked in #18084: the EQAA message is gone, but the title stops on the same target at a later check in the same decoder: a 4-sample target with one fragment and
The target: two more starts, each with a local line (not part of this PR) that prints the target the check refuses: with this PR, before the check above; without it, before Not covered here: whether the title reaches this PR's 2- and 4-fragment path; this PR's tests, which I didn't run; Linux and macOS. AI-assisted: yes. Claude Code ran the builds and starts, added the local diagnostic lines and drafted this comment; a separate review agent checked it. The results are from the runs on this machine. |
…clear Take boykopovar#18176 (PS4 EQAA and one-fragment color targets) as a base: a one-fragment target is drawn as one sample, so its fast clear is the single-sample fast clear this branch materializes. With this branch's decode, a one-fragment target with FAST_CLEAR now takes its CMASK instead of throwing "PS4 color target fast clear (CMASK) is not implemented", which Grand Theft Auto V (CUSA00419) hits on a 4-sample 1-fragment target with boykopovar#18176. - GcnColorTarget.cpp keeps both new cases; the check that a fast-cleared one-fragment target throws becomes a check that it takes its CMASK and FMASK. - docs/dev/debt/libSceAgcDriver.md keeps boykopovar#18176's PS4 multisampled entry without the one-fragment fast clear among what throws, and this branch's fast clear entry for single-sample and one-fragment targets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grand Theft Auto V (CUSA00419) draws to a 4-sample, 1-fragment color target with FAST_CLEAR and COMPRESSION (CB_COLOR_INFO 0x0002e828, CB_COLOR_ATTRIB 0x000021ce, 1920x1088), which boykopovar#18176 decodes as one stored sample and the merged decode now gives its CMASK. Besides code 0, the CMASK of such a target can hold the codes 0xc to 0xf that the AGC path accepts for a one-fragment target, where the GCN branch of materializeCmaskClear accepted only all 0 or all 0xff bytes. It now reads each tile's code as readCmask does: code 0 is a fast-cleared tile and any other code keeps its texels, with the codes of a one-fragment target required to be 0xc to 0xf, as on the AGC path. A CMASK with code 0 on every tile is cleared as before, one with none keeps its texels, and one with code 0 on only some tiles still throws, since that needs the GCN CMASK tile order. GcnFastClearColorTarget adds a 4-sample 1-fragment target cleared under code 0, kept under code 0xc and refused under code 0x5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@adam25136 Thank you, that pins it down, and thanks for checking #18207 too. The target you found is a one-fragment fast clear, which this PR still refuses. #18177 now materializes the fast clears of one-fragment targets on top of this branch: its head Generated by Claude Code |
|
Windows check of head Setup: Windows 11 x64, WinLibs GCC 15.2.0 (r7), Ninja, Release,
AI-assisted: yes. |
…agment A CB_COLOR_VIEW of slice n of a GCN color target started n single-sample slices past CB_COLOR_BASE, and its CMASK and FMASK started at their bases. A slice holds all stored fragments, as addrlib sizes it with its samples, and the CB steps the CMASK and FMASK by CB_COLOR_CMASK_SLICE and CB_COLOR_FMASK_SLICE: Mesa programs all three bases for slice 0 and the layer only in CB_COLOR_VIEW. Slice n of a multisampled, EQAA or one-fragment target now starts n slices of its fragments past the base, and its CMASK and FMASK n of their slices past theirs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…own CMASK A fast-cleared single-sample or one-fragment GCN color target viewed at slice n read and expanded the CMASK of slice 0. With boykopovar#18176's slice strides merged, the CMASK of slice n starts n CB_COLOR_CMASK_SLICE sizes past CB_COLOR_CMASK; such a slice is a multiple of 128 bytes, so the GCN CMASK is now read and written at 128-byte alignment instead of 256. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Linux/AMD verification of head |
Validation run: item 10 of 5-item batch — AGC EQAA / one-fragment color targetsVerdict: ALL GREEN — no regressions detected; tested SHA pushed to Environment
SHAs
Build (PR tree, under build lock; lock wait 10 s)
Focused tests (under build lock; lock wait 0 s)Pattern (identical matched set of 23 tests in both trees, verified by diffing Command per tree (each Results base vs PR head: 23/23 Passed on both, 0 Failed/Skipped; per-test pass/fail identical (no diffs). List: agc_driver_cached_image_multisample_guard, agc_driver_eqaa_color_target, agc_driver_multisample_{centered_lines,fill_host_only,readback,readback_uint8/16/64/128,readback_depth,readback_depth_retile,readback_retile,readback_upload,retirement,srgb_twin}, agc_driver_multisampled_pass_order, agc_driver_native_multisample_depth, agc_driver_packed_unorm4444_multisample_partial_write, agc_driver_sample_mask_multisample, agc_driver_sample_multisample_target, agc_multisample_guest_access, agc_gcn_color_target, agc_gcn_decode. Supplementary PR-only run (new test added by this PR, not present on base): Layer checks (per AGENTS.md)
VUID / sync-hazard diff
Push
Limitations
|
|
NVIDIA run on Ubuntu 26.04.1 LTS: NVIDIA GeForce RTX 4080 SUPER, driver 595.99.02, Intel Core i9-14900KF, GCC 15.2.0 Release, validation layer 1.4.341. PR head
Negative control: none: Command: AI-assisted: yes (Claude Code ran the tests and drafted this comment) |
What
A PS4 (GCN) color target with fewer fragments than samples (
CB_COLOR_ATTRIBNUM_FRAGMENTSbelowNUM_SAMPLES) stopped the run withAGC graphics: GCN color targets with fewer fragments than samples (EQAA) are not implemented. It is the current stop of Grand Theft Auto V (CUSA00419) after 34.5 s, blocker 7 in #18084, which no issue or pull request tracked.DecodeGcnColorBuffernow reads these targets as the AGC path's decoder has since #9700 and #9450:samplesis the coverage sample count andeqaaFragmentsthe fragment count, so the target is drawn at its coverage samples as a host-resident target (feat(agc): draw PS4 multisampled color targets as host-resident targets #9892), with its color memory guarded over the fragments it stores. It needsCB_COLOR_INFOCOMPRESSIONand aCB_COLOR_FMASKbase, as on the AGC path, and throws without them.coverageSamplesset, drawn by the AGC path's one-fragment code. WithCOMPRESSIONits FMASK base is recorded, and that code guards it.The AGC path sizes both FMASK guards (
fmaskBytesandGuardOneFragmentFmask) with theSW_64KB_Z_Xlayout, which does not hold for GCN tiling: for a 64x64 target they guard 64 KiB where the PS4 FMASK is 4 KiB, so later guest data in that range would be refused. A GCN target now records the sizeCB_COLOR_FMASK_SLICEgives inColorTarget::gcnFmaskBytes, and both guards use it for GCN tile modes: (tile max + 1) × 64 pixels ofSiLib::HwlComputeFmaskBitsbpp = 1,numSamples = 8bpp = 2bpp = 4A slice is pitch × height × bpp × samples bits in addrlib's macro-tiled layout, and Mesa programs
TILE_MAXas pitch × height / 64 − 1 of the FMASK surface (ac_surface.c). The register fields are GFX7's from Mesa'sgfx7.json.gcnFmaskBytesis 32 bits (at most 2^22 tiles × 64 pixels × 32 bits = 1 GiB) and fills padding afterfmaskPipeBankXor, sosizeof(State)stays 952 and the pipeline journal, which records no FMASK field, is unchanged.Update, 2026-11-12, later array slices (
f348629c5c, withmainc85dcfd005merged in asb58d7b1f4d): aCB_COLOR_VIEWof slice n of a target storing 2 or more fragments started n single-sample slices pastCB_COLOR_BASE, as onmain, and its CMASK and FMASK at their bases. A slice holds all stored fragments, as addrlib sizes it with its samples (egbaddrlib.cpp), and Mesa programs the color, CMASK and FMASK bases for slice 0 and the layer only inCB_COLOR_VIEW(ac_descriptors.c, L1177), so the CB steps all three per slice. Slice n of a multisampled, EQAA or one-fragment target now starts n slices of its stored fragments past the base, and its CMASK and FMASK nCB_COLOR_CMASK_SLICEandCB_COLOR_FMASK_SLICEsizes past theirs; a single-sample target keeps its stride. A later slice of the 2D-tiled modes still throws here; #18721 places single-sample ones.Unchanged: FMASK contents are not modeled (the plane is guarded, never written); a one-fragment target with
FAST_CLEARstill throws as a single-sample fast clear; and a PS4 multisampled target, EQAA or not, still throws when it is first drawn without a fast clear (initial multisample color contents with CMASK require a modeled metadata import, orinitial multisample color footprint is not implementedwithout CMASK). The new test introduces its targets with a fast clear.Debt: the "PS4 (GCN) multisampled color targets" entry now covers EQAA and one-fragment targets, the FMASK size and what still throws, and a new "PS4 (GCN) color array slice strides" entry says where a later slice, its CMASK and its FMASK start.
Overlap:
tools/pr_overlap.py --branch claude/zealous-brown-h1u67ragainstmain9e3265259eand the 2011 open pull requests reported no overlap with those it could compare and failed closed on 39 that already conflict withmainand sharedocs/dev/debt/libSceAgcDriver.md,State.hpp,State.cpporMultisampleTarget.cppwith this branch. Merged intomainand into this branch, each of the 39 conflicts in the same files with the same number of hunks, except #14212, which puts a blank line between all debt entries and gets one more hunk on the entry this branch rewrites; a merge keeps both. Of them, #9748, #9895, #10249 and #11551 editState.cpp, none in the GCN color target decode or its FMASK fields, and #9895 and #11551 keep the EQAA refusal.GTA V's target is a 4-sample, 1-fragment target with
FAST_CLEARandCOMPRESSION(adam25136's run in the comments): this PR draws it as one stored sample and still refuses its fast clear, atPS4 color target fast clear (CMASK) is not implemented. #18177 materializes the fast clears of single-sample and one-fragment PS4 targets on top of this branch and depends on it; until this PR merges, #18177's diff includes it.Tested
Windows 11 (10.0.26200.9711) with WSL2 Ubuntu 24.04.5 LTS (kernel 6.18.54.1-microsoft-standard-WSL2), gcc 13.3.0,
-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON, test targets only. Vulkan device: lavapipe (llvmpipe (LLVM 20.1.2, 256 bits), Mesa 25.2.8, Vulkan 1.4.318); the machine's GeForce RTX 3080 has no Vulkan driver inside WSL2. No title or console.agc_gcn_color_target(CPU): the newFewerFragmentsDecodechecks 4/2, 8/2, 8/4 and 4/1 targets (samples, coverage samples, fragments, FMASK base and size, no FMASK or CMASK on an uncompressed one-fragment target) and the four refusals.agc_driver_gcn_eqaa_color_target(PS4 shader mode, hand-encoded GFX7 shaders, guest memory below 2^40): fast-clears and draws a 4-sample 2-fragment target and a 4x target with the same two triangles. Their CB resolves are identical and hold 102 quarter- or three-quarter-coverage channels; the EQAA FMASK guard ends at the 4 KiBCB_COLOR_FMASK_SLICEgives, as does that of a compressed one-fragment target, and the color guard covers the two stored fragments only. It passes 3 of 3 runs.main946133f92f, the same test (without its twogcnFmaskByteschecks, as the field does not exist there) stops at the title's message:AGC graphics: GCN color targets with fewer fragments than samples (EQAA) are not implemented.a test read of 0x800051000+0x100 overlaps the FMASK of EQAA color target 0x800050000+0x10000, and the same for the one-fragment target).main946133f92fand on this branch, same machine, withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationin the build directory:ctest -R '^(agc_gcn_color_target|agc_driver_eqaa_color_target|agc_driver_graphics|agc_driver_gcn_.*|agc_driver_.*multisample.*|agc_driver_cached_image_multisample_guard|agc_driver_sample_multisample_target)$' -E sampled_cache_budget -j 8 --timeout 300 -V: 28 of 28 pass onmain, 29 of 29 on this branch. The Khronos validation layer is Ubuntu's 1.3.275, loaded throughVK_LAYER_PATH; the loader logsInsert instance layer "VK_LAYER_KHRONOS_validation", and neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS. The only VUID in either log isVUID-VkDeviceCreateInfo-pNext-pNextat device creation (tests: with a Vulkan validation layer older than the repo's headers, agc_driver_image_table* fail on main from VUID-VkDeviceCreateInfo-pNext-pNext (unknown VK_KHR_shader_fma / VK_KHR_maintenance8 structs) #17693: the layer is older than the repository's headers), with the same count in every test of both runs, plus one for the new test's device.python3 tools/check_conventions.py --base upstream/main: all conventions checks passed. The branch merges cleanly withmain9e3265259e, which changed none of its files.GcnColorTarget.cppdoes.b58d7b1f4d:agc_gcn_color_target's newMultisampledSlicesDecodedecodes slice 1 of a 4x array 4 single-sample slices past the base with its CMASK one CMASK slice past its base; slice 2 of a 4-sample 2-fragment array 2 × 2 slices past, with its FMASK and CMASK two of their slices past; slice 3 of a compressed one-fragment array 3 single-fragment slices past, with its FMASK three FMASK slices past; and slice 0 at the three bases. Removing the fragment factor, the CMASK offset or the FMASK offset each fails it.mainc85dcfd005. Neither log containswas not found but was requested by env var VK_INSTANCE_LAYERS, and every test logs the sameVUID-ids and counts on both (VUID-VkDeviceCreateInfo-pNext-pNextat device creation, and 2 and 36VUID-vkCmdDraw-None-07629inagc_driver_native_multisample_depthandagc_driver_sample_mask_multisample), plus the new test's device-creation message.agc_gcn_color_target,agc_driver_graphics,agc_driver_gcn_eqaa_color_target,agc_driver_gcn_fast_clear_color_targetandagc_driver_gcn_color_array_slices.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code