<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Jul 5, 2018 at 6:34 PM Caio Marcelo de Oliveira Filho <<a href="mailto:caio.oliveira@intel.com">caio.oliveira@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Jun 27, 2018 at 07:00:56PM -0700, Jason Ekstrand wrote:<br>
> The back-end compiler emits the number of color writes specified by<br>
> wm_prog_key::nr_color_regions regardless of what nir_store_outputs we<br>
> have.  Once we've gone through and figured out which render targets<br>
> actually exist and are written by the shader, we should restrict the key<br>
> to avoid extra RT write messages.<br>
> ---<br>
>  src/intel/vulkan/anv_pipeline.c | 5 +++++<br>
>  1 file changed, 5 insertions(+)<br>
> <br>
> diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c<br>
> index 523202cf3d9..6a27d305dbc 100644<br>
> --- a/src/intel/vulkan/anv_pipeline.c<br>
> +++ b/src/intel/vulkan/anv_pipeline.c<br>
> @@ -965,6 +965,11 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline,<br>
>           var->data.location = rt_to_bindings[rt] + FRAG_RESULT_DATA0;<br>
>        }<br>
>  <br>
> +      /* Now that we've determined the actual number of render targets, adjust<br>
> +       * the key accordingly.<br>
> +       */<br>
> +      key.nr_color_regions = num_rts;<br>
> +<br>
<br>
Question: earlier in the code we call <br>
<br>
   populate_wm_prog_key(pipeline, info, &key);<br>
<br>
which does<br>
<br>
   key->nr_color_regions = pipeline->subpass->color_count;<br>
<br>
   key->replicate_alpha = key->nr_color_regions > 1 &&<br>
                          info->pMultisampleState &&<br>
                          info->pMultisampleState->alphaToCoverageEnable;<br>
<br>
so key->replicate_alpha is calculated based on the old value. Should<br>
this be (re)calculated using the new value?<br></blockquote><div><br></div><div>We could but it would have no effect.  100% of the uses of replicate_alpha in the back-end have it ANDed with inst->target > 0.</div><div><br></div><div>--Jason<br></div></div></div>