[Bf-blender-cvs] [5b10412] GPU_data_request: cleanup: code style

Mike Erwin noreply at git.blender.org
Sat Mar 21 07:07:25 CET 2015


Commit: 5b10412103c247b16dde8b0cb6ac38394bc74f4b
Author: Mike Erwin
Date:   Sat Mar 21 02:06:54 2015 -0400
Branches: GPU_data_request
https://developer.blender.org/rB5b10412103c247b16dde8b0cb6ac38394bc74f4b

cleanup: code style

C-style comments, braces & pointer placement.

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

M	source/blender/gpu/GPUx_draw.h
M	source/blender/gpu/GPUx_element.h
M	source/blender/gpu/GPUx_state.h
M	source/blender/gpu/GPUx_vbo.h
M	source/blender/gpu/intern/GPUx_element_private.h
M	source/blender/gpu/intern/gpux_draw.c
M	source/blender/gpu/intern/gpux_element.c
M	source/blender/gpu/intern/gpux_state.c
M	source/blender/gpu/intern/gpux_vbo.c

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

diff --git a/source/blender/gpu/GPUx_draw.h b/source/blender/gpu/GPUx_draw.h
index 219159c..ffbbdc2 100644
--- a/source/blender/gpu/GPUx_draw.h
+++ b/source/blender/gpu/GPUx_draw.h
@@ -1,19 +1,19 @@
 #ifndef BLENDER_GL_DRAW_PRIMITIVES
 #define BLENDER_GL_DRAW_PRIMITIVES
 
-// Stateless draw functions for lists of primitives.
-// Mike Erwin, Dec 2014
+/* Stateless draw functions for lists of primitives.
+ * Mike Erwin, Dec 2014 */
 
 #include "GPUx_state.h"
 #include "GPUx_vbo.h"
 #include "GPUx_element.h"
 
-// pass ElementList = NULL to draw all vertices from VertexBuffer in order
+/* pass ElementList = NULL to draw all vertices from VertexBuffer in order */
 void draw_points(const CommonDrawState*, const PointDrawState*, const VertexBuffer*, const ElementList*);
 void draw_lines(const CommonDrawState*, const LineDrawState*, const VertexBuffer*, const ElementList*);
 void draw_triangles(const CommonDrawState*, const PolygonDrawState*, const VertexBuffer*, const ElementList*);
 
-// generic version uses ElementList's primitive type
-void draw_primitives(const CommonDrawState*, const void* primitive_state, const VertexBuffer*, const ElementList*);
+/* generic version uses ElementList's primitive type */
+void draw_primitives(const CommonDrawState*, const void *primitive_state, const VertexBuffer*, const ElementList*);
 
-#endif // BLENDER_GL_DRAW_PRIMITIVES
+#endif /* BLENDER_GL_DRAW_PRIMITIVES */
diff --git a/source/blender/gpu/GPUx_element.h b/source/blender/gpu/GPUx_element.h
index e5bc407..2bf61b8 100644
--- a/source/blender/gpu/GPUx_element.h
+++ b/source/blender/gpu/GPUx_element.h
@@ -1,24 +1,24 @@
 #ifndef BLENDER_GL_ELEMENT_LIST
 #define BLENDER_GL_ELEMENT_LIST
 
-// Element lists specify which vertices to use when drawing point,
-// line, or triangle primiitives. They don't care how the per-vertex
-// data (attributes) are laid out, only *which* vertices are used.
-// Mike Erwin, Dec 2014
+/* Element lists specify which vertices to use when drawing point,
+ * line, or triangle primiitives. They don't care how the per-vertex
+ * data (attributes) are laid out, only *which* vertices are used.
+ * Mike Erwin, Dec 2014 */
 
 #include "GPU_glew.h"
-// ^-- for GLenum (and if you're including this file, you're probably calling OpenGL anyway)
+/* ^-- for GLenum (and if you're including this file, you're probably calling OpenGL anyway) */
 
-struct ElementList; // forward declaration
+struct ElementList; /* forward declaration */
 typedef struct ElementList ElementList;
 
-ElementList* create_element_list(GLenum prim_type, unsigned prim_ct, unsigned max_index);
+ElementList *create_element_list(GLenum prim_type, unsigned prim_ct, unsigned max_index);
 void discard_element_list(ElementList*);
 
 void set_point_vertex(ElementList*, unsigned prim_idx, unsigned v1);
 void set_line_vertices(ElementList*, unsigned prim_idx, unsigned v1, unsigned v2);
 void set_triangle_vertices(ElementList*, unsigned prim_idx, unsigned v1, unsigned v2, unsigned v3);
 
