[Bf-committers] Backbuffer hang in oldrenderpipe.

Douglas Toltzman bf-committers@blender.org
Tue, 11 Nov 2003 17:00:36 -0500 (EST)


Have your tried:
"short * volatile sp;"
which would indicate that sp was a pointer to a volatile short.

On Tue, 11 Nov 2003, Robert Wenzlaff wrote:

> 
> There's some odd code in rendercore.c around line 310 in 
> scanlinesky().  It is invoked when using the old renderpipe with a backbuff 
> image.
> 
> sp= (short *)&ofs;
> 			
> #ifdef BBIG_ENDIAN
> #else
> 	sp++; 
> #endif
> 			
> ofs= 0;
> x= R.rectx;
> while( x-- ) {
> 	if( rect[3] != 255) { 
> 		if(rect[3]==0) *((unsigned int *)rect)= *rt;
> 		else {
> 			alphafunc(rect, rt);
> 		}
> 	}
> 	rect+= 4;
> 				
> 	ofs+= dx;
> 	while( *sp>0 ) {
> 		ofs-= 65536;
> 		rt++;
> 	}
> }
> 
> The problem is that the inner while loop never exits.  It appears to be 
> optimization related, because if I put a printf("%i\n", *sp) in the loop, it 
> suddenly works.  This also means that you may not be able to recreate 
> the bug.   I even tried declaring *sp to be "volatile short *", but I think 
> that tells the compiler that the pointer is volatile, not the reference.  It 
> didn't solve the problem in anycase.
> 
> It appears that checking *sp>0 has the same effect as checking for ofs>65536.
> 
> Can anyone see any other thing this checks for?  It works properly here 
> changing the inner while to "while(ofs>65536)", but the #ifdef BBIG_ENDIAN 
> has me concerned.
> -- 
> Robert Wenzlaff                rwenzlaff@soylent-green.com
> 
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers
> 

/*********************************************
 * Douglas Toltzman
 * President/CEO, Oak Street Software, Inc.
 * doug@oakstreetsoftware.com
 * http://www.oakstreetsoftware.com/
 *********************************************/