I was trying to copy all cells of an Allocation to other Allocation in renderscript. From android developer api reference i got this method rsAllocationCopy1DRange whose signature is
void rsAllocationCopy1DRange(rs_allocation dstAlloc, uint32_t dstOff, uint32_t dstMip, uint32_t count, rs_allocation srcAlloc, uint32_t srcOff, uint32_t srcMip);
.
The google reference link for method is https://developer.android.com/guide/topics/renderscript/reference/rs_allocation_data.html
But when i run the script it shows Call to Unsupported method rsAllocationCopy1DRange in android.support.v8.renderscript error
my rs script is below
#pragma version(1)
#pragma rs java_package_name(com.ravikant.rs)
#pragma rs_fp_relaxed
int width;
int height;
rs_allocation stateArr;
rs_allocation stateNextArr;
void __attribute__((kernel)) _copy(int32_t in)
{
int len=width*height;
rsAllocationCopy1DRange(stateArr,0,0,len,stateNextArr,0,0);
}
and java code is
float[] sideArr=new float[width*height};
Arrays.fill(sideArr,1);
Allocation stateArrAlloc = Allocation.createSized(rs, Element.F32(rs), sideArr.length);
Allocation stateNextArrAlloc = Allocation.createSized(rs, Element.F32(rs), sideArr.length);
stateArrAlloc.copyFrom(sideArr);
stateNextArrAlloc.copyFrom(sideArr);
scriptC_copycells.set_width(width);
scriptC_copycells.set_height(height);
scriptC_copycells.set_stateArr(stateArrAlloc);
scriptC_copycells.set_stateNextArr(stateNextArrAlloc);
scriptC_copycells.forEach__copy(stateArrAlloc);
Logcat output for error is
E/AndroidRuntime: FATAL EXCEPTION: RSMessageThread
Process: com.ravikant.rs, PID: 2321
android.support.v8.renderscript.RSRuntimeException: Fatal error 4097,
details: Error: Call to unsupported function rsAllocationCopy1DRange in kernel at android.support.v8.renderscript.RenderScript$MessageThread.run(RenderScript.java:1313)