[Bf-blender-cvs] [7fa7a0b] temp_display_optimization: WIP: Add some structs for vertex format of derivedmeshes.

Antony Ryakiotakis noreply at git.blender.org
Fri Mar 11 23:58:42 CET 2016


Commit: 7fa7a0b70366b1979c0bda90dc9b58767fd09b10
Author: Antony Ryakiotakis
Date:   Fri Mar 11 23:57:33 2016 +0100
Branches: temp_display_optimization
https://developer.blender.org/rB7fa7a0b70366b1979c0bda90dc9b58767fd09b10

WIP: Add some structs for vertex format of derivedmeshes.

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

M	source/blender/gpu/GPU_buffers.h

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

diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index 5cade53..6481747 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -146,7 +146,6 @@ typedef struct GPUVertPointLink {
 } GPUVertPointLink;
 
 
-
 /* used for GLSL materials */
 typedef struct GPUAttrib {
 	int index;
@@ -154,6 +153,43 @@ typedef struct GPUAttrib {
 	int type;
 } GPUAttrib;
 
+/* generic vertex format used for all derivedmeshes
+ * customdatatype is enough to get size of format
+ * and we can infer the offset by the position in buffer.
+ * This corresponds in a single interleaved buffer */
+typedef struct GPUMeshVertexAttribute
+{
+    /* char is sufficient here, we have less than 255 customdata types */
+    char customdatatype;
+    /* layer number, for layers that need it */
+    char layer;
+} GPUMeshVertexAttribute;
+
+typedef struct GPUMeshVertexFormat
+{
+    /* which customdata exist in the current vertex format */
+    long long customdataflag;
+
+    /* number of customData in format */
+    char numData;
+
+    /* actual current data existing in buffer */
+    GPUMeshVertexAttribute *layout;
+} GPUMeshVertexFormat;
+
+/* create a vertex format with the specified formats */
+GPUMeshVertexFormat *GPU_vertex_format_alloc(long long iformat);
+
+/* check if reusing the vertex format is possible */
+bool GPU_vertex_format_reuse(GPUMeshVertexFormat *vformat, long long iformat);
+
+/* bind the vertex format existing in the currently bound buffer object,
+ * according to the format specified here */
+void GPU_vertex_format_bind(GPUMeshVertexFormat *vformat, long long iformat);
+
+/* get the size of the vertex format */
+int GPU_vertex_format_size(GPUMeshVertexFormat *vformat);
+
 void GPU_global_buffer_pool_free(void);
 void GPU_global_buffer_pool_free_unused(void);




More information about the Bf-blender-cvs mailing list