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
diff --git a/rsScriptC.cpp b/rsScriptC.cpp
index e7ff8c7..892807b 100644
--- a/rsScriptC.cpp
+++ b/rsScriptC.cpp
@@ -156,36 +156,6 @@
void ScriptC::runForEach(Context *rsc,
uint32_t slot,
- const Allocation * ain,
- Allocation * aout,
- const void * usr,
- size_t usrBytes,
- const RsScriptCall *sc) {
- // Trace this function call.
- // To avoid overhead, we only build the string, if tracing is actually
- // enabled.
- String8 *AString = NULL;
- const char *String = "";
- if (ATRACE_ENABLED()) {
- AString = new String8("runForEach_");
- AString->append(mHal.info.exportedForeachFuncList[slot].first);
- String = AString->string();
- }
- ATRACE_NAME(String);
- (void)String;
-
- Context::PushState ps(rsc);
-
- setupGLState(rsc);
- setupScript(rsc);
- rsc->mHal.funcs.script.invokeForEach(rsc, this, slot, ain, aout, usr, usrBytes, sc);
-
- if (AString)
- delete AString;
-}
-
-void ScriptC::runForEach(Context *rsc,
- uint32_t slot,
const Allocation ** ains,
size_t inLen,
Allocation * aout,
@@ -210,10 +180,22 @@
setupGLState(rsc);
setupScript(rsc);
- rsc->mHal.funcs.script.invokeForEachMulti(rsc, this, slot, ains, inLen, aout, usr, usrBytes, sc);
+ if (rsc->mHal.funcs.script.invokeForEachMulti != NULL) {
+ rsc->mHal.funcs.script.invokeForEachMulti(rsc, this, slot, ains, inLen,
+ aout, usr, usrBytes, sc);
- if (AString)
+ } else if (inLen == 1) {
+ rsc->mHal.funcs.script.invokeForEach(rsc, this, slot, ains[0], aout,
+ usr, usrBytes, sc);
+
+ } else {
+ rsc->setError(RS_ERROR_FATAL_DRIVER,
+ "Driver support for multi-input not present");
+ }
+
+ if (AString) {
delete AString;
+ }
}
void ScriptC::Invoke(Context *rsc, uint32_t slot, const void *data, size_t len) {