st/mesa: don't force per-sample interp if only sampleid/pos are used
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 27 Feb 2016 16:01:27 +0000 (11:01 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 6 Mar 2016 04:26:03 +0000 (23:26 -0500)
The OES extensions clarify this behaviour to differentiate between
per-sample invocation and per-sample interpolation. Using sampleid/pos
will force per-sample invocation but not per-sample interpolation.

See https://www.khronos.org/bugzilla/show_bug.cgi?id=1462

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_atom_shader.c
src/mesa/state_tracker/st_program.c

index a88f0352746a6f4da91534771326da3b92ed2dd4..ff90bd61d5b098fb381ef9def7371071a3d658a6 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "main/imports.h"
 #include "main/mtypes.h"
+#include "main/framebuffer.h"
 #include "program/program.h"
 
 #include "pipe/p_context.h"
@@ -70,16 +71,13 @@ update_fp( struct st_context *st )
    key.clamp_color = st->clamp_frag_color_in_shader &&
                      st->ctx->Color._ClampFragmentColor;
 
-   /* Don't set it if the driver can force the interpolation by itself.
-    * If SAMPLE_ID or SAMPLE_POS are used, the interpolation is set
-    * automatically.
-    * Ignore sample qualifier while computing this flag.
-    */
+   /* _NEW_MULTISAMPLE | _NEW_BUFFERS */
    key.persample_shading =
       st->force_persample_in_shader &&
-      !(stfp->Base.Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
-                                            SYSTEM_BIT_SAMPLE_POS)) &&
-      _mesa_get_min_invocations_per_fragment(st->ctx, &stfp->Base, true) > 1;
+      st->ctx->Multisample._Enabled &&
+      st->ctx->Multisample.SampleShading &&
+      st->ctx->Multisample.MinSampleShadingValue *
+      _mesa_geometric_samples(st->ctx->DrawBuffer) > 1;
 
    st->fp_variant = st_get_fp_variant(st, stfp, &key);
 
index 2e21d02b8b5f8b36928bb5d512ad6863cdc87e85..c9f390aa9a25e7ceec45a825251f0caefcbdab8e 100644 (file)
@@ -573,10 +573,6 @@ st_translate_fragment_program(struct st_context *st,
          else
             interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTER;
 
-         if (stfp->Base.Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
-                                                 SYSTEM_BIT_SAMPLE_POS))
-            interpLocation[slot] = TGSI_INTERPOLATE_LOC_SAMPLE;
-
          switch (attr) {
          case VARYING_SLOT_POS:
             input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;