Mesa (17.2): radv: Fix multi-layer blits.
Andres Gomez
tanty at kemper.freedesktop.org
Wed Dec 20 23:30:50 UTC 2017
Module: Mesa
Branch: 17.2
Commit: a8ee7222629736ed553030a5bd1c33b37ba52157
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8ee7222629736ed553030a5bd1c33b37ba52157
Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date: Sun Dec 17 23:53:37 2017 +0100
radv: Fix multi-layer blits.
We did not set the layer correctly for the dst, as we would keep
using the base layer. Same for the source image.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102710
CC: <mesa-stable at lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied at redhat.com>
(cherry picked from commit b42e106d4dfa61a6351b076741c5458b5677f332)
---
src/amd/vulkan/radv_meta_blit.c | 49 ++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/src/amd/vulkan/radv_meta_blit.c b/src/amd/vulkan/radv_meta_blit.c
index 2c1a13228d..18be99c148 100644
--- a/src/amd/vulkan/radv_meta_blit.c
+++ b/src/amd/vulkan/radv_meta_blit.c
@@ -269,8 +269,8 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer,
VkOffset3D src_offset_1,
struct radv_image *dest_image,
struct radv_image_view *dest_iview,
- VkOffset3D dest_offset_0,
- VkOffset3D dest_offset_1,
+ VkOffset2D dest_offset_0,
+ VkOffset2D dest_offset_1,
VkRect2D dest_box,
VkFilter blit_filter)
{
@@ -517,21 +517,6 @@ void radv_CmdBlitImage(
for (unsigned r = 0; r < regionCount; r++) {
const VkImageSubresourceLayers *src_res = &pRegions[r].srcSubresource;
const VkImageSubresourceLayers *dst_res = &pRegions[r].dstSubresource;
- struct radv_image_view src_iview;
- radv_image_view_init(&src_iview, cmd_buffer->device,
- &(VkImageViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
- .image = srcImage,
- .viewType = radv_meta_get_view_type(src_image),
- .format = src_image->vk_format,
- .subresourceRange = {
- .aspectMask = src_res->aspectMask,
- .baseMipLevel = src_res->mipLevel,
- .levelCount = 1,
- .baseArrayLayer = src_res->baseArrayLayer,
- .layerCount = 1
- },
- });
unsigned dst_start, dst_end;
if (dest_image->type == VK_IMAGE_TYPE_3D) {
@@ -578,18 +563,17 @@ void radv_CmdBlitImage(
dest_box.extent.width = abs(dst_x1 - dst_x0);
dest_box.extent.height = abs(dst_y1 - dst_y0);
- struct radv_image_view dest_iview;
const unsigned num_layers = dst_end - dst_start;
for (unsigned i = 0; i < num_layers; i++) {
- const VkOffset3D dest_offset_0 = {
+ struct radv_image_view dest_iview, src_iview;
+
+ const VkOffset2D dest_offset_0 = {
.x = dst_x0,
.y = dst_y0,
- .z = dst_start + i ,
};
- const VkOffset3D dest_offset_1 = {
+ const VkOffset2D dest_offset_1 = {
.x = dst_x1,
.y = dst_y1,
- .z = dst_start + i ,
};
VkOffset3D src_offset_0 = {
.x = src_x0,
@@ -601,9 +585,10 @@ void radv_CmdBlitImage(
.y = src_y1,
.z = src_start + i * src_z_step,
};
- const uint32_t dest_array_slice =
- radv_meta_get_iview_layer(dest_image, dst_res,
- &dest_offset_0);
+ const uint32_t dest_array_slice = dst_start + i;
+
+ /* 3D images have just 1 layer */
+ const uint32_t src_array_slice = src_image->type == VK_IMAGE_TYPE_3D ? 0 : src_start + i;
radv_image_view_init(&dest_iview, cmd_buffer->device,
&(VkImageViewCreateInfo) {
@@ -619,6 +604,20 @@ void radv_CmdBlitImage(
.layerCount = 1
},
});
+ radv_image_view_init(&src_iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
+ .image = srcImage,
+ .viewType = radv_meta_get_view_type(src_image),
+ .format = src_image->vk_format,
+ .subresourceRange = {
+ .aspectMask = src_res->aspectMask,
+ .baseMipLevel = src_res->mipLevel,
+ .levelCount = 1,
+ .baseArrayLayer = src_array_slice,
+ .layerCount = 1
+ },
+ });
meta_emit_blit(cmd_buffer,
src_image, &src_iview,
src_offset_0, src_offset_1,
More information about the mesa-commit
mailing list