[Bf-blender-cvs] [fc0e24b] temp_viewport_fx_merge: Blender displays fine again without errors, using the custom matrix stacks.

Antony Riakiotakis noreply at git.blender.org
Tue Apr 14 22:15:23 CEST 2015


Commit: fc0e24b05c9c692531afa0ffb072a9dc12508445
Author: Antony Riakiotakis
Date:   Tue Apr 14 22:15:17 2015 +0200
Branches: temp_viewport_fx_merge
https://developer.blender.org/rBfc0e24b05c9c692531afa0ffb072a9dc12508445

Blender displays fine again without errors, using the custom matrix
stacks.

Still need to replace glRect calls to completely fix it probably.

This still does not use the soc API properly.

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

M	source/blender/blenfont/intern/blf.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/gpu/GPU_immediate.h
M	source/blender/gpu/intern/gpu_clipping.c
M	source/blender/gpu/intern/gpu_immediate.c
M	source/blender/gpu/intern/gpu_primitives_inline.h

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

diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index f298076..b5be69f 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -526,8 +526,6 @@ static void blf_draw__start(FontBLF *font, GLint *param)
 	/* always bind the texture for the first glyph */
 	font->tex_bind_state = -1;
 
-	gpu_commit_matrix();
-
 	/* Save the current parameter to restore it later. */
 	glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param);
 	if (*param != GL_MODULATE)
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index de10f54..3cb4854 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -100,6 +100,7 @@
 #include "GPU_compositing.h"
 #include "GPU_primitives.h"
 #include "GPU_matrix.h"
+#include "GPU_aspect.h"
 
 #include "view3d_intern.h"  /* own include */
 
@@ -126,7 +127,7 @@ void circf(float x, float y, float rad)
 	
 	gpuTranslate(GPU_MODELVIEW_MATRIX, x, y, 0.0);
 
-	gpuDrawDisk(0.0, 0.0, rad, 32);
+	gpuSingleDisk(0.0, 0.0, rad, 32);
 	
 	gpuPopMatrix(GPU_MODELVIEW_MATRIX);
 }
@@ -137,7 +138,7 @@ void circ(float x, float y, float rad)
 	
 	gpuTranslate(GPU_MODELVIEW_MATRIX, x, y, 0.0);
 	
-	gpuDrawDisk(0.0, 0.0, rad, 32);
+	gpuSingleDisk(0.0, 0.0, rad, 32);
 
 	gpuPopMatrix(GPU_MODELVIEW_MATRIX);
 }
@@ -2871,7 +2872,7 @@ static void view3d_draw_objects(
 	}
 
 	if (!draw_offscreen) {
-		BIF_draw_manipulator(C);
+		//BIF_draw_manipulator(C);
 	}
 
 	/* cleanup */
@@ -3702,7 +3703,7 @@ static void view3d_main_area_draw_objects(const bContext *C, Scene *scene, View3
 	}
 
 	/* main drawing call */
