In Java I have this code for creating the Allocation for the intPointer. But after the renderscript computation I can't get the value of the allocation back. There is no copyTo(int) method only byte[], short[], int[], float[], bitmap.
//Create Allocation
Allocation intPointer = Allocation.createSized(renderScript, Element.I32(renderScript), 2);
convolution.bind_intPointer(intPointer);
convolution.forEach_root(allocationOut);
[...]
//read Allocation, not working
int[] ints = new int[]{0x01234567};
intPointer.copyTo(ints); //does not overwrite the ints the line above
int i = (int)ints[0];
Log.d("ints", String.valueOf(i));
renderscript:
#pragma version(1)
#pragma rs java_package_name(package com.ap.wificam)
#pragma rs_fp_imprecise
rs_allocation input;
rs_allocation mask;
int32_t *intPointer = 0;
void root(uchar4* out, uint32_t x, uint32_t y) {
//do some stuff
if((sum.x + sum.y + sum.z)/3 > *intPointer)
*intPointer = (sum.x + sum.y + sum.z)/3; //wirte data to intPointer
*out = convert_uchar4(sum);
}
Log.d("ints", String.valueOf(i)); gives me D/intsīš 19088743
and rsDebug("rs", *intPointer); 2045 0x7fd
How can I get my int value from the Allocation?