From: Jason Ekstrand Date: Mon, 16 May 2016 17:25:54 +0000 (-0700) Subject: anv: Add a devinfo argument to the get_format functions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=45c93384e519aefba1d28388955b2638f4d26ea3;p=mesa.git anv: Add a devinfo argument to the get_format functions --- diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 233abc1882e..bd8d11fb2b2 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 f517aa61f58..208e3779c78 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 c509c8fa1c0..ff560ce1e84 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 fccdbf7c191..99436771249 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 3d362da3092..ecbe436e4ea 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);