diff options
| author | Matt Wala <wala@google.com> | 2015-08-03 11:35:55 -0700 |
|---|---|---|
| committer | Matt Wala <wala@google.com> | 2015-08-20 16:34:17 -0700 |
| commit | 394e9a6e1b10229cf0465c50a679dda539c30876 (patch) | |
| tree | 889f78935c61bf1c60a57701cd1be862c84202f9 /cpp/Script.cpp | |
| parent | b995629a3fdd6c8dd8e99aa8ffabc08a2d106272 (diff) | |
Add reduce to the dispatch table and to the RenderScript C++ API.
Bug: 22631253
Change-Id: I06eec227e122075c8a81ed501cd9efcd4e0ef13a
Diffstat (limited to 'cpp/Script.cpp')
| -rw-r--r-- | cpp/Script.cpp | 14 |
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) { } |
