[Bf-blender-cvs] [d6beaad] master: Fix T42875 GLSL display not correct in vertex array mode.

Antony Riakiotakis noreply at git.blender.org
Fri Dec 12 17:59:18 CET 2014


Commit: d6beaad01cdc0849d4bee840a631ae9d9ef2be46
Author: Antony Riakiotakis
Date:   Fri Dec 12 17:59:06 2014 +0100
Branches: master
https://developer.blender.org/rBd6beaad01cdc0849d4bee840a631ae9d9ef2be46

Fix T42875 GLSL display not correct in vertex array mode.

GLSL used a global variable to store the enabled vertex attributes which
were not set for vertex arrays after the VBO refactor.

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

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

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

diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 8ac629d..2ac2ca3 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -1293,6 +1293,7 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
 	int i;
 	int elementsize;
 	intptr_t offset = 0;
+	char *basep;
 
 	for (i = 0; i < MAX_GPU_ATTRIB_DATA; i++) {
 		if (attribData[i].index != -1) {
@@ -1305,26 +1306,24 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
 
 	if (buffer->use_vbo) {
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer->id);
-		for (i = 0; i < numdata; i++) {
-			glEnableVertexAttribArrayARB(data[i].index);
-			glVertexAttribPointerARB(data[i].index, data[i].size, data[i].type,
-			                         GL_FALSE, elementsize, (void *)offset);
-			offset += data[i].size * GPU_typesize(data[i].type);
-
-			attribData[i].index = data[i].index;
-			attribData[i].size = data[i].size;
-			attribData[i].type = data[i].type;
-		}
-		attribData[numdata].index = -1;
+		basep = NULL;
 	}
 	else {
-		for (i = 0; i < numdata; i++) {
-			glEnableVertexAttribArrayARB(data[i].index);
-			glVertexAttribPointerARB(data[i].index, data[i].size, data[i].type,
-			                         GL_FALSE, elementsize, (char *)buffer->pointer + offset);
-			offset += data[i].size * GPU_typesize(data[i].type);
-		}
+		basep = buffer->pointer;
 	}
+	
+	for (i = 0; i < numdata; i++) {
+		glEnableVertexAttribArrayARB(data[i].index);
+		glVertexAttribPointerARB(data[i].index, data[i].size, data[i].type,
+		                         GL_FALSE, elementsize, (void *)(basep + offset));
+		offset += data[i].size * GPU_typesize(data[i].type);
+		
+		attribData[i].index = data[i].index;
+		attribData[i].size = data[i].size;
+		attribData[i].type = data[i].type;
+	}
+	
+	attribData[numdata].index = -1;	
 }




More information about the Bf-blender-cvs mailing list