[Bf-blender-cvs] [c2f5cd8f645] blender2.8: Gawain: add VertexBuffer prefix to functions

Mike Erwin noreply at git.blender.org
Thu Apr 6 07:19:16 CEST 2017


Commit: c2f5cd8f6454bf8256a39a5fc9cb075311e25c58
Author: Mike Erwin
Date:   Tue Apr 4 20:45:23 2017 -0400
Branches: blender2.8
https://developer.blender.org/rBc2f5cd8f6454bf8256a39a5fc9cb075311e25c58

Gawain: add VertexBuffer prefix to functions

See intern/gawain for the API change. Other files are updated to use the new names.

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

M	intern/gawain/gawain/vertex_buffer.h
M	intern/gawain/src/vertex_buffer.c
M	source/blender/blenkernel/intern/mesh_render.c
M	source/blender/draw/intern/draw_cache.c
M	source/blender/draw/intern/draw_manager.c
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/space_view3d/drawarmature.c
M	source/blender/editors/space_view3d/drawobject.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

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

diff --git a/intern/gawain/gawain/vertex_buffer.h b/intern/gawain/gawain/vertex_buffer.h
index 6a72cfe6ff3..687f15e9e98 100644
--- a/intern/gawain/gawain/vertex_buffer.h
+++ b/intern/gawain/gawain/vertex_buffer.h
@@ -46,9 +46,9 @@ void VertexBuffer_resize_data(VertexBuffer*, unsigned v_ct);
 // to the vertex attribute's type and component count. They're in control of both, so this
 // should not be a problem.
 
-void setAttrib(VertexBuffer*, unsigned a_idx, unsigned v_idx, const void* data);
-void fillAttrib(VertexBuffer*, unsigned a_idx, const void* data); // tightly packed, non interleaved input data
-void fillAttribStride(VertexBuffer*, unsigned a_idx, unsigned stride, const void* data);
+void VertexBuffer_set_attrib(VertexBuffer*, unsigned a_idx, unsigned v_idx, const void* data);
+void VertexBuffer_fill_attrib(VertexBuffer*, unsigned a_idx, const void* data); // tightly packed, non interleaved input data
+void VertexBuffer_fill_attrib_stride(VertexBuffer*, unsigned a_idx, unsigned stride, const void* data);
 
 // TODO: decide whether to keep the functions below
 // doesn't immediate mode satisfy these needs?
diff --git a/intern/gawain/src/vertex_buffer.c b/intern/gawain/src/vertex_buffer.c
index 827703403e3..ab488a07bed 100644
--- a/intern/gawain/src/vertex_buffer.c
+++ b/intern/gawain/src/vertex_buffer.c
@@ -92,7 +92,7 @@ void VertexBuffer_resize_data(VertexBuffer* verts, unsigned v_ct)
 	// extra space will be reclaimed, and never sent to VRAM (see VertexBuffer_prime)
 	}
 
