[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58995] branches/soc-2013-viewport_fx/ source/blender: Created shader for 'DrawPixels', got 'DrawPixels' working on ES, removed last FAKE/REAL GL cruft

Jason Wilkins Jason.A.Wilkins at gmail.com
Wed Aug 7 19:15:43 CEST 2013


Revision: 58995
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58995
Author:   jwilkins
Date:     2013-08-07 17:15:42 +0000 (Wed, 07 Aug 2013)
Log Message:
-----------
Created shader for 'DrawPixels', got 'DrawPixels' working on ES, removed last FAKE/REAL GL cruft

Modified Paths:
--------------
    branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_icons.c
    branches/soc-2013-viewport_fx/source/blender/editors/screen/area.c
    branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawarmature.c
    branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.c
    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_draw.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_font_shader.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_gl.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_pixels.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_pixels.h
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_primitives.c
    branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_view_gl.c
    branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_font_vert.glsl

Added Paths:
-----------
    branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_pixels_frag.glsl
    branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_pixels_uniforms.glsl
    branches/soc-2013-viewport_fx/source/blender/gpu/shaders/gpu_shader_pixels_vert.glsl

Modified: branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_icons.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_icons.c	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/editors/interface/interface_icons.c	2013-08-07 17:15:42 UTC (rev 58995)
@@ -559,7 +559,7 @@
 
 #undef INIT_BRUSH_ICON
 }
-//#include REAL_GL_MODE
+
 static void icon_verify_datatoc(IconImage *iimg)
 {
 	/* if it has own rect, things are all OK */
@@ -735,8 +735,8 @@
 	IMB_freeImBuf(b32buf);
 	
 }
-//#include FAKE_GL_MODE
 
+
 #endif  /* WITH_HEADLESS */
 
 
@@ -1076,7 +1076,8 @@
 		IMB_freeImBuf(ima);
 }
 
-//#include REAL_GL_MODE
+
+
 static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy,
                               int UNUSED(iw), int ih, float alpha, const float rgb[3])
 {

Modified: branches/soc-2013-viewport_fx/source/blender/editors/screen/area.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/screen/area.c	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/editors/screen/area.c	2013-08-07 17:15:42 UTC (rev 58995)
@@ -61,7 +61,7 @@
 
 #include "GPU_colors.h"
 #include "GPU_primitives.h"
-//#include REAL_GL_MODE
+
 #include "BLF_api.h"
 
 #include "BIF_glutil.h"

Modified: branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawarmature.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawarmature.c	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/editors/space_view3d/drawarmature.c	2013-08-07 17:15:42 UTC (rev 58995)
@@ -988,7 +988,6 @@
 	float length;
 
 	gpuPixelFormat(GL_UNPACK_ALIGNMENT, 1);
-	gpuPixelsBegin();
 
 	if (pchan) 
 		length = pchan->bone->length;
@@ -1026,9 +1025,11 @@
 				gpuEnd();
 			}
 			else {
+				gpuPixelsBegin();
 				gpuPixelPos3f(0.0f, 0.0f, 0.0f);
 				gpuCacheBitmap(&bm_dot8);
 				gpuBitmap(&bm_dot8);
+				gpuPixelsEnd();
 			}
 		}
 
@@ -1049,9 +1050,11 @@
 			gpuEnd();
 		}
 		else {
+			gpuPixelsBegin();
 			gpuPixelPos3f(0.0f, 1.0f, 0.0f);
 			gpuCacheBitmap(&bm_dot7);
 			gpuBitmap(&bm_dot7);
+			gpuPixelsEnd();
 		}
 
 		/* further we send no names */
@@ -1073,9 +1076,11 @@
 				else UI_ThemeColor(TH_VERTEX);
 			}
 
+			gpuPixelsBegin();
 			gpuPixelPos3f(0.0f, 0.0f, 0.0f);
 			gpuCacheBitmap(&bm_dot6);
 			gpuBitmap(&bm_dot6);
+			gpuPixelsEnd();
 		}
 	}
 
@@ -1097,9 +1102,11 @@
 			else UI_ThemeColor(TH_VERTEX);
 		}
 
