summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderGen.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2021-03-07 00:21:11 -0500
committerGitHub <noreply@github.com>2021-03-07 00:21:11 -0500
commit089250fde65c2e225681c0ef6917d28fa187e8de (patch)
treebcbb6db025c6003bd681e0028f0bc3b7b223bd07 /Source/Core/VideoCommon/VertexShaderGen.cpp
parent5f7d935b0a40f5cece7341927bd92b6a8d5debbe (diff)
parentdf81210e96c6603d3aeb6c76f51b030d06cd06ac (diff)
Merge pull request #9497 from Pokechu22/better-fifo-analyzer
Graphics refactoring + add names and descriptions in FIFO analyzer
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index 584f55b5e3..cf400a21ba 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -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"