blob: aa18bdd6c0d09e53c9f0f64bc59fed6ad0f878e2 [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 {
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070047namespace renderscript {
48
49class Device;
50
Alex Sakhartchouked9f2102010-11-09 17:00:54 -080051class Context {
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070052public:
53 Context(Device *, bool isGraphics, bool useDepth) {
54 mObjHead = NULL;
55 }
56 ~Context() {
57 }
58
59
60 //StructuredAllocationContext mStateAllocation;
61 ElementState mStateElement;
62 TypeState mStateType;
63 SamplerState mStateSampler;
64 //ProgramFragmentState mStateFragment;
65 ProgramStoreState mStateFragmentStore;
66 //ProgramRasterState mStateRaster;
67 //ProgramVertexState mStateVertex;
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070068 VertexArrayState mStateVertexArray;
69
70 //ScriptCState mScriptC;
71 ShaderCache mShaderCache;
72
Alex Sakhartchouk98bfe5d2010-10-18 17:18:50 -070073 RsSurfaceConfig mUserSurfaceConfig;
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070074
75 //bool setupCheck();
76 bool checkDriver() const {return false;}
77
78 ProgramFragment * getDefaultProgramFragment() const {
79 return NULL;
80 }
81 ProgramVertex * getDefaultProgramVertex() const {
82 return NULL;
83 }
84 ProgramStore * getDefaultProgramStore() const {
85 return NULL;
86 }
87 ProgramRaster * getDefaultProgramRaster() const {
88 return NULL;
89 }
90
91 uint32_t getWidth() const {return 0;}
92 uint32_t getHeight() const {return 0;}
93
94 // Timers
95 enum Timers {
96 RS_TIMER_IDLE,
97 RS_TIMER_INTERNAL,
98 RS_TIMER_SCRIPT,
99 RS_TIMER_CLEAR_SWAP,
100 _RS_TIMER_TOTAL
101 };
102
103 bool checkVersion1_1() const {return false; }
104 bool checkVersion2_0() const {return false; }
105
106 struct {
107 bool mLogTimes;
108 bool mLogScripts;
109 bool mLogObjects;
110 bool mLogShaders;
Alex Sakhartchoukf5b35102010-09-30 11:36:37 -0700111 bool mLogShadersAttr;
112 bool mLogShadersUniforms;
113 bool mLogVisual;
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -0700114 } props;
115
116 void dumpDebug() const { }
117 void checkError(const char *) const { };
118 void setError(RsError e, const char *msg = NULL) { }
119
120 mutable const ObjectBase * mObjHead;
121
122 bool ext_OES_texture_npot() const {return mGL.OES_texture_npot;}
Alex Sakhartchouk9d71e212010-11-08 15:10:52 -0800123 bool ext_GL_NV_texture_npot_2D_mipmap() const {return false;}
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