Fix memory leak with volume shaders with the workbench engine

../lib/tests/render/volume/smoke_fire.blend was leaking memory,
reloading leaked more memory each time.
This commit is contained in:
Campbell Barton 2023-09-27 16:50:48 +10:00
parent 5126677c6f
commit a9f0d19197
1 changed files with 12 additions and 0 deletions

View File

@ -12,6 +12,18 @@
namespace blender::workbench {
VolumePass::~VolumePass()
{
GPUShader **sh_p = &shaders_[0][0][0][0];
const int n = sizeof(shaders_) / sizeof(*shaders_);
for (int i = 0; i < n; i++, sh_p++) {
GPUShader *sh = *sh_p;
if (sh) {
GPU_shader_free(sh);
}
}
}
void VolumePass::sync(SceneResources &resources)
{
active_ = false;