anv: Add a devinfo argument to the get_format functions
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 16 May 2016 17:25:54 +0000 (10:25 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 17 May 2016 19:17:22 +0000 (12:17 -0700)
src/intel/vulkan/anv_formats.c
src/intel/vulkan/anv_image.c
src/intel/vulkan/anv_meta_copy.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/genX_pipeline_util.h

index 233abc1882e9d3f6862c4c22bfa6026ea908fa80..bd8d11fb2b232f43846c7a39633b288245659236 100644 (file)
@@ -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,
index f517aa61f5871ba98af1367f70c4fd033aff7c90..208e3779c784a03550114bae01148981ab3af5a7 100644 (file)
@@ -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;
index c509c8fa1c01efa6ffc0b2d23d3e240867da9cd3..ff560ce1e84365ecbda54508ac558235b0155493 100644 (file)
@@ -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,
index fccdbf7c191719aafed0d6cf9df1064f6dfd05ec..99436771249878da230259ef659b2e78ec977255 100644 (file)
@@ -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;
 }
 
 /**
index 3d362da3092f4aeeb88dc1c0539062130670e48d..ecbe436e4ea2070bfed5223a1b6442446c0bb7c4 100644 (file)
@@ -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);