[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60262] branches/soc-2013-viewport_fx/ source/blender: start of refactoring based on ideas gathered while writing documentation.

Jason Wilkins Jason.A.Wilkins at gmail.com
Fri Sep 20 14:30:32 CEST 2013


Revision: 60262
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60262
Author:   jwilkins
Date:     2013-09-20 12:30:31 +0000 (Fri, 20 Sep 2013)
Log Message:
-----------
start of refactoring based on ideas gathered while writing documentation.  incomplete because I have to move to a different computer

Modified Paths:
--------------
    branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_extensions.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_matrix.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_primitives.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_codegen.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_codegen.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_common.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_gl.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_gl.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_lighting.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_matrix.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_pixels.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_primitives.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_state_latch.c
    branches/soc-2013-viewport_fx/source/blender/windowmanager/intern/wm_init_exit.c

Added Paths:
-----------
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_aspect.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_basic.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_blender_aspect.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_common.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_deprecated.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_font.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_glew.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_init_exit.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_lighting.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_pixels.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_raster.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_safety.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_sprite.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_state_latch.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect_intern.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_intern.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_blender_aspect.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_blender_aspect_intern.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_common_intern.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions_intern.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_font.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_font_intern.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_init_exit.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_lighting_intern.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_matrix_intern.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_pixels_intern.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster_intern.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_sprite.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_sprite_intern.h

