[Mesa-dev] [PATCH] anv: ignore pColorBlendState if all color attachments of the subpass are unused

Jason Ekstrand jason at jlekstrand.net
Tue May 8 15:12:50 UTC 2018


On Mon, May 7, 2018 at 11:42 PM, Samuel Iglesias Gonsálvez <
siglesias at igalia.com> wrote:

> On 07/05/18 16:46, Jason Ekstrand wrote:
>
> Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
>
>
> Thanks.
>
> Have you audited to ensure that we don't actually use it in this case?
>
>
> I checked its usage in the driver. There is no problem except in one call
> to has_color_buffer_write_enable() that could be problematic. If you
> agree, I will add this hunk to this patch to avoid any problem:
>
> diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_
> pipeline.c
> index d3af9304ba3..6016d257584 100644
> --- a/src/intel/vulkan/genX_pipeline.c
> +++ b/src/intel/vulkan/genX_pipeline.c
> @@ -1361,7 +1361,7 @@ has_color_buffer_write_enabled(const struct
> anv_pipeline *pipeline,
>        if (binding->index == UINT32_MAX)
>           continue;
>
> -      if (blend->pAttachments[binding->index].colorWriteMask != 0)
> +      if (blend && blend->pAttachments[binding->index].colorWriteMask !=
> 0)
>           return true;
>     }
>
> What do you think?
>

Sounds good.

--Jason


> Sam
>
>
>
> On Mon, May 7, 2018 at 1:01 AM, Samuel Iglesias Gonsálvez <
> siglesias at igalia.com> wrote:
>
>> According to Vulkan spec:
>>
>>   "pColorBlendState is a pointer to an instance of the
>>    VkPipelineColorBlendStateCreateInfo structure, and is ignored if the
>>    pipeline has rasterization disabled or if the subpass of the render
>> pass the
>>    pipeline is created against does not use any color attachments."
>>
>> Fixes tests from CL#2505:
>>
>>    dEQP-VK.renderpass.*.simple.color_unused_omit_blend_state
>>
>> Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
>> ---
>>  src/intel/vulkan/anv_pipeline.c | 14 ++++++++++++--
>>  1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/intel/vulkan/anv_pipeline.c
>> b/src/intel/vulkan/anv_pipeline.c
>> index 87788de10a5..8f30136b100 100644
>> --- a/src/intel/vulkan/anv_pipeline.c
>> +++ b/src/intel/vulkan/anv_pipeline.c
>> @@ -1247,8 +1247,18 @@ anv_pipeline_validate_create_info(const
>> VkGraphicsPipelineCreateInfo *info)
>>        if (subpass && subpass->depth_stencil_attachment.attachment !=
>> VK_ATTACHMENT_UNUSED)
>>           assert(info->pDepthStencilState);
>>
>> -      if (subpass && subpass->color_count > 0)
>> -         assert(info->pColorBlendState);
>> +      if (subpass && subpass->color_count > 0) {
>> +         bool all_color_unused = true;
>> +         for (int i = 0; i < subpass->color_count; i++) {
>> +            if (subpass->color_attachments[i].attachment !=
>> VK_ATTACHMENT_UNUSED)
>> +               all_color_unused = false;
>> +         }
>> +         /* pColorBlendState is ignored if the pipeline has rasterization
>> +          * disabled or if the subpass of the render pass the pipeline is
>> +          * created against does not use any color attachments.
>> +          */
>> +         assert(info->pColorBlendState || all_color_unused);
>> +      }
>>     }
>>
>>     for (uint32_t i = 0; i < info->stageCount; ++i) {
>> --
>> 2.17.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180508/562a81fd/attachment.html>


More information about the mesa-dev mailing list