[Mesa-dev] [PATCH] anv: fix bug when VK_REMAINING_ARRAY_LAYERS is used in vkCmdClearAttachments()

Samuel Iglesias Gonsálvez siglesias at igalia.com
Fri Dec 15 11:36:02 UTC 2017


Blorp was not supporting the use of the constant VK_REMAINING_ARRAY_LAYERS
(whose value is ~0) in the VkClearRect structure. If we receive it, we need
to calculate the layer count as the image layers count minus the base array
layer.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---
 src/intel/vulkan/anv_blorp.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index e244468e03..4ab4458246 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -989,10 +989,15 @@ clear_color_attachment(struct anv_cmd_buffer *cmd_buffer,
    for (uint32_t r = 0; r < rectCount; ++r) {
       const VkOffset2D offset = pRects[r].rect.offset;
       const VkExtent2D extent = pRects[r].rect.extent;
+      unsigned layer_count =
+         anv_get_layerCount(
+            cmd_buffer->state.framebuffer->attachments[att_idx]->image,
+            &pRects[r]);
+
       blorp_clear_attachments(batch, binding_table,
                               ISL_FORMAT_UNSUPPORTED, pass_att->samples,
                               pRects[r].baseArrayLayer,
-                              pRects[r].layerCount,
+                              layer_count,
                               offset.x, offset.y,
                               offset.x + extent.width, offset.y + extent.height,
                               true, clear_color, false, 0.0f, 0, 0);
@@ -1059,11 +1064,16 @@ clear_depth_stencil_attachment(struct anv_cmd_buffer *cmd_buffer,
    for (uint32_t r = 0; r < rectCount; ++r) {
       const VkOffset2D offset = pRects[r].rect.offset;
       const VkExtent2D extent = pRects[r].rect.extent;
+      unsigned layer_count =
+         anv_get_layerCount(
+            cmd_buffer->state.framebuffer->attachments[att_idx]->image,
+            &pRects[r]);
+
       VkClearDepthStencilValue value = attachment->clearValue.depthStencil;
       blorp_clear_attachments(batch, binding_table,
                               depth_format, pass_att->samples,
                               pRects[r].baseArrayLayer,
-                              pRects[r].layerCount,
+                              layer_count,
                               offset.x, offset.y,
                               offset.x + extent.width, offset.y + extent.height,
                               false, color_value,
-- 
2.14.1



More information about the mesa-dev mailing list