summaryrefslogtreecommitdiff
path: root/cpu_ref/rsCpuScriptGroup2.h
diff options
context:
space:
mode:
authorYang Ni <yangni@google.com>2015-01-07 09:16:40 -0800
committerYang Ni <yangni@google.com>2015-01-07 09:16:40 -0800
commit1ffd86b448d78366190c540f98f8b6d641cdb6cf (patch)
tree65dc9b2f0c6d53ce4858ae990ab82f34cc26fd06 /cpu_ref/rsCpuScriptGroup2.h
parent82f515b5a40d030f88bf622b8c05a03ec80083ee (diff)
downloadrs-1ffd86b448d78366190c540f98f8b6d641cdb6cf.tar.gz
New Script Group API: runtime and cpu driver support.
Change-Id: I9c612cf8874aabaf0ca7d1640567464c71ed3070
Diffstat (limited to 'cpu_ref/rsCpuScriptGroup2.h')
-rw-r--r--cpu_ref/rsCpuScriptGroup2.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/cpu_ref/rsCpuScriptGroup2.h b/cpu_ref/rsCpuScriptGroup2.h
new file mode 100644
index 00000000..6cb72a65
--- /dev/null
+++ b/cpu_ref/rsCpuScriptGroup2.h
@@ -0,0 +1,60 @@
+#ifndef CPU_REF_CPUSCRIPTGROUP2IMPL_H_
+#define CPU_REF_CPUSCRIPTGROUP2IMPL_H_
+
+#include <list>
+
+#include "rsd_cpu.h"
+
+using std::list;
+
+namespace android {
+namespace renderscript {
+
+class Closure;
+class RsdCpuScriptImpl;
+class RsdCpuReferenceImpl;
+class ScriptGroup2;
+
+struct RsExpandKernelParams;
+
+typedef void (*ExpandFuncTy)(const RsExpandKernelParams*, uint32_t, uint32_t,
+ uint32_t);
+
+class CPUClosure {
+ public:
+ CPUClosure(const Closure* closure, RsdCpuScriptImpl* si, ExpandFuncTy func,
+ const void* usrPtr, const size_t usrSize) :
+ mClosure(closure), mSi(si), mFunc(func), mUsrPtr(usrPtr),
+ mUsrSize(usrSize) {}
+
+ // It's important to do forwarding here than inheritance for unbound value
+ // binding to work.
+ const Closure* mClosure;
+ RsdCpuScriptImpl* mSi;
+ const ExpandFuncTy mFunc;
+ const void* mUsrPtr;
+ const size_t mUsrSize;
+};
+
+class CpuScriptGroup2Impl : public RsdCpuReference::CpuScriptGroup2 {
+ public:
+ CpuScriptGroup2Impl(RsdCpuReferenceImpl *cpuRefImpl, const ScriptGroupBase* group);
+ virtual ~CpuScriptGroup2Impl();
+
+ bool init();
+ virtual void execute();
+
+ private:
+ void setGlobalsForBatch(const list<CPUClosure*>& batch);
+ void runBatch(const list<CPUClosure*>& batch);
+
+ RsdCpuReferenceImpl* mCpuRefImpl;
+ const ScriptGroup2* mGroup;
+
+ list<list<CPUClosure*>*> mBatches;
+};
+
+} // namespace renderscript
+} // namespace android
+
+#endif // CPU_REF_CPUSCRIPTGROUP2IMPL_H_