turnip: Correctly set layer stride for 3D images

Previously we were using layout.layer_size for the layer stride, but
in Vulkan, you can alias a 3D image as an array of 2D images via the
VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT flag. One reason to use
this behavior is so the geometry shader can write to a specific
depth in a 3D framebuffer with gl_Layer.

Since the 3D image is not a *true* layered image, layer_size is 0.
Instead, we can copy what freedreno does and use the slice size.

Fixes dEQP-VK.geometry.layered.3d.*

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4541>
This commit is contained in:
Brian Ho 2020-04-13 14:57:45 -07:00 committed by Marge Bot
parent 7e525d29ab
commit d6d5ee29ab
1 changed files with 4 additions and 2 deletions

View File

@ -392,7 +392,8 @@ tu6_emit_zs(struct tu_cmd_buffer *cmd,
tu_cs_emit_regs(cs,
A6XX_RB_DEPTH_BUFFER_INFO(.depth_format = fmt),
A6XX_RB_DEPTH_BUFFER_PITCH(tu_image_stride(iview->image, iview->base_mip)),
A6XX_RB_DEPTH_BUFFER_ARRAY_PITCH(iview->image->layout.layer_size),
A6XX_RB_DEPTH_BUFFER_ARRAY_PITCH(
fdl_layer_stride(&iview->image->layout, iview->base_mip)),
A6XX_RB_DEPTH_BUFFER_BASE(tu_image_view_base_ref(iview)),
A6XX_RB_DEPTH_BUFFER_BASE_GMEM(cmd->state.pass->attachments[a].gmem_offset));
@ -444,7 +445,8 @@ tu6_emit_mrt(struct tu_cmd_buffer *cmd,
.color_format = format.fmt,
.color_swap = format.swap),
A6XX_RB_MRT_PITCH(i, tu_image_stride(iview->image, iview->base_mip)),
A6XX_RB_MRT_ARRAY_PITCH(i, iview->image->layout.layer_size),
A6XX_RB_MRT_ARRAY_PITCH(i,
fdl_layer_stride(&iview->image->layout, iview->base_mip)),
A6XX_RB_MRT_BASE(i, tu_image_view_base_ref(iview)),
A6XX_RB_MRT_BASE_GMEM(i, cmd->state.pass->attachments[a].gmem_offset));