i965/nir: Do not scalarize phis in non-scalar setups
[mesa.git] / src / mesa / drivers / dri / i965 / gen6_wm_state.c
index e5b0f5ab03013442e03d073a837f62d936444ba6..d1748ba74578555b75f68db6cd0660cb55507a1e 100644 (file)
@@ -33,6 +33,7 @@
 #include "program/program.h"
 #include "program/prog_parameter.h"
 #include "program/prog_statevars.h"
+#include "main/framebuffer.h"
 #include "intel_batchbuffer.h"
 
 static void
@@ -73,7 +74,8 @@ gen6_upload_wm_state(struct brw_context *brw,
                      bool multisampled_fbo, int min_inv_per_frag,
                      bool dual_source_blend_enable, bool kill_enable,
                      bool color_buffer_write_enable, bool msaa_enabled,
-                     bool line_stipple_enable, bool polygon_stipple_enable)
+                     bool line_stipple_enable, bool polygon_stipple_enable,
+                     bool statistic_enable)
 {
    uint32_t dw2, dw4, dw5, dw6, ksp0, ksp2;
 
@@ -109,7 +111,10 @@ gen6_upload_wm_state(struct brw_context *brw,
    }
 
    dw2 = dw4 = dw5 = dw6 = ksp2 = 0;
-   dw4 |= GEN6_WM_STATISTICS_ENABLE;
+
+   if (statistic_enable)
+      dw4 |= GEN6_WM_STATISTICS_ENABLE;
+
    dw5 |= GEN6_WM_LINE_AA_WIDTH_1_0;
    dw5 |= GEN6_WM_LINE_END_CAP_AA_WIDTH_0_5;
 
@@ -280,7 +285,7 @@ upload_wm_state(struct brw_context *brw)
    const struct brw_wm_prog_data *prog_data = brw->wm.prog_data;
 
    /* _NEW_BUFFERS */
-   const bool multisampled_fbo = ctx->DrawBuffer->Visual.samples > 1;
+   const bool multisampled_fbo = _mesa_geometric_samples(ctx->DrawBuffer) > 1;
 
    /* In case of non 1x per sample shading, only one of SIMD8 and SIMD16
     * should be enabled. We do 'SIMD16 only' dispatch if a SIMD16 shader
@@ -300,6 +305,9 @@ upload_wm_state(struct brw_context *brw)
                             ctx->Multisample.SampleAlphaToCoverage ||
                             prog_data->uses_omask;
 
+   /* Rendering against the gl-context is always taken into account. */
+   const bool statistic_enable = true;
+
    /* _NEW_LINE | _NEW_POLYGON | _NEW_BUFFERS | _NEW_COLOR |
     * _NEW_MULTISAMPLE
     */
@@ -308,7 +316,8 @@ upload_wm_state(struct brw_context *brw)
                         dual_src_blend_enable, kill_enable,
                         brw_color_buffer_write_enabled(brw),
                         ctx->Multisample.Enabled,
-                        ctx->Line.StippleFlag, ctx->Polygon.StippleFlag);
+                        ctx->Line.StippleFlag, ctx->Polygon.StippleFlag,
+                        statistic_enable);
 }
 
 const struct brw_tracked_state gen6_wm_state = {