exoide's picture

CLOO - Doubt using ComputeCommandQueue.Read()

Hi there,

This is the first time I use CLOO, I've the version 0.7.0.

In the examples I've seen the Read() method returns the result and requires only 5 parameters. But in the current version it returns nothing and uses 6 parameters, here's my sentence:

float[] result = new float[1];
queue.Read(bufferResult, false, 0, 1, result, null);

But I get the following error " cannot convert from 'float[]' to 'System.IntPtr' " in the fifth parameter.

Can someone help me fix this?

Thank you.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nythrix's picture

The following comes from the "VectorAdd" example (in Clootils):

result = new float[ 1 ];
GCHandle resultHandle = GCHandle.Alloc( result, GCHandleType.Pinned );
commands.Read(bufferResult, false, 0, count, resultHandle.AddrOfPinnedObject(), null );
// when done with the queue

This method has replaced the one you mention because the predecessor wasn't working under all circumstances.