diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2023-06-17 20:04:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-17 20:04:25 +0200 |
| commit | 93d9e90798fd1e3a25f378a2c46a74643f6944fc (patch) | |
| tree | de1d5af55a5c2347145628d58a09cd35439ab680 /Source/Core/VideoCommon/UberShaderVertex.cpp | |
| parent | 4d0330987892f790f9540a463010cb934795fdac (diff) | |
| parent | 7523a62105cf5af34dff4dabc771320513e0ddfc (diff) | |
Merge pull request #11962 from Minty-Meeo/to-underlying
EnumUtils: Add Common::ToUnderlying
Diffstat (limited to 'Source/Core/VideoCommon/UberShaderVertex.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/UberShaderVertex.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/Source/Core/VideoCommon/UberShaderVertex.cpp b/Source/Core/VideoCommon/UberShaderVertex.cpp index db6b3c0c62..6e663a1d02 100644 --- a/Source/Core/VideoCommon/UberShaderVertex.cpp +++ b/Source/Core/VideoCommon/UberShaderVertex.cpp @@ -3,6 +3,7 @@ #include "VideoCommon/UberShaderVertex.h" +#include "Common/EnumUtils.h" #include "VideoCommon/ConstantManager.h" #include "VideoCommon/DriverDetails.h" #include "VideoCommon/NativeVertexFormat.h" @@ -223,7 +224,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{ "float3 N2;\n" "\n" "if ((components & {}u) != 0u) {{ // VB_HAS_POSMTXIDX\n", - static_cast<u32>(VB_HAS_POSMTXIDX)); + Common::ToUnderlying(VB_HAS_POSMTXIDX)); LoadVertexAttribute(out, host_config, 2, "posmtx", "uint4", "ubyte4"); out.Write(" // Vertex format has a per-vertex matrix\n" " int posidx = int(posmtx.r);\n" @@ -258,7 +259,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{ "float3 _normal = float3(0.0, 0.0, 0.0);\n" "if ((components & {}u) != 0u) // VB_HAS_NORMAL\n" "{{\n", - static_cast<u32>(VB_HAS_NORMAL)); + Common::ToUnderlying(VB_HAS_NORMAL)); LoadVertexAttribute(out, host_config, 2, "rawnormal", "float3", "float3"); out.Write(" _normal = normalize(float3(dot(N0, rawnormal), dot(N1, rawnormal), dot(N2, " "rawnormal)));\n" @@ -267,7 +268,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{ "float3 _tangent = float3(0.0, 0.0, 0.0);\n" "if ((components & {}u) != 0u) // VB_HAS_TANGENT\n" "{{\n", - static_cast<u32>(VB_HAS_TANGENT)); + Common::ToUnderlying(VB_HAS_TANGENT)); LoadVertexAttribute(out, host_config, 2, "rawtangent", "float3", "float3"); out.Write(" _tangent = float3(dot(N0, rawtangent), dot(N1, rawtangent), dot(N2, rawtangent));\n" "}}\n" @@ -280,7 +281,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{ "float3 _binormal = float3(0.0, 0.0, 0.0);\n" "if ((components & {}u) != 0u) // VB_HAS_BINORMAL\n" "{{\n", - static_cast<u32>(VB_HAS_BINORMAL)); + Common::ToUnderlying(VB_HAS_BINORMAL)); LoadVertexAttribute(out, host_config, 2, "rawbinormal", "float3", "float3"); out.Write(" _binormal = float3(dot(N0, rawbinormal), dot(N1, rawbinormal), dot(N2, " "rawbinormal));\n" @@ -313,14 +314,14 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{ "}}\n" "else if ((components & {}u) != 0u) // VB_HAS_COL0\n" "{{\n", - static_cast<u32>(VB_HAS_COL0)); + Common::ToUnderlying(VB_HAS_COL0)); LoadVertexAttribute(out, host_config, 2, "rawcolor0", "float4", "ubyte4"); out.Write(" vertex_color_0 = rawcolor0;\n" " vertex_color_1 = rawcolor0;\n" "}}\n" "else if ((components & {}u) != 0u) // VB_HAS_COL1\n" "{{\n", - static_cast<u32>(VB_HAS_COL1)); + Common::ToUnderlying(VB_HAS_COL1)); LoadVertexAttribute(out, host_config, 2, "rawcolor1", "float4", "ubyte4"); out.Write(" vertex_color_0 = rawcolor1;\n" " vertex_color_1 = rawcolor1;\n" @@ -340,7 +341,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{ if (host_config.backend_vs_point_line_expand) { - out.Write("if (vs_expand == {}u) {{ // Line\n", static_cast<u32>(VSExpand::Line)); + out.Write("if (vs_expand == {}u) {{ // Line\n", Common::ToUnderlying(VSExpand::Line)); out.Write(" bool is_bottom = (gl_VertexID & 2) != 0;\n" " bool is_right = (gl_VertexID & 1) != 0;\n" " uint other_base_offset = vertex_base_offset;\n" @@ -355,7 +356,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{ " float4 other_p1 = P1;\n" " float4 other_p2 = P2;\n" " if ((components & {}u) != 0u) {{ // VB_HAS_POSMTXIDX\n", - static_cast<u32>(VB_HAS_POSMTXIDX)); + Common::ToUnderlying(VB_HAS_POSMTXIDX)); out.Write(" uint other_posidx = load_input_uint4_ubyte4(other_base_offset, " "vertex_offset_posmtx).r;\n" " other_p0 = " I_TRANSFORMMATRICES "[other_posidx];\n" @@ -365,7 +366,7 @@ float3 load_input_float3_rawtex(uint vtx_offset, uint attr_offset) {{ " float4 other_pos = float4(dot(other_p0, other_rawpos), " "dot(other_p1, other_rawpos), dot(other_p2, other_rawpos), 1.0);\n"); GenerateVSLineExpansion(out, " ", num_texgen); - out.Write("}} else if (vs_expand == {}u) {{ // Point\n", static_cast<u32>(VSExpand::Point)); + out.Write("}} else if (vs_expand == {}u) {{ // Point\n", Common::ToUnderlying(VSExpand::Point)); out.Write(" bool is_bottom = (gl_VertexID & 2) != 0;\n" " bool is_right = (gl_VertexID & 1) != 0;\n"); GenerateVSPointExpansion(out, " ", num_texgen); @@ -545,7 +546,7 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos out.Write(" case {:s}:\n", SourceRow::Normal); out.Write(" if ((components & {}u) != 0u) // VB_HAS_NORMAL\n" " {{\n", - static_cast<u32>(VB_HAS_NORMAL)); + Common::ToUnderlying(VB_HAS_NORMAL)); LoadVertexAttribute(out, host_config, 6, "rawnormal", "float3", "float3"); out.Write(" coord.xyz = rawnormal.xyz;\n" " }}\n" @@ -553,7 +554,7 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos out.Write(" case {:s}:\n", SourceRow::BinormalT); out.Write(" if ((components & {}u) != 0u) // VB_HAS_TANGENT\n" " {{\n", - static_cast<u32>(VB_HAS_TANGENT)); + Common::ToUnderlying(VB_HAS_TANGENT)); LoadVertexAttribute(out, host_config, 6, "rawtangent", "float3", "float3"); out.Write(" coord.xyz = rawtangent.xyz;\n" " }}\n" @@ -561,14 +562,14 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos out.Write(" case {:s}:\n", SourceRow::BinormalB); out.Write(" if ((components & {}u) != 0u) // VB_HAS_BINORMAL\n" " {{\n", - static_cast<u32>(VB_HAS_BINORMAL)); + Common::ToUnderlying(VB_HAS_BINORMAL)); LoadVertexAttribute(out, host_config, 6, "rawbinormal", "float3", "float3"); out.Write(" coord.xyz = rawbinormal.xyz;\n" " }}\n" " break;\n\n"); for (u32 i = 0; i < 8; i++) { - out.Write(" case {:s}:\n", static_cast<SourceRow>(static_cast<u32>(SourceRow::Tex0) + i)); + out.Write(" case {:s}:\n", static_cast<SourceRow>(Common::ToUnderlying(SourceRow::Tex0) + i)); out.Write(" if ((components & {}u) != 0u) // VB_HAS_UV{}\n" " {{\n", VB_HAS_UV0 << i, i); @@ -625,7 +626,7 @@ static void GenVertexShaderTexGens(APIType api_type, const ShaderHostConfig& hos out.Write(" default:\n" " {{\n"); out.Write(" if ((components & ({}u /* VB_HAS_TEXMTXIDX0 */ << texgen)) != 0u) {{\n", - static_cast<u32>(VB_HAS_TEXMTXIDX0)); + Common::ToUnderlying(VB_HAS_TEXMTXIDX0)); if (host_config.backend_dynamic_vertex_loader || host_config.backend_vs_point_line_expand) { out.Write(" int tmp = int(load_input_float3_rawtex(vertex_base_offset, " |
