I am trying to get a simple renderscript function to take two numnbers, add them and return the result, however I have not managed to find an example project to do that smoothly. I keep getting a weird error when I try to load the file:
ScriptC_myexamplescript myScript;
RenderScript rs = RenderScript.create(this);
I get the error:
Symbol not found: .rs.dtor on the next line:
myScript = new ScriptC_myexamplescript(rs, getResources(), R.raw.myexamplescript);
My .rs file is just something simple:
#pragma version(1)
#pragma rs java_package_name(com.exercise.<my pacakge name>);
void init(){
}
void root(const float *v_in, float *v_out) {
const float *data = v_in;
float *outData = v_out;
*outData = *data;
}
Does anyone know what this means, or if there is a simple project I can download for Android ICS and later that does maths, not actual rendering that just works?
(I can get a rendering script file to work, but that isn't what I want. I don't want any graphics in it)
EDIT Today I have tried to make it run, and get the following problem:
Allocation mInAllocation = null;
Allocation mOutAllocation;
float[] A = new float[1];
for (int i = 0; i < 1; i++) {
A[i] = 2;
}
Allocation inFloatPointer = Allocation.createSized(rs, Element.F32(rs), A.length, Allocation.USAGE_SCRIPT);
Allocation outFloatPointer = Allocation.createSized(rs, Element.F32(rs), A.length, Allocation.USAGE_SCRIPT);
inFloatPointer.copyFrom(A); // copies from an array of floats (random numbers in this test case).
mScript.forEach_root(inFloatPointer, outFloatPointer);
I get the error message: the method forEach_root is undedifed for type ScriptC_RenderScript There is no function forEach_root in the .java file and even after I clean the project it still is not there.
Is there a simple project I can download with just a maths function I can download?