blob: 8cfb38bd5b1811d5467c0ff269f7f4840d2b203b [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 {
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070047namespace renderscript {
48
49class Device;
50
Alex Sakhartchoukafb743a2010-11-09 17:00:54 -080051class Context {
Alex Sakhartchoukfb6b6142010-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 Sakhartchoukfb6b6142010-05-21 12:53:13 -070068 VertexArrayState mStateVertexArray;
69
70 //ScriptCState mScriptC;
71 ShaderCache mShaderCache;
72
Alex Sakhartchouk64cd98e2010-10-18 17:18:50 -070073 RsSurfaceConfig mUserSurfaceConfig;
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070074
75 //bool setupCheck();
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070076
77 ProgramFragment * getDefaultProgramFragment() const {
78 return NULL;
79 }
80 ProgramVertex * getDefaultProgramVertex() const {
81 return NULL;
82 }
83 ProgramStore * getDefaultProgramStore() const {
84 return NULL;
85 }
86 ProgramRaster * getDefaultProgramRaster() const {
87 return NULL;
88 }
89
90 uint32_t getWidth() const {return 0;}
91 uint32_t getHeight() const {return 0;}
92
93 // Timers
94 enum Timers {
95 RS_TIMER_IDLE,
96 RS_TIMER_INTERNAL,
97 RS_TIMER_SCRIPT,
98 RS_TIMER_CLEAR_SWAP,
99 _RS_TIMER_TOTAL
100 };
101
102 bool checkVersion1_1() const {return false; }
103 bool checkVersion2_0() const {return false; }
104
105 struct {
106 bool mLogTimes;
107 bool mLogScripts;
108 bool mLogObjects;
109 bool mLogShaders;
Alex Sakhartchouk1103d8e2010-09-30 11:36:37 -0700110 bool mLogShadersAttr;
111 bool mLogShadersUniforms;
112 bool mLogVisual;
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -0700113 } props;
114
115 void dumpDebug() const { }
116 void checkError(const char *) const { };
117 void setError(RsError e, const char *msg = NULL) { }
118
119 mutable const ObjectBase * mObjHead;
120
121 bool ext_OES_texture_npot() const {return mGL.OES_texture_npot;}
Alex Sakhartchouk3df0ff82011-01-13 14:53:43 -0800122 bool ext_GL_NV_texture_npot_2D_mipmap() const {return mGL.GL_NV_texture_npot_2D_mipmap;}
123 float ext_texture_max_aniso() const {return mGL.EXT_texture_max_aniso; }
Alex Sakhartchouk383e5b12010-09-23 16:16:33 -0700124 uint32_t getMaxFragmentTextures() const {return mGL.mMaxFragmentTextureImageUnits;}
125 uint32_t getMaxFragmentUniformVectors() const {return mGL.mMaxFragmentUniformVectors;}
126 uint32_t getMaxVertexUniformVectors() const {return mGL.mMaxVertexUniformVectors;}
Alex Sakhartchouk3df0ff82011-01-13 14:53:43 -0800127 uint32_t getMaxVertexAttributes() const {return mGL.mMaxVertexAttribs;}
Alex Sakhartchoukfb6b6142010-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;
Alex Sakhartchouk3df0ff82011-01-13 14:53:43 -0800151 bool GL_NV_texture_npot_2D_mipmap;
152 float EXT_texture_max_aniso;
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -0700153 } mGL;
154
155};
156
157}
158}
159#endif