[Mesa-dev] [PATCH 07/23] anv: Change render_pass_attachment.format to a VkFormat

Nanley Chery nanleychery at gmail.com
Tue May 17 00:38:48 UTC 2016


On Mon, May 16, 2016 at 12:08:12PM -0700, Jason Ekstrand wrote:
> ---
>  src/intel/vulkan/anv_cmd_buffer.c | 9 ++++++---
>  src/intel/vulkan/anv_pass.c       | 2 +-
>  src/intel/vulkan/anv_private.h    | 2 +-
>  3 files changed, 8 insertions(+), 5 deletions(-)

With respect to the commit title, the syntax I've seen for mentioning a
structure member is structure_name::field_name.

Either way,
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>

- Nanley

> 
> diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
> index 77f4283..bba24e8 100644
> --- a/src/intel/vulkan/anv_cmd_buffer.c
> +++ b/src/intel/vulkan/anv_cmd_buffer.c
> @@ -29,6 +29,8 @@
>  
>  #include "anv_private.h"
>  
> +#include "vk_format_info.h"
> +
>  /** \file anv_cmd_buffer.c
>   *
>   * This file contains all of the stuff for emitting commands into a command
> @@ -168,20 +170,21 @@ anv_cmd_state_setup_attachments(struct anv_cmd_buffer *cmd_buffer,
>  
>     for (uint32_t i = 0; i < pass->attachment_count; ++i) {
>        struct anv_render_pass_attachment *att = &pass->attachments[i];
> +      VkImageAspectFlags att_aspects = vk_format_aspects(att->format);
>        VkImageAspectFlags clear_aspects = 0;
>  
> -      if (anv_format_is_color(att->format)) {
> +      if (att_aspects == VK_IMAGE_ASPECT_COLOR_BIT) {
>           /* color attachment */
>           if (att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
>              clear_aspects |= VK_IMAGE_ASPECT_COLOR_BIT;
>           }
>        } else {
>           /* depthstencil attachment */
> -         if (att->format->has_depth &&
> +         if ((att_aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&
>               att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
>              clear_aspects |= VK_IMAGE_ASPECT_DEPTH_BIT;
>           }
> -         if (att->format->has_stencil &&
> +         if ((att_aspects & VK_IMAGE_ASPECT_STENCIL_BIT) &&
>               att->stencil_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
>              clear_aspects |= VK_IMAGE_ASPECT_STENCIL_BIT;
>           }
> diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c
> index d07e9fe..b740754 100644
> --- a/src/intel/vulkan/anv_pass.c
> +++ b/src/intel/vulkan/anv_pass.c
> @@ -57,7 +57,7 @@ VkResult anv_CreateRenderPass(
>     for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
>        struct anv_render_pass_attachment *att = &pass->attachments[i];
>  
> -      att->format = anv_format_for_vk_format(pCreateInfo->pAttachments[i].format);
> +      att->format = pCreateInfo->pAttachments[i].format;
>        att->samples = pCreateInfo->pAttachments[i].samples;
>        att->load_op = pCreateInfo->pAttachments[i].loadOp;
>        att->stencil_load_op = pCreateInfo->pAttachments[i].stencilLoadOp;
> diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
> index c3b31e6..6284be9 100644
> --- a/src/intel/vulkan/anv_private.h
> +++ b/src/intel/vulkan/anv_private.h
> @@ -1751,7 +1751,7 @@ struct anv_subpass {
>  };
>  
>  struct anv_render_pass_attachment {
> -   const struct anv_format                      *format;
> +   VkFormat                                     format;
>     uint32_t                                     samples;
>     VkAttachmentLoadOp                           load_op;
>     VkAttachmentLoadOp                           stencil_load_op;
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list