From df8f14f3d5d78782d6c9f65aca07077603745800 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Fri, 4 Feb 2011 12:18:56 -0800 Subject: [PATCH] glsl: Set operators '%' and '%=' to be reserved when GLSL < 1.30 From section 5.9 of the GLSL 1.20 spec: The operator modulus (%) is reserved for future use. From section 5.8 of the GLSL 1.20 spec: The assignments modulus into (%=), left shift by (<<=), right shift by (>>=), inclusive or into ( |=), and exclusive or into ( ^=). These operators are reserved for future use. The GLSL ES 1.00 spec and GLSL 1.10 spec have similiar language. Fixes Piglit tests: spec/glsl-1.00/compiler/arithmetic-operators/modulus-00.frag spec/glsl-1.00/compiler/assignment-operators/modulus-assign-00.frag spec/glsl-1.10/compiler/arithmetic-operators/modulus-00.frag spec/glsl-1.10/compiler/assignment-operators/modulus-assign-00.frag spec/glsl-1.20/compiler/arithmetic-operators/modulus-00.frag spec/glsl-1.20/compiler/assignment-operators/modulus-assign-00.frag --- src/glsl/ast_to_hir.cpp | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 75f28cd..69985e3 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -956,6 +956,14 @@ ast_expression::hir(exec_list *instructions, break; case ast_mod: + if (state->language_version < 130) { + _mesa_glsl_error(&loc, state, + "operator %s is reserved in %s", + operator_string(this->oper), + state->version_string); + error_emitted = true; + } + op[0] = this->subexpressions[0]->hir(instructions, state); op[1] = this->subexpressions[1]->hir(instructions, state); @@ -1252,6 +1260,14 @@ ast_expression::hir(exec_list *instructions, } case ast_mod_assign: { + if (state->language_version < 130) { + _mesa_glsl_error(&loc, state, + "operator %s is reserved in %s", + operator_string(this->oper), + state->version_string); + error_emitted = true; + } + op[0] = this->subexpressions[0]->hir(instructions, state); op[1] = this->subexpressions[1]->hir(instructions, state); -- 1.7.3.5