-void setAttrib(VertexBuffer* verts, unsigned a_idx, unsigned v_idx, const void* data)
+void VertexBuffer_set_attrib(VertexBuffer* verts, unsigned a_idx, unsigned v_idx, const void* data)
 	{
 	const VertexFormat* format = &verts->format;
 	const Attrib* a = format->attribs + a_idx;
@@ -106,7 +106,7 @@ void setAttrib(VertexBuffer* verts, unsigned a_idx, unsigned v_idx, const void*
 	memcpy((GLubyte*)verts->data + a->offset + v_idx * format->stride, data, a->sz);
 	}
 
-void fillAttrib(VertexBuffer* verts, unsigned a_idx, const void* data)
+void VertexBuffer_fill_attrib(VertexBuffer* verts, unsigned a_idx, const void* data)
 	{
 	const VertexFormat* format = &verts->format;
 	const Attrib* a = format->attribs + a_idx;
@@ -117,10 +117,10 @@ void fillAttrib(VertexBuffer* verts, unsigned a_idx, const void* data)
 
 	const unsigned stride = a->sz; // tightly packed input data
 
-	fillAttribStride(verts, a_idx, stride, data);
+	VertexBuffer_fill_attrib_stride(verts, a_idx, stride, data);
 	}
 
-void fillAttribStride(VertexBuffer* verts, unsigned a_idx, unsigned stride, const void* data)
+void VertexBuffer_fill_attrib_stride(VertexBuffer* verts, unsigned a_idx, unsigned stride, const void* data)
 	{
 	const VertexFormat* format = &verts->format;
 	const Attrib* a = format->attribs + a_idx;
diff --git a/source/blender/blenkernel/intern/mesh_render.c b/source/blender/blenkernel/intern/mesh_render.c
index dbe99acc10b..ecd2c6ea28e 100644
--- a/source/blender/blenkernel/intern/mesh_render.c
+++ b/source/blender/blenkernel/intern/mesh_render.c
@@ -676,22 +676,22 @@ static void add_overlay_tri(
 	unsigned char  fflag = mesh_render_data_looptri_flag(mrdata, f);
 	unsigned char  vflag = mesh_render_data_vertex_flag(mrdata, v1);
 	eflag[0] = fflag | vflag;
-	setAttrib(vbo, pos_id, base_vert_idx + 0, pos);
-	setAttrib(vbo, edgeMod_id, base_vert_idx + 0, eflag);
+	VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 0, pos);
+	VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 0, eflag);
 
 	pos = mesh_render_data_vert_co(mrdata, v2);
 	eflag = mesh_render_data_edge_flag(mrdata, v1, v3, -1);
 	vflag = mesh_render_data_vertex_flag(mrdata, v2);
 	eflag[0] = fflag | vflag;
-	setAttrib(vbo, pos_id, base_vert_idx + 1, pos);
-	setAttrib(vbo, edgeMod_id, base_vert_idx + 1, eflag);
+	VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 1, pos);
+	VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 1, eflag);
 
 	pos = mesh_render_data_vert_co(mrdata, v3);
 	eflag = mesh_render_data_edge_flag(mrdata, v1, v2, -1);
 	vflag = mesh_render_data_vertex_flag(mrdata, v3);
 	eflag[0] = fflag | vflag;
-	setAttrib(vbo, pos_id, base_vert_idx + 2, pos);
-	setAttrib(vbo, edgeMod_id, base_vert_idx + 2, eflag);
+	VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 2, pos);
+	VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 2, eflag);
 }
 
 static void add_overlay_loose_edge(
@@ -701,13 +701,13 @@ static void add_overlay_loose_edge(
 	unsigned char *eflag = mesh_render_data_edge_flag(mrdata, 0, 0, e);
 	const float *pos = mesh_render_data_vert_co(mrdata, v1);
 	eflag[0] = mesh_render_data_vertex_flag(mrdata, v1);
-	setAttrib(vbo, pos_id, base_vert_idx + 0, pos);
-	setAttrib(vbo, edgeMod_id, base_vert_idx + 0, eflag);
+	VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 0, pos);
+	VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 0, eflag);
 
 	pos = mesh_render_data_vert_co(mrdata, v2);
 	eflag[0] = mesh_render_data_vertex_flag(mrdata, v2);
-	setAttrib(vbo, pos_id, base_vert_idx + 1, pos);
-	setAttrib(vbo, edgeMod_id, base_vert_idx + 1, eflag);
+	VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 1, pos);
+	VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 1, eflag);
 }
 
 static void add_overlay_loose_vert(
@@ -717,8 +717,8 @@ static void add_overlay_loose_vert(
 	unsigned char vflag[4] = {0, 0, 0, 0};
 	const float *pos = mesh_render_data_vert_co(mrdata, v);
 	vflag[0] = mesh_render_data_vertex_flag(mrdata, v);
-	setAttrib(vbo, pos_id, base_vert_idx + 0, pos);
-	setAttrib(vbo, edgeMod_id, base_vert_idx + 0, vflag);
+	VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 0, pos);
+	VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 0, vflag);
 }
 
 /* ---------------------------------------------------------------------- */
@@ -919,19 +919,19 @@ static VertexBuffer *mesh_batch_cache_get_pos_and_normals(MeshRenderData *mrdata
 			const bool is_smooth = mesh_render_data_looptri_cos_nors_smooth_get(mrdata, i, &tri_vert_cos, &tri_nor, &tri_vert_nors);
 
 			if (is_smooth) {
-				setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[0]);
-				setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[1]);
-				setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[2]);
+				VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[0]);
+				VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[1]);
+				VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[2]);
 			}
 			else {
-				setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_nor);
-				setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_nor);
-				setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_nor);
+				VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_nor);
+				VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_nor);
+				VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_nor);
 			}
 
