Skip to content Skip to sidebar Skip to footer

Returning A Renderscript Struct From A Renderscript Kernel

I'm looking to return an array of struct from my renderscript kernel. My problem is that although I can create an array of the struct in java using the generated code and pass this

Solution 1:

RenderScript currently doesn't reflect a method to copy back the values from a user-defined struct to Java. We indeed only have methods that operate on primitive Java and vector types. The Allocation is still usable by other kernels or Script-side functions.

Solution 2:

Actually you should use the copy1DRangeToUnchecked method of the Allocation class. You can copy it into your own ByteBuffer and deserialize it yourself.

Post a Comment for "Returning A Renderscript Struct From A Renderscript Kernel"