[Mesa-dev] [PATCH 2/2] i965: Set ForceZeroRTAIndexEnable based on slots_valid

Jason Ekstrand jason at jlekstrand.net
Sat Oct 27 21:34:42 UTC 2018


Instead of setting it based on the number of layers in the framebuffer,
disable it whenever the shader does not explicitly write the value.
Otherwise, if the shader doesn't write the value but you do have a
layered framebuffer, we may end up with a garbage layer and write off
into the ether.

https://bugs.freedesktop.org/show_bug.cgi?id=108571
Cc: mesa-stable at lists.freedesktop.org
---
 src/mesa/drivers/dri/i965/genX_state_upload.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 56fa5969725..d4915e86e9b 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -1458,7 +1458,6 @@ genX(upload_clip_state)(struct brw_context *brw)
    struct brw_wm_prog_data *wm_prog_data =
       brw_wm_prog_data(brw->wm.base.prog_data);
 
-#if GEN_GEN < 8
    /* BRW_NEW_VS_PROG_DATA | BRW_NEW_TES_PROG_DATA | BRW_NEW_GS_PROG_DATA */
    const struct brw_vue_prog_data *vue_prog_data;
    if (brw->gs.base.prog_data)
@@ -1467,7 +1466,6 @@ genX(upload_clip_state)(struct brw_context *brw)
       vue_prog_data = brw_vue_prog_data(brw->tes.base.prog_data);
    else
       vue_prog_data = brw_vue_prog_data(brw->vs.base.prog_data);
-#endif
 
    brw_batch_emit(brw, GENX(3DSTATE_CLIP), clip) {
       clip.StatisticsEnable = !brw->meta_in_progress;
@@ -1561,8 +1559,9 @@ genX(upload_clip_state)(struct brw_context *brw)
       clip.MinimumPointWidth = 0.125;
       clip.MaximumPointWidth = 255.875;
       clip.MaximumVPIndex = viewport_count - 1;
-      if (_mesa_geometric_layers(fb) == 0)
-         clip.ForceZeroRTAIndexEnable = true;
+      clip.ForceZeroRTAIndexEnable =
+         _mesa_geometric_layers(fb) == 0 ||
+         !(vue_prog_data->vue_map.slots_valid & VARYING_BIT_LAYER);
    }
 }
 
-- 
2.19.1



More information about the mesa-dev mailing list