[Bf-blender-cvs] [c5f5012] master: Code cleanup: use GPUDynamicType instead of int

Nicholas Bishop noreply at git.blender.org
Mon Jan 26 16:42:09 CET 2015


Commit: c5f5012c5a1b30ee757244782584cab087e22999
Author: Nicholas Bishop
Date:   Sat Jan 24 15:50:03 2015 +0100
Branches: master
https://developer.blender.org/rBc5f5012c5a1b30ee757244782584cab087e22999

Code cleanup: use GPUDynamicType instead of int

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D1026

===================================================================

M	source/blender/gpu/GPU_material.h
M	source/blender/gpu/intern/gpu_codegen.c
M	source/blender/gpu/intern/gpu_codegen.h

===================================================================

diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index a002c98..a65a123 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -123,13 +123,40 @@ typedef struct GPUNodeStack {
 	short sockettype;
 } GPUNodeStack;
 
+typedef enum GPUDynamicType {
+	GPU_DYNAMIC_NONE = 0,
+	GPU_DYNAMIC_OBJECT_VIEWMAT = 1,
+	GPU_DYNAMIC_OBJECT_MAT = 2,
+	GPU_DYNAMIC_OBJECT_VIEWIMAT = 3,
+	GPU_DYNAMIC_OBJECT_IMAT = 4,
+	GPU_DYNAMIC_OBJECT_COLOR = 5,
+	GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE = 15,
+
+	GPU_DYNAMIC_LAMP_FIRST = 6,
+	GPU_DYNAMIC_LAMP_DYNVEC = 6,
+	GPU_DYNAMIC_LAMP_DYNCO = 7,
+	GPU_DYNAMIC_LAMP_DYNIMAT = 8,
+	GPU_DYNAMIC_LAMP_DYNPERSMAT = 9,
+	GPU_DYNAMIC_LAMP_DYNENERGY = 10,
+	GPU_DYNAMIC_LAMP_DYNCOL = 11,
+	GPU_DYNAMIC_LAMP_LAST = 11,
+	GPU_DYNAMIC_SAMPLER_2DBUFFER = 12,
+	GPU_DYNAMIC_SAMPLER_2DIMAGE = 13,
+	GPU_DYNAMIC_SAMPLER_2DSHADOW = 14,
+	GPU_DYNAMIC_LAMP_DISTANCE = 16,
+	GPU_DYNAMIC_LAMP_ATT1 = 17,
+	GPU_DYNAMIC_LAMP_ATT2 = 18,
+	GPU_DYNAMIC_LAMP_SPOTSIZE = 19,
+	GPU_DYNAMIC_LAMP_SPOTBLEND = 20,
+} GPUDynamicType;
+
 GPUNodeLink *GPU_attribute(CustomDataType type, const char *name);
 GPUNodeLink *GPU_uniform(float *num);
-GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data);
+GPUNodeLink *GPU_dynamic_uniform(float *num, GPUDynamicType dynamictype, void *data);
 GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser, bool is_data);
 GPUNodeLink *GPU_image_preview(struct PreviewImage *prv);
 GPUNodeLink *GPU_texture(int size, float *pixels);
-GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex, int dynamictype, void *data);
+GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex, GPUDynamicType dynamictype, void *data);
 GPUNodeLink *GPU_builtin(GPUBuiltin builtin);
 GPUNodeLink *GPU_opengl_builtin(GPUOpenGLBuiltin builtin);
 
@@ -183,33 +210,6 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr);
 
 /* Export GLSL shader */
 
-typedef enum GPUDynamicType {
-	GPU_DYNAMIC_NONE = 0,
-	GPU_DYNAMIC_OBJECT_VIEWMAT = 1,
-	GPU_DYNAMIC_OBJECT_MAT = 2,
-	GPU_DYNAMIC_OBJECT_VIEWIMAT = 3,
-	GPU_DYNAMIC_OBJECT_IMAT = 4,
-	GPU_DYNAMIC_OBJECT_COLOR = 5,
-	GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE = 15,
-
-	GPU_DYNAMIC_LAMP_FIRST = 6,
-	GPU_DYNAMIC_LAMP_DYNVEC = 6,
-	GPU_DYNAMIC_LAMP_DYNCO = 7,
-	GPU_DYNAMIC_LAMP_DYNIMAT = 8,
-	GPU_DYNAMIC_LAMP_DYNPERSMAT = 9,
-	GPU_DYNAMIC_LAMP_DYNENERGY = 10,
-	GPU_DYNAMIC_LAMP_DYNCOL = 11,
-	GPU_DYNAMIC_LAMP_LAST = 11,
-	GPU_DYNAMIC_SAMPLER_2DBUFFER = 12,
-	GPU_DYNAMIC_SAMPLER_2DIMAGE = 13,
-	GPU_DYNAMIC_SAMPLER_2DSHADOW = 14,
-	GPU_DYNAMIC_LAMP_DISTANCE = 16,
-	GPU_DYNAMIC_LAMP_ATT1 = 17,
-	GPU_DYNAMIC_LAMP_ATT2 = 18,
-	GPU_DYNAMIC_LAMP_SPOTSIZE = 19,
-	GPU_DYNAMIC_LAMP_SPOTBLEND = 20,
-} GPUDynamicType;
-
 typedef enum GPUDataType {
 	GPU_DATA_NONE = 0,
 	GPU_DATA_1I = 1,	// 1 integer
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 0ada260..9b49d23 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1178,7 +1178,7 @@ GPUNodeLink *GPU_uniform(float *num)
 	return link;
 }
 
-GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data)
+GPUNodeLink *GPU_dynamic_uniform(float *num, GPUDynamicType dynamictype, void *data)
 {
 	GPUNodeLink *link = GPU_node_link_create();
 
@@ -1225,7 +1225,7 @@ GPUNodeLink *GPU_texture(int size, float *pixels)
 	return link;
 }
 
-GPUNodeLink *GPU_dynamic_texture(GPUTexture *tex, int dynamictype, void *data)
+GPUNodeLink *GPU_dynamic_texture(GPUTexture *tex, GPUDynamicType dynamictype, void *data)
 {
 	GPUNodeLink *link = GPU_node_link_create();
 
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index 8b63af9..c76341a 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -94,7 +94,7 @@ struct GPUNodeLink {
 	void *ptr1, *ptr2;
 
 	bool dynamic;
-	int dynamictype;
+	GPUDynamicType dynamictype;
 
 	GPUType type;
 
@@ -131,7 +131,7 @@ typedef struct GPUInput {
 	int attribid;			/* id for vertex attributes */
 	bool bindtex;			/* input is responsible for binding the texture? */
 	bool definetex;			/* input is responsible for defining the pixel? */
-	int textarget;			/* GL_TEXTURE_* */
+	int textarget;			/* GL texture target, e.g. GL_TEXTURE_2D */
 	GPUType textype;		/* datatype */
 
 	struct Image *ima;		/* image */
@@ -139,7 +139,7 @@ typedef struct GPUInput {
 	struct PreviewImage *prv;	/* preview images & icons */
 	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) */
+	GPUDynamicType dynamictype;	/* origin of the dynamic uniform */
 	void *dynamicdata;		/* data source of the dynamic uniform */
 	struct GPUTexture *tex;	/* input texture, only set at runtime */
 	int shaderloc;			/* id from opengl */




More information about the Bf-blender-cvs mailing list