1
votes

I compile renderscript code for Android API16+

I have script function:

void setBuffers(uchar *y, uchar *u, uchar *v){
...
}

With this I want to setup internal pointers (allocations) to the script. But compiler treats all functions with pointer parameters as if they had RS_KERNEL attribute, and makes it a kernel function, with Java code generated as forEach_setBuffers, or complaining that y must be int (true for kernels).

I assume this auto-kernel mode was added as simplification so that we don't have to mark functions in scripts. Nice.

But I need to make the function invokable so that Java code contains invoke_setBuffers instead. How do I make it?

1

1 Answers

0
votes

You can't have an invokable that accepts pointers, so that is why the "shortcut" of this being marked as a kernel is happening. If you do have a function that takes pointers, but doesn't need to be reflected in Java, you can mark it "static" to make sure that it doesn't get treated as as kernel. For taking actual Allocation data from Java, you should make this invokable take "rs_allocation" arguments instead.