Jason Sams | 8eaba4f | 2012-08-14 14:38:05 -0700 | [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 ANDROID_RS_SCRIPT_INTRINSIC_H |
| 18 | #define ANDROID_RS_SCRIPT_INTRINSIC_H |
| 19 | |
| 20 | #include "rsScript.h" |
| 21 | |
| 22 | |
| 23 | // --------------------------------------------------------------------------- |
| 24 | namespace android { |
| 25 | namespace renderscript { |
| 26 | |
| 27 | |
| 28 | class ScriptIntrinsic : public Script { |
| 29 | public: |
| 30 | |
| 31 | ObjectBaseRef<const Element> mElement; |
| 32 | |
Chih-Hung Hsieh | 10ab8bb | 2016-07-01 12:20:20 -0700 | [diff] [blame] | 33 | explicit ScriptIntrinsic(Context *); |
Matt Wala | 14ce007 | 2015-07-30 17:30:25 -0700 | [diff] [blame] | 34 | ~ScriptIntrinsic() override; |
Jason Sams | 8eaba4f | 2012-08-14 14:38:05 -0700 | [diff] [blame] | 35 | |
Stephen Hines | 41d6c76 | 2012-08-21 17:07:38 -0700 | [diff] [blame] | 36 | bool init(Context *rsc, RsScriptIntrinsicID iid, Element *e); |
Jason Sams | 8eaba4f | 2012-08-14 14:38:05 -0700 | [diff] [blame] | 37 | |
| 38 | |
Matt Wala | 14ce007 | 2015-07-30 17:30:25 -0700 | [diff] [blame] | 39 | void serialize(Context *rsc, OStream *stream) const override; |
| 40 | RsA3DClassID getClassId() const override; |
| 41 | bool freeChildren() override; |
Jason Sams | 8eaba4f | 2012-08-14 14:38:05 -0700 | [diff] [blame] | 42 | |
Matt Wala | 14ce007 | 2015-07-30 17:30:25 -0700 | [diff] [blame] | 43 | void runForEach(Context* rsc, |
| 44 | uint32_t slot, |
| 45 | const Allocation ** ains, |
| 46 | size_t inLen, |
| 47 | Allocation* aout, |
| 48 | const void* usr, |
| 49 | size_t usrBytes, |
| 50 | const RsScriptCall* sc = nullptr) override; |
Chris Wailes | 4b3c34e | 2014-06-11 12:00:29 -0700 | [diff] [blame] | 51 | |
David Gross | fc7ab79 | 2016-06-01 14:45:47 -0700 | [diff] [blame] | 52 | void runReduce(Context *rsc, uint32_t slot, |
| 53 | const Allocation ** ains, size_t inLen, |
Matt Wala | 14ce007 | 2015-07-30 17:30:25 -0700 | [diff] [blame] | 54 | Allocation *aout, const RsScriptCall *sc) override; |
| 55 | |
| 56 | void Invoke(Context *rsc, uint32_t slot, const void *data, size_t len) override; |
| 57 | void setupScript(Context *rsc) override; |
| 58 | uint32_t run(Context *) override; |
| 59 | bool isIntrinsic() const override { return true; } |
Jason Sams | 8eaba4f | 2012-08-14 14:38:05 -0700 | [diff] [blame] | 60 | protected: |
| 61 | uint32_t mIntrinsicID; |
Jason Sams | 8eaba4f | 2012-08-14 14:38:05 -0700 | [diff] [blame] | 62 | |
| 63 | }; |
| 64 | |
| 65 | |
Rahul Chaudhry | 7974fc0 | 2017-02-09 12:33:28 -0800 | [diff] [blame] | 66 | } // namespace renderscript |
| 67 | } // namespace android |
Jason Sams | 8eaba4f | 2012-08-14 14:38:05 -0700 | [diff] [blame] | 68 | #endif |