[Bf-blender-cvs] [b4d053efc75] blender2.8: Gawain API naming refactor

Campbell Barton noreply at git.blender.org
Mon Jun 19 12:15:27 CEST 2017


Commit: b4d053efc75424fca4b413ac1bc7a7e826fac629
Author: Campbell Barton
Date:   Mon Jun 19 20:18:04 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBb4d053efc75424fca4b413ac1bc7a7e826fac629

Gawain API naming refactor

Use consistent prefix for gawain API names as well as
some abbreviations to avoid over-long names, see: D2678

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

M	intern/gawain/gawain/attrib_binding.h
M	intern/gawain/gawain/attrib_binding_private.h
M	intern/gawain/gawain/batch.h
M	intern/gawain/gawain/buffer_id.h
M	intern/gawain/gawain/element.h
M	intern/gawain/gawain/immediate.h
M	intern/gawain/gawain/primitive.h
M	intern/gawain/gawain/primitive_private.h
M	intern/gawain/gawain/shader_interface.h
M	intern/gawain/gawain/vertex_buffer.h
M	intern/gawain/gawain/vertex_format.h
M	intern/gawain/gawain/vertex_format_private.h
M	intern/gawain/src/attrib_binding.c
M	intern/gawain/src/batch.c
M	intern/gawain/src/buffer_id.cpp
M	intern/gawain/src/element.c
M	intern/gawain/src/imm_util.c
M	intern/gawain/src/immediate.c
M	intern/gawain/src/primitive.c
M	intern/gawain/src/shader_interface.c
M	intern/gawain/src/vertex_buffer.c
M	intern/gawain/src/vertex_format.c
M	source/blender/blenfont/intern/blf.c
M	source/blender/blenfont/intern/blf_font.c
M	source/blender/blenkernel/BKE_animsys.h
M	source/blender/blenkernel/BKE_pbvh.h
M	source/blender/blenkernel/intern/DerivedMesh.c
M	source/blender/blenkernel/intern/cdderivedmesh.c
M	source/blender/blenkernel/intern/cloth.c
M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/collada/MeshImporter.cpp
M	source/blender/draw/engines/basic/basic_engine.c
M	source/blender/draw/engines/clay/clay_engine.c
M	source/blender/draw/engines/eevee/eevee_effects.c
M	source/blender/draw/engines/eevee/eevee_engine.c
M	source/blender/draw/engines/eevee/eevee_lightprobes.c
M	source/blender/draw/engines/eevee/eevee_lights.c
M	source/blender/draw/engines/eevee/eevee_materials.c
M	source/blender/draw/engines/eevee/eevee_private.h
M	source/blender/draw/engines/external/external_engine.c
M	source/blender/draw/intern/DRW_render.h
M	source/blender/draw/intern/draw_armature.c
M	source/blender/draw/intern/draw_cache.c
M	source/blender/draw/intern/draw_cache.h
M	source/blender/draw/intern/draw_cache_impl.h
M	source/blender/draw/intern/draw_cache_impl_curve.c
M	source/blender/draw/intern/draw_cache_impl_displist.c
M	source/blender/draw/intern/draw_cache_impl_lattice.c
M	source/blender/draw/intern/draw_cache_impl_mesh.c
M	source/blender/draw/intern/draw_cache_impl_particles.c
M	source/blender/draw/intern/draw_common.c
M	source/blender/draw/intern/draw_common.h
M	source/blender/draw/intern/draw_manager.c
M	source/blender/draw/intern/draw_view.c
M	source/blender/draw/modes/edit_curve_mode.c
M	source/blender/draw/modes/edit_lattice_mode.c
M	source/blender/draw/modes/edit_mesh_mode.c
M	source/blender/draw/modes/edit_metaball_mode.c
M	source/blender/draw/modes/edit_surface_mode.c
M	source/blender/draw/modes/edit_text_mode.c
M	source/blender/draw/modes/object_mode.c
M	source/blender/draw/modes/paint_texture_mode.c
M	source/blender/draw/modes/paint_vertex_mode.c
M	source/blender/draw/modes/paint_weight_mode.c
M	source/blender/draw/modes/particle_mode.c
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/animation/anim_draw.c
M	source/blender/editors/animation/anim_markers.c
M	source/blender/editors/animation/keyframes_draw.c
M	source/blender/editors/armature/editarmature_sketch.c
M	source/blender/editors/curve/editcurve_paint.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/gpencil/gpencil_brush.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/include/ED_keyframes_draw.h
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/interface/interface_panel.c
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/interface/view2d.c
M	source/blender/editors/manipulator_library/arrow2d_manipulator.c
M	source/blender/editors/manipulator_library/arrow3d_manipulator.c
M	source/blender/editors/manipulator_library/cage2d_manipulator.c
M	source/blender/editors/manipulator_library/dial3d_manipulator.c
M	source/blender/editors/manipulator_library/grab3d_manipulator.c
M	source/blender/editors/manipulator_library/manipulator_draw_utils.c
M	source/blender/editors/manipulator_library/primitive3d_manipulator.c
M	source/blender/editors/mask/mask_draw.c
M	source/blender/editors/mesh/editmesh_knife.c
M	source/blender/editors/mesh/editmesh_loopcut.c
M	source/blender/editors/physics/particle_edit.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/screen/glutil.c
M	source/blender/editors/screen/screen_draw.c
M	source/blender/editors/screen/screendump.c
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/sculpt_paint/paint_stroke.c
M	source/blender/editors/sculpt_paint/sculpt_uv.c
M	source/blender/editors/space_action/action_draw.c
M	source/blender/editors/space_clip/clip_dopesheet_draw.c
M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_clip/clip_graph_draw.c
M	source/blender/editors/space_clip/clip_utils.c
M	source/blender/editors/space_console/console_draw.c
M	source/blender/editors/space_file/file_draw.c
M	source/blender/editors/space_graph/graph_draw.c
M	source/blender/editors/space_graph/space_graph.c
M	source/blender/editors/space_image/image_draw.c
M	source/blender/editors/space_info/textview.c
M	source/blender/editors/space_nla/nla_draw.c
M	source/blender/editors/space_node/drawnode.c
M	source/blender/editors/space_node/node_draw.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/editors/space_text/text_draw.c
M	source/blender/editors/space_time/space_time.c
M	source/blender/editors/space_view3d/drawanimviz.c
M	source/blender/editors/space_view3d/drawarmature.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/drawsimdebug.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_fly.c
M	source/blender/editors/space_view3d/view3d_intern.h
M	source/blender/editors/space_view3d/view3d_ruler.c
M	source/blender/editors/space_view3d/view3d_walk.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_constraints.c
M	source/blender/editors/transform/transform_generics.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/editors/util/ed_util.c
M	source/blender/editors/uvedit/uvedit_draw.c
M	source/blender/editors/uvedit/uvedit_smart_stitch.c
M	source/blender/gpu/GPU_batch.h
M	source/blender/gpu/GPU_buffers.h
M	source/blender/gpu/GPU_immediate_util.h
M	source/blender/gpu/GPU_matrix.h
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_compositing.c
M	source/blender/gpu/intern/gpu_draw.c
M	source/blender/gpu/intern/gpu_framebuffer.c
M	source/blender/gpu/intern/gpu_immediate_util.c
M	source/blender/gpu/intern/gpu_matrix.c
M	source/blender/gpu/intern/gpu_shader.c
M	source/blender/gpu/intern/gpu_shader_private.h
M	source/blender/gpu/intern/gpu_viewport.c
M	source/blender/windowmanager/intern/wm_draw.c
M	source/blender/windowmanager/intern/wm_gesture.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/intern/wm_playanim.c
M	source/blender/windowmanager/intern/wm_stereo.c

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

diff --git a/intern/gawain/gawain/attrib_binding.h b/intern/gawain/gawain/attrib_binding.h
index 8c372c81cc7..a254f05dc05 100644
--- a/intern/gawain/gawain/attrib_binding.h
+++ b/intern/gawain/gawain/attrib_binding.h
@@ -16,4 +16,4 @@
 typedef struct {
 	uint64_t loc_bits; // store 4 bits for each of the 16 attribs
 	uint16_t enabled_bits; // 1 bit for each attrib
-} AttribBinding;
+} Gwn_AttrBinding;
diff --git a/intern/gawain/gawain/attrib_binding_private.h b/intern/gawain/gawain/attrib_binding_private.h
index c9b7a3f2c01..53fdecff9ce 100644
--- a/intern/gawain/gawain/attrib_binding_private.h
+++ b/intern/gawain/gawain/attrib_binding_private.h
@@ -14,7 +14,7 @@
 #include "vertex_format.h"
 #include "shader_interface.h"
 
-void AttribBinding_clear(AttribBinding*);
+void AttribBinding_clear(Gwn_AttrBinding*);
 
-void get_attrib_locations(const VertexFormat*, AttribBinding*, const ShaderInterface*);
-unsigned read_attrib_location(const AttribBinding*, unsigned a_idx);
+void get_attrib_locations(const Gwn_VertFormat*, Gwn_AttrBinding*, const Gwn_ShaderInterface*);
+unsigned read_attrib_location(const Gwn_AttrBinding*, unsigned a_idx);
diff --git a/intern/gawain/gawain/batch.h b/intern/gawain/gawain/batch.h
index 33a1c1b653c..6e2f32c1996 100644
--- a/intern/gawain/gawain/batch.h
+++ b/intern/gawain/gawain/batch.h
@@ -16,64 +16,64 @@
 #include "shader_interface.h"
 
 typedef enum {
-	READY_TO_FORMAT,
-	READY_TO_BUILD,
-	BUILDING,
-	READY_TO_DRAW
-} BatchPhase;
+	GWN_BATCH_READY_TO_FORMAT,
+	GWN_BATCH_READY_TO_BUILD,
+	GWN_BATCH_BUILDING,
+	GWN_BATCH_READY_TO_DRAW
+} Gwn_BatchPhase;
 
