[Bf-blender-cvs] [0debbe2b7f7] blender2.8: Gawain: VertexFormat_add_attrib (function name change)
Mike Erwin
noreply at git.blender.org
Thu Apr 6 07:19:18 CEST 2017
Commit: 0debbe2b7f7177678c9bce9046c1499b698ac969
Author: Mike Erwin
Date: Thu Apr 6 00:59:04 2017 -0400
Branches: blender2.8
https://developer.blender.org/rB0debbe2b7f7177678c9bce9046c1499b698ac969
Gawain: VertexFormat_add_attrib (function name change)
See intern/gawain for the API change. Other files are updated to use the new name. Also updated every call site to the recommended style:
unsigned int foo = VertexFormat_add_attrib(format, "foo", COMP_ ... )
===================================================================
M intern/gawain/gawain/vertex_format.h
M intern/gawain/src/vertex_format.c
M source/blender/blenfont/intern/blf.c
M source/blender/blenkernel/intern/DerivedMesh.c
M source/blender/blenkernel/intern/mesh_render.c
M source/blender/blenkernel/intern/pbvh.c
M source/blender/draw/intern/draw_cache.c
M source/blender/draw/intern/draw_manager.c
M source/blender/draw/intern/draw_view.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/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/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_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_manipulator.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/intern/gpu_batch.c
M source/blender/gpu/intern/gpu_compositing.c
M source/blender/gpu/intern/gpu_framebuffer.c
M source/blender/gpu/intern/gpu_immediate_util.c
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_stereo.c
===================================================================
diff --git a/intern/gawain/gawain/vertex_format.h b/intern/gawain/gawain/vertex_format.h
index 4ed9e58f376..fcebaec8772 100644
--- a/intern/gawain/gawain/vertex_format.h
+++ b/intern/gawain/gawain/vertex_format.h
@@ -64,7 +64,7 @@ typedef struct {
void VertexFormat_clear(VertexFormat*);
void VertexFormat_copy(VertexFormat* dest, const VertexFormat* src);
-unsigned add_attrib(VertexFormat*, const char* name, VertexCompType, unsigned comp_ct, VertexFetchMode);
+unsigned VertexFormat_add_attrib(VertexFormat*, const char* name, VertexCompType, unsigned comp_ct, VertexFetchMode);
// format conversion
diff --git a/intern/gawain/src/vertex_format.c b/intern/gawain/src/vertex_format.c
index d42398f3a4f..b1fb7721e38 100644
--- a/intern/gawain/src/vertex_format.c
+++ b/intern/gawain/src/vertex_format.c
@@ -106,7 +106,7 @@ static const char* copy_attrib_name(VertexFormat* format, const char* name)
return name_copy;
}
-unsigned add_attrib(VertexFormat* format, const char* name, VertexCompType comp_type, unsigned comp_ct, VertexFetchMode fetch_mode)
+unsigned VertexFormat_add_attrib(VertexFormat* format, const char* name, VertexCompType comp_type, unsigned comp_ct, VertexFetchMode fetch_mode)
{
#if TRUST_NO_ONE
assert(format->attrib_ct < MAX_VERTEX_ATTRIBS); // there's room for more
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index d4bd1502417..663be49c71e 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -567,9 +567,9 @@ static void blf_draw_gl__start(FontBLF *font)
#ifndef BLF_STANDALONE
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
- unsigned texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT);
- unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
BLI_assert(pos == BLF_POS_ID);
BLI_assert(texCoord == BLF_COORD_ID);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index b9cc9540cf7..724f596a452 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -3953,8 +3953,8 @@ static void navmesh_drawColored(DerivedMesh *dm)
#endif
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned color = add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
diff --git a/source/blender/blenkernel/intern/mesh_render.c b/source/blender/blenkernel/intern/mesh_render.c
index ecd2c6ea28e..d6cf70af1ab 100644
--- a/source/blender/blenkernel/intern/mesh_render.c
+++ b/source/blender/blenkernel/intern/mesh_render.c
@@ -903,8 +903,8 @@ static VertexBuffer *mesh_batch_cache_get_pos_and_normals(MeshRenderData *mrdata
static unsigned int pos_id, nor_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- nor_id = add_attrib(&format, "nor", GL_SHORT, 3, NORMALIZE_INT_TO_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ nor_id = VertexFormat_add_attrib(&format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT);
}
const int tottri = mesh_render_data_looptri_num_get(mrdata);
@@ -945,8 +945,8 @@ static VertexBuffer *mesh_batch_cache_get_pos_and_nor_in_order(MeshRenderData *m
static unsigned pos_id, nor_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- nor_id = add_attrib(&format, "nor", GL_SHORT, 3, NORMALIZE_INT_TO_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ nor_id = VertexFormat_add_attrib(&format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT);
}
const int vertex_ct = mesh_render_data_verts_num_get(mrdata);
@@ -1096,14 +1096,14 @@ Batch *BKE_mesh_batch_cache_get_fancy_edges(Mesh *me)
static unsigned int pos_id, n1_id, n2_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- pos_id = add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
#if USE_10_10_10 /* takes 1/3 the space */
- n1_id = add_attrib(&format, "N1", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
- n2_id = add_attrib(&format, "N2", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
+ n1_id = VertexFormat_add_attrib(&format, "N1", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
+ n2_id = VertexFormat_add_attrib(&format, "N2", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
#else
- n1_id = add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT);
- n2_id = add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT);
+ n1_id = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT);
+ n2_id = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT);
#endif
}
VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
@@ -1167,8 +1167,8 @@ static void mesh_batch_cache_create_overlay_batches(Mesh *me)
static unsigned pos_id, data_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- data_id = add_attrib(&format, "data", GL_UNSIGNED_BYTE, 4, KEEP_INT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ data_id = VertexFormat_add_attrib(&format, "data", COMP_U8, 4, KEEP_INT);
}
const int tri_ct = mesh_render_data_looptri_num_get(mrdata);
@@ -1266,11 +1266,11 @@ Batch *BKE_mesh_batch_cache_get_overlay_facedots(Mesh *me)
static unsigned pos_id, data_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
#if USE_10_10_10
- data_id = add_attrib(&format, "norAndFlag", COMP_I10, 4, NORMALIZE_INT_TO_FLOAT);
+ data_id = VertexFormat_add_attrib(&format, "norAndFlag", COMP_I10, 4, NORMALIZE_INT_TO_FLOAT);
#else
- data_id = add_attrib(&format, "norAndFlag", GL_FLOAT, 4, KEEP_FLOAT);
+ data_id = VertexFormat_add_attrib(&format, "norAndFlag", COMP_F32, 4, KEEP_FLOAT);
#endif
}
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index b0f9875eaac..6bfb9d779c2 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1157,7 +1157,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
static void pbvh_draw_BB(PBVH *bvh)
{
- unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
for (int a = 0; a < bvh->totnode; a++) {
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index fe09c6d8f06..e8d2f1b83fe 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -160,9 +160,9 @@ static VertexBuffer *fill_arrows_vbo(const float scale)
{
/* Position Only 3D format */
static VertexFormat format = { 0 };
- static unsigned pos_id;
+ static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
}
/* Line */
@@ -207,9 +207,9 @@ static VertexBuffer *sphere_wire_vbo(const float rad)
#define NSEGMENTS 16
/* Position Only 3D format */
static VertexFormat format = { 0 };
- static unsigned pos_id;
+ static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
}
VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
@@ -256,10 +256,10 @@ Batch *DRW_cache_fullscreen_quad_get(void)
/* Position Only 2D format */
static VertexFormat format = { 0 };
- static unsigned pos_id, uvs_id;
+ static unsigned int pos_id, uvs_id;
if (format.attrib_ct == 0) {
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
- uvs_id = add_attrib(&format, "uvs", GL_FLOAT, 2, KEEP_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ uvs_id = VertexFormat_add_attrib(&format, "uvs", COMP_F32, 2, KEEP_FLOAT);
}
VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
@@ -295,9 +295,9 @@ Batch *DRW_cache_cube_get(void)
/* Position Only 3D format */
static VertexFormat format = { 0 };
- static unsigned pos_id;
+ static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
}
VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
@@ -320,9 +320,9 @@ Batch *DRW_cache_circle_get(void)
/* Position Only 3D format */
static VertexFormat format = { 0 };
- static unsigned pos_id;
+ static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
}
VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
@@ -356,9 +356,9 @@ Batch *DRW_cache_square_get(void)
/* Position Only 3D format */
static VertexFormat format = { 0 };
- static unsigned pos_id;
+ static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = add_attrib(&
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list