[Bf-committers] Backbuffer hang in oldrenderpipe.

Robert Wenzlaff bf-committers@blender.org
Tue, 11 Nov 2003 16:34:16 -0500


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