diff options
author | Ian Romanick <[email protected]> | 2010-09-07 14:30:06 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-09-07 14:33:29 -0700 |
commit | f09fabc448c0781f0cf9160565e1b0bab59a16e5 (patch) | |
tree | 285c694667cd76d620d9536dabdf0f4bd42b5665 /src/glsl/ast_to_hir.cpp | |
parent | 50a3349bee04088bee3491622d6ef3c032d01eac (diff) |
glsl2: Forbid array-types in ?: operator in GLSL 1.10
Fixes bugzilla #30039.
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 762f802c2b7..78284034f0e 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1125,6 +1125,17 @@ ast_expression::hir(exec_list *instructions, type = op[1]->type; } + /* From page 33 (page 39 of the PDF) of the GLSL 1.10 spec: + * + * "The second and third expressions must be the same type, but can + * be of any type other than an array." + */ + if ((state->language_version <= 110) && type->is_array()) { + _mesa_glsl_error(& loc, state, "Second and third operands of ?: " + "operator must not be arrays."); + error_emitted = true; + } + ir_constant *cond_val = op[0]->constant_expression_value(); ir_constant *then_val = op[1]->constant_expression_value(); ir_constant *else_val = op[2]->constant_expression_value(); |