rsScriptC.h revision e45ac6e91864f2a6617b6a2c0aa87cdb62cf58fd
1/*
2 * Copyright (C) 2009 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_C_H
18#define ANDROID_RS_SCRIPT_C_H
19
20#include "rsScript.h"
21
22#include "RenderScriptEnv.h"
23
24struct ACCscript;
25
26// ---------------------------------------------------------------------------
27namespace android {
28namespace renderscript {
29
30
31
32class ScriptC : public Script
33{
34public:
35    typedef int (*RunScript_t)(uint32_t launchIndex);
36
37    ScriptC();
38    virtual ~ScriptC();
39
40    struct Program_t {
41        const char * mScriptText;
42        uint32_t mScriptTextLength;
43
44
45        int mVersionMajor;
46        int mVersionMinor;
47
48        RunScript_t mScript;
49    };
50
51    Program_t mProgram;
52
53    ACCscript*    mAccScript;
54
55    virtual bool run(Context *, uint32_t launchID);
56};
57
58class ScriptCState
59{
60public:
61    ScriptCState();
62    ~ScriptCState();
63
64    ACCscript* mAccScript;
65
66    ScriptC::Program_t mProgram;
67    Script::Enviroment_t mEnviroment;
68
69    Vector<const Type *> mConstantBufferTypes;
70
71    void clear();
72    void runCompiler(Context *rsc);
73
74    struct SymbolTable_t {
75        const char * mName;
76        void * mPtr;
77        const char * mRet;
78        const char * mParam;
79    };
80    static SymbolTable_t gSyms[];
81    static const SymbolTable_t * lookupSymbol(const char *);
82    static void appendDecls(String8 *str);
83};
84
85
86}
87}
88#endif
89
90
91
92