-#define BATCH_MAX_VBO_CT 3
+#define GWN_BATCH_VBO_MAX_LEN 3
 
-typedef struct Batch {
+typedef struct Gwn_Batch {
 	// geometry
-	VertexBuffer* verts[BATCH_MAX_VBO_CT]; // verts[0] is required, others can be NULL
-	ElementList* elem; // NULL if element list not needed
-	PrimitiveType prim_type;
+	Gwn_VertBuf* verts[GWN_BATCH_VBO_MAX_LEN]; // verts[0] is required, others can be NULL
+	Gwn_IndexBuf* elem; // NULL if element list not needed
+	Gwn_PrimType prim_type;
 	GLenum gl_prim_type;
 
 	// book-keeping
 	GLuint vao_id; // remembers all geometry state (vertex attrib bindings & element buffer)
-	BatchPhase phase;
+	Gwn_BatchPhase phase;
 	bool program_dirty;
 	bool program_in_use;
 
 	// state
 	GLuint program;
-	const ShaderInterface* interface;
-} Batch;
+	const Gwn_ShaderInterface* interface;
+} Gwn_Batch;
 
-Batch* Batch_create(PrimitiveType, VertexBuffer*, ElementList*);
-void Batch_init(Batch*, PrimitiveType, VertexBuffer*, ElementList*);
+Gwn_Batch* GWN_batch_create(Gwn_PrimType, Gwn_VertBuf*, Gwn_IndexBuf*);
+void GWN_batch_init(Gwn_Batch*, Gwn_PrimType, Gwn_VertBuf*, Gwn_IndexBuf*);
 
-void Batch_discard(Batch*); // verts & elem are not discarded
-void Batch_discard_all(Batch*); // including verts & elem
+void GWN_batch_discard(Gwn_Batch*); // verts & elem are not discarded
+void GWN_batch_discard_all(Gwn_Batch*); // including verts & elem
 
-int Batch_add_VertexBuffer(Batch*, VertexBuffer*);
+int GWN_batch_vertbuf_add(Gwn_Batch*, Gwn_VertBuf*);
 
-void Batch_set_program(Batch*, GLuint program, const ShaderInterface*);
+void GWN_batch_program_set(Gwn_Batch*, GLuint program, const Gwn_ShaderInterface*);
 // 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 Batch_use_program(Batch*); // call before Batch_Uniform (temp hack?)
-void Batch_done_using_program(Batch*);
+void GWN_batch_program_use_begin(Gwn_Batch*); // call before Batch_Uniform (temp hack?)
+void GWN_batch_program_use_end(Gwn_Batch*);
 
