Skip to content

feat(ps4): tile mode 19 (Thick_1dThick) and quad lists for Gang Beasts (CUSA04865) - #4

Open
ntamas94 wants to merge 2 commits into
Get-fix:ps4/limbo-gpufrom
ntamas94:fix/ps4-thick-tiles-quad-lists
Open

ntamas94 wants to merge 2 commits into
Get-fix:ps4/limbo-gpufrom
ntamas94:fix/ps4-thick-tiles-quad-lists

Conversation

@ntamas94

@ntamas94 ntamas94 commented Oct 20, 2026 •

Copy link
Copy Markdown

What

Two more gaps in this PR's PS4 path that Gang Beasts (CUSA04865, Unity, my own dump) hits, each in its own commit so you can take either. They complement #1 (which lays out 3D textures in the thin modes) and #3.

  1. Tile mode 19 (Thick_1dThick). A T# with tile mode index 19 threw. The mode stores 8x8x4 micro tiles. Within a tile the elements follow addrlib's ADDR_THICK order for their size (8 and 16 bits: x0 y0 x1 y1 z0 z1 x2 y2; 32 bits: x0 y0 x1 z0 y1 z1 x2 y2; 64 and 128 bits: x0 y0 z0 x1 y1 z1 x2 y2). The depth is padded to a multiple of 4 and each level keeps its slices as slabs of four. Only thick 3D textures take this layout; a block-compressed volume, which addrlib lays out thin, throws. I checked the layout against addrlib, Mesa, GPCS4, shadPS4 and fpPS4. New TextureTiling cases check that a micro tile maps its 8x8x4 elements one to one, the first steps of the element order for each size, and the level and slab offsets of a small volume.

  2. Quad lists (primitive type 19). A QUADLIST draw threw. Each quad is now drawn as a patch of four control points through the generated rect-list stages. On GCN the VGT splits a quad so that the provoking vertex is in both triangles; with the first provoking vertex (PA_SU_SC_MODE_CNTL.PROVOKING_VTX_LAST = 0) that gives (v0,v1,v2) and (v0,v2,v3). The Vulkan quad tessellator splits an all-ones patch along its (1,0)-(0,1) diagonal (measured on an RTX 2080; the D3D11 reference tessellator does the same). So the control shader places v1, v2, v0, v3 at (0,0), (1,0), (0,1), (1,1). Flat parameters come from v0. A quad list with the last provoking vertex throws, through the existing check for generated-primitive pipelines. The pipeline key and the pipeline journal format carry the quad flag.

    • QuadListDiagonal (new execution test) draws a concave quad through the whole driver. It checks that both triangles of the v0-v2 split are drawn and that the notch, which only the v1-v3 split would cover, stays empty. It fails with the corner order of the v1-v3 split.
    • agc_driver_graphics gets a quad-list state case: the decode, four control points, a rect-list control shader rejected for a quad state, and the last provoking vertex rejected.

Merging next to the other two PRs: with #1, describeGcnSurface conflicts in two lines. Keep #1's lines and put this PR's single line before them: it sends only thick-mode 3D textures to the new volume layout, so #1's thin 3D path is unchanged. The debt file conflicts with #1 and #3 only because they edit neighbouring lines. I can rebase onto whichever lands first.

Not in this PR: GCN v_cmpx. RDNA's v_cmpx writes only EXEC, so the GCN form, which also writes VCC or an SGPR, needs a second instruction or a tag the IR lowering acts on. The decoder takes one RDNA instruction per GCN instruction, so it would best follow the tag #1 adds for V_RSQ_CLAMP_F32.

Tested

Windows 11 Pro (26200), WinLibs GCC 15.2.0 r7, NVIDIA RTX 2080, on this branch at 93eeee0: agc_driver_graphics and agc_driver_quad_list_diagonal pass. Locally, with both changes and the rest of my bring-up branch, Gang Beasts plays a full round (boykopovar#7941). Linux was not run locally.

Checklist

🤖 Generated with Claude Code

ntamas94 and others added 2 commits October 20, 2026 04:50
…Thick)

A GCN T# with tile mode index 19 threw. The mode stores 8x8x4 micro tiles: within a tile the elements follow addrlib's ADDR_THICK order for their size, the depth is padded to a multiple of 4, and each level keeps its slices as slabs of four. Only thick 3D textures take the new layout; a block-compressed volume, which addrlib lays out thin, throws. The new tiling cases check that a micro tile maps its 8x8x4 elements one to one, the first steps of the element order for each element size, and the level and slab offsets of a small volume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ellation stages

Primitive type 19 (QUADLIST) threw. Each quad of four vertices is now drawn as a patch of four control points through the generated rect-list stages. The control shader orders the corners so that the patch splits into (v0,v1,v2) and (v0,v2,v3) with flat parameters from v0, which keeps the first provoking vertex in both triangles as the GCN VGT does; it relies on the quad tessellator splitting an all-ones patch along its (1,0)-(0,1) diagonal. A quad list with the last provoking vertex throws. The pipeline key and the pipeline journal format carry the quad flag.

QuadListDiagonal draws a concave quad on the GPU and checks that the notch between v1, v2 and v3 stays empty; it fails with the other diagonal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Get-fix

Get-fix commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Thanks @ntamas94. boykopovar#6977 is now a draft integration branch, and its own work is split into boykopovar#9429 to boykopovar#9433 (details). The maintainers asked that the branch not land anything without its own review, so could you open this upstream against main, on top of boykopovar#9431, with Depends on? Once it's open, I'll merge it into ps4/limbo-gpu, list it as a member and run Limbo with it. ps4/limbo-gpu now moves to the split branches, so this pull request may show conflicts here.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

@ntamas94

Copy link
Copy Markdown
Author

Opened the tile mode 19 commit upstream as boykopovar#9674 against main, on top of boykopovar#9431, with Depends on. I left the quad-list commit out: main already draws quad lists through a generated triangle-list index buffer, for both the first and the last provoking vertex.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants