[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49781] branches/soc-2012-swiss_cheese/ source: Switching most gl view calls to gpu wrapper ( To avoid a lot REAL_GL_MODE for ES)

Alexander Kuznetsov kuzsasha at gmail.com
Fri Aug 10 23:08:29 CEST 2012


Revision: 49781
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49781
Author:   alexk
Date:     2012-08-10 21:08:28 +0000 (Fri, 10 Aug 2012)
Log Message:
-----------
Switching most gl view calls to gpu wrapper (To avoid a lot REAL_GL_MODE for ES)
Fix blend function in GLSL viewport

Modified Paths:
--------------
    branches/soc-2012-swiss_cheese/source/blender/editors/armature/editarmature_sketch.c
    branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_widgets.c
    branches/soc-2012-swiss_cheese/source/blender/editors/interface/resources.c
    branches/soc-2012-swiss_cheese/source/blender/editors/screen/area.c
    branches/soc-2012-swiss_cheese/source/blender/editors/screen/glutil.c
    branches/soc-2012-swiss_cheese/source/blender/editors/sculpt_paint/paint_utils.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_action/space_action.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_buttons/space_buttons.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_clip/space_clip.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_console/space_console.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_file/space_file.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_graph/space_graph.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_image/space_image.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_info/info_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_info/space_info.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_logic/space_logic.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_nla/space_nla.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_node/node_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_outliner/space_outliner.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_script/space_script.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_sequencer/sequencer_draw.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_time/space_time.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2012-swiss_cheese/source/blender/editors/space_view3d/view3d_draw.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/GPU_compatibility.h
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_draw.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_matrix.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_view.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_view.h
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_view_gl.c
    branches/soc-2012-swiss_cheese/source/blender/gpu/intern/gpu_view_gl.h
    branches/soc-2012-swiss_cheese/source/blender/windowmanager/intern/wm_draw.c
    branches/soc-2012-swiss_cheese/source/blender/windowmanager/intern/wm_subwindow.c
    branches/soc-2012-swiss_cheese/source/blender/windowmanager/intern/wm_window.c
    branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Ketsji/KX_Dome.cpp
    branches/soc-2012-swiss_cheese/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/armature/editarmature_sketch.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/armature/editarmature_sketch.c	2012-08-10 20:22:30 UTC (rev 49780)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/armature/editarmature_sketch.c	2012-08-10 21:08:28 UTC (rev 49781)
@@ -2030,7 +2030,7 @@
 	ToolSettings *ts = scene->toolsettings;
 	SK_Stroke *stk;
 
-	glClear(GL_DEPTH_BUFFER_BIT);
+	gpuClear(GL_DEPTH_BUFFER_BIT);
 	glEnable(GL_DEPTH_TEST);
 
 	if (with_names) {

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_draw.c	2012-08-10 20:22:30 UTC (rev 49780)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_draw.c	2012-08-10 21:08:28 UTC (rev 49781)
@@ -442,8 +442,8 @@
 	w = (rect->xmax - rect->xmin);
 	h = (rect->ymax - rect->ymin);
 	/* prevent drawing outside widget area */
-	glGetIntegerv(GL_SCISSOR_BOX, scissor);
-	glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h);
+	gpuGetSizeBox(GL_SCISSOR_BOX, scissor);
+	gpuScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h);
 #endif
 	
 	glEnable(GL_BLEND);
@@ -456,7 +456,7 @@
 	
 #if 0
 	// restore scissortest
-	glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+	gpuScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
 #endif
 	
 #endif
@@ -637,7 +637,7 @@
 	float scaler_x1, scaler_x2;
 
 	/* restore scissortest */
-	glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+	gpuScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
 
 	/* scale widget */
 	scaler_x1 = rect->xmin + (rect->xmax - rect->xmin) / 2 - SCOPE_RESIZE_PAD;
@@ -747,8 +747,8 @@
 	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);
