Repository navigation
fix(shader): write a mesh shader's layer through a per-primitive block - #7674
Conversation
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.
|
|
Thanks, this looks good on our side: review passes and all the mesh and layered tests pass on NVIDIA, including the new one. We don't have an AMD GPU, so before merging we'd like one independent AMD run: the crash on current main, and no crash with this PR. Could anyone with an RDNA2 card (or another AMD GPU) on a recent Windows driver post that? |
|
Independent AMD run, as requested. Windows 11, AMD Radeon(TM) Graphics iGPU (Granite Ridge, RDNA2, deviceID 0x13c0), driver 32.0.21042.62, WinLibs GCC 15.2.0, Release,
AI-assisted: yes (Claude Code); results above were run on this machine. |
|
Tested on Windows 11 with AMD Radeon RX 6700 XT and AMD Ryzen 9 7900X:
Fully support closing #6379 in favor of this cleaner solution. Thanks @thuanquang and @oneandonlydean! |
What
On AMD's Windows driver, a draw through a geometry program that writes a layer crashes the process on
main. The mesh shader the recompiler builds for it declares the per-primitive layer as a standaloneOutputarray ofuint, decoratedBuiltIn LayerandPerPrimitiveEXT. Creating the pipeline crashes inside the driver:The layer is now written through an array of a one-member
Blockstruct whose member is decoratedBuiltIn LayerandPerPrimitiveEXT, stored with an access chain to member 0. That is how glslang declaresgl_Layer, as a member ofgl_MeshPerPrimitiveEXT. AMD's driver creates that pipeline and draws with it, also when the pixel shader reads the layer.ShaderValidationnow readsPerPrimitiveEXTmember decorations, so the block's array is checked againstmaxPrimitiveslike the other per-primitive outputs. The debt entry records why the block form is used.#6379 (@Feuris) works around the same crash by removing the mesh layer output and the fragment layer input when pipelines are created, so layered mesh draws land in slice 0 on every vendor. This keeps the layer instead. I offered the block form for #6379 there first (comment); this is the separate PR that comment mentions. #7377 notes that Demon's Souls (PPSA01342) needed #6379 for this crash on AMD. #6959 (@JJenkx) renders layered mesh targets in windows and needs the layer output that #6379 removes; on this driver its new
agc_driver_layered_volume_meshcrashes the same way, atamdvlk64.dll+0x21f3221.The test is the one @oneandonlydean asked for on #7374: the layer each triangle lands on in first and last provoking vertex mode. On
mainit never reaches the comparison on this GPU, because the first draw crashes the driver.Tested
Windows 11 26200, AMD Radeon RX 6700 XT (gfx1031), driver 32.0.21045.5002, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON,ANYPS5_REQUIRE_VULKAN=1,main05171bc66:agc_driver_mesh_provoking_layer. It draws one quad through the geometry programagc_driver_layered_volume_drawcompiles, which exports each vertex's layer, into a 2-slice target. Each triangle's vertices carry layers 0, 0 and 1.main's emitter andShaderValidation, the test crashes at the first draw, 3 of 3, with theamdvlk64.dll+0x21f3221crash above. With this change it passes 3 of 3.VK_EXT_mesh_shader,VK_EXT_shader_viewport_index_layeror a last provoking vertex mode, and on llvmpipe like the other mesh execution tests, so CI does not run it.ctest -R "mesh|layer|provoking"(18 tests): all pass exceptagc_driver_layered_volume_vertex_no_gpl, which fails onmainhere too (AMD Windows: GPL-mode cache failures (alpha/wave32 pass after local driver update) #4768).ctest --parallel 4 --timeout 120onmain023106ae4with this change, before the rebase onto05171bc66: 1509 tests. The failures are the three thatmainhas on this machine (agc_driver_lds_mixed_width_atomicsfix(shader): release the LDS lock with an exchange and drop fences inside it #6976,agc_driver_lds_lock_budget,agc_driver_layered_volume_vertex_no_gplAMD Windows: GPL-mode cache failures (alpha/wave32 pass after local driver update) #4768), pluslog_macrosandlog_macros_timestamps, which fail in this build only because ccache rewrites__FILE__.python tools/check_conventions.py --base origin/mainwith this title and body passes.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