Skip to content

Commit

Permalink
GL memory leak in IBLComposer: radiance fbo and default BRDF texture …
Browse files Browse the repository at this point in the history
…are never released (#111)

* fix: possible npe when disposing EnvironmentBaker

* fix: gl memory leak

GL memory leak: radiance fbo and default BRDF texture are never released
  • Loading branch information
dar-dev authored Jun 16, 2023
1 parent 3915eef commit 38e4381
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public EnvironmentBaker() {
public void dispose() {
rectToCubeShader.dispose();
rectToCubeRenderer.dispose();
fboEnv.dispose();
if(fboEnv != null) fboEnv.dispose();
}

private static ShaderProgram loadShader(String name){
Expand Down
2 changes: 2 additions & 0 deletions ibl-composer/src/net/mgsx/gltf/ibl/model/IBLComposer.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public void dispose() {
if(pixmapRaw != null) pixmapRaw.dispose();
if(textureRaw != null) textureRaw.dispose();
if(irradianceMap != null) irradianceMap.dispose();
if(radianceMap != null) radianceMap.dispose();
if(builtinBRDF != null) builtinBRDF.dispose();
environmentBaker.dispose();
irradianceBaker.dispose();
radianceBaker.dispose();
Expand Down

0 comments on commit 38e4381

Please sign in to comment.