[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60333] branches/soc-2013-viewport_fx/ source/blender: added gpuGetViewport and added GPU_SAFETY checks to GPU_state_latch ( state should be set before gotten)

Jason Wilkins Jason.A.Wilkins at gmail.com
Mon Sep 23 15:58:46 CEST 2013


Revision: 60333
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60333
Author:   jwilkins
Date:     2013-09-23 13:58:46 +0000 (Mon, 23 Sep 2013)
Log Message:
-----------
added gpuGetViewport and added GPU_SAFETY checks to GPU_state_latch (state should be set before gotten)

Modified Paths:
--------------
    branches/soc-2013-viewport_fx/source/blender/blenlib/BLI_utildefines.h
    branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c
    branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c
    branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c
    branches/soc-2013-viewport_fx/source/blender/editors/sculpt_paint/paint_utils.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_draw.c
    branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_safety.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_state_latch.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_init_exit.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_state_latch.c

Added Paths:
-----------
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_state_latch_intern.h

Modified: branches/soc-2013-viewport_fx/source/blender/blenlib/BLI_utildefines.h
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/blenlib/BLI_utildefines.h	2013-09-23 13:21:27 UTC (rev 60332)
+++ branches/soc-2013-viewport_fx/source/blender/blenlib/BLI_utildefines.h	2013-09-23 13:58:46 UTC (rev 60333)
@@ -209,14 +209,20 @@
 		*((v1) + 3) = w;                                                      \
 } (void)0
 #define VECCOPY(v1, v2) {                                                     \
-		*(v1) =   *(v2);                                                      \
+		*(v1 + 0) = *(v2 + 0);                                                \
 		*(v1 + 1) = *(v2 + 1);                                                \
 		*(v1 + 2) = *(v2 + 2);                                                \
 } (void)0
 #define VECCOPY2D(v1, v2) {                                                   \
-		*(v1) =   *(v2);                                                      \
+		*(v1 + 0) = *(v2 + 0);                                                \
 		*(v1 + 1) = *(v2 + 1);                                                \
 } (void)0
+#define VECCOPY4D(v1, v2) {                                                   \
+		*(v1 + 0) = *(v2 + 0);                                                \
+		*(v1 + 1) = *(v2 + 1);                                                \
+		*(v1 + 2) = *(v2 + 2);                                                \
+		*(v1 + 3) = *(v2 + 3);                                                \
+} (void)0
 #define VECADD(v1, v2, v3) {                                                  \
 		*(v1) =   *(v2)   + *(v3);                                            \
 		*(v1 + 1) = *(v2 + 1) + *(v3 + 1);                                    \