-	glScissor(ar->winrct.xmin + (rect.xmin - 1),
+	gpuGetSizeBox(GL_VIEWPORT, scissor);
+	gpuScissor(ar->winrct.xmin + (rect.xmin - 1),
 	          ar->winrct.ymin + (rect.ymin - 1),
 	          (rect.xmax + 1) - (rect.xmin - 1),
 	          (rect.ymax + 1) - (rect.ymin - 1));
@@ -830,8 +830,8 @@
 	
 
 	/* need scissor test, waveform can draw outside of boundary */
-	glGetIntegerv(GL_VIEWPORT, scissor);
-	glScissor(ar->winrct.xmin + (rect.xmin - 1),
+	gpuGetSizeBox(GL_VIEWPORT, scissor);
+	gpuScissor(ar->winrct.xmin + (rect.xmin - 1),
 	          ar->winrct.ymin + (rect.ymin - 1),
 	          (rect.xmax + 1) - (rect.xmin - 1),
 	          (rect.ymax + 1) - (rect.ymin - 1));
@@ -1069,8 +1069,8 @@
 	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);
-	glScissor(ar->winrct.xmin + (rect.xmin - 1),
+	gpuGetSizeBox(GL_VIEWPORT, scissor);
+	gpuScissor(ar->winrct.xmin + (rect.xmin - 1),
 	          ar->winrct.ymin + (rect.ymin - 1),
 	          (rect.xmax + 1) - (rect.xmin - 1),
 	          (rect.ymax + 1) - (rect.ymin - 1));
@@ -1411,13 +1411,13 @@
 	cuma = cumap->cm + cumap->cur;
 
 	/* need scissor test, curve can draw outside of boundary */
-	glGetIntegerv(GL_VIEWPORT, scissor);
+	gpuGetSizeBox(GL_VIEWPORT, 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;
 	scissor_new.ymax = ar->winrct.ymin + rect->ymax;
 	BLI_rcti_isect(&scissor_new, &ar->winrct, &scissor_new);
-	glScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax - scissor_new.xmin, scissor_new.ymax - scissor_new.ymin);
+	gpuScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax - scissor_new.xmin, scissor_new.ymax - scissor_new.ymin);
 	
 	/* calculate offset and zoom */
 	zoomx = (rect->xmax - rect->xmin - 2.0f * but->aspect) / (cumap->curr.xmax - cumap->curr.xmin);
@@ -1577,7 +1577,7 @@
 	glPointSize(1.0f);
 	
 	/* restore scissortest */
-	glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+	gpuScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
 
 	/* outline */
 	gpuCurrentColor3ubv((unsigned char *)wcol->outline);
@@ -1602,8 +1602,8 @@
 	glEnable(GL_BLEND);
 
 	/* need scissor test, preview image can draw outside of boundary */
-	glGetIntegerv(GL_VIEWPORT, scissor);
-	glScissor(ar->winrct.xmin + (rect.xmin - 1),
+	gpuGetSizeBox(GL_VIEWPORT, scissor);
+	gpuScissor(ar->winrct.xmin + (rect.xmin - 1),
 	          ar->winrct.ymin + (rect.ymin - 1),
 	          (rect.xmax + 1) - (rect.xmin - 1),
 	          (rect.ymax + 1) - (rect.ymin - 1));
@@ -1653,7 +1653,7 @@
 		track_pos[1] = scopes->track_pos[1];
 
 		/* draw content of pattern area */
-		glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, scissor[2], scissor[3]);
+		gpuScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, scissor[2], scissor[3]);
 
 		if (width > 0 && height > 0) {
 			drawibuf = scopes->track_preview;
@@ -1669,7 +1669,7 @@
 
 			/* draw cross for pizel position */
 			gpuTranslate(rect.xmin + track_pos[0], rect.ymin + track_pos[1], 0.f);
-			glScissor(ar->winrct.xmin + rect.xmin,
+			gpuScissor(ar->winrct.xmin + rect.xmin,
 			          ar->winrct.ymin + rect.ymin,
 			          rect.xmax - rect.xmin,
 			          rect.ymax - rect.ymin);

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_widgets.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_widgets.c	2012-08-10 20:22:30 UTC (rev 49780)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/interface/interface_widgets.c	2012-08-10 21:08:28 UTC (rev 49781)
@@ -2790,7 +2790,7 @@
 	/* store the box bg as gl clearcolor, to retrieve later when drawing semi-transparent rects
 	 * over the top to indicate disabled buttons */
 	/* XXX, this doesnt work right since the color applies to buttons outside the box too. */
-	glClearColor(wcol->inner[0] / 255.0, wcol->inner[1] / 255.0, wcol->inner[2] / 255.0, 1.0);
+	gpuSetClearColor(wcol->inner[0] / 255.0, wcol->inner[1] / 255.0, wcol->inner[2] / 255.0, 1.0);
 	
 	copy_v3_v3_char(wcol->inner, old_col);
 }

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/interface/resources.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/interface/resources.c	2012-08-10 20:22:30 UTC (rev 49780)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/interface/resources.c	2012-08-10 21:08:28 UTC (rev 49781)
@@ -1316,9 +1316,8 @@
 void UI_ThemeClearColor(int colorid)
 {
 	float col[3];
-	
 	UI_GetThemeColor3fv(colorid, col);
-	glClearColor(col[0], col[1], col[2], 0.0);
+	gpuSetClearColorvf(col, 0.0);
 }
 
 void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis)

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/screen/area.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/screen/area.c	2012-08-10 20:22:30 UTC (rev 49780)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/screen/area.c	2012-08-10 21:08:28 UTC (rev 49781)
@@ -59,7 +59,7 @@
 
 #include "GPU_colors.h"
 #include "GPU_primitives.h"
