diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2015-01-24 17:02:54 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2015-01-26 18:35:55 +0300 |
commit | 6cfc55c4f95f0fdf73a570d199004f5ad6c18fe2 (patch) | |
tree | 650769bb2a6f952f0e913211a8eef6475c037217 /source/blender/gpu/intern/gpu_codegen.c | |
parent | 42eaf82d1083c86b9edc8af37553a4b0b2fbbc21 (diff) |
Code cleanup: use enums instead of defines
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D1026
Diffstat (limited to 'source/blender/gpu/intern/gpu_codegen.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index ed0282bd097..ee81abec2c3 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -62,19 +62,25 @@ extern char datatoc_gpu_shader_vertex_world_glsl[]; static char *glsl_material_library = NULL; -/* structs and defines */ +/* type definitions and constants */ -#define MAX_FUNCTION_NAME 64 -#define MAX_PARAMETER 32 +enum { + MAX_FUNCTION_NAME = 64 +}; +enum { + MAX_PARAMETER = 32 +}; -#define FUNCTION_QUAL_IN 0 -#define FUNCTION_QUAL_OUT 1 -#define FUNCTION_QUAL_INOUT 2 +typedef enum { + FUNCTION_QUAL_IN, + FUNCTION_QUAL_OUT, + FUNCTION_QUAL_INOUT +} GPUFunctionQual; typedef struct GPUFunction { char name[MAX_FUNCTION_NAME]; GPUType paramtype[MAX_PARAMETER]; - int paramqual[MAX_PARAMETER]; + GPUFunctionQual paramqual[MAX_PARAMETER]; int totparam; } GPUFunction; @@ -142,7 +148,8 @@ static void gpu_parse_functions_string(GHash *hash, char *code) { GPUFunction *function; GPUType type; - int i, qual; + GPUFunctionQual qual; + int i; while ((code = strstr(code, "void "))) { function = MEM_callocN(sizeof(GPUFunction), "GPUFunction"); |