summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-11-15 06:46:50 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2016-11-24 16:34:41 +0000
commit32adfd509df398696013704a39cde888361824bf (patch)
tree08d366c7344b263757f72f447fac0d6767d9ddea
parent7e9bdb40f34243201317ca0a3b74809a619e0e53 (diff)
downloadexternal_mesa3d-32adfd509df398696013704a39cde888361824bf.zip
external_mesa3d-32adfd509df398696013704a39cde888361824bf.tar.gz
external_mesa3d-32adfd509df398696013704a39cde888361824bf.tar.bz2
radv: fix image view creation for depth and stencil only
This fixes the image view for sampling just the depth. It removes some pointless swizzle code, and adds a missing case for the x8_d24 format. Fixes: dEQP-VK.renderpass.formats.d32_sfloat_s8_uint.input.* dEQP-VK.renderpass.formats.d24_unorm_s8_uint.input.* dEQP-VK.renderpass.formats.x8_d24_unorm_pack32.input.* Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 6d7be52d90cd5f4798b9612e8a68f6d6d9e31c33)
-rw-r--r--src/amd/vulkan/radv_formats.c1
-rw-r--r--src/amd/vulkan/radv_image.c21
2 files changed, 9 insertions, 13 deletions
diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c
index 76d5fa1..fe786b3 100644
--- a/src/amd/vulkan/radv_formats.c
+++ b/src/amd/vulkan/radv_formats.c
@@ -154,6 +154,7 @@ uint32_t radv_translate_tex_dataformat(VkFormat format,
case VK_FORMAT_D16_UNORM:
return V_008F14_IMG_DATA_FORMAT_16;
case VK_FORMAT_D24_UNORM_S8_UINT:
+ case VK_FORMAT_X8_D24_UNORM_PACK32:
return V_008F14_IMG_DATA_FORMAT_8_24;
case VK_FORMAT_S8_UINT:
return V_008F14_IMG_DATA_FORMAT_8;
diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index 710eda1..3099d83 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -267,17 +267,7 @@ si_make_texture_descriptor(struct radv_device *device,
if (desc->colorspace == VK_FORMAT_COLORSPACE_ZS) {
const unsigned char swizzle_xxxx[4] = {0, 0, 0, 0};
- const unsigned char swizzle_yyyy[4] = {1, 1, 1, 1};
-
- switch (vk_format) {
- case VK_FORMAT_X8_D24_UNORM_PACK32:
- case VK_FORMAT_D24_UNORM_S8_UINT:
- case VK_FORMAT_D32_SFLOAT_S8_UINT:
- vk_format_compose_swizzles(mapping, swizzle_yyyy, swizzle);
- break;
- default:
- vk_format_compose_swizzles(mapping, swizzle_xxxx, swizzle);
- }
+ vk_format_compose_swizzles(mapping, swizzle_xxxx, swizzle);
} else {
vk_format_compose_swizzles(mapping, desc->swizzle, swizzle);
}
@@ -775,8 +765,13 @@ radv_image_view_init(struct radv_image_view *iview,
iview->vk_format = pCreateInfo->format;
iview->aspect_mask = pCreateInfo->subresourceRange.aspectMask;
- if (iview->aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT)
+ if (iview->aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT) {
is_stencil = true;
+ iview->vk_format = vk_format_stencil_only(iview->vk_format);
+ } else if (iview->aspect_mask == VK_IMAGE_ASPECT_DEPTH_BIT) {
+ iview->vk_format = vk_format_depth_only(iview->vk_format);
+ }
+
iview->extent = (VkExtent3D) {
.width = radv_minify(image->extent.width , range->baseMipLevel),
.height = radv_minify(image->extent.height, range->baseMipLevel),
@@ -794,7 +789,7 @@ radv_image_view_init(struct radv_image_view *iview,
si_make_texture_descriptor(device, image, false,
iview->type,
- pCreateInfo->format,
+ iview->vk_format,
&pCreateInfo->components,
0, radv_get_levelCount(image, range) - 1,
range->baseArrayLayer,