blob: e40531ede37e6e810eaeecb8347cc5f7ef41094e [file] [log] [blame]
Jason Samsd19f10d2009-05-22 14:03:28 -07001/*
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
Jason Sams3eaa3382009-06-10 15:04:38 -070022
Jason Samsd19f10d2009-05-22 14:03:28 -070023// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
Jason Sams3eaa3382009-06-10 15:04:38 -070027class ProgramVertex;
28class ProgramFragment;
29class ProgramRaster;
30class ProgramFragmentStore;
Jason Samsd19f10d2009-05-22 14:03:28 -070031
Jason Sams43ee06852009-08-12 17:54:11 -070032#define MAX_SCRIPT_BANKS 16
33
Jason Samsd19f10d2009-05-22 14:03:28 -070034class Script : public ObjectBase
35{
36public:
Jason Samsbe2e8412009-09-16 15:04:38 -070037 typedef void (* InvokeFunc_t)(void);
Jason Samsd19f10d2009-05-22 14:03:28 -070038
39 Script();
40 virtual ~Script();
41
42
Jason Sams928f5cf2009-06-08 18:50:13 -070043 struct Enviroment_t {
44 bool mIsRoot;
Jason Sams928f5cf2009-06-08 18:50:13 -070045 float mClearColor[4];
46 float mClearDepth;
47 uint32_t mClearStencil;
Jason Samsd19f10d2009-05-22 14:03:28 -070048
Romain Guy584a3752009-07-30 18:45:01 -070049 uint32_t mStartTimeMillis;
50 const char* mTimeZone;
51
Jason Sams3eaa3382009-06-10 15:04:38 -070052 ObjectBaseRef<ProgramVertex> mVertex;
53 ObjectBaseRef<ProgramFragment> mFragment;
54 //ObjectBaseRef<ProgramRaster> mRaster;
55 ObjectBaseRef<ProgramFragmentStore> mFragmentStore;
Jason Samsbe2e8412009-09-16 15:04:38 -070056 InvokeFunc_t mInvokables[MAX_SCRIPT_BANKS];
57 const char * mScriptText;
58 uint32_t mScriptTextLength;
Jason Sams928f5cf2009-06-08 18:50:13 -070059 };
60 Enviroment_t mEnviroment;
Jason Samsd19f10d2009-05-22 14:03:28 -070061
Jason Samsd19f10d2009-05-22 14:03:28 -070062 uint32_t mCounstantBufferCount;
63
Jason Samsbe2e8412009-09-16 15:04:38 -070064
Jason Sams43ee06852009-08-12 17:54:11 -070065 ObjectBaseRef<Allocation> mSlots[MAX_SCRIPT_BANKS];
Jason Samsfbf0b9e2009-08-13 12:59:04 -070066 ObjectBaseRef<const Type> mTypes[MAX_SCRIPT_BANKS];
67 String8 mSlotNames[MAX_SCRIPT_BANKS];
Jason Sams334ea0c2009-08-17 13:56:09 -070068 bool mSlotWritable[MAX_SCRIPT_BANKS];
Jason Samsd19f10d2009-05-22 14:03:28 -070069
Jason Samsbe2e8412009-09-16 15:04:38 -070070
71
Jason Samsa09f11d2009-06-04 17:58:03 -070072 virtual bool run(Context *, uint32_t launchID) = 0;
Jason Samsd19f10d2009-05-22 14:03:28 -070073};
74
75
76
77}
78}
79#endif
80