pvr: don't setup attachment tex state for images with input attachment bit unset

In this case the attachment tex state will be 0, which should make things easier
to debug.

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18320>
This commit is contained in:
Frank Binns
2022-08-23 11:46:56 +01:00
parent fdf85f10a1
commit 80bd9ce7ee
+27 -24
View File
@@ -321,34 +321,37 @@ VkResult pvr_CreateImageView(VkDevice _device,
goto err_vk_image_view_destroy;
}
/* Attachment state is created as if the mipmaps are not supported, so the
* baselevel is set to zero and num_mip_levels is set to 1. Which gives an
* impression that this is the only level in the image. This also requires
* that width, height and depth be adjusted as well. Given iview->vk.extent
* is already adjusted for base mip map level we use it here.
*/
/* TODO: Investigate and document the reason for above approach. */
info.extent = iview->vk.extent;
if (image->vk.usage & VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT) {
/* Attachment state is created as if the mipmaps are not supported, so the
* baselevel is set to zero and num_mip_levels is set to 1. Which gives an
* impression that this is the only level in the image. This also requires
* that width, height and depth be adjusted as well. Given
* iview->vk.extent is already adjusted for base mip map level we use it
* here.
*/
/* TODO: Investigate and document the reason for above approach. */
info.extent = iview->vk.extent;
info.mip_levels = 1;
info.mipmaps_present = false;
info.stride = u_minify(image->physical_extent.width, info.base_level);
info.base_level = 0;
info.tex_state_type = PVR_TEXTURE_STATE_ATTACHMENT;
info.mip_levels = 1;
info.mipmaps_present = false;
info.stride = u_minify(image->physical_extent.width, info.base_level);
info.base_level = 0;
info.tex_state_type = PVR_TEXTURE_STATE_ATTACHMENT;
if (iview->vk.image->image_type == VK_IMAGE_TYPE_3D &&
iview->vk.view_type == VK_IMAGE_VIEW_TYPE_2D) {
info.type = VK_IMAGE_VIEW_TYPE_3D;
} else {
info.type = iview->vk.view_type;
if (iview->vk.image->image_type == VK_IMAGE_TYPE_3D &&
iview->vk.view_type == VK_IMAGE_VIEW_TYPE_2D) {
info.type = VK_IMAGE_VIEW_TYPE_3D;
} else {
info.type = iview->vk.view_type;
}
result = pvr_pack_tex_state(device,
&info,
iview->texture_state[info.tex_state_type]);
if (result != VK_SUCCESS)
goto err_vk_image_view_destroy;
}
result = pvr_pack_tex_state(device,
&info,
iview->texture_state[info.tex_state_type]);
if (result != VK_SUCCESS)
goto err_vk_image_view_destroy;
*pView = pvr_image_view_to_handle(iview);
return VK_SUCCESS;