diff options
author | Iago Toral Quiroga <[email protected]> | 2017-05-18 08:23:38 +0200 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2017-05-18 11:53:25 +0200 |
commit | 2322ddf5480a0e07246fc4aefe4fdc1411b555a7 (patch) | |
tree | 7d69808e8979f44f0e097c5d1b5340cff4b4b939 /src/intel/vulkan/anv_blorp.c | |
parent | 70215a23c656531dfd1650054ea497a860d2ba39 (diff) |
anv: fix multiview for clear commands
According to the VK_KHX_multiview spec:
"Multiview causes all drawing and clear commands in the subpass to
behave as if they were broadcast to each view, where each view is
represented by one layer of the framebuffer attachments."
This adds support for multiview clears, which were missing in the
initial implementation.
v2 (Jason):
- split multiview from regular case
- Use for_each_bit() macro
Fixes new CTS multiview tests:
dEQP-VK.multiview.clear_attachments.*
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_blorp.c')
-rw-r--r-- | src/intel/vulkan/anv_blorp.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 7b6944ad531..974ea310cfa 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -999,6 +999,25 @@ clear_color_attachment(struct anv_cmd_buffer *cmd_buffer, union isl_color_value clear_color = vk_to_isl_color(attachment->clearValue.color); + /* If multiview is enabled we ignore baseArrayLayer and layerCount */ + if (subpass->view_mask) { + uint32_t view_idx; + for_each_bit(view_idx, subpass->view_mask) { + for (uint32_t r = 0; r < rectCount; ++r) { + const VkOffset2D offset = pRects[r].rect.offset; + const VkExtent2D extent = pRects[r].rect.extent; + blorp_clear_attachments(batch, binding_table, + ISL_FORMAT_UNSUPPORTED, pass_att->samples, + view_idx, 1, + offset.x, offset.y, + offset.x + extent.width, + offset.y + extent.height, + true, clear_color, false, 0.0f, 0, 0); + } + } + return; + } + for (uint32_t r = 0; r < rectCount; ++r) { const VkOffset2D offset = pRects[r].rect.offset; const VkExtent2D extent = pRects[r].rect.extent; @@ -1047,6 +1066,28 @@ clear_depth_stencil_attachment(struct anv_cmd_buffer *cmd_buffer, if (result != VK_SUCCESS) return; + /* If multiview is enabled we ignore baseArrayLayer and layerCount */ + if (subpass->view_mask) { + uint32_t view_idx; + for_each_bit(view_idx, subpass->view_mask) { + for (uint32_t r = 0; r < rectCount; ++r) { + const VkOffset2D offset = pRects[r].rect.offset; + const VkExtent2D extent = pRects[r].rect.extent; + VkClearDepthStencilValue value = attachment->clearValue.depthStencil; + blorp_clear_attachments(batch, binding_table, + depth_format, pass_att->samples, + view_idx, 1, + offset.x, offset.y, + offset.x + extent.width, + offset.y + extent.height, + false, color_value, + clear_depth, value.depth, + clear_stencil ? 0xff : 0, value.stencil); + } + } + return; + } + for (uint32_t r = 0; r < rectCount; ++r) { const VkOffset2D offset = pRects[r].rect.offset; const VkExtent2D extent = pRects[r].rect.extent; |