aboutsummaryrefslogtreecommitdiff
path: root/sq-rs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sq-rs.cpp')
-rw-r--r--sq-rs.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/sq-rs.cpp b/sq-rs.cpp
new file mode 100644
index 0000000..68cd26e
--- /dev/null
+++ b/sq-rs.cpp
@@ -0,0 +1,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;
+}