+		gpuPixelsBegin();
 		gpuPixelPos3f(0.0f, 1.0f, 0.0f);
 		gpuCacheBitmap(&bm_dot5);
 		gpuBitmap(&bm_dot5);
+		gpuPixelsEnd();
 	}
 
 	gpuLineWidth(1.0);
@@ -1113,7 +1120,6 @@
 		GPU_aspect_disable(GPU_ASPECT_BASIC, GPU_BASIC_TEXTURE_2D);
 	}
 
-	gpuPixelsEnd();
 	gpuPixelFormat(GL_UNPACK_ALIGNMENT, 4);  /* restore default value */
 }
 

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/CMakeLists.txt	2013-08-07 17:15:42 UTC (rev 58995)
@@ -126,6 +126,10 @@
 data_to_c_simple(shaders/gpu_shader_font_frag.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_font_vert.glsl SRC)
 
+data_to_c_simple(shaders/gpu_shader_pixels_uniforms.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_pixels_frag.glsl SRC)
+data_to_c_simple(shaders/gpu_shader_pixels_vert.glsl SRC)
+
 data_to_c_simple(shaders/gpu_shader_basic_frag.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_basic_vert.glsl SRC)
 
@@ -140,4 +144,3 @@
 add_definitions(${GL_DEFINITIONS})
 
 blender_add_lib(bf_gpu "${SRC}" "${INC}" "${INC_SYS}")
-

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.c	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.c	2013-08-07 17:15:42 UTC (rev 58995)
@@ -43,6 +43,7 @@
 static size_t aspect_free = 0;
 static size_t aspect_fill = 0;
 
+static GPUaspectfuncs dummy = { NULL };
 
 
 void gpu_initialize_aspects(void)
