[Bf-blender-cvs] [85d5c78] temp_viewport_fx_merge: Blender compiles again and has most of the mising files now.

Antony Riakiotakis noreply at git.blender.org
Wed Mar 18 22:37:58 CET 2015


Commit: 85d5c78901d04bb8b9a0b370d45b8d5fce9a3ef0
Author: Antony Riakiotakis
Date:   Wed Mar 18 22:37:44 2015 +0100
Branches: temp_viewport_fx_merge
https://developer.blender.org/rB85d5c78901d04bb8b9a0b370d45b8d5fce9a3ef0

Blender compiles again and has most of the mising files now.

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

M	source/blender/blenlib/BLI_math_vector.h
M	source/blender/blenlib/intern/math_vector_inline.c
M	source/blender/gpu/CMakeLists.txt
M	source/blender/gpu/intern/gpu_init_exit.c
M	source/blender/gpu/intern/gpu_primitives.c
M	source/blender/gpu/intern/gpu_private.h
M	source/blender/gpu/intern/gpu_select.c
A	source/blender/gpu/intern/gpu_state_latch.c
A	source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
A	source/blender/gpu/shaders/gpu_shader_basic_vert.glsl

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

diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index de712cb..219caf5 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -87,6 +87,8 @@ MINLINE void copy_v4db_v4fl(double r[4], const float a[4]);
 MINLINE void copy_v2_fl2(float v[2], float x, float y);
 MINLINE void copy_v3_fl3(float v[3], float x, float y, float z);
 MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w);
+/* double args -> vec */
+MINLINE void copy_v2_db2(double v[2], double x, double y);
 
 /********************************* Arithmetic ********************************/
 
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index dae2c0a..5b38d51 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -257,6 +257,13 @@ MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w)
 	v[3] = w;
 }
 
+/* double args -> vec */
+MINLINE void copy_v2_db2(double v[2], double x, double y)
+{
+	v[0] = x;
+	v[1] = y;
+}
+
 /********************************* Arithmetic ********************************/
 
 MINLINE void add_v2_fl(float r[2], float f)
@@ -361,12 +368,6 @@ MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
 	r[2] = a[2] - b[2];
 }
 
