minor optimizations to gpu and gfx3d:

- sprwin was too big (256x256 instead of 256x192)
- line render buffer initializer was a per pixel loop instead of a 256 wide memset
This commit is contained in:
zeromus 2008-12-27 03:49:18 +00:00
parent 6247af54cb
commit e72264ea71
3 changed files with 889 additions and 888 deletions

View File

@ -50,10 +50,10 @@
#include "debug.h"
#include "render3D.h"
#include "GPU_osd.h"
#include "debug.h"
//#define CHECKSPRITES
#include "debug.h"
//#define CHECKSPRITES
#ifdef CHECKSPRITES
#define CHECK_SPRITE(type) \
if (!src) {\
@ -67,7 +67,7 @@ continue;\
#else
#define CHECK_SPRITE(type) if (!src) { continue; };
#endif
ARM9_struct ARM9Mem;
@ -235,7 +235,7 @@ static void GPU_resortBGs(GPU *gpu)
struct _DISPCNT * cnt = &gpu->dispx_st->dispx_DISPCNT.bits;
itemsForPriority_t * item;
memset(gpu->sprWin,0, 256*256);
memset(gpu->sprWin,0, 256*192);
// we don't need to check for windows here...
// if we tick boxes, invisible layers become invisible & vice versa
@ -2039,7 +2039,7 @@ void GPU_set_DISPCAPCNT(u32 val)
case 2:
gpu->dispCapCnt.capx = 256;
gpu->dispCapCnt.capy = 128;
break;
break;
case 3:
gpu->dispCapCnt.capx = 256;
gpu->dispCapCnt.capy = 192;
@ -2060,8 +2060,8 @@ BOOL bright_init=FALSE;
// comment this if want to use formulas instead
// #define BRIGHT_TABLES
#ifdef BRIGHT_TABLES
#ifdef BRIGHT_TABLES
static void calc_bright_colors() {
int base = 31 ;
int factor;
@ -2094,9 +2094,9 @@ static void calc_bright_colors() {
#undef FORMULA_MORE
#undef FORMULA_LESS
}
#endif
}
#endif
static INLINE void GPU_ligne_layer(NDS_Screen * screen, u16 l)
{
GPU * gpu = screen->gpu;
@ -2118,11 +2118,8 @@ static INLINE void GPU_ligne_layer(NDS_Screen * screen, u16 l)
!gpu->LayersEnable[4]) return;
// init background color & priorities
for(int i = 0; i< 256; ++i)
{
sprPrio[i]=0xFF;
gpu->sprWin[l][i]=0;
}
memset(sprPrio,0xFF,256);
memset(&gpu->sprWin[l],0,256);
// init pixels priorities
for (int i=0; i<NB_PRIORITIES; i++) {
@ -2187,13 +2184,13 @@ static INLINE void GPU_ligne_layer(NDS_Screen * screen, u16 l)
}
}
}
}
}
// TODO: capture emulated not fully
static INLINE void GPU_ligne_DispCapture(u16 l)
{
GPU * gpu = MainScreen.gpu;
struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits;
GPU * gpu = MainScreen.gpu;
struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits;
if (l == 0)
{

File diff suppressed because it is too large Load Diff

View File

@ -1089,68 +1089,72 @@ u32 gfx3d_GetGXstatus()
return gxstat;
}
#define NOPARAMS() \
for (;;) \
{\
switch (clCmd & 0xFF)\
{\
case 0x00:\
{\
if (clInd > 0)\
{\
clCmd >>= 8;\
clInd--;\
continue;\
}\
clCmd = 0;\
break;\
}\
case 0x11:\
{\
GFX_FIFOadd(&MMU.gfx_fifo);\
*(u32 *)(ARM9Mem.ARM9_REG + 0x444) = val;\
gfx3d_glPushMatrix();\
clCmd >>= 8;\
clInd--;\
continue;\
}\
case 0x15:\
{\
GFX_FIFOadd(&MMU.gfx_fifo);\
*(u32 *)(ARM9Mem.ARM9_REG + 0x454) = val;\
gfx3d_glLoadIdentity();\
clCmd >>= 8;\
clInd--;\
continue;\
}\
case 0x41:\
{\
GFX_FIFOadd(&MMU.gfx_fifo);\
*(u32 *)(ARM9Mem.ARM9_REG + 0x504) = val;\
gfx3d_glEnd();\
clCmd >>= 8;\
clInd--;\
continue;\
}\
}\
break;\
void NOPARAMS(u32 val)
{
for (;;)
{
switch (clCmd & 0xFF)
{
case 0x00:
{
if (clInd > 0)
{
clCmd >>= 8;
clInd--;
continue;
}
clCmd = 0;
break;
}
case 0x11:
{
GFX_FIFOadd(&MMU.gfx_fifo);
*(u32 *)(ARM9Mem.ARM9_REG + 0x444) = val;
gfx3d_glPushMatrix();
clCmd >>= 8;
clInd--;
continue;
}
case 0x15:
{
GFX_FIFOadd(&MMU.gfx_fifo);
*(u32 *)(ARM9Mem.ARM9_REG + 0x454) = val;
gfx3d_glLoadIdentity();
clCmd >>= 8;
clInd--;
continue;
}
case 0x41:
{
GFX_FIFOadd(&MMU.gfx_fifo);
*(u32 *)(ARM9Mem.ARM9_REG + 0x504) = val;
gfx3d_glEnd();
clCmd >>= 8;
clInd--;
continue;
}
}
break;
}
}
#define SETCOUNTCOMMANDS() \
if (!clCmd) clInd = 0;\
else\
{\
u32 tmp_chk = 0xFF000000;\
for (int t = 4; t > 0; t--)\
{\
if ((clCmd & tmp_chk))\
{\
clInd = t;\
break;\
}\
tmp_chk >>= 8;\
}\
void SETCOUNTCOMMANDS()
{
if (!clCmd) clInd = 0;
else
{
u32 tmp_chk = 0xFF000000;
for (int t = 4; t > 0; t--)
{
if ((clCmd & tmp_chk))
{
clInd = t;
break;
}
tmp_chk >>= 8;
}
}
}
void gfx3d_Add_Command(u32 val)
{
@ -1160,7 +1164,7 @@ void gfx3d_Add_Command(u32 val)
if (val == 0) return;
clCmd = val;
SETCOUNTCOMMANDS();
NOPARAMS();
NOPARAMS(val);
return;
}
@ -1377,7 +1381,7 @@ void gfx3d_Add_Command(u32 val)
return;
}
GFX_FIFOadd(&MMU.gfx_fifo);
NOPARAMS();
NOPARAMS(val);
}
void gfx3d_Add_Command_Direct(u32 cmd, u32 val)