rsScriptC.h revision efb8de1ef851c9c2a042ad06f64e33bb8b366041
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        bool useStateVertex;
44        bool useStateRaster;
45        bool useStateFragment;
46        bool useStateStore;
47
48        rsc_RunScript mScript;
49    };
50
51    struct Enviroment_t {
52        bool mIsRoot;
53        bool mIsOrtho;
54        float mClearColor[4];
55        float mClearDepth;
56        uint32_t mClearStencil;
57    };
58
59    Program_t mProgram;
60    Enviroment_t mEnviroment;
61
62    ACCscript*    mAccScript;
63
64    virtual bool run(Context *, uint32_t launchID);
65
66    struct Env {
67        Context *mContext;
68        ScriptC *mScript;
69    };
70
71};
72
73class ScriptCState
74{
75public:
76    ScriptCState();
77    ~ScriptCState();
78
79    ACCscript* mAccScript;
80
81    ScriptC::Program_t mProgram;
82    ScriptC::Enviroment_t mEnviroment;
83
84    Vector<const Type *> mConstantBufferTypes;
85
86    void clear();
87    void runCompiler();
88};
89
90
91}
92}
93#endif
94
95
96
97