android - set a renderscript global from another script -
android - set a renderscript global from another script -
is there possibility set field in android renderscript out of renderscript b? know can phone call kernel of script, using rsforeach()
, how set globals or bind allocations?
example:
i have (of course of study there multiple) slave script slave.rs
:
// 2 illustration allocations rs_allocation gimg1; rs_allocation gimg2; /** merge 2 images element wise - illustration */ float2 __attribute__((kernel)) root(uint32_t x, uint32_t y) { float2 merged = 0; merged.x = rsgetelementat_float(gimg1, x, y); merged.y = rsgetelementat_float(gimg2, x, y); homecoming merged; }
which phone call master.rs
script:
// globals (which set java) rs_allocation gi0; rs_allocation gi1; rs_allocation gmerged; rs_script mslave; /** * function called java , should delegate of work * kernel function of slave - script */ void myfunction(){ // stuff // bind allocations slave sript rsbind(mslave, "gimg1", gi0); // ??? there exists that? rsbind(mslave, "gimg2", gi1); // ??? // , invoke kernel rsforeach(mslave, 0 , gmerged ); }
of course of study toy example, hoping realize more complex renderscript constructs avoiding many context switches java renderscript.
some info multiple scripts provided in comment question: http://stackoverflow.com/a/18926003/4118132
also overview on renderscript functions provided here: https://stuff.mit.edu/afs/sipb/project/android/docs/guide/topics/renderscript/reference.html
i'm aware that, starting in android 4.4, renderscript - engine can used straight ndk.
no, there's no way straight phone call functions of other scripts or bind allocations 1 script another. however, can utilize scriptgroup
create chain of scripts run output of 1 feeding input of another, or field of another.
android renderscript
Comments
Post a Comment