defer installation of polyattr until a begin command, and give a warning when you try to set polyattr inside a begin/end pair since this is probably a mistake.
This commit is contained in:
parent
5c158071b8
commit
f0e0d21227
|
@ -1978,13 +1978,13 @@ static void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
||||||
#endif
|
#endif
|
||||||
if(val & (1<<15))
|
if(val & (1<<15))
|
||||||
{
|
{
|
||||||
LOG("Main core on top\n");
|
//LOG("Main core on top\n");
|
||||||
MainScreen.offset = 0;
|
MainScreen.offset = 0;
|
||||||
SubScreen.offset = 192;
|
SubScreen.offset = 192;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG("Main core on bottom (%04X)\n", val);
|
//LOG("Main core on bottom (%04X)\n", val);
|
||||||
MainScreen.offset = 192;
|
MainScreen.offset = 192;
|
||||||
SubScreen.offset = 0;
|
SubScreen.offset = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,7 @@ static u8 MM3x3ind = 0;
|
||||||
static CACHE_ALIGN float coord[4] = {0.0, 0.0, 0.0, 0.0};
|
static CACHE_ALIGN float coord[4] = {0.0, 0.0, 0.0, 0.0};
|
||||||
static char coordind = 0;
|
static char coordind = 0;
|
||||||
static u32 vtxFormat;
|
static u32 vtxFormat;
|
||||||
|
static BOOL inBegin = FALSE;
|
||||||
|
|
||||||
// Data for basic transforms
|
// Data for basic transforms
|
||||||
static CACHE_ALIGN float trans[4] = {0.0, 0.0, 0.0, 0.0};
|
static CACHE_ALIGN float trans[4] = {0.0, 0.0, 0.0, 0.0};
|
||||||
|
@ -151,7 +152,7 @@ static CACHE_ALIGN float BTcoords[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
||||||
static CACHE_ALIGN float PTcoords[4] = {0.0, 0.0, 0.0, 1.0};
|
static CACHE_ALIGN float PTcoords[4] = {0.0, 0.0, 0.0, 1.0};
|
||||||
|
|
||||||
//raw ds format poly attributes
|
//raw ds format poly attributes
|
||||||
static u32 polyAttr=0,textureFormat=0, texturePalette=0;
|
static u32 polyAttr=0,textureFormat=0, texturePalette=0, polyAttrPending=0;
|
||||||
|
|
||||||
//the current vertex color, 5bit values
|
//the current vertex color, 5bit values
|
||||||
static int colorRGB[4] = { 31,31,31,31 };
|
static int colorRGB[4] = { 31,31,31,31 };
|
||||||
|
@ -556,16 +557,35 @@ BOOL gfx3d_glMultMatrix4x4(signed long v)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gfx3d_glPolygonAttrib_cache()
|
||||||
|
{
|
||||||
|
// Light enable/disable
|
||||||
|
lightMask = (polyAttr&0xF);
|
||||||
|
|
||||||
|
// texture environment
|
||||||
|
envMode = (polyAttr&0x30)>>4;
|
||||||
|
|
||||||
|
// back face culling
|
||||||
|
cullingMask = (polyAttr>>6)&3;
|
||||||
|
|
||||||
|
// Alpha value, actually not well handled, 0 should be wireframe
|
||||||
|
colorRGB[3] = colorAlpha = ((polyAttr>>16)&0x1F);
|
||||||
|
}
|
||||||
|
|
||||||
void gfx3d_glBegin(u32 v)
|
void gfx3d_glBegin(u32 v)
|
||||||
{
|
{
|
||||||
|
inBegin = TRUE;
|
||||||
vtxFormat = v&0x03;
|
vtxFormat = v&0x03;
|
||||||
triStripToggle = 0;
|
triStripToggle = 0;
|
||||||
tempVertInfo.count = 0;
|
tempVertInfo.count = 0;
|
||||||
tempVertInfo.first = true;
|
tempVertInfo.first = true;
|
||||||
|
polyAttr = polyAttrPending;
|
||||||
|
gfx3d_glPolygonAttrib_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx3d_glEnd(void)
|
void gfx3d_glEnd(void)
|
||||||
{
|
{
|
||||||
|
inBegin = FALSE;
|
||||||
tempVertInfo.count = 0;
|
tempVertInfo.count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,25 +798,15 @@ int gfx3d_GetNumVertex()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx3d_glPolygonAttrib_cache()
|
|
||||||
{
|
|
||||||
// Light enable/disable
|
|
||||||
lightMask = (polyAttr&0xF);
|
|
||||||
|
|
||||||
// texture environment
|
|
||||||
envMode = (polyAttr&0x30)>>4;
|
|
||||||
|
|
||||||
//// back face culling
|
|
||||||
cullingMask = (polyAttr>>6)&3;
|
|
||||||
|
|
||||||
// Alpha value, actually not well handled, 0 should be wireframe
|
|
||||||
colorRGB[3] = colorAlpha = ((polyAttr>>16)&0x1F);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gfx3d_glPolygonAttrib (u32 val)
|
void gfx3d_glPolygonAttrib (u32 val)
|
||||||
{
|
{
|
||||||
polyAttr = val;
|
if(inBegin) {
|
||||||
gfx3d_glPolygonAttrib_cache();
|
PROGINFO("Set polyattr in the middle of a begin/end pair.\n (This won't be activated until the next begin)\n");
|
||||||
|
//TODO - we need some some similar checking for teximageparam etc.
|
||||||
|
}
|
||||||
|
polyAttrPending = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2126,6 +2136,8 @@ void gfx3d_glGetLightColor(unsigned int index, unsigned int* dest)
|
||||||
SFORMAT SF_GFX3D[]={
|
SFORMAT SF_GFX3D[]={
|
||||||
{ "GCTL", 4, 1, &control},
|
{ "GCTL", 4, 1, &control},
|
||||||
{ "GPAT", 4, 1, &polyAttr},
|
{ "GPAT", 4, 1, &polyAttr},
|
||||||
|
{ "GPAP", 4, 1, &polyAttrPending},
|
||||||
|
{ "GINB", 4, 1, &inBegin},
|
||||||
{ "GTFM", 4, 1, &textureFormat},
|
{ "GTFM", 4, 1, &textureFormat},
|
||||||
{ "GTPA", 4, 1, &texturePalette},
|
{ "GTPA", 4, 1, &texturePalette},
|
||||||
{ "GMOD", 4, 1, &mode},
|
{ "GMOD", 4, 1, &mode},
|
||||||
|
|
Loading…
Reference in New Issue