diff options
Diffstat (limited to 'src/com/jogamp/opencl/CLMemory.java')
-rw-r--r-- | src/com/jogamp/opencl/CLMemory.java | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/com/jogamp/opencl/CLMemory.java b/src/com/jogamp/opencl/CLMemory.java index 5b0422ca..b78e6024 100644 --- a/src/com/jogamp/opencl/CLMemory.java +++ b/src/com/jogamp/opencl/CLMemory.java @@ -33,11 +33,7 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.impl.CLMemObjectDestructorCallback; import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.DoubleBuffer; -import java.nio.FloatBuffer; import java.nio.IntBuffer; -import java.nio.ShortBuffer; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; @@ -73,7 +69,7 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL } private void initElementSizes() { - this.elementSize = (buffer==null) ? 1 : sizeOfBufferElem(buffer); + this.elementSize = (buffer==null) ? 1 : Buffers.sizeOfBufferElem(buffer); this.clCapacity = (int) (size / elementSize); } @@ -85,21 +81,6 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL || (flags & CL_MEM_USE_HOST_PTR) != 0; } - static int sizeOfBufferElem(Buffer buffer) { - if (buffer instanceof ByteBuffer) { - return Buffers.SIZEOF_BYTE; - } else if (buffer instanceof IntBuffer) { - return Buffers.SIZEOF_INT; - } else if (buffer instanceof ShortBuffer) { - return Buffers.SIZEOF_SHORT; - } else if (buffer instanceof FloatBuffer) { - return Buffers.SIZEOF_FLOAT; - } else if (buffer instanceof DoubleBuffer) { - return Buffers.SIZEOF_DOUBLE; - } - throw new RuntimeException("Unexpected buffer type " + buffer.getClass().getName()); - } - protected static long getSizeImpl(CL cl, long id) { PointerBuffer pb = PointerBuffer.allocateDirect(1); int ret = cl.clGetMemObjectInfo(id, CL_MEM_SIZE, pb.elementSize(), pb.getBuffer(), null); |