summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-15 03:26:30 +0100
committerSven Gothel <[email protected]>2023-03-15 03:26:30 +0100
commitc01a4ad712cfa2d1f8746daf161d9052c8acfccd (patch)
tree4f8a033905d0ffc63329f44726a9ea88c0b2977f /src/jogl/classes/jogamp/graph/curve/opengl
parent00dbacc5af3531af50e77a02d534dc11e08de10f (diff)
Fix ShaderProgram ownership bug, introduced in commit 67a723477ecd818fbc5859fe20ee536a3b4efae5 (reverting and clarifying)
All Graph ShaderPrograms used are owned by RegionRenderer, not RenderState nor [GL]Region*, hence [GL]Region* shall only nullify the resources but not destroy the shader currently in use. One RegionRenderer maybe used for multuple Regions.
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java17
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java16
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java11
3 files changed, 9 insertions, 35 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index c09e75b53..bc87b3faa 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -40,6 +40,7 @@ import com.jogamp.opengl.GLUniformData;
import jogamp.graph.curve.opengl.shader.AttributeNames;
import jogamp.graph.curve.opengl.shader.UniformNames;
+import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.RenderState;
@@ -322,7 +323,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
/**
* <p>
* Since multiple {@link Region}s may share one
- * {@link ShaderProgram}, the uniform data must always be updated.
+ * {@link ShaderProgram} managed and owned by {@link RegionRendered}, the uniform data must always be updated.
* </p>
*
* @param gl
@@ -629,18 +630,6 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
}
@Override
- protected void clearShaderImpl(final GL2ES2 gl) {
- if( null != spPass1 ) {
- spPass1.destroy(gl);
- spPass1 = null;
- }
- if( null != spPass2 ) {
- spPass2.destroy(gl);
- spPass2 = null;
- }
- }
-
- @Override
protected void destroyImpl(final GL2ES2 gl) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegion2PES2 Destroy: " + this);
@@ -677,5 +666,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
indicesFbo.destroy(gl);
indicesFbo = null;
}
+ spPass1 = null; // owned by RegionRenderer
+ spPass2 = null; // owned by RegionRenderer
}
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 96247c61a..21f454655 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -128,7 +128,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
/**
* <p>
* Since multiple {@link Region}s may share one
- * {@link ShaderProgram}, the uniform data must always be updated.
+ * {@link ShaderProgram} managed and owned by {@link RegionRendered}, the uniform data must always be updated.
* </p>
*
* @param gl
@@ -762,18 +762,6 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
}
@Override
- protected void clearShaderImpl(final GL2ES2 gl) {
- if( null != spPass1 ) {
- spPass1.destroy(gl);
- spPass1 = null;
- }
- if( null != spPass2 ) {
- spPass2.destroy(gl);
- spPass2 = null;
- }
- }
-
- @Override
protected void destroyImpl(final GL2ES2 gl) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegion2PES2 Destroy: " + this);
@@ -813,5 +801,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
indicesFbo.destroy(gl);
indicesFbo = null;
}
+ spPass1 = null; // owned by RegionRenderer
+ spPass2 = null; // owned by RegionRenderer
}
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index b8bdfbe37..0077186e6 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -265,7 +265,7 @@ public final class VBORegionSPES2 extends GLRegion {
/**
* <p>
* Since multiple {@link Region}s may share one
- * {@link ShaderProgram}, the uniform data must always be updated.
+ * {@link ShaderProgram} managed and owned by {@link RegionRendered}, the uniform data must always be updated.
* </p>
*
* @param gl
@@ -345,14 +345,6 @@ public final class VBORegionSPES2 extends GLRegion {
}
@Override
- protected void clearShaderImpl(final GL2ES2 gl) {
- if( null != spPass1 ) {
- spPass1.destroy(gl);
- spPass1 = null;
- }
- }
-
- @Override
protected void destroyImpl(final GL2ES2 gl) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegionSPES2 Destroy: " + this);
@@ -373,5 +365,6 @@ public final class VBORegionSPES2 extends GLRegion {
indicesBuffer.destroy(gl);
indicesBuffer = null;
}
+ spPass1 = null; // owned by RegionRenderer
}
}