[Mesa-dev] [PATCH 22/23] anv: Add a devinfo argument to the get_format functions

Jason Ekstrand jason at jlekstrand.net
Mon May 16 19:08:27 UTC 2016


---
 src/intel/vulkan/anv_formats.c        | 10 ++++++----
 src/intel/vulkan/anv_image.c          |  9 +++++----
 src/intel/vulkan/anv_meta_copy.c      |  3 ++-
 src/intel/vulkan/anv_private.h        | 10 +++++-----
 src/intel/vulkan/genX_pipeline_util.h |  3 ++-
 5 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 233abc1..bd8d11f 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -246,8 +246,8 @@ static const struct anv_format anv_formats[] = {
  * Exactly one bit must be set in \a aspect.
  */
 struct anv_format
-anv_get_format(VkFormat vk_format, VkImageAspectFlags aspect,
-               VkImageTiling tiling)
+anv_get_format(const struct brw_device_info *devinfo, VkFormat vk_format,
+               VkImageAspectFlags aspect, VkImageTiling tiling)
 {
    struct anv_format format = anv_formats[vk_format];
 
@@ -382,9 +382,11 @@ anv_physical_device_get_format_properties(struct anv_physical_device *physical_d
                VK_FORMAT_FEATURE_BLIT_DST_BIT;
    } else {
       struct anv_format linear_fmt, tiled_fmt;
-      linear_fmt = anv_get_format(format, VK_IMAGE_ASPECT_COLOR_BIT,
+      linear_fmt = anv_get_format(physical_device->info, format,
+                                  VK_IMAGE_ASPECT_COLOR_BIT,
                                   VK_IMAGE_TILING_LINEAR);
-      tiled_fmt = anv_get_format(format, VK_IMAGE_ASPECT_COLOR_BIT,
+      tiled_fmt = anv_get_format(physical_device->info, format,
+                                 VK_IMAGE_ASPECT_COLOR_BIT,
                                  VK_IMAGE_TILING_OPTIMAL);
 
       linear = get_image_format_properties(gen, linear_fmt.isl_format,
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index f517aa6..208e377 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -131,7 +131,8 @@ make_surface(const struct anv_device *dev,
 
    ok = isl_surf_init(&dev->isl_dev, &anv_surf->isl,
       .dim = vk_to_isl_surf_dim[vk_info->imageType],
-      .format = anv_get_isl_format(vk_info->format, aspect, vk_info->tiling),
+      .format = anv_get_isl_format(&dev->info, vk_info->format,
+                                   aspect, vk_info->tiling),
       .width = image->extent.width,
       .height = image->extent.height,
       .depth = image->extent.depth,
@@ -466,8 +467,8 @@ anv_image_view_init(struct anv_image_view *iview,
    iview->aspect_mask = pCreateInfo->subresourceRange.aspectMask;
    iview->vk_format = pCreateInfo->format;
 
-   struct anv_format format =
-      anv_get_format(pCreateInfo->format, range->aspectMask, image->tiling);
+   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;
@@ -621,7 +622,7 @@ void anv_buffer_view_init(struct anv_buffer_view *view,
 
    /* TODO: Handle the format swizzle? */
 
-   view->format = anv_get_isl_format(pCreateInfo->format,
+   view->format = anv_get_isl_format(&device->info, pCreateInfo->format,
                                      VK_IMAGE_ASPECT_COLOR_BIT,
                                      VK_IMAGE_TILING_LINEAR);
    view->bo = buffer->bo;
diff --git a/src/intel/vulkan/anv_meta_copy.c b/src/intel/vulkan/anv_meta_copy.c
index c509c8f..ff560ce 100644
--- a/src/intel/vulkan/anv_meta_copy.c
+++ b/src/intel/vulkan/anv_meta_copy.c
@@ -161,7 +161,8 @@ meta_copy_buffer_to_image(struct anv_cmd_buffer *cmd_buffer,
          &anv_image_get_surface_for_aspect_mask(image, aspect)->isl;
       struct anv_meta_blit2d_surf img_bsurf =
          blit_surf_for_image(image, img_isl_surf);
-      enum isl_format buf_format = anv_get_isl_format(image->vk_format, aspect,
+      enum isl_format buf_format = anv_get_isl_format(&cmd_buffer->device->info,
+                                                      image->vk_format, aspect,
                                                       VK_IMAGE_TILING_LINEAR);
       struct anv_meta_blit2d_surf buf_bsurf = {
          .bo = buffer->bo,
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index fccdbf7..9943677 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1519,14 +1519,14 @@ struct anv_format {
 };
 
 struct anv_format
-anv_get_format(VkFormat format, VkImageAspectFlags aspect,
-               VkImageTiling tiling);
+anv_get_format(const struct brw_device_info *devinfo, VkFormat format,
+               VkImageAspectFlags aspect, VkImageTiling tiling);
 
 static inline enum isl_format
-anv_get_isl_format(VkFormat vk_format, VkImageAspectFlags aspect,
-                   VkImageTiling tiling)
+anv_get_isl_format(const struct brw_device_info *devinfo, VkFormat vk_format,
+                   VkImageAspectFlags aspect, VkImageTiling tiling)
 {
-   return anv_get_format(vk_format, aspect, tiling).isl_format;
+   return anv_get_format(devinfo, vk_format, aspect, tiling).isl_format;
 }
 
 /**
diff --git a/src/intel/vulkan/genX_pipeline_util.h b/src/intel/vulkan/genX_pipeline_util.h
index 3d362da..ecbe436 100644
--- a/src/intel/vulkan/genX_pipeline_util.h
+++ b/src/intel/vulkan/genX_pipeline_util.h
@@ -100,7 +100,8 @@ emit_vertex_input(struct anv_pipeline *pipeline,
    for (uint32_t i = 0; i < info->vertexAttributeDescriptionCount; i++) {
       const VkVertexInputAttributeDescription *desc =
          &info->pVertexAttributeDescriptions[i];
-      enum isl_format format = anv_get_isl_format(desc->format,
+      enum isl_format format = anv_get_isl_format(&pipeline->device->info,
+                                                  desc->format,
                                                   VK_IMAGE_ASPECT_COLOR_BIT,
                                                   VK_IMAGE_TILING_LINEAR);
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list