blob: cfbc8aa43538fe7c4094dec43dc2320fd016577f [file] [log] [blame]
Jason Sams8eaba4f2012-08-14 14:38:05 -07001/*
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// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
27
28class ScriptIntrinsic : public Script {
29public:
30
31 ObjectBaseRef<const Element> mElement;
32
33 ScriptIntrinsic(Context *);
34 virtual ~ScriptIntrinsic();
35
Stephen Hines41d6c762012-08-21 17:07:38 -070036 bool init(Context *rsc, RsScriptIntrinsicID iid, Element *e);
Jason Sams8eaba4f2012-08-14 14:38:05 -070037
38
39 virtual void serialize(Context *rsc, OStream *stream) const;
40 virtual RsA3DClassID getClassId() const;
41 virtual bool freeChildren();
42
Chris Wailes4b3c34e2014-06-11 12:00:29 -070043 virtual void runForEach(Context* rsc,
44 uint32_t slot,
Chris Wailesf3712132014-07-16 15:18:30 -070045 const Allocation ** ains,
Chris Wailes4b3c34e2014-06-11 12:00:29 -070046 size_t inLen,
47 Allocation* aout,
48 const void* usr,
49 size_t usrBytes,
Chris Wailes44bef6f2014-08-12 13:51:10 -070050 const RsScriptCall* sc = nullptr);
Chris Wailes4b3c34e2014-06-11 12:00:29 -070051
Jason Sams8eaba4f2012-08-14 14:38:05 -070052 virtual void Invoke(Context *rsc, uint32_t slot, const void *data, size_t len);
53 virtual void setupScript(Context *rsc);
54 virtual uint32_t run(Context *);
Yang Nida0f0692015-01-12 13:03:40 -080055 virtual bool isInstrinsic() const { return true; }
Jason Sams8eaba4f2012-08-14 14:38:05 -070056protected:
57 uint32_t mIntrinsicID;
Jason Sams8eaba4f2012-08-14 14:38:05 -070058
59};
60
61
62}
63}
64#endif