| Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 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 | virtual void populateScript(Script *) = 0; |
| 30 | |
| Chris Wailes | f371213 | 2014-07-16 15:18:30 -0700 | [diff] [blame] | 31 | virtual void invokeFunction(uint32_t slot, const void * params, |
| 32 | size_t paramLength); |
| Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 33 | virtual int invokeRoot(); |
| Chris Wailes | f371213 | 2014-07-16 15:18:30 -0700 | [diff] [blame] | 34 | |
| Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 35 | virtual void invokeForEach(uint32_t slot, |
| Chris Wailes | f371213 | 2014-07-16 15:18:30 -0700 | [diff] [blame] | 36 | const Allocation ** ain, |
| 37 | uint32_t inLen, |
| 38 | Allocation * aout, |
| 39 | const void * usr, |
| 40 | uint32_t usrLen, |
| 41 | const RsScriptCall *sc); |
| Chris Wailes | 4b3c34e | 2014-06-11 12:00:29 -0700 | [diff] [blame] | 42 | |
| Chris Wailes | f371213 | 2014-07-16 15:18:30 -0700 | [diff] [blame] | 43 | virtual void forEachKernelSetup(uint32_t slot, MTLaunchStruct * mtls); |
| Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 44 | virtual void invokeInit(); |
| 45 | virtual void invokeFreeChildren(); |
| 46 | |
| Chris Wailes | f371213 | 2014-07-16 15:18:30 -0700 | [diff] [blame] | 47 | virtual void preLaunch(uint32_t slot, const Allocation ** ains, |
| 48 | uint32_t inLen, Allocation * aout, const void * usr, |
| 49 | uint32_t usrLen, const RsScriptCall * sc); |
| 50 | virtual void postLaunch(uint32_t slot, const Allocation ** ains, |
| 51 | uint32_t inLen, Allocation * aout, |
| 52 | const void * usr, uint32_t usrLen, |
| 53 | const RsScriptCall * sc); |
| Jason Sams | 2282e28 | 2013-06-17 16:52:01 -0700 | [diff] [blame] | 54 | |
| Chris Wailes | f371213 | 2014-07-16 15:18:30 -0700 | [diff] [blame] | 55 | virtual void setGlobalVar(uint32_t slot, const void * data, |
| 56 | size_t dataLength); |
| 57 | virtual void setGlobalVarWithElemDims(uint32_t slot, const void * data, |
| 58 | size_t dataLength, const Element * e, |
| 59 | const uint32_t * dims, |
| 60 | size_t dimLength); |
| Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 61 | virtual void setGlobalBind(uint32_t slot, Allocation *data); |
| 62 | virtual void setGlobalObj(uint32_t slot, ObjectBase *data); |
| 63 | |
| 64 | virtual ~RsdCpuScriptIntrinsic(); |
| Chris Wailes | f371213 | 2014-07-16 15:18:30 -0700 | [diff] [blame] | 65 | RsdCpuScriptIntrinsic(RsdCpuReferenceImpl * ctx, const Script * s, |
| 66 | const Element * e, RsScriptIntrinsicID iid); |
| Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 67 | |
| 68 | protected: |
| 69 | RsScriptIntrinsicID mID; |
| 70 | outer_foreach_t mRootPtr; |
| Jason Sams | c905efd | 2012-11-26 15:20:18 -0800 | [diff] [blame] | 71 | ObjectBaseRef<const Element> mElement; |
| Jason Sams | 709a097 | 2012-11-15 18:18:04 -0800 | [diff] [blame] | 72 | |
| 73 | }; |
| 74 | |
| 75 | |
| 76 | |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | #endif |