1 /*
2  * Copyright (C) 2011-2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef RSD_SCRIPT_GROUP_H
18 #define RSD_SCRIPT_GROUP_H
19 
20 #include "rsd_cpu.h"
21 
22 namespace android {
23 namespace renderscript {
24 
25 
26 class CpuScriptGroupImpl : public RsdCpuReference::CpuScriptGroup {
27 public:
28     void setInput(const ScriptKernelID *kid, Allocation *) override;
29     void setOutput(const ScriptKernelID *kid, Allocation *) override;
30     void execute() override;
31     ~CpuScriptGroupImpl() override;
32 
33     CpuScriptGroupImpl(RsdCpuReferenceImpl *ctx, const ScriptGroupBase *sg);
34     bool init();
35 
36     static void scriptGroupRoot(const RsExpandKernelDriverInfo *info,
37                                 uint32_t xstart, uint32_t xend,
38                                 uint32_t outstep);
39 
40 protected:
41     struct ScriptList {
42         size_t count;
43         Allocation *const* ins;
44         uint8_t const* inExts;
45         Allocation *const* outs;
46         uint8_t const* outExts;
47         const void *const* usrPtrs;
48         size_t const *usrSizes;
49         uint32_t const *sigs;
50         const void *const* fnPtrs;
51 
52         const ScriptKernelID *const* kernels;
53     };
54     ScriptList mSl;
55     const ScriptGroup *mSG;
56     RsdCpuReferenceImpl *mCtx;
57 };
58 
59 } // namespace renderscript
60 } // namespace android
61 
62 #endif // RSD_SCRIPT_GROUP_H
63