[Bf-blender-cvs] [14aca96] temp_viewport_fx_merge: Blender now runs without crashing, but still garbage on screen.

Antony Riakiotakis noreply at git.blender.org
Wed Apr 1 14:12:18 CEST 2015


Commit: 14aca96652054cf4b5a8b9e55d34840059949cab
Author: Antony Riakiotakis
Date:   Wed Apr 1 14:12:11 2015 +0200
Branches: temp_viewport_fx_merge
https://developer.blender.org/rB14aca96652054cf4b5a8b9e55d34840059949cab

Blender now runs without crashing, but still garbage on screen.

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

M	source/blender/editors/transform/transform_manipulator.c
M	source/blender/gpu/intern/gpu_immediate.c
M	source/blender/gpu/intern/gpu_raster.c

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

diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index c3359ff..22a5a8d 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -1392,7 +1392,7 @@ static void draw_manipulator_translate(
 					glTranslatef(0.0, 0.0, dz);
 					if (is_picksel) GPU_select_load_id(MAN_TRANS_Z);
 					else manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->tw_idot[2]));
-					gpuDrawCone(&prim, cywid, cylen);
+					gpuSingleCone(&prim, cywid, cylen);
 					glTranslatef(0.0, 0.0, -dz);
 				}
 				break;
@@ -1402,7 +1402,7 @@ static void draw_manipulator_translate(
 					if (is_picksel) GPU_select_load_id(MAN_TRANS_X);
 					else manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->tw_idot[0]));
 					glRotatef(90.0, 0.0, 1.0, 0.0);
-					gpuDrawCone(&prim, cywid, cylen);
+					gpuSingleCone(&prim, cywid, cylen);
 					glRotatef(-90.0, 0.0, 1.0, 0.0);
 					glTranslatef(-dz, 0.0, 0.0);
 				}
@@ -1413,7 +1413,7 @@ static void draw_manipulator_translate(
 					if (is_picksel) GPU_select_load_id(MAN_TRANS_Y);
 					else manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->tw_idot[1]));
 					glRotatef(-90.0, 1.0, 0.0, 0.0);
-					gpuDrawCone(&prim, cywid, cylen);
+					gpuSingleCone(&prim, cywid, cylen);
 					glRotatef(90.0, 1.0, 0.0, 0.0);
 					glTranslatef(0.0, -dz, 0.0);
 				}
diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c
index 6e89d28..019d87e 100644
--- a/source/blender/gpu/intern/gpu_immediate.c
+++ b/source/blender/gpu/intern/gpu_immediate.c
@@ -87,7 +87,6 @@ enum StreamTypes {
 	eStreamTypeVertexBuffer,
 };
 
-
 typedef struct bufferDataGLSL {
 	size_t   size;
 	GLuint   vao;
@@ -134,10 +133,9 @@ static void alloc_stream_vabuffer(GPUVertexStream *stream, size_t newsize)
 		if (!va_stream->vao)
 			glGenVertexArrays(1, &va_stream->vao);
 
-		if (va_stream->vstream.vbo)
-			glBindBuffer(stream->type, va_stream->vstream.vbo);
-		else
+		if (!va_stream->vstream.vbo)
 			glGenBuffers(1, &va_stream->vstream.vbo);
+		glBindBuffer(stream->type, va_stream->vstream.vbo);
 		glBufferData(stream->type, newsize, NULL, GL_STREAM_DRAW);
 		stream->size = newsize;
 	}
@@ -198,6 +196,41 @@ static void free_stream_vbuffer(GPUVertexStream *stream)
 	MEM_freeN(stream);
 }
 
+static void *bind_stream_ram(GPUVertexStream *stream)
+{
+	GPURAMArrayStream *ram_stream = (GPURAMArrayStream *)stream;
+	return ram_stream->unmappedBuffer;
+}
+
+static void unbind_stream_ram(GPUVertexStream *UNUSED(stream))
+{
+}
+
+static void *bind_stream_vbuffer(GPUVertexStream *stream)
+{
+	GPUVertexBufferStream *va_stream = (GPUVertexBufferStream *)stream;
+	glBindBuffer(stream->type, va_stream->vbo);
+	return NULL;
+}
+
+static void unbind_stream_vbuffer(GPUVertexStream *stream)
+{
+	glBindBuffer(stream->type, 0);
+}
+
+static void *bind_stream_varray(GPUVertexStream *stream)
+{
+	GPUVertexArrayStream *va_stream = (GPUVertexArrayStream *)stream;
+	glBindVertexArray(va_stream->vao);
+	glBindBuffer(stream->type, va_stream->vstream.vbo);
+	return NULL;
+}
+
+static void unbind_stream_varray(GPUVertexStream *stream)
+{
+	glBindVertexArray(0);
+	glBindBuffer(stream->type, 0);
+}
 
 static GPUVertexStream *gpu_new_vertex_stream(enum StreamTypes type, int array_type)
 {
@@ -211,6 +244,8 @@ static GPUVertexStream *gpu_new_vertex_stream(enum StreamTypes type, int array_t
 			ret->map = map_stream_vbuffer;
 			ret->unmap = unmap_stream_vbuffer;
 			ret->free = free_stream_varray;
+			ret->bind = bind_stream_varray;
+			ret->unbind = unbind_stream_varray;
 			break;
 		}
 
@@ -222,6 +257,8 @@ static GPUVertexStream *gpu_new_vertex_stream(enum StreamTypes type, int array_t
 			ret->map = map_stream_ram;
 			ret->unmap = unmap_stream_ram;
 			ret->free = free_stream_ram;
+			ret->bind = bind_stream_ram;
+			ret->unbind = unbind_stream_ram;
 			break;
 		}
 
@@ -233,6 +270,8 @@ static GPUVertexStream *gpu_new_vertex_stream(enum StreamTypes type, int array_t
 			ret->map = map_stream_vbuffer;
 			ret->unmap = unmap_stream_vbuffer;
 			ret->free = free_stream_vbuffer;
+			ret->bind = bind_stream_vbuffer;
+			ret->unbind = unbind_stream_vbuffer;
 			break;
 		}
 
@@ -966,8 +1005,6 @@ void gpuEnd(void)
 	BLI_assert(GPU_IMMEDIATE->mode != GL_NOOP || !(GPU_IMMEDIATE->hasOverflowed));
 
 	gpu_end_buffer_gl();
-
-	GPU_IMMEDIATE->mappedBuffer = NULL;
 }
 
 void gpuImmediateFormatReset(void)
diff --git a/source/blender/gpu/intern/gpu_raster.c b/source/blender/gpu/intern/gpu_raster.c
index 24fc6f7..e9a4039 100644
--- a/source/blender/gpu/intern/gpu_raster.c
+++ b/source/blender/gpu/intern/gpu_raster.c
@@ -494,7 +494,6 @@ static GLboolean end_begin(void)
 	{
 		gpu_end_buffer_gl();
 
-		GPU_IMMEDIATE->mappedBuffer = NULL;
 		GPU_IMMEDIATE->offset = 0;
 		GPU_IMMEDIATE->count = 1; /* count the vertex that triggered this */




More information about the Bf-blender-cvs mailing list