From 2a3c29698c43601751e43c0344d8f5ba1f57937d Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 10 Jun 2015 21:04:51 -0700 Subject: [PATCH] vk/image: Add a bunch of asserts --- src/vulkan/image.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/vulkan/image.c b/src/vulkan/image.c index 40d5024a0eb..b385be48917 100644 --- a/src/vulkan/image.c +++ b/src/vulkan/image.c @@ -108,6 +108,13 @@ VkResult anv_image_create( if (image == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + /* XXX: We don't handle any of these */ + anv_assert(pCreateInfo->imageType == VK_IMAGE_TYPE_2D); + anv_assert(pCreateInfo->mipLevels == 1); + anv_assert(pCreateInfo->arraySize == 1); + anv_assert(pCreateInfo->samples == 1); + anv_assert(pCreateInfo->extent.depth == 1); + image->bo = NULL; image->offset = 0; image->type = pCreateInfo->imageType; @@ -204,6 +211,13 @@ anv_image_view_init(struct anv_surface_view *view, anv_format_for_vk_format(pCreateInfo->format); uint32_t tile_mode, format; + /* XXX: We don't handle any of these */ + anv_assert(pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_2D); + anv_assert(pCreateInfo->subresourceRange.baseMipLevel == 0); + anv_assert(pCreateInfo->subresourceRange.mipLevels == 1); + anv_assert(pCreateInfo->subresourceRange.baseArraySlice == 0); + anv_assert(pCreateInfo->subresourceRange.arraySize == 1); + view->bo = image->bo; switch (pCreateInfo->subresourceRange.aspect) { case VK_IMAGE_ASPECT_STENCIL: @@ -316,6 +330,12 @@ anv_color_attachment_view_init(struct anv_surface_view *view, const struct anv_format *format = anv_format_for_vk_format(pCreateInfo->format); + /* XXX: We don't handle any of these */ + anv_assert(pCreateInfo->mipLevel == 0); + anv_assert(pCreateInfo->baseArraySlice == 0); + anv_assert(pCreateInfo->arraySize == 1); + anv_assert(pCreateInfo->msaaResolveImage == 0); + view->bo = image->bo; view->offset = image->offset; view->extent = image->extent; @@ -410,6 +430,12 @@ VkResult anv_CreateDepthStencilView( if (view == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + /* XXX: We don't handle any of these */ + anv_assert(pCreateInfo->mipLevel == 0); + anv_assert(pCreateInfo->baseArraySlice == 0); + anv_assert(pCreateInfo->arraySize == 1); + anv_assert(pCreateInfo->msaaResolveImage == 0); + view->bo = image->bo; view->depth_stride = image->stride; -- 2.30.2