diff options
author | Chad Versace <[email protected]> | 2015-08-28 07:44:32 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2015-08-28 07:44:32 -0700 |
commit | b2ee317e24d9d236d0050b2a6188df379e913c45 (patch) | |
tree | ff27aba11a885bf192d8af3041a7dd1a70ae5e91 /src/vulkan/anv_image.c | |
parent | 798acb2464f1a7baf58b0085d020d7b2b3d21de7 (diff) |
vk: Fix format of anv_depth_stencil_view
The format of the view itself and of the view's image may differ.
Moreover, if the view's format has no depth aspect but the image's
format does, we must not program the depth buffer. Ditto for stencil.
Diffstat (limited to 'src/vulkan/anv_image.c')
-rw-r--r-- | src/vulkan/anv_image.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index 198f4a40212..6ab541e5bce 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -475,14 +475,28 @@ anv_depth_stencil_view_init(struct anv_depth_stencil_view *view, view->bo = image->bo; - view->depth_stride = image->depth_surface.stride; - view->depth_offset = image->offset + image->depth_surface.offset; - view->depth_format = image->format->depth_format; - view->depth_qpitch = 0; /* FINISHME: QPitch */ - - view->stencil_stride = image->stencil_surface.stride; - view->stencil_offset = image->offset + image->stencil_surface.offset; - view->stencil_qpitch = 0; /* FINISHME: QPitch */ + view->format = anv_format_for_vk_format(pCreateInfo->format); + assert(anv_format_is_depth_or_stencil(view->format)); + + if (view->format->depth_format) { + view->depth_stride = image->depth_surface.stride; + view->depth_offset = image->offset + image->depth_surface.offset; + view->depth_qpitch = 0; /* FINISHME: QPitch */ + } else { + view->depth_stride = 0; + view->depth_offset = 0; + view->depth_qpitch = 0; + } + + if (view->format->has_stencil) { + view->stencil_stride = image->stencil_surface.stride; + view->stencil_offset = image->offset + image->stencil_surface.offset; + view->stencil_qpitch = 0; /* FINISHME: QPitch */ + } else { + view->stencil_stride = 0; + view->stencil_offset = 0; + view->stencil_qpitch = 0; + } } struct anv_surface * |