-
+#include REAL_GL_MODE
 #include "BLF_api.h"
 
 #include "UI_interface.h"
@@ -485,7 +485,7 @@
 	/* optional header info instead? */
 	if (ar->headerstr) {
 		UI_ThemeClearColor(TH_HEADER);
-		glClear(GL_COLOR_BUFFER_BIT);
+		gpuClear(GL_COLOR_BUFFER_BIT);
 		
 		UI_ThemeColor(TH_TEXT);
 		BLF_draw_default(20, 8, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
@@ -1656,7 +1656,7 @@
 
 	/* clear */
 	UI_ThemeClearColor((ar->type->regionid == RGN_TYPE_PREVIEW) ? TH_PREVIEW_BACK : TH_BACK);
-	glClear(GL_COLOR_BUFFER_BIT);
+	gpuClear(GL_COLOR_BUFFER_BIT);
 	
 	/* before setting the view */
 	if (vertical) {
@@ -1739,7 +1739,7 @@
 
 	/* clear */	
 	UI_ThemeClearColor((ED_screen_area_active(C)) ? TH_HEADER : TH_HEADERDESEL);
-	glClear(GL_COLOR_BUFFER_BIT);
+	gpuClear(GL_COLOR_BUFFER_BIT);
 	
 	/* set view2d view matrix for scrolling (without scrollers) */
 	UI_view2d_view_ortho(&ar->v2d);

Modified: branches/soc-2012-swiss_cheese/source/blender/editors/screen/glutil.c
===================================================================
--- branches/soc-2012-swiss_cheese/source/blender/editors/screen/glutil.c	2012-08-10 20:22:30 UTC (rev 49780)
+++ branches/soc-2012-swiss_cheese/source/blender/editors/screen/glutil.c	2012-08-10 21:08:28 UTC (rev 49781)
@@ -514,7 +514,7 @@
 	float rast_x = x + off_x * xzoom;
 	float rast_y = y + off_y * yzoom;
 
-	GLfloat scissor[4];
+	int scissor[4];
 	int draw_w, draw_h;
 
 	/* Determine the smallest number of pixels we need to draw
@@ -529,9 +529,9 @@
 	 * fails if we zoom in on one really huge pixel so that it
 	 * covers the entire screen).
 	 */
-	glGetFloatv(GL_SCISSOR_BOX, scissor);
-	draw_w = MIN2(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom));
-	draw_h = MIN2(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom));
+	gpuGetSizeBox(GL_SCISSOR_BOX, scissor);
+	draw_w = MIN2(img_w - off_x, ceil(((float)scissor[2] - rast_x) / xzoom));
+	draw_h = MIN2(img_h - off_y, ceil(((float)scissor[3] - rast_y) / yzoom));
 
 	if (draw_w > 0 && draw_h > 0) {
 		/* Don't use safe RasterPos (slower) if we can avoid it. */
@@ -576,8 +576,8 @@
 	int sc_w = screen_rect->xmax - screen_rect->xmin + 1;
 	int sc_h = screen_rect->ymax - screen_rect->ymin + 1;
 
-	glViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
-	glScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
+	gpuViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
+	gpuScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
 
 	/* The 0.375 magic number is to shift the matrix so that
 	 * both raster and vertex integer coordinates fall at pixel
@@ -597,7 +597,7 @@
 #if 0 /* UNUSED */
 
 struct gla2DDrawInfo {
-	int orig_vp[4], orig_sc[4];
+	int orig_vp[4], /*orig_sc[4]; Unused*/
 	float orig_projmat[16], orig_viewmat[16];
 
 	rcti screen_rect;
@@ -633,8 +633,7 @@
 	int sc_w, sc_h;
 	float wo_w, wo_h;
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list