-void optimize(ElementList*); // optionally call this after setting all vertex indices
+void optimize(ElementList*); /* optionally call this after setting all vertex indices */
 
-#endif // BLENDER_GL_ELEMENT_LIST
+#endif /* BLENDER_GL_ELEMENT_LIST */
diff --git a/source/blender/gpu/GPUx_state.h b/source/blender/gpu/GPUx_state.h
index 7090310..a05aa93 100644
--- a/source/blender/gpu/GPUx_state.h
+++ b/source/blender/gpu/GPUx_state.h
@@ -1,41 +1,37 @@
 #ifndef BLENDER_GL_STATE
 #define BLENDER_GL_STATE
 
-// Two goals:
-// -- batch draws by state so we don't have to "switch gears" as often
-// -- track current draw state internally so we don't have to bother the GL as often
-// Mike Erwin, Dec 2014
+/* Two goals:
+ * -- batch draws by state so we don't have to "switch gears" as often
+ * -- track current draw state internally so we don't have to bother the GL as often
+ * Mike Erwin, Dec 2014 */
 
 #include <stdbool.h>
 
-typedef struct
-	{
-	bool blend; // + src & dst of glBlendFunc
+typedef struct {
+	bool blend; /* plus src & dst of glBlendFunc? */
 	bool depth_test;
 	bool depth_write;
 	bool lighting;
-	} CommonDrawState;
+} CommonDrawState;
 
-typedef struct
-	{
-	bool smooth; // implies blend / transparency. Disable depth write! (p179 of AGPUO)
+typedef struct {
+	bool smooth; /* implies blend / transparency. Disable depth write! (p179 of AGPUO) */
 	float size;
-	} PointDrawState;
+} PointDrawState;
 
-typedef struct
-	{
-	bool smooth; // implies blend / transparency. Disable depth write! (p179 of AGPUO)
+typedef struct {
+	bool smooth; /* implies blend / transparency. Disable depth write! (p179 of AGPUO) */
 	float width;
-	int stipple; // = 0 for don't
-	} LineDrawState;
+	int stipple; /* = 0 for don't */
+} LineDrawState;
 
-typedef struct PolygonDrawState
-	{
+typedef struct PolygonDrawState {
 	bool draw_front;
 	bool draw_back;
 	int material_id;
-	int stipple; // = 0 for don't
-	} PolygonDrawState;
+	int stipple; /* = 0 for don't */
+} PolygonDrawState;
 
 #define MATERIAL_NONE -1
 
@@ -46,4 +42,4 @@ void set_point_state(const PointDrawState*);
 void set_line_state(const LineDrawState*);
 void set_polygon_state(const PolygonDrawState*);
 
-#endif // BLENDER_GL_STATE
+#endif /* BLENDER_GL_STATE */
diff --git a/source/blender/gpu/GPUx_vbo.h b/source/blender/gpu/GPUx_vbo.h
index 6ce1da2..b9d033a 100644
--- a/source/blender/gpu/GPUx_vbo.h
+++ b/source/blender/gpu/GPUx_vbo.h
@@ -1,65 +1,63 @@
 #ifndef BLENDER_GL_VERTEX_BUFFER
 #define BLENDER_GL_VERTEX_BUFFER
 
-// vertex buffer support
-// Mike Erwin, Nov 2014
+/* vertex buffer support
+ * Mike Erwin, Nov 2014 */
 
 #include "GPU_glew.h"
-// ^-- for GLenum (and if you're including this file, you're probably calling OpenGL anyway)
+/* ^-- for GLenum (and if you're including this file, you're probably calling OpenGL anyway) */
 #include <stdbool.h>
 
 #define TRUST_NO_ONE true
 #define PRINT false
 
-struct VertexBuffer; // forward declaration
+struct VertexBuffer; /* forward declaration */
 typedef struct VertexBuffer VertexBuffer;
 