@@ -89,6 +90,7 @@
 
 	while (dst < count) {
 		if (!GPU_ASPECT_FUNCS[src]) {
+			GPU_ASPECT_FUNCS[src] = &dummy;
 			aspects[dst] = src;
 			dst++;
 			aspect_fill = dst;

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.c	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.c	2013-08-07 17:15:42 UTC (rev 58995)
@@ -31,6 +31,7 @@
 
 #define GPU_ASPECT_INTERN
 #include "intern/gpu_aspectfuncs.h"
+#include "intern/gpu_pixels.h"
 
 #include "GPU_basic_shader.h"
 #include "GPU_font_shader.h"
@@ -61,6 +62,28 @@
 
 
 
+static bool pixels_end(void* UNUSED(param), const void* UNUSED(object))
+{
+	GPU_pixels_shader_unbind();
+
+	return true;
+}
+
+static void pixels_commit(void* UNUSED(param))
+{
+	GPU_pixels_shader_bind();
+}
+
+GPUaspectfuncs GPU_ASPECTFUNCS_PIXELS = {
+	NULL,          /* begin   */
+	pixels_end,    /* end     */
+	pixels_commit, /* commit  */
+	NULL,          /* enable  */
+	NULL,          /* disable */
+};
+
+
+
 static bool basic_end(void* UNUSED(param), const void* UNUSED(object))
 {
 	GPU_basic_shader_unbind();
@@ -97,9 +120,11 @@
 {
 	GPU_gen_aspects(1, &GPU_ASPECT_FONT);
 	GPU_gen_aspects(1, &GPU_ASPECT_BASIC);
+	GPU_gen_aspects(1, &GPU_ASPECT_PIXELS);
 
-	GPU_aspect_funcs(GPU_ASPECT_FONT,  &GPU_ASPECTFUNCS_FONT);
-	GPU_aspect_funcs(GPU_ASPECT_BASIC, &GPU_ASPECTFUNCS_BASIC);
+	GPU_aspect_funcs(GPU_ASPECT_FONT,   &GPU_ASPECTFUNCS_FONT);
+	GPU_aspect_funcs(GPU_ASPECT_BASIC,  &GPU_ASPECTFUNCS_BASIC);
+	GPU_aspect_funcs(GPU_ASPECT_PIXELS, &GPU_ASPECTFUNCS_PIXELS);
 }
 
 
@@ -108,4 +133,5 @@
 {
 	GPU_delete_aspects(1, &GPU_ASPECT_FONT);
 	GPU_delete_aspects(1, &GPU_ASPECT_BASIC);
+	GPU_delete_aspects(1, &GPU_ASPECT_PIXELS);
 }

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.h
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.h	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.h	2013-08-07 17:15:42 UTC (rev 58995)
@@ -46,11 +46,13 @@
 
 GPU_ASPECT_EXTERN(GPU_ASPECT_FONT);
 GPU_ASPECT_EXTERN(GPU_ASPECT_BASIC);
+GPU_ASPECT_EXTERN(GPU_ASPECT_PIXELS);
 
 
 
 extern GPUaspectfuncs GPU_ASPECTFUNCS_FONT;
 extern GPUaspectfuncs GPU_ASPECTFUNCS_BASIC;
+extern GPUaspectfuncs GPU_ASPECTFUNCS_PIXELS;
 
 
 

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_shader.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_shader.c	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_basic_shader.c	2013-08-07 17:15:42 UTC (rev 58995)
@@ -148,12 +148,11 @@
 
 	const uint32_t options = tweak_options();
 
-GPU_CHECK_NO_ERROR();
+	GPU_CHECK_NO_ERROR();
 
 	/* create shader if it doesn't exist yet */
 	if (BASIC_SHADER.gpushader[options] != NULL) {
 		GPU_shader_bind(BASIC_SHADER.gpushader[options]);
-GPU_CHECK_NO_ERROR();
 		gpu_set_common(BASIC_SHADER.common + options);
 	}
 	else if (!BASIC_SHADER.failed[options]) {
@@ -199,7 +198,6 @@
 
 		BASIC_SHADER.gpushader[options] =
 			GPU_shader_create(vert_cstring, frag_cstring, NULL, defs_cstring);
-GPU_CHECK_NO_ERROR();
 
 		MEM_freeN(vert_cstring);
 		MEM_freeN(frag_cstring);
@@ -214,7 +212,6 @@
 			gpu_set_common (BASIC_SHADER.common + options);
 
 			GPU_shader_bind(BASIC_SHADER.gpushader[options]);
-GPU_CHECK_NO_ERROR();
 		}
 		else {
 			BASIC_SHADER.failed[options] = true;
@@ -224,6 +221,8 @@
 	else {
 		gpu_set_common(NULL);
 	}
+
+	GPU_CHECK_NO_ERROR();
 }
 
 

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_draw.c	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_draw.c	2013-08-07 17:15:42 UTC (rev 58995)
@@ -730,9 +730,9 @@
 
 	if (*bind != 0) {
 		/* enable opengl drawing with textures */
-//#include REAL_GL_MODE
+
 		gpuBindTexture(GL_TEXTURE_2D, *bind);
-//#include FAKE_GL_MODE
+
 		BKE_image_release_ibuf(ima, ibuf, NULL);
 		return *bind;
 	}
@@ -1138,8 +1138,8 @@
 	BKE_image_release_ibuf(ima, ibuf, NULL);
 }
 
-//#include REAL_GL_MODE
 
+
 void GPU_update_images_framechange(void)
 {
 	Image *ima;
@@ -1421,8 +1421,8 @@
 	}
 }
 
-//#include FAKE_GL_MODE
 
+
 static void disable_alphatest(void)
 {
 	if (GMS.lastalphatestenabled) {

Modified: 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.c	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.c	2013-08-07 17:15:42 UTC (rev 58995)
@@ -33,8 +33,8 @@
 
 #include <stdlib.h>
 
-//#include REAL_GL_MODE
 
+
 #if GPU_SAFETY
 
 #define GPU_CHECK_INVALID_PNAME(symbol)           \

Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c	2013-08-07 16:57:18 UTC (rev 58994)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extensions.c	2013-08-07 17:15:42 UTC (rev 58995)
@@ -41,6 +41,7 @@
 /* internal */
 #include "intern/gpu_codegen.h"
 #include "intern/gpu_extension_wrapper.h"
+#include "intern/gpu_pixels.h"
 
 /* external */
 #include "BLI_blenlib.h"
@@ -298,10 +299,11 @@
 
 	GPU_basic_shaders_init();
 	GPU_font_shader_init();
+	GPU_pixels_shader_init();
 
 	gpu_initialize_aspects();
 	gpu_initialize_aspect_funcs();
-	GPU_aspect_begin(GPU_ASPECT_BASIC, 0);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list