mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 00:53:02 -05:00
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 #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 #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>