Modified: branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c	2013-09-23 13:21:27 UTC (rev 60332)
+++ branches/soc-2013-viewport_fx/source/blender/editors/gpencil/drawgpencil.c	2013-09-23 13:58:46 UTC (rev 60333)
@@ -504,7 +504,7 @@
 			int mask_orig = 0;
 			
 			if (no_xray) {
-				mask_orig = gpuGetDepthWritemask();
+				mask_orig = gpuGetDepthWriteMask();
 				gpuDepthMask(GL_FALSE);
 				glEnable(GL_DEPTH_TEST);
 				

Modified: branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c	2013-09-23 13:21:27 UTC (rev 60332)
+++ branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_draw.c	2013-09-23 13:58:46 UTC (rev 60333)
@@ -67,6 +67,7 @@
 #include "GPU_primitives.h"
 #include "GPU_raster.h"
 #include "GPU_sprite.h"
+#include "GPU_state_latch.h"
 
 /* standard */
 #include <math.h>
@@ -604,7 +605,7 @@
 	uiDrawBox(GL_TRIANGLE_FAN, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f);
 
 	/* need scissor test, histogram can draw outside of boundary */
-	glGetIntegerv(GL_VIEWPORT, scissor);
+	gpuGetViewport(scissor);
 	glScissor(ar->winrct.xmin + (rect.xmin - 1),
 	          ar->winrct.ymin + (rect.ymin - 1),
 	          (rect.xmax + 1) - (rect.xmin - 1),
@@ -695,7 +696,7 @@
 	
 
 	/* need scissor test, waveform can draw outside of boundary */
-	glGetIntegerv(GL_VIEWPORT, scissor);
+	gpuGetViewport(scissor);
 	glScissor(ar->winrct.xmin + (rect.xmin - 1),
 	          ar->winrct.ymin + (rect.ymin - 1),
 	          (rect.xmax + 1) - (rect.xmin - 1),
@@ -934,7 +935,7 @@
 	uiDrawBox(GL_TRIANGLE_FAN, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f);
 
 	/* need scissor test, hvectorscope can draw outside of boundary */
-	glGetIntegerv(GL_VIEWPORT, scissor);
+	gpuGetViewport(scissor);
 	glScissor(ar->winrct.xmin + (rect.xmin - 1),
 	          ar->winrct.ymin + (rect.ymin - 1),
 	          (rect.xmax + 1) - (rect.xmin - 1),
@@ -1314,7 +1315,7 @@
 	cuma = &cumap->cm[cumap->cur];
 
 	/* need scissor test, curve can draw outside of boundary */
-	glGetIntegerv(GL_VIEWPORT, scissor);
+	gpuGetViewport(scissor);
 	scissor_new.xmin = ar->winrct.xmin + rect->xmin;
 	scissor_new.ymin = ar->winrct.ymin + rect->ymin;
 	scissor_new.xmax = ar->winrct.xmin + rect->xmax;
@@ -1518,7 +1519,7 @@
 	glEnable(GL_BLEND);
 
 	/* need scissor test, preview image can draw outside of boundary */
-	glGetIntegerv(GL_VIEWPORT, scissor);
+	gpuGetViewport(scissor);
 	glScissor(ar->winrct.xmin + (rect.xmin - 1),
 	          ar->winrct.ymin + (rect.ymin - 1),
 	          (rect.xmax + 1) - (rect.xmin - 1),
@@ -1659,7 +1660,7 @@
 	y = 0.5f * (recti->ymin + recti->ymax);
 	
 	/* need scissor test, can draw outside of boundary */
-	glGetIntegerv(GL_VIEWPORT, scissor);
+	gpuGetViewport(scissor);
 	scissor_new.xmin = ar->winrct.xmin + recti->xmin;
 	scissor_new.ymin = ar->winrct.ymin + recti->ymin;
 	scissor_new.xmax = ar->winrct.xmin + recti->xmax;

Modified: branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c	2013-09-23 13:21:27 UTC (rev 60332)
+++ branches/soc-2013-viewport_fx/source/blender/editors/screen/glutil.c	2013-09-23 13:58:46 UTC (rev 60333)
@@ -607,7 +607,7 @@
 	int sc_w, sc_h;
 	float wo_w, wo_h;
 
-	glGetIntegerv(GL_VIEWPORT, (GLint *)di->orig_vp);
+	gpuGetViewport((GLint *)di->orig_vp);
 	gpuGetMatrix(GL_PROJECTION_MATRIX, (GLfloat *)di->orig_projmat);
 	gpuGetMatrix(GL_MODELVIEW_MATRIX, (GLfloat *)di->orig_viewmat);
 
@@ -676,7 +676,7 @@
 
 	gpuGetMatrix(GL_MODELVIEW_MATRIX, mats->modelview);
 	gpuGetMatrix(GL_PROJECTION_MATRIX, mats->projection);
-	glGetIntegerv(GL_VIEWPORT, (GLint *)mats->viewport);
+	gpuGetViewport((GLint *)mats->viewport);
 	
 	/* Very strange code here - it seems that certain bad values in the
 	 * modelview matrix can cause gluUnProject to give bad results. */

Modified: branches/soc-2013-viewport_fx/source/blender/editors/sculpt_paint/paint_utils.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/sculpt_paint/paint_utils.c	2013-09-23 13:21:27 UTC (rev 60332)
+++ branches/soc-2013-viewport_fx/source/blender/editors/sculpt_paint/paint_utils.c	2013-09-23 13:58:46 UTC (rev 60333)
@@ -73,6 +73,7 @@
 #include "paint_intern.h"
 
 #include "GPU_glew.h"
+#include "GPU_state_latch.h"
 
 /* Convert the object-space axis-aligned bounding box (expressed as
  * its minimum and maximum corners) into a screen-space rectangle,
@@ -221,7 +222,7 @@
 	/* compute barycentric coordinates */
 
 	/* get the needed opengl matrices */
-	glGetIntegerv(GL_VIEWPORT, view);
+	gpuGetViewport(view);
 	gpuGetMatrix(GL_MODELVIEW_MATRIX,  (float *)model);
 	gpuGetMatrix(GL_PROJECTION_MATRIX, (float *)proj);
 	view[0] = view[1] = 0;

Modified: branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_draw.c	2013-09-23 13:21:27 UTC (rev 60332)
+++ branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/view3d_draw.c	2013-09-23 13:58:46 UTC (rev 60333)
@@ -2450,7 +2450,7 @@
 		v3d->xray = TRUE;
 		
 		/* transp materials can change the depth mask, see #21388 */
-		mask_orig = gpuGetDepthWritemask();
+		mask_orig = gpuGetDepthWriteMask();
 
 
 		if (v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first) {

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt	2013-09-23 13:21:27 UTC (rev 60332)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt	2013-09-23 13:58:46 UTC (rev 60333)
@@ -57,6 +57,7 @@
 	intern/gpu_profile.h
 	intern/gpu_raster_intern.h
 	intern/gpu_sprite_intern.h
+	intern/gpu_state_latch_intern.h
 )
 
 set(GLSL_SRC

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/GPU_safety.h
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/GPU_safety.h	2013-09-23 13:21:27 UTC (rev 60332)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/GPU_safety.h	2013-09-23 13:58:46 UTC (rev 60333)
@@ -28,13 +28,13 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/gpu/intern/gpu_safety.h
+/** \file blender/gpu/GPU_safety.h
  *  \ingroup gpu
  */
 
 
 
-#ifndef GPU_SAFETY 
+#ifndef GPU_SAFETY
 #if (!defined(NDEBUG) && WITH_GPU_SAFETY)
 #define GPU_SAFETY 1
 #else
@@ -44,7 +44,7 @@
 
 
 
-#if GPU_SAFETY /* Define some useful, but slow, checks for correct API usage. */
+#if GPU_SAFETY /* Define some useful, but potentially slow, checks for correct API usage. */
 
 #include "BLI_utildefines.h"
 
@@ -70,7 +70,7 @@
    Needs a variable in scope to store results of the test.
    Can be used in functions that return void if third argument is left blank */
 #define GPU_SAFE_RETURN(test, var, ret) \
-    var = (bool)(test);            \
+    var = (bool)(test);                 \
     GPU_ASSERT(((void)#test, var));     \
     if (!var) {                         \
         return ret;                     \

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/GPU_state_latch.h
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/GPU_state_latch.h	2013-09-23 13:21:27 UTC (rev 60332)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/GPU_state_latch.h	2013-09-23 13:58:46 UTC (rev 60333)
@@ -55,19 +55,23 @@
 
 */
 
-/* These also covers the fact the ES 2.0 doesn't accept GLdouble for depth range by doing a conversion. */
+/* the DepthRange state latch also covers the fact the ES 2.0 doesn't accept
+   GLdouble for depth range by doing a conversion. */
 void gpuDepthRange(GLdouble near, GLdouble far);
 void gpuGetDepthRange(GLdouble range[2]);
 
-GLfloat GPU_feedback_depth_range(GLfloat z);
-
 void gpuBindTexture(GLenum target, GLuint name);
 GLuint gpuGetTextureBinding2D(void);
 
 void gpuDepthMask(GLboolean flag);
-GLboolean gpuGetDepthWritemask(void);
+GLboolean gpuGetDepthWriteMask(void);
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list