-void Batch_Uniform1i(Batch*, const char* name, int value);
-void Batch_Uniform1b(Batch*, const char* name, bool value);
-void Batch_Uniform1f(Batch*, const char* name, float value);
-void Batch_Uniform2f(Batch*, const char* name, float x, float y);
-void Batch_Uniform3f(Batch*, const char* name, float x, float y, float z);
-void Batch_Uniform4f(Batch*, const char* name, float x, float y, float z, float w);
-void Batch_Uniform3fv(Batch*, const char* name, const float data[3]);
-void Batch_Uniform4fv(Batch*, const char* name, const float data[4]);
+void GWN_batch_uniform_1i(Gwn_Batch*, const char* name, int value);
+void GWN_batch_uniform_1b(Gwn_Batch*, const char* name, bool value);
+void GWN_batch_uniform_1f(Gwn_Batch*, const char* name, float value);
+void GWN_batch_uniform_2f(Gwn_Batch*, const char* name, float x, float y);
+void GWN_batch_uniform_3f(Gwn_Batch*, const char* name, float x, float y, float z);
+void GWN_batch_uniform_4f(Gwn_Batch*, const char* name, float x, float y, float z, float w);
+void GWN_batch_uniform_3fv(Gwn_Batch*, const char* name, const float data[3]);
+void GWN_batch_uniform_4fv(Gwn_Batch*, const char* name, const float data[4]);
 
-void Batch_draw(Batch*);
+void GWN_batch_draw(Gwn_Batch*);
 
 
 // clement : temp stuff
-void Batch_draw_stupid(Batch*);
-void Batch_draw_stupid_instanced(Batch*, unsigned int instance_vbo, int instance_count,
+void GWN_batch_draw_stupid(Gwn_Batch*);
+void GWN_batch_draw_stupid_instanced(Gwn_Batch*, unsigned int instance_vbo, int instance_count,
                                  int attrib_nbr, int attrib_stride, int attrib_loc[16], int attrib_size[16]);
-void Batch_draw_stupid_instanced_with_batch(Batch*, Batch*);
+void GWN_batch_draw_stupid_instanced_with_batch(Gwn_Batch*, Gwn_Batch*);
 
 
 
@@ -81,49 +81,49 @@ void Batch_draw_stupid_instanced_with_batch(Batch*, Batch*);
 
 #if 0 // future plans
 
-// Can multiple batches share a VertexBuffer? Use ref count?
+// Can multiple batches share a Gwn_VertBuf? Use ref count?
 
 
 // We often need a batch with its own data, to be created and discarded together.
 // WithOwn variants reduce number of system allocations.
 
 typedef struct {
-	Batch batch;
-	VertexBuffer verts; // link batch.verts to this
+	Gwn_Batch batch;
+	Gwn_VertBuf verts; // link batch.verts to this
 } BatchWithOwnVertexBuffer;
 
 typedef struct {
-	Batch batch;
-	ElementList elem; // link batch.elem to this
+	Gwn_Batch batch;
+	Gwn_IndexBuf elem; // link batch.elem to this
 } BatchWithOwnElementList;
 
 typedef struct {
-	Batch batch;
-	ElementList elem; // link batch.elem to this
-	VertexBuffer verts; // link batch.verts to this
+	Gwn_Batch batch;
+	Gwn_IndexBuf elem; // link batch.elem to this
+	Gwn_VertBuf verts; // link batch.verts to this
 } BatchWithOwnVertexBufferAndElementList;
 
-Batch* create_BatchWithOwnVertexBuffer(PrimitiveType, VertexFormat*, unsigned v_ct, ElementList*);
-Batch* create_BatchWithOwnElementList(PrimitiveType, VertexBuffer*, unsigned prim_ct);
-Batch* create_BatchWithOwnVertexBufferAndElementList(PrimitiveType, VertexFormat*, unsigned v_ct, unsigned prim_ct);
+Gwn_Batch* create_BatchWithOwnVertexBuffer(Gwn_PrimType, Gwn_VertFormat*, unsigned v_ct, Gwn_IndexBuf*);
+Gwn_Batch* create_BatchWithOwnElementList(Gwn_PrimType, Gwn_VertBuf*, unsigned prim_ct);
+Gwn_Batch* create_BatchWithOwnVertexBufferAndElementList(Gwn_PrimType, Gwn_VertFormat*, unsigned v_ct, unsigned prim_ct);
 // verts: shared, own
 // elem: none, shared, own
-Batch* create_BatchInGeneral(PrimitiveType, VertexBufferStuff, ElementListStuff);
+Gwn_Batch* create_BatchInGeneral(Gwn_PrimType, VertexBufferStuff, ElementListStuff);
 
 #endif // future plans
 
 
 /* Macros */
 
-#define BATCH_DISCARD_SAFE(batch) do { \
+#define GWN_BATCH_DISCARD_SAFE(batch) do { \
 	if (batch != NULL) { \
-		Batch_discard(batch); \
+		GWN_batch_discard(batch); \
 		batch = NULL; \
 	} \
 } while (0)
 #define BATCH_DISCARD_ALL_SAFE(batch) do { \
 	if (batch != NULL) { \
-		Batch_discard_all(batch); \
+		GWN_batch_discard_all(batch); \
 		batch = NULL; \
 	} \
 } while (0)
