Adds support for multi-input kernels to Frameworks/RS.
This patch modifies Frameworks/RS in the following ways:
* Adjusted the data-layout of the C/C++ version of RsForEachStubParamStruct to
accommodate a pointer to an array of input allocations and a pointer to an
array of stride sizes for each of these allocatoins.
* Adds a new code path for Java code to pass multiple allocations to a RS
kernel.
* Packs base pointers and step values for multi-input kernels into the new
RsForEachStubParamStruct members.
Change-Id: I46d2834c37075b2a2407fd8b010546818a4540d1
diff --git a/rsScript.cpp b/rsScript.cpp
index 27fe020..5918c59 100644
--- a/rsScript.cpp
+++ b/rsScript.cpp
@@ -198,6 +198,28 @@
}
+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);
+ // The rs.spec generated code does not handle the absence of an actual
+ // input for sc. Instead, it retains an existing pointer value (the prior
+ // field in the packed data object). This can cause confusion because
+ // drivers might now inspect bogus sc data.
+ if (scLen == 0) {
+ sc = NULL;
+ }
+
+ Allocation **ains = (Allocation**)(vains);
+
+ s->runForEach(rsc, slot,
+ const_cast<const Allocation **>(ains), inLen,
+ static_cast<Allocation *>(vaout), params, paramLen, sc);
+
+}
+
void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot) {
Script *s = static_cast<Script *>(vs);
s->Invoke(rsc, slot, NULL, 0);
@@ -260,4 +282,3 @@
}
}
-