diff options
author | Chris Wailes <chriswailes@google.com> | 2014-07-16 15:18:30 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-08-12 17:02:01 -0700 |
commit | 818cfa034e257c7bb48356257f5cb67334e19aa6 (patch) | |
tree | 27ad9d05d771ae01aa678d71593a7c062b2d2105 /rsScript.cpp | |
parent | fb0a274983ae8bfb07aff8c292305389789d6e92 (diff) | |
download | rs-818cfa034e257c7bb48356257f5cb67334e19aa6.tar.gz |
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: I77e4b155cc7ca1581b05bf901c70ae53a9ff0b12
Diffstat (limited to 'rsScript.cpp')
-rw-r--r-- | rsScript.cpp | 31 |
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); |