Removed Paths:
-------------
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_basic_shader.h
    branches/soc-2013-viewport_fx/source/blender/gpu/GPU_font_shader.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_shader.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_common.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_deprecated.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_font_shader.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_glew.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_lighting.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_pixels.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_raster.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_safety.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_state_latch.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_view.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_view.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_view_gl.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_view_gl.h

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt	2013-09-20 11:55:43 UTC (rev 60261)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt	2013-09-20 12:30:31 UTC (rev 60262)
@@ -46,8 +46,8 @@
 
 set(SRC
     intern/gpu_aspect.c
-	intern/gpu_aspectfuncs.c
-	intern/gpu_basic_shader.c
+	intern/gpu_aspectimpl.c
+	intern/gpu_basic.c
 	intern/gpu_buffers.c
 	intern/gpu_codegen.c
 	intern/gpu_common.c
@@ -58,6 +58,7 @@
 	intern/gpu_font_shader.c
 	intern/gpu_immediate.c
 	intern/gpu_immediate_gl.c
+	intern/gpu_init_exit.c
 	intern/gpu_lighting.c
 	intern/gpu_material.c
 	intern/gpu_matrix.c
@@ -65,26 +66,34 @@
 	intern/gpu_primitives.c
 	intern/gpu_raster.c
 	intern/gpu_select.c
+	intern/gpu_sprite.c
 	intern/gpu_state_latch.c
 	intern/gpu_view.c
 	intern/gpu_view_gl.c
 
-	GPU_basic_shader.h
+	GPU_aspect.h
+	GPU_basic.h
 	GPU_buffers.h
 	GPU_colors.h
+	GPU_commoh.h
+	GPU_compatibility.h
 	GPU_draw.h
-	GPU_compatibility.h
 	GPU_extensions.h
 	GPU_font_shader.h
+	GPU_init_exit.h
 	GPU_material.h
 	GPU_matrix.h
 	GPU_primitives.h
 	GPU_utility.h
+	GPU_safety.h
+	GPU_sprite.h
 
-	intern/gpu_aspect.h
+	intern/gpu_aspect_intern.h
+	intern/gpu_basic_intern.h
+	intern/gpu_sprite_intern.h
+	
 	intern/gpu_aspectfuncs.h
 	intern/gpu_codegen.h
-	intern/gpu_common.h
 	intern/gpu_deprecated.h
 	intern/gpu_extension_wrapper.h
 	intern/gpu_glew.h
@@ -96,7 +105,6 @@
 	intern/gpu_primitives_inline.h
 	intern/gpu_profile.h
 	intern/gpu_raster.h
-	intern/gpu_safety.h
 	intern/gpu_select.h
 	intern/gpu_state_latch.h
 	intern/gpu_view.h

Copied: branches/soc-2013-viewport_fx/source/blender/gpu/GPU_aspect.h (from rev 60251, branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.h)
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/GPU_aspect.h	                        (rev 0)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/GPU_aspect.h	2013-09-20 12:30:31 UTC (rev 60262)
@@ -0,0 +1,67 @@
+#ifndef _GPU_ASPECT_H_
+#define _GPU_ASPECT_H_
+
+/*
+ * ***** 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) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Jason Wilkins.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/gpu/GPU_aspect.h
+  *  \ingroup gpu
+  */
+
+#include "BLI_sys_types.h"
+
+#include <string.h> /* for size_t */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void GPU_gen_aspects   (size_t count,       uint32_t* aspects);
+void GPU_delete_aspects(size_t count, const uint32_t* aspects);
+
+typedef struct GPUaspectimpl {
+	bool  (*begin  )(void* param, const void* object);
+	bool  (*end    )(void* param, const void* object);
+	void  (*commit )(void* param);
+	void  (*enable )(void* param, uint32_t options);
+	void  (*disable)(void* param, uint32_t options);
+	void* param;
+} GPUaspectfuncs;
+
+void GPU_aspect_impl(uint32_t aspect, GPUaspectimpl* aspectImpl);
+
+bool GPU_aspect_begin(uint32_t aspect, const void* object);
+bool GPU_aspect_end  (void);
+
+void GPU_aspect_enable (uint32_t aspect, uint32_t options);
+void GPU_aspect_disable(uint32_t aspect, uint32_t options);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GPU_ASPECT_H_ */

Copied: branches/soc-2013-viewport_fx/source/blender/gpu/GPU_basic.h (from rev 60251, branches/soc-2013-viewport_fx/source/blender/gpu/GPU_basic_shader.h)
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/GPU_basic.h	                        (rev 0)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/GPU_basic.h	2013-09-20 12:30:31 UTC (rev 60262)
@@ -0,0 +1,67 @@
+#ifndef _GPU_BASIC_H_
+#define _GPU_BASIC_H_
+
+/*
+ * ***** 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) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Brecht Van Lommel, Jason Wilkins.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file source/blender/gpu/GPU_basic.h
+ *  \ingroup gpu
+ */
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+typedef enum GPUBasicOption {
+	GPU_BASIC_LIGHTING       = (1<<0), /* do lighting computations                */
+	GPU_BASIC_TWO_SIDE       = (1<<1), /* flip back-facing normals towards viewer */
+	GPU_BASIC_TEXTURE_2D     = (1<<2), /* use 2D texture to replace diffuse color */
+	GPU_BASIC_LOCAL_VIEWER   = (1<<3), /* use for orthographic projection         */
+	GPU_BASIC_SMOOTH         = (1<<4), /* use smooth shading                      */
+	GPU_BASIC_ALPHATEST      = (1<<5), /* use alpha test                          */
+
+	GPU_BASIC_FAST_LIGHTING  = (1<<6), /* use faster lighting (set automatically) */
+
+	GPU_BASIC_OPTIONS_NUM         = 7,
+	GPU_BASIC_OPTION_COMBINATIONS = (1<<GPU_BASIC_OPTIONS_NUM)
+} GPUBasicOption;
+
+
+
+bool GPU_basic_needs_normals(void);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GPU_BASIC_H_ */

Deleted: branches/soc-2013-viewport_fx/source/blender/gpu/GPU_basic_shader.h
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/GPU_basic_shader.h	2013-09-20 11:55:43 UTC (rev 60261)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/GPU_basic_shader.h	2013-09-20 12:30:31 UTC (rev 60262)
@@ -1,81 +0,0 @@
-#ifndef _GPU_SIMPLE_SHADER_H_
-#define _GPU_SIMPLE_SHADER_H_
-
-/*
- * ***** 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) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Brecht Van Lommel.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file GPU_basic_shader.h
- *  \ingroup gpu
- */
-
-#include "intern/gpu_lighting.h"
-
-#include "BLI_sys_types.h" // for uint32_t
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-/* Simple Shading */
-
-// XXX jwilkins: may need alpha testing?
-typedef enum GPUBasicShaderOption {
-	GPU_BASIC_LIGHTING       = (1<<0), /* do lighting computations                */
-	GPU_BASIC_TWO_SIDE       = (1<<1), /* flip backfacing normals towards viewer  */
-	GPU_BASIC_TEXTURE_2D     = (1<<2), /* use 2D texture to replace diffuse color */
-	GPU_BASIC_LOCAL_VIEWER   = (1<<3), /* use for orthographic projection         */
-	GPU_BASIC_SMOOTH         = (1<<4), /* use smooth shading                      */
-	GPU_BASIC_ALPHATEST      = (1<<5), /* use alpha test                          */
-
-	GPU_BASIC_FAST_LIGHTING = (1<<6), /* use faster lighting (set automatically) */
-
-	GPU_BASIC_OPTIONS_NUM         = 7,
-	GPU_BASIC_OPTION_COMBINATIONS = (1<<GPU_BASIC_OPTIONS_NUM)
-} GPUBasicShaderOption;
-
-void GPU_basic_shaders_init(void);
-void GPU_basic_shaders_exit(void);
-
-void GPU_basic_shader_enable(uint32_t options);
-void GPU_basic_shader_disable(uint32_t options);
-
-void GPU_basic_shader_bind(void);
-void GPU_basic_shader_unbind(void);
-
-bool GPU_basic_shader_needs_normals(void);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GPU_SIMPLE_SHADER_ */

Copied: branches/soc-2013-viewport_fx/source/blender/gpu/GPU_blender_aspect.h (from rev 60251, branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.h)
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/GPU_blender_aspect.h	                        (rev 0)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/GPU_blender_aspect.h	2013-09-20 12:30:31 UTC (rev 60262)
@@ -0,0 +1,53 @@
+#ifndef _GPU_BLENDER_ASPECT_H_
+#define _GPU_BLENDER_ASPECT_H_
+
+/*
+ * ***** 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

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list