mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Convert XFMemory to BitField and enum class
Additionally a new ClipDisable union has been added (though it is not currently used by Dolphin).
This commit is contained in:
@ -39,7 +39,7 @@ VertexShaderUid GetVertexShaderUid()
|
||||
// first transformation
|
||||
switch (texinfo.texgentype)
|
||||
{
|
||||
case XF_TEXGEN_EMBOSS_MAP: // calculate tex coords into bump map
|
||||
case TexGenType::EmbossMap: // calculate tex coords into bump map
|
||||
if ((uid_data->components & (VB_HAS_NRM1 | VB_HAS_NRM2)) != 0)
|
||||
{
|
||||
// transform the light dir into tangent space
|
||||
@ -51,18 +51,19 @@ VertexShaderUid GetVertexShaderUid()
|
||||
texinfo.embosssourceshift = xfmem.texMtxInfo[i].embosssourceshift;
|
||||
}
|
||||
break;
|
||||
case XF_TEXGEN_COLOR_STRGBC0:
|
||||
case XF_TEXGEN_COLOR_STRGBC1:
|
||||
case TexGenType::Color0:
|
||||
case TexGenType::Color1:
|
||||
break;
|
||||
case XF_TEXGEN_REGULAR:
|
||||
case TexGenType::Regular:
|
||||
default:
|
||||
uid_data->texMtxInfo_n_projection |= xfmem.texMtxInfo[i].projection << i;
|
||||
uid_data->texMtxInfo_n_projection |= static_cast<u32>(xfmem.texMtxInfo[i].projection.Value())
|
||||
<< i;
|
||||
break;
|
||||
}
|
||||
|
||||
uid_data->dualTexTrans_enabled = xfmem.dualTexTrans.enabled;
|
||||
// CHECKME: does this only work for regular tex gen types?
|
||||
if (uid_data->dualTexTrans_enabled && texinfo.texgentype == XF_TEXGEN_REGULAR)
|
||||
if (uid_data->dualTexTrans_enabled && texinfo.texgentype == TexGenType::Regular)
|
||||
{
|
||||
auto& postInfo = uid_data->postMtxInfo[i];
|
||||
postInfo.index = xfmem.postMtxInfo[i].index;
|
||||
@ -297,49 +298,48 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
|
||||
out.Write("coord = float4(0.0, 0.0, 1.0, 1.0);\n");
|
||||
switch (texinfo.sourcerow)
|
||||
{
|
||||
case XF_SRCGEOM_INROW:
|
||||
case SourceRow::Geom:
|
||||
out.Write("coord.xyz = rawpos.xyz;\n");
|
||||
break;
|
||||
case XF_SRCNORMAL_INROW:
|
||||
case SourceRow::Normal:
|
||||
if ((uid_data->components & VB_HAS_NRM0) != 0)
|
||||
{
|
||||
out.Write("coord.xyz = rawnorm0.xyz;\n");
|
||||
}
|
||||
break;
|
||||
case XF_SRCCOLORS_INROW:
|
||||
ASSERT(texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC0 ||
|
||||
texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC1);
|
||||
case SourceRow::Colors:
|
||||
ASSERT(texinfo.texgentype == TexGenType::Color0 || texinfo.texgentype == TexGenType::Color1);
|
||||
break;
|
||||
case XF_SRCBINORMAL_T_INROW:
|
||||
case SourceRow::BinormalT:
|
||||
if ((uid_data->components & VB_HAS_NRM1) != 0)
|
||||
{
|
||||
out.Write("coord.xyz = rawnorm1.xyz;\n");
|
||||
}
|
||||
break;
|
||||
case XF_SRCBINORMAL_B_INROW:
|
||||
case SourceRow::BinormalB:
|
||||
if ((uid_data->components & VB_HAS_NRM2) != 0)
|
||||
{
|
||||
out.Write("coord.xyz = rawnorm2.xyz;\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ASSERT(texinfo.sourcerow <= XF_SRCTEX7_INROW);
|
||||
if ((uid_data->components & (VB_HAS_UV0 << (texinfo.sourcerow - XF_SRCTEX0_INROW))) != 0)
|
||||
ASSERT(texinfo.sourcerow >= SourceRow::Tex0 && texinfo.sourcerow <= SourceRow::Tex7);
|
||||
u32 texnum = static_cast<u32>(texinfo.sourcerow) - static_cast<u32>(SourceRow::Tex0);
|
||||
if ((uid_data->components & (VB_HAS_UV0 << (texnum))) != 0)
|
||||
{
|
||||
out.Write("coord = float4(rawtex{}.x, rawtex{}.y, 1.0, 1.0);\n",
|
||||
texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW);
|
||||
out.Write("coord = float4(rawtex{}.x, rawtex{}.y, 1.0, 1.0);\n", texnum, texnum);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Input form of AB11 sets z element to 1.0
|
||||
|
||||
if (texinfo.inputform == XF_TEXINPUT_AB11)
|
||||
if (texinfo.inputform == TexInputForm::AB11)
|
||||
out.Write("coord.z = 1.0;\n");
|
||||
|
||||
// first transformation
|
||||
switch (texinfo.texgentype)
|
||||
{
|
||||
case XF_TEXGEN_EMBOSS_MAP: // calculate tex coords into bump map
|
||||
case TexGenType::EmbossMap: // calculate tex coords into bump map
|
||||
|
||||
if ((uid_data->components & (VB_HAS_NRM1 | VB_HAS_NRM2)) != 0)
|
||||
{
|
||||
@ -359,18 +359,18 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
|
||||
}
|
||||
|
||||
break;
|
||||
case XF_TEXGEN_COLOR_STRGBC0:
|
||||
case TexGenType::Color0:
|
||||
out.Write("o.tex{}.xyz = float3(o.colors_0.x, o.colors_0.y, 1);\n", i);
|
||||
break;
|
||||
case XF_TEXGEN_COLOR_STRGBC1:
|
||||
case TexGenType::Color1:
|
||||
out.Write("o.tex{}.xyz = float3(o.colors_1.x, o.colors_1.y, 1);\n", i);
|
||||
break;
|
||||
case XF_TEXGEN_REGULAR:
|
||||
case TexGenType::Regular:
|
||||
default:
|
||||
if ((uid_data->components & (VB_HAS_TEXMTXIDX0 << i)) != 0)
|
||||
{
|
||||
out.Write("int tmp = int(rawtex{}.z);\n", i);
|
||||
if (((uid_data->texMtxInfo_n_projection >> i) & 1) == XF_TEXPROJ_STQ)
|
||||
if (static_cast<TexSize>((uid_data->texMtxInfo_n_projection >> i) & 1) == TexSize::STQ)
|
||||
{
|
||||
out.Write("o.tex{}.xyz = float3(dot(coord, " I_TRANSFORMMATRICES
|
||||
"[tmp]), dot(coord, " I_TRANSFORMMATRICES
|
||||
@ -386,7 +386,7 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((uid_data->texMtxInfo_n_projection >> i) & 1) == XF_TEXPROJ_STQ)
|
||||
if (static_cast<TexSize>((uid_data->texMtxInfo_n_projection >> i) & 1) == TexSize::STQ)
|
||||
{
|
||||
out.Write("o.tex{}.xyz = float3(dot(coord, " I_TEXMATRICES
|
||||
"[{}]), dot(coord, " I_TEXMATRICES "[{}]), dot(coord, " I_TEXMATRICES
|
||||
@ -404,7 +404,7 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
|
||||
}
|
||||
|
||||
// CHECKME: does this only work for regular tex gen types?
|
||||
if (uid_data->dualTexTrans_enabled && texinfo.texgentype == XF_TEXGEN_REGULAR)
|
||||
if (uid_data->dualTexTrans_enabled && texinfo.texgentype == TexGenType::Regular)
|
||||
{
|
||||
auto& postInfo = uid_data->postMtxInfo[i];
|
||||
|
||||
@ -427,7 +427,7 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const ShaderHostConfig& ho
|
||||
// This can be seen in devkitPro's neheGX Lesson08 example for Wii
|
||||
// Makes differences in Rogue Squadron 3 (Hoth sky) and The Last Story (shadow culling)
|
||||
// TODO: check if this only affects XF_TEXGEN_REGULAR
|
||||
if (texinfo.texgentype == XF_TEXGEN_REGULAR)
|
||||
if (texinfo.texgentype == TexGenType::Regular)
|
||||
{
|
||||
out.Write(
|
||||
"if(o.tex{0}.z == 0.0f)\n"
|
||||
|
Reference in New Issue
Block a user