summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLMemory.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-05-18 03:51:10 +0200
committerSven Gothel <[email protected]>2011-05-18 03:51:10 +0200
commit773060662ef81707f70c447b71e664635ac45e2a (patch)
treef52c9e24b80902b08422005192df5b525f85489b /src/com/jogamp/opencl/CLMemory.java
parenteceed6e10c7d6cb19e8ad3c1bf5ea20450d6fae1 (diff)
parentf12e3a9d7ac644abc98a51dc51786cf7c5b67851 (diff)
resolve conflicts
Diffstat (limited to 'src/com/jogamp/opencl/CLMemory.java')
-rw-r--r--src/com/jogamp/opencl/CLMemory.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/com/jogamp/opencl/CLMemory.java b/src/com/jogamp/opencl/CLMemory.java
index b78e6024..db64f8a5 100644
--- a/src/com/jogamp/opencl/CLMemory.java
+++ b/src/com/jogamp/opencl/CLMemory.java
@@ -30,7 +30,7 @@ package com.jogamp.opencl;
import com.jogamp.opencl.gl.CLGLI;
import com.jogamp.common.nio.Buffers;
-import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.common.nio.NativeSizeBuffer;
import com.jogamp.opencl.impl.CLMemObjectDestructorCallback;
import java.nio.Buffer;
import java.nio.IntBuffer;
@@ -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;
}