anv/image: Remove some vkCreateImage validation
authorChad Versace <chad.versace@intel.com>
Thu, 10 Dec 2015 00:30:52 +0000 (16:30 -0800)
committerChad Versace <chad.versace@intel.com>
Thu, 10 Dec 2015 00:33:23 +0000 (16:33 -0800)
Don't validate the baseArrayLayer and layerCount of cube images.  This
allows us to remove a bloated lookup table and an unneeded struct
definition (anv_image_view_info).

src/vulkan/anv_image.c

index 6aa6b5a32b55d71480b66627e445442ba32209f3..dc52e6b368c98cb5870606c229aa496dabdc3d3f 100644 (file)
  */
 #include "gen8_pack.h"
 
-struct anv_image_view_info {
-   uint8_t surface_type; /**< RENDER_SURFACE_STATE.SurfaceType */
-   bool is_array:1; /**< RENDER_SURFACE_STATE.SurfaceArray */
-   bool is_cube:1; /**< RENDER_SURFACE_STATE.CubeFaceEnable* */
-};
-
 static const uint8_t anv_surf_type_from_image_type[] = {
    [VK_IMAGE_TYPE_1D] = SURFTYPE_1D,
    [VK_IMAGE_TYPE_2D] = SURFTYPE_2D,
    [VK_IMAGE_TYPE_3D] = SURFTYPE_3D,
 };
 
-static const struct anv_image_view_info
-anv_image_view_info_table[] = {
-   #define INFO(s, ...) { .surface_type = s, __VA_ARGS__ }
-   [VK_IMAGE_VIEW_TYPE_1D]          = INFO(SURFTYPE_1D),
-   [VK_IMAGE_VIEW_TYPE_2D]          = INFO(SURFTYPE_2D),
-   [VK_IMAGE_VIEW_TYPE_3D]          = INFO(SURFTYPE_3D),
-   [VK_IMAGE_VIEW_TYPE_CUBE]        = INFO(SURFTYPE_CUBE,                  .is_cube = 1),
-   [VK_IMAGE_VIEW_TYPE_1D_ARRAY]    = INFO(SURFTYPE_1D,     .is_array = 1),
-   [VK_IMAGE_VIEW_TYPE_2D_ARRAY]    = INFO(SURFTYPE_2D,     .is_array = 1),
-   [VK_IMAGE_VIEW_TYPE_CUBE_ARRAY]  = INFO(SURFTYPE_CUBE,   .is_array = 1, .is_cube = 1),
-   #undef INFO
-};
-
 /**
  * The \a format argument is required and overrides any format found in struct
  * anv_image_create_info. Exactly one bit must be set in \a aspect.
@@ -362,7 +343,6 @@ anv_validate_CreateImageView(VkDevice _device,
 {
    ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
    const VkImageSubresourceRange *subresource;
-   const struct anv_image_view_info *view_info;
    const struct anv_format *view_format_info;
 
    /* Validate structure type before dereferencing it. */
@@ -373,7 +353,6 @@ anv_validate_CreateImageView(VkDevice _device,
    /* Validate viewType is in range before using it. */
    assert(pCreateInfo->viewType >= VK_IMAGE_VIEW_TYPE_BEGIN_RANGE);
    assert(pCreateInfo->viewType <= VK_IMAGE_VIEW_TYPE_END_RANGE);
-   view_info = &anv_image_view_info_table[pCreateInfo->viewType];
 
    /* Validate format is in range before using it. */
    assert(pCreateInfo->format >= VK_FORMAT_BEGIN_RANGE);
@@ -400,11 +379,6 @@ anv_validate_CreateImageView(VkDevice _device,
    assert(subresource->baseArrayLayer + subresource->layerCount <= image->array_size);
    assert(pView);
 
-   if (view_info->is_cube) {
-      assert(subresource->baseArrayLayer % 6 == 0);
-      assert(subresource->layerCount % 6 == 0);
-   }
-
    const VkImageAspectFlags ds_flags = VK_IMAGE_ASPECT_DEPTH_BIT
                                      | VK_IMAGE_ASPECT_STENCIL_BIT;