mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-12 06:39:14 +01:00
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;
|
dst->texCoords[coordNum].z = 1.0f;
|
||||||
break;
|
break;
|
||||||
default:
|
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();
|
g_video_backend->CheckInvalidState();
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#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,
|
g_ActiveConfig.iSaveTargetId, xfmem.numTexGen.numTexGens, xfmem.numChan.numColorChans,
|
||||||
xfmem.dualTexTrans.enabled, (int)bpmem.ztex2.op, (int)bpmem.blendmode.colorupdate,
|
xfmem.dualTexTrans.enabled, bpmem.ztex2.op.Value(), bpmem.blendmode.colorupdate.Value(),
|
||||||
(int)bpmem.blendmode.alphaupdate, (int)bpmem.zmode.updateenable);
|
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];
|
LitChannel* ch = &xfmem.color[i];
|
||||||
PRIM_LOG("colchan%d: matsrc=%d, light=0x%x, ambsrc=%d, diffunc=%d, attfunc=%d", i,
|
PRIM_LOG("colchan%u: matsrc=%u, light=0x%x, ambsrc=%u, diffunc=%u, attfunc=%u", i,
|
||||||
ch->matsource, ch->GetFullLightMask(), ch->ambsource, ch->diffusefunc, ch->attnfunc);
|
ch->matsource.Value(), ch->GetFullLightMask(), ch->ambsource.Value(),
|
||||||
|
ch->diffusefunc.Value(), ch->attnfunc.Value());
|
||||||
ch = &xfmem.alpha[i];
|
ch = &xfmem.alpha[i];
|
||||||
PRIM_LOG("alpchan%d: matsrc=%d, light=0x%x, ambsrc=%d, diffunc=%d, attfunc=%d", i,
|
PRIM_LOG("alpchan%u: matsrc=%u, light=0x%x, ambsrc=%u, diffunc=%u, attfunc=%u", i,
|
||||||
ch->matsource, ch->GetFullLightMask(), ch->ambsource, ch->diffusefunc, ch->attnfunc);
|
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];
|
TexMtxInfo tinfo = xfmem.texMtxInfo[i];
|
||||||
if (tinfo.texgentype != XF_TEXGEN_EMBOSS_MAP)
|
if (tinfo.texgentype != XF_TEXGEN_EMBOSS_MAP)
|
||||||
@ -216,16 +218,17 @@ void VertexManagerBase::Flush()
|
|||||||
if (tinfo.texgentype != XF_TEXGEN_REGULAR)
|
if (tinfo.texgentype != XF_TEXGEN_REGULAR)
|
||||||
tinfo.projection = 0;
|
tinfo.projection = 0;
|
||||||
|
|
||||||
PRIM_LOG("txgen%d: proj=%d, input=%d, gentype=%d, srcrow=%d, embsrc=%d, emblght=%d, "
|
PRIM_LOG("txgen%u: proj=%u, input=%u, gentype=%u, srcrow=%u, embsrc=%u, emblght=%u, "
|
||||||
"postmtx=%d, postnorm=%d",
|
"postmtx=%u, postnorm=%u",
|
||||||
i, tinfo.projection, tinfo.inputform, tinfo.texgentype, tinfo.sourcerow,
|
i, tinfo.projection.Value(), tinfo.inputform.Value(), tinfo.texgentype.Value(),
|
||||||
tinfo.embosssourceshift, tinfo.embosslightshift, xfmem.postMtxInfo[i].index,
|
tinfo.sourcerow.Value(), tinfo.embosssourceshift.Value(),
|
||||||
xfmem.postMtxInfo[i].normalize);
|
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",
|
PRIM_LOG("pixel: tev=%u, ind=%u, texgen=%u, dstalpha=%u, alphatest=0x%x",
|
||||||
(int)bpmem.genMode.numtevstages + 1, (int)bpmem.genMode.numindstages,
|
bpmem.genMode.numtevstages.Value() + 1, bpmem.genMode.numindstages.Value(),
|
||||||
(int)bpmem.genMode.numtexgens, (u32)bpmem.dstalpha.enable,
|
bpmem.genMode.numtexgens.Value(), bpmem.dstalpha.enable.Value(),
|
||||||
(bpmem.alpha_test.hex >> 16) & 0xff);
|
(bpmem.alpha_test.hex >> 16) & 0xff);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ void VertexShaderManager::Init()
|
|||||||
bProjectionChanged = true;
|
bProjectionChanged = true;
|
||||||
bViewportChanged = false;
|
bViewportChanged = false;
|
||||||
|
|
||||||
xfmem = {};
|
std::memset(&xfmem, 0, sizeof(xfmem));
|
||||||
constants = {};
|
constants = {};
|
||||||
ResetView();
|
ResetView();
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "Common/BitField.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "VideoCommon/CPMemory.h"
|
#include "VideoCommon/CPMemory.h"
|
||||||
|
|
||||||
@ -132,27 +133,15 @@ enum
|
|||||||
|
|
||||||
union LitChannel
|
union LitChannel
|
||||||
{
|
{
|
||||||
struct
|
BitField<0, 1, u32> matsource;
|
||||||
{
|
BitField<1, 1, u32> enablelighting;
|
||||||
u32 matsource : 1;
|
BitField<2, 4, u32> lightMask0_3;
|
||||||
u32 enablelighting : 1;
|
BitField<6, 1, u32> ambsource;
|
||||||
u32 lightMask0_3 : 4;
|
BitField<7, 2, u32> diffusefunc; // LIGHTDIF_X
|
||||||
u32 ambsource : 1;
|
BitField<9, 2, u32> attnfunc; // LIGHTATTN_X
|
||||||
u32 diffusefunc : 2; // LIGHTDIF_X
|
BitField<11, 4, u32> lightMask4_7;
|
||||||
u32 attnfunc : 2; // LIGHTATTN_X
|
u32 hex;
|
||||||
u32 lightMask4_7 : 4;
|
|
||||||
};
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
u32 hex : 15;
|
|
||||||
u32 unused : 17;
|
|
||||||
};
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
u32 dummy0 : 7;
|
|
||||||
u32 lightparams : 4;
|
|
||||||
u32 dummy1 : 21;
|
|
||||||
};
|
|
||||||
unsigned int GetFullLightMask() const
|
unsigned int GetFullLightMask() const
|
||||||
{
|
{
|
||||||
return enablelighting ? (lightMask0_3 | (lightMask4_7 << 4)) : 0;
|
return enablelighting ? (lightMask0_3 | (lightMask4_7 << 4)) : 0;
|
||||||
@ -173,28 +162,22 @@ union INVTXSPEC
|
|||||||
|
|
||||||
union TexMtxInfo
|
union TexMtxInfo
|
||||||
{
|
{
|
||||||
struct
|
BitField<0, 1, u32> unknown; //
|
||||||
{
|
BitField<1, 1, u32> projection; // XF_TEXPROJ_X
|
||||||
u32 unknown : 1;
|
BitField<2, 1, u32> inputform; // XF_TEXINPUT_X
|
||||||
u32 projection : 1; // XF_TEXPROJ_X
|
BitField<3, 1, u32> unknown2; //
|
||||||
u32 inputform : 1; // XF_TEXINPUT_X
|
BitField<4, 3, u32> texgentype; // XF_TEXGEN_X
|
||||||
u32 unknown2 : 1;
|
BitField<7, 5, u32> sourcerow; // XF_SRCGEOM_X
|
||||||
u32 texgentype : 3; // XF_TEXGEN_X
|
BitField<12, 3, u32> embosssourceshift; // what generated texcoord to use
|
||||||
u32 sourcerow : 5; // XF_SRCGEOM_X
|
BitField<15, 3, u32> embosslightshift; // light index that is used
|
||||||
u32 embosssourceshift : 3; // what generated texcoord to use
|
|
||||||
u32 embosslightshift : 3; // light index that is used
|
|
||||||
};
|
|
||||||
u32 hex;
|
u32 hex;
|
||||||
};
|
};
|
||||||
|
|
||||||
union PostMtxInfo
|
union PostMtxInfo
|
||||||
{
|
{
|
||||||
struct
|
BitField<0, 6, u32> index; // base row of dual transform matrix
|
||||||
{
|
BitField<6, 2, u32> unused; //
|
||||||
u32 index : 6; // base row of dual transform matrix
|
BitField<8, 1, u32> normalize; // normalize before send operation
|
||||||
u32 unused : 2;
|
|
||||||
u32 normalize : 1; // normalize before send operation
|
|
||||||
};
|
|
||||||
u32 hex;
|
u32 hex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user