summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_meta.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2015-10-06 19:11:58 -0700
committerChad Versace <[email protected]>2015-10-06 21:22:18 -0700
commit24de3d49eab3c8fd8aad3f4aeb8aac0154690374 (patch)
tree1b83091b6e993798b226b4ad045d0c95951ad7e6 /src/vulkan/anv_meta.c
parent37bf120930aa9e3ccf455efc633f2edbdec9dfc1 (diff)
vk: Embed two surface states in anv_image_view
This prepares for merging VkAttachmentView into VkImageView. The two surface states are: anv_image_view::color_rt_surface_state: RENDER_SURFACE_STATE when using image as a color render target. anv_image_view::nonrt_surface_state; RENDER_SURFACE_STATE when using image as a non render target. No Crucible regressions.
Diffstat (limited to 'src/vulkan/anv_meta.c')
-rw-r--r--src/vulkan/anv_meta.c138
1 files changed, 102 insertions, 36 deletions
diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c
index d69863b8375..c7c50ef87a9 100644
--- a/src/vulkan/anv_meta.c
+++ b/src/vulkan/anv_meta.c
@@ -1029,14 +1029,25 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
cmd_buffer);
struct anv_image_view dest_iview;
- anv_color_attachment_view_init(&dest_iview, cmd_buffer->device,
- &(VkAttachmentViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
+ anv_image_view_init(&dest_iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = dest_image,
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
.format = copy_format,
- .mipLevel = 0,
- .baseArraySlice = 0,
- .arraySize = 1,
+ .channels = {
+ .r = VK_CHANNEL_SWIZZLE_R,
+ .g = VK_CHANNEL_SWIZZLE_G,
+ .b = VK_CHANNEL_SWIZZLE_B,
+ .a = VK_CHANNEL_SWIZZLE_A,
+ },
+ .subresourceRange = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = 0,
+ .mipLevels = 1,
+ .baseArrayLayer = 0,
+ .arraySize = 1,
+ },
},
cmd_buffer);
@@ -1194,14 +1205,25 @@ void anv_CmdCopyImage(
anv_finishme("FINISHME: copy multiple depth layers");
struct anv_image_view dest_iview;
- anv_color_attachment_view_init(&dest_iview, cmd_buffer->device,
- &(VkAttachmentViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
+ anv_image_view_init(&dest_iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = destImage,
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
.format = dest_image->format->vk_format,
- .mipLevel = pRegions[r].destSubresource.mipLevel,
- .baseArraySlice = dest_array_slice,
- .arraySize = 1,
+ .channels = {
+ VK_CHANNEL_SWIZZLE_R,
+ VK_CHANNEL_SWIZZLE_G,
+ VK_CHANNEL_SWIZZLE_B,
+ VK_CHANNEL_SWIZZLE_A
+ },
+ .subresourceRange = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = pRegions[r].destSubresource.mipLevel,
+ .mipLevels = 1,
+ .baseArrayLayer = dest_array_slice,
+ .arraySize = 1
+ },
},
cmd_buffer);
@@ -1283,14 +1305,25 @@ void anv_CmdBlitImage(
anv_finishme("FINISHME: copy multiple depth layers");
struct anv_image_view dest_iview;
- anv_color_attachment_view_init(&dest_iview, cmd_buffer->device,
- &(VkAttachmentViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
+ anv_image_view_init(&dest_iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = destImage,
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
.format = dest_image->format->vk_format,
- .mipLevel = pRegions[r].destSubresource.mipLevel,
- .baseArraySlice = dest_array_slice,
- .arraySize = 1,
+ .channels = {
+ VK_CHANNEL_SWIZZLE_R,
+ VK_CHANNEL_SWIZZLE_G,
+ VK_CHANNEL_SWIZZLE_B,
+ VK_CHANNEL_SWIZZLE_A
+ },
+ .subresourceRange = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = pRegions[r].destSubresource.mipLevel,
+ .mipLevels = 1,
+ .baseArrayLayer = dest_array_slice,
+ .arraySize = 1
+ },
},
cmd_buffer);
@@ -1413,14 +1446,25 @@ void anv_CmdCopyBufferToImage(
anv_finishme("FINISHME: copy multiple depth layers");
struct anv_image_view dest_iview;
- anv_color_attachment_view_init(&dest_iview, cmd_buffer->device,
- &(VkAttachmentViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
+ anv_image_view_init(&dest_iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = anv_image_to_handle(dest_image),
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
.format = proxy_format,
- .mipLevel = pRegions[r].imageSubresource.mipLevel,
- .baseArraySlice = dest_array_slice,
- .arraySize = 1,
+ .channels = {
+ VK_CHANNEL_SWIZZLE_R,
+ VK_CHANNEL_SWIZZLE_G,
+ VK_CHANNEL_SWIZZLE_B,
+ VK_CHANNEL_SWIZZLE_A
+ },
+ .subresourceRange = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = pRegions[r].imageSubresource.mipLevel,
+ .mipLevels = 1,
+ .baseArrayLayer = dest_array_slice,
+ .arraySize = 1
+ },
},
cmd_buffer);
@@ -1497,14 +1541,25 @@ void anv_CmdCopyImageToBuffer(
dest_format, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &pRegions[r]);
struct anv_image_view dest_iview;
- anv_color_attachment_view_init(&dest_iview, cmd_buffer->device,
- &(VkAttachmentViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
+ anv_image_view_init(&dest_iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = destImage,
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
.format = dest_format,
- .mipLevel = 0,
- .baseArraySlice = 0,
- .arraySize = 1,
+ .channels = {
+ VK_CHANNEL_SWIZZLE_R,
+ VK_CHANNEL_SWIZZLE_G,
+ VK_CHANNEL_SWIZZLE_B,
+ VK_CHANNEL_SWIZZLE_A
+ },
+ .subresourceRange = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = 0,
+ .mipLevels = 1,
+ .baseArrayLayer = 0,
+ .arraySize = 1
+ },
},
cmd_buffer);
@@ -1562,14 +1617,25 @@ void anv_CmdClearColorImage(
for (uint32_t l = 0; l < pRanges[r].mipLevels; l++) {
for (uint32_t s = 0; s < pRanges[r].arraySize; s++) {
struct anv_image_view iview;
- anv_color_attachment_view_init(&iview, cmd_buffer->device,
- &(VkAttachmentViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
+ anv_image_view_init(&iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = _image,
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
.format = image->format->vk_format,
- .mipLevel = pRanges[r].baseMipLevel + l,
- .baseArraySlice = pRanges[r].baseArrayLayer + s,
- .arraySize = 1,
+ .channels = {
+ VK_CHANNEL_SWIZZLE_R,
+ VK_CHANNEL_SWIZZLE_G,
+ VK_CHANNEL_SWIZZLE_B,
+ VK_CHANNEL_SWIZZLE_A
+ },
+ .subresourceRange = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = pRanges[r].baseMipLevel + l,
+ .mipLevels = 1,
+ .baseArrayLayer = pRanges[r].baseArrayLayer + s,
+ .arraySize = 1
+ },
},
cmd_buffer);