[Mesa-dev] [PATCH 07/11] radv: Add multiview clears.

Dave Airlie airlied at gmail.com
Thu Aug 24 00:35:27 UTC 2017


On 24 August 2017 at 06:51, Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl> wrote:
> ---
>  src/amd/vulkan/radv_cmd_buffer.c |  1 +
>  src/amd/vulkan/radv_meta_clear.c | 65 ++++++++++++++++++++++++++++------------
>  src/amd/vulkan/radv_private.h    |  1 +
>  3 files changed, 48 insertions(+), 19 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
> index 94453094eb6..ed11a4aa35e 100644
> --- a/src/amd/vulkan/radv_cmd_buffer.c
> +++ b/src/amd/vulkan/radv_cmd_buffer.c
> @@ -1867,6 +1867,7 @@ radv_cmd_state_setup_attachments(struct radv_cmd_buffer *cmd_buffer,
>                 }
>
>                 state->attachments[i].pending_clear_aspects = clear_aspects;
> +               state->attachments[i].cleared_views = 0;
>                 if (clear_aspects && info) {
>                         assert(info->clearValueCount > i);
>                         state->attachments[i].clear_value = info->pClearValues[i];
> diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c
> index af76a517aaf..ea777d9979c 100644
> --- a/src/amd/vulkan/radv_meta_clear.c
> +++ b/src/amd/vulkan/radv_meta_clear.c
> @@ -337,7 +337,8 @@ radv_device_finish_meta_clear_state(struct radv_device *device)
>  static void
>  emit_color_clear(struct radv_cmd_buffer *cmd_buffer,
>                   const VkClearAttachment *clear_att,
> -                 const VkClearRect *clear_rect)
> +                 const VkClearRect *clear_rect,
> +                 uint32_t view_mask)
>  {
>         struct radv_device *device = cmd_buffer->device;
>         const struct radv_subpass *subpass = cmd_buffer->state.subpass;
> @@ -400,7 +401,14 @@ emit_color_clear(struct radv_cmd_buffer *cmd_buffer,
>
>         radv_CmdSetScissor(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1, &clear_rect->rect);
>
> -       radv_CmdDraw(cmd_buffer_h, 3, clear_rect->layerCount, 0, clear_rect->baseArrayLayer);
> +       if (view_mask) {
> +               for (unsigned i = 0; (1u << i) <= view_mask; ++i)
> +                       if ((1u << i) & view_mask) {

for_each_bit?

Dave.


More information about the mesa-dev mailing list