asynchronous copy CLImage2D

12 views
Skip to first unread message

Marcos Paulo Rocha

unread,
Mar 23, 2017, 12:51:28 PM3/23/17
to NativeLibs4Java, Alexandre Nery
Hi, is possible to make an asynchronous copy of CLImage2D in JavaCL ? Someone have an example of that?
Looking at documentation I found a createImage2D in context class with a boolean parameter copy 
that returns a CLImage2D and a method write in CLImage that have a boolean parameter blocking.
I try to use this two methods  to make an asynchronous copy in the following code:

CLImageFormat format = new CLImageFormat(CLImageFormat.ChannelOrder.BGRA
                        , CLImageFormat.ChannelDataType.UNormInt8);

CLImage2D inputImage = context.createImage2D(CLMem.Usage.Input, format,
                        width, height, 0, pixels.getBuffer(), false);

CLImageFormat imageFormat =new CLImageFormat(CLImageFormat.ChannelOrder.BGRA,
                        CLImageFormat.ChannelDataType.UNormInt8);
                
inputImage.write(queue, image, false);

but i get this error:
Exception in thread "Thread-2" java.lang.IllegalArgumentException: Raster has 3 data elements, should have only 1 !
    at com.nativelibs4java.opencl.ImageIOUtils.checkSinglePixelPackedSampleModel(ImageIOUtils.java:164)
    at com.nativelibs4java.opencl.ImageIOUtils$9.getData(ImageIOUtils.java:407)
    at com.nativelibs4java.opencl.ImageIOUtils$9.getData(ImageIOUtils.java:403)
    at com.nativelibs4java.opencl.CLImage2D.write(CLImage2D.java:215)

thanks
Reply all
Reply to author
Forward
0 new messages