rsScriptIntrinsic.cpp revision 41d6c769f5fa21da3cbc116af95d88949a4a5c76
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#include "rsContext.h"
18#include "rsScriptIntrinsic.h"
19#include <time.h>
20
21using namespace android;
22using namespace android::renderscript;
23
24ScriptIntrinsic::ScriptIntrinsic(Context *rsc) : Script(rsc) {
25}
26
27ScriptIntrinsic::~ScriptIntrinsic() {
28}
29
30bool ScriptIntrinsic::init(Context *rsc, RsScriptIntrinsicID iid, Element *e) {
31    mIntrinsicID = iid;
32    mElement.set(e);
33    rsc->mHal.funcs.script.initIntrinsic(rsc, this, iid, e);
34
35    return true;
36}
37
38bool ScriptIntrinsic::freeChildren() {
39    return false;
40}
41
42void ScriptIntrinsic::setupScript(Context *rsc) {
43}
44
45uint32_t ScriptIntrinsic::run(Context *rsc) {
46    rsAssert(!"ScriptIntrinsic::run - should not happen");
47    return 0;
48}
49
50
51void ScriptIntrinsic::runForEach(Context *rsc,
52                         uint32_t slot,
53                         const Allocation * ain,
54                         Allocation * aout,
55                         const void * usr,
56                         size_t usrBytes,
57                         const RsScriptCall *sc) {
58
59    rsc->mHal.funcs.script.invokeForEach(rsc, this, slot, ain, aout, usr, usrBytes, sc);
60}
61
62void ScriptIntrinsic::Invoke(Context *rsc, uint32_t slot, const void *data, size_t len) {
63}
64
65void ScriptIntrinsic::serialize(Context *rsc, OStream *stream) const {
66}
67
68RsA3DClassID ScriptIntrinsic::getClassId() const {
69    return (RsA3DClassID)0;
70}
71
72
73
74namespace android {
75namespace renderscript {
76
77
78RsScript rsi_ScriptIntrinsicCreate(Context *rsc, uint32_t id, RsElement ve) {
79    ScriptIntrinsic *si = new ScriptIntrinsic(rsc);
80    ALOGE("rsi_ScriptIntrinsicCreate %i", id);
81    if (!si->init(rsc, (RsScriptIntrinsicID)id, (Element *)ve)) {
82        delete si;
83        return NULL;
84    }
85    return si;
86}
87
88}
89}
90
91
92