Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 1 | /* |
Alex Sakhartchouk | a04e30d | 2011-04-29 16:49:08 -0700 | [diff] [blame] | 2 | * Copyright (C) 2011 The Android Open Source Project |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 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_H |
| 18 | #define ANDROID_RS_CONTEXT_H |
| 19 | |
Jason Sams | a557780 | 2009-07-13 12:20:31 -0700 | [diff] [blame] | 20 | #include "rsUtils.h" |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 21 | #include "rsType.h" |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 22 | #include "rsAllocation.h" |
Jason Sams | a89371c | 2009-06-30 14:13:04 -0700 | [diff] [blame] | 23 | #include "rsMesh.h" |
Alex Sakhartchouk | 77d9f4b | 2011-01-31 14:53:24 -0800 | [diff] [blame] | 24 | |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 25 | #include "rs_hal.h" |
| 26 | |
Alex Sakhartchouk | 77d9f4b | 2011-01-31 14:53:24 -0800 | [diff] [blame] | 27 | #ifndef ANDROID_RS_SERIALIZE |
| 28 | #include "rsMutex.h" |
| 29 | #include "rsThreadIO.h" |
Jason Sams | 87fe59a | 2011-04-20 15:09:01 -0700 | [diff] [blame] | 30 | #include "rsMatrix4x4.h" |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 31 | #include "rsDevice.h" |
| 32 | #include "rsScriptC.h" |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 33 | #include "rsAdapter.h" |
| 34 | #include "rsSampler.h" |
Alex Sakhartchouk | d3e0ad4 | 2010-06-24 17:15:34 -0700 | [diff] [blame] | 35 | #include "rsFont.h" |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 36 | #include "rsProgramFragment.h" |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 37 | #include "rsProgramStore.h" |
Jason Sams | 5fd09d8 | 2009-09-23 13:57:02 -0700 | [diff] [blame] | 38 | #include "rsProgramRaster.h" |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 39 | #include "rsProgramVertex.h" |
Alex Sakhartchouk | 7d9c5ff | 2011-04-01 14:19:01 -0700 | [diff] [blame] | 40 | #include "rsFBOCache.h" |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 41 | |
| 42 | #include "rsgApiStructs.h" |
| 43 | #include "rsLocklessFifo.h" |
| 44 | |
Alex Sakhartchouk | 77d9f4b | 2011-01-31 14:53:24 -0800 | [diff] [blame] | 45 | #endif // ANDROID_RS_SERIALIZE |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 46 | |
Alex Sakhartchouk | c19ff01 | 2011-05-06 14:59:45 -0700 | [diff] [blame^] | 47 | class ANativeWindow; |
| 48 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 49 | // --------------------------------------------------------------------------- |
| 50 | namespace android { |
Mathias Agopian | d4c25e3 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 51 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 52 | namespace renderscript { |
| 53 | |
Jason Sams | 605048a | 2010-09-30 18:15:52 -0700 | [diff] [blame] | 54 | #if 0 |
| 55 | #define CHECK_OBJ(o) { \ |
| 56 | GET_TLS(); \ |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 57 | if (!ObjectBase::isValid(rsc, (const ObjectBase *)o)) { \ |
Jason Sams | 605048a | 2010-09-30 18:15:52 -0700 | [diff] [blame] | 58 | LOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__); \ |
| 59 | } \ |
| 60 | } |
| 61 | #define CHECK_OBJ_OR_NULL(o) { \ |
| 62 | GET_TLS(); \ |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 63 | if (o && !ObjectBase::isValid(rsc, (const ObjectBase *)o)) { \ |
Jason Sams | 605048a | 2010-09-30 18:15:52 -0700 | [diff] [blame] | 64 | LOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__); \ |
| 65 | } \ |
| 66 | } |
| 67 | #else |
| 68 | #define CHECK_OBJ(o) |
| 69 | #define CHECK_OBJ_OR_NULL(o) |
| 70 | #endif |
| 71 | |
Alex Sakhartchouk | 77d9f4b | 2011-01-31 14:53:24 -0800 | [diff] [blame] | 72 | #ifndef ANDROID_RS_SERIALIZE |
| 73 | |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 74 | class Context { |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 75 | public: |
Jason Sams | bad8074 | 2011-03-16 16:29:28 -0700 | [diff] [blame] | 76 | struct Hal { |
| 77 | void * drv; |
| 78 | |
| 79 | RsdHalFunctions funcs; |
| 80 | }; |
| 81 | Hal mHal; |
| 82 | |
Jason Sams | 5c1c79a | 2010-11-03 14:27:11 -0700 | [diff] [blame] | 83 | static Context * createContext(Device *, const RsSurfaceConfig *sc); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 84 | ~Context(); |
| 85 | |
Jason Sams | fb03a22 | 2009-10-15 16:47:31 -0700 | [diff] [blame] | 86 | static pthread_mutex_t gInitMutex; |
Stephen Hines | ca3f09c | 2011-01-07 15:11:30 -0800 | [diff] [blame] | 87 | // Library mutex (for providing thread-safe calls from the runtime) |
| 88 | static pthread_mutex_t gLibMutex; |
Jason Sams | fb03a22 | 2009-10-15 16:47:31 -0700 | [diff] [blame] | 89 | |
Jason Sams | 6070925 | 2010-11-17 15:29:32 -0800 | [diff] [blame] | 90 | class PushState { |
| 91 | public: |
| 92 | PushState(Context *); |
| 93 | ~PushState(); |
| 94 | |
| 95 | private: |
| 96 | ObjectBaseRef<ProgramFragment> mFragment; |
| 97 | ObjectBaseRef<ProgramVertex> mVertex; |
| 98 | ObjectBaseRef<ProgramStore> mStore; |
| 99 | ObjectBaseRef<ProgramRaster> mRaster; |
| 100 | ObjectBaseRef<Font> mFont; |
| 101 | Context *mRsc; |
| 102 | }; |
| 103 | |
Jason Sams | 6b8552a | 2010-10-13 15:31:10 -0700 | [diff] [blame] | 104 | RsSurfaceConfig mUserSurfaceConfig; |
Jason Sams | e576910 | 2009-06-19 16:03:18 -0700 | [diff] [blame] | 105 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 106 | ElementState mStateElement; |
| 107 | TypeState mStateType; |
| 108 | SamplerState mStateSampler; |
| 109 | ProgramFragmentState mStateFragment; |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 110 | ProgramStoreState mStateFragmentStore; |
Jason Sams | 5fd09d8 | 2009-09-23 13:57:02 -0700 | [diff] [blame] | 111 | ProgramRasterState mStateRaster; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 112 | ProgramVertexState mStateVertex; |
Alex Sakhartchouk | d3e0ad4 | 2010-06-24 17:15:34 -0700 | [diff] [blame] | 113 | FontState mStateFont; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 114 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 115 | ScriptCState mScriptC; |
Alex Sakhartchouk | 7d9c5ff | 2011-04-01 14:19:01 -0700 | [diff] [blame] | 116 | FBOCache mFBOCache; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 117 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 118 | void swapBuffers(); |
| 119 | void setRootScript(Script *); |
Jason Sams | 6070925 | 2010-11-17 15:29:32 -0800 | [diff] [blame] | 120 | void setProgramRaster(ProgramRaster *); |
| 121 | void setProgramVertex(ProgramVertex *); |
| 122 | void setProgramFragment(ProgramFragment *); |
| 123 | void setProgramStore(ProgramStore *); |
Alex Sakhartchouk | d3e0ad4 | 2010-06-24 17:15:34 -0700 | [diff] [blame] | 124 | void setFont(Font *); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 125 | |
| 126 | void updateSurface(void *sur); |
| 127 | |
Jason Sams | 6070925 | 2010-11-17 15:29:32 -0800 | [diff] [blame] | 128 | ProgramFragment * getProgramFragment() {return mFragment.get();} |
| 129 | ProgramStore * getProgramStore() {return mFragmentStore.get();} |
| 130 | ProgramRaster * getProgramRaster() {return mRaster.get();} |
| 131 | ProgramVertex * getProgramVertex() {return mVertex.get();} |
Alex Sakhartchouk | d3e0ad4 | 2010-06-24 17:15:34 -0700 | [diff] [blame] | 132 | Font * getFont() {return mFont.get();} |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 133 | |
Jason Sams | a2cf755 | 2010-03-03 13:03:18 -0800 | [diff] [blame] | 134 | bool setupCheck(); |
Alex Sakhartchouk | 889fe50 | 2010-10-01 10:54:06 -0700 | [diff] [blame] | 135 | void setupProgramStore(); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 136 | |
Jason Sams | 86f1b23 | 2009-09-24 17:38:20 -0700 | [diff] [blame] | 137 | void pause(); |
| 138 | void resume(); |
Dianne Hackborn | 1c769c3 | 2010-06-30 13:56:17 -0700 | [diff] [blame] | 139 | void setSurface(uint32_t w, uint32_t h, ANativeWindow *sur); |
Jason Sams | 1583244 | 2009-11-15 12:14:26 -0800 | [diff] [blame] | 140 | void setPriority(int32_t p); |
Jason Sams | 741aac9 | 2010-12-24 14:38:39 -0800 | [diff] [blame] | 141 | void destroyWorkerThreadResources(); |
Jason Sams | 86f1b23 | 2009-09-24 17:38:20 -0700 | [diff] [blame] | 142 | |
Jason Sams | a4a54e4 | 2009-06-10 18:39:40 -0700 | [diff] [blame] | 143 | void assignName(ObjectBase *obj, const char *name, uint32_t len); |
Jason Sams | a0a1b6f | 2009-06-10 15:04:38 -0700 | [diff] [blame] | 144 | void removeName(ObjectBase *obj); |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 145 | |
Jason Sams | aad4bc5 | 2010-11-08 17:06:46 -0800 | [diff] [blame] | 146 | RsMessageToClientType peekMessageToClient(size_t *receiveLen, uint32_t *subID, bool wait); |
| 147 | RsMessageToClientType getMessageToClient(void *data, size_t *receiveLen, uint32_t *subID, size_t bufferLen, bool wait); |
Jason Sams | 87319de | 2010-11-22 16:20:16 -0800 | [diff] [blame] | 148 | bool sendMessageToClient(const void *data, RsMessageToClientType cmdID, uint32_t subID, size_t len, bool waitForSpace) const; |
Jason Sams | c61346b | 2010-05-28 18:23:22 -0700 | [diff] [blame] | 149 | uint32_t runScript(Script *s); |
Jason Sams | 8c401ef | 2009-10-06 13:58:47 -0700 | [diff] [blame] | 150 | |
| 151 | void initToClient(); |
| 152 | void deinitToClient(); |
| 153 | |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 154 | ProgramFragment * getDefaultProgramFragment() const { |
| 155 | return mStateFragment.mDefault.get(); |
| 156 | } |
| 157 | ProgramVertex * getDefaultProgramVertex() const { |
| 158 | return mStateVertex.mDefault.get(); |
| 159 | } |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 160 | ProgramStore * getDefaultProgramStore() const { |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 161 | return mStateFragmentStore.mDefault.get(); |
| 162 | } |
Jason Sams | 5fd09d8 | 2009-09-23 13:57:02 -0700 | [diff] [blame] | 163 | ProgramRaster * getDefaultProgramRaster() const { |
| 164 | return mStateRaster.mDefault.get(); |
| 165 | } |
Alex Sakhartchouk | d3e0ad4 | 2010-06-24 17:15:34 -0700 | [diff] [blame] | 166 | Font* getDefaultFont() const { |
| 167 | return mStateFont.mDefault.get(); |
| 168 | } |
Jason Sams | 8ce125b | 2009-06-17 16:52:59 -0700 | [diff] [blame] | 169 | |
Jason Sams | 771565f | 2010-05-14 15:30:29 -0700 | [diff] [blame] | 170 | uint32_t getWidth() const {return mWidth;} |
| 171 | uint32_t getHeight() const {return mHeight;} |
Jason Sams | e579df4 | 2009-08-10 14:55:26 -0700 | [diff] [blame] | 172 | |
Jason Sams | 87319de | 2010-11-22 16:20:16 -0800 | [diff] [blame] | 173 | mutable ThreadIO mIO; |
Jason Sams | fcd3192 | 2009-08-17 18:35:48 -0700 | [diff] [blame] | 174 | |
Jason Sams | 24371d9 | 2009-08-19 12:17:14 -0700 | [diff] [blame] | 175 | // Timers |
| 176 | enum Timers { |
| 177 | RS_TIMER_IDLE, |
| 178 | RS_TIMER_INTERNAL, |
| 179 | RS_TIMER_SCRIPT, |
| 180 | RS_TIMER_CLEAR_SWAP, |
| 181 | _RS_TIMER_TOTAL |
| 182 | }; |
| 183 | uint64_t getTime() const; |
| 184 | void timerInit(); |
| 185 | void timerReset(); |
| 186 | void timerSet(Timers); |
| 187 | void timerPrint(); |
Jason Sams | 1d54f10 | 2009-09-03 15:43:13 -0700 | [diff] [blame] | 188 | void timerFrame(); |
Jason Sams | 24371d9 | 2009-08-19 12:17:14 -0700 | [diff] [blame] | 189 | |
Jason Sams | 1fddd90 | 2009-09-25 15:25:00 -0700 | [diff] [blame] | 190 | struct { |
| 191 | bool mLogTimes; |
| 192 | bool mLogScripts; |
| 193 | bool mLogObjects; |
Jason Sams | cd50653 | 2009-12-15 19:10:11 -0800 | [diff] [blame] | 194 | bool mLogShaders; |
Alex Sakhartchouk | 886f11a | 2010-09-29 09:49:13 -0700 | [diff] [blame] | 195 | bool mLogShadersAttr; |
| 196 | bool mLogShadersUniforms; |
Alex Sakhartchouk | 0cae59f | 2010-08-03 12:03:16 -0700 | [diff] [blame] | 197 | bool mLogVisual; |
Jason Sams | 1fddd90 | 2009-09-25 15:25:00 -0700 | [diff] [blame] | 198 | } props; |
Joe Onorato | 76371ff | 2009-09-23 16:37:36 -0700 | [diff] [blame] | 199 | |
Jason Sams | 13e2634 | 2009-11-24 12:26:35 -0800 | [diff] [blame] | 200 | void dumpDebug() const; |
Jason Sams | 87319de | 2010-11-22 16:20:16 -0800 | [diff] [blame] | 201 | void setError(RsError e, const char *msg = NULL) const; |
Jason Sams | 13e2634 | 2009-11-24 12:26:35 -0800 | [diff] [blame] | 202 | |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 203 | mutable const ObjectBase * mObjHead; |
| 204 | |
Alex Sakhartchouk | 7b3e9bd | 2011-03-16 19:28:25 -0700 | [diff] [blame] | 205 | uint32_t getDPI() const {return mDPI;} |
| 206 | void setDPI(uint32_t dpi) {mDPI = dpi;} |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 207 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 208 | Device *mDev; |
Jason Sams | 4b3de47 | 2011-04-06 17:52:23 -0700 | [diff] [blame] | 209 | protected: |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 210 | |
Alex Sakhartchouk | 7b3e9bd | 2011-03-16 19:28:25 -0700 | [diff] [blame] | 211 | uint32_t mDPI; |
Jason Sams | 613cad1 | 2009-11-12 15:10:25 -0800 | [diff] [blame] | 212 | uint32_t mWidth; |
| 213 | uint32_t mHeight; |
Jason Sams | 2dca84d | 2009-12-09 11:05:45 -0800 | [diff] [blame] | 214 | int32_t mThreadPriority; |
Jason Sams | 4820e8b | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 215 | bool mIsGraphicsContext; |
Jason Sams | 613cad1 | 2009-11-12 15:10:25 -0800 | [diff] [blame] | 216 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 217 | bool mRunning; |
| 218 | bool mExit; |
Jason Sams | 86f1b23 | 2009-09-24 17:38:20 -0700 | [diff] [blame] | 219 | bool mPaused; |
Jason Sams | 87319de | 2010-11-22 16:20:16 -0800 | [diff] [blame] | 220 | mutable RsError mError; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 221 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 222 | pthread_t mThreadId; |
Jason Sams | 1583244 | 2009-11-15 12:14:26 -0800 | [diff] [blame] | 223 | pid_t mNativeThreadId; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 224 | |
| 225 | ObjectBaseRef<Script> mRootScript; |
| 226 | ObjectBaseRef<ProgramFragment> mFragment; |
| 227 | ObjectBaseRef<ProgramVertex> mVertex; |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 228 | ObjectBaseRef<ProgramStore> mFragmentStore; |
Jason Sams | 5fd09d8 | 2009-09-23 13:57:02 -0700 | [diff] [blame] | 229 | ObjectBaseRef<ProgramRaster> mRaster; |
Alex Sakhartchouk | d3e0ad4 | 2010-06-24 17:15:34 -0700 | [diff] [blame] | 230 | ObjectBaseRef<Font> mFont; |
Jason Sams | 5086938 | 2009-08-18 17:07:09 -0700 | [diff] [blame] | 231 | |
Alex Sakhartchouk | 0cae59f | 2010-08-03 12:03:16 -0700 | [diff] [blame] | 232 | void displayDebugStats(); |
| 233 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 234 | private: |
| 235 | Context(); |
Jason Sams | 5c1c79a | 2010-11-03 14:27:11 -0700 | [diff] [blame] | 236 | bool initContext(Device *, const RsSurfaceConfig *sc); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 237 | |
Jason Sams | 5c1c79a | 2010-11-03 14:27:11 -0700 | [diff] [blame] | 238 | |
| 239 | bool initGLThread(); |
Jason Sams | 33b6e3b | 2009-10-27 14:44:31 -0700 | [diff] [blame] | 240 | void deinitEGL(); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 241 | |
Jason Sams | 2dca84d | 2009-12-09 11:05:45 -0800 | [diff] [blame] | 242 | uint32_t runRootScript(); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 243 | |
| 244 | static void * threadProc(void *); |
Jason Sams | 7bf29dd | 2010-07-19 15:38:19 -0700 | [diff] [blame] | 245 | static void * helperThreadProc(void *); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 246 | |
Dianne Hackborn | 1c769c3 | 2010-06-30 13:56:17 -0700 | [diff] [blame] | 247 | ANativeWindow *mWndSurface; |
Jason Sams | a0a1b6f | 2009-06-10 15:04:38 -0700 | [diff] [blame] | 248 | |
| 249 | Vector<ObjectBase *> mNames; |
Jason Sams | 24371d9 | 2009-08-19 12:17:14 -0700 | [diff] [blame] | 250 | |
| 251 | uint64_t mTimers[_RS_TIMER_TOTAL]; |
| 252 | Timers mTimerActive; |
| 253 | uint64_t mTimeLast; |
Jason Sams | 1d54f10 | 2009-09-03 15:43:13 -0700 | [diff] [blame] | 254 | uint64_t mTimeFrame; |
| 255 | uint64_t mTimeLastFrame; |
Jason Sams | 2dca84d | 2009-12-09 11:05:45 -0800 | [diff] [blame] | 256 | uint32_t mTimeMSLastFrame; |
| 257 | uint32_t mTimeMSLastScript; |
| 258 | uint32_t mTimeMSLastSwap; |
Alex Sakhartchouk | c8fb69e | 2010-10-05 13:23:55 -0700 | [diff] [blame] | 259 | uint32_t mAverageFPSFrameCount; |
| 260 | uint64_t mAverageFPSStartTime; |
| 261 | uint32_t mAverageFPS; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 262 | }; |
| 263 | |
Alex Sakhartchouk | 77d9f4b | 2011-01-31 14:53:24 -0800 | [diff] [blame] | 264 | #else |
| 265 | |
| 266 | class Context { |
| 267 | public: |
| 268 | Context() { |
| 269 | mObjHead = NULL; |
| 270 | } |
| 271 | ~Context() { |
| 272 | ObjectBase::zeroAllUserRef(this); |
| 273 | } |
| 274 | |
| 275 | ElementState mStateElement; |
| 276 | TypeState mStateType; |
| 277 | |
| 278 | struct { |
| 279 | bool mLogTimes; |
| 280 | bool mLogScripts; |
| 281 | bool mLogObjects; |
| 282 | bool mLogShaders; |
| 283 | bool mLogShadersAttr; |
| 284 | bool mLogShadersUniforms; |
| 285 | bool mLogVisual; |
| 286 | } props; |
| 287 | |
| 288 | void setError(RsError e, const char *msg = NULL) { } |
| 289 | |
| 290 | mutable const ObjectBase * mObjHead; |
| 291 | |
| 292 | protected: |
| 293 | |
| 294 | }; |
| 295 | #endif //ANDROID_RS_SERIALIZE |
| 296 | |
| 297 | } // renderscript |
| 298 | } // android |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 299 | #endif |