glsl: set user defined varyings to smooth by default in ES
authorTimothy Arceri <timothy.arceri@collabora.com>
Tue, 16 Feb 2016 00:03:56 +0000 (11:03 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Tue, 16 Feb 2016 20:23:49 +0000 (07:23 +1100)
This is usually handled by the backends in order to handle the
various interactions with the gl_*Color built-ins.

The problem is this means linking will fail if one side on the
interface adds the smooth qualifier to the varying and the other
side just uses the default even though they match.

This fixes various deqp tests. The spec is not clear what to for
desktop GL so leave it as is for now.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92743

src/compiler/glsl/ast_to_hir.cpp

index b63937899cb8d8ce8127caa8a1758ddef3f5790f..0bb2ba2a5e9ccbaa132728ae81e63894250ed2b2 100644 (file)
@@ -2750,6 +2750,17 @@ interpret_interpolation_qualifier(const struct ast_type_qualifier *qual,
                           "vertex shader inputs or fragment shader outputs",
                           interpolation_string(interpolation));
       }
+   } else if (state->es_shader &&
+              ((mode == ir_var_shader_in &&
+                state->stage != MESA_SHADER_VERTEX) ||
+               (mode == ir_var_shader_out &&
+                state->stage != MESA_SHADER_FRAGMENT))) {
+      /* Section 4.3.9 (Interpolation) of the GLSL ES 3.00 spec says:
+       *
+       *    "When no interpolation qualifier is present, smooth interpolation
+       *    is used."
+       */
+      interpolation = INTERP_QUALIFIER_SMOOTH;
    }
 
    return interpolation;