summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2019-05-03 07:59:25 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-05-20 21:36:48 +0200
commitada79fa8ad94952c4ddee766a3bb9091dc6282e0 (patch)
treeff9e5b6949f261108c9c6a2e52ad348819e0de28 /src/video_core/renderer_opengl
parentMerge pull request #2499 from lioncash/translate (diff)
downloadyuzu-ada79fa8ad94952c4ddee766a3bb9091dc6282e0.tar
yuzu-ada79fa8ad94952c4ddee766a3bb9091dc6282e0.tar.gz
yuzu-ada79fa8ad94952c4ddee766a3bb9091dc6282e0.tar.bz2
yuzu-ada79fa8ad94952c4ddee766a3bb9091dc6282e0.tar.lz
yuzu-ada79fa8ad94952c4ddee766a3bb9091dc6282e0.tar.xz
yuzu-ada79fa8ad94952c4ddee766a3bb9091dc6282e0.tar.zst
yuzu-ada79fa8ad94952c4ddee766a3bb9091dc6282e0.zip
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp14
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;
using Tegra::Shader::IpaMode;
using Tegra::Shader::IpaSampleMode;
using Tegra::Shader::Register;
+
+using namespace std::string_literals;
using namespace VideoCommon::Shader;
using Maxwell = Tegra::Engines::Maxwell3D::Regs;
@@ -96,11 +98,9 @@ private:
};
/// Generates code to use for a swizzle operation.
-std::string GetSwizzle(u32 elem) {
- ASSERT(elem <= 3);
- std::string swizzle = ".";
- swizzle += "xyzw"[elem];
- return swizzle;
+constexpr const char* GetSwizzle(u32 element) {
+ constexpr std::array<const char*, 4> swizzle = {".x", ".y", ".z", ".w"};
+ return swizzle.at(element);
}
/// Translate topology
@@ -622,7 +622,7 @@ private:
if (stage != ShaderStage::Fragment) {
return GeometryPass("position") + GetSwizzle(element);
} else {
- return element == 3 ? "1.0f" : "gl_FragCoord" + GetSwizzle(element);
+ return element == 3 ? "1.0f" : ("gl_FragCoord"s + GetSwizzle(element));
}
case Attribute::Index::PointCoord:
switch (element) {
@@ -909,7 +909,7 @@ private:
target = [&]() -> std::string {
switch (const auto attribute = abuf->GetIndex(); abuf->GetIndex()) {
case Attribute::Index::Position:
- return "position" + GetSwizzle(abuf->GetElement());
+ return "position"s + GetSwizzle(abuf->GetElement());
case Attribute::Index::PointSize:
return "gl_PointSize";
case Attribute::Index::ClipDistances0123: