diff options
author | Michael Bien <[email protected]> | 2011-04-26 15:49:23 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-04-26 15:49:23 +0200 |
commit | 5e3020e831a4b5fc04843db88642097b2ad072a9 (patch) | |
tree | 1c6357638275d104b5cd4b8648f621e06d182a1f /src/com/jogamp/opencl/CLMemory.java | |
parent | c00dc66867518f32d6a2615aa8da71a52489d5d8 (diff) |
- CLGLBuffer size must now be specified when the buffer is created
- but can be updated later if required (gl lock is mandatory)
- added VBO CLGL test
- javadoc updates
Diffstat (limited to 'src/com/jogamp/opencl/CLMemory.java')
-rw-r--r-- | src/com/jogamp/opencl/CLMemory.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/jogamp/opencl/CLMemory.java b/src/com/jogamp/opencl/CLMemory.java index 7a3e82f7..f299439d 100644 --- a/src/com/jogamp/opencl/CLMemory.java +++ b/src/com/jogamp/opencl/CLMemory.java @@ -50,7 +50,7 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL B buffer; protected final int FLAGS; - protected final long size; + protected long size; // depends on the nio buffer type protected int elementSize; @@ -65,11 +65,15 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL this.buffer = directBuffer; this.FLAGS = flags; this.size = size; - initElementSizes(); + initElementSize(); + initCLCapacity(); } - private void initElementSizes() { + private void initElementSize() { this.elementSize = (buffer==null) ? 1 : Buffers.sizeOfBufferElem(buffer); + } + + protected final void initCLCapacity() { this.clCapacity = (int) (size / elementSize); } @@ -118,7 +122,8 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL +" but got " + buffer.getClass()); } this.buffer = buffer; - initElementSizes(); + initElementSize(); + initCLCapacity(); return this; } |