Repository navigation
feat(agc): vertex clip and cull distances - #423
oneandonlydean merged 2 commits into
Conversation
|
Heads-up on the request serialization: #303 (mine) also moves it from version 5 to 6, for |
09b5508 to
64ea12e
Compare
+ boykopovar#423) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
64ea12e to
5dc6420
Compare
5dc6420 to
06a8c60
Compare
06a8c60 to
7aa98bf
Compare
Version 8 is the vertex stage's PA_CL_VS_OUT_CNTL (boykopovar#423, below this PR), so the pixel stage's quad mask moves to version 9. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Rebased onto current |
… squashed) MichonGoddijn231849's boykopovar#423 at 577b8d5, squashed onto main 90c152e so request version 16 (alpha-to-coverage, f64 denormals), so PA_CL_VS_OUT_CNTL is read from version 17 instead of 15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A color view of several depth slices of a 3D target (CB_COLOR_VIEW SLICE_START < SLICE_MAX) was rejected as "color views of several array slices are unsupported". Titles render such volumes with one draw: an instanced draw whose vertex stage picks each primitive's slice through the misc position export (PA_CL_VS_OUT_CNTL USE_VTX_RENDER_TARGET_INDX with VS_OUT_MISC_VEC_ENA). Depends on boykopovar#423, which carries PA_CL_VS_OUT_CNTL to the recompiler. - DecodeColorBuffer takes the slice range of a 3D target (ColorTarget::layers, clamped to the surface's last slice), allows DCC on 3D targets, and sizes a tiled 3D target by its whole surface (SurfaceForTarget moves to State.cpp for that). DecodeState sets State::renderLayers and, for a layered draw, USE_VTX_RENDER_TARGET_INDX (State::layerExports); color targets of different slice counts and layered draws with a depth target throw. - The driver adds State::layerExports to the PA_CL_VS_OUT_CNTL bits boykopovar#423 passes (it already passes VS_OUT_MISC_VEC_ENA), so the render target index reaches gl_Layer only for layered draws and stays ignored elsewhere as before. - A vertex stage writing gl_Layer declares ShaderViewportIndexLayerEXT and SPV_EXT_shader_viewport_index_layer when the device offers them (the device enables VK_EXT_shader_viewport_index_layer when present), instead of SPIR-V 1.5 ShaderLayer, which a Vulkan 1.1 device cannot take. Graphics validation accepts the capability, the extension and a vertex Layer output when it is enabled, and a per-primitive Layer output of a mesh stage. - The resident target's attachment view is a 2D array view of the slices, and the framebuffer has that many layers (Framebuffer and AcquireFramebuffer take the layer count). The execution test agc_driver_layered_volume_draw draws three bands, one per layer, into slices 1..3 of a 4-slice 64 KiB-tiled volume and reads every slice back: slice 0 stays untouched and slice 1 + L holds only band L. It also recompiles a mesh program with the layer export and validates it against the layered state. The mesh case does not draw: lavapipe's LLVM backend aborts compiling that mesh pipeline ("Cannot emit physreg copy instruction"), which a test cannot catch. On RADV the same mesh draw renders the bands into the right slices. PPSA14632 (LEGO Horizon Adventures) renders its 64x64x64 RGBA16F translucency lighting volumes (two DCC targets, 64 instances) this way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PA_CL_VS_OUT_CNTL moved to request version 17, so the last version without it is 16; a version 12 request would also lack main's newer fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… squashed) MichonGoddijn231849's boykopovar#423 at 577b8d5, squashed onto main 90c152e so request version 16 (alpha-to-coverage, f64 denormals), so PA_CL_VS_OUT_CNTL is read from version 17 instead of 15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A color view of several depth slices of a 3D target (CB_COLOR_VIEW SLICE_START < SLICE_MAX) was rejected as "color views of several array slices are unsupported". Titles render such volumes with one draw: an instanced draw whose vertex stage picks each primitive's slice through the misc position export (PA_CL_VS_OUT_CNTL USE_VTX_RENDER_TARGET_INDX with VS_OUT_MISC_VEC_ENA). Depends on boykopovar#423, which carries PA_CL_VS_OUT_CNTL to the recompiler. - DecodeColorBuffer takes the slice range of a 3D target (ColorTarget::layers, clamped to the surface's last slice), allows DCC on 3D targets, and sizes a tiled 3D target by its whole surface (SurfaceForTarget moves to State.cpp for that). DecodeState sets State::renderLayers and, for a layered draw, USE_VTX_RENDER_TARGET_INDX (State::layerExports); color targets of different slice counts and layered draws with a depth target throw. - The driver adds State::layerExports to the PA_CL_VS_OUT_CNTL bits boykopovar#423 passes (it already passes VS_OUT_MISC_VEC_ENA), so the render target index reaches gl_Layer only for layered draws and stays ignored elsewhere as before. - A vertex stage writing gl_Layer declares ShaderViewportIndexLayerEXT and SPV_EXT_shader_viewport_index_layer when the device offers them (the device enables VK_EXT_shader_viewport_index_layer when present), instead of SPIR-V 1.5 ShaderLayer, which a Vulkan 1.1 device cannot take. Graphics validation accepts the capability, the extension and a vertex Layer output when it is enabled, and a per-primitive Layer output of a mesh stage. - The resident target's attachment view is a 2D array view of the slices, and the framebuffer has that many layers (Framebuffer and AcquireFramebuffer take the layer count). The execution test agc_driver_layered_volume_draw draws three bands, one per layer, into slices 1..3 of a 4-slice 64 KiB-tiled volume and reads every slice back: slice 0 stays untouched and slice 1 + L holds only band L. It also recompiles a mesh program with the layer export and validates it against the layered state. The mesh case does not draw: lavapipe's LLVM backend aborts compiling that mesh pipeline ("Cannot emit physreg copy instruction"), which a test cannot catch. On RADV the same mesh draw renders the bands into the right slices. PPSA14632 (LEGO Horizon Adventures) renders its 64x64x64 RGBA16F translucency lighting volumes (two DCC targets, 64 instances) this way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PA_CL_VS_OUT_CNTL moved to request version 17, so the last version without it is 16; a version 12 request would also lack main's newer fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Serialization: upstream's version 17/18 target fields keep their numbers; boykopovar#423's vertex PA_CL_VS_OUT_CNTL word moves to version 19 (as boykopovar#3763 has it) and the relaxed-float flag to 20. - The registry's shared lease is cached weakly, so a range's references are only its real holders' (upstream's failed-import test counts them). - Spanned imports respect upstream's import window. - Depth seeding skips storage images that do not view the depth plane texel for texel; they read the reused memory, as upstream's DepthSurfaceAt decides. - DescriptorBinding keeps the fork's imageRead flags (608 bytes); test files re-add the fork's import-run and loop-patch tests over upstream's versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uzy15wqYTt6iWyxYXEzUWo
Keeps boykopovar#423's PA_CL_VS_OUT_CNTL word at serialization version 19 (relaxed float stays at 20) and the separate clip/cull distance feature flags; adds the viewport-index-layer flag beside them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uzy15wqYTt6iWyxYXEzUWo
… squashed) MichonGoddijn231849's boykopovar#423 at 577b8d5, squashed onto main 90c152e so request version 16 (alpha-to-coverage, f64 denormals), so PA_CL_VS_OUT_CNTL is read from version 17 instead of 15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A color view of several depth slices of a 3D target (CB_COLOR_VIEW SLICE_START < SLICE_MAX) was rejected as "color views of several array slices are unsupported". Titles render such volumes with one draw: an instanced draw whose vertex stage picks each primitive's slice through the misc position export (PA_CL_VS_OUT_CNTL USE_VTX_RENDER_TARGET_INDX with VS_OUT_MISC_VEC_ENA). Depends on boykopovar#423, which carries PA_CL_VS_OUT_CNTL to the recompiler. - DecodeColorBuffer takes the slice range of a 3D target (ColorTarget::layers, clamped to the surface's last slice), allows DCC on 3D targets, and sizes a tiled 3D target by its whole surface (SurfaceForTarget moves to State.cpp for that). DecodeState sets State::renderLayers and, for a layered draw, USE_VTX_RENDER_TARGET_INDX (State::layerExports); color targets of different slice counts and layered draws with a depth target throw. - The driver adds State::layerExports to the PA_CL_VS_OUT_CNTL bits boykopovar#423 passes (it already passes VS_OUT_MISC_VEC_ENA), so the render target index reaches gl_Layer only for layered draws and stays ignored elsewhere as before. - A vertex stage writing gl_Layer declares ShaderViewportIndexLayerEXT and SPV_EXT_shader_viewport_index_layer when the device offers them (the device enables VK_EXT_shader_viewport_index_layer when present), instead of SPIR-V 1.5 ShaderLayer, which a Vulkan 1.1 device cannot take. Graphics validation accepts the capability, the extension and a vertex Layer output when it is enabled, and a per-primitive Layer output of a mesh stage. - The resident target's attachment view is a 2D array view of the slices, and the framebuffer has that many layers (Framebuffer and AcquireFramebuffer take the layer count). The execution test agc_driver_layered_volume_draw draws three bands, one per layer, into slices 1..3 of a 4-slice 64 KiB-tiled volume and reads every slice back: slice 0 stays untouched and slice 1 + L holds only band L. It also recompiles a mesh program with the layer export and validates it against the layered state. The mesh case does not draw: lavapipe's LLVM backend aborts compiling that mesh pipeline ("Cannot emit physreg copy instruction"), which a test cannot catch. On RADV the same mesh draw renders the bands into the right slices. PPSA14632 (LEGO Horizon Adventures) renders its 64x64x64 RGBA16F translucency lighting volumes (two DCC targets, 64 instances) this way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PA_CL_VS_OUT_CNTL moved to request version 17, so the last version without it is 16; a version 12 request would also lack main's newer fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PA_CL_VS_OUT_CNTL's clip and cull enables and its misc and distance vector bits reach the recompiler's vertex info (request version 20), the draw key, the vertex-info comparison and the recompile cache key. Registration and draw-time preparation set them the same way the draw does; a program without pos1..pos3 exports gets none, so its artifact does not depend on the register. Guest clip distances share main's gl_ClipDistance array with the all-zero position distance; cull distances need shaderCullDistance. Up to eight clip and cull distances are accepted. Co-Authored-By: john.maia <hi@johnmaia.dev> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…river Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
66e1669 to
a72dcb9
Compare
Met on the current head: drawing tests (VertexClipCullDistances, VertexClipCullDraw), capabilities gated on device features, request versions 16-19 replayed in agc_shader_memory.
A color view of several depth slices of a 3D target (CB_COLOR_VIEW SLICE_START < SLICE_MAX) was rejected as "color views of several array slices are unsupported". Titles render such volumes with one draw: an instanced draw whose vertex stage picks each primitive's slice through the misc position export (PA_CL_VS_OUT_CNTL USE_VTX_RENDER_TARGET_INDX with VS_OUT_MISC_VEC_ENA). Depends on boykopovar#423, which carries PA_CL_VS_OUT_CNTL to the recompiler. - DecodeColorBuffer takes the slice range of a 3D target (ColorTarget::layers, clamped to the surface's last slice), allows DCC on 3D targets, and sizes a tiled 3D target by its whole surface (SurfaceForTarget moves to State.cpp for that). DecodeState sets State::renderLayers and, for a layered draw, USE_VTX_RENDER_TARGET_INDX (State::layerExports); color targets of different slice counts and layered draws with a depth target throw. - The driver adds State::layerExports to the PA_CL_VS_OUT_CNTL bits boykopovar#423 passes (it already passes VS_OUT_MISC_VEC_ENA), so the render target index reaches gl_Layer only for layered draws and stays ignored elsewhere as before. - A vertex stage writing gl_Layer declares ShaderViewportIndexLayerEXT and SPV_EXT_shader_viewport_index_layer when the device offers them (the device enables VK_EXT_shader_viewport_index_layer when present), instead of SPIR-V 1.5 ShaderLayer, which a Vulkan 1.1 device cannot take. Graphics validation accepts the capability, the extension and a vertex Layer output when it is enabled, and a per-primitive Layer output of a mesh stage. - The resident target's attachment view is a 2D array view of the slices, and the framebuffer has that many layers (Framebuffer and AcquireFramebuffer take the layer count). The execution test agc_driver_layered_volume_draw draws three bands, one per layer, into slices 1..3 of a 4-slice 64 KiB-tiled volume and reads every slice back: slice 0 stays untouched and slice 1 + L holds only band L. It also recompiles a mesh program with the layer export and validates it against the layered state. The mesh case does not draw: lavapipe's LLVM backend aborts compiling that mesh pipeline ("Cannot emit physreg copy instruction"), which a test cannot catch. On RADV the same mesh draw renders the bands into the right slices. PPSA14632 (LEGO Horizon Adventures) renders its 64x64x64 RGBA16F translucency lighting volumes (two DCC targets, 64 instances) this way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A color view of several depth slices of a 3D target (CB_COLOR_VIEW SLICE_START < SLICE_MAX) was rejected as "color views of several array slices are unsupported". Titles render such volumes with one draw: an instanced draw whose vertex stage picks each primitive's slice through the misc position export (PA_CL_VS_OUT_CNTL USE_VTX_RENDER_TARGET_INDX with VS_OUT_MISC_VEC_ENA). Depends on boykopovar#423, which carries PA_CL_VS_OUT_CNTL to the recompiler. - DecodeColorBuffer takes the slice range of a 3D target (ColorTarget::layers, clamped to the surface's last slice), allows DCC on 3D targets, and sizes a tiled 3D target by its whole surface (SurfaceForTarget moves to State.cpp for that). DecodeState sets State::renderLayers and, for a layered draw, USE_VTX_RENDER_TARGET_INDX (State::layerExports); color targets of different slice counts and layered draws with a depth target throw. - The driver adds State::layerExports to the PA_CL_VS_OUT_CNTL bits boykopovar#423 passes (it already passes VS_OUT_MISC_VEC_ENA), so the render target index reaches gl_Layer only for layered draws and stays ignored elsewhere as before. - A vertex stage writing gl_Layer declares ShaderViewportIndexLayerEXT and SPV_EXT_shader_viewport_index_layer when the device offers them (the device enables VK_EXT_shader_viewport_index_layer when present), instead of SPIR-V 1.5 ShaderLayer, which a Vulkan 1.1 device cannot take. Graphics validation accepts the capability, the extension and a vertex Layer output when it is enabled, and a per-primitive Layer output of a mesh stage. - The resident target's attachment view is a 2D array view of the slices, and the framebuffer has that many layers (Framebuffer and AcquireFramebuffer take the layer count). The execution test agc_driver_layered_volume_draw draws three bands, one per layer, into slices 1..3 of a 4-slice 64 KiB-tiled volume and reads every slice back: slice 0 stays untouched and slice 1 + L holds only band L. It also recompiles a mesh program with the layer export and validates it against the layered state. The mesh case does not draw: lavapipe's LLVM backend aborts compiling that mesh pipeline ("Cannot emit physreg copy instruction"), which a test cannot catch. On RADV the same mesh draw renders the bands into the right slices. PPSA14632 (LEGO Horizon Adventures) renders its 64x64x64 RGBA16F translucency lighting volumes (two DCC targets, 64 instances) this way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Where upstream now does what this branch carried, upstream's version is kept: clip and cull distances (boykopovar#423), layered rendering (boykopovar#3763), block copies of BC textures over storage images (126a1e4), one-layer depth array storage views, joined and windowed host imports (importAccess). Kept from this branch on top: the retry of host imports refused while a heap was being committed, the shared registry lease, host-import reads of sampled textures (not for partially resident ones), the live storage image lookup for block copies, aligned buffer atomics, the CMASK reading of codes other than 0 and 15, mesh draws shorter than one primitive, and the relaxed float mode (request serialization version 24). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uzy15wqYTt6iWyxYXEzUWo
What
Draws whose vertex stage exports clip or cull distances (PA_CL_VS_OUT_CNTL clip/cull enables and VS_OUT_CCDIST) were refused with
clip distances, layer, viewport or auxiliary vertex exports. The recompiler already turns the misc and clip/cull position exports intoClipDistance/CullDistanceoutputs fromShaderVertexStageInfo::paClVsOutCntl, but the driver never passed the register, so the field was always 0.decodeVertexInfopasses PA_CL_VS_OUT_CNTL's clip/cull enables and VS_OUT_MISC/CCDIST bits. They are part of the draw lookup key and the vertex-info comparison, the recompile cache key, and the serialized request (version 18; main is at 17).pos1..pos3export gets no bits at all (PositionExportLayout, cached per snapshot), so its artifact does not depend on PA_CL_VS_OUT_CNTL. That also covers johnmaia's0x01240000case, where only the misc-vector bit was set.State::paClVsOutCntlkeeps the value for the validator's messages and its cache key.ClipDistanceoutputs off32[1..8](they share one array with main's all-zero clip position distance from 9db923e, which takes the index after the guest's) and vertexCullDistanceoutputs off32[1..8], at most eight together. A clip or cull capability on a device withoutshaderClipDistance/shaderCullDistanceis refused with the PA_CL_VS_OUT_CNTL value in the message.shaderCullDistanceis enabled when available, next to main'sshaderClipDistance, andCullDistancejoins the device capabilities.In GTA V the reflections in glass and some glass textures were missing: their draws clip against a plane. tibzejoker's Story mode stop (
register 0x207 = 0x00400001, one clip distance) is this path.Tested
Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.
agc_driver_vertex_clip_cull_distances: device draws for each enable pattern (no bits, clip planes 0, 1 and 0x5, cull plane 0 with every vertex negative and with one not, sparse cull plane 0x4), checking which pixels are written.agc_driver_vertex_clip_cull_drawand..._no_key: the position export layout of a pos0-only program (no bits), a pos1 program (only the layout bits), cached and at a code offset; then the same draws through PM4 submission, with the draw key on and off (the cache then keys on the decoded vertex stage, which must include PA_CL_VS_OUT_CNTL). Both shut the driver down at exit (thanks @Scramblrrrr for the teardown crash).agc_driver_zero_position_vertexandagc_position_invariancestill pass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository🤖 Generated with Claude Code