diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-15 14:15:15 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-15 14:18:32 -0700 |
commit | 7f9d30974317a4050fb8990ce1a3eebbb190483a (patch) | |
tree | c562a07c62bc25580ca684f62c98f74aef5d5c90 /ast_to_hir.cpp | |
parent | bbddcb3092dbb80081d9d4d183cd7b6f3804b1d8 (diff) |
Ensure that ast_type always has type_name set
For built-in types, type_name would be NULL. This ensures that
type_name is set even for the built-in types. This simplifies code in
a few places and centralizes the name setting code.
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r-- | ast_to_hir.cpp | 62 |
1 files changed, 2 insertions, 60 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index 1de64795ad..9f580d28cb 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -759,73 +759,15 @@ type_specifier_to_glsl_type(const struct ast_type_specifier *spec, const char **name, struct _mesa_glsl_parse_state *state) { - static const char *const type_names[] = { - "void", - "float", - "int", - "uint", - "bool", - "vec2", - "vec3", - "vec4", - "bvec2", - "bvec3", - "bvec4", - "ivec2", - "ivec3", - "ivec4", - "uvec2", - "uvec3", - "uvec4", - "mat2", - "mat2x3", - "mat2x4", - "mat3x2", - "mat3", - "mat3x4", - "mat4x2", - "mat4x3", - "mat4", - "sampler1D", - "sampler2D", - "sampler3D", - "samplerCube", - "sampler1DShadow", - "sampler2DShadow", - "samplerCubeShadow", - "sampler1DArray", - "sampler2DArray", - "sampler1DArrayShadow", - "sampler2DArrayShadow", - "isampler1D", - "isampler2D", - "isampler3D", - "isamplerCube", - "isampler1DArray", - "isampler2DArray", - "usampler1D", - "usampler2D", - "usampler3D", - "usamplerCube", - "usampler1DArray", - "usampler2DArray", - - NULL, /* ast_struct */ - NULL /* ast_type_name */ - }; struct glsl_type *type; - const char *type_name = NULL; if (spec->type_specifier == ast_struct) { /* FINISHME: Handle annonymous structures. */ type = NULL; } else { - type_name = (spec->type_specifier == ast_type_name) - ? spec->type_name : type_names[spec->type_specifier]; - type = (glsl_type *) - _mesa_symbol_table_find_symbol(state->symbols, 0, type_name); - *name = type_name; + _mesa_symbol_table_find_symbol(state->symbols, 0, spec->type_name); + *name = spec->type_name; /* FINISHME: Handle array declarations. Note that this requires complete * FINSIHME: handling of constant expressions. |