diff --git a/desmume/src/gfx3d.cpp b/desmume/src/gfx3d.cpp index bb57dc719..7f260214f 100644 --- a/desmume/src/gfx3d.cpp +++ b/desmume/src/gfx3d.cpp @@ -599,8 +599,6 @@ void gfx3d_reset() last_t = 0; last_s = 0; viewport = 0xBFFF0000; - - gfx3d.state.clearDepth = DS_DEPTH15TO24(0x7FFF); clInd2 = 0; isSwapBuffers = FALSE; diff --git a/desmume/src/gfx3d.h b/desmume/src/gfx3d.h index 837d7bdce..682e36068 100644 --- a/desmume/src/gfx3d.h +++ b/desmume/src/gfx3d.h @@ -73,6 +73,7 @@ class EMUFILE; #define GFX3D_5TO6_LOOKUP(x) (material_5bit_to_6bit[(x)]) // 15-bit to 24-bit depth formula from http://nocash.emubase.de/gbatek.htm#ds3drearplane +extern CACHE_ALIGN u32 dsDepthExtend_15bit_to_24bit[32768]; #define DS_DEPTH15TO24(depth) ( dsDepthExtend_15bit_to_24bit[(depth) & 0x7FFF] ) // MATRIX MODES @@ -611,7 +612,7 @@ struct GFX3D_State , alphaTestRef(0) , activeFlushCommand(0) , pendingFlushCommand(0) - , clearDepth(1) + , clearDepth(DS_DEPTH15TO24(0x7FFF)) , clearColor(0) , fogColor(0) , fogOffset(0)