diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2015-01-24 17:20:26 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2015-01-26 18:36:01 +0300 |
commit | 3a3d68cd885ba6d9550c7b6ed6207a9d21380d93 (patch) | |
tree | 19b757a1854f25ead94f80e4fc596b981118888b /source | |
parent | fdb55e3719b20ef7e4f47cbd674c9f3aabf4520f (diff) |
Code cleanup: use bool instead of int
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D1026
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.c | 28 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.h | 18 |
2 files changed, 24 insertions, 22 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index ff94258028e..0ada2602ae4 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -402,8 +402,8 @@ static void codegen_set_unique_ids(ListBase *nodes) for (input=node->inputs.first; input; input=input->next) { /* set id for unique names of uniform variables */ input->id = id++; - input->bindtex = 0; - input->definetex = 0; + input->bindtex = false; + input->definetex = false; /* set texid used for settings texture slot with multitexture */ if (codegen_input_has_texture(input) && @@ -414,7 +414,7 @@ static void codegen_set_unique_ids(ListBase *nodes) * buffer to avoid sampling the same texture twice */ if (!BLI_ghash_haskey(bindhash, input->link)) { input->texid = texid++; - input->bindtex = 1; + input->bindtex = true; BLI_ghash_insert(bindhash, input->link, SET_INT_IN_POINTER(input->texid)); } else @@ -425,7 +425,7 @@ static void codegen_set_unique_ids(ListBase *nodes) * buffer to avoid sampling the same texture twice */ if (!BLI_ghash_haskey(bindhash, input->ima)) { input->texid = texid++; - input->bindtex = 1; + input->bindtex = true; BLI_ghash_insert(bindhash, input->ima, SET_INT_IN_POINTER(input->texid)); } else @@ -436,7 +436,7 @@ static void codegen_set_unique_ids(ListBase *nodes) * buffer to avoid sampling the same texture twice */ if (!BLI_ghash_haskey(bindhash, input->prv)) { input->texid = texid++; - input->bindtex = 1; + input->bindtex = true; BLI_ghash_insert(bindhash, input->prv, SET_INT_IN_POINTER(input->texid)); } else @@ -446,7 +446,7 @@ static void codegen_set_unique_ids(ListBase *nodes) if (!BLI_ghash_haskey(bindhash, input->tex)) { /* input is user created texture, check tex pointer */ input->texid = texid++; - input->bindtex = 1; + input->bindtex = true; BLI_ghash_insert(bindhash, input->tex, SET_INT_IN_POINTER(input->texid)); } else @@ -457,13 +457,13 @@ static void codegen_set_unique_ids(ListBase *nodes) if (input->source == GPU_SOURCE_TEX_PIXEL) { if (input->ima) { if (!BLI_ghash_haskey(definehash, input->ima)) { - input->definetex = 1; + input->definetex = true; BLI_ghash_insert(definehash, input->ima, SET_INT_IN_POINTER(input->texid)); } } else { if (!BLI_ghash_haskey(definehash, input->link)) { - input->definetex = 1; + input->definetex = true; BLI_ghash_insert(definehash, input->link, SET_INT_IN_POINTER(input->texid)); } } @@ -968,7 +968,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const GPUType input->tex = link->dynamictex; input->textarget = GL_TEXTURE_2D; input->textype = type; - input->dynamictex = 1; + input->dynamictex = true; input->dynamicdata = link->ptr2; MEM_freeN(link); } @@ -1184,7 +1184,7 @@ GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data) link->ptr1= num; link->ptr2= data; - link->dynamic= 1; + link->dynamic= true; link->dynamictype = dynamictype; @@ -1218,7 +1218,7 @@ GPUNodeLink *GPU_texture(int size, float *pixels) { GPUNodeLink *link = GPU_node_link_create(); - link->texture = 1; + link->texture = true; link->texturesize = size; link->ptr1= pixels; @@ -1229,7 +1229,7 @@ GPUNodeLink *GPU_dynamic_texture(GPUTexture *tex, int dynamictype, void *data) { GPUNodeLink *link = GPU_node_link_create(); - link->dynamic = 1; + link->dynamic = true; link->dynamictex = tex; link->dynamictype = dynamictype; link->ptr2 = data; @@ -1385,7 +1385,7 @@ static void gpu_nodes_tag(GPUNodeLink *link) if (node->tag) return; - node->tag= 1; + node->tag = true; for (input=node->inputs.first; input; input=input->next) if (input->link) gpu_nodes_tag(input->link); @@ -1396,7 +1396,7 @@ static void gpu_nodes_prune(ListBase *nodes, GPUNodeLink *outlink) GPUNode *node, *next; for (node=nodes->first; node; node=node->next) - node->tag= 0; + node->tag = false; gpu_nodes_tag(outlink); diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h index 5c19f259214..519fe84c82f 100644 --- a/source/blender/gpu/intern/gpu_codegen.h +++ b/source/blender/gpu/intern/gpu_codegen.h @@ -71,7 +71,9 @@ struct GPUNode { struct GPUNode *next, *prev; const char *name; - int tag; + + /* Internal flag to mark nodes during pruning */ + bool tag; ListBase inputs; ListBase outputs; @@ -84,14 +86,14 @@ struct GPUNodeLink { const char *attribname; GPUNodeLinkImage image; - int image_isdata; + bool image_isdata; - int texture; + bool texture; int texturesize; void *ptr1, *ptr2; - int dynamic; + bool dynamic; int dynamictype; GPUType type; @@ -127,15 +129,15 @@ typedef struct GPUInput { int id; /* unique id as created by code generator */ int texid; /* number for multitexture, starting from zero */ int attribid; /* id for vertex attributes */ - int bindtex; /* input is responsible for binding the texture? */ - int definetex; /* input is responsible for defining the pixel? */ + bool bindtex; /* input is responsible for binding the texture? */ + bool definetex; /* input is responsible for defining the pixel? */ int textarget; /* GL_TEXTURE_* */ GPUType textype; /* datatype */ struct Image *ima; /* image */ struct ImageUser *iuser;/* image user */ struct PreviewImage *prv; /* preview images & icons */ - int image_isdata; /* image does not contain color data */ + bool image_isdata; /* image does not contain color data */ float *dynamicvec; /* vector data in case it is dynamic */ int dynamictype; /* origin of the dynamic uniform (GPUDynamicType) */ void *dynamicdata; /* data source of the dynamic uniform */ @@ -145,7 +147,7 @@ typedef struct GPUInput { float vec[16]; /* vector data */ GPUNodeLink *link; - int dynamictex; /* dynamic? */ + bool dynamictex; /* dynamic? */ CustomDataType attribtype; /* attribute type */ char attribname[32]; /* attribute name */ int attribfirst; /* this is the first one that is bound */ |