From 6a579ded87a4192ed2f1a015ca8c6535d323ce1c Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Tue, 26 Jan 2016 18:53:21 -0800 Subject: [PATCH] anv: Add offset parameter to anv_image_view_init() This is the offset of the tile that contains the mip specified by isl_surf_get_image_intratile_offset_el(). Used to draw to/from the specified mip. --- src/vulkan/anv_image.c | 7 ++++--- src/vulkan/anv_meta.c | 20 ++++++++++---------- src/vulkan/anv_meta_clear.c | 2 +- src/vulkan/anv_private.h | 3 ++- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index 8b2003587ac..6c1c92d61c6 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -483,7 +483,8 @@ void anv_image_view_init(struct anv_image_view *iview, struct anv_device *device, const VkImageViewCreateInfo* pCreateInfo, - struct anv_cmd_buffer *cmd_buffer) + struct anv_cmd_buffer *cmd_buffer, + uint32_t offset) { ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image); const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange; @@ -513,7 +514,7 @@ anv_image_view_init(struct anv_image_view *iview, iview->image = image; iview->bo = image->bo; - iview->offset = image->offset + surface->offset; + iview->offset = image->offset + surface->offset + offset; iview->aspect_mask = pCreateInfo->subresourceRange.aspectMask; iview->vk_format = pCreateInfo->format; @@ -608,7 +609,7 @@ anv_CreateImageView(VkDevice _device, if (view == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - anv_image_view_init(view, device, pCreateInfo, NULL); + anv_image_view_init(view, device, pCreateInfo, NULL, 0); *pView = anv_image_view_to_handle(view); diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c index 0b0adfc224f..3faabc159c4 100644 --- a/src/vulkan/anv_meta.c +++ b/src/vulkan/anv_meta.c @@ -798,7 +798,7 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer, .layerCount = 1 }, }, - cmd_buffer); + cmd_buffer, 0); struct anv_image_view dest_iview; anv_image_view_init(&dest_iview, cmd_buffer->device, @@ -815,7 +815,7 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer, .layerCount = 1, }, }, - cmd_buffer); + cmd_buffer, 0); meta_emit_blit(cmd_buffer, anv_image_from_handle(src_image), @@ -1058,7 +1058,7 @@ void anv_CmdCopyImage( .layerCount = pRegions[r].dstSubresource.layerCount, }, }, - cmd_buffer); + cmd_buffer, 0); const VkOffset3D dest_offset = { .x = pRegions[r].dstOffset.x, @@ -1102,7 +1102,7 @@ void anv_CmdCopyImage( .layerCount = 1 }, }, - cmd_buffer); + cmd_buffer, 0); meta_emit_blit(cmd_buffer, src_image, &src_iview, @@ -1162,7 +1162,7 @@ void anv_CmdBlitImage( .layerCount = 1 }, }, - cmd_buffer); + cmd_buffer, 0); const VkOffset3D dest_offset = { .x = pRegions[r].dstOffsets[0].x, @@ -1213,7 +1213,7 @@ void anv_CmdBlitImage( .layerCount = 1 }, }, - cmd_buffer); + cmd_buffer, 0); meta_emit_blit(cmd_buffer, src_image, &src_iview, @@ -1326,7 +1326,7 @@ void anv_CmdCopyBufferToImage( .layerCount = 1, }, }, - cmd_buffer); + cmd_buffer, 0); uint32_t img_x = 0; uint32_t img_y = 0; @@ -1360,7 +1360,7 @@ void anv_CmdCopyBufferToImage( .layerCount = 1 }, }, - cmd_buffer); + cmd_buffer, img_o); const VkExtent3D img_extent_el = meta_region_extent_el(dest_image->vk_format, &pRegions[r].imageExtent); @@ -1440,7 +1440,7 @@ void anv_CmdCopyImageToBuffer( .layerCount = pRegions[r].imageSubresource.layerCount, }, }, - cmd_buffer); + cmd_buffer, 0); struct anv_image *dest_image = make_image_for_buffer(vk_device, destBuffer, buffer_format, @@ -1476,7 +1476,7 @@ void anv_CmdCopyImageToBuffer( .layerCount = 1 }, }, - cmd_buffer); + cmd_buffer, 0); meta_emit_blit(cmd_buffer, anv_image_from_handle(srcImage), diff --git a/src/vulkan/anv_meta_clear.c b/src/vulkan/anv_meta_clear.c index ac369e9f9be..da234fcbdf1 100644 --- a/src/vulkan/anv_meta_clear.c +++ b/src/vulkan/anv_meta_clear.c @@ -838,7 +838,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer, .layerCount = 1 }, }, - cmd_buffer); + cmd_buffer, 0); VkFramebuffer fb; anv_CreateFramebuffer(device_h, diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 79af4102e3f..a6f24b55dca 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -1609,7 +1609,8 @@ anv_image_get_surface_for_aspect_mask(struct anv_image *image, void anv_image_view_init(struct anv_image_view *view, struct anv_device *device, const VkImageViewCreateInfo* pCreateInfo, - struct anv_cmd_buffer *cmd_buffer); + struct anv_cmd_buffer *cmd_buffer, + uint32_t offset); void anv_fill_image_surface_state(struct anv_device *device, struct anv_state state, -- 2.30.2