diff options
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 4bff54a59..713eded6d 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -31,6 +31,8 @@ using Tegra::Shader::IpaInterpMode; | |||
| 31 | using Tegra::Shader::IpaMode; | 31 | using Tegra::Shader::IpaMode; |
| 32 | using Tegra::Shader::IpaSampleMode; | 32 | using Tegra::Shader::IpaSampleMode; |
| 33 | using Tegra::Shader::Register; | 33 | using Tegra::Shader::Register; |
| 34 | |||
| 35 | using namespace std::string_literals; | ||
| 34 | using namespace VideoCommon::Shader; | 36 | using namespace VideoCommon::Shader; |
| 35 | 37 | ||
| 36 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; | 38 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; |
| @@ -96,11 +98,9 @@ private: | |||
| 96 | }; | 98 | }; |
| 97 | 99 | ||
| 98 | /// Generates code to use for a swizzle operation. | 100 | /// Generates code to use for a swizzle operation. |
| 99 | std::string GetSwizzle(u32 elem) { | 101 | constexpr const char* GetSwizzle(u32 element) { |
| 100 | ASSERT(elem <= 3); | 102 | constexpr std::array<const char*, 4> swizzle = {".x", ".y", ".z", ".w"}; |
| 101 | std::string swizzle = "."; | 103 | return swizzle.at(element); |
| 102 | swizzle += "xyzw"[elem]; | ||
| 103 | return swizzle; | ||
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | /// Translate topology | 106 | /// Translate topology |
| @@ -622,7 +622,7 @@ private: | |||
| 622 | if (stage != ShaderStage::Fragment) { | 622 | if (stage != ShaderStage::Fragment) { |
| 623 | return GeometryPass("position") + GetSwizzle(element); | 623 | return GeometryPass("position") + GetSwizzle(element); |
| 624 | } else { | 624 | } else { |
| 625 | return element == 3 ? "1.0f" : "gl_FragCoord" + GetSwizzle(element); | 625 | return element == 3 ? "1.0f" : ("gl_FragCoord"s + GetSwizzle(element)); |
| 626 | } | 626 | } |
| 627 | case Attribute::Index::PointCoord: | 627 | case Attribute::Index::PointCoord: |
| 628 | switch (element) { | 628 | switch (element) { |
| @@ -909,7 +909,7 @@ private: | |||
| 909 | target = [&]() -> std::string { | 909 | target = [&]() -> std::string { |
| 910 | switch (const auto attribute = abuf->GetIndex(); abuf->GetIndex()) { | 910 | switch (const auto attribute = abuf->GetIndex(); abuf->GetIndex()) { |
| 911 | case Attribute::Index::Position: | 911 | case Attribute::Index::Position: |
| 912 | return "position" + GetSwizzle(abuf->GetElement()); | 912 | return "position"s + GetSwizzle(abuf->GetElement()); |
| 913 | case Attribute::Index::PointSize: | 913 | case Attribute::Index::PointSize: |
| 914 | return "gl_PointSize"; | 914 | return "gl_PointSize"; |
| 915 | case Attribute::Index::ClipDistances0123: | 915 | case Attribute::Index::ClipDistances0123: |