anv: Add a devinfo argument to the get_format functions

This commit is contained in:
Jason Ekstrand 2016-05-16 10:25:54 -07:00
parent 100db3d31c
commit 45c93384e5
5 changed files with 20 additions and 15 deletions

View 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,

View 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;

View 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,

View 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;
}
/**

View 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);