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