robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2012 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | |
| 10 | #include "gl/GrGLInterface.h" |
robertphillips@google.com | dd743fe | 2012-04-05 14:40:53 +0000 | [diff] [blame] | 11 | #include "GrDebugGL.h" |
| 12 | #include "GrShaderObj.h" |
| 13 | #include "GrProgramObj.h" |
| 14 | #include "GrBufferObj.h" |
| 15 | #include "GrTextureUnitObj.h" |
| 16 | #include "GrTextureObj.h" |
| 17 | #include "GrFrameBufferObj.h" |
| 18 | #include "GrRenderBufferObj.h" |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 19 | #include "GrVertexArrayObj.h" |
robertphillips@google.com | 670ff9a | 2012-04-12 19:53:31 +0000 | [diff] [blame] | 20 | #include "SkFloatingPoint.h" |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 21 | #include "../GrGLNoOpInterface.h" |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 22 | |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 23 | namespace { // suppress no previous prototype warning |
caryclark@google.com | cf6285b | 2012-06-06 12:09:01 +0000 | [diff] [blame] | 24 | |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 25 | //////////////////////////////////////////////////////////////////////////////// |
robertphillips@google.com | f6f123d | 2012-03-21 17:57:55 +0000 | [diff] [blame] | 26 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLActiveTexture(GrGLenum texture) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 27 | |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 28 | // Ganesh offsets the texture unit indices |
| 29 | texture -= GR_GL_TEXTURE0; |
| 30 | GrAlwaysAssert(texture < GrDebugGL::getInstance()->getMaxTextureUnits()); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 31 | |
| 32 | GrDebugGL::getInstance()->setCurTextureUnit(texture); |
| 33 | } |
| 34 | |
| 35 | //////////////////////////////////////////////////////////////////////////////// |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 36 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLAttachShader(GrGLuint programID, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 37 | GrGLuint shaderID) { |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 38 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 39 | GrProgramObj *program = GR_FIND(programID, GrProgramObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 40 | GrDebugGL::kProgram_ObjTypes); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 41 | GrAlwaysAssert(program); |
| 42 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 43 | GrShaderObj *shader = GR_FIND(shaderID, |
| 44 | GrShaderObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 45 | GrDebugGL::kShader_ObjTypes); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 46 | GrAlwaysAssert(shader); |
| 47 | |
| 48 | program->AttachShader(shader); |
| 49 | } |
| 50 | |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 51 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLBeginQuery(GrGLenum target, GrGLuint id) { |
| 52 | } |
| 53 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 54 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindAttribLocation(GrGLuint program, |
| 55 | GrGLuint index, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 56 | const char* name) { |
| 57 | } |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 58 | |
| 59 | //////////////////////////////////////////////////////////////////////////////// |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 60 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindTexture(GrGLenum target, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 61 | GrGLuint textureID) { |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 62 | |
| 63 | // we don't use cube maps |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 64 | GrAlwaysAssert(target == GR_GL_TEXTURE_2D); |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 65 | // || target == GR_GL_TEXTURE_CUBE_MAP); |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 66 | |
| 67 | // a textureID of 0 is acceptable - it binds to the default texture target |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 68 | GrTextureObj *texture = GR_FIND(textureID, GrTextureObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 69 | GrDebugGL::kTexture_ObjTypes); |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 70 | |
| 71 | GrDebugGL::getInstance()->setTexture(texture); |
| 72 | } |
| 73 | |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 74 | |
| 75 | //////////////////////////////////////////////////////////////////////////////// |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 76 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLBufferData(GrGLenum target, |
| 77 | GrGLsizeiptr size, |
| 78 | const GrGLvoid* data, |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 79 | GrGLenum usage) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 80 | GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 81 | GR_GL_ELEMENT_ARRAY_BUFFER == target); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 82 | GrAlwaysAssert(size >= 0); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 83 | GrAlwaysAssert(GR_GL_STREAM_DRAW == usage || |
| 84 | GR_GL_STATIC_DRAW == usage || |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 85 | GR_GL_DYNAMIC_DRAW == usage); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 86 | |
| 87 | GrBufferObj *buffer = NULL; |
| 88 | switch (target) { |
| 89 | case GR_GL_ARRAY_BUFFER: |
| 90 | buffer = GrDebugGL::getInstance()->getArrayBuffer(); |
| 91 | break; |
| 92 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 93 | buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); |
| 94 | break; |
| 95 | default: |
| 96 | GrCrash("Unexpected target to glBufferData"); |
| 97 | break; |
| 98 | } |
| 99 | |
| 100 | GrAlwaysAssert(buffer); |
| 101 | GrAlwaysAssert(buffer->getBound()); |
| 102 | |
robertphillips@google.com | f6f123d | 2012-03-21 17:57:55 +0000 | [diff] [blame] | 103 | buffer->allocate(size, reinterpret_cast<const GrGLchar *>(data)); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 104 | buffer->setUsage(usage); |
| 105 | } |
| 106 | |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 107 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 108 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLPixelStorei(GrGLenum pname, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 109 | GrGLint param) { |
robertphillips@google.com | 670ff9a | 2012-04-12 19:53:31 +0000 | [diff] [blame] | 110 | |
| 111 | switch (pname) { |
| 112 | case GR_GL_UNPACK_ROW_LENGTH: |
| 113 | GrDebugGL::getInstance()->setUnPackRowLength(param); |
| 114 | break; |
| 115 | case GR_GL_PACK_ROW_LENGTH: |
| 116 | GrDebugGL::getInstance()->setPackRowLength(param); |
| 117 | break; |
| 118 | case GR_GL_UNPACK_ALIGNMENT: |
| 119 | break; |
| 120 | case GR_GL_PACK_ALIGNMENT: |
| 121 | GrAlwaysAssert(false); |
| 122 | break; |
| 123 | default: |
| 124 | GrAlwaysAssert(false); |
| 125 | break; |
| 126 | } |
| 127 | } |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 128 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 129 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLReadPixels(GrGLint x, |
| 130 | GrGLint y, |
| 131 | GrGLsizei width, |
| 132 | GrGLsizei height, |
| 133 | GrGLenum format, |
| 134 | GrGLenum type, |
robertphillips@google.com | 670ff9a | 2012-04-12 19:53:31 +0000 | [diff] [blame] | 135 | GrGLvoid* pixels) { |
| 136 | |
| 137 | GrGLint pixelsInRow = width; |
| 138 | if (0 < GrDebugGL::getInstance()->getPackRowLength()) { |
| 139 | pixelsInRow = GrDebugGL::getInstance()->getPackRowLength(); |
| 140 | } |
| 141 | |
| 142 | GrGLint componentsPerPixel = 0; |
| 143 | |
| 144 | switch (format) { |
| 145 | case GR_GL_RGBA: |
| 146 | // fallthrough |
| 147 | case GR_GL_BGRA: |
| 148 | componentsPerPixel = 4; |
| 149 | break; |
| 150 | case GR_GL_RGB: |
| 151 | componentsPerPixel = 3; |
| 152 | break; |
robertphillips@google.com | d32369e | 2012-05-30 14:46:10 +0000 | [diff] [blame] | 153 | case GR_GL_RED: |
| 154 | componentsPerPixel = 1; |
| 155 | break; |
robertphillips@google.com | 670ff9a | 2012-04-12 19:53:31 +0000 | [diff] [blame] | 156 | default: |
| 157 | GrAlwaysAssert(false); |
| 158 | break; |
| 159 | } |
| 160 | |
| 161 | GrGLint alignment = 4; // the pack alignment (one of 1, 2, 4 or 8) |
| 162 | // Ganesh currently doesn't support setting GR_GL_PACK_ALIGNMENT |
| 163 | |
| 164 | GrGLint componentSize = 0; // size (in bytes) of a single component |
| 165 | |
| 166 | switch (type) { |
| 167 | case GR_GL_UNSIGNED_BYTE: |
| 168 | componentSize = 1; |
| 169 | break; |
| 170 | default: |
| 171 | GrAlwaysAssert(false); |
| 172 | break; |
| 173 | } |
| 174 | |
| 175 | GrGLint rowStride = 0; // number of components (not bytes) to skip |
| 176 | if (componentSize >= alignment) { |
| 177 | rowStride = componentsPerPixel * pixelsInRow; |
| 178 | } else { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 179 | float fTemp = |
| 180 | sk_float_ceil(componentSize * componentsPerPixel * pixelsInRow / |
robertphillips@google.com | 670ff9a | 2012-04-12 19:53:31 +0000 | [diff] [blame] | 181 | static_cast<float>(alignment)); |
| 182 | rowStride = static_cast<GrGLint>(alignment * fTemp / componentSize); |
| 183 | } |
| 184 | |
| 185 | GrGLchar *scanline = static_cast<GrGLchar *>(pixels); |
| 186 | for (int y = 0; y < height; ++y) { |
| 187 | memset(scanline, 0, componentsPerPixel * componentSize * width); |
| 188 | scanline += rowStride; |
| 189 | } |
| 190 | } |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 191 | |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 192 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLUseProgram(GrGLuint programID) { |
| 193 | |
| 194 | // A programID of 0 is legal |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 195 | GrProgramObj *program = GR_FIND(programID, |
| 196 | GrProgramObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 197 | GrDebugGL::kProgram_ObjTypes); |
| 198 | |
| 199 | GrDebugGL::getInstance()->useProgram(program); |
| 200 | } |
| 201 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 202 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindFramebuffer(GrGLenum target, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 203 | GrGLuint frameBufferID) { |
| 204 | |
| 205 | GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); |
| 206 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 207 | // a frameBufferID of 0 is acceptable - it binds to the default |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 208 | // frame buffer |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 209 | GrFrameBufferObj *frameBuffer = GR_FIND(frameBufferID, |
| 210 | GrFrameBufferObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 211 | GrDebugGL::kFrameBuffer_ObjTypes); |
| 212 | |
| 213 | GrDebugGL::getInstance()->setFrameBuffer(frameBuffer); |
| 214 | } |
| 215 | |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 216 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindRenderbuffer(GrGLenum target, GrGLuint renderBufferID) { |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 217 | |
| 218 | GrAlwaysAssert(GR_GL_RENDERBUFFER == target); |
| 219 | |
| 220 | // a renderBufferID of 0 is acceptable - it unbinds the bound render buffer |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 221 | GrRenderBufferObj *renderBuffer = GR_FIND(renderBufferID, |
| 222 | GrRenderBufferObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 223 | GrDebugGL::kRenderBuffer_ObjTypes); |
| 224 | |
| 225 | GrDebugGL::getInstance()->setRenderBuffer(renderBuffer); |
| 226 | } |
| 227 | |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 228 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteTextures(GrGLsizei n, const GrGLuint* textures) { |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 229 | |
| 230 | // first potentially unbind the texture |
| 231 | // TODO: move this into GrDebugGL as unBindTexture? |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 232 | for (unsigned int i = 0; |
| 233 | i < GrDebugGL::getInstance()->getMaxTextureUnits(); |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 234 | ++i) { |
| 235 | GrTextureUnitObj *pTU = GrDebugGL::getInstance()->getTextureUnit(i); |
| 236 | |
| 237 | if (pTU->getTexture()) { |
| 238 | for (int j = 0; j < n; ++j) { |
| 239 | |
| 240 | if (textures[j] == pTU->getTexture()->getID()) { |
| 241 | // this ID is the current texture - revert the binding to 0 |
| 242 | pTU->setTexture(NULL); |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | // TODO: fuse the following block with DeleteRenderBuffers? |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 249 | // Open GL will remove a deleted render buffer from the active |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 250 | // frame buffer but not from any other frame buffer |
| 251 | if (GrDebugGL::getInstance()->getFrameBuffer()) { |
| 252 | |
| 253 | GrFrameBufferObj *frameBuffer = GrDebugGL::getInstance()->getFrameBuffer(); |
| 254 | |
| 255 | for (int i = 0; i < n; ++i) { |
| 256 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 257 | if (NULL != frameBuffer->getColor() && |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 258 | textures[i] == frameBuffer->getColor()->getID()) { |
| 259 | frameBuffer->setColor(NULL); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 260 | } |
| 261 | if (NULL != frameBuffer->getDepth() && |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 262 | textures[i] == frameBuffer->getDepth()->getID()) { |
| 263 | frameBuffer->setDepth(NULL); |
| 264 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 265 | if (NULL != frameBuffer->getStencil() && |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 266 | textures[i] == frameBuffer->getStencil()->getID()) { |
| 267 | frameBuffer->setStencil(NULL); |
| 268 | } |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | // then actually "delete" the buffers |
| 273 | for (int i = 0; i < n; ++i) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 274 | GrTextureObj *buffer = GR_FIND(textures[i], |
| 275 | GrTextureObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 276 | GrDebugGL::kTexture_ObjTypes); |
| 277 | GrAlwaysAssert(buffer); |
| 278 | |
| 279 | // OpenGL gives no guarantees if a texture is deleted while attached to |
| 280 | // something other than the currently bound frame buffer |
| 281 | GrAlwaysAssert(!buffer->getBound()); |
| 282 | |
| 283 | GrAlwaysAssert(!buffer->getDeleted()); |
| 284 | buffer->deleteAction(); |
| 285 | } |
| 286 | |
| 287 | } |
| 288 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 289 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteFramebuffers(GrGLsizei n, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 290 | const GrGLuint *frameBuffers) { |
| 291 | |
| 292 | // first potentially unbind the buffers |
| 293 | if (GrDebugGL::getInstance()->getFrameBuffer()) { |
| 294 | for (int i = 0; i < n; ++i) { |
| 295 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 296 | if (frameBuffers[i] == |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 297 | GrDebugGL::getInstance()->getFrameBuffer()->getID()) { |
| 298 | // this ID is the current frame buffer - rebind to the default |
| 299 | GrDebugGL::getInstance()->setFrameBuffer(NULL); |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | // then actually "delete" the buffers |
| 305 | for (int i = 0; i < n; ++i) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 306 | GrFrameBufferObj *buffer = GR_FIND(frameBuffers[i], |
| 307 | GrFrameBufferObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 308 | GrDebugGL::kFrameBuffer_ObjTypes); |
| 309 | GrAlwaysAssert(buffer); |
| 310 | |
| 311 | GrAlwaysAssert(!buffer->getDeleted()); |
| 312 | buffer->deleteAction(); |
| 313 | } |
| 314 | } |
| 315 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 316 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteRenderbuffers(GrGLsizei n, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 317 | const GrGLuint *renderBuffers) { |
| 318 | |
| 319 | // first potentially unbind the buffers |
| 320 | if (GrDebugGL::getInstance()->getRenderBuffer()) { |
| 321 | for (int i = 0; i < n; ++i) { |
| 322 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 323 | if (renderBuffers[i] == |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 324 | GrDebugGL::getInstance()->getRenderBuffer()->getID()) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 325 | // this ID is the current render buffer - make no |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 326 | // render buffer be bound |
| 327 | GrDebugGL::getInstance()->setRenderBuffer(NULL); |
| 328 | } |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | // TODO: fuse the following block with DeleteTextures? |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 333 | // Open GL will remove a deleted render buffer from the active frame |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 334 | // buffer but not from any other frame buffer |
| 335 | if (GrDebugGL::getInstance()->getFrameBuffer()) { |
| 336 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 337 | GrFrameBufferObj *frameBuffer = |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 338 | GrDebugGL::getInstance()->getFrameBuffer(); |
| 339 | |
| 340 | for (int i = 0; i < n; ++i) { |
| 341 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 342 | if (NULL != frameBuffer->getColor() && |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 343 | renderBuffers[i] == frameBuffer->getColor()->getID()) { |
| 344 | frameBuffer->setColor(NULL); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 345 | } |
| 346 | if (NULL != frameBuffer->getDepth() && |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 347 | renderBuffers[i] == frameBuffer->getDepth()->getID()) { |
| 348 | frameBuffer->setDepth(NULL); |
| 349 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 350 | if (NULL != frameBuffer->getStencil() && |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 351 | renderBuffers[i] == frameBuffer->getStencil()->getID()) { |
| 352 | frameBuffer->setStencil(NULL); |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | // then actually "delete" the buffers |
| 358 | for (int i = 0; i < n; ++i) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 359 | GrRenderBufferObj *buffer = GR_FIND(renderBuffers[i], |
| 360 | GrRenderBufferObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 361 | GrDebugGL::kRenderBuffer_ObjTypes); |
| 362 | GrAlwaysAssert(buffer); |
| 363 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 364 | // OpenGL gives no guarantees if a render buffer is deleted |
| 365 | // while attached to something other than the currently |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 366 | // bound frame buffer |
| 367 | GrAlwaysAssert(!buffer->getColorBound()); |
| 368 | GrAlwaysAssert(!buffer->getDepthBound()); |
| 369 | GrAlwaysAssert(!buffer->getStencilBound()); |
| 370 | |
| 371 | GrAlwaysAssert(!buffer->getDeleted()); |
| 372 | buffer->deleteAction(); |
| 373 | } |
| 374 | } |
| 375 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 376 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLFramebufferRenderbuffer(GrGLenum target, |
| 377 | GrGLenum attachment, |
| 378 | GrGLenum renderbuffertarget, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 379 | GrGLuint renderBufferID) { |
| 380 | |
| 381 | GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 382 | GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || |
| 383 | GR_GL_DEPTH_ATTACHMENT == attachment || |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 384 | GR_GL_STENCIL_ATTACHMENT == attachment); |
| 385 | GrAlwaysAssert(GR_GL_RENDERBUFFER == renderbuffertarget); |
| 386 | |
| 387 | GrFrameBufferObj *framebuffer = GrDebugGL::getInstance()->getFrameBuffer(); |
| 388 | // A render buffer cannot be attached to the default framebuffer |
| 389 | GrAlwaysAssert(NULL != framebuffer); |
| 390 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 391 | // a renderBufferID of 0 is acceptable - it unbinds the current |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 392 | // render buffer |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 393 | GrRenderBufferObj *renderbuffer = GR_FIND(renderBufferID, |
| 394 | GrRenderBufferObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 395 | GrDebugGL::kRenderBuffer_ObjTypes); |
| 396 | |
| 397 | switch (attachment) { |
| 398 | case GR_GL_COLOR_ATTACHMENT0: |
| 399 | framebuffer->setColor(renderbuffer); |
| 400 | break; |
| 401 | case GR_GL_DEPTH_ATTACHMENT: |
| 402 | framebuffer->setDepth(renderbuffer); |
| 403 | break; |
| 404 | case GR_GL_STENCIL_ATTACHMENT: |
| 405 | framebuffer->setStencil(renderbuffer); |
| 406 | break; |
| 407 | default: |
| 408 | GrAlwaysAssert(false); |
| 409 | break; |
| 410 | }; |
| 411 | |
| 412 | } |
| 413 | |
| 414 | //////////////////////////////////////////////////////////////////////////////// |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 415 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLFramebufferTexture2D(GrGLenum target, |
| 416 | GrGLenum attachment, |
| 417 | GrGLenum textarget, |
| 418 | GrGLuint textureID, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 419 | GrGLint level) { |
| 420 | |
| 421 | GrAlwaysAssert(GR_GL_FRAMEBUFFER == target); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 422 | GrAlwaysAssert(GR_GL_COLOR_ATTACHMENT0 == attachment || |
| 423 | GR_GL_DEPTH_ATTACHMENT == attachment || |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 424 | GR_GL_STENCIL_ATTACHMENT == attachment); |
| 425 | GrAlwaysAssert(GR_GL_TEXTURE_2D == textarget); |
| 426 | |
| 427 | GrFrameBufferObj *framebuffer = GrDebugGL::getInstance()->getFrameBuffer(); |
| 428 | // A texture cannot be attached to the default framebuffer |
| 429 | GrAlwaysAssert(NULL != framebuffer); |
| 430 | |
| 431 | // A textureID of 0 is allowed - it unbinds the currently bound texture |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 432 | GrTextureObj *texture = GR_FIND(textureID, GrTextureObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 433 | GrDebugGL::kTexture_ObjTypes); |
| 434 | if (texture) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 435 | // The texture shouldn't be bound to a texture unit - this |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 436 | // could lead to a feedback loop |
| 437 | GrAlwaysAssert(!texture->getBound()); |
| 438 | } |
| 439 | |
| 440 | GrAlwaysAssert(0 == level); |
| 441 | |
| 442 | switch (attachment) { |
| 443 | case GR_GL_COLOR_ATTACHMENT0: |
| 444 | framebuffer->setColor(texture); |
| 445 | break; |
| 446 | case GR_GL_DEPTH_ATTACHMENT: |
| 447 | framebuffer->setDepth(texture); |
| 448 | break; |
| 449 | case GR_GL_STENCIL_ATTACHMENT: |
| 450 | framebuffer->setStencil(texture); |
| 451 | break; |
| 452 | default: |
| 453 | GrAlwaysAssert(false); |
| 454 | break; |
| 455 | }; |
| 456 | } |
| 457 | |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 458 | GrGLuint GR_GL_FUNCTION_TYPE debugGLCreateProgram() { |
| 459 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 460 | GrProgramObj *program = GR_CREATE(GrProgramObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 461 | GrDebugGL::kProgram_ObjTypes); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 462 | |
| 463 | return program->getID(); |
| 464 | } |
| 465 | |
| 466 | GrGLuint GR_GL_FUNCTION_TYPE debugGLCreateShader(GrGLenum type) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 467 | |
| 468 | GrAlwaysAssert(GR_GL_VERTEX_SHADER == type || |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 469 | GR_GL_FRAGMENT_SHADER == type); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 470 | |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 471 | GrShaderObj *shader = GR_CREATE(GrShaderObj, GrDebugGL::kShader_ObjTypes); |
| 472 | shader->setType(type); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 473 | |
| 474 | return shader->getID(); |
| 475 | } |
| 476 | |
| 477 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteProgram(GrGLuint programID) { |
| 478 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 479 | GrProgramObj *program = GR_FIND(programID, |
| 480 | GrProgramObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 481 | GrDebugGL::kProgram_ObjTypes); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 482 | GrAlwaysAssert(program); |
| 483 | |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 484 | if (program->getRefCount()) { |
| 485 | // someone is still using this program so we can't delete it here |
| 486 | program->setMarkedForDeletion(); |
| 487 | } else { |
| 488 | program->deleteAction(); |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteShader(GrGLuint shaderID) { |
| 493 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 494 | GrShaderObj *shader = GR_FIND(shaderID, |
| 495 | GrShaderObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 496 | GrDebugGL::kShader_ObjTypes); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 497 | GrAlwaysAssert(shader); |
| 498 | |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 499 | if (shader->getRefCount()) { |
| 500 | // someone is still using this shader so we can't delete it here |
| 501 | shader->setMarkedForDeletion(); |
| 502 | } else { |
| 503 | shader->deleteAction(); |
| 504 | } |
| 505 | } |
| 506 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 507 | GrGLvoid debugGenObjs(GrDebugGL::GrObjTypes type, |
| 508 | GrGLsizei n, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 509 | GrGLuint* ids) { |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 510 | |
| 511 | for (int i = 0; i < n; ++i) { |
| 512 | GrFakeRefObj *obj = GrDebugGL::getInstance()->createObj(type); |
| 513 | GrAlwaysAssert(obj); |
| 514 | ids[i] = obj->getID(); |
| 515 | } |
| 516 | } |
| 517 | |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 518 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenBuffers(GrGLsizei n, GrGLuint* ids) { |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 519 | debugGenObjs(GrDebugGL::kBuffer_ObjTypes, n, ids); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 520 | } |
| 521 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 522 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenFramebuffers(GrGLsizei n, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 523 | GrGLuint* ids) { |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 524 | debugGenObjs(GrDebugGL::kFrameBuffer_ObjTypes, n, ids); |
robertphillips@google.com | f6f123d | 2012-03-21 17:57:55 +0000 | [diff] [blame] | 525 | } |
| 526 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 527 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenRenderbuffers(GrGLsizei n, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 528 | GrGLuint* ids) { |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 529 | debugGenObjs(GrDebugGL::kRenderBuffer_ObjTypes, n, ids); |
| 530 | } |
| 531 | |
| 532 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenTextures(GrGLsizei n, GrGLuint* ids) { |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 533 | debugGenObjs(GrDebugGL::kTexture_ObjTypes, n, ids); |
robertphillips@google.com | 7c95942 | 2012-03-22 20:43:56 +0000 | [diff] [blame] | 534 | } |
| 535 | |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 536 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLGenVertexArrays(GrGLsizei n, GrGLuint* ids) { |
| 537 | debugGenObjs(GrDebugGL::kVertexArray_ObjTypes, n, ids); |
| 538 | } |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 539 | |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 540 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteVertexArrays(GrGLsizei n, const GrGLuint* ids) { |
| 541 | for (GrGLsizei i = 0; i < n; ++i) { |
| 542 | GrVertexArrayObj* array = |
| 543 | GR_FIND(ids[i], GrVertexArrayObj, GrDebugGL::kVertexArray_ObjTypes); |
| 544 | GrAlwaysAssert(array); |
| 545 | |
| 546 | // Deleting the current vertex array binds object 0 |
| 547 | if (GrDebugGL::getInstance()->getVertexArray() == array) { |
| 548 | GrDebugGL::getInstance()->setVertexArray(NULL); |
| 549 | } |
| 550 | |
| 551 | if (array->getRefCount()) { |
| 552 | // someone is still using this vertex array so we can't delete it here |
| 553 | array->setMarkedForDeletion(); |
| 554 | } else { |
| 555 | array->deleteAction(); |
| 556 | } |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindVertexArray(GrGLuint id) { |
| 561 | GrVertexArrayObj* array = GR_FIND(id, GrVertexArrayObj, GrDebugGL::kVertexArray_ObjTypes); |
bsalomon@google.com | 6918d48 | 2013-03-07 19:09:11 +0000 | [diff] [blame^] | 562 | GrAlwaysAssert((0 == id) || NULL != array); |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 563 | GrDebugGL::getInstance()->setVertexArray(array); |
| 564 | } |
| 565 | |
| 566 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLBindBuffer(GrGLenum target, GrGLuint bufferID) { |
| 567 | GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || GR_GL_ELEMENT_ARRAY_BUFFER == target); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 568 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 569 | GrBufferObj *buffer = GR_FIND(bufferID, |
| 570 | GrBufferObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 571 | GrDebugGL::kBuffer_ObjTypes); |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 572 | // 0 is a permissible bufferID - it unbinds the current buffer |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 573 | |
| 574 | switch (target) { |
| 575 | case GR_GL_ARRAY_BUFFER: |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 576 | GrDebugGL::getInstance()->setArrayBuffer(buffer); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 577 | break; |
| 578 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 579 | GrDebugGL::getInstance()->setElementArrayBuffer(buffer); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 580 | break; |
| 581 | default: |
| 582 | GrCrash("Unexpected target to glBindBuffer"); |
| 583 | break; |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | // deleting a bound buffer has the side effect of binding 0 |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 588 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, const GrGLuint* ids) { |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 589 | // first potentially unbind the buffers |
| 590 | for (int i = 0; i < n; ++i) { |
| 591 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 592 | if (GrDebugGL::getInstance()->getArrayBuffer() && |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 593 | ids[i] == GrDebugGL::getInstance()->getArrayBuffer()->getID()) { |
| 594 | // this ID is the current array buffer |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 595 | GrDebugGL::getInstance()->setArrayBuffer(NULL); |
| 596 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 597 | if (GrDebugGL::getInstance()->getElementArrayBuffer() && |
| 598 | ids[i] == |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 599 | GrDebugGL::getInstance()->getElementArrayBuffer()->getID()) { |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 600 | // this ID is the current element array buffer |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 601 | GrDebugGL::getInstance()->setElementArrayBuffer(NULL); |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | // then actually "delete" the buffers |
| 606 | for (int i = 0; i < n; ++i) { |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 607 | GrBufferObj *buffer = GR_FIND(ids[i], |
| 608 | GrBufferObj, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 609 | GrDebugGL::kBuffer_ObjTypes); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 610 | GrAlwaysAssert(buffer); |
| 611 | |
| 612 | GrAlwaysAssert(!buffer->getDeleted()); |
| 613 | buffer->deleteAction(); |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | // map a buffer to the caller's address space |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 618 | GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, GrGLenum access) { |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 619 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 620 | GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 621 | GR_GL_ELEMENT_ARRAY_BUFFER == target); |
| 622 | // GR_GL_READ_ONLY == access || || GR_GL_READ_WRIT == access); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 623 | GrAlwaysAssert(GR_GL_WRITE_ONLY == access); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 624 | |
| 625 | GrBufferObj *buffer = NULL; |
| 626 | switch (target) { |
| 627 | case GR_GL_ARRAY_BUFFER: |
| 628 | buffer = GrDebugGL::getInstance()->getArrayBuffer(); |
| 629 | break; |
| 630 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 631 | buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); |
| 632 | break; |
| 633 | default: |
| 634 | GrCrash("Unexpected target to glMapBuffer"); |
| 635 | break; |
| 636 | } |
| 637 | |
| 638 | if (buffer) { |
| 639 | GrAlwaysAssert(!buffer->getMapped()); |
| 640 | buffer->setMapped(); |
| 641 | return buffer->getDataPtr(); |
| 642 | } |
| 643 | |
| 644 | GrAlwaysAssert(false); |
| 645 | return NULL; // no buffer bound to the target |
| 646 | } |
| 647 | |
| 648 | // remove a buffer from the caller's address space |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 649 | // TODO: check if the "access" method from "glMapBuffer" was honored |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 650 | GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) { |
| 651 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 652 | GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 653 | GR_GL_ELEMENT_ARRAY_BUFFER == target); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 654 | |
| 655 | GrBufferObj *buffer = NULL; |
| 656 | switch (target) { |
| 657 | case GR_GL_ARRAY_BUFFER: |
| 658 | buffer = GrDebugGL::getInstance()->getArrayBuffer(); |
| 659 | break; |
| 660 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 661 | buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); |
| 662 | break; |
| 663 | default: |
| 664 | GrCrash("Unexpected target to glUnmapBuffer"); |
| 665 | break; |
| 666 | } |
| 667 | |
| 668 | if (buffer) { |
| 669 | GrAlwaysAssert(buffer->getMapped()); |
| 670 | buffer->resetMapped(); |
| 671 | return GR_GL_TRUE; |
| 672 | } |
| 673 | |
| 674 | GrAlwaysAssert(false); |
| 675 | return GR_GL_FALSE; // GR_GL_INVALID_OPERATION; |
| 676 | } |
| 677 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 678 | GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target, |
| 679 | GrGLenum value, |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 680 | GrGLint* params) { |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 681 | |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 682 | GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 683 | GR_GL_ELEMENT_ARRAY_BUFFER == target); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 684 | GrAlwaysAssert(GR_GL_BUFFER_SIZE == value || |
robertphillips@google.com | ebde3e0 | 2012-07-13 17:45:17 +0000 | [diff] [blame] | 685 | GR_GL_BUFFER_USAGE == value); |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 686 | |
| 687 | GrBufferObj *buffer = NULL; |
| 688 | switch (target) { |
| 689 | case GR_GL_ARRAY_BUFFER: |
| 690 | buffer = GrDebugGL::getInstance()->getArrayBuffer(); |
| 691 | break; |
| 692 | case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 693 | buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 694 | break; |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 695 | } |
| 696 | |
| 697 | GrAlwaysAssert(buffer); |
| 698 | |
| 699 | switch (value) { |
| 700 | case GR_GL_BUFFER_MAPPED: |
| 701 | *params = GR_GL_FALSE; |
| 702 | if (buffer) |
| 703 | *params = buffer->getMapped() ? GR_GL_TRUE : GR_GL_FALSE; |
| 704 | break; |
| 705 | case GR_GL_BUFFER_SIZE: |
| 706 | *params = 0; |
| 707 | if (buffer) |
| 708 | *params = buffer->getSize(); |
| 709 | break; |
| 710 | case GR_GL_BUFFER_USAGE: |
| 711 | *params = GR_GL_STATIC_DRAW; |
| 712 | if (buffer) |
| 713 | *params = buffer->getUsage(); |
| 714 | break; |
| 715 | default: |
| 716 | GrCrash("Unexpected value to glGetBufferParamateriv"); |
| 717 | break; |
| 718 | } |
| 719 | }; |
caryclark@google.com | cf6285b | 2012-06-06 12:09:01 +0000 | [diff] [blame] | 720 | } // end of namespace |
| 721 | |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 722 | //////////////////////////////////////////////////////////////////////////////// |
| 723 | struct GrDebugGLInterface : public GrGLInterface { |
| 724 | |
| 725 | public: |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 726 | SK_DECLARE_INST_COUNT(GrDebugGLInterface) |
| 727 | |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 728 | GrDebugGLInterface() |
| 729 | : fWrapped(NULL) { |
robertphillips@google.com | 622a170 | 2012-07-31 19:23:02 +0000 | [diff] [blame] | 730 | GrDebugGL::staticRef(); |
| 731 | } |
| 732 | |
| 733 | virtual ~GrDebugGLInterface() { |
| 734 | GrDebugGL::staticUnRef(); |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 735 | } |
| 736 | |
| 737 | void setWrapped(GrGLInterface *interface) { |
| 738 | fWrapped.reset(interface); |
| 739 | } |
| 740 | |
| 741 | // TODO: there are some issues w/ wrapping another GL interface inside the |
| 742 | // debug interface: |
| 743 | // Since none of the "gl" methods are member functions they don't get |
| 744 | // a "this" pointer through which to access "fWrapped" |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 745 | // This could be worked around by having all of them access the |
| 746 | // "glInterface" pointer - i.e., treating the debug interface as a |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 747 | // true singleton |
| 748 | // |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 749 | // The problem with this is that we also want to handle OpenGL |
| 750 | // contexts. The natural way to do this is to have multiple debug |
| 751 | // interfaces. Each of which represents a separate context. The |
| 752 | // static ID count would still uniquify IDs across all of them. |
| 753 | // The problem then is that we couldn't treat the debug GL |
| 754 | // interface as a singleton (since there would be one for each |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 755 | // context). |
| 756 | // |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 757 | // The solution to this is probably to alter SkDebugGlContext's |
| 758 | // "makeCurrent" method to make a call like "makeCurrent(this)" to |
| 759 | // the debug GL interface (assuming that the application will create |
robertphillips@google.com | 6177e69 | 2013-02-28 20:16:25 +0000 | [diff] [blame] | 760 | // multiple SkGLContextHelper's) to let it switch between the active |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 761 | // context. Everything in the GrDebugGL object would then need to be |
| 762 | // moved to a GrContextObj and the GrDebugGL object would just switch |
| 763 | // between them. Note that this approach would also require that |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 764 | // SkDebugGLContext wrap an arbitrary other context |
| 765 | // and then pass the wrapped interface to the debug GL interface. |
| 766 | |
| 767 | protected: |
| 768 | private: |
| 769 | |
| 770 | SkAutoTUnref<GrGLInterface> fWrapped; |
| 771 | |
| 772 | typedef GrGLInterface INHERITED; |
| 773 | }; |
| 774 | |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 775 | SK_DEFINE_INST_COUNT(GrDebugGLInterface) |
| 776 | |
robertphillips@google.com | ba0cc3e | 2012-03-26 17:58:35 +0000 | [diff] [blame] | 777 | //////////////////////////////////////////////////////////////////////////////// |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 778 | const GrGLInterface* GrGLCreateDebugInterface() { |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 779 | GrGLInterface* interface = SkNEW(GrDebugGLInterface); |
| 780 | |
| 781 | interface->fBindingsExported = kDesktop_GrGLBinding; |
| 782 | interface->fActiveTexture = debugGLActiveTexture; |
| 783 | interface->fAttachShader = debugGLAttachShader; |
| 784 | interface->fBeginQuery = debugGLBeginQuery; |
| 785 | interface->fBindAttribLocation = debugGLBindAttribLocation; |
| 786 | interface->fBindBuffer = debugGLBindBuffer; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 787 | interface->fBindFragDataLocation = noOpGLBindFragDataLocation; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 788 | interface->fBindTexture = debugGLBindTexture; |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 789 | interface->fBindVertexArray = debugGLBindVertexArray; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 790 | interface->fBlendColor = noOpGLBlendColor; |
| 791 | interface->fBlendFunc = noOpGLBlendFunc; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 792 | interface->fBufferData = debugGLBufferData; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 793 | interface->fBufferSubData = noOpGLBufferSubData; |
| 794 | interface->fClear = noOpGLClear; |
| 795 | interface->fClearColor = noOpGLClearColor; |
| 796 | interface->fClearStencil = noOpGLClearStencil; |
| 797 | interface->fColorMask = noOpGLColorMask; |
| 798 | interface->fCompileShader = noOpGLCompileShader; |
| 799 | interface->fCompressedTexImage2D = noOpGLCompressedTexImage2D; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 800 | interface->fCreateProgram = debugGLCreateProgram; |
| 801 | interface->fCreateShader = debugGLCreateShader; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 802 | interface->fCullFace = noOpGLCullFace; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 803 | interface->fDeleteBuffers = debugGLDeleteBuffers; |
| 804 | interface->fDeleteProgram = debugGLDeleteProgram; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 805 | interface->fDeleteQueries = noOpGLDeleteIds; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 806 | interface->fDeleteShader = debugGLDeleteShader; |
| 807 | interface->fDeleteTextures = debugGLDeleteTextures; |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 808 | interface->fDeleteVertexArrays = debugGLDeleteVertexArrays; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 809 | interface->fDepthMask = noOpGLDepthMask; |
| 810 | interface->fDisable = noOpGLDisable; |
| 811 | interface->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; |
| 812 | interface->fDrawArrays = noOpGLDrawArrays; |
| 813 | interface->fDrawBuffer = noOpGLDrawBuffer; |
| 814 | interface->fDrawBuffers = noOpGLDrawBuffers; |
| 815 | interface->fDrawElements = noOpGLDrawElements; |
| 816 | interface->fEnable = noOpGLEnable; |
| 817 | interface->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; |
| 818 | interface->fEndQuery = noOpGLEndQuery; |
| 819 | interface->fFinish = noOpGLFinish; |
| 820 | interface->fFlush = noOpGLFlush; |
| 821 | interface->fFrontFace = noOpGLFrontFace; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 822 | interface->fGenBuffers = debugGLGenBuffers; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 823 | interface->fGenQueries = noOpGLGenIds; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 824 | interface->fGenTextures = debugGLGenTextures; |
| 825 | interface->fGetBufferParameteriv = debugGLGetBufferParameteriv; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 826 | interface->fGetError = noOpGLGetError; |
| 827 | interface->fGetIntegerv = noOpGLGetIntegerv; |
| 828 | interface->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; |
| 829 | interface->fGetQueryObjectiv = noOpGLGetQueryObjectiv; |
| 830 | interface->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; |
| 831 | interface->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; |
| 832 | interface->fGetQueryiv = noOpGLGetQueryiv; |
| 833 | interface->fGetProgramInfoLog = noOpGLGetInfoLog; |
| 834 | interface->fGetProgramiv = noOpGLGetShaderOrProgramiv; |
| 835 | interface->fGetShaderInfoLog = noOpGLGetInfoLog; |
| 836 | interface->fGetShaderiv = noOpGLGetShaderOrProgramiv; |
| 837 | interface->fGetString = noOpGLGetString; |
bsalomon@google.com | 1744f97 | 2013-02-26 21:46:32 +0000 | [diff] [blame] | 838 | interface->fGetStringi = noOpGLGetStringi; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 839 | interface->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; |
| 840 | interface->fGetUniformLocation = noOpGLGetUniformLocation; |
bsalomon@google.com | ecd8484 | 2013-03-01 15:36:02 +0000 | [diff] [blame] | 841 | interface->fGenVertexArrays = debugGLGenVertexArrays; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 842 | interface->fLineWidth = noOpGLLineWidth; |
| 843 | interface->fLinkProgram = noOpGLLinkProgram; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 844 | interface->fPixelStorei = debugGLPixelStorei; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 845 | interface->fQueryCounter = noOpGLQueryCounter; |
| 846 | interface->fReadBuffer = noOpGLReadBuffer; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 847 | interface->fReadPixels = debugGLReadPixels; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 848 | interface->fScissor = noOpGLScissor; |
| 849 | interface->fShaderSource = noOpGLShaderSource; |
| 850 | interface->fStencilFunc = noOpGLStencilFunc; |
| 851 | interface->fStencilFuncSeparate = noOpGLStencilFuncSeparate; |
| 852 | interface->fStencilMask = noOpGLStencilMask; |
| 853 | interface->fStencilMaskSeparate = noOpGLStencilMaskSeparate; |
| 854 | interface->fStencilOp = noOpGLStencilOp; |
| 855 | interface->fStencilOpSeparate = noOpGLStencilOpSeparate; |
| 856 | interface->fTexImage2D = noOpGLTexImage2D; |
| 857 | interface->fTexParameteri = noOpGLTexParameteri; |
| 858 | interface->fTexParameteriv = noOpGLTexParameteriv; |
| 859 | interface->fTexSubImage2D = noOpGLTexSubImage2D; |
| 860 | interface->fTexStorage2D = noOpGLTexStorage2D; |
| 861 | interface->fUniform1f = noOpGLUniform1f; |
| 862 | interface->fUniform1i = noOpGLUniform1i; |
| 863 | interface->fUniform1fv = noOpGLUniform1fv; |
| 864 | interface->fUniform1iv = noOpGLUniform1iv; |
| 865 | interface->fUniform2f = noOpGLUniform2f; |
| 866 | interface->fUniform2i = noOpGLUniform2i; |
| 867 | interface->fUniform2fv = noOpGLUniform2fv; |
| 868 | interface->fUniform2iv = noOpGLUniform2iv; |
| 869 | interface->fUniform3f = noOpGLUniform3f; |
| 870 | interface->fUniform3i = noOpGLUniform3i; |
| 871 | interface->fUniform3fv = noOpGLUniform3fv; |
| 872 | interface->fUniform3iv = noOpGLUniform3iv; |
| 873 | interface->fUniform4f = noOpGLUniform4f; |
| 874 | interface->fUniform4i = noOpGLUniform4i; |
| 875 | interface->fUniform4fv = noOpGLUniform4fv; |
| 876 | interface->fUniform4iv = noOpGLUniform4iv; |
| 877 | interface->fUniformMatrix2fv = noOpGLUniformMatrix2fv; |
| 878 | interface->fUniformMatrix3fv = noOpGLUniformMatrix3fv; |
| 879 | interface->fUniformMatrix4fv = noOpGLUniformMatrix4fv; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 880 | interface->fUseProgram = debugGLUseProgram; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 881 | interface->fVertexAttrib4fv = noOpGLVertexAttrib4fv; |
| 882 | interface->fVertexAttribPointer = noOpGLVertexAttribPointer; |
| 883 | interface->fViewport = noOpGLViewport; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 884 | interface->fBindFramebuffer = debugGLBindFramebuffer; |
| 885 | interface->fBindRenderbuffer = debugGLBindRenderbuffer; |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 886 | interface->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 887 | interface->fDeleteFramebuffers = debugGLDeleteFramebuffers; |
| 888 | interface->fDeleteRenderbuffers = debugGLDeleteRenderbuffers; |
| 889 | interface->fFramebufferRenderbuffer = debugGLFramebufferRenderbuffer; |
| 890 | interface->fFramebufferTexture2D = debugGLFramebufferTexture2D; |
| 891 | interface->fGenFramebuffers = debugGLGenFramebuffers; |
| 892 | interface->fGenRenderbuffers = debugGLGenRenderbuffers; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 893 | interface->fGetFramebufferAttachmentParameteriv = |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 894 | noOpGLGetFramebufferAttachmentParameteriv; |
| 895 | interface->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv; |
| 896 | interface->fRenderbufferStorage = noOpGLRenderbufferStorage; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 897 | interface->fRenderbufferStorageMultisample = |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 898 | noOpGLRenderbufferStorageMultisample; |
| 899 | interface->fBlitFramebuffer = noOpGLBlitFramebuffer; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 900 | interface->fResolveMultisampleFramebuffer = |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 901 | noOpGLResolveMultisampleFramebuffer; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 902 | interface->fMapBuffer = debugGLMapBuffer; |
| 903 | interface->fUnmapBuffer = debugGLUnmapBuffer; |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 904 | interface->fBindFragDataLocationIndexed = |
bsalomon@google.com | 8f94361 | 2013-02-26 14:34:43 +0000 | [diff] [blame] | 905 | noOpGLBindFragDataLocationIndexed; |
robertphillips@google.com | 409566a | 2012-06-26 20:19:41 +0000 | [diff] [blame] | 906 | |
| 907 | return interface; |
robertphillips@google.com | 0da3719 | 2012-03-19 14:42:13 +0000 | [diff] [blame] | 908 | } |