Mesa (master): glsl: make sure that interpolateAt arguments are variables

Ilia Mirkin imirkin at kemper.freedesktop.org
Fri May 13 23:21:34 UTC 2016


Module: Mesa
Branch: master
Commit: 5239f1e0c9f24ca06a9c58ce6eea95c7e4da93bd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5239f1e0c9f24ca06a9c58ce6eea95c7e4da93bd

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Thu May 12 23:54:36 2016 -0400

glsl: make sure that interpolateAt arguments are variables

In the case of a constant, it might have been propagated through and
variable_referenced() returns NULL. Error out in that case.

Fixes 3 dEQP tests:

dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.negative.interpolate_constant
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_centroid.negative.interpolate_constant
dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_offset.negative.interpolate_constant

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Eduardo Lima Mitev <elima at igalia.com>
Reviewed-by: Chris Forbes <chrisforbes at google.com>

---

 src/compiler/glsl/ast_function.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 37fb3e79..4db3dd0 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -209,7 +209,7 @@ verify_parameter_modes(_mesa_glsl_parse_state *state,
       /* Verify that shader_in parameters are shader inputs */
       if (formal->data.must_be_shader_input) {
          ir_variable *var = actual->variable_referenced();
-         if (var && var->data.mode != ir_var_shader_in) {
+         if (!var || var->data.mode != ir_var_shader_in) {
             _mesa_glsl_error(&loc, state,
                              "parameter `%s` must be a shader input",
                              formal->name);




More information about the mesa-commit mailing list