video_core: reduce string allocations in shader decompiler (#5261)
* video_core: reduce string allocations in shader decompiler * use append for indentation instead of resize Co-authored-by: Mat M. <mathew1800@gmail.com>
This commit is contained in:
parent
b82d4315fe
commit
db5b8b9c88
|
@ -196,12 +196,13 @@ private:
|
||||||
|
|
||||||
class ShaderWriter {
|
class ShaderWriter {
|
||||||
public:
|
public:
|
||||||
void AddLine(const std::string& text) {
|
void AddLine(std::string_view text) {
|
||||||
DEBUG_ASSERT(scope >= 0);
|
DEBUG_ASSERT(scope >= 0);
|
||||||
if (!text.empty()) {
|
if (!text.empty()) {
|
||||||
shader_source += std::string(static_cast<std::size_t>(scope) * 4, ' ');
|
shader_source.append(static_cast<std::size_t>(scope) * 4, ' ');
|
||||||
}
|
}
|
||||||
shader_source += text + '\n';
|
shader_source += text;
|
||||||
|
shader_source += '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MoveResult() {
|
std::string MoveResult() {
|
||||||
|
|
Reference in New Issue