<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Seems reasonable.  Only one comment which you can feel free to ignore.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">On Fri, Jan 5, 2018 at 7:23 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Looks good to me too.<br>
<br>
Reviewed-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a><wbr>><br>
<br>
Thanks a lot!<br>
<br>
-<br>
Lionel<div class="HOEnZb"><div class="h5"><br>
<br>
On 05/01/18 09:19, Iago Toral wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Looks good to me, unless Jason or Lionel say otherwise:<br>
<br>
Reviewed-by: Iago Toral Quiroga <<a href="mailto:itoral@igalia.com" target="_blank">itoral@igalia.com</a>><br>
<br>
Iago<br>
<br>
On Thu, 2018-01-04 at 18:13 +0000, Alex Smith wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If we have a color attachment, but its writes are masked, this would<br>
have still returned true. This is inconsistent with how<br>
HasWriteableRT<br>
in 3DSTATE_PS_BLEND is set, which does take the mask into account.<br>
<br>
This could lead to PixelShaderHasUAV not being set in<br>
3DSTATE_PS_EXTRA<br>
if the fragment shader does use UAVs, meaning the fragment shader may<br>
not be invoked because HasWriteableRT is false. Specifically, this<br>
was<br>
seen to occur when the shader also enables early fragment tests: the<br>
fragment shader was not invoked despite passing depth/stencil.<br>
<br>
Fix by taking the color write mask into account in this function.<br>
This<br>
is consistent with how things are done on i965.<br>
<br>
Signed-off-by: Alex Smith <<a href="mailto:asmith@feralinteractive.com" target="_blank">asmith@feralinteractive.com</a>><br>
Cc: <a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop.<wbr>org</a><br>
---<br>
  src/intel/vulkan/genX_pipeli<wbr>ne.c | 27 ++++++++++++++++++---------<br>
  1 file changed, 18 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/genX_pipeli<wbr>ne.c<br>
b/src/intel/vulkan/genX_pipeli<wbr>ne.c<br>
index 0ae9ead587..cfc3bea426 100644<br>
--- a/src/intel/vulkan/genX_pipeli<wbr>ne.c<br>
+++ b/src/intel/vulkan/genX_pipeli<wbr>ne.c<br>
@@ -1330,7 +1330,8 @@ emit_3dstate_gs(struct anv_pipeline *pipeline)<br>
  }<br>
    static bool<br>
