[Bf-blender-cvs] [86b9bcb] GPU_data_request: workaround for VBOs on Mesa

Mike Erwin noreply at git.blender.org
Mon Apr 13 10:35:58 CEST 2015


Commit: 86b9bcbfb4bd13f64a87e2138b680fe5e3e6e5ce
Author: Mike Erwin
Date:   Mon Apr 13 04:34:35 2015 -0400
Branches: GPU_data_request
https://developer.blender.org/rB86b9bcbfb4bd13f64a87e2138b680fe5e3e6e5ce

workaround for VBOs on Mesa

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

M	source/blender/gpu/intern/gpux_vbo.c

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

diff --git a/source/blender/gpu/intern/gpux_vbo.c b/source/blender/gpu/intern/gpux_vbo.c
index 0df7ac4..7f80738 100644
--- a/source/blender/gpu/intern/gpux_vbo.c
+++ b/source/blender/gpu/intern/gpux_vbo.c
@@ -13,6 +13,13 @@
  * so we should follow that restriction on all platforms. */
 #ifdef USE_VBO
   #define USE_VAO
+
+  #ifdef __linux__
+    #define MESA_WORKAROUND
+    /* For padded attributes (stride > size) Mesa likes the VBO to have some extra
+     * space at the end, else it drops those attributes of our final vertex.
+     * noticed this on Mesa 10.4.3 */
+  #endif
 #endif
 
 #ifdef TRUST_NO_ONE
@@ -176,8 +183,14 @@ static unsigned attrib_total_size(const VertexBuffer *buff, unsigned attrib_num)
 #ifdef TRUST_NO_ONE
 	assert(attrib_num < buff->attrib_ct);
 #endif /* TRUST_NO_ONE */
+
+#ifdef MESA_WORKAROUND
+	/* an over-estimate, with padding after each vertex */
+	return buff->vertex_ct * attrib->stride;
+#else
 	/* just enough space for every vertex, with padding between but not after the last */
 	return (buff->vertex_ct - 1) * attrib->stride + attrib->sz;
+#endif /*  MESA_WORKAROUND */
 }
 
 void GPUx_specify_attrib(VertexBuffer *buff, unsigned attrib_num,




More information about the Bf-blender-cvs mailing list