|
Hi,
I am trying to create a CLBuffer from an existing DirectBuffer. Running that code:
CLBuffer<FloatBuffer> someDataCL =
context.createBuffer(someObject.getExistingDirectFloatBuffer(), READ_ONLY);
(the buffer is being rewinded before doing this)
All the values as read by my OpenCL device become something like 10E-40 (exactly the same value for all elements).
When running this code:
CLBuffer<FloatBuffer> someDataCL =
context.createFloatBuffer(someObject.getExistingDirectFloatBuffer().capacity(), READ_ONLY);
someDataCL.getBuffer().put(someObject.getExistingDirectFloatBuffer());
someDataCL.getBuffer().rewind();
everything works just fine.
I don't understand what's going on.... am I missing something?
btw. the existing DirectFloatBuffer is allocated like this:
FloatBuffer buffer = ByteBuffer.allocateDirect(4*numElements).asFloatBuffer();
Thanks,
barno
|