diff --git a/intern/gawain/gawain/buffer_id.h b/intern/gawain/gawain/buffer_id.h
index 3f67458d060..e978eec67d8 100644
--- a/intern/gawain/gawain/buffer_id.h
+++ b/intern/gawain/gawain/buffer_id.h
@@ -22,11 +22,11 @@ extern "C" {
 
 #include "common.h"
 
-GLuint buffer_id_alloc(void);
-void buffer_id_free(GLuint buffer_id);
+GLuint GWN_buf_id_alloc(void);
+void GWN_buf_id_free(GLuint buffer_id);
 
-GLuint vao_id_alloc(void);
-void vao_id_free(GLuint vao_id);
+GLuint GWN_vao_alloc(void);
+void GWN_vao_free(GLuint vao_id);
 
 
 #ifdef __cplusplus
diff --git a/intern/gawain/gawain/element.h b/intern/gawain/gawain/element.h
index 0e2ece1d2f1..771462be7c5 100644
--- a/intern/gawain/gawain/element.h
+++ b/intern/gawain/gawain/element.h
@@ -13,18 +13,18 @@
 
 #include "primitive.h"
 
-#define TRACK_INDEX_RANGE 1
+#define GWN_TRACK_INDEX_RANGE 1
 
 typedef enum {
-	INDEX_U8, // GL has this, Vulkan does not
-	INDEX_U16,
-	INDEX_U32
-} IndexType;
+	GWN_INDEX_U8, // GL has this, Vulkan does not
+	GWN_INDEX_U16,
+	GWN_INDEX_U32
+} Gwn_IndexBufType;
 
 typedef struct {
 	unsigned index_ct;
-#if TRACK_INDEX_RANGE
-	IndexType index_type;
+#if GWN_TRACK_INDEX_RANGE
+	Gwn_IndexBufType index_type;
 	GLenum gl_index_type;
 	unsigned min_index;
 	unsigned max_index;
@@ -32,44 +32,44 @@ typedef struct {
 #endif
 	void* data; // NULL indicates data in VRAM (unmapped) or not yet allocated
 	GLuint vbo_id; // 0 indicates not yet sent to VRAM
-} ElementList;
+} Gwn_IndexBuf;
 
-void ElementList_use(ElementList*);
-unsigned ElementList_size(const ElementList*);
+void GWN_indexbuf_use(Gwn_IndexBuf*);
+unsigned GWN_indexbuf_size_get(const Gwn_IndexBuf*);
 
 typedef struct {
 	unsigned max_allowed_index;
 	unsigned max_index_ct;
 	unsigned index_ct;
-	PrimitiveType prim_type;
+	Gwn_PrimType prim_type;
 	unsigned* data;
-} ElementListBuilder;
+} Gwn_IndexBufBuilder;
 
 // supported primitives:
-//  PRIM_POINTS
-//  PRIM_LINES
-//  PRIM_TRIANGLES
+//  GWN_PRIM_POINTS
+//  GWN_PRIM_LINES
+//  GWN_PRIM_TRIS
 
-void ElementListBuilder_init(ElementListBuilder*, PrimitiveType, unsigned prim_ct, unsigned vertex_ct);
-//void ElementListBuilder_init_custom(ElementListBuilder*, PrimitiveType, unsigned index_ct, unsigned vertex_ct);
+void GWN_indexbuf_init(Gwn_IndexBufBuilder*, Gwn_PrimType, unsigned prim_ct, unsigned vertex_ct);
+//void GWN_indexbuf_init_custom(Gwn_IndexBufBuilder*, Gwn_PrimType, unsigned index_ct, unsigned vertex_ct);
 
-void add_generic_vertex(ElementListBui

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list