Reducing memory usage

This commit is contained in:
Dynamitos
2024-08-07 21:19:33 +02:00
parent 819b541ff2
commit 64a26bfd57
37 changed files with 216 additions and 44 deletions
+21
View File
@@ -181,3 +181,24 @@ void Material::compile() {
codeStream << "};\n";
graphics->getShaderCompiler()->registerMaterial(this);
}
uint64 Material::getCPUSize() const {
uint64 result = sizeof(Material);
for (size_t i = 0; i < parameters.size(); ++i) {
result += parameters[i].size();
}
for (const auto& expr : codeExpressions)
{
result += expr->getCPUSize();
}
return result;
}
uint64 Material::getGPUSize() const
{
uint64 result = 0;
for (const auto& expr : codeExpressions) {
result += expr->getGPUSize();
}
return result;
}