blob: be1fff6dd071e09ceb5107dd0b521d03cfcaccee [file] [log] [blame]
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -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_CONTEXT_HOST_STUB_H
18#define ANDROID_RS_CONTEXT_HOST_STUB_H
19
20#include "rsUtils.h"
21//#include "rsMutex.h"
22
23//#include "rsThreadIO.h"
24#include "rsType.h"
25#include "rsMatrix.h"
26#include "rsAllocation.h"
27#include "rsSimpleMesh.h"
28#include "rsMesh.h"
29//#include "rsDevice.h"
30#include "rsScriptC.h"
31#include "rsAllocation.h"
32#include "rsAdapter.h"
33#include "rsSampler.h"
34#include "rsLight.h"
35#include "rsProgramFragment.h"
36#include "rsProgramStore.h"
37#include "rsProgramRaster.h"
38#include "rsProgramVertex.h"
39#include "rsShaderCache.h"
40#include "rsVertexArray.h"
41
42//#include "rsgApiStructs.h"
43//#include "rsLocklessFifo.h"
44
45//#include <ui/egl/android_natives.h>
46
47// ---------------------------------------------------------------------------
48namespace android {
49
50namespace renderscript {
51
52class Device;
53
54class Context
55{
56public:
57 Context(Device *, bool isGraphics, bool useDepth) {
58 mObjHead = NULL;
59 }
60 ~Context() {
61 }
62
63
64 //StructuredAllocationContext mStateAllocation;
65 ElementState mStateElement;
66 TypeState mStateType;
67 SamplerState mStateSampler;
68 //ProgramFragmentState mStateFragment;
69 ProgramStoreState mStateFragmentStore;
70 //ProgramRasterState mStateRaster;
71 //ProgramVertexState mStateVertex;
72 LightState mStateLight;
73 VertexArrayState mStateVertexArray;
74
75 //ScriptCState mScriptC;
76 ShaderCache mShaderCache;
77
78
79 //bool setupCheck();
80 bool checkDriver() const {return false;}
81
82 ProgramFragment * getDefaultProgramFragment() const {
83 return NULL;
84 }
85 ProgramVertex * getDefaultProgramVertex() const {
86 return NULL;
87 }
88 ProgramStore * getDefaultProgramStore() const {
89 return NULL;
90 }
91 ProgramRaster * getDefaultProgramRaster() const {
92 return NULL;
93 }
94
95 uint32_t getWidth() const {return 0;}
96 uint32_t getHeight() const {return 0;}
97
98 // Timers
99 enum Timers {
100 RS_TIMER_IDLE,
101 RS_TIMER_INTERNAL,
102 RS_TIMER_SCRIPT,
103 RS_TIMER_CLEAR_SWAP,
104 _RS_TIMER_TOTAL
105 };
106
107 bool checkVersion1_1() const {return false; }
108 bool checkVersion2_0() const {return false; }
109
110 struct {
111 bool mLogTimes;
112 bool mLogScripts;
113 bool mLogObjects;
114 bool mLogShaders;
115 } props;
116
117 void dumpDebug() const { }
118 void checkError(const char *) const { };
119 void setError(RsError e, const char *msg = NULL) { }
120
121 mutable const ObjectBase * mObjHead;
122
123 bool ext_OES_texture_npot() const {return mGL.OES_texture_npot;}
124
125protected:
126
127 struct {
128 const uint8_t * mVendor;
129 const uint8_t * mRenderer;
130 const uint8_t * mVersion;
131 const uint8_t * mExtensions;
132
133 uint32_t mMajorVersion;
134 uint32_t mMinorVersion;
135
136 int32_t mMaxVaryingVectors;
137 int32_t mMaxTextureImageUnits;
138
139 int32_t mMaxFragmentTextureImageUnits;
140 int32_t mMaxFragmentUniformVectors;
141
142 int32_t mMaxVertexAttribs;
143 int32_t mMaxVertexUniformVectors;
144 int32_t mMaxVertexTextureUnits;
145
146 bool OES_texture_npot;
147 } mGL;
148
149};
150
151}
152}
153#endif