rasterize: fix depth buffering again.

This commit is contained in:
zeromus 2009-06-22 18:05:47 +00:00
parent e9ebd7df18
commit d8cb1ea638
3 changed files with 7 additions and 15 deletions

View File

@ -1712,6 +1712,8 @@ void NDS_exec(s32 nb)
#endif #endif
} }
//this doesnt work anyway. why take a speed hit for public releases?
#ifndef PUBLIC_RELEASE
#ifdef EXPERIMENTAL_WIFI #ifdef EXPERIMENTAL_WIFI
// FIXME: the wifi stuff isn't actually clocked by the ARM7 clock, // FIXME: the wifi stuff isn't actually clocked by the ARM7 clock,
// but by a 22 mhz oscillator. // but by a 22 mhz oscillator.
@ -1737,6 +1739,7 @@ void NDS_exec(s32 nb)
WIFI_SoftAP_usTrigger(&wifiMac); WIFI_SoftAP_usTrigger(&wifiMac);
} }
}*/ }*/
#endif
#endif #endif
} // for (j = 0; j < INSTRUCTIONS_PER_BATCH && (!FORCE) && (execute); j++) } // for (j = 0; j < INSTRUCTIONS_PER_BATCH && (!FORCE) && (execute); j++)

View File

@ -54,9 +54,9 @@ inline u32 gfx3d_extendDepth_15_to_24(u32 depth)
{ {
//formula from http://nocash.emubase.de/gbatek.htm#ds3drearplane //formula from http://nocash.emubase.de/gbatek.htm#ds3drearplane
//return (depth*0x200)+((depth+1)>>15)*0x01FF; //return (depth*0x200)+((depth+1)>>15)*0x01FF;
//but this is identical for values 0..0x7FFF. prove it to yourself with brute force. //I think this might be slightly faster
//i think this isnt right since we can't get up to 0x00FFFFFF if(depth==0x7FFF) return 0x00FFFFFF;
return depth<<9; else return depth<<9;
} }
#define TEXMODE_NONE 0 #define TEXMODE_NONE 0

View File

@ -487,19 +487,8 @@ static FORCEINLINE void pixel(int adr,float r, float g, float b, float invu, flo
} }
else else
{ {
//the traditional value
depth = u32floor(z*0x7FFF); depth = u32floor(z*0x7FFF);
depth <<= 9;
//this would work in sonic chronicles but break battles of prince of persia
//depth = u32floor(z*0xFFFFFF);
//so we have this compromise:
depth = gfx3d_extendDepth_15_to_24(depth);
//some contemplation on the matter:
//it seems that everything in the ds uses 15 bit depths
//except that thedepth buffer is 24 bit. but nothing ever uses 24 bits!!!
//this makes no sense.
} }
if(polyAttr.decalMode) if(polyAttr.decalMode)
{ {