mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
tu: Fix IBO descriptor for cubes
They act the same as 2D arrays when used as storage images, and we're supposed to override the IBO descriptor to reflect this. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5122>
This commit is contained in:
parent
f7ab9c4eb1
commit
08d22bb908
1 changed files with 17 additions and 16 deletions
|
|
@ -237,7 +237,7 @@ tu6_texswiz(const VkComponentMapping *comps,
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum a6xx_tex_type
|
static enum a6xx_tex_type
|
||||||
tu6_tex_type(VkImageViewType type)
|
tu6_tex_type(VkImageViewType type, bool storage)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
default:
|
default:
|
||||||
|
|
@ -251,7 +251,7 @@ tu6_tex_type(VkImageViewType type)
|
||||||
return A6XX_TEX_3D;
|
return A6XX_TEX_3D;
|
||||||
case VK_IMAGE_VIEW_TYPE_CUBE:
|
case VK_IMAGE_VIEW_TYPE_CUBE:
|
||||||
case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
|
case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
|
||||||
return A6XX_TEX_CUBE;
|
return storage ? A6XX_TEX_2D : A6XX_TEX_CUBE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -314,17 +314,18 @@ tu_image_view_init(struct tu_image_view *iview,
|
||||||
|
|
||||||
uint32_t width = u_minify(image->extent.width, range->baseMipLevel);
|
uint32_t width = u_minify(image->extent.width, range->baseMipLevel);
|
||||||
uint32_t height = u_minify(image->extent.height, range->baseMipLevel);
|
uint32_t height = u_minify(image->extent.height, range->baseMipLevel);
|
||||||
uint32_t depth = tu_get_layerCount(image, range);
|
uint32_t storage_depth = tu_get_layerCount(image, range);
|
||||||
switch (pCreateInfo->viewType) {
|
if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_3D) {
|
||||||
case VK_IMAGE_VIEW_TYPE_3D:
|
storage_depth = u_minify(image->extent.depth, range->baseMipLevel);
|
||||||
depth = u_minify(image->extent.depth, range->baseMipLevel);
|
}
|
||||||
break;
|
|
||||||
case VK_IMAGE_VIEW_TYPE_CUBE:
|
uint32_t depth = storage_depth;
|
||||||
case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
|
if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE ||
|
||||||
|
pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY) {
|
||||||
|
/* Cubes are treated as 2D arrays for storage images, so only divide the
|
||||||
|
* depth by 6 for the texture descriptor.
|
||||||
|
*/
|
||||||
depth /= 6;
|
depth /= 6;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t base_addr = image->bo->iova + image->bo_offset +
|
uint64_t base_addr = image->bo->iova + image->bo_offset +
|
||||||
|
|
@ -365,7 +366,7 @@ tu_image_view_init(struct tu_image_view *iview,
|
||||||
iview->descriptor[2] =
|
iview->descriptor[2] =
|
||||||
A6XX_TEX_CONST_2_FETCHSIZE(tu6_fetchsize(format)) |
|
A6XX_TEX_CONST_2_FETCHSIZE(tu6_fetchsize(format)) |
|
||||||
A6XX_TEX_CONST_2_PITCH(pitch) |
|
A6XX_TEX_CONST_2_PITCH(pitch) |
|
||||||
A6XX_TEX_CONST_2_TYPE(tu6_tex_type(pCreateInfo->viewType));
|
A6XX_TEX_CONST_2_TYPE(tu6_tex_type(pCreateInfo->viewType, false));
|
||||||
iview->descriptor[3] = A6XX_TEX_CONST_3_ARRAY_PITCH(layer_size);
|
iview->descriptor[3] = A6XX_TEX_CONST_3_ARRAY_PITCH(layer_size);
|
||||||
iview->descriptor[4] = base_addr;
|
iview->descriptor[4] = base_addr;
|
||||||
iview->descriptor[5] = (base_addr >> 32) | A6XX_TEX_CONST_5_DEPTH(depth);
|
iview->descriptor[5] = (base_addr >> 32) | A6XX_TEX_CONST_5_DEPTH(depth);
|
||||||
|
|
@ -435,11 +436,11 @@ tu_image_view_init(struct tu_image_view *iview,
|
||||||
A6XX_IBO_1_HEIGHT(height);
|
A6XX_IBO_1_HEIGHT(height);
|
||||||
iview->storage_descriptor[2] =
|
iview->storage_descriptor[2] =
|
||||||
A6XX_IBO_2_PITCH(pitch) |
|
A6XX_IBO_2_PITCH(pitch) |
|
||||||
A6XX_IBO_2_TYPE(tu6_tex_type(pCreateInfo->viewType));
|
A6XX_IBO_2_TYPE(tu6_tex_type(pCreateInfo->viewType, true));
|
||||||
iview->storage_descriptor[3] = A6XX_IBO_3_ARRAY_PITCH(layer_size);
|
iview->storage_descriptor[3] = A6XX_IBO_3_ARRAY_PITCH(layer_size);
|
||||||
|
|
||||||
iview->storage_descriptor[4] = base_addr;
|
iview->storage_descriptor[4] = base_addr;
|
||||||
iview->storage_descriptor[5] = (base_addr >> 32) | A6XX_IBO_5_DEPTH(depth);
|
iview->storage_descriptor[5] = (base_addr >> 32) | A6XX_IBO_5_DEPTH(storage_depth);
|
||||||
|
|
||||||
if (ubwc_enabled) {
|
if (ubwc_enabled) {
|
||||||
iview->storage_descriptor[3] |= A6XX_IBO_3_FLAG | A6XX_IBO_3_UNK27;
|
iview->storage_descriptor[3] |= A6XX_IBO_3_FLAG | A6XX_IBO_3_UNK27;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue