rsScriptC.h revision f1685045e3423f2e342c3d74c206a25d72eba89d
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
36    ScriptC();
37    virtual ~ScriptC();
38
39    struct Program_t {
40        const char * mScriptText;
41        uint32_t mScriptTextLength;
42
43
44        int mVersionMajor;
45        int mVersionMinor;
46
47        rsc_RunScript mScript;
48    };
49
50    Program_t mProgram;
51
52    ACCscript*    mAccScript;
53
54    virtual bool run(Context *, uint32_t launchID);
55};
56
57class ScriptCState
58{
59public:
60    ScriptCState();
61    ~ScriptCState();
62
63    ACCscript* mAccScript;
64
65    ScriptC::Program_t mProgram;
66    Script::Enviroment_t mEnviroment;
67
68    Vector<const Type *> mConstantBufferTypes;
69
70    void clear();
71    void runCompiler(Context *rsc);
72
73    struct SymbolTable_t {
74        const char * mName;
75        void * mPtr;
76        const char * mDecl;
77    };
78    static SymbolTable_t gSyms[];
79    static const SymbolTable_t * lookupSymbol(const char *);
80    static void appendDecls(String8 *str);
81};
82
83
84}
85}
86#endif
87
88
89
90