Changes to allow LoadCPReg to work in a preprocess mode which affects a separate state.

This state will be used to calculate sizes for skipping over commands on
a separate thread.  An alternative to having these state variables would
be to have the preprocessor stash "state as we go" somewhere, but I
think that would be much uglier.

GetVertexSize now takes an extra argument to determine which state to
use, as does FifoCommandRunnable, which calls it.  While I'm modifying
FifoCommandRunnable, I also change it to take a buffer and size as
parameters rather than using g_pVideoData, which will also be necessary
later.  I also get rid of an unused overload.
This commit is contained in:
comex
2014-08-27 13:38:00 -04:00
parent f0131c2e09
commit e86ddacb18
5 changed files with 64 additions and 40 deletions

View File

@ -238,6 +238,8 @@ struct VAT
UVAT_group2 g2;
};
class VertexLoader;
// STATE_TO_SAVE
struct CPState final
{
@ -248,18 +250,25 @@ struct CPState final
TVtxDesc vtx_desc;
// Most games only use the first VtxAttr and simply reconfigure it all the time as needed.
VAT vtx_attr[8];
// Attributes that actually belong to VertexLoaderManager:
int attr_dirty; // bitfield
VertexLoader* vertex_loaders[8];
};
class PointerWrap;
extern void DoCPState(PointerWrap& p);
extern void CopyPreprocessCPStateFromMain();
extern CPState g_main_cp_state;
extern CPState g_preprocess_cp_state;
extern u8 *cached_arraybases[16];
// Might move this into its own file later.
void LoadCPReg(u32 SubCmd, u32 Value);
void LoadCPReg(u32 SubCmd, u32 Value, bool is_preprocess = false);
// Fills memory with data from CP regs
void FillCPMemoryArray(u32 *memory);