/** * Releases a shared buffer object. * Call this method after the buffer object was acquired by * {@link #acquireBufferForSharingAsync(com.jme3.opencl.CommandQueue) } * to hand the control back to OpenGL. * The generated event object is directly released, resulting in * performance improvements. * @param queue the command queue */ public void releaseBufferForSharingNoEvent(CommandQueue queue) { //default implementation, overwrite for better performance releaseBufferForSharingAsync(queue).release(); }
Event e1 = image.fillAsync(clQueue, new long[]{0,0,0}, new long[]{descr.width/2, descr.height, 1}, color1); Event e2 = image.fillAsync(clQueue, new long[]{descr.width/2,0,0}, new long[]{descr.width/2, descr.height, 1}, color2); e1.waitForFinished(); e2.waitForFinished(); e3.release();
h1.position(5); Event event = b1.readAsync(clQueue, h1, high-low, low); event.waitForFinished(); h1.position(5); for (int i=0; i<high-low; ++i) {
float value = 5; Event event = kernel.Run1(clQueue, new com.jme3.opencl.Kernel.WorkSize(buffer.getSize() / 4), buffer, value); event.waitForFinished();
/** * Releases a shared image object. * Call this method after the image object was acquired by * {@link #acquireImageForSharingAsync(com.jme3.opencl.CommandQueue) } * to hand the control back to OpenGL. * The generated event object is directly released, resulting in * performance improvements. * @param queue the command queue */ public void releaseImageForSharingNoEvent(CommandQueue queue) { //default implementation, overwrite it for performance improvements releaseImageForSharingAsync(queue).release(); }
/** * Launches the kernel with the current global work size, work group size * and arguments without returning an event object. * The generated event is directly released. Therefore, the performance * is better, but there is no way to detect when the kernel execution * has finished. For this purpose, use {@link #Run(com.jme3.opencl.CommandQueue) }. * @param queue the command queue * @see #setGlobalWorkSize(com.jme3.opencl.Kernel.WorkSize) * @see #setWorkGroupSize(com.jme3.opencl.Kernel.WorkSize) * @see #setArg(int, java.lang.Object) */ public void RunNoEvent(CommandQueue queue) { //Default implementation, overwrite to not allocate the event object Run(queue).release(); }
/** * Aquires this image object for using. Only call this method if this image * represents a shared object from OpenGL, created with e.g. * {@link Context#bindImage(com.jme3.texture.Image, com.jme3.texture.Texture.Type, int, com.jme3.opencl.MemoryAccess) } * or variations. * This method must be called before the image is used. After the work is * done, the image must be released by calling * {@link #releaseImageForSharingAsync(com.jme3.opencl.CommandQueue) } * so that OpenGL can use the image/texture/renderbuffer again. * * The generated event object is directly released. * This brings a performance improvement when the resource is e.g. directly * used by a kernel afterwards on the same queue (this implicitly waits for * this action). If you need the event, use * {@link #acquireImageForSharingAsync(com.jme3.opencl.CommandQueue) }. * * @param queue the command queue */ public void acquireImageForSharingNoEvent(CommandQueue queue) { //Default implementation, overwrite for performance acquireImageForSharingAsync(queue).release(); }
/** * Aquires this buffer object for using. Only call this method if this buffer * represents a shared object from OpenGL, created with e.g. * {@link Context#bindVertexBuffer(com.jme3.scene.VertexBuffer, com.jme3.opencl.MemoryAccess) }. * This method must be called before the buffer is used. After the work is * done, the buffer must be released by calling * {@link #releaseBufferForSharingAsync(com.jme3.opencl.CommandQueue) } * so that OpenGL can use the VertexBuffer again. * * The generated event object is directly released. * This brings a performance improvement when the resource is e.g. directly * used by a kernel afterwards on the same queue (this implicitly waits for * this action). If you need the event, use * {@link #acquireBufferForSharingAsync(com.jme3.opencl.CommandQueue) } instead. * * @param queue the command queue */ public void acquireBufferForSharingNoEvent(CommandQueue queue) { //default implementation, overwrite for better performance acquireBufferForSharingAsync(queue).release(); }
/** * Releases a shared buffer object. * Call this method after the buffer object was acquired by * {@link #acquireBufferForSharingAsync(com.jme3.opencl.CommandQueue) } * to hand the control back to OpenGL. * The generated event object is directly released, resulting in * performance improvements. * @param queue the command queue */ public void releaseBufferForSharingNoEvent(CommandQueue queue) { //default implementation, overwrite for better performance releaseBufferForSharingAsync(queue).release(); }
/** * Releases a shared image object. * Call this method after the image object was acquired by * {@link #acquireImageForSharingAsync(com.jme3.opencl.CommandQueue) } * to hand the control back to OpenGL. * The generated event object is directly released, resulting in * performance improvements. * @param queue the command queue */ public void releaseImageForSharingNoEvent(CommandQueue queue) { //default implementation, overwrite it for performance improvements releaseImageForSharingAsync(queue).release(); }
/** * Launches the kernel with the current global work size, work group size * and arguments without returning an event object. * The generated event is directly released. Therefore, the performance * is better, but there is no way to detect when the kernel execution * has finished. For this purpose, use {@link #Run(com.jme3.opencl.CommandQueue) }. * @param queue the command queue * @see #setGlobalWorkSize(com.jme3.opencl.Kernel.WorkSize) * @see #setWorkGroupSize(com.jme3.opencl.Kernel.WorkSize) * @see #setArg(int, java.lang.Object) */ public void RunNoEvent(CommandQueue queue) { //Default implementation, overwrite to not allocate the event object Run(queue).release(); }
/** * Aquires this buffer object for using. Only call this method if this buffer * represents a shared object from OpenGL, created with e.g. * {@link Context#bindVertexBuffer(com.jme3.scene.VertexBuffer, com.jme3.opencl.MemoryAccess) }. * This method must be called before the buffer is used. After the work is * done, the buffer must be released by calling * {@link #releaseBufferForSharingAsync(com.jme3.opencl.CommandQueue) } * so that OpenGL can use the VertexBuffer again. * * The generated event object is directly released. * This brings a performance improvement when the resource is e.g. directly * used by a kernel afterwards on the same queue (this implicitly waits for * this action). If you need the event, use * {@link #acquireBufferForSharingAsync(com.jme3.opencl.CommandQueue) } instead. * * @param queue the command queue */ public void acquireBufferForSharingNoEvent(CommandQueue queue) { //default implementation, overwrite for better performance acquireBufferForSharingAsync(queue).release(); }
/** * Aquires this image object for using. Only call this method if this image * represents a shared object from OpenGL, created with e.g. * {@link Context#bindImage(com.jme3.texture.Image, com.jme3.texture.Texture.Type, int, com.jme3.opencl.MemoryAccess) } * or variations. * This method must be called before the image is used. After the work is * done, the image must be released by calling * {@link #releaseImageForSharingAsync(com.jme3.opencl.CommandQueue) } * so that OpenGL can use the image/texture/renderbuffer again. * * The generated event object is directly released. * This brings a performance improvement when the resource is e.g. directly * used by a kernel afterwards on the same queue (this implicitly waits for * this action). If you need the event, use * {@link #acquireImageForSharingAsync(com.jme3.opencl.CommandQueue) }. * * @param queue the command queue */ public void acquireImageForSharingNoEvent(CommandQueue queue) { //Default implementation, overwrite for performance acquireImageForSharingAsync(queue).release(); }