-has_color_buffer_write_enable<wbr>d(const struct anv_pipeline *pipeline)<br>
+has_color_buffer_write_enable<wbr>d(const struct anv_pipeline *pipeline,<br>
+                             <wbr>  const<br>
VkPipelineColorBlendStateCreat<wbr>eInfo *blend)<br>
  {<br>
     const struct anv_shader_bin *shader_bin =<br>
        pipeline->shaders[<wbr>MESA_SHADER_FRAGMENT];<br>
@@ -1339,10 +1340,15 @@ has_color_buffer_write_enabled<wbr>(const struct<br>
anv_pipeline *pipeline)<br>
       const struct anv_pipeline_bind_map *bind_map = &shader_bin-<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
bind_map;<br>
</blockquote>
     for (int i = 0; i < bind_map->surface_count; i++) {<br>
-      if (bind_map->surface_to_descript<wbr>or[i].set !=<br>
-          ANV_DESCRIPTOR_SET_<wbr>COLOR_ATTACHMENTS)<br>
+      struct anv_pipeline_binding *binding = &bind_map-<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
surface_to_descriptor[i];<br>
</blockquote>
+<br>
+      if (binding->set != ANV_DESCRIPTOR_SET_COLOR_ATTAC<wbr>HMENTS)<br>
           continue;<br>
-      if (bind_map->surface_to_descript<wbr>or[i].index != UINT32_MAX)<br>
+<br>
+      const VkPipelineColorBlendAttachment<wbr>State *a =<br>
+         &blend->pAttachments<wbr>[binding->index];<br>
+<br>
+      if (binding->index != UINT32_MAX && a->colorWriteMask != 0)<br></blockquote></blockquote></div></div></blockquote><div><br></div><div>At some point, we really should add a new #define for this and stop using UINT32_MAX.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
           return true;<br>
     }<br>
  @@ -1351,6 +1357,7 @@ has_color_buffer_write_enabled<wbr>(const struct<br>
anv_pipeline *pipeline)<br>
    static void<br>
  emit_3dstate_wm(struct anv_pipeline *pipeline, struct anv_subpass<br>
*subpass,<br>
+                const VkPipelineColorBlendStateCreat<wbr>eInfo *blend,<br>
                  const VkPipelineMultisampleStateCrea<wbr>teInfo<br>
*multisample)<br>
  {<br>
     const struct brw_wm_prog_data *wm_prog_data =<br>
get_wm_prog_data(pipeline);<br>
@@ -1395,7 +1402,7 @@ emit_3dstate_wm(struct anv_pipeline *pipeline,<br>
struct anv_subpass *subpass,<br>
           if (wm.PixelShaderComputedDepthMo<wbr>de != PSCDEPTH_OFF ||<br>
               wm_prog_data->h<wbr>as_side_effects ||<br>
               wm.PixelShaderK<wbr>illsPixel ||<br>
-             has_color_buffer<wbr>_write_enabled(pipeline))<br>
+             has_color_buffer<wbr>_write_enabled(pipeline, blend))<br>
              wm.ThreadDispatc<wbr>hEnable = true;<br>
             if (samples > 1) {<br>
@@ -1520,7 +1527,8 @@ emit_3dstate_ps(struct anv_pipeline *pipeline,<br>
  #if GEN_GEN >= 8<br>
  static void<br>
  emit_3dstate_ps_extra(struct anv_pipeline *pipeline,<br>
-                      struct anv_subpass *subpass)<br>
+                      struct anv_subpass *subpass,<br>
+                      const VkPipelineColorBlendStateCreat<wbr>eInfo<br>
*blend)<br>
  {<br>
     const struct brw_wm_prog_data *wm_prog_data =<br>
get_wm_prog_data(pipeline);<br>
  @@ -1575,7 +1583,7 @@ emit_3dstate_ps_extra(struct anv_pipeline<br>
*pipeline,<br>
         * attachments, we need to force-enable here.<br>
         */<br>
        if ((wm_prog_data->has_side_effec<wbr>ts || wm_prog_data-<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
uses_kill) &&<br>
</blockquote>
-          !has_color_buffer_w<wbr>rite_enabled(pipeline))<br>
+          !has_color_buffer_w<wbr>rite_enabled(pipeline, blend))<br>
           ps.<wbr>PixelShaderHasUAV = true;<br>
    #if GEN_GEN >= 9<br>
@@ -1705,10 +1713,11 @@ genX(graphics_pipeline_create)<wbr>(<br>
     emit_3dstate_hs_te_ds(pip<wbr>eline, pCreateInfo->pTessellationStat<wbr>e);<br>
     emit_3dstate_gs(pipeline)<wbr>;<br>
     emit_3dstate_sbe(<wbr>pipeline);<br>
-   emit_3dstate_wm(pipeline, subpass, pCreateInfo-<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
pMultisampleState);<br>
</blockquote>
+   emit_3dstate_wm(pipeline, subpass, pCreateInfo->pColorBlendState,<br>
+                   pCreateInf<wbr>o->pMultisampleState);<br>
     emit_3dstate_ps(pipeline, pCreateInfo->pColorBlendState)<wbr>;<br>
  #if GEN_GEN >= 8<br>
-   emit_3dstate_ps_extra(pipe<wbr>line, subpass);<br>
+   emit_3dstate_ps_extra(pipe<wbr>line, subpass, pCreateInfo-<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
pColorBlendState);<br>
</blockquote>
     emit_3dstate_vf_topology(<wbr>pipeline);<br>
  #endif<br>
     emit_3dstate_vf_statistic<wbr>s(pipeline);<br>
</blockquote>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote>
<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div></div>