package com.mbien.opencl; import com.sun.gluegen.runtime.BufferFactory; import java.nio.Buffer; import java.nio.IntBuffer; import static com.mbien.opencl.CLException.*; /** * * @author Michael Bien */ public final class CLImage2d extends CLImage { private CLImage2d(CLContext context, B directBuffer, CLImageFormat format, long id) { super(context, directBuffer, format, id); } static CLImage2d createImage(CLContext context, B directBuffer, int width, int height, int rowPitch, CLImageFormat format, int flags) { CL cl = context.cl; IntBuffer err = BufferFactory.newDirectByteBuffer(4).asIntBuffer(); long id = cl.clCreateImage2D(context.ID, flags, format, width, height, rowPitch, directBuffer, err); checkForError(err.get(), "can not create 2d image"); return new CLImage2d(context, directBuffer, format, id); } @Override public CLImage2d cloneWith(T directBuffer) { return new CLImage2d(context, directBuffer, format, ID); } }