1 /* 2 * Copyright (C) 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_CPU_SCRIPT_INTRINSIC_H 18 #define RSD_CPU_SCRIPT_INTRINSIC_H 19 20 #include "rsCpuScript.h" 21 22 23 namespace android { 24 namespace renderscript { 25 26 27 class RsdCpuScriptIntrinsic : public RsdCpuScriptImpl { 28 public: 29 void populateScript(Script *) override = 0; 30 31 void invokeFunction(uint32_t slot, const void * params, size_t paramLength) override; 32 int invokeRoot() override; 33 34 void invokeForEach(uint32_t slot, 35 const Allocation ** ain, 36 uint32_t inLen, 37 Allocation * aout, 38 const void * usr, 39 uint32_t usrLen, 40 const RsScriptCall *sc) override; 41 42 void forEachKernelSetup(uint32_t slot, MTLaunchStructForEach * mtls) override; 43 void invokeInit() override; 44 void invokeFreeChildren() override; 45 46 void preLaunch(uint32_t slot, const Allocation ** ains, 47 uint32_t inLen, Allocation * aout, const void * usr, 48 uint32_t usrLen, const RsScriptCall * sc) override; 49 void postLaunch(uint32_t slot, const Allocation ** ains, 50 uint32_t inLen, Allocation * aout, 51 const void * usr, uint32_t usrLen, 52 const RsScriptCall * sc) override; 53 54 void setGlobalVar(uint32_t slot, const void * data, size_t dataLength) override; 55 void setGlobalVarWithElemDims(uint32_t slot, const void * data, 56 size_t dataLength, const Element * e, 57 const uint32_t * dims, 58 size_t dimLength) override; 59 void setGlobalBind(uint32_t slot, Allocation *data) override; 60 void setGlobalObj(uint32_t slot, ObjectBase *data) override; 61 62 ~RsdCpuScriptIntrinsic() override; 63 RsdCpuScriptIntrinsic(RsdCpuReferenceImpl * ctx, const Script * s, 64 const Element * e, RsScriptIntrinsicID iid); 65 66 protected: 67 RsScriptIntrinsicID mID; 68 ForEachFunc_t mRootPtr; 69 ObjectBaseRef<const Element> mElement; 70 71 }; 72 73 74 75 } 76 } 77 78 #endif 79