[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55751] trunk/blender/source/blender/ editors: Fix/Workaround #34854: render buffer update writes to wrong layer

Sergey Sharybin sergey.vfx at gmail.com
Wed Apr 3 11:08:03 CEST 2013


Revision: 55751
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55751
Author:   nazgul
Date:     2013-04-03 09:08:02 +0000 (Wed, 03 Apr 2013)
Log Message:
-----------
Fix/Workaround #34854: render buffer update writes to wrong layer

Was caused by recent change in image_buffer_rect_update which
was writing data to ibuf-rect_float. Apparently, this buffer
could point to different render layer than came from RenderResult.

Made quick fix for this, which ends up in skipping float buffer
update in image_buffer_rect_update and skipping GLSL when image
has both byte and float buffers.

This will bring speed down a bit, but slower blender is better
than broken blender.

Proper fix will arrive later this week.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/render/render_internal.c
    trunk/blender/source/blender/editors/screen/glutil.c

Modified: trunk/blender/source/blender/editors/render/render_internal.c
===================================================================
--- trunk/blender/source/blender/editors/render/render_internal.c	2013-04-03 08:25:29 UTC (rev 55750)
+++ trunk/blender/source/blender/editors/render/render_internal.c	2013-04-03 09:08:02 UTC (rev 55751)
@@ -140,23 +140,15 @@
 		}
 	}
 	if (rectf == NULL) return;
-	
-	rectf += 4 * (rr->rectx * ymin + xmin);
 
-	if (ibuf->rect) {
-		IMB_partial_display_buffer_update(ibuf, rectf, NULL, rr->rectx, rxmin, rymin,
-		                                  &scene->view_settings, &scene->display_settings,
-		                                  rxmin, rymin, rxmin + xmax, rymin + ymax, TRUE);
-	}
+	if (ibuf->rect == NULL)
+		imb_addrectImBuf(ibuf);
 
-	/* update float buffer as well, so fast GLSL display could use it
-	 *
-	 * TODO(sergey): not actually sure it is nice thing to modify something here
-	 *               but ibuf->rect used to be modified here
-	 */
-	IMB_buffer_float_from_float(ibuf->rect_float + 4 * (ibuf->x * rymin + rxmin), rectf,
-	                            4, IB_PROFILE_LINEAR_RGB, IB_PROFILE_LINEAR_RGB, FALSE,
-	                            xmax, ymax, ibuf->x, rr->rectx);
+	rectf += 4 * (rr->rectx * ymin + xmin);
+
+	IMB_partial_display_buffer_update(ibuf, rectf, NULL, rr->rectx, rxmin, rymin,
+	                                  &scene->view_settings, &scene->display_settings,
+	                                  rxmin, rymin, rxmin + xmax, rymin + ymax, TRUE);
 }
 
 /* ****************************** render invoking ***************** */

Modified: trunk/blender/source/blender/editors/screen/glutil.c
===================================================================
--- trunk/blender/source/blender/editors/screen/glutil.c	2013-04-03 08:25:29 UTC (rev 55750)
+++ trunk/blender/source/blender/editors/screen/glutil.c	2013-04-03 09:08:02 UTC (rev 55751)
@@ -998,7 +998,14 @@
 	bool need_fallback = true;
 
 	/* Bytes and dithering are not supported on GLSL yet */
-	if (ibuf->rect_float && ibuf->dither == 0.0f) {
+
+	/* WORKAROUND: only use GLSL if there's no byte buffer at all,
+	 *             this is because of how render results are handled,
+	 *             they're not updating image buffer's float buffer,
+	 *             but writes data directly to it's byte buffer and
+	 *             modifies display buffer.
+	 */
+	if (ibuf->rect == NULL && ibuf->rect_float && ibuf->dither == 0.0f) {
 		if (IMB_colormanagement_setup_glsl_draw_from_ctx(C)) {
 			glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 			glColor4f(1.0, 1.0, 1.0, 1.0);




More information about the Bf-blender-cvs mailing list