gl_shader_gen: std::move strings where applicable

Avoids the creation of a copy when returning.
This commit is contained in:
Lioncash 2020-06-08 06:56:07 -04:00
parent 11792682fb
commit 2b031e4eaf

View file

@ -1470,7 +1470,7 @@ vec4 secondary_fragment_color = vec4(0.0);
// Do not do any sort of processing if it's obvious we're not going to pass the alpha test // Do not do any sort of processing if it's obvious we're not going to pass the alpha test
if (state.alpha_test_func == FramebufferRegs::CompareFunc::Never) { if (state.alpha_test_func == FramebufferRegs::CompareFunc::Never) {
out += "discard; }"; out += "discard; }";
return {out}; return {std::move(out)};
} }
// Append the scissor test // Append the scissor test
@ -1536,7 +1536,7 @@ vec4 secondary_fragment_color = vec4(0.0);
"VideoCore_Pica_UseGasMode", true); "VideoCore_Pica_UseGasMode", true);
LOG_CRITICAL(Render_OpenGL, "Unimplemented gas mode"); LOG_CRITICAL(Render_OpenGL, "Unimplemented gas mode");
out += "discard; }"; out += "discard; }";
return {out}; return {std::move(out)};
} }
if (state.shadow_rendering) { if (state.shadow_rendering) {
@ -1574,7 +1574,7 @@ do {
out += '}'; out += '}';
return {out}; return {std::move(out)};
} }
ShaderDecompiler::ProgramResult GenerateTrivialVertexShader(bool separable_shader) { ShaderDecompiler::ProgramResult GenerateTrivialVertexShader(bool separable_shader) {
@ -1619,7 +1619,7 @@ void main() {
} }
)"; )";
return {out}; return {std::move(out)};
} }
std::optional<ShaderDecompiler::ProgramResult> GenerateVertexShader( std::optional<ShaderDecompiler::ProgramResult> GenerateVertexShader(
@ -1684,7 +1684,7 @@ layout (std140) uniform vs_config {
out += program_source; out += program_source;
return {{out}}; return {{std::move(out)}};
} }
static std::string GetGSCommonSource(const PicaGSConfigCommonRaw& config, bool separable_shader) { static std::string GetGSCommonSource(const PicaGSConfigCommonRaw& config, bool separable_shader) {
@ -1802,6 +1802,6 @@ void main() {
out += " EmitPrim(prim_buffer[0], prim_buffer[1], prim_buffer[2]);\n"; out += " EmitPrim(prim_buffer[0], prim_buffer[1], prim_buffer[2]);\n";
out += "}\n"; out += "}\n";
return {out}; return {std::move(out)};
} }
} // namespace OpenGL } // namespace OpenGL