-	view3d_draw_objects(C, scene, v3d, ar, grid_unit, true, false, do_compositing ? rv3d->compositor : NULL);
+	GPU_CHECK_ERRORS_AROUND(view3d_draw_objects(C, scene, v3d, ar, grid_unit, true, false, do_compositing ? rv3d->compositor : NULL));
 
 	/* post process */
 	if (do_compositing) {
@@ -3729,6 +3730,7 @@ static void view3d_main_area_draw_objects(const bContext *C, Scene *scene, View3
 		/* TODO: draw something else (but not this) during fly mode */
 		draw_rotation_guide(rv3d);
 
+	GPU_ASSERT_NO_GL_ERRORS("lala");
 }
 
 static bool is_cursor_visible(Scene *scene)
diff --git a/source/blender/gpu/GPU_immediate.h b/source/blender/gpu/GPU_immediate.h
index fce2f98..54f23e3 100644
--- a/source/blender/gpu/GPU_immediate.h
+++ b/source/blender/gpu/GPU_immediate.h
@@ -153,7 +153,7 @@ void gpuEnd(void);
 
 void GPUBegin(GLenum mode);
 void GPUDrawArrays(GLenum mode, int start, int count);
-void GPUDrawElements(GLenum mode, int count, int type, void *p);
+void GPUDrawElements(GLenum mode, int count, int type, const void *p);
 
 
 typedef struct GPUarrays {
diff --git a/source/blender/gpu/intern/gpu_clipping.c b/source/blender/gpu/intern/gpu_clipping.c
index 075342f..5108c74 100644
--- a/source/blender/gpu/intern/gpu_clipping.c
+++ b/source/blender/gpu/intern/gpu_clipping.c
@@ -107,7 +107,7 @@ void GPU_restore_clip_planes(int clip_plane_count, const GPUplane clip_planes[])
 
 static void feedback_clip_plane_position(double position[4] /* in-out */)
 {
-	GPU_feedback_vertex_4dv(GL_MODELVIEW_MATRIX, position[0], position[1], position[2], position[3], position);
+	GPU_feedback_vertex_4dv(GPU_MODELVIEW_MATRIX, position[0], position[1], position[2], position[3], position);
 }
 
 
diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c
index b97a33a..3375b8d 100644
--- a/source/blender/gpu/intern/gpu_immediate.c
+++ b/source/blender/gpu/intern/gpu_immediate.c
@@ -688,6 +688,7 @@ void gpu_end_buffer_gl(void)
 
 		unsetup();
 		GPU_shader_unbind();
+		gpu_set_common(NULL);
 		GPU_ASSERT_NO_GL_ERRORS("gpu_end_buffer_gl end");
 	}
 }
@@ -2405,19 +2406,20 @@ void gpuIndexEnd(void)
 void GPUBegin(GLenum mode)
 {
 	gpu_commit_matrix();
+	GPU_ASSERT_NO_GL_ERRORS("GPUBegin");
 	glBegin(mode);
 }
 
 void GPUDrawArrays(GLenum mode, int start, int count)
 {
 	gpu_commit_matrix();
-	glDrawArrays(mode, start, count);
+	GPU_CHECK_ERRORS_AROUND(glDrawArrays(mode, start, count));
 }
 
-void GPUDrawElements(GLenum mode, int count, int type, void *p)
+void GPUDrawElements(GLenum mode, int count, int type, const void *p)
 {
 	gpu_commit_matrix();
-	glDrawElements(mode, count, type, p);
+	GPU_CHECK_ERRORS_AROUND(glDrawElements(mode, count, type, p));
 }
 
 
