Repository navigation
feat(agc): lay out PS4 multisampled depth textures - #22629
Conversation
A 2D multisampled PS4 T# in a depth tile mode (2, 4 or 8 samples, one level, one slice) now has a size and an address equation instead of throwing in describeGcnSurface. GcnTiling and ComputeGcnMipLayout take a sample count: the samples of an element sit next to each other in the micro tile (addrlib's depth sample order), so a micro tile holds 64 elements times the sample count, and the tile split and macro tile mode follow from that larger micro tile, as in addrlib's ComputeSurfaceAddrFromCoordMacroTiled and HwlComputeMacroModeIndex. Color tile modes (FMASK), mips, arrays and more than 16 split slices still throw. The test compares the equation with a separate addrlib-style implementation for every depth tile mode, element size and sample count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
|
Head No new failures and no new validation messages on either GPU.
Layer runs used AI-assisted: yes |
What
On
main, describing a PS4 (GCN) 2D multisampled texture throws indescribeGcnSurface(PS4 multisampled textures are not implemented), so a PS4 multisampled texture has no guest size or layout. inFAMOUS Second Son stops there once #21961 lets its compute shader load the title's 2-sample depth buffer (see Tested). This gives a 2D multisampled T# in a depth tile mode its PS4 layout.GcnTilingandComputeGcnMipLayouttake a sample count (default 1, so every existing caller is unchanged). Depth surfaces use addrlib's depth sample order: the samples of an element are stored next to each other, so an 8x8 micro tile holds 64 elements times the sample count. The tile split then cuts that larger micro tile into slices a whole surface apart, and the smaller of the tile split and the micro tile picks the macro tile mode, asComputeSurfaceAddrFromCoordMacroTiled(r800/egbaddrlib.cpp) andHwlComputeMacroModeIndex(r800/ciaddrlib.cpp) in Mesa's addrlib compute them. In the address equation the sample index takes the bits between the byte bits and the pixel bits (a newGcnSampleShiftnames its coordinate bits); everything after that is the existing split, pipe and bank code.describeGcnSurfacegives such a T# (2, 4 or 8 samples, one level, one slice) one level of pitch x padded height x element bytes x samples, with a row pitch that holds every sample of a row, as the PS5 multisampled description has. inFAMOUS's 2-sample 32-bit depth T# (pitch 1792, height 1800, tiling index 1: the 128-byte split, four split slices, and in this base layout macro tiles of 128x128) comes to 1792 x 1920 x 4 x 2 = 0x1a40000 bytes, the distance between itsDB_Z_READ_BASE(0x3054a0000) andDB_STENCIL_READ_BASE(0x306ee0000); the 64-byte-split mode (256x128) pads to the same size. The test checks both. The title's depth target uses PS4 Pro alternate tiling, which neithermainnor this PR models: its DB_DEPTH_INFO (0x00131241) gives pipe config 18 (P16, 16 pipes), 8 banks, bank width 1, bank height 4 and aspect 2, so its macro tiles are 256x128 and its addresses are not this layout's; 1792 is a multiple of 128 and 256 and 1920 of 128, so the size is the same. feat(agc): lay out PS4 multisampled color textures in 2D tile modes #23672 has more on alternate tiling. An earlier version of this description gave the base layout's 128x128 as the title's.createFilledhas no PS4 tile modes). Only the size and the address equation are new: sampling still goes through the resident depth target. The sample bits sit at bits 28 to 30, in the equation's slice field (bits 24 and up); the GPU detiler, which puts the layer there, never gets a multisampled equation (it callsGcnTilingwithout samples).native multisample depth arrays or non-Z_X layout are not implemented), which assumes PS5 layouts. Importing and publishing the samples in the PS4 layout builds on this equation and is follow-up work; sending the layout first lets it be checked against addrlib on its own and keeps that change smaller.PS4 (GCN) multisampled depth textures, next to the other PS4 tiling entries.Tested
Windows 10 Pro 22H2 (19045), NVIDIA GeForce RTX 5080 (driver 621.14), WinLibs GCC 15.2.0 (r7), CMake 4.3.1, Release, this branch on
mainbef2f1f77dfor everything below; then rebased onto92b7c3747d, whose new commits touch none of the files this changes, whereagc_driver_graphicspasses again.main's ownagc_driver_upload_cache_read_only_flush_testsdoes not build with MinGW (setenv; open #19899 fixes it), so the builds went on past it.RunTextureTilingTests(ctestagc_driver_graphics), with a newgcnMultisampleTilingTests:referenceGcnAddress, extended with the sample) places it, and no two samples share an address. That is 80 layouts; the 4 that would split into more than 16 slices throw instead;GcnTilingwith samples in a color mode still throw.It passes, and each of 8 deliberate breaks fails it: samples after the pixel bits (color order), no sample bits, a micro tile without the samples, the size, split stride or row pitch without the samples, the color-mode refusal removed (the layout's own check then throws another message, which the test rejects), and the 2D multisampled refusal kept. It also passes in a build configured with
-DANYPS5_ENABLE_SPIRV_TOOLS=ON.tools/select_tests.pyselects for the 4 changed files (ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1), onmainand on this branch.agc_driver_bda_device,agc_driver_msaa_dcc_unwatch(DCC unwatch did not preserve unchanged data or refused a real write incorrectly),agc_driver_stencil_plane_memory,agc_driver_store_over_untrackedandperformance_runner_PerformanceRunTests(a clean performance capture refusesANYPS5_NO_SHADER_CACHE) fail on both,agc_driver_upload_cache_read_only_flushis not run on both (it does not build, as above), and the same 25 tests are skipped on both. Three VideoOut tests,guest_video_out_flip_rate,guest_video_out_window_margins_boundsandvideo_out_hdr_present, went over their own time limits (20 s, 20 s and 30 s) on this branch only, while another build was running on the machine; rerun by themselves three times on this branch, all three passed every time in about 1 s.VK_LAYER_KHRONOS_validation1.4.367 (VK_ADD_LAYER_PATH=<the layer's folder> VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer VK_LOADER_LAYERS_DISABLE=~implicit~ ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1), the 56 tests matchingagc_driver_graphics$|gcn|tiling|detile|multisample|msaa,ctest -V, onmainand on this branch: each log has 55Insert instance layer "VK_LAYER_KHRONOS_validation"lines from 49 tests, no "was not found" line and noVUID-message; on both, 52 pass, 3 are skipped andagc_driver_msaa_dcc_unwatchfails as above.main'stools/unwrap_self.pyand converted with--windows --registry --trace-imports. Both starts ran onmainbef2f1f77d(which has the output-mode fix, fix(libSceVideoOut): accept an output mode left at any in every field #22517) with feat(shader): offer a 2D MSAA mode to GCN image loads #21961, feat(libSceGnmDriver): export the workload, trace and tessellation si… #18235, feat(libSceGnmDriver): share mode-independent command writers #17711 and fix(libSceSysmodule): accept four PS4-only module ids in a PS4 process #18184 merged locally (feat(libSceGnmDriver): share mode-independent command writers #17711's one conflicting file,libSceGnmDriverForNeoMode/Export.cpp, keptmain's version) and a local answer for libSceDiscMap'sfJgP+wqifno(asked about on closed feat(libs): PS4 imports and a buffer option inFAMOUS Second Son needs #10531): the open PRs it needs to reach this shader. One traced start each:0x2f2fa2500, withPS4 multisampled textures are not implemented;native multisample depth arrays or non-Z_X layout are not implemented.python tools/check_conventions.py --base origin/mainwith this title and description: all checks passed.python tools/pr_overlap.py --branch: open feat(libSceAgcDriver): support PS4 2D thick tile mode 20 for volumes #20786 (Gag21, PS4 2D thick tile mode 20) changes the same lines ofGcnTiling(how the bit order and the micro tile size are formed) and conflicts with this branch inTextureTiling.hpp,TextureTiling.cppand the tests. The two compose (sample bits for depth modes, the thick order for mode 20); I will rebase on it if it lands first. Open draft fix(agc): keep texture images inside their extent's mip chain #6280 also touchesTextureTiling.hppandTextureTiling.cpp; it conflicts withmain, sopr_overlapcould not compare it.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)AI-assisted: Claude Code wrote the change and its tests from addrlib's formulas, ran the tests and the inFAMOUS starts, and drafted this description; separate review agents checked it.
🤖 Generated with Claude Code