-typedef enum
-	{
+typedef enum {
 	KEEP_FLOAT,
-	KEEP_INT, // requires EXT_gpu_shader4
-	NORMALIZE_INT_TO_FLOAT, // 127 (ubyte) -> 0.5 (and so on for other int types)
-	CONVERT_INT_TO_FLOAT // 127 (any int type) -> 127.0
-	} VertexFetchMode;
+	KEEP_INT, /* requires EXT_gpu_shader4 */
+	NORMALIZE_INT_TO_FLOAT, /* 127 (ubyte) -> 0.5 (and so on for other int types) */
+	CONVERT_INT_TO_FLOAT /* 127 (any int type) -> 127.0 */
+} VertexFetchMode;
 
 VertexBuffer* vertex_buffer_create(unsigned attrib_ct, unsigned vertex_ct);
 void vertex_buffer_discard(VertexBuffer*);
 
-// how many vertices?
 unsigned vertex_ct(const VertexBuffer*);
 
 #if PRINT
 void attrib_print(const VertexBuffer*, unsigned attrib_num);
-#endif // PRINT
+#endif /* PRINT */
 
-void specify_attrib(VertexBuffer*, unsigned attrib_num, const char* name, GLenum comp_type, unsigned comp_ct, VertexFetchMode);
+void specify_attrib(VertexBuffer*, unsigned attrib_num, const char *name, GLenum comp_type, unsigned comp_ct, VertexFetchMode);
 
-// set value of single attribute of single vertex
-// incoming data must be of same type & size for this attribute
-void set_attrib(VertexBuffer*, unsigned attrib_num, unsigned vertex_num, const void* data);
-// convenience function for specific type and size
-// can add more like this if it's useful
+/* set value of single attribute of single vertex
+ * incoming data must be of same type & size for this attribute */
+void set_attrib(VertexBuffer*, unsigned attrib_num, unsigned vertex_num, const void *data);
+/* convenience function for specific type and size
+ * can add more like this if it's useful */
 void set_attrib_3f(VertexBuffer*, unsigned attrib_num, unsigned vertex_num, float x, float y, float z);
 
-// bulk attribute filling routines (all vertices)
-// incoming data must be of same type & size for this attribute
-// must be tightly packed in memory, no padding
-void fill_attrib(VertexBuffer*, unsigned attrib_num, const void* data);
-// this version can have padding between attributes
-void fill_attrib_stride(VertexBuffer*, unsigned attrib_num, const void* data, unsigned stride);
+/* bulk attribute filling routines (all vertices)
+ * incoming data must be of same type & size for this attribute
+ * must be tightly packed in memory, no padding */
+void fill_attrib(VertexBuffer*, unsigned attrib_num, const void *data);
+/* this version can have padding between attributes */
+void fill_attrib_stride(VertexBuffer*, unsigned attrib_num, const void *data, unsigned stride);
 
-// call before drawing to make this vertex buffer part of current OpenGL state
+/* call before drawing to make this vertex buffer part of current OpenGL state */
 void vertex_buffer_use(VertexBuffer*);
-// call after drawing
+/* call after drawing */
 void vertex_buffer_done_using(const VertexBuffer*);
 
-// alternative to vertex_buffer_use:
-// prime does all the setup (create VBOs, send to GPU, etc.) so use_primed doesn't have to
+/* alternative to vertex_buffer_use:
+ * prime does all the setup (create VBOs, send to GPU, etc.) so use_primed doesn't have to */
 void vertex_buffer_prime(VertexBuffer*);
 void vertex_buffer_use_primed(const VertexBuffer*);
-// prime, use_primed, done_using, use_primed, done_using ...
-// use, done_using, use, done_using ... (first use auto-primes)
-// 'use' modifies VAO and VBO IDs on first run, so is non-const (no 'mutable' in C)
-// this was primary motivation for splitting into two functions
+/* prime, use_primed, done_using, use_primed, done_using ...
+ * use, done_using, use, done_using ... (first use auto-primes)
+ * 'use' modifies VAO and VBO IDs on first run, so is non-const (no 'mutable' in C)
+ * this was primary motivation for splitting into two functions */
 
-#endif // BLENDER_GL_VERTEX_BUFFER
+#endif /* BLENDER_GL_VERTEX_BUFFER */
diff --git a/source/blender/gpu/intern/GPUx_element_private.h b/source/blender/gpu/intern/GPUx_element_private.h
index 712618d..e68b9db 100644
--- a/source/blender/gpu/intern/GPUx_element_private.h
+++ b/source/blender/gpu/intern/GPUx_element_private.h
@@ -3,25 +3,24 @@
 
 #include "GPUx_element.h"
 
-// track min & max observed index (for glDrawRangeElements)
+/* track min & ma

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list