anv: Fix CUBE storage images
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 15 Dec 2015 00:59:59 +0000 (16:59 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 15 Dec 2015 00:59:59 +0000 (16:59 -0800)
src/vulkan/gen7_state.c
src/vulkan/gen8_state.c

index f58283f7d05138d330e786600bd8634cbb42d925..c6de40d3b9ad3f74dba3e8d9443afe13a9b212a7 100644 (file)
@@ -33,7 +33,8 @@
 #include "gen75_pack.h"
 
 static const uint8_t
-anv_surftype(const struct anv_image *image, VkImageViewType view_type)
+anv_surftype(const struct anv_image *image, VkImageViewType view_type,
+             bool storage)
 {
    switch (view_type) {
    default:
@@ -45,7 +46,7 @@ anv_surftype(const struct anv_image *image, VkImageViewType view_type)
    case VK_IMAGE_VIEW_TYPE_CUBE:
    case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
       assert(image->type == VK_IMAGE_TYPE_2D);
-      return SURFTYPE_CUBE;
+      return storage ? SURFTYPE_2D : SURFTYPE_CUBE;
    case VK_IMAGE_VIEW_TYPE_2D:
    case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
       assert(image->type == VK_IMAGE_TYPE_2D);
@@ -266,7 +267,7 @@ genX(image_view_init)(struct anv_image_view *iview,
       isl_surf_get_image_alignment_sa(&surface->isl);
 
    struct GENX(RENDER_SURFACE_STATE) surface_state = {
-      .SurfaceType = anv_surftype(image, pCreateInfo->viewType),
+      .SurfaceType = anv_surftype(image, pCreateInfo->viewType, false),
       .SurfaceArray = image->array_size > 1,
       .SurfaceFormat = format->surface_format,
       .SurfaceVerticalAlignment = anv_valign[image_align_sa.height],
@@ -360,6 +361,9 @@ genX(image_view_init)(struct anv_image_view *iview,
    if (image->needs_storage_surface_state) {
       iview->storage_surface_state = alloc_surface_state(device, cmd_buffer);
 
+      surface_state.SurfaceType =
+         anv_surftype(image, pCreateInfo->viewType, true),
+
       surface_state.SurfaceFormat =
          isl_lower_storage_image_format(&device->isl_dev,
                                         format->surface_format);
index eee2515e22023d7282be5fe70e05556dfd6a3c58..fe9f088d9cac6e22cf2c018b7a8b42345d5a1573 100644 (file)
@@ -33,7 +33,8 @@
 #include "gen9_pack.h"
 
 static const uint8_t
-anv_surftype(const struct anv_image *image, VkImageViewType view_type)
+anv_surftype(const struct anv_image *image, VkImageViewType view_type,
+             bool storage)
 {
    switch (view_type) {
    default:
@@ -45,7 +46,7 @@ anv_surftype(const struct anv_image *image, VkImageViewType view_type)
    case VK_IMAGE_VIEW_TYPE_CUBE:
    case VK_IMAGE_VIEW_TYPE_CUBE_ARRAY:
       assert(image->type == VK_IMAGE_TYPE_2D);
-      return SURFTYPE_CUBE;
+      return storage ? SURFTYPE_2D : SURFTYPE_CUBE;
    case VK_IMAGE_VIEW_TYPE_2D:
    case VK_IMAGE_VIEW_TYPE_2D_ARRAY:
       assert(image->type == VK_IMAGE_TYPE_2D);
@@ -246,7 +247,7 @@ genX(image_view_init)(struct anv_image_view *iview,
    get_halign_valign(&surface->isl, &halign, &valign);
 
    struct GENX(RENDER_SURFACE_STATE) surface_state = {
-      .SurfaceType = anv_surftype(image, pCreateInfo->viewType),
+      .SurfaceType = anv_surftype(image, pCreateInfo->viewType, false),
       .SurfaceArray = image->array_size > 1,
       .SurfaceFormat = format_info->surface_format,
       .SurfaceVerticalAlignment = valign,
@@ -335,6 +336,9 @@ genX(image_view_init)(struct anv_image_view *iview,
       iview->storage_surface_state =
          alloc_surface_state(device, cmd_buffer);
 
+      surface_state.SurfaceType =
+         anv_surftype(image, pCreateInfo->viewType, true),
+
       surface_state.SurfaceFormat =
          isl_lower_storage_image_format(&device->isl_dev,
                                         format_info->surface_format);