glsl: Drop the round-trip through ast_type_specifier for many builtin types.
We have lexer recognition of a bunch of our types based on the handling. This code was mapping those recognized tokens to an enum and then to a string of their name. Just drop the enums and provide the string directly in the parser. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -418,72 +418,12 @@ public:
|
||||
};
|
||||
|
||||
|
||||
enum ast_types {
|
||||
ast_void,
|
||||
ast_float,
|
||||
ast_int,
|
||||
ast_uint,
|
||||
ast_bool,
|
||||
ast_vec2,
|
||||
ast_vec3,
|
||||
ast_vec4,
|
||||
ast_bvec2,
|
||||
ast_bvec3,
|
||||
ast_bvec4,
|
||||
ast_ivec2,
|
||||
ast_ivec3,
|
||||
ast_ivec4,
|
||||
ast_uvec2,
|
||||
ast_uvec3,
|
||||
ast_uvec4,
|
||||
ast_mat2,
|
||||
ast_mat2x3,
|
||||
ast_mat2x4,
|
||||
ast_mat3x2,
|
||||
ast_mat3,
|
||||
ast_mat3x4,
|
||||
ast_mat4x2,
|
||||
ast_mat4x3,
|
||||
ast_mat4,
|
||||
ast_sampler1d,
|
||||
ast_sampler2d,
|
||||
ast_sampler2drect,
|
||||
ast_sampler3d,
|
||||
ast_samplercube,
|
||||
ast_samplerexternaloes,
|
||||
ast_sampler1dshadow,
|
||||
ast_sampler2dshadow,
|
||||
ast_sampler2drectshadow,
|
||||
ast_samplercubeshadow,
|
||||
ast_sampler1darray,
|
||||
ast_sampler2darray,
|
||||
ast_sampler1darrayshadow,
|
||||
ast_sampler2darrayshadow,
|
||||
ast_isampler1d,
|
||||
ast_isampler2d,
|
||||
ast_isampler3d,
|
||||
ast_isamplercube,
|
||||
ast_isampler1darray,
|
||||
ast_isampler2darray,
|
||||
ast_usampler1d,
|
||||
ast_usampler2d,
|
||||
ast_usampler3d,
|
||||
ast_usamplercube,
|
||||
ast_usampler1darray,
|
||||
ast_usampler2darray,
|
||||
|
||||
ast_struct,
|
||||
ast_type_name
|
||||
};
|
||||
|
||||
|
||||
class ast_type_specifier : public ast_node {
|
||||
public:
|
||||
ast_type_specifier(int specifier);
|
||||
|
||||
/** Construct a type specifier from a type name */
|
||||
ast_type_specifier(const char *name)
|
||||
: type_specifier(ast_type_name), type_name(name), structure(NULL),
|
||||
: type_name(name), structure(NULL),
|
||||
is_array(false), array_size(NULL), precision(ast_precision_none),
|
||||
is_precision_statement(false)
|
||||
{
|
||||
@@ -492,7 +432,7 @@ public:
|
||||
|
||||
/** Construct a type specifier from a structure definition */
|
||||
ast_type_specifier(ast_struct_specifier *s)
|
||||
: type_specifier(ast_struct), type_name(s->name), structure(s),
|
||||
: type_name(s->name), structure(s),
|
||||
is_array(false), array_size(NULL), precision(ast_precision_none),
|
||||
is_precision_statement(false)
|
||||
{
|
||||
@@ -507,8 +447,6 @@ public:
|
||||
|
||||
ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *);
|
||||
|
||||
enum ast_types type_specifier;
|
||||
|
||||
const char *type_name;
|
||||
ast_struct_specifier *structure;
|
||||
|
||||
|
Reference in New Issue
Block a user