blob: aa0205d2a8fe294860f660737e079230efcf22bd [file] [log] [blame]
Alex Sakhartchoukaa7d2882010-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"
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070027#include "rsMesh.h"
28//#include "rsDevice.h"
29#include "rsScriptC.h"
30#include "rsAllocation.h"
31#include "rsAdapter.h"
32#include "rsSampler.h"
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070033#include "rsProgramFragment.h"
34#include "rsProgramStore.h"
35#include "rsProgramRaster.h"
36#include "rsProgramVertex.h"
37#include "rsShaderCache.h"
38#include "rsVertexArray.h"
39
40//#include "rsgApiStructs.h"
41//#include "rsLocklessFifo.h"
42
43//#include <ui/egl/android_natives.h>
44
45// ---------------------------------------------------------------------------
46namespace android {
47
48namespace renderscript {
49
50class Device;
51
52class Context
53{
54public:
55 Context(Device *, bool isGraphics, bool useDepth) {
56 mObjHead = NULL;
57 }
58 ~Context() {
59 }
60
61
62 //StructuredAllocationContext mStateAllocation;
63 ElementState mStateElement;
64 TypeState mStateType;
65 SamplerState mStateSampler;
66 //ProgramFragmentState mStateFragment;
67 ProgramStoreState mStateFragmentStore;
68 //ProgramRasterState mStateRaster;
69 //ProgramVertexState mStateVertex;
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070070 VertexArrayState mStateVertexArray;
71
72 //ScriptCState mScriptC;
73 ShaderCache mShaderCache;
74
75
76 //bool setupCheck();
77 bool checkDriver() const {return false;}
78
79 ProgramFragment * getDefaultProgramFragment() const {
80 return NULL;
81 }
82 ProgramVertex * getDefaultProgramVertex() const {
83 return NULL;
84 }
85 ProgramStore * getDefaultProgramStore() const {
86 return NULL;
87 }
88 ProgramRaster * getDefaultProgramRaster() const {
89 return NULL;
90 }
91
92 uint32_t getWidth() const {return 0;}
93 uint32_t getHeight() const {return 0;}
94
95 // Timers
96 enum Timers {
97 RS_TIMER_IDLE,
98 RS_TIMER_INTERNAL,
99 RS_TIMER_SCRIPT,
100 RS_TIMER_CLEAR_SWAP,
101 _RS_TIMER_TOTAL
102 };
103
104 bool checkVersion1_1() const {return false; }
105 bool checkVersion2_0() const {return false; }
106
107 struct {
108 bool mLogTimes;
109 bool mLogScripts;
110 bool mLogObjects;
111 bool mLogShaders;
Alex Sakhartchoukf5b35102010-09-30 11:36:37 -0700112 bool mLogShadersAttr;
113 bool mLogShadersUniforms;
114 bool mLogVisual;
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -0700115 } 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;}
Alex Sakhartchoukf5b35102010-09-30 11:36:37 -0700124 float ext_texture_max_aniso() const {return 1.0f;}
Alex Sakhartchoukb89aaac2010-09-23 16:16:33 -0700125 uint32_t getMaxFragmentTextures() const {return mGL.mMaxFragmentTextureImageUnits;}
126 uint32_t getMaxFragmentUniformVectors() const {return mGL.mMaxFragmentUniformVectors;}
127 uint32_t getMaxVertexUniformVectors() const {return mGL.mMaxVertexUniformVectors;}
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -0700128
129protected:
130
131 struct {
132 const uint8_t * mVendor;
133 const uint8_t * mRenderer;
134 const uint8_t * mVersion;
135 const uint8_t * mExtensions;
136
137 uint32_t mMajorVersion;
138 uint32_t mMinorVersion;
139
140 int32_t mMaxVaryingVectors;
141 int32_t mMaxTextureImageUnits;
142
143 int32_t mMaxFragmentTextureImageUnits;
144 int32_t mMaxFragmentUniformVectors;
145
146 int32_t mMaxVertexAttribs;
147 int32_t mMaxVertexUniformVectors;
148 int32_t mMaxVertexTextureUnits;
149
150 bool OES_texture_npot;
151 } mGL;
152
153};
154
155}
156}
157#endif