Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2015-01-24 15:58:19 +0300
committerNicholas Bishop <nicholasbishop@gmail.com>2015-01-26 18:35:40 +0300
commitd1f88c05aa4a02565c93c1524962c85fdd041c5f (patch)
treed2c3bbed2f198402e79f74579c43866c2c3522bc /source/blender/gpu
parenta59e590e7f113facca2fbee96529d93c781472ac (diff)
Code cleanup: retype various fields/parameters from int to GPUType
Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D1026
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c17
-rw-r--r--source/blender/gpu/intern/gpu_codegen.h13
-rw-r--r--source/blender/gpu/intern/gpu_material.c28
3 files changed, 39 insertions, 19 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 6a088a40a45..7f4035cc84c 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -127,7 +127,8 @@ static char *gpu_str_skip_token(char *str, char *token, int max)
static void gpu_parse_functions_string(GHash *hash, char *code)
{
GPUFunction *function;
- int i, type, qual;
+ GPUType type;
+ int i, qual;
while ((code = strstr(code, "void "))) {
function = MEM_callocN(sizeof(GPUFunction), "GPUFunction");
@@ -147,7 +148,7 @@ static void gpu_parse_functions_string(GHash *hash, char *code)
code = gpu_str_skip_token(code, NULL, 0);
/* test for type */
- type= 0;
+ type= GPU_NONE;
for (i=1; i<=16; i++) {
if (GPU_DATATYPE_STR[i] && gpu_str_prefix(code, GPU_DATATYPE_STR[i])) {
type= i;
@@ -321,7 +322,7 @@ static void codegen_convert_datatype(DynStr *ds, int from, int to, const char *t
}
}
-static void codegen_print_datatype(DynStr *ds, int type, float *data)
+static void codegen_print_datatype(DynStr *ds, const GPUType type, float *data)
{
int i;
@@ -639,7 +640,7 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch
return code;
}
-static char *code_generate_vertex(ListBase *nodes, int type)
+static char *code_generate_vertex(ListBase *nodes, const GPUMatType type)
{
DynStr *ds = BLI_dynstr_new();
GPUNode *node;
@@ -900,7 +901,7 @@ static void GPU_node_end(GPUNode *UNUSED(node))
/* empty */
}
-static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
+static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const GPUType type)
{
GPUInput *input;
GPUNode *outnode;
@@ -1027,7 +1028,7 @@ static void gpu_node_input_socket(GPUNode *node, GPUNodeStack *sock)
}
}
-static void GPU_node_output(GPUNode *node, int type, const char *UNUSED(name), GPUNodeLink **link)
+static void GPU_node_output(GPUNode *node, const GPUType type, const char *UNUSED(name), GPUNodeLink **link)
{
GPUOutput *output = MEM_callocN(sizeof(GPUOutput), "GPUOutput");
@@ -1400,7 +1401,9 @@ static void gpu_nodes_prune(ListBase *nodes, GPUNodeLink *outlink)
}
}
-GPUPass *GPU_generate_pass(ListBase *nodes, GPUNodeLink *outlink, GPUVertexAttribs *attribs, int *builtins, int type, const char *name)
+GPUPass *GPU_generate_pass(ListBase *nodes, GPUNodeLink *outlink,
+ GPUVertexAttribs *attribs, int *builtins,
+ const GPUMatType type, const char *name)
{
GPUShader *shader;
GPUPass *pass;
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index abc5650059d..4091db8be11 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -55,7 +55,7 @@ struct PreviewImage;
typedef struct GPUFunction {
char name[MAX_FUNCTION_NAME];
- int paramtype[MAX_PARAMETER];
+ GPUType paramtype[MAX_PARAMETER];
int paramqual[MAX_PARAMETER];
int totparam;
} GPUFunction;
@@ -104,7 +104,7 @@ struct GPUNodeLink {
int dynamic;
int dynamictype;
- int type;
+ GPUType type;
/* Refcount */
int users;
@@ -121,7 +121,7 @@ typedef struct GPUOutput {
struct GPUOutput *next, *prev;
GPUNode *node;
- int type; /* data type = length of vector/matrix */
+ GPUType type; /* data type = length of vector/matrix */
GPUNodeLink *link; /* output link */
int id; /* unique id as created by code generator */
} GPUOutput;
@@ -131,7 +131,7 @@ typedef struct GPUInput {
GPUNode *node;
- int type; /* datatype */
+ GPUType type; /* datatype */
int source; /* data source */
int id; /* unique id as created by code generator */
@@ -140,7 +140,7 @@ typedef struct GPUInput {
int bindtex; /* input is responsible for binding the texture? */
int definetex; /* input is responsible for defining the pixel? */
int textarget; /* GL_TEXTURE_* */
- int textype; /* datatype */
+ GPUType textype; /* datatype */
struct Image *ima; /* image */
struct ImageUser *iuser;/* image user */
@@ -178,7 +178,8 @@ struct GPUPass {
typedef struct GPUPass GPUPass;
GPUPass *GPU_generate_pass(ListBase *nodes, struct GPUNodeLink *outlink,
- struct GPUVertexAttribs *attribs, int *builtin, int type, const char *name);
+ struct GPUVertexAttribs *attribs, int *builtin,
+ const GPUMatType type, const char *name);
struct GPUShader *GPU_pass_shader(GPUPass *pass);
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 75a9572f54f..20f8f5f099e 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -2208,30 +2208,46 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
glBindTexture(GL_TEXTURE_2D, lastbindcode);
}
break;
+
+ case GPU_NONE:
+ case GPU_FLOAT:
+ case GPU_VEC2:
+ case GPU_VEC3:
+ case GPU_VEC4:
+ case GPU_MAT3:
+ case GPU_MAT4:
+ case GPU_ATTRIB:
+ break;
}
}
else {
uniform->type = input->dynamictype;
BLI_strncpy(uniform->varname, input->shadername, sizeof(uniform->varname));
switch (input->type) {
- case 1:
+ case GPU_FLOAT:
uniform->datatype = GPU_DATA_1F;
break;
- case 2:
+ case GPU_VEC2:
uniform->datatype = GPU_DATA_2F;
break;
- case 3:
+ case GPU_VEC3:
uniform->datatype = GPU_DATA_3F;
break;
- case 4:
+ case GPU_VEC4:
uniform->datatype = GPU_DATA_4F;
break;
- case 9:
+ case GPU_MAT3:
uniform->datatype = GPU_DATA_9F;
break;
- case 16:
+ case GPU_MAT4:
uniform->datatype = GPU_DATA_16F;
break;
+
+ case GPU_NONE:
+ case GPU_TEX2D:
+ case GPU_SHADOW2D:
+ case GPU_ATTRIB:
+ break;
}
if (uniform->type >= GPU_DYNAMIC_LAMP_FIRST && uniform->type <= GPU_DYNAMIC_LAMP_LAST)