mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-12-15 15:25:31 +00:00
glsl_shader_decompiler: Append indentation without constructing a separate std::string
The interface of std::string already lets us append N copies of a character to an existing string.
This commit is contained in:
parent
3f49210234
commit
4ef392906b
|
@ -112,7 +112,7 @@ public:
|
||||||
void AddLine(const std::string& text) {
|
void AddLine(const std::string& text) {
|
||||||
DEBUG_ASSERT(scope >= 0);
|
DEBUG_ASSERT(scope >= 0);
|
||||||
if (!text.empty()) {
|
if (!text.empty()) {
|
||||||
shader_source += std::string(static_cast<size_t>(scope) * 4, ' ');
|
AppendIndentation();
|
||||||
}
|
}
|
||||||
shader_source += text + '\n';
|
shader_source += text + '\n';
|
||||||
}
|
}
|
||||||
|
@ -124,6 +124,10 @@ public:
|
||||||
int scope = 0;
|
int scope = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void AppendIndentation() {
|
||||||
|
shader_source.append(static_cast<size_t>(scope) * 4, ' ');
|
||||||
|
}
|
||||||
|
|
||||||
std::string shader_source;
|
std::string shader_source;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue