blob: 48e3f369f3c147d3d50b759b4d4cc3d7ed042b27 [file] [log] [blame]
Jason Samse4a06c52011-03-16 16:29:28 -07001/*
2 * Copyright (C) 2011 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 RS_HAL_H
18#define RS_HAL_H
19
20#include <RenderScriptDefines.h>
21
22namespace android {
23namespace renderscript {
24
25class Context;
26class ObjectBase;
27class Element;
28class Type;
29class Allocation;
30class Script;
31class ScriptC;
32
33
34typedef struct RsHalRec RsHal;
35
36typedef void *(*RsHalSymbolLookupFunc)(void *usrptr, char const *symbolName);
37
38
39
40/**
41 * Script management functions
42 */
43typedef struct {
44 void (*shutdownDriver)(RsHal dc);
45 void (*getVersion)(unsigned int *major, unsigned int *minor);
46
47
48
49 struct {
50 bool (*scriptInit)(const Context *rsc, ScriptC *s,
51 char const *resName,
52 char const *cacheDir,
53 uint8_t const *bitcode,
54 size_t bitcodeSize,
55 uint32_t flags,
56 RsHalSymbolLookupFunc lookupFunc);
57
58 void (*invokeFunction)(const Context *rsc, const Script *s,
59 uint32_t slot,
60 const void *params,
61 size_t paramLength);
62 int (*invokeRoot)(const Context *rsc, const Script *s);
63 void (*invokeInit)(const Context *rsc, const Script *s);
64
65 void (*setGlobalVar)(const Context *rsc, const Script *s,
66 uint32_t slot,
67 void *data,
68 size_t dataLength);
69 void (*setGlobalBind)(const Context *rsc, const Script *s,
70 uint32_t slot,
71 void *data);
72 void (*setGlobalObj)(const Context *rsc, const Script *s,
73 uint32_t slot,
74 ObjectBase *data);
75
76 void (*destroy)(const Context *rsc, Script *s);
77 } script;
78
79
80
81} RsdHalFunctions;
82
83void rsiSetObject(ObjectBase **vdst, ObjectBase * vsrc);
84void rsiClearObject(ObjectBase **vdst);
85bool rsiIsObject(const ObjectBase *vdst);
86
87}
88}
89
90
91bool rsdHalInit(android::renderscript::Context *, uint32_t version_major, uint32_t version_minor);
92
93#endif
94