BPMemory: Use BitField for the GenMode fields.

This commit is contained in:
Tony Wasserka 2014-04-21 22:34:23 +02:00
parent 8e38b1e63b
commit 16d3dbc5ea
2 changed files with 17 additions and 11 deletions

View File

@ -531,16 +531,22 @@ struct FourTexUnits
union GenMode union GenMode
{ {
struct enum CullMode : u32
{ {
u32 numtexgens : 4; // 0xF CULL_NONE = 0,
u32 numcolchans : 5; // 0x1E0 CULL_BACK = 1, // cull back-facing primitives
u32 multisampling : 1; // 0x200 CULL_FRONT = 2, // cull front-facing primitives
u32 numtevstages : 4; // 0x3C00 CULL_ALL = 3, // cull all primitives
u32 cullmode : 2; // 0xC000
u32 numindstages : 3; // 0x30000
u32 zfreeze : 5; //0x3C0000
}; };
BitField< 0,4,u32> numtexgens;
BitField< 4,5,u32> numcolchans;
BitField< 9,1,u32> multisampling;
BitField<10,4,u32> numtevstages;
BitField<14,2,CullMode> cullmode;
BitField<16,3,u32> numindstages;
BitField<19,5,u32> zfreeze;
u32 hex; u32 hex;
}; };

View File

@ -91,9 +91,9 @@ void BPWritten(const BPCmd& bp)
case BPMEM_GENMODE: // Set the Generation Mode case BPMEM_GENMODE: // Set the Generation Mode
{ {
PRIM_LOG("genmode: texgen=%d, col=%d, multisampling=%d, tev=%d, cullmode=%d, ind=%d, zfeeze=%d", PRIM_LOG("genmode: texgen=%d, col=%d, multisampling=%d, tev=%d, cullmode=%d, ind=%d, zfeeze=%d",
bpmem.genMode.numtexgens, bpmem.genMode.numcolchans, (u32)bpmem.genMode.numtexgens, (u32)bpmem.genMode.numcolchans,
bpmem.genMode.multisampling, bpmem.genMode.numtevstages+1, bpmem.genMode.cullmode, (u32)bpmem.genMode.multisampling, (u32)bpmem.genMode.numtevstages+1, (u32)bpmem.genMode.cullmode,
bpmem.genMode.numindstages, bpmem.genMode.zfreeze); (u32)bpmem.genMode.numindstages, (u32)bpmem.genMode.zfreeze);
// Only call SetGenerationMode when cull mode changes. // Only call SetGenerationMode when cull mode changes.
if (bp.changes & 0xC000) if (bp.changes & 0xC000)