summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-04-20 04:18:27 +0200
committerSven Gothel <[email protected]>2023-04-20 04:18:27 +0200
commit593b9c6360fd32fdca7d4e3da71525be15157726 (patch)
tree7db4dcfd40e5899cec0b0b3bbadae4a0842225b4 /src/jogl/classes/jogamp/graph/curve/opengl
parent8041c69644acb5bd68bb6404ba8744163e8f2a30 (diff)
Graph GLRegion*: Utilize interleaved GLSL buffers for vertices, curveParams and the optional colors (GPU effeciency and performance; Increased CPU buffer growth performance)
Besides simplification, interleaved GPU memory boosts - effeciency - performance Since only one underlying backing buffer on the CPU (host) has to be managed, it also increases buffer growth performance.
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java39
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java38
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java41
3 files changed, 14 insertions, 104 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index 2ccb0b050..62451ec50 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -139,14 +139,9 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
// seal buffers
indicesBuffer.seal(gl, true);
indicesBuffer.enableBuffer(gl, false);
- gca_CurveParamsAttr.seal(gl, true);
- gca_CurveParamsAttr.enableBuffer(gl, false);
- gca_VerticesAttr.seal(gl, true);
- gca_VerticesAttr.enableBuffer(gl, false);
- if( hasColorChannel && null != gca_ColorsAttr ) {
- gca_ColorsAttr.seal(gl, true);
- gca_ColorsAttr.enableBuffer(gl, false);
- }
+ vpc_ileave.seal(gl, true);
+ vpc_ileave.enableBuffer(gl, false);
+
if( hasColorTexture && null != gcu_ColorTexUnit && colorTexSeq.isTextureAvailable() ) {
final TextureSequence.TextureFrame frame = colorTexSeq.getLastTexture();
final Texture tex = frame.getTexture();
@@ -471,11 +466,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
final boolean hasColorTexture = Region.hasColorTexture( curRenderModes );
gl.glUniform(gcu_PMVMatrix02);
- gca_VerticesAttr.enableBuffer(gl, true);
- gca_CurveParamsAttr.enableBuffer(gl, true);
- if( hasColorChannel && null != gca_ColorsAttr ) {
- gca_ColorsAttr.enableBuffer(gl, true);
- }
+ vpc_ileave.enableBuffer(gl, true);
indicesBuffer.bindBuffer(gl, true); // keeps VBO binding
if( hasColorTexture && null != gcu_ColorTexUnit && colorTexSeq.isTextureAvailable() ) {
final TextureSequence.TextureFrame frame = colorTexSeq.getNextTexture(gl);
@@ -493,11 +484,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
}
indicesBuffer.bindBuffer(gl, false);
- if( hasColorChannel && null != gca_ColorsAttr ) {
- gca_ColorsAttr.enableBuffer(gl, false);
- }
- gca_CurveParamsAttr.enableBuffer(gl, false);
- gca_VerticesAttr.enableBuffer(gl, false);
+ vpc_ileave.enableBuffer(gl, false);
}
@Override
@@ -509,22 +496,6 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
fbo.destroy(gl);
fbo = null;
}
- if(null != gca_VerticesAttr) {
- gca_VerticesAttr.destroy(gl);
- gca_VerticesAttr = null;
- }
- if(null != gca_CurveParamsAttr) {
- gca_CurveParamsAttr.destroy(gl);
- gca_CurveParamsAttr = null;
- }
- if(null != gca_ColorsAttr) {
- gca_ColorsAttr.destroy(gl);
- gca_ColorsAttr = null;
- }
- if(null != indicesBuffer) {
- indicesBuffer.destroy(gl);
- indicesBuffer = null;
- }
if(null != gca_FboVerticesAttr) {
gca_FboVerticesAttr.destroy(gl);
gca_FboVerticesAttr = null;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index ac7ec21fc..3acbd6c73 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -232,14 +232,8 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
// seal buffers
indicesBuffer.seal(gl, true);
indicesBuffer.enableBuffer(gl, false);
- gca_CurveParamsAttr.seal(gl, true);
- gca_CurveParamsAttr.enableBuffer(gl, false);
- gca_VerticesAttr.seal(gl, true);
- gca_VerticesAttr.enableBuffer(gl, false);
- if( hasColorChannel && null != gca_ColorsAttr ) {
- gca_ColorsAttr.seal(gl, true);
- gca_ColorsAttr.enableBuffer(gl, false);
- }
+ vpc_ileave.seal(gl, true);
+ vpc_ileave.enableBuffer(gl, false);
if( hasColorTexture && null != gcu_ColorTexUnit && colorTexSeq.isTextureAvailable() ) {
final TextureSequence.TextureFrame frame = colorTexSeq.getLastTexture();
final Texture tex = frame.getTexture();
@@ -577,11 +571,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
gl.glUniform(gcu_PMVMatrix02);
- gca_VerticesAttr.enableBuffer(gl, true);
- gca_CurveParamsAttr.enableBuffer(gl, true);
- if( hasColorChannel && null != gca_ColorsAttr ) {
- gca_ColorsAttr.enableBuffer(gl, true);
- }
+ vpc_ileave.enableBuffer(gl, true);
indicesBuffer.bindBuffer(gl, true); // keeps VBO binding
if( hasColorTexture && null != gcu_ColorTexUnit && colorTexSeq.isTextureAvailable() ) {
final TextureSequence.TextureFrame frame = colorTexSeq.getNextTexture(gl);
@@ -599,11 +589,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
}
indicesBuffer.bindBuffer(gl, false);
- if( hasColorChannel && null != gca_ColorsAttr ) {
- gca_ColorsAttr.enableBuffer(gl, false);
- }
- gca_CurveParamsAttr.enableBuffer(gl, false);
- gca_VerticesAttr.enableBuffer(gl, false);
+ vpc_ileave.enableBuffer(gl, false);
}
@Override
@@ -617,22 +603,6 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
fbo = null;
texA = null;
}
- if(null != gca_VerticesAttr) {
- gca_VerticesAttr.destroy(gl);
- gca_VerticesAttr = null;
- }
- if(null != gca_CurveParamsAttr) {
- gca_CurveParamsAttr.destroy(gl);
- gca_CurveParamsAttr = null;
- }
- if(null != gca_ColorsAttr) {
- gca_ColorsAttr.destroy(gl);
- gca_ColorsAttr = null;
- }
- if(null != indicesBuffer) {
- indicesBuffer.destroy(gl);
- indicesBuffer = null;
- }
if(null != gca_FboVerticesAttr) {
gca_FboVerticesAttr.destroy(gl);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 97948c204..a55bd626a 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -83,14 +83,8 @@ public final class VBORegionSPES2 extends GLRegion {
final boolean hasColorTexture = Region.hasColorTexture( curRenderModes );
// seal buffers
- gca_VerticesAttr.seal(gl, true);
- gca_VerticesAttr.enableBuffer(gl, false);
- gca_CurveParamsAttr.seal(gl, true);
- gca_CurveParamsAttr.enableBuffer(gl, false);
- if( hasColorChannel && null != gca_ColorsAttr ) {
- gca_ColorsAttr.seal(gl, true);
- gca_ColorsAttr.enableBuffer(gl, false);
- }
+ vpc_ileave.seal(gl, true);
+ vpc_ileave.enableBuffer(gl, false);
if( hasColorTexture && null != gcu_ColorTexUnit && colorTexSeq.isTextureAvailable() ) {
final TextureSequence.TextureFrame frame = colorTexSeq.getLastTexture();
final Texture tex = frame.getTexture();
@@ -113,8 +107,7 @@ public final class VBORegionSPES2 extends GLRegion {
indicesBuffer.enableBuffer(gl, false);
if(DEBUG_INSTANCE) {
System.err.println("VBORegionSPES2 idx "+indicesBuffer);
- System.err.println("VBORegionSPES2 ver "+gca_VerticesAttr);
- System.err.println("VBORegionSPES2 tex "+gca_CurveParamsAttr);
+ System.err.println("VBORegionSPES2 vpc "+vpc_ileave);
}
}
@@ -170,11 +163,7 @@ public final class VBORegionSPES2 extends GLRegion {
}
return; // empty!
}
- gca_VerticesAttr.enableBuffer(gl, true);
- gca_CurveParamsAttr.enableBuffer(gl, true);
- if( hasColorChannel && null != gca_ColorsAttr ) {
- gca_ColorsAttr.enableBuffer(gl, true);
- }
+ vpc_ileave.enableBuffer(gl, true);
indicesBuffer.bindBuffer(gl, true); // keeps VBO binding
if( renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) {
@@ -199,11 +188,7 @@ public final class VBORegionSPES2 extends GLRegion {
}
indicesBuffer.bindBuffer(gl, false);
- if( hasColorChannel && null != gca_ColorsAttr ) {
- gca_ColorsAttr.enableBuffer(gl, false);
- }
- gca_CurveParamsAttr.enableBuffer(gl, false);
- gca_VerticesAttr.enableBuffer(gl, false);
+ vpc_ileave.enableBuffer(gl, false);
}
@Override
@@ -211,22 +196,6 @@ public final class VBORegionSPES2 extends GLRegion {
if(DEBUG_INSTANCE) {
System.err.println("VBORegionSPES2 Destroy: " + this);
}
- if(null != gca_VerticesAttr) {
- gca_VerticesAttr.destroy(gl);
- gca_VerticesAttr = null;
- }
- if(null != gca_CurveParamsAttr) {
- gca_CurveParamsAttr.destroy(gl);
- gca_CurveParamsAttr = null;
- }
- if(null != gca_ColorsAttr) {
- gca_ColorsAttr.destroy(gl);
- gca_ColorsAttr = null;
- }
- if(null != indicesBuffer) {
- indicesBuffer.destroy(gl);
- indicesBuffer = null;
- }
spPass1 = null; // owned by RegionRenderer
}
}