diff options
| author | Eric Anholt <eric@anholt.net> | 2010-05-19 13:38:15 -0700 |
|---|---|---|
| committer | Eric Anholt <eric@anholt.net> | 2010-06-01 15:15:04 -0700 |
| commit | 0ca171908d04732176cbcaf2625fed8208a93dc9 (patch) | |
| tree | 88fd86ada99debeaeb3923e92f5d7359202f762b | |
| parent | cd512b00633a8f631ad7442c5cdccc608dd432e1 (diff) | |
Allow arrays of floats as varyings.
The comment just above the code said arrays were OK, then it didn't
handle arrays. Whoops. Partially fixes CorrectUnsizedArray.frat.
| -rw-r--r-- | ast_to_hir.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index 8945bce6ee..307e448369 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -1426,10 +1426,19 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, * float, vec2, vec3, vec4, mat2, mat3, and mat4, or arrays of * these." */ - if (qual->varying && var->type->base_type != GLSL_TYPE_FLOAT) { - var->type = glsl_type::error_type; - _mesa_glsl_error(loc, state, - "varying variables must be of base type float"); + if (qual->varying) { + const glsl_type *non_array_type; + + if (var->type && var->type->is_array()) + non_array_type = var->type->fields.array; + else + non_array_type = var->type; + + if (non_array_type && non_array_type->base_type != GLSL_TYPE_FLOAT) { + var->type = glsl_type::error_type; + _mesa_glsl_error(loc, state, + "varying variables must be of base type float"); + } } if (qual->in && qual->out) |
