feat(agc): draw tessellation followed by an NGG geometry stage #6612
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6612"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-15T22:54:03Z.
What
Crimson Desert (PPSA25286, 01.000.568) stops on
main12 to 14 s in, while it resolves the shader ABIs of its first graphics stages:Its tessellated draws feed an NGG geometry stage. From a throwaway print of the first one:
VGT_SHADER_STAGES_EN0x60212dSPI_SHADER_PGM_LO_LS(0x148)SPI_SHADER_PGM_LO_HSSPI_SHADER_PGM_LO_ES(0xc8)VGT_LS_HS_CONFIG/VGT_TF_PARAM0x1043f/0x4004aVGT_ESGS_RING_ITEMSIZE/VGT_GS_MAX_VERT_OUT/GE_MAX_OUTPUT_PER_SUBGROUPmainrefuses the combination, and with that refusal lifted it would refuse wave32 tessellation next. The enum already hasShaderPath::TessellationGeometry, unused until now. This PR draws that path.How
The geometry half needs the subgroup: its threads share LDS, use
s_barrierand allocate their output withGS_ALLOC_REQ, which only the mesh path runs. A Vulkan geometry shader can't run it per triangle, and a mesh shader can't follow the tessellator. So the draw takes two passes:s_cbranch_execz, which skips the vertex threads' part. Its ESGS LDS writes (thread index × item size) become domain outputs. A generated geometry shader (BuildTessellationCaptureGeometryShader) appends each tessellated triangle's three items to a device-local buffer and keeps the mesh draw arguments in a small header: one group perprimitivesPerGrouptriangles, and three indices per triangle.s3. Its entry copies the group's captured items into LDS where the vertex half would have written them, then runs the geometry half unchanged. It is drawn withvkCmdDrawMeshTasksIndirectEXTfrom the header, after a geometry-shader-write to indirect/mesh-read barrier, in a new render pass.The hull side:
ControlSharedrecords, the read of a write uses the lane's own record, and the bounds checks use the 2-byte end.HS_W32andGS_W32are accepted: local and hull programs compile with the hull wave size, domain and mesh programs with the geometry one.The compile modes follow from fields the request already serializes (a mesh configuration on a domain program, a tessellation configuration on a mesh program). The request format doesn't change beyond #6679's version 37; the cache key gains a word for each new mode.
The approximations are in the technical debt files: triangles reach the geometry half in the order the capture claims them, at most 2^20 per draw, the geometry half's primitive ID is the captured triangle's index, and instanced draws throw.
Tested
Capture draw after an ordinary draw in one batch (
004f49875e, after @oneandonlydean's review): the capture pass now keys its render pass by rasterizer discard, so it can't continue an open pass that has attachments. A newagc_driver_tessellation_geometrycase records an ordinary tessellation draw and then a tessellation-geometry draw into the same resident target with no wait between, and compares the image with the ordinary draw alone.Khronos layer 1.4.363 over the 12 tessellation and journal tests: with the new case and without the key change (a371244bf8),
VUID-vkCmdDrawIndexed-colorAttachmentCount-06179x2. With the change, noVUID-messages; 12 of 12 pass on both.The 12 tests pass 3 of 3 on Linux. On the Windows 11 VM (GT 1030, WinLibs GCC 15.2.0 r7), the merge base passes 11 of 11 3 of 3 and this head 12 of 12 3 of 3.
Current head
1168a21b8c, rebased ontomain2dc85609fc, which changedDraw(): it takes aDrawTraceContext(#5431) and the driver'sDraw.cppgained<algorithm>.drawTessellationGeometrynow takes the draw's trace context and passes it to both of its inner draws, so traced tessellation-geometry draws keep their trace; the include conflict keepsmain's<algorithm>and this branch's<map>. The journal format stays 12 (mainis at 10), and the guards stay 904 / 160 (main's 832 / 112 plus this branch's fields), confirmed by the build. The 12 tests below pass 3 of 3 on this head. On the Windows 11 VM (GT 1030, WinLibs GCC 15.2.0 r7), the merge base passes 11 of 11 and this head 12 of 12, 3 runs each, withagc_driver_tessellation_geometryskipped there (no mesh shaders).75a06af9a9, rebased ontomainc035bd5b7afterb76ab1f6c0(one-fragment multisampled colour targets) grewStateto 832 bytes there; the only conflict was the journal's size guard, which is now 904 (832 plus this branch's 72), withShaderStagesat 160. The 12 tests below pass 3 of 3 on this head.d175c08f94, rebased ontomaind0e7fe7bebafter #9348 took journal format 10; the only conflict was that line, and this branch keeps its provisional 12 (#8365 takes 11) until it is set tomain+1 at landing. The 12 tests below pass 3 of 3 on this head.b6f3131b54, rebased ontomainc9b75825f3after #8999, which conflicted inDraw():mainnow opens it withDepthCopySourceScope, and this branch's early return for tessellation followed by a geometry stage comes right after that scope, so it covers those draws too. The 12 tests below pass 3 of 3 on this head.ce4748f0fa:e6db936606plus a fix from @oneandonlydean's review.ImpliesNotreturned at a negated condition, so a predicate!!a(a complemented own-lane ballot bit of!aafter lane-bit lowering) never proved!afalse, alone or in either order of a conjunction; each check now falls through when it doesn't prove the negation. Three newagc_tessellation_loweringcases build that hull read and must lower at its address; withmain'sImpliesNotall three are refused 3 of 3 (not a whole number of control points), and with the fix the 12 tests below pass 3 of 3.e6db936606was rebased ontomaind098eca3d6, which conflicted inTessellationLowering.cpp:mainaddedImpliesNot, which covers what this branch'sExcludesdid (a predicate that implies a condition's negation) and also a negated condition, so the branch callsImpliesNotat its two sites and dropsExcludes. The journal commit takes format 12.mainis at 9, and 10 is also used by #6959, #8212 and #10420 and 11 by #8365, so this bump can't merge silently with any of theirs. Linux (Ubuntu 26.04.1, GCC 15.2, Release, RTX 4070 Ti, 615.71.09): the tessellation, pipeline journal,agc_driver_graphicsand pixel LDS tests (12) pass 3 of 3.Previous head
ae86a022f6, onmain11d6efa06c: the same 12 passed 3 of 3 on Linux, and onf28839f3c5on the Windows 11 VM (GT 1030, 582.66, WinLibs GCC 15.2.0 r7), withagc_driver_tessellation_geometryskipped there (no mesh shaders).Earlier heads: Linux (Ubuntu 24.04, GCC 13.3, Release), RTX 4070 Ti, NVIDIA 595.99.
agc_driver_tessellation_geometry(new, GPU). It drawsTessellation.cpp's three patches (levels 1, 0 and 5) through the plain tessellation path, then through the new path, with a merged domain and geometry program. That program writes the same position and colour as an 8-dword item, and its geometry half (the mesh fixture's NGG program reading items instead of indices) emits each triangle unchanged. The two images must be equal in every pixel, unculled and back-face culled, for wave64 and wave32 stages. The same comparison runs again into a resident tiled target, where both draws are recorded into the open batch (the path titles take), byte for byte. A last part registers a type-3 merged hull and the merged domain program and resolves their graphics ABI, which compiles all four roles through draw decode, once at wave64 and once withHS_W32(as Crimson Desert sets it). A throwaway check that throws when a wave32 merged hull is compiled fails only with theHS_W32registration.agc_driver_tessellation: two variants of #6679's merged hull program use 16-bit LDS accesses with the same values, so the patches must draw exactly as with the 32-bit program. @SleglJan's case splits the local part's x-position write intods_write_b16_d16_hi(high half first) andds_write_b16. The second half's read-modify-write must then keep the first, and the value is read back through the control point's own record. It fails if that read uses control point 0's record, or if it merges into 0 instead of the record's current word. The other case splits a 32-bit read of the level intods_read_u16andds_read_u16_d16_hi. My first version split only a write that is never read back, which SleglJan found didn't check the write side. With #6679 alone, the cases fail withonly 32-bit LDS reads and writes are supported in tessellation stages at pc 0x84.agc_driver_graphics:0x60212ddecodes as TessellationGeometry with the expected subgroup (10 triangles of 30 vertices, 192 threads, wave32 hull and domain) and only registers the draw key covers.0x0260210ddecodes as wave32 tessellation. PRIMGEN_PASSTHRU or a missing PRIMGEN_EN with GS_EN is refused.agc_driver_tessellation_geometryandagc_driver_graphicsuse the new state fields and the capture shader, so they don't build onmainor on #6679. The newTessellation.cppcase fails on #6679 as above. All three pass 3 of 3 with this PR.mainb7a451d62b(head8783ad1e29), after #6801 merged, as @oneandonlydean asked. The journal format is 9, andsizeof(State)is 896 on the rebased tree, confirmed by the build'sstatic_assert.ShaderStagesstays 160. The recipe codec and canonical state carry #6801's point fields and this PR's rasterizer discard.ShaderRegistry.cppkeeps #6801'sApplyPointSizeand this PR'sStageMeshConfiguration, andShaderInputInfoBuilder.cppkeeps both new flags. The 17 tests matching^agc_driver_graphics$|tessellation|journal|serializer|mesh|geometrypass 3 of 3. With the Khronos validation layer (1.4.363),mainpasses 16 of 16 and this head 17 of 17, with no VUID. On the Windows 11 VM (GT 1030, R580), the 18 matching tests pass 3 of 3 on this head,agc_driver_tessellation_geometryincluded.mainf6075c2f4a(heada785b13a95), after #7948 grewStatefrom 784 to 800 bytes. The one conflict was the size check inPipelineJournal.cpp; it is now 872,main's 800 plus this PR's 72, andShaderStagesstays 160. The build confirms both. On that head (Ubuntu 26.04.1, GCC 15.2, RTX 4070 Ti, 615.71.09), the 17 tests matching^agc_driver_graphics$|tessellation|journal|serializer|mesh|geometrypass 3 of 3. Under the Khronos 1.4.363 layer, the same set passes onmain(16, without this PR's test) and on this head (17), with noVUID-message on either side. The journal format stays 7 here; #8115 and #8365 also take 7, so whichever lands later renumbers.maincc0078595d(head6aa4f7cc7f). #8992 splitGraphics::Drawinto a prepare and a record step.drawTessellationGeometrynow sits just before the newDraw, and the hand-off to it is at the top of that function. It still draws both passes throughDraw, and theDraw.cppchange is otherwise line for line the same. The journal format stays 7 andsizeof(State)stays 856. The 17 tests matching^agc_driver_graphics$|tessellation|journal|serializer|mesh|geometrypass 3 of 3,agc_driver_tessellation_geometryamong them.main275e896797(head dfc290f4ae). #7869 took journal format 6 for its polygon modes, so the journal commit now takes 7.Pipeline.cppkeepsmain'spolygonModelines, with this PR'srasterizerDiscardEnableafter them.sizeof(State)stays 856. The 8 tests matchingtess|Tess|hull|Hull|pipeline_journal|^agc_driver_graphics$pass 2 of 2.main3aa4448ed3), head 09356fedba. #6941 merged with request version 38, so #6679 now reads its merged-hull flag from 39, and this PR reads it from there with the rest of #6679 (it adds no version of its own). Four conflicts came frommain's mesh barycentric change (#6941). InCacheKey.hpp,appendMeshkeeps #6941's pixel key and barycentric layout, and this PR's domain-stage ESGS key and tessellation tag. The tag comes before the barycentric block, which can return early. InShaderValidation.cpp, both added extension clauses stay, along with #6941's per-primitive checks and this PR's position check under rasterizer discard. InDraw.cpp, the tessellation geometry stage is inserted before #6941's barycentric pairing. InDrawCapture.cpp, this PR's push limit and mesh configuration take #6941's barycentric argument. The 16 tests matching^agc_driver_graphics$|tessellation|journal|serializer|mesh|geometrypass 3 of 3. Under the LunarG SDK's 1.4.363 layer,^agc_driver_graphics$|tessellation|journal|mesh|geometrygives no validation messages on #6679's head (14 tests) or on this head (15).main0fbfd91e5e), head 77d218a50a. #6679 now writes request version 38 and resolves both conflicts adriadam10 listed: #6931's indirect record words and the serializer fixtures. This PR's three commits apply on it without a conflict. The 635 broad-set tests pass onmain, and 636 of 636 with this PR. The tessellation, journal and serializer tests pass 3 of 3. Under the LunarG SDK's 1.4.363 layer,tess|journalreports nothing onmainor on this head.VUID-vkCmdDrawIndexed-colorAttachmentCount-06179×12 in the capture pass. A discarding pipeline has no fragment output state, so it has no color attachments, while the pass began rendering with the draw's targets.Pipeline::Beginnow begins a discarding pass with no attachments. Under 1.4.363,tess|journalreports nothing onmainf72c7aacfaor on this head. The 631 broad-set tests pass, and the tessellation, journal and serializer tests pass 3 of 3.VK_LAYER_PATH,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V, RTX 4070 Ti,tess|journal). Neither log reports the layer missing. On 235f5130c0 it found two errors this PR added, 9 each, inagc_driver_tessellation_geometry:VUID-VkGraphicsPipelineCreateInfo-pStages-06894andVUID-RuntimeSpirv-OpEntryPoint-08743. The capture pass discards its primitives but still carried the pixel program, which reads a location the capture geometry stage doesn't write. Head 7570d583d6 leaves the pixel program out of that pass: it has four stages, andValidateShadersexpects four and checks no color exports for it. The pixel program still runs in the mesh pass that draws the captured triangles. Nowmainf72c7aacfaand this PR report onlyVkDeviceCreateInfo-pNext-pNextandVkGraphicsPipelineCreateInfo-pLibraries-06681, which this older layer gives for every device-creating test, and nothing new. The 631 broad-set tests pass, and the tessellation, journal and serializer tests pass 3 of 3.mainf72c7aacfa(head 235f5130c0), with #6679's commit still first, as @adriadam10 asked. The one conflict wasmain'sbool quadList(#6529) next to this PR'srasterizerDiscardandtessellationCaptureinState.hpp, and both are kept.sizeof(State)stays 856, because the bool fits in padding, so the journal guards are unchanged. Quad-list draws are never journaled:Draw.cppclearsrecipeOutfor them, and the recorder returnsNotRecordable. So the codec doesn't carryquadList, and a decoded recipe'sfalseis what it was recorded with. The 630 tests in the broad driver/recompiler/journal set pass onf72c7aacfa, and 631 of 631 with this PR. The tessellation, journal and serializer tests pass 3 of 3.StagePushLimitnow also takes the depth remap limit, inmain's order: mesh, tessellation before rasterization, depth remap, then the slot. The push-constant validation keeps both the depth-remap push and the tessellation capture terms. The journal guards name the newState(856 bytes) andShaderStages(160 bytes) sizes, and the journal format becomes 6, since #5656 took 5 onmain. The AGC, shader, request, journal and tessellation set passes 614 of 615, against 613 of 614 on 3b69fde441 alone; the one failure on both isagc_driver_bda_device(#7584). The 6 tessellation, serializer and journal tests pass 3 of 3.main324e0e48e0), head 9825024871; it merges withmain7bc7905978cleanly. Two conflicts, both frommain: inShaderRegistry.cppthe stage loop now computes the push offset, then the deferral check, then decodes the vertex stage inside itstry, and this PR'sStageWaveSizeandStageMeshConfigurationreplace the fixed wave size andstages.meshthere; inDraw.cppthis PR's|| capturedsits besidemain'sKeepMultisampleTargetloop. The AGC, shader, request, journal and tessellation set passes 609 of 610, against 608 of 609 on 4e7fa2be55 alone; the one failure on both isagc_driver_bda_device(#7584). The 6 tessellation, serializer and journal tests pass 3 of 3.main17cfb1f4cbcleanly: the 6 tessellation, geometry, merged hull, journal and serializer tests pass 3 of 3, and the AGC area suite passes 897 of 898. The one failure isagc_driver_store_over_untracked, which also fails under-j6here without this PR and passes alone.main3e3e8b9050(723155ed20; #6679's commit still first). #7374 now sets the provoking vertex of geometry programs fromPA_SU_SC_MODE_CNTL.PROVOKING_VTX_LASTwhereDecodeShaderStagesbuilds theMeshConfiguration. This PR builds it in the sharedmeshConfiguration, so that computation moved there, and the tessellation geometry path gets it too.ctest -R ^agc_: 710/710 pass, including the two provoking vertex tests.main4524944: the 7 tessellation, geometry, merged hull, journal and serializer tests pass 3 of 3, and the 502 area tests pass exceptmain'sagc_driver_graphics(#6792) andagc_driver_store_over_untracked.main82ddae75b(10-16). #5884's line-strip output (outputPrimitiveSize) now goes through the sharedmeshConfigurationinState.cpp, which the tessellation-geometry path also uses; #5804's terminate-invocation checks and this PR's capture rules both stay inShaderValidation.cpp. #5875's pipeline journal guardsStateandShaderStages, so e4c4725f4 adds the hull wave size, the geometry stage after tessellation, the merged hull flag and rasterizer discard to its codec and canonical state, with journal format 4. A pipeline drawn with a tessellation capture validates against that draw's capture buffers, so it isn't journaled. ctest (^agc_driver_|^agc_vertex_barrier|recompiler|shader_cache|request_serializer|spirv|^agc_shader|bda|journal, 502 tests, with #6789's one-line test fix applied soagc_driver_graphicsruns to the end): 501 pass.agc_driver_tessellation,agc_driver_tessellation_geometry,agc_driver_graphics,agc_driver_prepared_graphicsand the journal tests pass 3 of 3; a recipe with these fields must decode with them.agc_driver_store_over_untrackedfails the same way onmain; #6385 addresses it. #6679 then read its merged hull flag under request version 31, whichmainuses for #5884; SleglJan moved it to version 32 (36529f17d). (On an earlier head, jotitadev found anagc_driver_prepared_graphicsfailure that my stale binary had hidden. That code is now #6679's, and the test passes.)Crimson Desert, scripted pad input:
main5d9dcc42dSPIR-V emission failed: ... opcode=Barrier reason=s_barrier in a vertex program that accesses LDS or GDS or writes memory is not implementedThe title is still building shaders and pipelines then and hasn't issued a draw, so it hasn't drawn the new path yet. With #6706 as well, which makes its large compute pipelines about 3x faster to create, it reaches its first draw at 597 s and stops there on
AGC graphics: fragment shader must export float4 colors to its attachments, which is a separate change. In a 905 s run (the previous head with #6613 and #6178), the shaders finish after about 7 minutes. After that, eleven compute pipelines of 110,000 to 870,000 SPIR-V words take 2 to 137 s each to create on NVIDIA, about 570 s in all, and the first draw still hasn't come. That's a separate problem, which I'm looking at. The rendering is checked by the tests above only.On the previous head (0eeb8159b), jotitadev ran it on an RTX 3070 (595.99.02) and on lavapipe (Mesa 26.0.3), Ubuntu 26.04, and confirmed the area tests there.
SleglJan reviewed the merged hull parts of de9f0f71c on an RTX 3080 (NVIDIA 615.78.08, CachyOS).
ctest -R 'tess|hull|prepared_graphics|shader_memory|request'passed 10 of 10, andagc_driver_tessellationandagc_driver_tessellation_geometrypassed 3 of 3 each.On de9f0f71c:
^agc_driver_(prepared|graphics$|tessellation|ngg|mesh|vertex|registered)pass or skip, andtools/check_skips.py --job linuxaccepts the 6 skips.agc_driver_tessellationnow runs its merged hull cases there, because #6679 runs the merged hull at one lane per invocation.agc_driver_tessellation_geometrystill skips, since the capture needs subgroup operations in tessellation stages.agc_driver_tessellationandagc_driver_tessellation_geometrypass 3 of 3 with no skips.@LeandroLP23 ran it on Windows 11 with an AMD Radeon 860M (RDNA 3.5, driver 32.0.13058.8001) (comment), in one build of
main6efb7261bwith this PR and six other pull requests:agc_driver_tessellation,agc_driver_tessellation_geometry,agc_driver_graphics,agc_driver_prepared_graphicsandagc_driver_store_over_untrackedpass 3 runs of 3.@JJenkx ran this head, rebased unchanged onto
main25c1aa1e79, on an AMD Radeon RX 6650 XT (RADV NAVI23, Linux) with Khronos validation (comment). They used a Mesa 26.2.5 build with twonir_opt_varyings.cfixes, because system RADV already segfaults while linkingmain's tessellation test pipelines. The nine groups both builds share pass 3 of 3 onmain, and the same groups plusagc_driver_tessellation_geometrypass 3 of 3 with this PR, with no VUID. Cocoon (PPSA08766) stops at about 82 s on both builds. On this PR it stops at the routing guard, since itsVGT_SHADER_STAGES_EN0x2135 setsES_ENto 2 where this path takes 1.@klosixgaming-arch ran Cocoon on Windows with this PR merged onto current
main(comment): it builds, and the title still stops after about 80 s at this PR's guard onVGT_SHADER_STAGES_EN=0x2135. That value has LS and HS on withES_EN= 2, a routing this PR does not take (it takesES_EN= 1, the domain shader in the ES stage); see the note to JJenkx.2 · level²slots per patch, where triangle patches hadlevel², too few from level 5 on (3n²/2triangles). A newagc_driver_tessellation_geometrycase draws the level-5 triangle patch alone atVGT_HOS_MAX_TESS_LEVEL5 and must match the tessellation path's image. With the old sizing it fails 3 of 3 (a dropped triangle). With the fix it passes 3 of 3, as doesagc_driver_tessellation.Not checked on a console.
Other open PRs touch neighbouring lines in the same files (for example #6176 in
ConstantFolder.cpp, #6188 inDrawCapture.cpp, #6215 inDraw.cpp). None of them draws this path; whichever lands second needs a small rebase.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
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T01:55:59Z.
Review: COMMENTED
Two failures on Linux that the PR body doesn't list.
Machine: NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, plus lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same machine. Ubuntu 26.04 (kernel 7.0.0-38), i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. Head89aa76a76merged intomain5d9dcc42d(clean merge).1.
agc_driver_prepared_graphicsfails with this PR on every run.ANYPS5_NO_SHADER_CACHE=1. lavapipe: 3/3 fail. Unchangedmainpasses it on both.AGC driver: registered program refers to an incompatible shader binary type, the check at the end ofRegisteredPrograminShaderRegistry.cpp. The last lines before it are theReportPreparedAtUsenotes for stages 5 and 7.^agc_driver_preparedtests pass.^agc_driver_|..., 468 of 469) should include this test, so maybe that binary was stale?2. On lavapipe, which the Linux CI job uses, the new tessellation cases fail.
agc_driver_tessellation:AGC graphics: subgroup capability 61 is unsupported for shader stage 2.agc_driver_tessellation_geometry: the same forshader stage 4.GroupNonUniform, and lavapipe'ssubgroupSupportedStagesis only fragment, compute, task and mesh, so it refuses the merged program's tessellation-control and tessellation-evaluation modules. The RTX 3070 has subgroups in those stages, and there both tests pass 3/3.main'sTessellation.cpp(the separate local/hull pair only),agc_driver_tessellationpasses 3/3 on lavapipe. So the existing coverage still works there, and only the new merged case and the new test need subgroup support in tessellation stages.subgroupSupportedStageslacks those stages. A skip message that names subgroup support already passestools/check_skips.py.Otherwise, on the RTX 3070:
agc_driver_tessellation,agc_driver_tessellation_geometryandagc_driver_graphicspass 3/3.main(new state fields), as the body says.ctest -R "^agc|shader|recompiler" -j1(flip, display andlds_atomics64excluded): 2 failures. One isprepared_graphicsabove. The other isstore_over_untracked, which also fails onmainhere (#6347).GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T02:03:32Z.
@jotitadev Thank you, both are real, and both are fixed in 0eeb8159b.
1.
agc_driver_prepared_graphics. Draw decode checked the local slot (0x148) for a merged type-3 hull by askingRegisteredProgramfor type 3 alone. That throwsregistered program refers to an incompatible shader binary typewhenever an ordinary type-5 local program is registered there, which is this test's setup. It now asks for type 3 or 5 and takes the merged local and hull roles only for type 3, so a separate pair decodes as onmain. The test passes 3 of 3 here now. You're right that my earlier count was wrong: my binary of that test must have been stale. I've corrected the description.2. lavapipe. As you found, the merged program and the captured domain half need subgroup operations in tessellation-control and tessellation-evaluation shaders. The merged case of
agc_driver_tessellationand the whole ofagc_driver_tessellation_geometrynow skip whenSubgroupStages()lacks the stage, with a message that names the missing subgroup support. On this machine's lavapipe,agc_driver_tessellationpasses with the merged case skipped andagc_driver_tessellation_geometryskips. The 30^agc_driver_(prepared|graphics$|tessellation|ngg|mesh|vertex|registered)tests pass or skip. On the RTX 4070 Ti nothing changes: the area suite is 468 of 469, with onlystore_over_untrackedfailing, as onmain.I've added your runs to the description.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T02:58:30Z.
Review: COMMENTED
Both fixes confirmed on my machine at
0eeb8159b.Machine: NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, plus lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same machine. Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. Head0eeb8159bmerged intomain5d9dcc42d(clean merge),-j1 --timeout 30.agc_driver_prepared_graphics: passes 3/3 on the RTX 3070 and 3/3 on lavapipe (previously 5/5 and 3/3 failures).agc_driver_tessellationpasses 3/3 with the merged case skipped ("needs subgroup operations in tessellation-control shaders");agc_driver_tessellation_geometryskips 3/3.^agc_driver_(prepared|graphics$|tessellation|ngg|mesh|vertex|registered): 30/30 on the RTX 3070. On lavapipe, 30/30 with 6 skipped:tessellation_geometryplus the 5 mesh/NGG/clip-distance tests that also skip onmain.tools/check_skips.py --job linuxon that lavapipe JUnit: all 6 skips expected.GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-16T04:19:24Z.
Data from 007 First Light (PPSA11386 v01.018.000), which registers its tessellation hull programs as type 3 too, on Linux 7.2.10, RTX 3080, driver 615.78.08, in a bubblewrap sandbox. Stack:
main4186f06a9plus open PRs, unpublished local fixes the title needs, local logging and scripted input, and the title's two feedback-wait limits widened in its executable as described in #6172 (local only). For this run my merged-hull change (#6679) was reverted and this PR's head 89aa76a76 merged instead, which bringsmainup to5d9dcc42d.merged shader user-data address is null(therequireinInitializeMerged,DrawDecode.cpp): a merged hull draw there leaves the hull user-data address (SH 0x102/0x103) null.main4186f06a9, without the merge up to5d9dcc42d) passes the level load and reaches gameplay's first tutorial prompt. #6679 makes the address optional for a merged program (s[0:1]zero when the draw leaves it unset); I have not run this PR with only that check relaxed.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T04:21:44Z.
Thanks @SleglJan, that settles it. #6612's type-3 split requires the hull user-data address, and 007 First Light leaves it unset. Your #6679 handles that and also keeps VGPRs live across the barrier, which my split can't. So #6679 should own registered merged hulls.
I'll restack #6612 on #6679: drop its type-3 split and keep only the tessellation-to-geometry path, marked "Depends on: #6679". Then I'll check that Crimson Desert gets past its 13 s stop on #6679's merged hull. Its merged program passes 16-bit values through LDS, so that's the part to check. A trial merge conflicts in 8 files (draw decode, registry, cache key, stage IO, tessellation lowering, recompiler), so it will take a while. I'll post here when it's done.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-16T04:25:28Z.
Thanks, sounds good. One heads-up for the Crimson Desert check: #6679 keeps
main's 32-bit limit on LDS accesses in tessellation stages, so aLoadSharedU16/WriteSharedU16in the merged program fails there withonly 32-bit LDS reads and writes are supported in tessellation stages. Your 16-bit handling from #6612 (the half-width access withConvertU16U32/ConvertU32U16around it) is the right approach, but it won't carry over as is. It only acceptsLocalOutputandControlInput, while #6679 lowers every LDS access in the merged program asControlShared. Two things to adapt: theControlSharedbounds checks need the 2-byte end for a half access, and the write's read-modify-write has to read the lane's own record. AControlSharedread is emitted as a read of another control point's record (address / shared stride), so a read at an address that isn't indexed by invocation gets control point 0's record. Happy to review it on the restacked #6612.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T04:59:15Z.
Restacked on #6679 at de9f0f71c (the first commit is #6679's 8f93aa0bd). The type-3 split is gone; draw decode takes #6679's merged hull on the tessellation-plus-geometry path too.
@SleglJan, your two points are in: a
ControlShared16-bit write reads the lane's own record for its read-modify-write, and the bounds checks use the 2-byte end. The newagc_driver_tessellationcase splits one 32-bit LDS write and one 32-bit read of yourMergedHullCodeintob16/d16_hipairs. It fails on #6679 alone at the write (only 32-bit LDS ... at pc 0x84) and passes 3 of 3 here. Crimson Desert with #6613 and #6178 runs to my 240 s limit with no stop, like before the restack. Details and lavapipe/Intel results are in the description.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-16T05:21:48Z.
I reviewed the parts of de9f0f71c that touch #6679's merged hull: the 16-bit
ControlSharedlowering, draw decode on the tessellation-plus-geometry path, and the newagc_driver_tessellationcase.The lowering looks right. A half write's read now uses
InvocationId × shared stride + (offset & ~3), and the emitter turns that into the same[gl_InvocationID]element that the write stores to. AControlSharedwrite has to stay in its own record, so no two invocations write the same word. The 2-byte end is used for both reads and writes, and odd offsets are refused. Draw decode takes the merged hull through the same branch on the new path, and #6679's refusals are unchanged.The new test case doesn't exercise the write side, though:
ds_write_b32 v7at offset 16, and the hull part never reads offset 16 of a record. It reads its own record at 0 to 15, control point 2's at +8 (the level), and control points 1 and 2 at +0.rewrite():address, which is control point 0's record (the case from my earlier comment);0instead ofexisting.The variant below splits the x-position write instead. It writes the high half first, so the second write's read-modify-write has to keep it. The x position has non-zero low halves, differs per control point, and is read back through the own-record
ds_read_b128and theds_read2_b32. It passes 3 of 3 on de9f0f71c and fails 3 of 3 under both changes:That turns
ds_write_b64 v10, v[8:9]intods_write_b16_d16_hi v10, v8 offset:2,ds_write_b16 v10, v8andds_write_b32 v10, v9 offset:4, and movess_cbranch_execzfrom 28 to 32. Your read split stays. It runs with the sameRequirePatches(..., MergedTriangles, MergedHullHalfRecord)call as your case, either in place ofMergedHullHalfWordsor next to it.A coverage gap on the lane side: this PR lets the merged hull run with
HS_W32, which Crimson Desert's0x60212dsets, but no test compiles or draws a wave32 merged hull.Tessellation.cppcompiles at 64.TessellationGeometry.cppdraws wave32 only with the separate local/hull pair and registers its merged hull with0x212d(wave64). Registering one withHS_W32there would cover it.agc_driver_graphicsdecodes0x60212dwithout compiling it.Tested on Linux 7.2.10 (CachyOS), RTX 3080, NVIDIA 615.78.08, GCC 16.2.1, Release:
ctest -R 'tess|hull|prepared_graphics|shader_memory|request': 10 of 10 pass, no skips.agc_driver_tessellationandagc_driver_tessellation_geometryeach pass 3 of 3, andagc_driver_graphicspasses.Tessellation.cppchange applied, fails 3 of 3 withonly 32-bit LDS reads and writes are supported in tessellation stages at pc 0x84.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T05:30:18Z.
Thanks @SleglJan, you're right on both counts. 2920dce82 adds your
MergedHullHalfRecordcase next to mine, with you as co-author on that commit. Here it fails under both of yourrewrite()changes, own-record read replaced byaddressand merge into 0, each withthe level-1 patch was not drawn as one flat triangle. Restored, it passes 3 of 3.For the lane side,
TessellationGeometry.cppnow resolves the registered merged hull a second time withHS_W32, on bothVGT_SHADER_STAGES_ENand the hull's registration. A throwaway check that throws when a merged hull is compiled at wave32 fails with the new registration and doesn't trigger on the previous test, so that path is now compiled. Both tests pass 3 of 3, and I credited your review and your RTX 3080 runs in the description.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-16T16:14:42Z.
Thanks @SleglJan. I restacked this PR onto your 36529f17d (rebased onto
main4524944), so its first commit now readsmergedHullfrom version 32. The tessellation, geometry, merged hull, journal and serializer tests pass 3 of 3 on the new head 3400c1349, and the area suite matchesmain.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-17T07:36:00Z.
Restacked onto #6679's current head 01947dd9b6, so the first commit here is #6679's as it stands now. My three commits applied without conflicts, and the branch still merges with
main17cfb1f4cbcleanly. On the new head c2464855be: the tessellation, geometry, merged hull, journal and serializer tests pass 3 of 3. The AGC area suite passes 897 of 898. The one failure isagc_driver_store_over_untracked, which also fails under-j6on this machine without this PR and passes when run alone.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T00:09:28Z.
Rebased onto
maina8581d3331(head 565ce1a861; #6679's commit is still first, unchanged). The only conflict was inShaderValidation.cppwith #7308, which routes emulated barycentrics through generated tessellation stages. Both sides keep their checks:The tests matching
tessellation|prepared_graphics|^agc_driver_graphics$|merged_hull|tesspass 3 of 3, and all 685^agc_tests pass (Linux, RTX 4070 Ti, 595.99.02).AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T01:02:00Z.
Rebased onto
mainf663e565fe(head fa48241e96; #6679's commit is still first, unchanged). The only conflict was indocs/dev/debt/shader.md, wheremainadded the guest memory load guards entry on the same line as the merged hull programs entry. Both entries are kept.After the rebase on Linux/NVIDIA, the tessellation, graphics, journal and shader memory tests pass (14/14), and so do the recompiler, SPIR-V, disk cache, rect-list, barycentric and prepared-pipeline tests (43/43).
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T02:24:24Z.
Rebased again onto
mainb39d90bf14(head a66f3b6d79; #6679's commit is still first). The only conflict was the same line indocs/dev/debt/shader.md:mainreworded the guest memory load guards entry. That entry now hasmain's text, followed by this PR's merged hull programs entry.After the rebase on Linux/NVIDIA (RTX 4070 Ti, 595.99.02), the 46 tessellation, graphics, journal, shader memory, SPIR-V, rect-list, barycentric, prepared-pipeline, disk cache and recompiler tests pass.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T14:15:36Z.
Rebased onto
maina62c724c38(head 126d3ff17a). The only conflict was inDecodeShaderStages: #6129 changed the triangle/quad domain refusal to print theVGT_TF_PARAMandVGT_LS_HS_CONFIGfields (tessellationMessage), and this PR moves that block into the shared tessellation branch. The moved block now uses #6129's message, and the rest is this PR's code. Built and ran the 7 tests matchingtess|hull|^agc_driver_graphics|pipeline_journal|request_serializer, including #6129's new message cases inagc_driver_graphicsand this PR'sagc_driver_tessellation_geometry: all pass.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T17:10:43Z.
AMD on Windows run, since the description lists Windows and AMD as not checked. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON. Build:main6efb7261bwith #7524, #7006, #6612, #6929, #7119, #6896 and #6856 merged together (each merge clean, built once). It conflicted with a larger AGC batch earlier, so it was tested here without those.agc_driver_tessellation,agc_driver_tessellation_geometry,agc_driver_graphics,agc_driver_prepared_graphicsandagc_driver_store_over_untrackedpass 3 runs of 3.AI-assisted
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T18:04:16Z.
Rebased onto
main8625038579(head 8addea1d05). #6150 changed the same lines inShaderRegistry.cpp: it now defers a vertex program whoses_barrierdepends on draw routing. The resolution keeps that, together with this branch's wave size bit for tessellation control (0x00200000). The 11 tests matching^agc_driver_graphics$|tess|geometry|ngg|hull|prepared_graphics|store_over_untrackedpass in 2 runs of 2 (RTX 4070 Ti, 595.99.02, Ubuntu 24.04).AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-18T18:46:02Z.
Thanks @LeandroLP23 for the AMD run on Windows. I added it to the description.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T06:49:10Z.
Review: DISMISSED
Thanks for the continued restacks. This head can't land as is:
mainit conflicts in 8 files:Draw/DrawCapture.cpp,Shaders/ShaderRegistry.cpp(also touched by the merged #6150),Graphics/include/State.hpp,PipelineJournal.cpp,ShaderValidation.cpp,tests/ShaderMemory.cpp,RequestSerializer.cppandRequestSerializerTests.cpp. These are not mechanical, so please resolve them and re-run the tessellation, graphics, journal and serializer tests.Once #6679 is merged and this is rebased on
main, it will be reviewed against the new head.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T06:50:35Z.
@adriadam10 thanks for the review. The restack onto #6679's current head 3b69fde44 is done locally, and its tests are running now. #6679's head alone passes 613 of 614 of the AGC, shader, request, journal and tessellation set; the one failure is
agc_driver_bda_device(#7584). The PR's own run, then the tessellation, serializer and journal tests 3 of 3, are next.The conflicts in the files you listed came from #4650 and #6503, which landed while this sat on the older head:
StagePushLimitnow takes the depth remap limit, inmain's order;main.I'll push with the results. Once #6679 merges, I'll rebase this onto
main.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T06:55:49Z.
@adriadam10 @SleglJan pushed: #6612 is now on #6679's head 3b69fde44 (head 847628a460).
agc_driver_bda_device(#7584).StagePushLimittakes the depth remap limit, the validation keeps both push terms, and the journal format becomes 5.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T07:27:35Z.
Review: DISMISSED
Thanks for restacking onto #6679's current head; the earlier eight conflicts are resolved. One conflict with
mainremains:Graphics/include/State.hpp:mainaddedbool quadListright afterrectList(support quad-list primitive type), where this PR addsrasterizerDiscardandtessellationCapture. Please resolve it and re-check theStatesize guards inPipelineJournal.cpp(the new member changes the layout) and that the journal codec/canonical state treatquadListconsistently with the new fields. Then re-run the graphics, journal and tessellation tests.This is also still stacked on #6679, which is open; it will be reviewed against the new head once #6679 has merged.
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T11:29:46Z.
@adriadam10 thanks, resolved and pushed: 235f5130c0, rebased onto
mainf72c7aacfawith #6679's commit still first.State.hpp: the conflict wasmain'sbool quadListafterrectList, next to this PR'srasterizerDiscardandtessellationCapture. Both are kept.sizeof(State)is still 856 withquadList, because the bool fits in existing padding. The guards inPipelineJournal.cpp(State856,ShaderStages160, journal format 5) compile unchanged.Draw.cppclearsrecipeOutwhenstate.quadListis set, and the recorder returnsDrawRecipeMiss::NotRecordablefor them. So neither the recipe codec norCanonicalPipelineStatecarriesquadList, the same as onmain. A decoded state's defaultfalseis what every journaled draw was recorded with. The new tessellation fields are encoded and compared as before.f72c7aacfa, and 631 of 631 with this PR. The tessellation, journal and request serializer tests pass 3 of 3.The Khronos validation comparison CONTRIBUTING.md now asks for (
mainvs this PR,tess|journaltests) is queued. I'll add it to the description when it finishes.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T11:39:47Z.
@adriadam10 one more push, from the validation comparison mentioned above: 7570d583d6.
Under the Khronos layer, 235f5130c0 added two errors in
agc_driver_tessellation_geometry, 9 each:VUID-VkGraphicsPipelineCreateInfo-pStages-06894andVUID-RuntimeSpirv-OpEntryPoint-08743. The first pass of tessellation followed by a geometry stage captures the tessellated triangles with rasterizer discard. It still carried the pixel program, which Vulkan doesn't allow without fragment shader state, and that program reads a location the capture geometry stage doesn't write.The capture pass now has the four pre-rasterization stages only.
ValidateShadersexpects four stages for it and checks no color exports there, and the pixel program runs only in the mesh pass that draws the captured triangles. The fix is folded into "draw tessellation followed by an NGG geometry stage".tess|journal:mainf72c7aacfaand this head now report onlyVkDeviceCreateInfo-pNext-pNextandVkGraphicsPipelineCreateInfo-pLibraries-06681, which this older layer (1.3.275) gives for every device-creating test. Nothing is new, and neither log reports the layer missing.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T16:09:38Z.
Review: DISMISSED
Thanks for resolving the
State.hppconflict; thequadListhandling and the new capture pass without a pixel program look consistent.mainhas moved again and the branch conflicts in two files:core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp: #6931 (pipelined indirect draws) now locatesbaseVertexLocation/startInstanceLocation/drawIndexLocationas single words and computeslastDrawable, where this branch reads them throughUserDataWords(programs, roles, ...). Please merge the two so the merged-hull/tessellation roles are still covered by the new queued path.core/shader/recompiler/tests/RequestSerializerTests.cpp:mainalready upgrades the fixture to request version 37 (upgraded[4] = 37u), while this branch buildsmain36and then upgrades to 37 itself. Please re-check which version this stack should write and adjust the fixtures to match.Also, #6679, which this PR is stacked on, is still open and itself conflicts with
main. This one can only land after #6679 does, so please restack onto its resolved head, then re-run the graphics, journal, serializer and tessellation tests.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T16:10:03Z.
@adriadam10 two updates on #6612:
VUID-vkCmdDrawIndexed-colorAttachmentCount-06179×12. A pipeline that discards its primitives has no fragment output state, so it counts as having no color attachments, while the pass still began rendering with the draw's targets.Pipeline::Beginnow begins a discarding pass with no attachments. Under 1.4.363,tess|journalonmainf72c7aacfaand on this head now report nothing. The 631 broad-set tests pass, and the tessellation, journal and serializer tests pass 3 of 3.mainmoved again.7563b4a480(stencil operation value export) took request version 37, which #6679's merged hull flag also uses, so the stack conflicts withmainin #6679's commit. I've told SleglJan on #6679 that the next free version is 38, and I'll restack #6612 on #6679's rebased head and push it with the tests then.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T16:55:36Z.
@adriadam10 restacked as you asked: 77d218a50a is this PR's three commits on SleglJan's rebased #6679 head 83a04aba09 (
main0fbfd91e5e). They apply without a conflict.Draw.cpp: #6679's head keeps the three record lookups asUserDataWords(programs, roles, ...)and runs #6931'slastDrawablescan after them. So every program that holds the register gets the word, both stages of a merged hull included, and the queued last drawable record carries them.maintook 37 for the stencil operation value export, so #6679 now writes 38 and readsmergedHullonly from 38. Its replay test replaysmain's version 37 format. This PR adds no version of its own.main, and 636 of 636 with this PR. The graphics, journal, request serializer and tessellation tests pass 3 of 3. Under the LunarG SDK's 1.4.363 layer,tess|journalreports nothing onmainor on this head.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T03:33:04Z.
Restacked on #6679's current head 0307183985 (SleglJan's rebased single commit), so it's now at 6f8d397618. My three commits applied without conflicts, and the branch merges cleanly with
main525e299fc0.agc_driver_tessellation,agc_driver_tessellation_geometry,agc_driver_graphics,agc_driver_store_over_untracked,agc_driver_prepared_graphicsandagc_driver_bda_devicepass, 6 of 6.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T15:22:34Z.
#6679 is merged, so this is now rebased onto
main5ccf1824dfwithout it (c068cc8fe6). It is the same three commits, and they applied without a conflict. The conflict GitHub showed came from the older copy of #6679's commit that this branch carried.ctest -R '^(agc_|shader_|request_)'passes 835 of 835, and the tessellation, graphics, journal, serializer, mesh and geometry tests pass 3 of 3. Depends on is now none.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T16:14:47Z.
Thanks for the restack. One correctness problem in the capture sizing, plus a question.
Triangle-domain capture capacity is below the tessellator's output.
drawTessellationGeometrysizes the capture aslevel = ceil(clamp(VGT_HOS_MAX_TESS_LEVEL)) + 1andperPatch = domain == 2 ? 2 * level * level : level * level, so a triangle patch gets(n + 1)²slots. A triangle domain with uniform level n tessellates into3n²/2triangles (n even) or(3n² − 1)/2(n odd): 1, 6, 13, 24, 37 for n = 1…5. That's more than(n + 1)²from n = 5 on (37 > 36), and 6144 vs 4225 at n = 64 (+45%). The capture shader then drops every triangle pastcapacity(index < capacity, TessellationCaptureShader.cpp:57), with no error. So a draw whose patches are tessellated near the maximum loses geometry silently, well under the documented 2^20 cap. The debt entry says the capacity is "no more than its patches allow atVGT_HOS_MAX_TESS_LEVEL", which this bound doesn't satisfy for triangles. Quads are fine (2n² ≤ 2(n + 1)²).Could you size triangle patches at least
ceil(3 · level² / 2)(or use2 · level²for both domains), and add a case toagc_driver_tessellation_geometrythat tessellates a triangle patch at a level ≥ 5 with every factor at the maximum, checking the captured count equals the tessellator's? The current PatchLevels {1, 0, 5} stays under capacity because the other patches leave room.Question: a 16-bit LDS write in a merged hull (
ControlShared) becomes a read-modify-write of the containing 32-bit attribute word (GetTessellationAttribute→BitFieldInsert→SetTessellationAttribute). If two lanes write the two halves of the same dword, can one update be lost? If the hull program only ever writes the halves from one lane, a line in the debt entry saying so would settle it.Minor, no change needed for merge: the capture buffers are allocated per draw at the worst case (e.g. 2^20 × 3 × 32 dwords × 4 B ≈ 384 MB device-local for a 32-dword ESGS item), and
Draw.cpp's static capture-shader map is keyed only by(esgsItemSize, primitivesPerGroup), not by device or target.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T16:24:05Z.
Thanks @oneandonlydean, you're right on both counts, and the capacity one was a real bug.
Capacity. Fixed in b478c407a7. Every domain now gets
2 · level²slots per patch, withlevel = ceil(clamp(VGT_HOS_MAX_TESS_LEVEL)) + 1, as you suggested. That covers a triangle's3n²/2and a quad's2n².agc_driver_tessellation_geometrygains the case you described: the level-5 triangle patch drawn alone, withVGT_HOS_MAX_TESS_LEVELat 5, so that patch alone has to fit its capacity. That's 37 triangles, against 36 slots before the fix. The geometry path's image must match the tessellation path's.the element at byte 22292 is (16, 24, 40, 255), the tessellation path drew (255, 102, 0, 255), a dropped triangle.agc_driver_tessellationandagc_driver_tessellation_geometrypass 3 of 3.The debt entry's "no more than its patches allow at
VGT_HOS_MAX_TESS_LEVEL" now holds.16-bit halves. No update can be lost.
TessellationLoweringrefuses a merged-hull LDS write unless it lands in the writing control point's own record:the merged hull program writes LDS outside its own control point's record, in theControlSharedwrite check. The emitter indexes that record by the invocation. So the two halves of a dword are always written by the same invocation, in program order. The read-modify-write reads that invocation's own record, and no other lane writes it. That's enforced rather than assumed, so I've left the debt entry as it is.Minor points. Noted. Both the worst-case per-draw capture buffers and the capture-shader map keyed only by item size and group size would be follow-ups if a title shows them mattering.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T20:43:00Z.
Rebased onto
main26740077bd, now e7b06892d3, with the same five commits. The one conflict was inShaderInputInfoBuilder.cppwith #6611, which moved the mesh checks into_validateMeshand added a validate-only path. This PR's mesh-stage line (capturedInput) stays where it was. Its copy of the old inline check is gone, since main now makes that check in_validateMeshfor both paths. This PR changes no validation, so the newValidateVertexStageInputsneeds nothing.On the rebased head,
ctest -R '^(agc_|shader_|request_)'passes 841 of 842. The usual three skip themselves. The one failure isagc_driver_lookup_log_fits_build, the load-sensitive test that #8601 fixes, and this PR doesn't touch it. The tessellation, journal, serializer and graphics tests (10) pass 3 of 3.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T21:44:18Z.
A follow-up to my rebase: this PR had the same silent collision oneandonlydean found on #6639. Its journal commit bumps
FileFormatfrom 4 to 5 while it changes the record layout, and #5656 had already set main to 5. So the rebase merged cleanly, but the branch no longer changed the format.In 9ffafc3946,
fix(agc): journal the tessellation geometry state(now 6d2efc22d7) sets the format to 6 and its message says so. The two commits after it are unchanged, and the only change from e7b06892d3 is that line. The journal, tessellation and graphics tests (9) pass 3 of 3 on rebuilt binaries.#6639 and #8365 also take 6. Whichever of the three merges after the first will take the next number when I rebase it.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T11:06:01Z.
Rebased onto
main275e896797. The new head isdfc290f4ae, five commits.Pipeline.cppkeptmain's newpolygonModelines, with this PR'srasterizerDiscardEnableafter them.sizeof(State)stays 856 with #7869's field.The 8 tests matching
tess|Tess|hull|Hull|pipeline_journal|^agc_driver_graphics$pass 2 of 2.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T12:59:03Z.
Rebased again, onto
maince7d547175, after #8856 (point-list output of NGG geometry programs). The new head isa4d995c4af. The one conflict was inDecodeShaderStages: this PR renamesprimitivetoinputPrimitive, and #8856 added point-list output there. The resolution is #8856's lines with the new name. The journal format stays 7 andsizeof(State)856. The 8 tests matchingtess|Tess|hull|Hull|pipeline_journal|^agc_driver_graphics$|geometry|Geometrypass 2 of 2.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-22T10:31:27Z.
Rebased onto
maincc0078595das6aa4f7cc7f. The conflict was #8992's split ofGraphics::Drawinto a prepare and a record step.drawTessellationGeometryand its hand-off now sit around the newDraw, and the change is otherwise line for line the same. The 17 focused tests pass 3 of 3. Details in Tested.AI-assisted: yes (Claude Code)