diff --git a/source/blender/gpu/intern/gpu_primitives_inline.h b/source/blender/gpu/intern/gpu_primitives_inline.h
index 60d3de0..5a10a0a 100644
--- a/source/blender/gpu/intern/gpu_primitives_inline.h
+++ b/source/blender/gpu/intern/gpu_primitives_inline.h
@@ -48,52 +48,52 @@ extern "C" {
 
 BLI_INLINE void gpuAppendLinef(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
 {
-	glVertex2f(x1, y1);
-	glVertex2f(x2, y2);
+	gpuVertex2f(x1, y1);
+	gpuVertex2f(x2, y2);
 }
 
 BLI_INLINE void gpuAppendLinei(GLint x1, GLint y1, GLint x2, GLint y2)
 {
-	glVertex2i(x1, y1);
-	glVertex2i(x2, y2);
+	gpuVertex2i(x1, y1);
+	gpuVertex2i(x2, y2);
 }
 
 BLI_INLINE void gpuDrawLinef(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
 {
-	GPUBegin(GL_LINES);
+	gpuBegin(GL_LINES);
 	gpuAppendLinef(x1, y1, x2, y2);
-	glEnd();
+	gpuEnd();
 }
 
 BLI_INLINE void gpuDrawLinei(GLint x1, GLint y1, GLint x2, GLint y2)
 {
-	GPUBegin(GL_LINES);
+	gpuBegin(GL_LINES);
 	gpuAppendLinei(x1, y1, x2, y2);
-	glEnd();
+	gpuEnd();
 }
 
 
 
 BLI_INLINE void gpuAppendFilledRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
 {
-	glVertex2f(x1, y1);
-	glVertex2f(x2, y1);
-	glVertex2f(x2, y2);
+	gpuVertex2f(x1, y1);
+	gpuVertex2f(x2, y1);
+	gpuVertex2f(x2, y2);
 
-	glVertex2f(x1, y1);
-	glVertex2f(x2, y2);
-	glVertex2f(x1, y2);
+	gpuVertex2f(x1, y1);
+	gpuVertex2f(x2, y2);
+	gpuVertex2f(x1, y2);
 }
 
 BLI_INLINE void gpuAppendFilledRecti(GLint x1, GLint y1, GLint x2, GLint y2)
 {
-	glVertex2i(x1, y1);
-	glVertex2i(x2, y1);
-	glVertex2i(x2, y2);
+	gpuVertex2i(x1, y1);
+	gpuVertex2i(x2, y1);
+	gpuVertex2i(x2, y2);
 
-	glVertex2i(x1, y1);
-	glVertex2i(x2, y2);
-	glVertex2i(x1, y2);
+	gpuVertex2i(x1, y1);
+	gpuVertex2i(x2, y2);
+	gpuVertex2i(x1, y2);
 }
 
 BLI_INLINE void gpuAppendWireRectf(
@@ -102,10 +102,10 @@ BLI_INLINE void gpuAppendWireRectf(
 	GLfloat x2,
 	GLfloat y2)
 {
-	glVertex2f(x1, y1);
-	glVertex2f(x2, y1);
-	glVertex2f(x2, y2);
-	glVertex2f(x1, y2);
+	gpuVertex2f(x1, y1);
+	gpuVertex2f(x2, y1);
+	gpuVertex2f(x2, y2);
+	gpuVertex2f(x1, y2);
 }
 
 BLI_INLINE void gpuAppendWireRecti(
@@ -114,10 +114,10 @@ BLI_INLINE void gpuAppendWireRecti(
 	GLint x2,
 	GLint y2)
 {
-	glVertex2i(x1, y1);
-	glVertex2i(x2, y1);
-	glVertex2i(x2, y2);
-	glVertex2i(x1, y2);
+	gpuVertex2i(x1, y1);
+	gpuVertex2i(x2, y1);
+	gpuVertex2i(x2, y2);
+	gpuVertex2i(x1, y2);
 }
 
 BLI_INLINE void gpuDrawFilledRectf(
@@ -126,9 +126,9 @@ BLI_INLINE void gpuDrawFilledRectf(
 	GLfloat x2,
 	GLfloat y2)
 {
-	GPUBegin(GL_TRIANGLES);
+	gpuBegin(GL_TRIANGLES);
 	gpuAppendFilledRectf(x1, y1, x2, y2);
-	glEnd();
+	gpuEnd();
 }
 
 BLI_INLINE void gpuDrawFilledRecti(
@@ -137,9 +137,9 @@ BLI_INLINE void gpuDrawFilledRecti(
 	GLint x2,
 	GLint y2)
 {
-	GPUBegin(GL_TRIANGLES);
+	gpuBegin(GL_TRIANGLES);
 	gpuAppendFilledRecti(x1, y1, x2, y2);
-	glEnd();
+	gpuEnd();
 }
 
 BLI_INLINE void gpuDrawWireRectf(
@@ -148,9 +148,9 @@ BLI_INLINE void gpuDrawWireRectf(
 	GLfloat x2,
 	GLfloat y2)
 {
-	GPUBegin(GL_LINE_LOOP);
+	gpuBegin(GL_LINE_LOOP);
 	gpuAppendWireRectf(x1, y1, x2, y2);
-	glEnd();
+	gpuEnd();
 }
 
 BLI_INLINE void gpuDrawWireRecti(
@@ -159,9 +159,9 @@ BLI_INLINE void gpuDrawWireRecti(
 	GLint x2,
 	GLint y2)
 {
-	GPUBegin(GL_LINE_LOOP);
+	gpuBegin(GL_LINE_LOOP);
 	gpuAppendWireRecti(x1, y1, x2, y2);
-	glEnd();
+	gpuEnd();
 }




More information about the Bf-blender-cvs mailing list