glsl: Convert glsl_type::base_type from #define'd constants to an enum.

This is nice because printing type->base_type in GDB will now give you a
readable name instead of a number.
This commit is contained in:
Kenneth Graunke 2010-11-10 23:20:47 -08:00
parent ee36f14fa5
commit 5dc74e9c77
2 changed files with 14 additions and 12 deletions

View File

@ -46,7 +46,7 @@ glsl_type::init_talloc_type_ctx(void)
} }
glsl_type::glsl_type(GLenum gl_type, glsl_type::glsl_type(GLenum gl_type,
unsigned base_type, unsigned vector_elements, glsl_base_type base_type, unsigned vector_elements,
unsigned matrix_columns, const char *name) : unsigned matrix_columns, const char *name) :
gl_type(gl_type), gl_type(gl_type),
base_type(base_type), base_type(base_type),

View File

@ -43,15 +43,17 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state);
extern "C" void extern "C" void
_mesa_glsl_release_types(void); _mesa_glsl_release_types(void);
#define GLSL_TYPE_UINT 0 enum glsl_base_type {
#define GLSL_TYPE_INT 1 GLSL_TYPE_UINT = 0,
#define GLSL_TYPE_FLOAT 2 GLSL_TYPE_INT,
#define GLSL_TYPE_BOOL 3 GLSL_TYPE_FLOAT,
#define GLSL_TYPE_SAMPLER 4 GLSL_TYPE_BOOL,
#define GLSL_TYPE_STRUCT 5 GLSL_TYPE_SAMPLER,
#define GLSL_TYPE_ARRAY 6 GLSL_TYPE_STRUCT,
#define GLSL_TYPE_VOID 7 GLSL_TYPE_ARRAY,
#define GLSL_TYPE_ERROR 8 GLSL_TYPE_VOID,
GLSL_TYPE_ERROR
};
enum glsl_sampler_dim { enum glsl_sampler_dim {
GLSL_SAMPLER_DIM_1D = 0, GLSL_SAMPLER_DIM_1D = 0,
@ -65,7 +67,7 @@ enum glsl_sampler_dim {
struct glsl_type { struct glsl_type {
GLenum gl_type; GLenum gl_type;
unsigned base_type:4; glsl_base_type base_type;
unsigned sampler_dimensionality:3; unsigned sampler_dimensionality:3;
unsigned sampler_shadow:1; unsigned sampler_shadow:1;
@ -393,7 +395,7 @@ private:
/** Constructor for vector and matrix types */ /** Constructor for vector and matrix types */
glsl_type(GLenum gl_type, glsl_type(GLenum gl_type,
unsigned base_type, unsigned vector_elements, glsl_base_type base_type, unsigned vector_elements,
unsigned matrix_columns, const char *name); unsigned matrix_columns, const char *name);
/** Constructor for sampler types */ /** Constructor for sampler types */