From 9319ef96fd5c2489754eae1b058e4087d7259341 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 24 Mar 2017 16:20:35 -0700 Subject: [PATCH] anv/blorp: Use anv_get_layerCount everywhere Reviewed-by: Lionel Landwerlin Cc: "13.0 17.0" --- src/intel/vulkan/anv_blorp.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 16f1692ff53..72a468a744a 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -233,7 +233,8 @@ void anv_CmdCopyImage( layer_count = pRegions[r].extent.depth; } else { dst_base_layer = pRegions[r].dstSubresource.baseArrayLayer; - layer_count = pRegions[r].dstSubresource.layerCount; + layer_count = + anv_get_layerCount(dst_image, &pRegions[r].dstSubresource); } unsigned src_base_layer; @@ -241,7 +242,8 @@ void anv_CmdCopyImage( src_base_layer = pRegions[r].srcOffset.z; } else { src_base_layer = pRegions[r].srcSubresource.baseArrayLayer; - assert(pRegions[r].srcSubresource.layerCount == layer_count); + assert(layer_count == + anv_get_layerCount(src_image, &pRegions[r].srcSubresource)); } assert(pRegions[r].srcSubresource.aspectMask == @@ -313,7 +315,8 @@ copy_buffer_to_image(struct anv_cmd_buffer *cmd_buffer, anv_sanitize_image_extent(anv_image->type, pRegions[r].imageExtent); if (anv_image->type != VK_IMAGE_TYPE_3D) { image.offset.z = pRegions[r].imageSubresource.baseArrayLayer; - extent.depth = pRegions[r].imageSubresource.layerCount; + extent.depth = + anv_get_layerCount(anv_image, &pRegions[r].imageSubresource); } const enum isl_format buffer_format = @@ -467,7 +470,7 @@ void anv_CmdBlitImage( dst_end = pRegions[r].dstOffsets[1].z; } else { dst_start = dst_res->baseArrayLayer; - dst_end = dst_start + dst_res->layerCount; + dst_end = dst_start + anv_get_layerCount(dst_image, dst_res); } unsigned src_start, src_end; @@ -477,7 +480,7 @@ void anv_CmdBlitImage( src_end = pRegions[r].srcOffsets[1].z; } else { src_start = src_res->baseArrayLayer; - src_end = src_start + src_res->layerCount; + src_end = src_start + anv_get_layerCount(src_image, src_res); } bool flip_z = flip_coords(&src_start, &src_end, &dst_start, &dst_end); @@ -1407,10 +1410,11 @@ void anv_CmdResolveImage( for (uint32_t r = 0; r < regionCount; r++) { assert(pRegions[r].srcSubresource.aspectMask == pRegions[r].dstSubresource.aspectMask); - assert(pRegions[r].srcSubresource.layerCount == - pRegions[r].dstSubresource.layerCount); + assert(anv_get_layerCount(src_image, &pRegions[r].srcSubresource) == + anv_get_layerCount(dst_image, &pRegions[r].dstSubresource)); - const uint32_t layer_count = pRegions[r].dstSubresource.layerCount; + const uint32_t layer_count = + anv_get_layerCount(dst_image, &pRegions[r].dstSubresource); for (uint32_t layer = 0; layer < layer_count; layer++) { resolve_image(&batch, -- 2.30.2