[Bf-blender-cvs] [428743a9b06] blender2.8: Cleanup: style for GPU module

Campbell Barton noreply at git.blender.org
Wed Jul 18 15:15:02 CEST 2018


Commit: 428743a9b06cc09b4eb4dd3e7794d45d13457fb8
Author: Campbell Barton
Date:   Wed Jul 18 23:09:31 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB428743a9b06cc09b4eb4dd3e7794d45d13457fb8

Cleanup: style for GPU module

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

M	source/blender/gpu/GPU_batch.h
M	source/blender/gpu/GPU_context.h
M	source/blender/gpu/GPU_element.h
M	source/blender/gpu/GPU_framebuffer.h
M	source/blender/gpu/GPU_immediate.h
M	source/blender/gpu/GPU_material.h
M	source/blender/gpu/GPU_shader.h
M	source/blender/gpu/GPU_shader_interface.h
M	source/blender/gpu/GPU_state.h
M	source/blender/gpu/GPU_vertex_array_id.h
M	source/blender/gpu/GPU_vertex_buffer.h
M	source/blender/gpu/GPU_vertex_format.h
M	source/blender/gpu/intern/gpu_attr_binding.c
M	source/blender/gpu/intern/gpu_basic_shader.c
M	source/blender/gpu/intern/gpu_batch.c
M	source/blender/gpu/intern/gpu_buffers.c
M	source/blender/gpu/intern/gpu_codegen.c
M	source/blender/gpu/intern/gpu_draw.c
M	source/blender/gpu/intern/gpu_element.c
M	source/blender/gpu/intern/gpu_framebuffer.c
M	source/blender/gpu/intern/gpu_immediate.c
M	source/blender/gpu/intern/gpu_immediate_util.c
M	source/blender/gpu/intern/gpu_material.c
M	source/blender/gpu/intern/gpu_matrix.c
M	source/blender/gpu/intern/gpu_select.c
M	source/blender/gpu/intern/gpu_shader.c
M	source/blender/gpu/intern/gpu_shader_interface.c
M	source/blender/gpu/intern/gpu_state.c
M	source/blender/gpu/intern/gpu_texture.c
M	source/blender/gpu/intern/gpu_vertex_buffer.c
M	source/blender/gpu/intern/gpu_vertex_format.c

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

