From 83d9d24747532d0c899cf9dad7e988f5f4ed26d1 Mon Sep 17 00:00:00 2001 From: zeromus <zeromus@users.sf.net> Date: Sun, 21 Jun 2009 06:26:09 +0000 Subject: [PATCH] rasterize: remove a recent depth buffering regression in advance wars tile rendering --- desmume/src/gfx3d.h | 5 ++++- desmume/src/rasterize.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/desmume/src/gfx3d.h b/desmume/src/gfx3d.h index 10823a71d..3df6c281a 100644 --- a/desmume/src/gfx3d.h +++ b/desmume/src/gfx3d.h @@ -53,7 +53,10 @@ inline u32 gfx3d_extendDepth_15_to_24(u32 depth) { //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 isnt right since we can't get up to 0x00FFFFFF + return depth<<9; } #define TEXMODE_NONE 0 diff --git a/desmume/src/rasterize.cpp b/desmume/src/rasterize.cpp index 956b3bae2..4ec005e30 100644 --- a/desmume/src/rasterize.cpp +++ b/desmume/src/rasterize.cpp @@ -501,7 +501,7 @@ static FORCEINLINE void pixel(int adr,float r, float g, float b, float invu, flo } else { - if(depth>=destFragment.depth+1) + if(depth>=destFragment.depth) { goto depth_fail; }