mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-23 18:19:21 +01:00
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.
This commit is contained in:
parent
397bd1bb73
commit
623cc926ed
@ -150,7 +150,7 @@ std::vector<std::string> 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;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace OpenGL {
|
||||
@ -18,6 +19,6 @@ std::vector<std::string> 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
|
||||
|
Loading…
Reference in New Issue
Block a user