Repository navigation
fix(agc): draw a last provoking vertex through the barycentric tessellation stages without VK_EXT_provoking_vertex - #21938
Conversation
…lation stages without VK_EXT_provoking_vertex Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Real-AMD coverage — the PR lists macOS/MoltenVK (Rosetta) as the only GPU tested, so here's Linux + real-AMD RADV. Head
0 validation errors on NAVI31. Notably One caveat for accuracy: RADV exposes AI-assisted: yes |
|
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.
|
|
@tablefrogpillow thank you for running this on real AMD hardware and lavapipe. Having On add_test(NAME agc_driver_unobserved_provoking_vertex COMMAND agc_driver_graphics_tests --unobserved-provoking-vertex)So it needs the AI-assisted: yes |
|
Thanks for the pointer — built |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The inspected implementation supports the described last-vertex fallback; a complete review and local checks were not possible because several changed files were not read and no tests were run.
What I ran
Reviewed head 942ec64f2f798b0a8adbc5990c6cb9c6c3590685 using the prepared review bundle and repo_read.py reader. No test commands were run. I read description.md, commits.md, manifest.json, and the relevant portions of diff.patch; repository code read included Draw.cpp, DrawCapture.cpp, Pipeline.hpp, Pipeline.cpp, CacheKey.hpp, RequestSerializer.cpp, Recompiler.cpp, and tests/execution/VertexProvokingVertex.cpp.
Results
| Check | Result | Note |
|---|---|---|
| Targeted code review | passed | No concrete defect found in the inspected changes. |
| Tests | not run | Author-reported results were not independently verified. |
| Full review coverage | not run | Some changed files were not read. |
Findings
Blocking
None in the inspected code.
Non-blocking
- The description notes that another PR also moves request serialization to version 63. Coordinate merge order so the second change advances the version to 64; otherwise both changes can assign different payload meanings to the same version.
Not verified
I did not read the changed files tests/Graphics.cpp and tests/ShaderMemory.cpp, which were excluded from the review folder as too large, or the remaining changed files and hunks not listed above. I did not run tests or verify the author-reported GPU results. The PR description says indexed draws, primitive-restart cases, and indirect draw re-materialization were not GPU-tested.
To get this to a good state
Nothing is required. Optional: coordinate the serialization version with the other PR before merging.
|
Ran the provoking-vertex and barycentric tests on NVIDIA's proprietary Linux driver with the Khronos validation layer, since the description reports MoltenVK only. Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor
The RTX 4090 reports No new AI-assisted: yes (Claude Code) |
|
RTX 5080 Windows run of head
Setup: base AI-assisted: yes (Claude Code) |
|
Run on Linux with Intel ANV and an Ampere NVIDIA, using the description's test set and the Khronos validation layer. Setup: Arch Linux, kernel 7.2.15, GCC 16.2.1, Release. One laptop, device picked with 3 runs per cell:
Every other test has the same result on both sides. Every test process logged VUID lines: NVIDIA has none on either side. Intel has the same 96 lines on This looks like the layer's false positive in KhronosGroup/Vulkan-ValidationLayers#13414: it added a stage's input and output clip arrays together. It was fixed by KhronosGroup/Vulkan-ValidationLayers#13415, merged 2026-10-10, which isn't in the 1.4.363 SDK layer. The fixed layer's message says "Input" or "Output", and this one doesn't. It isn't caused by this PR, and other reviewers running these tests with SDK 1.4.363 on a device without fragment-shader barycentrics will see the same lines. AI-assisted: yes (Claude) |
|
Windows 11 23H2 (22631), Ryzen 7 5700X, NVIDIA RTX 4060 (driver 616.56), WinLibs GCC 15.2.0 r7, Release, merged into New test |
Main's boykopovar#21938 took request serialization version 63 for its trailing emulated-barycentrics flag. The on-chip tessellation flag moves to version 64 and is written before that flag, so version 63 requests from main still read the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aude/gcn-on-chip-tessellation Main's boykopovar#21938 took request serialization version 63 for its trailing emulated-barycentrics flag, and boykopovar#22251 moved the on-chip flag to 64. The tessellation constants move to version 65, written after the on-chip flag and before the barycentrics flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aude/gcn-es-gs-copy-vs Main's boykopovar#21938 took request serialization version 63 for its trailing emulated-barycentrics flag, and the stack below moved the on-chip flag to 64 and the tessellation constants to 65. The geometry configuration moves to version 66 and stays before the barycentrics flag. The new emulateBarycentrics field sits before tessellationConstants and geometry, so the positional initializers gain a false or the stage's flag in that place, and the barycentrics test drops the geometry byte before reading the request as version 62. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
On a device without
VK_EXT_provoking_vertexprovokingVertexLast(MoltenVK on Apple GPUs), a draw in last-provoking-vertex mode whose pixel shader shows the provoking vertex fails atValidateProvokingVertex(Graphics/src/Pipeline.cpp) withlast provoking vertex requires VK_EXT_provoking_vertex with provokingVertexLast enabled. The barycentric tessellation stages already give each corner the last vertex's flat values (#7426, #8083), but a draw used them only when its pixel shader had been recompiled with emulated barycentrics, which happens only on devices without native fragment barycentrics. The Apple M4 has native barycentrics, so these draws took the native path and threw.This PR sends such draws through the existing tessellation stages:
LastVertexPatches(Pipeline.cpp) decides it. The device lacksprovokingVertexLastand has tessellation shaders, the draw is in last mode on the vertex path (not a rect list, mesh or tessellation draw), and its pixel shader shows the provoking vertex (the same testValidateProvokingVertexalready applies, moved to file scope). Its vertex shader writes noLayerorViewportIndex, and the topology is one the stages draw: a triangle list (primitive restart only withoutVK_EXT_primitive_topology_list_restart) or a triangle strip (primitive restart only in a non-indexed draw).Execution/src/Driver/Draw/Draw.cpp) then recompiles the pixel shader with a newGraphicsCompileContext::emulateBarycentricsflag and builds the tessellation stages with the last vertex, as it already does for emulated barycentrics. Re-materialised stages of an indirect draw keep the flag.Recompiler.cpp) translates a pixel shader with that flag the way it already does when lowering to host interpolation fails.Note for merging: #20153 also moves request serialization to version 63. Whichever merges second needs version 64.
Tested
macOS 27.2 on an Apple M4 (MoltenVK 1.4.2 from the LunarG Vulkan SDK 1.4.363.1, x86-64 build under Rosetta). This is the only GPU I tested. I could not run RADV, NVIDIA or Windows here. Devices with
provokingVertexLastdon't reach the new path, whichLastVertexPatchTestschecks on the CPU.New tests
agc_driver_vertex_provoking_vertex(new) submits real DCB draws through the driver: a guest vertex program with a flatv_interp_movP0 pixel shader, as a triangle list and a triangle strip, alternating first, last and first mode. It checks that each triangle takes its first or its last vertex's color.Draw.cpprouting disabled, it also fails with that message.agc_driver_provoking_vertex: on a device withoutprovokingVertexLastand with tessellation, it now also draws the guest P0 shader through the emulated barycentric stages, as a list and a strip, first/last/first, and checks the last-vertex colors.ANYPS5_REQUIRE_VULKAN; this branch passes it.agc_driver_unobserved_provoking_vertexgainsLastVertexPatchTests, which covers every condition of the decision.agc_shader_memorygainsverifyEmulatedBarycentricRequests. It checks that:request_serializerandagc_shader_memorywere updated for version 63.GPU tests, main vs. this branch
ctest --test-dir build -R '^agc_driver_.*(barycentric|tessellation|provoking|patch_vertex|interpolation|rect_list).*' -V, three runs per side.ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer.Insert instance layer "VK_LAYER_KHRONOS_validation"(layer 1.4.363). None loggedwas not found but was requested by env var VK_INSTANCE_LAYERS.agc_driver_provoking_vertexagc_driver_vertex_provoking_vertexagc_driver_tessellationVUID-linesFull
ctest -j8guest_audio_propagation,guest_main_stack_moveandguest_system_service_open_url. None of them links the AGC driver or the recompiler. Run alone, each passes on some runs and fails on others on this branch.guest_pthread_mutex_contentionandwrite_watch_backing_shared.Not tested
DRAW_INDEX_AUTOdraws without primitive restart. These run only in the CPU tests (LastVertexPatchTests), not on a GPU:VK_EXT_primitive_topology_list_restart, or a non-indexed strip;Draw.cpp, the patched-program loop).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