Merge pull request #609 from wheremyfoodat/wheremyfoodat-patch-2

Shadergen: Pre-allocate space for shadergen string
This commit is contained in:
wheremyfoodat 2024-10-13 20:29:15 +00:00 committed by GitHub
commit 5eb628eb5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,6 +34,8 @@ static constexpr const char* uniformDefinition = R"(
std::string FragmentGenerator::getDefaultVertexShader() {
std::string ret = "";
// Reserve some space (128KB) in the output string to avoid too many allocations later
ret.reserve(128 * 1024);
switch (api) {
case API::GL: ret += "#version 410 core"; break;