crude hack to fix problem where loadstate could crash if the GPU hasn't ever booted up. see TODO TODO TODO TODO in gfx3d.cpp -- somebody needs to revise the tables so they arent memory mapped but so that they work rather like shininess tables. if they aren't truly latched when the gpu is flushed, then put them in a table anyway and simply reference the live values instead of the latched ones. How to keep from accidentally referencing the latched ones? perhaps the 3d state could be divided into a latched part and an unlatched part via base classes. Could also be done by embedding a "latched" and "unlatched" struct in the gpu but that would involve touching every line of code that used something from it.
This commit is contained in:
parent
29c077c165
commit
8438a5a647
|
@ -530,6 +530,12 @@ void gfx3d_init()
|
|||
gfx3d.state.fogDensityTable = MMU.ARM9_REG+0x0360;
|
||||
gfx3d.state.edgeMarkColorTable = (u16 *)(MMU.ARM9_REG+0x0330);
|
||||
|
||||
//TODO: these should probably be copied into renderState when it's latched..
|
||||
//THIS IS A SUPER BAD HACK
|
||||
//see TODO TODO TODO TODO
|
||||
gfx3d.renderState.fogDensityTable = MMU.ARM9_REG+0x0360;
|
||||
gfx3d.renderState.edgeMarkColorTable = (u16 *)(MMU.ARM9_REG+0x0330);
|
||||
|
||||
gfx3d.render3DFrameCount = 0;
|
||||
|
||||
makeTables();
|
||||
|
@ -2443,6 +2449,7 @@ static void gfx3d_doFlush()
|
|||
//latch the current renderer and geometry engine states
|
||||
//NOTE: the geometry lists are copied elsewhere by another operation.
|
||||
//that's pretty annoying.
|
||||
//TODO: see TODO TODO TODO TODO
|
||||
gfx3d.renderState = gfx3d.state;
|
||||
|
||||
gfx3d.state.activeFlushCommand = gfx3d.state.pendingFlushCommand;
|
||||
|
|
|
@ -589,6 +589,8 @@ struct GFX3D_State
|
|||
bool invalidateToon;
|
||||
CACHE_ALIGN u16 u16ToonTable[32];
|
||||
u8 shininessTable[128];
|
||||
|
||||
//TODO: copy these in instead of this sloppy memory mapping
|
||||
u8 *fogDensityTable; // Alias to MMU.ARM9_REG+0x0360
|
||||
u16 *edgeMarkColorTable; // Alias to MMU.ARM9_REG+0x0330
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue