XFMemory: Convert several registers to bitfields
This commit is contained in:
parent
479abde9f4
commit
f48ef65bec
|
@ -443,7 +443,7 @@ void TransformTexCoord(const InputVertexData* src, OutputVertexData* dst, bool s
|
|||
dst->texCoords[coordNum].z = 1.0f;
|
||||
break;
|
||||
default:
|
||||
ERROR_LOG(VIDEO, "Bad tex gen type %i", texinfo.texgentype);
|
||||
ERROR_LOG(VIDEO, "Bad tex gen type %i", texinfo.texgentype.Value());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -193,22 +193,24 @@ void VertexManagerBase::Flush()
|
|||
g_video_backend->CheckInvalidState();
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
PRIM_LOG("frame%d:\n texgen=%d, numchan=%d, dualtex=%d, ztex=%d, cole=%d, alpe=%d, ze=%d",
|
||||
PRIM_LOG("frame%d:\n texgen=%u, numchan=%u, dualtex=%u, ztex=%u, cole=%u, alpe=%u, ze=%u",
|
||||
g_ActiveConfig.iSaveTargetId, xfmem.numTexGen.numTexGens, xfmem.numChan.numColorChans,
|
||||
xfmem.dualTexTrans.enabled, (int)bpmem.ztex2.op, (int)bpmem.blendmode.colorupdate,
|
||||
(int)bpmem.blendmode.alphaupdate, (int)bpmem.zmode.updateenable);
|
||||
xfmem.dualTexTrans.enabled, bpmem.ztex2.op.Value(), bpmem.blendmode.colorupdate.Value(),
|
||||
bpmem.blendmode.alphaupdate.Value(), bpmem.zmode.updateenable.Value());
|
||||
|
||||
for (unsigned int i = 0; i < xfmem.numChan.numColorChans; ++i)
|
||||
for (u32 i = 0; i < xfmem.numChan.numColorChans; ++i)
|
||||
{
|
||||
LitChannel* ch = &xfmem.color[i];
|
||||
PRIM_LOG("colchan%d: matsrc=%d, light=0x%x, ambsrc=%d, diffunc=%d, attfunc=%d", i,
|
||||
ch->matsource, ch->GetFullLightMask(), ch->ambsource, ch->diffusefunc, ch->attnfunc);
|
||||
PRIM_LOG("colchan%u: matsrc=%u, light=0x%x, ambsrc=%u, diffunc=%u, attfunc=%u", i,
|
||||
ch->matsource.Value(), ch->GetFullLightMask(), ch->ambsource.Value(),
|
||||
ch->diffusefunc.Value(), ch->attnfunc.Value());
|
||||
ch = &xfmem.alpha[i];
|
||||
PRIM_LOG("alpchan%d: matsrc=%d, light=0x%x, ambsrc=%d, diffunc=%d, attfunc=%d", i,
|
||||
ch->matsource, ch->GetFullLightMask(), ch->ambsource, ch->diffusefunc, ch->attnfunc);
|
||||
PRIM_LOG("alpchan%u: matsrc=%u, light=0x%x, ambsrc=%u, diffunc=%u, attfunc=%u", i,
|
||||
ch->matsource.Value(), ch->GetFullLightMask(), ch->ambsource.Value(),
|
||||
ch->diffusefunc.Value(), ch->attnfunc.Value());
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < xfmem.numTexGen.numTexGens; ++i)
|
||||
for (u32 i = 0; i < xfmem.numTexGen.numTexGens; ++i)
|
||||
{
|
||||
TexMtxInfo tinfo = xfmem.texMtxInfo[i];
|
||||
if (tinfo.texgentype != XF_TEXGEN_EMBOSS_MAP)
|
||||
|
@ -216,16 +218,17 @@ void VertexManagerBase::Flush()
|
|||
if (tinfo.texgentype != XF_TEXGEN_REGULAR)
|
||||
tinfo.projection = 0;
|
||||
|
||||
PRIM_LOG("txgen%d: proj=%d, input=%d, gentype=%d, srcrow=%d, embsrc=%d, emblght=%d, "
|
||||
"postmtx=%d, postnorm=%d",
|
||||
i, tinfo.projection, tinfo.inputform, tinfo.texgentype, tinfo.sourcerow,
|
||||
tinfo.embosssourceshift, tinfo.embosslightshift, xfmem.postMtxInfo[i].index,
|
||||
xfmem.postMtxInfo[i].normalize);
|
||||
PRIM_LOG("txgen%u: proj=%u, input=%u, gentype=%u, srcrow=%u, embsrc=%u, emblght=%u, "
|
||||
"postmtx=%u, postnorm=%u",
|
||||
i, tinfo.projection.Value(), tinfo.inputform.Value(), tinfo.texgentype.Value(),
|
||||
tinfo.sourcerow.Value(), tinfo.embosssourceshift.Value(),
|
||||
tinfo.embosslightshift.Value(), xfmem.postMtxInfo[i].index.Value(),
|
||||
xfmem.postMtxInfo[i].normalize.Value());
|
||||
}
|
||||
|
||||
PRIM_LOG("pixel: tev=%d, ind=%d, texgen=%d, dstalpha=%d, alphatest=0x%x",
|
||||
(int)bpmem.genMode.numtevstages + 1, (int)bpmem.genMode.numindstages,
|
||||
(int)bpmem.genMode.numtexgens, (u32)bpmem.dstalpha.enable,
|
||||
PRIM_LOG("pixel: tev=%u, ind=%u, texgen=%u, dstalpha=%u, alphatest=0x%x",
|
||||
bpmem.genMode.numtevstages.Value() + 1, bpmem.genMode.numindstages.Value(),
|
||||
bpmem.genMode.numtexgens.Value(), bpmem.dstalpha.enable.Value(),
|
||||
(bpmem.alpha_test.hex >> 16) & 0xff);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ void VertexShaderManager::Init()
|
|||
bProjectionChanged = true;
|
||||
bViewportChanged = false;
|
||||
|
||||
xfmem = {};
|
||||
std::memset(&xfmem, 0, sizeof(xfmem));
|
||||
constants = {};
|
||||
ResetView();
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Common/BitField.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "VideoCommon/CPMemory.h"
|
||||
|
||||
|
@ -132,27 +133,15 @@ enum
|
|||
|
||||
union LitChannel
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 matsource : 1;
|
||||
u32 enablelighting : 1;
|
||||
u32 lightMask0_3 : 4;
|
||||
u32 ambsource : 1;
|
||||
u32 diffusefunc : 2; // LIGHTDIF_X
|
||||
u32 attnfunc : 2; // LIGHTATTN_X
|
||||
u32 lightMask4_7 : 4;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 hex : 15;
|
||||
u32 unused : 17;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 dummy0 : 7;
|
||||
u32 lightparams : 4;
|
||||
u32 dummy1 : 21;
|
||||
};
|
||||
BitField<0, 1, u32> matsource;
|
||||
BitField<1, 1, u32> enablelighting;
|
||||
BitField<2, 4, u32> lightMask0_3;
|
||||
BitField<6, 1, u32> ambsource;
|
||||
BitField<7, 2, u32> diffusefunc; // LIGHTDIF_X
|
||||
BitField<9, 2, u32> attnfunc; // LIGHTATTN_X
|
||||
BitField<11, 4, u32> lightMask4_7;
|
||||
u32 hex;
|
||||
|
||||
unsigned int GetFullLightMask() const
|
||||
{
|
||||
return enablelighting ? (lightMask0_3 | (lightMask4_7 << 4)) : 0;
|
||||
|
@ -173,28 +162,22 @@ union INVTXSPEC
|
|||
|
||||
union TexMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 unknown : 1;
|
||||
u32 projection : 1; // XF_TEXPROJ_X
|
||||
u32 inputform : 1; // XF_TEXINPUT_X
|
||||
u32 unknown2 : 1;
|
||||
u32 texgentype : 3; // XF_TEXGEN_X
|
||||
u32 sourcerow : 5; // XF_SRCGEOM_X
|
||||
u32 embosssourceshift : 3; // what generated texcoord to use
|
||||
u32 embosslightshift : 3; // light index that is used
|
||||
};
|
||||
BitField<0, 1, u32> unknown; //
|
||||
BitField<1, 1, u32> projection; // XF_TEXPROJ_X
|
||||
BitField<2, 1, u32> inputform; // XF_TEXINPUT_X
|
||||
BitField<3, 1, u32> unknown2; //
|
||||
BitField<4, 3, u32> texgentype; // XF_TEXGEN_X
|
||||
BitField<7, 5, u32> sourcerow; // XF_SRCGEOM_X
|
||||
BitField<12, 3, u32> embosssourceshift; // what generated texcoord to use
|
||||
BitField<15, 3, u32> embosslightshift; // light index that is used
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union PostMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 index : 6; // base row of dual transform matrix
|
||||
u32 unused : 2;
|
||||
u32 normalize : 1; // normalize before send operation
|
||||
};
|
||||
BitField<0, 6, u32> index; // base row of dual transform matrix
|
||||
BitField<6, 2, u32> unused; //
|
||||
BitField<8, 1, u32> normalize; // normalize before send operation
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue