Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 1 | /* |
| 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 Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 27 | #include "rsMesh.h" |
| 28 | //#include "rsDevice.h" |
| 29 | #include "rsScriptC.h" |
| 30 | #include "rsAllocation.h" |
| 31 | #include "rsAdapter.h" |
| 32 | #include "rsSampler.h" |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 33 | #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 | // --------------------------------------------------------------------------- |
| 46 | namespace android { |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 47 | namespace renderscript { |
| 48 | |
| 49 | class Device; |
| 50 | |
Alex Sakhartchouk | ed9f210 | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 51 | class Context { |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 52 | public: |
| 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 Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 68 | VertexArrayState mStateVertexArray; |
| 69 | |
| 70 | //ScriptCState mScriptC; |
| 71 | ShaderCache mShaderCache; |
| 72 | |
Alex Sakhartchouk | 98bfe5d | 2010-10-18 17:18:50 -0700 | [diff] [blame] | 73 | RsSurfaceConfig mUserSurfaceConfig; |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 74 | |
| 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 Sakhartchouk | f5b3510 | 2010-09-30 11:36:37 -0700 | [diff] [blame] | 111 | bool mLogShadersAttr; |
| 112 | bool mLogShadersUniforms; |
| 113 | bool mLogVisual; |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 114 | } 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 Sakhartchouk | 9d71e21 | 2010-11-08 15:10:52 -0800 | [diff] [blame] | 123 | bool ext_GL_NV_texture_npot_2D_mipmap() const {return false;} |
Alex Sakhartchouk | f5b3510 | 2010-09-30 11:36:37 -0700 | [diff] [blame] | 124 | float ext_texture_max_aniso() const {return 1.0f;} |
Alex Sakhartchouk | b89aaac | 2010-09-23 16:16:33 -0700 | [diff] [blame] | 125 | uint32_t getMaxFragmentTextures() const {return mGL.mMaxFragmentTextureImageUnits;} |
| 126 | uint32_t getMaxFragmentUniformVectors() const {return mGL.mMaxFragmentUniformVectors;} |
| 127 | uint32_t getMaxVertexUniformVectors() const {return mGL.mMaxVertexUniformVectors;} |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 128 | |
| 129 | protected: |
| 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 |