diff options
author | Sven Gothel <[email protected]> | 2011-05-01 07:06:45 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-05-01 07:06:45 +0200 |
commit | dab2ffd696b5f9ccb192834c3e50132fad96a30a (patch) | |
tree | a174ad04342f32002197171eb895b2435fc42f49 /src/com/jogamp/opencl/CLMemory.java | |
parent | 454f81a14da543faebae4c8e6adebb3256a2e646 (diff) | |
parent | abcef28580df7ba0176390fe6d0a0eb1d969183d (diff) |
Merge remote-tracking branch 'mbien/master'
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); |