diff options
| author | Léo Lam <leo@leolam.fr> | 2021-05-08 00:21:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-08 00:21:15 +0200 |
| commit | a6f6211ddeaa87fee5009df7ba467ef733fa3fcf (patch) | |
| tree | f0677c763f4960d8373b2bb424a4d93ead8a0df3 /Source/Core/VideoCommon/UberShaderVertex.cpp | |
| parent | 049b92b7ef51b8aaa0f3a9370c3e8bccd44d185b (diff) | |
| parent | 0f7c9ef76783ac8c93d3fb099b43cede1e6915f4 (diff) | |
Merge pull request #9633 from Pokechu22/BitfieldExtract-pointer-to-member
Change BitfieldExtract to use a pointer to the bitfield member
Diffstat (limited to 'Source/Core/VideoCommon/UberShaderVertex.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/UberShaderVertex.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/Core/VideoCommon/UberShaderVertex.cpp b/Source/Core/VideoCommon/UberShaderVertex.cpp index cbc423dd5a..0f33168e88 100644 --- a/Source/Core/VideoCommon/UberShaderVertex.cpp +++ b/Source/Core/VideoCommon/UberShaderVertex.cpp @@ -402,7 +402,7 @@ static void GenVertexShaderTexGens(APIType api_type, u32 num_texgen, ShaderCode& out.Write(" // Texcoord transforms\n"); out.Write(" float4 coord = float4(0.0, 0.0, 1.0, 1.0);\n" " uint texMtxInfo = xfmem_texMtxInfo(texgen);\n"); - out.Write(" switch ({}) {{\n", BitfieldExtract("texMtxInfo", TexMtxInfo().sourcerow)); + out.Write(" switch ({}) {{\n", BitfieldExtract<&TexMtxInfo::sourcerow>("texMtxInfo")); out.Write(" case {:s}:\n", SourceRow::Geom); out.Write(" coord.xyz = rawpos.xyz;\n"); out.Write(" break;\n\n"); @@ -435,21 +435,21 @@ static void GenVertexShaderTexGens(APIType api_type, u32 num_texgen, ShaderCode& out.Write(" // Input form of AB11 sets z element to 1.0\n"); out.Write(" if ({} == {:s}) // inputform == AB11\n", - BitfieldExtract("texMtxInfo", TexMtxInfo().inputform), TexInputForm::AB11); + BitfieldExtract<&TexMtxInfo::inputform>("texMtxInfo"), TexInputForm::AB11); out.Write(" coord.z = 1.0f;\n" "\n"); out.Write(" // first transformation\n"); - out.Write(" uint texgentype = {};\n", BitfieldExtract("texMtxInfo", TexMtxInfo().texgentype)); + out.Write(" uint texgentype = {};\n", BitfieldExtract<&TexMtxInfo::texgentype>("texMtxInfo")); out.Write(" float3 output_tex;\n" " switch (texgentype)\n" " {{\n"); out.Write(" case {:s}:\n", TexGenType::EmbossMap); out.Write(" {{\n"); out.Write(" uint light = {};\n", - BitfieldExtract("texMtxInfo", TexMtxInfo().embosslightshift)); + BitfieldExtract<&TexMtxInfo::embosslightshift>("texMtxInfo")); out.Write(" uint source = {};\n", - BitfieldExtract("texMtxInfo", TexMtxInfo().embosssourceshift)); + BitfieldExtract<&TexMtxInfo::embosssourceshift>("texMtxInfo")); out.Write(" switch (source) {{\n"); for (u32 i = 0; i < num_texgen; i++) out.Write(" case {}u: output_tex.xyz = o.tex{}; break;\n", i, i); @@ -481,7 +481,7 @@ static void GenVertexShaderTexGens(APIType api_type, u32 num_texgen, ShaderCode& out.Write(" case {}u: tmp = int(rawtex{}.z); break;\n", i, i); out.Write(" }}\n" "\n"); - out.Write(" if ({} == {:s}) {{\n", BitfieldExtract("texMtxInfo", TexMtxInfo().projection), + out.Write(" if ({} == {:s}) {{\n", BitfieldExtract<&TexMtxInfo::projection>("texMtxInfo"), TexSize::STQ); out.Write(" output_tex.xyz = float3(dot(coord, " I_TRANSFORMMATRICES "[tmp]),\n" " dot(coord, " I_TRANSFORMMATRICES "[tmp + 1]),\n" @@ -492,7 +492,7 @@ static void GenVertexShaderTexGens(APIType api_type, u32 num_texgen, ShaderCode& " 1.0);\n" " }}\n" " }} else {{\n"); - out.Write(" if ({} == {:s}) {{\n", BitfieldExtract("texMtxInfo", TexMtxInfo().projection), + out.Write(" if ({} == {:s}) {{\n", BitfieldExtract<&TexMtxInfo::projection>("texMtxInfo"), TexSize::STQ); out.Write(" output_tex.xyz = float3(dot(coord, " I_TEXMATRICES "[3u * texgen]),\n" " dot(coord, " I_TEXMATRICES "[3u * texgen + 1u]),\n" @@ -510,12 +510,12 @@ static void GenVertexShaderTexGens(APIType api_type, u32 num_texgen, ShaderCode& out.Write(" if (xfmem_dualTexInfo != 0u) {{\n"); out.Write(" uint postMtxInfo = xfmem_postMtxInfo(texgen);"); - out.Write(" uint base_index = {};\n", BitfieldExtract("postMtxInfo", PostMtxInfo().index)); + out.Write(" uint base_index = {};\n", BitfieldExtract<&PostMtxInfo::index>("postMtxInfo")); out.Write(" float4 P0 = " I_POSTTRANSFORMMATRICES "[base_index & 0x3fu];\n" " float4 P1 = " I_POSTTRANSFORMMATRICES "[(base_index + 1u) & 0x3fu];\n" " float4 P2 = " I_POSTTRANSFORMMATRICES "[(base_index + 2u) & 0x3fu];\n" "\n"); - out.Write(" if ({} != 0u)\n", BitfieldExtract("postMtxInfo", PostMtxInfo().normalize)); + out.Write(" if ({} != 0u)\n", BitfieldExtract<&PostMtxInfo::normalize>("postMtxInfo")); out.Write(" output_tex.xyz = normalize(output_tex.xyz);\n" "\n" " // multiply by postmatrix\n" |
