blob: f3e9dab3d3af4c3e15efc2855430ecad94a71be6 [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"
Alex Sakhartchoukfb6b6142010-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 Sakhartchoukfb6b6142010-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 Sakhartchoukfb6b6142010-05-21 12:53:13 -070070 VertexArrayState mStateVertexArray;
71
72 //ScriptCState mScriptC;
73 ShaderCache mShaderCache;
74
Alex Sakhartchouk64cd98e2010-10-18 17:18:50 -070075 RsSurfaceConfig mUserSurfaceConfig;
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070076
77 //bool setupCheck();
78 bool checkDriver() const {return false;}
79
80 ProgramFragment * getDefaultProgramFragment() const {
81 return NULL;
82 }
83 ProgramVertex * getDefaultProgramVertex() const {
84 return NULL;
85 }
86 ProgramStore * getDefaultProgramStore() const {
87 return NULL;
88 }
89 ProgramRaster * getDefaultProgramRaster() const {
90 return NULL;
91 }
92
93 uint32_t getWidth() const {return 0;}
94 uint32_t getHeight() const {return 0;}
95
96 // Timers
97 enum Timers {
98 RS_TIMER_IDLE,
99 RS_TIMER_INTERNAL,
100 RS_TIMER_SCRIPT,
101 RS_TIMER_CLEAR_SWAP,
102 _RS_TIMER_TOTAL
103 };
104
105 bool checkVersion1_1() const {return false; }
106 bool checkVersion2_0() const {return false; }
107
108 struct {
109 bool mLogTimes;
110 bool mLogScripts;
111 bool mLogObjects;
112 bool mLogShaders;
Alex Sakhartchouk1103d8e2010-09-30 11:36:37 -0700113 bool mLogShadersAttr;
114 bool mLogShadersUniforms;
115 bool mLogVisual;
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -0700116 } props;
117
118 void dumpDebug() const { }
119 void checkError(const char *) const { };
120 void setError(RsError e, const char *msg = NULL) { }
121
122 mutable const ObjectBase * mObjHead;
123
124 bool ext_OES_texture_npot() const {return mGL.OES_texture_npot;}
Alex Sakhartchouk1103d8e2010-09-30 11:36:37 -0700125 float ext_texture_max_aniso() const {return 1.0f;}
Alex Sakhartchouk383e5b12010-09-23 16:16:33 -0700126 uint32_t getMaxFragmentTextures() const {return mGL.mMaxFragmentTextureImageUnits;}
127 uint32_t getMaxFragmentUniformVectors() const {return mGL.mMaxFragmentUniformVectors;}
128 uint32_t getMaxVertexUniformVectors() const {return mGL.mMaxVertexUniformVectors;}
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -0700129
130protected:
131
132 struct {
133 const uint8_t * mVendor;
134 const uint8_t * mRenderer;
135 const uint8_t * mVersion;
136 const uint8_t * mExtensions;
137
138 uint32_t mMajorVersion;
139 uint32_t mMinorVersion;
140
141 int32_t mMaxVaryingVectors;
142 int32_t mMaxTextureImageUnits;
143
144 int32_t mMaxFragmentTextureImageUnits;
145 int32_t mMaxFragmentUniformVectors;
146
147 int32_t mMaxVertexAttribs;
148 int32_t mMaxVertexUniformVectors;
149 int32_t mMaxVertexTextureUnits;
150
151 bool OES_texture_npot;
152 } mGL;
153
154};
155
156}
157}
158#endif