| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef GrDebugGL_DEFINED | 9 #ifndef GrDebugGL_DEFINED |
| 10 #define GrDebugGL_DEFINED | 10 #define GrDebugGL_DEFINED |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 static void staticUnRef() { | 108 static void staticUnRef() { |
| 109 SkASSERT(gStaticRefCount > 0); | 109 SkASSERT(gStaticRefCount > 0); |
| 110 gStaticRefCount--; | 110 gStaticRefCount--; |
| 111 if (0 == gStaticRefCount) { | 111 if (0 == gStaticRefCount) { |
| 112 SkDELETE(gObj); | 112 SkDELETE(gObj); |
| 113 gObj = NULL; | 113 gObj = NULL; |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 static void abandon() { |
| 118 SkASSERT(gStaticRefCount > 0); |
| 119 gObj->fAbandoned = true; |
| 120 } |
| 121 |
| 117 protected: | 122 protected: |
| 118 | 123 |
| 119 private: | 124 private: |
| 120 // the OpenGLES 2.0 spec says this must be >= 2 | 125 // the OpenGLES 2.0 spec says this must be >= 2 |
| 121 static const GrGLint kDefaultMaxTextureUnits = 8; | 126 static const GrGLint kDefaultMaxTextureUnits = 8; |
| 122 | 127 |
| 123 GrGLint fPackRowLength; | 128 GrGLint fPackRowLength; |
| 124 GrGLint fUnPackRowLength; | 129 GrGLint fUnPackRowLength; |
| 125 GrGLuint fCurTextureUnit; | 130 GrGLuint fCurTextureUnit; |
| 126 GrBufferObj* fArrayBuffer; | 131 GrBufferObj* fArrayBuffer; |
| 127 GrBufferObj* fElementArrayBuffer; | 132 GrBufferObj* fElementArrayBuffer; |
| 128 GrFrameBufferObj* fFrameBuffer; | 133 GrFrameBufferObj* fFrameBuffer; |
| 129 GrRenderBufferObj* fRenderBuffer; | 134 GrRenderBufferObj* fRenderBuffer; |
| 130 GrProgramObj* fProgram; | 135 GrProgramObj* fProgram; |
| 131 GrTextureObj* fTexture; | 136 GrTextureObj* fTexture; |
| 132 GrTextureUnitObj *fTextureUnits[kDefaultMaxTextureUnits]; | 137 GrTextureUnitObj *fTextureUnits[kDefaultMaxTextureUnits]; |
| 133 GrVertexArrayObj *fVertexArray; | 138 GrVertexArrayObj *fVertexArray; |
| 134 | 139 |
| 140 bool fAbandoned; |
| 141 |
| 135 typedef GrFakeRefObj *(*Create)(); | 142 typedef GrFakeRefObj *(*Create)(); |
| 136 | 143 |
| 137 static Create gFactoryFunc[kObjTypeCount]; | 144 static Create gFactoryFunc[kObjTypeCount]; |
| 138 | 145 |
| 139 static GrDebugGL* gObj; | 146 static GrDebugGL* gObj; |
| 140 static int gStaticRefCount; | 147 static int gStaticRefCount; |
| 141 | 148 |
| 142 // global store of all objects | 149 // global store of all objects |
| 143 SkTArray<GrFakeRefObj *> fObjects; | 150 SkTArray<GrFakeRefObj *> fObjects; |
| 144 | 151 |
| 145 GrDebugGL(); | 152 GrDebugGL(); |
| 146 ~GrDebugGL(); | 153 ~GrDebugGL(); |
| 147 }; | 154 }; |
| 148 | 155 |
| 149 //////////////////////////////////////////////////////////////////////////////// | 156 //////////////////////////////////////////////////////////////////////////////// |
| 150 // Helper macro to make creating an object (where you need to get back a derived | 157 // Helper macro to make creating an object (where you need to get back a derived |
| 151 // type) easier | 158 // type) easier |
| 152 #define GR_CREATE(className, classEnum) \ | 159 #define GR_CREATE(className, classEnum) \ |
| 153 reinterpret_cast<className *>(GrDebugGL::getInstance()->createObj(classEnum)
) | 160 reinterpret_cast<className *>(GrDebugGL::getInstance()->createObj(classEnum)
) |
| 154 | 161 |
| 155 //////////////////////////////////////////////////////////////////////////////// | 162 //////////////////////////////////////////////////////////////////////////////// |
| 156 // Helper macro to make finding objects less painful | 163 // Helper macro to make finding objects less painful |
| 157 #define GR_FIND(id, className, classEnum) \ | 164 #define GR_FIND(id, className, classEnum) \ |
| 158 reinterpret_cast<className *>(GrDebugGL::getInstance()->findObject(id, class
Enum)) | 165 reinterpret_cast<className *>(GrDebugGL::getInstance()->findObject(id, class
Enum)) |
| 159 | 166 |
| 160 #endif // GrDebugGL_DEFINED | 167 #endif // GrDebugGL_DEFINED |
| OLD | NEW |