diff options
author | Sven Gothel <[email protected]> | 2023-03-06 02:15:23 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-06 02:15:23 +0100 |
commit | c14b85395d2b3b75d09d9b9fd2eeecb20aad46af (patch) | |
tree | a313ae2dbd7965b466805f52357fa34fcd49755b | |
parent | d87f510194ad2eead2a42b41a3cbe1077f65a695 (diff) |
GLArrayData[Editable,Client]: Add put[34][bsif](..) and array put[bsif](..) variants for flexibility/performance
Notable: The array-put is slower than small range single-puts, e.g. put3i(..).
Uses GlueGen's Buffers change commit 69b748925038b7d44fa6318536642b426e3d3e38
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java | 84 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java | 17 |
2 files changed, 101 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java index 6dbfb2673..71b15e4e9 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java @@ -293,6 +293,27 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override + public void put3b(final byte v1, final byte v2, final byte v3) { + if ( sealed ) return; + growIfNeeded(3); + Buffers.put3b(buffer, v1, v2, v3); + } + + @Override + public void put4b(final byte v1, final byte v2, final byte v3, final byte v4) { + if ( sealed ) return; + growIfNeeded(4); + Buffers.put4b(buffer, v1, v2, v3, v4); + } + + @Override + public void putb(final byte[] src, final int offset, final int length) { + if ( sealed ) return; + growIfNeeded(length); + Buffers.putb(buffer, src, offset, length); + } + + @Override public void puts(final short v) { if ( sealed ) return; growIfNeeded(1); @@ -300,6 +321,27 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override + public void put3s(final short v1, final short v2, final short v3) { + if ( sealed ) return; + growIfNeeded(3); + Buffers.put3s(buffer, v1, v2, v3); + } + + @Override + public void put4s(final short v1, final short v2, final short v3, final short v4) { + if ( sealed ) return; + growIfNeeded(4); + Buffers.put4s(buffer, v1, v2, v3, v4); + } + + @Override + public void puts(final short[] src, final int offset, final int length) { + if ( sealed ) return; + growIfNeeded(length); + Buffers.puts(buffer, src, offset, length); + } + + @Override public void puti(final int v) { if ( sealed ) return; growIfNeeded(1); @@ -307,6 +349,27 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override + public void put3i(final int v1, final int v2, final int v3) { + if ( sealed ) return; + growIfNeeded(3); + Buffers.put3i(buffer, v1, v2, v3); + } + + @Override + public void put4i(final int v1, final int v2, final int v3, final int v4) { + if ( sealed ) return; + growIfNeeded(4); + Buffers.put4i(buffer, v1, v2, v3, v4); + } + + @Override + public void puti(final int[] src, final int offset, final int length) { + if ( sealed ) return; + growIfNeeded(length); + Buffers.puti(buffer, src, offset, length); + } + + @Override public void putx(final int v) { puti(v); } @@ -319,6 +382,27 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override + public void put3f(final float v1, final float v2, final float v3) { + if ( sealed ) return; + growIfNeeded(3); + Buffers.put3f(buffer, v1, v2, v3); + } + + @Override + public void put4f(final float v1, final float v2, final float v3, final float v4) { + if ( sealed ) return; + growIfNeeded(4); + Buffers.put4f(buffer, v1, v2, v3, v4); + } + + @Override + public void putf(final float[] src, final int offset, final int length) { + if ( sealed ) return; + growIfNeeded(length); + Buffers.putf(buffer, src, offset, length); + } + + @Override public String toString() { return "GLArrayDataClient["+name+ ", index "+index+ diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java index 50bcf7c5b..b3e402d3b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java @@ -137,10 +137,27 @@ public interface GLArrayDataEditable extends GLArrayData { public void rewind(); public void padding(int doneInByteSize); public void put(Buffer v); + public void putb(byte v); + public void put3b(byte v1, byte v2, byte v3); + public void put4b(byte v1, byte v2, byte v3, byte v4); + public void putb(byte[] src, int offset, int length); + public void puts(short v); + public void put3s(short v1, short v2, short v3); + public void put4s(short v1, short v2, short v3, short v4); + public void puts(short[] src, int offset, int length); + public void puti(int v); + public void put3i(int v1, int v2, int v3); + public void put4i(int v1, int v2, int v3, int v4); + public void puti(int[] src, int offset, int length); + public void putx(int v); + public void putf(float v); + public void put3f(float v1, float v2, float v3); + public void put4f(float v1, float v2, float v3, float v4); + public void putf(float[] src, int offset, int length); } |