summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLMemory.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/jogamp/opencl/CLMemory.java')
-rw-r--r--src/com/jogamp/opencl/CLMemory.java13
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;
}