-			setAttrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[0]);
-			setAttrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[1]);
-			setAttrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[2]);
+			VertexBuffer_set_attrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[0]);
+			VertexBuffer_set_attrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[1]);
+			VertexBuffer_set_attrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[2]);
 		}
 	}
 	return cache->pos_with_normals;
@@ -954,8 +954,8 @@ static VertexBuffer *mesh_batch_cache_get_pos_and_nor_in_order(MeshRenderData *m
 		cache->pos_in_order = VertexBuffer_create_with_format(&format);
 		VertexBuffer_allocate_data(cache->pos_in_order, vertex_ct);
 		for (int i = 0; i < vertex_ct; ++i) {
-			setAttrib(cache->pos_in_order, pos_id, i, mesh_render_data_vert_co(mrdata, i));
-			setAttrib(cache->pos_in_order, nor_id, i, mesh_render_data_vert_nor(mrdata, i));
+			VertexBuffer_set_attrib(cache->pos_in_order, pos_id, i, mesh_render_data_vert_co(mrdata, i));
+			VertexBuffer_set_attrib(cache->pos_in_order, nor_id, i, mesh_render_data_vert_nor(mrdata, i));
 		}
 	}
 
@@ -1138,13 +1138,13 @@ Batch *BKE_mesh_batch_cache_get_fancy_edges(Mesh *me)
 			const float *n2 = (is_manifold) ? pnor2 : dummy2;
 #endif
 
-			setAttrib(vbo, pos_id, 2 * i, vcos1);
-			setAttrib(vbo, n1_id, 2 * i, n1);
-			setAttrib(vbo, n2_id, 2 * i, n2);
+			VertexBuffer_set_attrib(vbo, pos_id, 2 * i, vcos1);
+			VertexBuffer_set_attrib(vbo, n1_id, 2 * i, n1);
+			VertexBuffer_set_attrib(vbo, n2_id, 2 * i, n2);
 
-			setAttrib(vbo, pos_id, 2 * i + 1, vcos2);
-			setAttrib(vbo, n1_id, 2 * i + 1, n1);
-			setAttrib(vbo, n2_id, 2 * i + 1, n2);
+			VertexBuffer_set_attrib(vbo, pos_id, 2 * i + 1, vcos2);
+			VertexBuffer_set_attrib(vbo, n1_id, 2 * i + 1, n1);
+			VertexBuffer_set_attrib(vbo, n2_id, 2 * i + 1, n2);
 		}
 
 		cache->fancy_edges = Batch_create(GL_LINES, vbo, NULL);
@@ -1289,13 +1289,13 @@ Batch *BKE_mesh_batch_cache_get_overlay_facedots(Mesh *me)
 			PackedNormal nor = { .x = 0, .y = 0, .z = -511 };
 			nor = convert_i10_v3(pnor);
 			nor.w = selected;
-			setAttrib(vbo, data_id, i, &nor);
+			VertexBuffer_set_attrib(vbo, data_id, i, &nor);
 #else
 			float nor[4] = {pnor[0], pnor[1], pnor[2], (float)selected};
-			setAttrib(vbo, data_id, i, nor);
+			VertexBuffer_set_attrib(vbo, data_id, i, nor);
 #endif
 
-			setAttrib(vbo, pos_id, i, pcenter);
+			VertexBuffer_set_attrib(vbo, pos_id, i, pcenter);
 		}
 
 		cache->overlay_facedots = Batch_create(GL_POINTS, vbo, NULL);
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 0d79011d267..fe09c6d8f06 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -134,13 +134,13 @@ static void add_fancy_edge(VertexBuffer *vbo, unsigned int pos_id, unsigned int
                            unsigned int *v_idx, const float co1[3], const float co2[3],
                            const float n1[3], const float n2[3])
 {
-	setAttrib(vbo, n1_id, *v_idx, n1);
-	setAttrib(vbo, n2_id, *v_idx, n2);
-	setAttrib(vbo, pos_id, (*v_idx)++, co1);
+	VertexBuffer_set_attrib(vbo, n1_id, *v_idx

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list