summaryrefslogtreecommitdiff
path: root/rsScript.cpp
diff options
context:
space:
mode:
authorChris Wailes <chriswailes@google.com>2014-07-16 15:18:30 -0700
committerChris Wailes <chriswailes@google.com>2014-08-15 18:26:36 -0700
commitf37121300217d3b39ab66dd9c8881bcbcad932df (patch)
tree2e06a02e490f318cc03b95b03112860e3d38e9a6 /rsScript.cpp
parentcd8df40f07d88f896bea05ed06a20d1a4d5e9728 (diff)
Collapse code paths for single- and multi-input kernels.
This patch simplifies the RenderScript driver and CPU reference implementation by removing the distinction between sing- and multi-input kernels in many places. The distinction is maintained in some places due to the need to maintain backwards compatibility. This permits the deletion of some functions and struct members that are no longer needed. Several related functions were also cleaned up. Change-Id: Id70a223ea5e3aa2b0b935b2b7f9af933339ae8a4
Diffstat (limited to 'rsScript.cpp')
-rw-r--r--rsScript.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/rsScript.cpp b/rsScript.cpp
index ea1b3ac9..a4fa1966 100644
--- a/rsScript.cpp
+++ b/rsScript.cpp
@@ -187,23 +187,13 @@ void rsi_ScriptSetTimeZone(Context * rsc, RsScript vs, const char * timeZone, si
free(tz);
}
-void rsi_ScriptForEach(Context *rsc, RsScript vs, uint32_t slot,
- RsAllocation vain, RsAllocation vaout,
- const void *params, size_t paramLen,
- const RsScriptCall *sc, size_t scLen) {
- Script *s = static_cast<Script *>(vs);
- s->runForEach(rsc, slot,
- static_cast<const Allocation *>(vain), static_cast<Allocation *>(vaout),
- params, paramLen, sc);
-
-}
-
void rsi_ScriptForEachMulti(Context *rsc, RsScript vs, uint32_t slot,
RsAllocation *vains, size_t inLen,
RsAllocation vaout, const void *params,
size_t paramLen, const RsScriptCall *sc,
size_t scLen) {
- Script *s = static_cast<Script *>(vs);
+
+ Script *s = static_cast<Script *>(vs);
Allocation **ains = (Allocation**)(vains);
s->runForEach(rsc, slot,
@@ -212,6 +202,23 @@ void rsi_ScriptForEachMulti(Context *rsc, RsScript vs, uint32_t slot,
}
+void rsi_ScriptForEach(Context *rsc, RsScript vs, uint32_t slot,
+ RsAllocation vain, RsAllocation vaout,
+ const void *params, size_t paramLen,
+ const RsScriptCall *sc, size_t scLen) {
+
+ if (vain == NULL) {
+ rsi_ScriptForEachMulti(rsc, vs, slot, NULL, 0, vaout, params, paramLen,
+ sc, scLen);
+ } else {
+ RsAllocation ains[1] = {vain};
+
+ rsi_ScriptForEachMulti(rsc, vs, slot, ains,
+ sizeof(ains) / sizeof(RsAllocation), vaout,
+ params, paramLen, sc, scLen);
+ }
+}
+
void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot) {
Script *s = static_cast<Script *>(vs);
s->Invoke(rsc, slot, NULL, 0);