summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2015-10-07 09:03:47 -0700
committerChad Versace <[email protected]>2015-10-07 09:10:25 -0700
commit03dd72279f871c242a47bc4d03aef128bd5ae792 (patch)
tree7e61a81b9f8722349ead4662c749cc02f7f3dfa2
parent85ff3cfde32fe1614d93071f6a866bf797b4d12f (diff)
vk/image: Fix retrieval of anv_surface for depthstencil aspect
If anv_image_get_surface_for_aspect_mask() is given a combined depthstencil aspect mask, and the image has a stencil surface but no depth surface, then return the stencil surface. Hacks on hacks.
-rw-r--r--src/vulkan/anv_image.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c
index 3f4d9b15c92..5973be1391b 100644
--- a/src/vulkan/anv_image.c
+++ b/src/vulkan/anv_image.c
@@ -596,15 +596,21 @@ anv_image_get_surface_for_aspect_mask(struct anv_image *image, VkImageAspectFlag
assert(image->format->has_stencil);
return &image->stencil_surface;
case VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT:
- /* FINISHME: The Vulkan spec (git a511ba2) requires support for combined
- * depth stencil formats. Specifically, it states:
- *
- * At least one of ename:VK_FORMAT_D24_UNORM_S8_UINT or
- * ename:VK_FORMAT_D32_SFLOAT_S8_UINT must be supported.
- */
- anv_finishme("combined depthstencil aspect");
- assert(image->format->depth_format);
- return &image->depth_surface;
+ if (image->format->depth_format && image->format->has_stencil) {
+ /* FINISHME: The Vulkan spec (git a511ba2) requires support for combined
+ * depth stencil formats. Specifically, it states:
+ *
+ * At least one of ename:VK_FORMAT_D24_UNORM_S8_UINT or
+ * ename:VK_FORMAT_D32_SFLOAT_S8_UINT must be supported.
+ */
+ anv_finishme("combined depthstencil aspect");
+ return &image->depth_surface;
+ } else if (image->format->depth_format) {
+ return &image->depth_surface;
+ } else if (image->format->has_stencil) {
+ return &image->stencil_surface;
+ }
+ /* fallthrough */
default:
unreachable("image does not have aspect");
return NULL;