[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28587] branches/render25/source/blender/ render/intern/source/zbuf.c: Fix crash rendering sss + irr cache, mask value could get a too

Brecht Van Lommel brecht at blender.org
Wed May 5 02:28:16 CEST 2010


Revision: 28587
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28587
Author:   blendix
Date:     2010-05-05 02:28:16 +0200 (Wed, 05 May 2010)

Log Message:
-----------
Fix crash rendering sss + irr cache, mask value could get a too
high value causing centmask lookup to go out of bounds.

Modified Paths:
--------------
    branches/render25/source/blender/render/intern/source/zbuf.c

Modified: branches/render25/source/blender/render/intern/source/zbuf.c
===================================================================
--- branches/render25/source/blender/render/intern/source/zbuf.c	2010-05-05 00:12:31 UTC (rev 28586)
+++ branches/render25/source/blender/render/intern/source/zbuf.c	2010-05-05 00:28:16 UTC (rev 28587)
@@ -2421,12 +2421,21 @@
 	int *ro= pa->recto, *rbo= pa->rectbacko;
 	int *rp= pa->rectp, *rbp= pa->rectbackp;
 	int *rz= pa->rectz, *rbz= pa->rectbackz;
-	int x, y;
+	int x, y, a, mask;
 
+	if(re->params.osa) {
+		/* for osa case mask must be exactly all osa samples,
+		   not more, since it is used for table lookups */
+		for(mask=0, a=0; a<re->params.osa; a++)
+			mask |= (1<<a);
+	}
+	else
+		mask= 0xFFFF;
+
 	for(y=0; y<pa->recty; y++) {
 		for(x=0; x<pa->rectx; x++, rd++, rp++, ro++, rz++, rbo++, rbp++, rbz++) {
-			if(*rp) addps(lb, rd, *ro, *rp, *rz, 0, 0xFFFF);
-			if(*rbp) addps(lb, rd, *rbo, *rbp, *rbz, 0, 0xFFFF);
+			if(*rp) addps(lb, rd, *ro, *rp, *rz, 0, mask);
+			if(*rbp) addps(lb, rd, *rbo, *rbp, *rbz, 0, mask);
 		}
 	}
 }





More information about the Bf-blender-cvs mailing list