public class JoclImage extends Image
Image.ImageChannelOrder, Image.ImageChannelType, Image.ImageDescriptor, Image.ImageFormat, Image.ImageMapping, Image.ImageType
OpenCLObject.ObjectReleaser
releaser
Constructor and Description |
---|
JoclImage(long image) |
Modifier and Type | Method and Description |
---|---|
Event |
acquireImageForSharingAsync(CommandQueue queue)
Aquires this image object for using.
|
void |
acquireImageForSharingNoEvent(CommandQueue queue)
Aquires this image object for using.
|
void |
copyTo(CommandQueue queue,
Image dest,
long[] srcOrigin,
long[] destOrigin,
long[] region)
Performs a blocking copy operation from one image to another.
|
Event |
copyToAsync(CommandQueue queue,
Image dest,
long[] srcOrigin,
long[] destOrigin,
long[] region)
Performs an async/non-blocking copy operation from one image to another.
|
Event |
copyToBufferAsync(CommandQueue queue,
Buffer dest,
long[] srcOrigin,
long[] srcRegion,
long destOffset)
Copies this image into the specified buffer, no format conversion is done.
|
static int |
decodeImageChannelOrder(Image.ImageChannelOrder order) |
static int |
decodeImageChannelType(Image.ImageChannelType type) |
static int |
decodeImageType(Image.ImageType type) |
static Image.ImageChannelOrder |
encodeImageChannelOrder(int order) |
static Image.ImageChannelType |
encodeImageChannelType(int type) |
static Image.ImageType |
encodeImageType(int type) |
Event |
fillAsync(CommandQueue queue,
long[] origin,
long[] region,
ColorRGBA color)
Fills the image with the specified color.
|
Event |
fillAsync(CommandQueue queue,
long[] origin,
long[] region,
int[] color)
Fills the image with the specified color given as four integer variables.
|
long |
getArraySize() |
long |
getDepth() |
int |
getElementSize() |
long |
getHeight() |
Image.ImageFormat |
getImageFormat() |
Image.ImageType |
getImageType() |
long |
getRowPitch() |
long |
getSlicePitch() |
long |
getWidth() |
Image.ImageMapping |
map(CommandQueue queue,
long[] origin,
long[] region,
MappingAccess access)
Maps the image into host memory.
|
Image.ImageMapping |
mapAsync(CommandQueue queue,
long[] origin,
long[] region,
MappingAccess access)
Non-blocking version of
Image.map(com.jme3.opencl.CommandQueue, long[], long[], com.jme3.opencl.MappingAccess) . |
void |
readImage(CommandQueue queue,
java.nio.ByteBuffer dest,
long[] origin,
long[] region,
long rowPitch,
long slicePitch)
Performs a blocking read of the image into the specified byte buffer.
|
Event |
readImageAsync(CommandQueue queue,
java.nio.ByteBuffer dest,
long[] origin,
long[] region,
long rowPitch,
long slicePitch)
Performs an async/non-blocking read of the image into the specified byte buffer.
|
Event |
releaseImageForSharingAsync(CommandQueue queue)
Releases a shared image object.
|
void |
releaseImageForSharingNoEvent(CommandQueue queue)
Releases a shared image object.
|
void |
unmap(CommandQueue queue,
Image.ImageMapping mapping)
Unmaps the mapped memory
|
void |
writeImage(CommandQueue queue,
java.nio.ByteBuffer dest,
long[] origin,
long[] region,
long rowPitch,
long slicePitch)
Performs a blocking write from the specified byte buffer into the image.
|
Event |
writeImageAsync(CommandQueue queue,
java.nio.ByteBuffer dest,
long[] origin,
long[] region,
long rowPitch,
long slicePitch)
Performs an async/non-blocking write from the specified byte buffer into the image.
|
finalize, getReleaser, release
public static int decodeImageChannelOrder(Image.ImageChannelOrder order)
public static Image.ImageChannelOrder encodeImageChannelOrder(int order)
public static int decodeImageChannelType(Image.ImageChannelType type)
public static Image.ImageChannelType encodeImageChannelType(int type)
public static int decodeImageType(Image.ImageType type)
public static Image.ImageType encodeImageType(int type)
public long getWidth()
public long getHeight()
public long getDepth()
public long getRowPitch()
getRowPitch
in class Image
public long getSlicePitch()
getSlicePitch
in class Image
public long getArraySize()
getArraySize
in class Image
Image.ImageType.IMAGE_1D_ARRAY
,
Image.ImageType.IMAGE_2D_ARRAY
public Image.ImageFormat getImageFormat()
getImageFormat
in class Image
public Image.ImageType getImageType()
getImageType
in class Image
public int getElementSize()
getElementSize
in class Image
public void readImage(CommandQueue queue, java.nio.ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch)
Image
readImage
in class Image
queue
- the command queuedest
- the target byte bufferorigin
- the image origin location, see class description for the formatregion
- the copied region, see class description for the formatrowPitch
- the row pitch of the target buffer, must be set to 0 if the image is 1D.
If set to 0 for 2D and 3D image, the row pitch is calculated as bytesPerElement * width
slicePitch
- the slice pitch of the target buffer, must be set to 0 for 1D and 2D images.
If set to 0 for 3D images, the slice pitch is calculated as rowPitch * height
public Event readImageAsync(CommandQueue queue, java.nio.ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch)
Image
readImageAsync
in class Image
queue
- the command queuedest
- the target byte bufferorigin
- the image origin location, see class description for the formatregion
- the copied region, see class description for the formatrowPitch
- the row pitch of the target buffer, must be set to 0 if the image is 1D.
If set to 0 for 2D and 3D image, the row pitch is calculated as bytesPerElement * width
slicePitch
- the slice pitch of the target buffer, must be set to 0 for 1D and 2D images.
If set to 0 for 3D images, the slice pitch is calculated as rowPitch * height
public void writeImage(CommandQueue queue, java.nio.ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch)
Image
writeImage
in class Image
queue
- the command queuedest
- the source bufferorigin
- the image origin location, see class description for the formatregion
- the copied region, see class description for the formatrowPitch
- the row pitch of the target buffer, must be set to 0 if the image is 1D.
If set to 0 for 2D and 3D image, the row pitch is calculated as bytesPerElement * width
slicePitch
- the slice pitch of the target buffer, must be set to 0 for 1D and 2D images.
If set to 0 for 3D images, the slice pitch is calculated as rowPitch * height
public Event writeImageAsync(CommandQueue queue, java.nio.ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch)
Image
writeImageAsync
in class Image
queue
- the command queuedest
- the source bufferorigin
- the image origin location, see class description for the formatregion
- the copied region, see class description for the formatrowPitch
- the row pitch of the target buffer, must be set to 0 if the image is 1D.
If set to 0 for 2D and 3D image, the row pitch is calculated as bytesPerElement * width
slicePitch
- the slice pitch of the target buffer, must be set to 0 for 1D and 2D images.
If set to 0 for 3D images, the slice pitch is calculated as rowPitch * height
public void copyTo(CommandQueue queue, Image dest, long[] srcOrigin, long[] destOrigin, long[] region)
Image
copyTo
in class Image
queue
- the command queuedest
- the target imagesrcOrigin
- the source image origin, see class description for the formatdestOrigin
- the target image origin, see class description for the formatregion
- the copied region, see class description for the formatpublic Event copyToAsync(CommandQueue queue, Image dest, long[] srcOrigin, long[] destOrigin, long[] region)
Image
copyToAsync
in class Image
queue
- the command queuedest
- the target imagesrcOrigin
- the source image origin, see class description for the formatdestOrigin
- the target image origin, see class description for the formatregion
- the copied region, see class description for the formatpublic Image.ImageMapping map(CommandQueue queue, long[] origin, long[] region, MappingAccess access)
Image
null
, it is needed for the asnyc
version Image.mapAsync(com.jme3.opencl.CommandQueue, long[], long[], com.jme3.opencl.MappingAccess)
.map
in class Image
queue
- the command queueorigin
- the image origin, see class description for the formatregion
- the mapped region, see class description for the formataccess
- the allowed memory access to the mapped memoryImage.unmap(com.jme3.opencl.CommandQueue, com.jme3.opencl.Image.ImageMapping)
public Image.ImageMapping mapAsync(CommandQueue queue, long[] origin, long[] region, MappingAccess access)
Image
Image.map(com.jme3.opencl.CommandQueue, long[], long[], com.jme3.opencl.MappingAccess)
.
The returned structure contains the mapped byte buffer and row and slice pitch.
The event object is used to detect when the mapped memory is available.mapAsync
in class Image
queue
- the command queueorigin
- the image origin, see class description for the formatregion
- the mapped region, see class description for the formataccess
- the allowed memory access to the mapped memoryImage.unmap(com.jme3.opencl.CommandQueue, com.jme3.opencl.Image.ImageMapping)
public void unmap(CommandQueue queue, Image.ImageMapping mapping)
Image
public Event fillAsync(CommandQueue queue, long[] origin, long[] region, ColorRGBA color)
Image
Image.ImageChannelType.FLOAT
or Image.ImageChannelType.HALF_FLOAT
.public Event fillAsync(CommandQueue queue, long[] origin, long[] region, int[] color)
Image
Image.ImageChannelType.FLOAT
or Image.ImageChannelType.HALF_FLOAT
.fillAsync
in class Image
queue
- the command queueorigin
- the image origin, see class description for the formatregion
- the size of the region, see class description for the formatcolor
- the color to fill, must be an array of length 4public Event copyToBufferAsync(CommandQueue queue, Buffer dest, long[] srcOrigin, long[] srcRegion, long destOffset)
Image
Buffer.copyToImageAsync(com.jme3.opencl.CommandQueue, com.jme3.opencl.Image, long, long[], long[])
.copyToBufferAsync
in class Image
queue
- the command queuedest
- the target buffersrcOrigin
- the image origin, see class description for the formatsrcRegion
- the copied region, see class description for the formatdestOffset
- an offset into the target bufferpublic Event acquireImageForSharingAsync(CommandQueue queue)
Image
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
Image.releaseImageForSharingAsync(com.jme3.opencl.CommandQueue)
so that OpenGL can use the image/texture/renderbuffer again.acquireImageForSharingAsync
in class Image
queue
- the command queuepublic void acquireImageForSharingNoEvent(CommandQueue queue)
Image
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
Image.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
Image.acquireImageForSharingAsync(com.jme3.opencl.CommandQueue)
.acquireImageForSharingNoEvent
in class Image
queue
- the command queuepublic Event releaseImageForSharingAsync(CommandQueue queue)
Image
Image.acquireImageForSharingAsync(com.jme3.opencl.CommandQueue)
to hand the control back to OpenGL.releaseImageForSharingAsync
in class Image
queue
- the command queuepublic void releaseImageForSharingNoEvent(CommandQueue queue)
Image
Image.acquireImageForSharingAsync(com.jme3.opencl.CommandQueue)
to hand the control back to OpenGL.
The generated event object is directly released, resulting in
performance improvements.releaseImageForSharingNoEvent
in class Image
queue
- the command queue