mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-28 01:52:29 -06:00
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
1 changed files with 4 additions and 3 deletions
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue