[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55462] trunk/blender/source/blender/ editors/space_view3d/view3d_draw.c: Bug fix #34713

Ton Roosendaal ton at blender.org
Thu Mar 21 12:48:14 CET 2013


Revision: 55462
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55462
Author:   ton
Date:     2013-03-21 11:48:13 +0000 (Thu, 21 Mar 2013)
Log Message:
-----------
Bug fix #34713

Using MultiSample, the code that inspects Z buffer values fail, like for grease pencil
drawing on "Surface".

It appears to me that all this depth draw/read code is ignoring gpu offscreen entirely.
This should be confirmed by Campbell though :)

I'm also quite unsure why this code exists, related to other tools that use
depth too (particles, sculpt). Good to mark down for our viewport recode.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2013-03-21 11:14:53 UTC (rev 55461)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2013-03-21 11:48:13 UTC (rev 55462)
@@ -1433,6 +1433,13 @@
 	}
 }
 
+/* XXX depth reading exception, for code not using gpu offscreen */
+static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h, int format, int type, void *data)
+{
+
+	glReadPixels(ar->winrct.xmin + x, ar->winrct.ymin + y, w, h, format, type, data);
+}
+
 void view3d_validate_backbuf(ViewContext *vc)
 {
 	if (vc->v3d->flag & V3D_INVALID_BACKBUF)
@@ -2104,6 +2111,7 @@
 	draw_dupli_objects_color(scene, ar, v3d, base, color);
 }
 
+/* XXX warning, not using gpu offscreen here */
 void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
 {
 	int x, y, w, h;
@@ -2153,7 +2161,8 @@
 	}
 
 	if (d->damaged) {
-		view3d_opengl_read_pixels(ar, d->x, d->y, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
+		/* XXX using special function here, it doesn't use the gpu offscreen system */
+		view3d_opengl_read_Z_pixels(ar, d->x, d->y, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
 		glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
 		d->damaged = false;
 	}




More information about the Bf-blender-cvs mailing list