mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 13:49:53 -06:00
Change BitfieldExtract to use a pointer to the bitfield member
This commit is contained in:
@ -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"
|
||||
|
Reference in New Issue
Block a user