Compactify VertexShader uid struct.
This commit is contained in:
parent
bdc28106ee
commit
597a6b34cb
|
@ -376,7 +376,7 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
|
||||||
break;
|
break;
|
||||||
case XF_TEXGEN_REGULAR:
|
case XF_TEXGEN_REGULAR:
|
||||||
default:
|
default:
|
||||||
uid_data.texMtxInfo[i].projection = xfregs.texMtxInfo[i].projection;
|
uid_data.texMtxInfo_n_projection |= xfregs.texMtxInfo[i].projection << i;
|
||||||
if (components & (VB_HAS_TEXMTXIDX0<<i))
|
if (components & (VB_HAS_TEXMTXIDX0<<i))
|
||||||
{
|
{
|
||||||
out.Write("int tmp = int(tex%d.z);\n", i);
|
out.Write("int tmp = int(tex%d.z);\n", i);
|
||||||
|
@ -395,13 +395,13 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uid_data.dualTexTrans.enabled = xfregs.dualTexTrans.enabled;
|
uid_data.dualTexTrans_enabled = xfregs.dualTexTrans.enabled;
|
||||||
// CHECKME: does this only work for regular tex gen types?
|
// CHECKME: does this only work for regular tex gen types?
|
||||||
if (xfregs.dualTexTrans.enabled && texinfo.texgentype == XF_TEXGEN_REGULAR)
|
if (xfregs.dualTexTrans.enabled && texinfo.texgentype == XF_TEXGEN_REGULAR)
|
||||||
{
|
{
|
||||||
const PostMtxInfo& postInfo = xfregs.postMtxInfo[i];
|
const PostMtxInfo& postInfo = xfregs.postMtxInfo[i];
|
||||||
|
|
||||||
uid_data.postMtxInfo[i].index = xfregs.postMtxInfo[i].index;
|
uid_data.postMtxInfo[i] = xfregs.postMtxInfo[i].index;
|
||||||
int postidx = postInfo.index;
|
int postidx = postInfo.index;
|
||||||
out.Write("float4 P0 = " I_POSTTRANSFORMMATRICES"[%d];\n"
|
out.Write("float4 P0 = " I_POSTTRANSFORMMATRICES"[%d];\n"
|
||||||
"float4 P1 = " I_POSTTRANSFORMMATRICES"[%d];\n"
|
"float4 P1 = " I_POSTTRANSFORMMATRICES"[%d];\n"
|
||||||
|
@ -419,7 +419,7 @@ static void GenerateVertexShader(T& out, u32 components, API_TYPE api_type)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uid_data.postMtxInfo[i].normalize = xfregs.postMtxInfo[i].normalize;
|
uid_data.postMtxInfo[i] |= xfregs.postMtxInfo[i].normalize << 6;
|
||||||
if (postInfo.normalize)
|
if (postInfo.normalize)
|
||||||
out.Write("o.tex%d.xyz = normalize(o.tex%d.xyz);\n", i, i);
|
out.Write("o.tex%d.xyz = normalize(o.tex%d.xyz);\n", i, i);
|
||||||
|
|
||||||
|
|
|
@ -63,32 +63,30 @@ const s_svar VSVar_Loc[] = { {I_POSNORMALMATRIX, C_POSNORMALMATRIX, 6 },
|
||||||
{I_DEPTHPARAMS, C_DEPTHPARAMS, 1 },
|
{I_DEPTHPARAMS, C_DEPTHPARAMS, 1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(4)
|
#pragma pack(1)
|
||||||
|
|
||||||
struct vertex_shader_uid_data
|
struct vertex_shader_uid_data
|
||||||
{
|
{
|
||||||
u32 num_values; // TODO: Shouldn't be a u32
|
|
||||||
|
|
||||||
u32 NumValues() const { return num_values; }
|
u32 NumValues() const { return num_values; }
|
||||||
|
|
||||||
u32 components;
|
u32 components;
|
||||||
|
u32 num_values : 16; // TODO: Shouldn't be a u32
|
||||||
u32 numColorChans : 2;
|
u32 numColorChans : 2;
|
||||||
u32 numTexGens : 4;
|
u32 numTexGens : 4;
|
||||||
|
|
||||||
|
u32 dualTexTrans_enabled : 1;
|
||||||
|
|
||||||
|
u32 texMtxInfo_n_projection : 16; // XF_TEXPROJ_X
|
||||||
struct {
|
struct {
|
||||||
u32 projection : 1; // XF_TEXPROJ_X
|
|
||||||
u32 inputform : 2; // XF_TEXINPUT_X
|
u32 inputform : 2; // XF_TEXINPUT_X
|
||||||
u32 texgentype : 3; // XF_TEXGEN_X
|
u32 texgentype : 3; // XF_TEXGEN_X
|
||||||
u32 sourcerow : 5; // XF_SRCGEOM_X
|
u32 sourcerow : 5; // XF_SRCGEOM_X
|
||||||
u32 embosssourceshift : 3; // what generated texcoord to use
|
u32 embosssourceshift : 3; // what generated texcoord to use
|
||||||
u32 embosslightshift : 3; // light index that is used
|
u32 embosslightshift : 3; // light index that is used
|
||||||
} texMtxInfo[8];
|
} texMtxInfo[8]; // TODO: Wasting space
|
||||||
struct {
|
|
||||||
u32 index : 6; // base row of dual transform matrix
|
u8 postMtxInfo[8]; // index + normalize + 1 padding bit, TODO: Can be made a struct again..
|
||||||
u32 normalize : 1; // normalize before send operation
|
|
||||||
} postMtxInfo[8];
|
|
||||||
struct {
|
|
||||||
u32 enabled : 1;
|
|
||||||
} dualTexTrans;
|
|
||||||
|
|
||||||
LightingUidData lighting;
|
LightingUidData lighting;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue