Package com.jme3.opencl.lwjgl
Class LwjglImage
java.lang.Object
com.jme3.opencl.AbstractOpenCLObject
com.jme3.opencl.Image
com.jme3.opencl.lwjgl.LwjglImage
- All Implemented Interfaces:
OpenCLObject
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jme3.opencl.Image
Image.ImageChannelOrder, Image.ImageChannelType, Image.ImageDescriptor, Image.ImageFormat, Image.ImageMapping, Image.ImageTypeNested classes/interfaces inherited from interface com.jme3.opencl.OpenCLObject
OpenCLObject.ObjectReleaser -
Field Summary
Fields inherited from class com.jme3.opencl.AbstractOpenCLObject
releaser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAcquires this image object for using.voidAcquires this image object for using.voidcopyTo(CommandQueue queue, Image dest, long[] srcOrigin, long[] destOrigin, long[] region) Performs a blocking copy operation from one image to another.copyToAsync(CommandQueue queue, Image dest, long[] srcOrigin, long[] destOrigin, long[] region) Performs an async/non-blocking copy operation from one image to another.copyToBufferAsync(CommandQueue queue, Buffer dest, long[] srcOrigin, long[] srcRegion, long destOffset) Copies this image into the specified buffer, no format conversion is done.static intstatic intstatic intstatic Image.ImageChannelOrderencodeImageChannelOrder(int order) static Image.ImageChannelTypeencodeImageChannelType(int type) static Image.ImageTypeencodeImageType(int type) fillAsync(CommandQueue queue, long[] origin, long[] region, int[] color) Fills the image with the specified color given as four integer variables.fillAsync(CommandQueue queue, long[] origin, long[] region, ColorRGBA color) Fills the image with the specified color.longlonggetDepth()intlongorg.lwjgl.opencl.CLMemgetImage()longlonglonggetWidth()map(CommandQueue queue, long[] origin, long[] region, MappingAccess access) Maps the image into host memory.mapAsync(CommandQueue queue, long[] origin, long[] region, MappingAccess access) Non-blocking version ofImage.map(com.jme3.opencl.CommandQueue, long[], long[], com.jme3.opencl.MappingAccess).voidreadImage(CommandQueue queue, ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch) Performs a blocking read of the image into the specified byte buffer.readImageAsync(CommandQueue queue, ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch) Performs an async/non-blocking read of the image into the specified byte buffer.Releases a shared image object.voidReleases a shared image object.voidunmap(CommandQueue queue, Image.ImageMapping mapping) Unmaps the mapped memoryvoidwriteImage(CommandQueue queue, ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch) Performs a blocking write from the specified byte buffer into the image.writeImageAsync(CommandQueue queue, ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch) Performs an async/non-blocking write from the specified byte buffer into the image.Methods inherited from class com.jme3.opencl.AbstractOpenCLObject
finalize, getReleaser, release
-
Constructor Details
-
LwjglImage
public LwjglImage(org.lwjgl.opencl.CLMem image)
-
-
Method Details
-
getImage
public org.lwjgl.opencl.CLMem getImage() -
decodeImageChannelOrder
-
encodeImageChannelOrder
-
decodeImageChannelType
-
encodeImageChannelType
-
decodeImageType
-
encodeImageType
-
getWidth
public long getWidth() -
getHeight
public long getHeight() -
getDepth
public long getDepth() -
getRowPitch
public long getRowPitch()- Specified by:
getRowPitchin classImage- Returns:
- the row pitch when the image was created from a host buffer
-
getSlicePitch
public long getSlicePitch()- Specified by:
getSlicePitchin classImage- Returns:
- the slice pitch when the image was created from a host buffer
-
getArraySize
public long getArraySize()- Specified by:
getArraySizein classImage- Returns:
- the number of elements in the image array
- See Also:
-
getImageFormat
- Specified by:
getImageFormatin classImage- Returns:
- the image format
-
getImageType
- Specified by:
getImageTypein classImage- Returns:
- the image type
-
getElementSize
public int getElementSize()- Specified by:
getElementSizein classImage- Returns:
- the number of bytes per pixel
-
readImage
public void readImage(CommandQueue queue, ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch) Description copied from class:ImagePerforms a blocking read of the image into the specified byte buffer.- Specified by:
readImagein classImage- Parameters:
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 asbytesPerElement * widthslicePitch- 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 asrowPitch * height
-
readImageAsync
public Event readImageAsync(CommandQueue queue, ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch) Description copied from class:ImagePerforms an async/non-blocking read of the image into the specified byte buffer.- Specified by:
readImageAsyncin classImage- Parameters:
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 asbytesPerElement * widthslicePitch- 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 asrowPitch * height- Returns:
- the event object indicating the status of the operation
-
writeImage
public void writeImage(CommandQueue queue, ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch) Description copied from class:ImagePerforms a blocking write from the specified byte buffer into the image.- Specified by:
writeImagein classImage- Parameters:
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 asbytesPerElement * widthslicePitch- 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 asrowPitch * height
-
writeImageAsync
public Event writeImageAsync(CommandQueue queue, ByteBuffer dest, long[] origin, long[] region, long rowPitch, long slicePitch) Description copied from class:ImagePerforms an async/non-blocking write from the specified byte buffer into the image.- Specified by:
writeImageAsyncin classImage- Parameters:
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 asbytesPerElement * widthslicePitch- 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 asrowPitch * height- Returns:
- the event object indicating the status of the operation
-
copyTo
public void copyTo(CommandQueue queue, Image dest, long[] srcOrigin, long[] destOrigin, long[] region) Description copied from class:ImagePerforms a blocking copy operation from one image to another. Important: Both images must have the same format!- Specified by:
copyToin classImage- Parameters:
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 format
-
copyToAsync
public Event copyToAsync(CommandQueue queue, Image dest, long[] srcOrigin, long[] destOrigin, long[] region) Description copied from class:ImagePerforms an async/non-blocking copy operation from one image to another. Important: Both images must have the same format!- Specified by:
copyToAsyncin classImage- Parameters:
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 format- Returns:
- the event object indicating the status of the operation
-
map
public Image.ImageMapping map(CommandQueue queue, long[] origin, long[] region, MappingAccess access) Description copied from class:ImageMaps the image into host memory. The returned structure contains the mapped byte buffer and row and slice pitch. The event object is set tonull, it is needed for the async versionImage.mapAsync(com.jme3.opencl.CommandQueue, long[], long[], com.jme3.opencl.MappingAccess).- Specified by:
mapin classImage- Parameters:
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 memory- Returns:
- a structure describing the mapped memory
- See Also:
-
mapAsync
public Image.ImageMapping mapAsync(CommandQueue queue, long[] origin, long[] region, MappingAccess access) Description copied from class:ImageNon-blocking version ofImage.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.- Specified by:
mapAsyncin classImage- Parameters:
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 memory- Returns:
- a structure describing the mapped memory
- See Also:
-
unmap
Description copied from class:ImageUnmaps the mapped memory -
fillAsync
Description copied from class:ImageFills the image with the specified color. Does only work if the image channel isImage.ImageChannelType.FLOATorImage.ImageChannelType.HALF_FLOAT. -
fillAsync
Description copied from class:ImageFills the image with the specified color given as four integer variables. Does not work if the image channel isImage.ImageChannelType.FLOATorImage.ImageChannelType.HALF_FLOAT.- Specified by:
fillAsyncin classImage- Parameters:
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 4- Returns:
- an event object to detect for the completion
-
copyToBufferAsync
public Event copyToBufferAsync(CommandQueue queue, Buffer dest, long[] srcOrigin, long[] srcRegion, long destOffset) Description copied from class:ImageCopies this image into the specified buffer, no format conversion is done. This is the dual function toBuffer.copyToImageAsync(com.jme3.opencl.CommandQueue, com.jme3.opencl.Image, long, long[], long[]).- Specified by:
copyToBufferAsyncin classImage- Parameters:
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 buffer- Returns:
- the event object to detect the completion of the operation
-
acquireImageForSharingAsync
Description copied from class:ImageAcquires this image object for using. Only call this method if this image represents a shared object from OpenGL, created with e.g.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 callingImage.releaseImageForSharingAsync(com.jme3.opencl.CommandQueue)so that OpenGL can use the image/texture/renderbuffer again.- Specified by:
acquireImageForSharingAsyncin classImage- Parameters:
queue- the command queue- Returns:
- the event object
-
acquireImageForSharingNoEvent
Description copied from class:ImageAcquires this image object for using. Only call this method if this image represents a shared object from OpenGL, created with e.g.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 callingImage.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, useImage.acquireImageForSharingAsync(com.jme3.opencl.CommandQueue).- Overrides:
acquireImageForSharingNoEventin classImage- Parameters:
queue- the command queue
-
releaseImageForSharingAsync
Description copied from class:ImageReleases a shared image object. Call this method after the image object was acquired byImage.acquireImageForSharingAsync(com.jme3.opencl.CommandQueue)to hand the control back to OpenGL.- Specified by:
releaseImageForSharingAsyncin classImage- Parameters:
queue- the command queue- Returns:
- the event object
-
releaseImageForSharingNoEvent
Description copied from class:ImageReleases a shared image object. Call this method after the image object was acquired byImage.acquireImageForSharingAsync(com.jme3.opencl.CommandQueue)to hand the control back to OpenGL. The generated event object is directly released, resulting in performance improvements.- Overrides:
releaseImageForSharingNoEventin classImage- Parameters:
queue- the command queue
-