-MINLINE void copy_v2_flfl(float r[2], float f0, float f1)
-{
-	r[0] = f0;
-	r[1] = f1;
-}
-
 MINLINE void copy_v3_flflfl(float r[3], float f0, float f1, float f2)
 {
 	r[0] = f0;
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 2a43942..1d3d341 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -67,6 +67,7 @@ set(SRC
 	intern/gpu_simple_shader.c
 	intern/gpu_select.c
 	intern/gpu_sprite.c
+	intern/gpu_state_latch.c
 	intern/gpu_compositing.c
 	intern/gpu_debug.c
 
@@ -95,6 +96,8 @@ set(SRC
 	shaders/gpu_shader_raster_frag.glsl
 	shaders/gpu_shader_font_vert.glsl
 	shaders/gpu_shader_font_frag.glsl
+	shaders/gpu_shader_basic_vert.glsl
+	shaders/gpu_shader_basic_frag.glsl
 
 	GPU_aspect.h
 	GPU_buffers.h
@@ -148,6 +151,8 @@ data_to_c_simple(shaders/gpu_shader_raster_vert.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_raster_frag.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_font_vert.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_font_frag.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_basic_vert.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_basic_frag.glsl SRC)
 
 if(WITH_GAMEENGINE)
 	add_definitions(-DWITH_GAMEENGINE)
diff --git a/source/blender/gpu/intern/gpu_init_exit.c b/source/blender/gpu/intern/gpu_init_exit.c
index b000abc..d658f71 100644
--- a/source/blender/gpu/intern/gpu_init_exit.c
+++ b/source/blender/gpu/intern/gpu_init_exit.c
@@ -64,13 +64,13 @@ void GPU_init(void)
 	gpu_common_init();
 	gpu_font_init();
 	gpu_immediate_init();
-//	gpu_lighting_init();
+	gpu_lighting_init();
 	gpu_matrix_init();
 	gpu_pixels_init();
 	gpu_raster_init();
 //	gpu_select_init();
-//	gpu_sprite_init();
-//	gpu_state_latch_init();
+	gpu_sprite_init();
+	gpu_state_latch_init();
 
 	gpu_immediate = gpuNewImmediate();
 	gpuImmediateMakeCurrent(gpu_immediate);
diff --git a/source/blender/gpu/intern/gpu_primitives.c b/source/blender/gpu/intern/gpu_primitives.c
index 08fe6d3..2dc3b33 100644
--- a/source/blender/gpu/intern/gpu_primitives.c
+++ b/source/blender/gpu/intern/gpu_primitives.c
@@ -744,13 +744,13 @@ BLI_INLINE void shape3(
 	uIndex = 0;
 
 	if (uFracAngle != 0) {
-		copy_v2_flfl(uArc[uIndex++], cosf(prim->thetaMin), sinf(prim->thetaMin));
+		copy_v2_fl2(uArc[uIndex++], cosf(prim->thetaMin), sinf(prim->thetaMin));
 	}
 
 	for (i = 0; i <= uWholeSegs; i++) {
 		GLfloat a = prim->thetaMin + uFracAngle + i*sweepAngle/(prim->usegs);
 
-		copy_v2_flfl(uArc[uIndex++], cosf(a), sinf(a));
+		copy_v2_fl2(uArc[uIndex++], cosf(a), sinf(a));
 	}
 
 	if (uFracSegs == 0) {
@@ -758,7 +758,7 @@ BLI_INLINE void shape3(
 	}
 	else {
 		usegs = uIndex;
-		copy_v2_flfl(uArc[usegs], cosf(prim->thetaMax), sinf(prim->thetaMax));
+		copy_v2_fl2(uArc[usegs], cosf(prim->thetaMax), sinf(prim->thetaMax));
 	}
 
 	uCycle =
diff --git a/source/blender/gpu/intern/gpu_private.h b/source/blender/gpu/intern/gpu_private.h
index 9b29ccf..05ab444 100644
--- a/source/blender/gpu/intern/gpu_private.h
+++ b/source/blender/gpu/intern/gpu_private.h
@@ -135,6 +135,9 @@ void gpu_sprite_unbind(void);
 void gpu_immediate_init(void);
 void gpu_immediate_exit(void);
 
+void gpu_state_latch_init(void);
+void gpu_state_latch_exit(void);
+
 typedef enum GPUBasicOption {
 	GPU_BASIC_LIGHTING       = (1<<0), /* do lighting computations                */
 	GPU_BASIC_TWO_SIDE       = (1<<1), /* flip back-facing normals towards viewer */
diff --git a/source/blender/gpu/intern/gpu_select.c b/source/blender/gpu/intern/gpu_select.c
index 4978229..e0e17e8 100644
--- a/source/blender/gpu/intern/gpu_select.c
+++ b/source/blender/gpu/intern/gpu_select.c
@@ -32,6 +32,8 @@
 #include "GPU_select.h"
 #include "GPU_extensions.h"
 #include "GPU_glew.h"
+
+#include "intern/gpu_private.h"
  
 #include "MEM_guardedalloc.h"
 
@@ -246,3 +248,46 @@ bool GPU_select_query_check_active(void)
 	       ((U.gpu_select_method == USER_SELECT_USE_OCCLUSION_QUERY) ||
 	        ((U.gpu_select_method == USER_SELECT_AUTO) && GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)));
 }
+
+static bool IS_SELECT_MODE = false;
+
+void gpu_select_init(void)
+{
+	IS_SELECT_MODE = false;
+}
+
+void gpu_select_exit(void)
+{
+}
+
+bool gpu_default_select_begin(const void* UNUSED(object), void* UNUSED(param))
+{
+#if defined(WITH_GPU_PROFILE_COMPAT)
+	return true; /* nothing to do, allow this pass to start */
+#else
+	return false; /* not implemented, so cancel this pass before it starts if possible */
+#endif
+}
+
+bool gpu_default_select_end(const void* UNUSED(object), void* UNUSED(param))
+{
+	return true; /* only one pass, 'true' means 'done' */
+}
+
+bool gpu_default_select_commit(const void* UNUSED(object))
+{
+#if defined(WITH_GPU_PROFILE_COMPAT)
+	gpu_set_common(NULL);
+	gpu_glUseProgram(0);
+	gpu_commit_matrix();
+
+	return true;
+#else
+	return false; /* cancel drawing, since select mode isn't implemented */
+#endif
+}
+
+bool gpu_is_select_mode(void)
+{
+	return IS_SELECT_MODE;
+}
diff --git a/source/blender/gpu/intern/gpu_state_latch.c b/source/blender/gpu/intern/gpu_state_latch.c
new file mode 100644
index 0000000..e668135
--- /dev/null
+++ b/source/blender/gpu/intern/gpu_state_latch.c
@@ -0,0 +1,230 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Jason Wilkins.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/gpu/intern/gpu_state_latch.c
+ *  \ingroup gpu
+ */
+
+#define GPU_MANGLE_DEPRECATED 0
+
+#include "GPU_debug.h"
+#include "GPU_state_latch.h"
+
+#include "BLI_sys_types.h"
+#include "BLI_utildefines.h"
+
+#include "gpu_private.h"
+
+#include "BLI_math_vector.h"
+
+#include <string.h>
+
+
+
+// XXX jwilkins: this needs to be made to save these values from different contexts
+
+static bool      depth_range_valid = false;
+static GLdouble  depth_range[2];
+
+static bool      viewport_valid = false;
+static GLint     viewport[4];
+
+static bool      texture_binding_2D_valid = false;
+static GLuint    texture_binding_2D;
+
+static bool      depth_writemask_valid = false;
+static GLboolean depth_writemask;
+
+
+
+void gpu_state_latch_init(void)
+{
+#if defined(WITH_GL_PROFILE_COMPAT)
+	GLint value;
+
+	glGetDoublev(GL_DEPTH_RANGE, depth_range);
+	depth_range_valid = true;
+
+	glGetIntegerv(GL_VIEWPORT, viewport);
+	viewport_valid = true;
+
+	value = 0;
+	glGetIntegerv(GL_TEXTURE_BINDING_2D, &value);
+	texture_binding_2D       = (GLuint)value;
+	texture_binding_2D_valid = true;
+
+	glGetBooleanv(GL_DEPTH_WRITEMASK, &depth_writemask);
+	depth_writemask_valid    = true;
+#else
+	depth_range_valid        = false;
+	viewport_valid           = false;
+	texture_binding_2D_valid = false;
+	depth_writemask_valid    = false;
+#endif
+}
+
+
+
+void gpu_state_latch_exit(void)
+{
+}
+
+
+
+void gpuDepthRange(GLdouble near, GLdouble far)
+{
+	BLI_assert(near != far);
+
+	copy_v2_db2(depth_range, near, far);
+
+	depth_range_valid = true;
+
+#if !defined(GLEW_ES_ONLY)
+//	if (!GPU_PROFILE_ES20) {
+		GPU_CHECK_ERRORS_AROUND(glDepthRange(near, far));
+		return;
+//	}
+#endif
+
+#if !defined(GLEW_NO_ES)
+	if (GPU_PROFILE_ES20) {
+		GPU_CHECK(glDepthRangef((GLfloat)near, (GLfloat)far));
+		return;
+	}
+#endif
+}
+
+
+
+void gpuGetDepthRange(GLdouble out[2])
+{
+	BLI_assert(depth_range_valid);
+
+	VECCOPY2D(out, depth_range);
+}
+
+
+
+GLfloat GPU_feedback_depth_range(GLfloat z)
+{
+	GLfloat depth;
+
+	BLI_assert(depth_range_valid);
+
+	depth = depth_range[1] - depth_range[0];
+
+	if (depth != 0) {
+		return z / depth;
+	}
+	else {
+		BLI_assert(0);
+		return z;
+	}
+}
+
+
+
+void gpuBindTexture(GLenum target, GLuint name)
+{
+	switch(target)
+	{
+		case GL_TEXTURE_2D:
+			texture_binding_2D       = name;
+			texture_binding_2D_valid = true;
+			break;
+
+		default:
+			/* a target we don't care to latch */
+			break;
+	}
+
+	GPU_CHECK_ERRORS_AROUND(glBindTexture(target, name));
+}
+
+
+
+GLuint gpuGetTextureBinding2D(void)
+{
+	BLI_assert(texture_binding_2D_valid);
+
+	return texture_bin

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list