1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include "RenderScript.h"
#include "ScriptC_sql1.h"
using namespace android;
using namespace RSC;
int main(int argc, char **argv) {
sp<RS> rs = new RS();
bool status = rs->init();
sp<const Element> dataElement1 = Element::I32_4(rs);
sp<const Element> dataElement2 = Element::I32_4(rs);
Type::Builder tb(ts, dataElement1);
tb.setX(100000/4);
sp<const Type> t = tb.create();
sp<Allocation> data1 = Allocation::createSized(rs, dataElement1, 100000/4);
sp<Allocation> data2 = Allocation::createSized(rs, dataElement2, 100000/4);
sp<Allocation> data1in = Allocation::createTyped(rs, t);
sp<Allocation> data2in = Allocation::createTyped(rs, t);
/* this seems sub-optimal ?? */
ScriptC_sql1 *sc = new ScriptC_sql1(rs);
/* make up some data */
int *buf = new int[t->getCount()];
for (int ct=0; ct < t->getCount(); ct++) {
buf[ct] = 90;
}
/* copy from column */
data1in->copy1DRangeFrom(0, t->getCount(), buf);
for (int ct=0; ct < t->getCount(); ct++) {
buf[ct] = -7;
}
data2in->copy1DRangeFrom(0, t->getCount(), buf);
sc->forEach_x2_root(data1in, data2in, maskOut);
rs->finish();
delete sc;
return 0;
}
|