summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-11-10 23:20:47 -0800
committerKenneth Graunke <[email protected]>2010-11-15 13:33:57 -0800
commit5dc74e9c77de7d30ac08c25f224ffa93006d8d7c (patch)
treed5484fc625ac88cb5d65c2bb48210f38227f66ef /src/glsl
parentee36f14fa54723f2da3cf6054f822ebf05cca247 (diff)
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.
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/glsl_types.cpp2
-rw-r--r--src/glsl/glsl_types.h24
2 files changed, 14 insertions, 12 deletions
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 82eb4706056..8c33cfa20d0 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -46,7 +46,7 @@ glsl_type::init_talloc_type_ctx(void)
}
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) :
gl_type(gl_type),
base_type(base_type),
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index d38ef0b88b2..d62d493c8e8 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -43,15 +43,17 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state);
extern "C" void
_mesa_glsl_release_types(void);
-#define GLSL_TYPE_UINT 0
-#define GLSL_TYPE_INT 1
-#define GLSL_TYPE_FLOAT 2
-#define GLSL_TYPE_BOOL 3
-#define GLSL_TYPE_SAMPLER 4
-#define GLSL_TYPE_STRUCT 5
-#define GLSL_TYPE_ARRAY 6
-#define GLSL_TYPE_VOID 7
-#define GLSL_TYPE_ERROR 8
+enum glsl_base_type {
+ GLSL_TYPE_UINT = 0,
+ GLSL_TYPE_INT,
+ GLSL_TYPE_FLOAT,
+ GLSL_TYPE_BOOL,
+ GLSL_TYPE_SAMPLER,
+ GLSL_TYPE_STRUCT,
+ GLSL_TYPE_ARRAY,
+ GLSL_TYPE_VOID,
+ GLSL_TYPE_ERROR
+};
enum glsl_sampler_dim {
GLSL_SAMPLER_DIM_1D = 0,
@@ -65,7 +67,7 @@ enum glsl_sampler_dim {
struct glsl_type {
GLenum gl_type;
- unsigned base_type:4;
+ glsl_base_type base_type;
unsigned sampler_dimensionality:3;
unsigned sampler_shadow:1;
@@ -393,7 +395,7 @@ private:
/** Constructor for vector and matrix types */
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);
/** Constructor for sampler types */