summaryrefslogtreecommitdiff
path: root/cpp/Script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/Script.cpp')
-rw-r--r--cpp/Script.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/cpp/Script.cpp b/cpp/Script.cpp
index 889bb02c..acea0c8a 100644
--- a/cpp/Script.cpp
+++ b/cpp/Script.cpp
@@ -36,6 +36,20 @@ void Script::forEach(uint32_t slot, sp<const Allocation> ain, sp<const Allocatio
tryDispatch(mRS, RS::dispatch->ScriptForEach(mRS->getContext(), getID(), slot, in_id, out_id, usr, usrLen, nullptr, 0));
}
+void Script::reduce(uint32_t slot, sp<const Allocation> ain, sp<const Allocation> aout,
+ const RsScriptCall *sc) const {
+ if (RS::dispatch->ScriptReduce == nullptr) {
+ mRS->throwError(RS_ERROR_RUNTIME_ERROR, "Reduce is not supported at the current API level");
+ return;
+ }
+ if (ain == nullptr || aout == nullptr) {
+ mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Both ain and aout are required to be non-null.");
+ return;
+ }
+ void *in_id = BaseObj::getObjID(ain);
+ void *out_id = BaseObj::getObjID(aout);
+ tryDispatch(mRS, RS::dispatch->ScriptReduce(mRS->getContext(), getID(), slot, in_id, out_id, sc, sc == nullptr ? 0 : sizeof(*sc)));
+}
Script::Script(void *id, sp<RS> rs) : BaseObj(id, rs) {
}