diff --git a/source/blender/gpu/GPU_batch.h b/source/blender/gpu/GPU_batch.h
index bd0e3b43e6c..bb67a90d619 100644
--- a/source/blender/gpu/GPU_batch.h
+++ b/source/blender/gpu/GPU_batch.h
@@ -51,15 +51,15 @@ typedef enum {
 
 typedef struct GPUBatch {
 	/* geometry */
-	GPUVertBuf* verts[GPU_BATCH_VBO_MAX_LEN]; /* verts[0] is required, others can be NULL */
-	GPUVertBuf* inst; /* instance attribs */
-	GPUIndexBuf* elem; /* NULL if element list not needed */
+	GPUVertBuf *verts[GPU_BATCH_VBO_MAX_LEN]; /* verts[0] is required, others can be NULL */
+	GPUVertBuf *inst; /* instance attribs */
+	GPUIndexBuf *elem; /* NULL if element list not needed */
 	uint32_t gl_prim_type;
 
 	/* cached values (avoid dereferencing later) */
 	uint32_t vao_id;
 	uint32_t program;
-	const struct GPUShaderInterface* interface;
+	const struct GPUShaderInterface *interface;
 
 	/* book-keeping */
 	uint owns_flag;
@@ -74,21 +74,21 @@ typedef struct GPUBatch {
 	union {
 		/* Static handle count */
 		struct {
-			const struct GPUShaderInterface* interfaces[GPU_BATCH_VAO_STATIC_LEN];
+			const struct GPUShaderInterface *interfaces[GPU_BATCH_VAO_STATIC_LEN];
 			uint32_t vao_ids[GPU_BATCH_VAO_STATIC_LEN];
 		} static_vaos;
 		/* Dynamic handle count */
 		struct {
 			uint count;
-			const struct GPUShaderInterface** interfaces;
-			uint32_t* vao_ids;
+			const struct GPUShaderInterface **interfaces;
+			uint32_t *vao_ids;
 		} dynamic_vaos;
 	};
 
 	/* XXX This is the only solution if we want to have some data structure using
 	 * batches as key to identify nodes. We must destroy these nodes with this callback. */
-	void (*free_callback)(struct GPUBatch*, void*);
-	void* callback_data;
+	void (*free_callback)(struct GPUBatch *, void *);
+	void *callback_data;
 } GPUBatch;
 
 enum {
@@ -98,55 +98,55 @@ enum {
 	GPU_BATCH_OWNS_INDEX = (1 << 31),
 };
 
-GPUBatch* GPU_batch_create_ex(GPUPrimType, GPUVertBuf*, GPUIndexBuf*, uint owns_flag);
-void GPU_batch_init_ex(GPUBatch*, GPUPrimType, GPUVertBuf*, GPUIndexBuf*, uint owns_flag);
-GPUBatch* GPU_batch_duplicate(GPUBatch* batch_src);
+GPUBatch *GPU_batch_create_ex(GPUPrimType, GPUVertBuf *, GPUIndexBuf *, uint owns_flag);
+void GPU_batch_init_ex(GPUBatch *, GPUPrimType, GPUVertBuf *, GPUIndexBuf *, uint owns_flag);
+GPUBatch *GPU_batch_duplicate(GPUBatch *batch_src);
 
 #define GPU_batch_create(prim, verts, elem) \
 	GPU_batch_create_ex(prim, verts, elem, 0)
 #define GPU_batch_init(batch, prim, verts, elem) \
 	GPU_batch_init_ex(batch, prim, verts, elem, 0)
 
-void GPU_batch_discard(GPUBatch*); /* verts & elem are not discarded */
+void GPU_batch_discard(GPUBatch *); /* verts & elem are not discarded */
 
-void GPU_batch_vao_cache_clear(GPUBatch*);
+void GPU_batch_vao_cache_clear(GPUBatch *);
 
-void GPU_batch_callback_free_set(GPUBatch*, void (*callback)(GPUBatch*, void*), void*);
+void GPU_batch_callback_free_set(GPUBatch *, void (*callback)(GPUBatch *, void *), void *);
 
-void GPU_batch_instbuf_set(GPUBatch*, GPUVertBuf*, bool own_vbo); /* Instancing */
+void GPU_batch_instbuf_set(GPUBatch *, GPUVertBuf *, bool own_vbo); /* Instancing */
 
-int GPU_batch_vertbuf_add_ex(GPUBatch*, GPUVertBuf*, bool own_vbo);
+int GPU_batch_vertbuf_add_ex(GPUBatch *, GPUVertBuf *, bool own_vbo);
 
 #define GPU_batch_vertbuf_add(batch, verts) \
 	GPU_batch_vertbuf_add_ex(batch, verts, false)
 
-void GPU_batch_program_set_no_use(GPUBatch*, uint32_t program, const GPUShaderInterface*);
-void GPU_batch_program_set(GPUBatch*, uint32_t program, const GPUShaderInterface*);
+void GPU_batch_program_set_no_use(GPUBatch *, uint32_t program, const GPUShaderInterface *);
+void GPU_batch_program_set(GPUBatch *, uint32_t program, const GPUShaderInterface *);
 void GPU_batch_program_set_builtin(GPUBatch *batch, GPUBuiltinShader shader_id);
 /* Entire batch draws with one shader program, but can be redrawn later with another program. */
 /* Vertex shader's inputs must be compatible with the batch's vertex format. */
 
-void GPU_batch_program_use_begin(GPUBatch*); /* call before Batch_Uniform (temp hack?) */
-void GPU_batch_program_use_end(GPUBatch*);
-
-void GPU_batch_uniform_1ui(GPUBatch*, const char* name, int value);
-void GPU_batch_uniform_1i(GPUBatch*, const char* name, int value);
-void GPU_batch_uniform_1b(GPUBatch*, const char* name, bool value);
-void GPU_batch_uniform_1f(GPUBatch*, const char* name, float value);
-void GPU_batch_uniform_2f(GPUBatch*, const char* name, float x, float y);
-void GPU_batch_uniform_3f(GPUBatch*, const char* name, float x, float y, float z);
-void GPU_batch_uniform_4f(GPUBatch*, const char* name, float x, float y, float z, float w);
-void GPU_batch_uniform_2fv(GPUBatch*, const char* name, const float data[2]);
-void GPU_batch_uniform_3fv(GPUBatch*, const char* name, const float data[3]);
-void GPU_batch_uniform_4fv(GPUBatch*, const char* name, const float data[4]);
-void GPU_batch_uniform_2fv_array(GPUBatch*, const char* name, int len, const float *data);
-void GPU_batch_uniform_4fv_array(GPUBatch*, const char* name, int len, const float *data);
-void GPU_batch_uniform_mat4(GPUBatch*, const char* name, const float data[4][4]);
-
-void GPU_batch_draw(GPUBatch*);
+void GPU_batch_program_use_begin(GPUBatch *); /* call before Batch_Uniform (temp hack?) */
+void GPU_batch_program_use_end(GPUBatch *);
+
+void GPU_batch_uniform_1ui(GPUBatch *, const char *name, int value);
+void GPU_batch_uniform_1i(GPUBatch *, const char *name, int value);
+void GPU_batch_uniform_1b(GPUBatch *, const char *name, bool value);
+void GPU_batch_uniform_1f(GPUBatch *, const char *name, float value);
+void GPU_batch_uniform_2f(GPUBatch *, const char *name, float x, float y);
+void GPU_batch_uniform_3f(GPUBatch *, const char *name, float x, float y, float z);
+void GPU_batch_uniform_4f(GPUBatch *, const char *name, float x, float y, float z, float w);
+void GPU_batch_uniform_2fv(GPUBatch *, const char *name, const float data[2]);
+void GPU_batch_uniform_3fv(GPUBatch *, const char *name, const float data[3]);
+void GPU_batch_uniform_4fv(GPUBatch *, const char *name, const float data[4]);
+void GPU_batch_uniform_2fv_array(GPUBatch *, const char *name, int len, const float *data);
+void GPU_batch_uniform_4fv_array(GPUBatch *, const char *name, int len, const float *data);
+void GPU_batch_uniform_mat4(GPUBatch *, const char *name, const float data[4][4]);
+
+void GPU_batch_draw(GPUBatch *);
 
 /* This does not bind/unbind shader and does not call GPU_matrix_bind() */
-void GPU_batch_draw_range_ex(GPUBatch*, int v_first, int v_count, bool force_instance);
+void GPU_batch_draw_range_ex(GPUBatch *, int v_first, int v_count, bool force_instance);
 
 /* Does not even need batch */
 void GPU_draw_primitive(GPUPrimType, int v_count);
@@ -175,12 +175,12 @@ typedef struct BatchWithOwnVertexBufferAndElementList {
 	GPUVertBuf verts; /* link batch.verts to this */
 } BatchWithOwnVertexBufferAndElementList;
 
-GPUBatch* create_BatchWithOwnVertexBuffer(GPUPrimType, GPUVertFormat*, uint v_len, GPUIndexBuf*);
-GPUBatch* create_BatchWithOwnElementList(GPUPrimType, GPUVertBuf*, uint prim_len);
-GPUBatch* create_BatchWithOwnVertexBufferAndElementList(GPUPrimType, GPUVertFormat*, uint v_len, uint prim_len);
+GPUBatch *create_BatchWithOwnVertexBuffer(GPUPrimType, GPUVertFormat *, uint v_len, GPUIndexBuf *);
+GPUBatch *create_BatchWithOwnElementList(GPUPrimType, GPUVertBuf *, uint prim_len);
+GPUBatch *create_BatchWithOwnVertexBufferAndElementList(GPUPrimType, GPUVertFormat *, uint v_len, uint prim_len);
 /* verts: shared, own */
 /* elem: none, shared, own */
-GPUBatch* create_BatchInGeneral(GPUPrimType, VertexBufferStuff, ElementListStuff);
+GPUBatch *create_BatchInGeneral(GPUPrimType, VertexBufferStuff, ElementListStuff);
 
 #endif /* future plans */
 
diff --git a/source/blender/gpu/GPU_context.h b/source/blender/gpu/GPU_context.h
index 5f63c408801..3e32b64b281 100644
--- a/source/blender/gpu/GPU_context.h
+++ b/source/blender/gpu/GPU_context.h
@@ -42,11 +42,11 @@ extern "C" {
 
 typedef struct GPUContext GPUContext;
 
-GPUContext* GPU_context_create(void);
-void GPU_context_discard(GPUContext*);
+GPUContext *GPU_context_create(void);
+void GPU_context_discard(GPUContext *);
 
-void GPU_context_active_set(GPUContext*);
-GPUContext* GPU_context_active_get(void);
+void GPU_context_active_set(GPUContext *);
+GPUContext *GPU_context_active_get(void);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/gpu/GPU_element.h b/source/blender/gpu/GPU_element.h
index 508c079fcd3..adc705ab641 100644
--- a/source/blender/gpu/GPU_element.h
+++ b/source/blender/gpu/GPU_element.h
@@ -57,37 +57,37 @@ typedef struct GPUIndexBuf {
 	bool use_prim_restart;
 } GPUIndexBuf;
 
-void GPU_indexbuf_use(GPUIndexBuf*);
-uint GPU_indexbuf_size_get(const GPUIndexBuf*);
+void GPU_indexbuf_use(GPUIndexBuf *);
+uint GPU_indexbuf_size_get(const GPUIndexBuf *);
 
 typedef struct GPUIndexBufBuilder {
 	uint max_allowed_index;
 	uint max_index_len;
 	uint index_len;
 	GPUPrimType prim_type;
-	uint* data;
+	uint *data;
 	bool use_prim_restart;
 } GPUIndexBufBuilder;
 
 
 /* supports all primitive types. */
-void GPU_indexbuf_init_ex(GPUIndexBufBuilder*, GPUPrimType, uint index_len, uint vertex_len, bool use_prim_restart);
+void GPU_indexbuf_init_ex(GPUIndexBufBuilder *, GPUPrimType, uint index_len, uint vertex_len, bool use_prim_restart);
 
 /* supports only GPU_PRIM_POINTS, GPU_PRIM_LINES and GPU_PRIM_TRIS. */
-void GPU_indexbuf_init(GPUIndexBufBuilder*, GPUPrimType, uint prim_len, uint vertex_len);
+void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len);
 
-void GPU_indexbuf_add_generic_vert(GPUIndexBufBuilder*, uint v);
-void GPU_indexbuf_add_primitive_restart(GPUIndexBufBuilder*);
+void GPU_indexbuf_add_generic_vert(GPUIndexBufBuilder *, uint v);
+void GPU_indexbuf_add_primitive_restart(GPUIndexBufBuilder *);
 
-void GPU_indexbuf_add_point_vert(GPUIndexBufBuilder*, uint v);
-void GPU_indexbuf_add_line_verts(GPUIndexBufBuilder*, uint v1, uint v2);
-void GPU_indexbuf_add_tri_verts(GPUIndexBufBuilder*, uint v1, uint v2, uint v3);
-void GPU_indexbuf_add_line_adj_verts(GPUIndexBufBuilder*, uint v1, uint v2, uint v3, uint v4);
+void GPU_indexbuf_add_point_vert(GPUIndexBufB

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list