rsScript.h revision 8b2c065dfc16c148e2829a19e83d2269b9bcd4cc
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_H
18#define ANDROID_RS_SCRIPT_H
19
20#include "rsAllocation.h"
21
22
23// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
27class ProgramVertex;
28class ProgramFragment;
29class ProgramRaster;
30class ProgramFragmentStore;
31
32#define MAX_SCRIPT_BANKS 16
33
34class Script : public ObjectBase
35{
36public:
37
38    Script();
39    virtual ~Script();
40
41
42    struct Enviroment_t {
43        bool mIsRoot;
44        float mClearColor[4];
45        float mClearDepth;
46        uint32_t mClearStencil;
47
48        uint32_t mStartTimeMillis;
49        const char* mTimeZone;
50
51        ObjectBaseRef<ProgramVertex> mVertex;
52        ObjectBaseRef<ProgramFragment> mFragment;
53        //ObjectBaseRef<ProgramRaster> mRaster;
54        ObjectBaseRef<ProgramFragmentStore> mFragmentStore;
55
56    };
57    Enviroment_t mEnviroment;
58
59    const Type * mConstantBufferTypes;
60    uint32_t mCounstantBufferCount;
61
62    ObjectBaseRef<Allocation> mSlots[MAX_SCRIPT_BANKS];
63    ObjectBaseRef<Type> mTypes[MAX_SCRIPT_BANKS];
64
65    virtual bool run(Context *, uint32_t launchID) = 0;
66};
67
68
69
70}
71}
72#endif
73
74