anv/image: Add a vk_format field

We've been trying to move away from anv_format for a while and this should
help with the transition.  There are cases (mostly in meta) where we need
the original format for the image and not the isl_format.  These will be
moved over to the new vk_format and everythign else will use the isl_format
from the particular anv_surface.
This commit is contained in:
Jason Ekstrand 2015-12-31 12:39:34 -08:00
parent 0d7614dce6
commit 3200a81a55
4 changed files with 13 additions and 8 deletions

View File

@ -205,6 +205,7 @@ anv_image_create(VkDevice _device,
memset(image, 0, sizeof(*image));
image->type = pCreateInfo->imageType;
image->extent = pCreateInfo->extent;
image->vk_format = pCreateInfo->format;
image->format = anv_format_for_vk_format(pCreateInfo->format);
image->levels = pCreateInfo->mipLevels;
image->array_size = pCreateInfo->arrayLayers;

View File

@ -858,7 +858,7 @@ void anv_CmdCopyImage(
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = srcImage,
.viewType = anv_meta_get_view_type(src_image),
.format = src_image->format->vk_format,
.format = src_image->vk_format,
.subresourceRange = {
.aspectMask = pRegions[r].srcSubresource.aspectMask,
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
@ -902,7 +902,7 @@ void anv_CmdCopyImage(
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = destImage,
.viewType = anv_meta_get_view_type(dest_image),
.format = dest_image->format->vk_format,
.format = dest_image->vk_format,
.subresourceRange = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = pRegions[r].dstSubresource.mipLevel,
@ -955,7 +955,7 @@ void anv_CmdBlitImage(
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = srcImage,
.viewType = anv_meta_get_view_type(src_image),
.format = src_image->format->vk_format,
.format = src_image->vk_format,
.subresourceRange = {
.aspectMask = pRegions[r].srcSubresource.aspectMask,
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
@ -989,7 +989,7 @@ void anv_CmdBlitImage(
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = destImage,
.viewType = anv_meta_get_view_type(dest_image),
.format = dest_image->format->vk_format,
.format = dest_image->vk_format,
.subresourceRange = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = pRegions[r].dstSubresource.mipLevel,
@ -1067,7 +1067,7 @@ void anv_CmdCopyBufferToImage(
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
ANV_FROM_HANDLE(anv_image, dest_image, destImage);
VkDevice vk_device = anv_device_to_handle(cmd_buffer->device);
const VkFormat orig_format = dest_image->format->vk_format;
const VkFormat orig_format = dest_image->vk_format;
struct anv_meta_saved_state saved_state;
meta_prepare_blit(cmd_buffer, &saved_state);
@ -1194,7 +1194,7 @@ void anv_CmdCopyImageToBuffer(
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = srcImage,
.viewType = anv_meta_get_view_type(src_image),
.format = src_image->format->vk_format,
.format = src_image->vk_format,
.subresourceRange = {
.aspectMask = pRegions[r].imageSubresource.aspectMask,
.baseMipLevel = pRegions[r].imageSubresource.mipLevel,
@ -1205,7 +1205,7 @@ void anv_CmdCopyImageToBuffer(
},
cmd_buffer);
VkFormat dest_format = src_image->format->vk_format;
VkFormat dest_format = src_image->vk_format;
if (dest_format == VK_FORMAT_S8_UINT) {
dest_format = VK_FORMAT_R8_UINT;
}

View File

@ -729,7 +729,7 @@ void anv_CmdClearColorImage(
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = _image,
.viewType = anv_meta_get_view_type(image),
.format = image->format->vk_format,
.format = image->vk_format,
.subresourceRange = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = pRanges[r].baseMipLevel + l,

View File

@ -1443,6 +1443,10 @@ struct anv_surface {
struct anv_image {
VkImageType type;
/* The original VkFormat provided by the client. This may not match any
* of the actual surface formats.
*/
VkFormat vk_format;
const struct anv_format *format;
VkExtent3D extent;
uint32_t levels;