AGC: agc_driver_tessellation's merged hull program draws a different wrong patch on each run on AMD's Windows driver #8861
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 thuanquang on 2026-10-21T03:36:30Z.
The merged hull path from #6679 (
8b8219dce) makesagc_driver_tessellationfail on AMD's proprietary Windows driver. CI (lavapipe) and NVIDIA pass. @wachi35676 saw this on an RDNA 2 iGPU with 32.0.21042.62, in #8134. It also happens on a discrete card.Setup:
maind0852defa.ANYPS5_NO_SHADER_CACHE=1, with every run from a renamed copy of the exe, so the driver's pipeline cache starts empty.The first
RequirePatches(..., MergedHullCode, "merged hull program", MergedTriangles, MergedHullCode)call fails on every run. Which check fails changes from run to run:merged hull program, unculled: the level-5 patch has no interior domain points at its centre, centre (16, 24, 40, 255) (background)the level-1 patch was not drawn as one flat triangle, centre backgroundAPS5_NO_GPL=1, run 1the level-1 patch was not drawn as one flat triangleAPS5_NO_GPL=1, run 2 and 3the level-5 patch has no interior domain points, centre (255, 0, 0, 255) (drawn flat)ctest -Vthe level-5 patch has no interior domain points, (255, 0, 0, 255); 0VUID-lines, and the layer loadedEvery earlier
RequirePatchescase in the test, with separate local and hull programs, passes on this card.I dumped the merged program's SPIR-V. Its tessellation control shader:
OutputVertices 3, and no subgroup operations;min(gl_InvocationID, 2)from the input array, then write the per-vertexControlSharedoutput (location 2) at indexgl_InvocationID;OpControlBarrier Workgroup Invocation Nonein a merge block that every invocation reaches;gl_InvocationID, and the reads I checked after the barrier use the invocation's own record;I found nothing there that the spec leaves undefined. But results that change from run to run look like a value is read before anything writes it, somewhere in the merged path or in the driver's handling of it. I have not narrowed it down further.
The SPIR-V (base64 and disassembly), the local stage, and the run logs are here: https://gist.github.com/thuanquang/acb22ee3eb1076854624d8764289bfca
Not tested: RADV, and any title that uses type-3 programs.
cc @SleglJan
Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-21T04:28:34Z.
Found it; the fix is in #8884.
TessellationPointerbuilt a tessellation attribute's vertex, location and component indices withOpUDiv,OpUModand shifts even for an immediate address. Without SPIRV-Tools those stay arithmetic on constants in the access chain. AMD's Windows driver reads a per-vertex hull output indexed that way wrongly.Two local experiments isolate it:
So it is not barrier visibility, and a stronger barrier didn't help either. With the indices emitted as
OpConstants,agc_driver_tessellationpasses 3 of 3 on the RX 6700 XT, along with the related tests and the validation layer.@wachi35676, if you get a chance, a run of #8884 on your 32.0.21042.62 iGPU would cover the second driver.