From 623cc926edb20d797ade3e3b26385112ea91e52c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 18 Apr 2020 22:27:42 -0400 Subject: [PATCH] post_processing_opengl: Make use of std::string_view with GetPostProcessingShaderCode() Same behavior, but doesn't result in an allocating copy of the passed in string. Particularly given the string is only compared against other existing strings. --- src/video_core/renderer_opengl/post_processing_opengl.cpp | 2 +- src/video_core/renderer_opengl/post_processing_opengl.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/video_core/renderer_opengl/post_processing_opengl.cpp b/src/video_core/renderer_opengl/post_processing_opengl.cpp index 6c4fec59d..b4841368d 100644 --- a/src/video_core/renderer_opengl/post_processing_opengl.cpp +++ b/src/video_core/renderer_opengl/post_processing_opengl.cpp @@ -150,7 +150,7 @@ std::vector GetPostProcessingShaderList(bool anaglyph) { return shader_names; } -std::string GetPostProcessingShaderCode(bool anaglyph, std::string shader) { +std::string GetPostProcessingShaderCode(bool anaglyph, std::string_view shader) { std::string shader_dir = FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir); std::string shader_path; diff --git a/src/video_core/renderer_opengl/post_processing_opengl.h b/src/video_core/renderer_opengl/post_processing_opengl.h index 0016638e6..3e9ea3e45 100644 --- a/src/video_core/renderer_opengl/post_processing_opengl.h +++ b/src/video_core/renderer_opengl/post_processing_opengl.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include namespace OpenGL { @@ -18,6 +19,6 @@ std::vector GetPostProcessingShaderList(bool anaglyph); // If anaglyph is true, it searches the shaders/anaglyph directory rather than // the shaders directory // If the shader cannot be loaded, an empty string is returned -std::string GetPostProcessingShaderCode(bool anaglyph, std::string shader_name); +std::string GetPostProcessingShaderCode(bool anaglyph, std::string_view shader_name); } // namespace OpenGL