mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-24 12:26:26 -05:00
glsl_shader_decompiler: Add char overload for ShaderWriter's AddLine()
Avoids constructing a std::string just to append a character.
This commit is contained in:
parent
4ef392906b
commit
aa26baa3db
1 changed files with 11 additions and 4 deletions
|
@ -117,6 +117,13 @@ public:
|
||||||
shader_source += text + '\n';
|
shader_source += text + '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddLine(char character) {
|
||||||
|
DEBUG_ASSERT(scope >= 0);
|
||||||
|
AppendIndentation();
|
||||||
|
shader_source += character;
|
||||||
|
shader_source += '\n';
|
||||||
|
}
|
||||||
|
|
||||||
std::string GetResult() {
|
std::string GetResult() {
|
||||||
return std::move(shader_source);
|
return std::move(shader_source);
|
||||||
}
|
}
|
||||||
|
@ -511,14 +518,14 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
--shader.scope;
|
--shader.scope;
|
||||||
shader.AddLine("}");
|
shader.AddLine('}');
|
||||||
}
|
}
|
||||||
|
|
||||||
shader.AddLine("default: return false;");
|
shader.AddLine("default: return false;");
|
||||||
shader.AddLine("}");
|
shader.AddLine('}');
|
||||||
|
|
||||||
--shader.scope;
|
--shader.scope;
|
||||||
shader.AddLine("}");
|
shader.AddLine('}');
|
||||||
|
|
||||||
shader.AddLine("return false;");
|
shader.AddLine("return false;");
|
||||||
}
|
}
|
||||||
|
@ -568,7 +575,7 @@ private:
|
||||||
unsigned const_buffer_layout = 0;
|
unsigned const_buffer_layout = 0;
|
||||||
for (const auto& entry : GetConstBuffersDeclarations()) {
|
for (const auto& entry : GetConstBuffersDeclarations()) {
|
||||||
declarations.AddLine("layout(std430) buffer " + entry.GetName());
|
declarations.AddLine("layout(std430) buffer " + entry.GetName());
|
||||||
declarations.AddLine("{");
|
declarations.AddLine('{');
|
||||||
declarations.AddLine(" float c" + std::to_string(entry.GetIndex()) + "[];");
|
declarations.AddLine(" float c" + std::to_string(entry.GetIndex()) + "[];");
|
||||||
declarations.AddLine("};");
|
declarations.AddLine("};");
|
||||||
declarations.AddLine("");
|
declarations.AddLine("");
|
||||||
|
|
Loading…
Reference in a new issue