[Mesa-dev] [PATCH 04/13] anv/image: Add an isl_view to anv_image_view

Jason Ekstrand jason at jlekstrand.net
Sun Sep 25 16:59:03 UTC 2016


Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
---
 src/intel/vulkan/anv_blorp.c       |  4 ++--
 src/intel/vulkan/anv_dump.c        |  3 ++-
 src/intel/vulkan/anv_image.c       | 37 ++++++++++++++++++-------------------
 src/intel/vulkan/anv_private.h     |  4 ++--
 src/intel/vulkan/genX_cmd_buffer.c |  4 ++--
 5 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index f5a6c40..9589510 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -918,9 +918,9 @@ anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer *cmd_buffer)
 
       assert(src_iview->aspect_mask == dst_iview->aspect_mask);
       resolve_image(&batch, src_iview->image,
-                    src_iview->base_mip, src_iview->base_layer,
+                    src_iview->isl.base_level, src_iview->isl.base_array_layer,
                     dst_iview->image,
-                    dst_iview->base_mip, dst_iview->base_layer,
+                    dst_iview->isl.base_level, dst_iview->isl.base_array_layer,
                     src_iview->aspect_mask,
                     render_area.offset.x, render_area.offset.y,
                     render_area.offset.x, render_area.offset.y,
diff --git a/src/intel/vulkan/anv_dump.c b/src/intel/vulkan/anv_dump.c
index 37882ff..ed1b575 100644
--- a/src/intel/vulkan/anv_dump.c
+++ b/src/intel/vulkan/anv_dump.c
@@ -426,7 +426,8 @@ anv_dump_add_framebuffer(struct anv_cmd_buffer *cmd_buffer,
                                           dump_idx, i, suffix);
 
          dump_add_image(cmd_buffer, (struct anv_image *)iview->image, aspect,
-                        iview->base_mip, iview->base_layer, filename);
+                        iview->isl.base_level, iview->isl.base_array_layer,
+                        filename);
       }
    }
 
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index f55c9b6..93c1c06 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -405,10 +405,7 @@ anv_image_view_init(struct anv_image_view *iview,
    struct anv_format format = anv_get_format(&device->info, pCreateInfo->format,
                                              range->aspectMask, image->tiling);
 
-   iview->base_layer = range->baseArrayLayer;
-   iview->base_mip = range->baseMipLevel;
-
-   struct isl_view isl_view = {
+   iview->isl = (struct isl_view) {
       .format = format.isl_format,
       .base_level = range->baseMipLevel,
       .levels = anv_get_levelCount(image, range),
@@ -440,26 +437,26 @@ anv_image_view_init(struct anv_image_view *iview,
        * detect the one case where we actually want an array range used for
        * 3-D textures.
        */
-      isl_view.base_array_layer = 0;
-      isl_view.array_len = iview->extent.depth;
+      iview->isl.base_array_layer = 0;
+      iview->isl.array_len = iview->extent.depth;
    }
 
-   isl_surf_usage_flags_t cube_usage;
    if (pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE ||
        pCreateInfo->viewType == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY) {
-      cube_usage = ISL_SURF_USAGE_CUBE_BIT;
+      iview->isl.usage = ISL_SURF_USAGE_CUBE_BIT;
    } else {
-      cube_usage = 0;
+      iview->isl.usage = 0;
    }
 
    if (image->usage & usage_mask & VK_IMAGE_USAGE_SAMPLED_BIT) {
       iview->sampler_surface_state = alloc_surface_state(device, cmd_buffer);
 
-      isl_view.usage = cube_usage | ISL_SURF_USAGE_TEXTURE_BIT;
+      struct isl_view view = iview->isl;
+      view.usage |= ISL_SURF_USAGE_TEXTURE_BIT;
       isl_surf_fill_state(&device->isl_dev,
                           iview->sampler_surface_state.map,
                           .surf = &surface->isl,
-                          .view = &isl_view,
+                          .view = &view,
                           .mocs = device->default_mocs);
 
       if (!device->info.has_llc)
@@ -479,14 +476,15 @@ anv_image_view_init(struct anv_image_view *iview,
     * remove a lot of hacks.
     */
    if ((image->usage & usage_mask & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) &&
-       isl_format_supports_rendering(&device->info, isl_view.format)) {
+       isl_format_supports_rendering(&device->info, format.isl_format)) {
       iview->color_rt_surface_state = alloc_surface_state(device, cmd_buffer);
 
-      isl_view.usage = cube_usage | ISL_SURF_USAGE_RENDER_TARGET_BIT;
+      struct isl_view view = iview->isl;
+      view.usage |= ISL_SURF_USAGE_RENDER_TARGET_BIT;
       isl_surf_fill_state(&device->isl_dev,
                           iview->color_rt_surface_state.map,
                           .surf = &surface->isl,
-                          .view = &isl_view,
+                          .view = &view,
                           .mocs = device->default_mocs);
 
       if (!device->info.has_llc)
@@ -501,13 +499,14 @@ anv_image_view_init(struct anv_image_view *iview,
 
       if (isl_has_matching_typed_storage_image_format(&device->info,
                                                       format.isl_format)) {
-         isl_view.usage = cube_usage | ISL_SURF_USAGE_STORAGE_BIT;
-         isl_view.format = isl_lower_storage_image_format(&device->info,
-                                                          isl_view.format);
+         struct isl_view view = iview->isl;
+         view.usage |= ISL_SURF_USAGE_STORAGE_BIT;
+         view.format = isl_lower_storage_image_format(&device->info,
+                                                      format.isl_format);
          isl_surf_fill_state(&device->isl_dev,
                              iview->storage_surface_state.map,
                              .surf = &surface->isl,
-                             .view = &isl_view,
+                             .view = &view,
                              .mocs = device->default_mocs);
       } else {
          anv_fill_buffer_surface_state(device, iview->storage_surface_state,
@@ -518,7 +517,7 @@ anv_image_view_init(struct anv_image_view *iview,
 
       isl_surf_fill_image_param(&device->isl_dev,
                                 &iview->storage_image_param,
-                                &surface->isl, &isl_view);
+                                &surface->isl, &iview->isl);
 
       if (!device->info.has_llc)
          anv_state_clflush(iview->storage_surface_state);
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 443c31f..a09403c 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1724,10 +1724,10 @@ struct anv_image_view {
    struct anv_bo *bo;
    uint32_t offset; /**< Offset into bo. */
 
+   struct isl_view isl;
+
    VkImageAspectFlags aspect_mask;
    VkFormat vk_format;
-   uint32_t base_layer;
-   uint32_t base_mip;
    VkExtent3D extent; /**< Extent of VkImageViewCreateInfo::baseMipLevel. */
 
    /** RENDER_SURFACE_STATE when using image as a color render target. */
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 6a84383..90700e7 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -1225,9 +1225,9 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
          db.SurfacePitch         = image->depth_surface.isl.row_pitch - 1;
          db.Height               = image->extent.height - 1;
          db.Width                = image->extent.width - 1;
-         db.LOD                  = iview->base_mip;
+         db.LOD                  = iview->isl.base_level;
          db.Depth                = image->array_size - 1; /* FIXME: 3-D */
-         db.MinimumArrayElement  = iview->base_layer;
+         db.MinimumArrayElement  = iview->isl.base_array_layer;
 
 #if GEN_GEN >= 8
          db.SurfaceQPitch =
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list