| 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 | 9 |
| 10 #include "gl/GrGLInterface.h" | 10 #include "gl/GrGLInterface.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 GrGLsizeiptr size, | 77 GrGLsizeiptr size, |
| 78 const GrGLvoid* data, | 78 const GrGLvoid* data, |
| 79 GrGLenum usage) { | 79 GrGLenum usage) { |
| 80 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || | 80 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
| 81 GR_GL_ELEMENT_ARRAY_BUFFER == target); | 81 GR_GL_ELEMENT_ARRAY_BUFFER == target); |
| 82 GrAlwaysAssert(size >= 0); | 82 GrAlwaysAssert(size >= 0); |
| 83 GrAlwaysAssert(GR_GL_STREAM_DRAW == usage || | 83 GrAlwaysAssert(GR_GL_STREAM_DRAW == usage || |
| 84 GR_GL_STATIC_DRAW == usage || | 84 GR_GL_STATIC_DRAW == usage || |
| 85 GR_GL_DYNAMIC_DRAW == usage); | 85 GR_GL_DYNAMIC_DRAW == usage); |
| 86 | 86 |
| 87 GrBufferObj *buffer = NULL; | 87 GrBufferObj *buffer = nullptr; |
| 88 switch (target) { | 88 switch (target) { |
| 89 case GR_GL_ARRAY_BUFFER: | 89 case GR_GL_ARRAY_BUFFER: |
| 90 buffer = GrDebugGL::getInstance()->getArrayBuffer(); | 90 buffer = GrDebugGL::getInstance()->getArrayBuffer(); |
| 91 break; | 91 break; |
| 92 case GR_GL_ELEMENT_ARRAY_BUFFER: | 92 case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 93 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); | 93 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); |
| 94 break; | 94 break; |
| 95 default: | 95 default: |
| 96 SkFAIL("Unexpected target to glBufferData"); | 96 SkFAIL("Unexpected target to glBufferData"); |
| 97 break; | 97 break; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 for (unsigned int i = 0; | 234 for (unsigned int i = 0; |
| 235 i < GrDebugGL::getInstance()->getMaxTextureUnits(); | 235 i < GrDebugGL::getInstance()->getMaxTextureUnits(); |
| 236 ++i) { | 236 ++i) { |
| 237 GrTextureUnitObj *pTU = GrDebugGL::getInstance()->getTextureUnit(i); | 237 GrTextureUnitObj *pTU = GrDebugGL::getInstance()->getTextureUnit(i); |
| 238 | 238 |
| 239 if (pTU->getTexture()) { | 239 if (pTU->getTexture()) { |
| 240 for (int j = 0; j < n; ++j) { | 240 for (int j = 0; j < n; ++j) { |
| 241 | 241 |
| 242 if (textures[j] == pTU->getTexture()->getID()) { | 242 if (textures[j] == pTU->getTexture()->getID()) { |
| 243 // this ID is the current texture - revert the binding to 0 | 243 // this ID is the current texture - revert the binding to 0 |
| 244 pTU->setTexture(NULL); | 244 pTU->setTexture(nullptr); |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 // TODO: fuse the following block with DeleteRenderBuffers? | 250 // TODO: fuse the following block with DeleteRenderBuffers? |
| 251 // Open GL will remove a deleted render buffer from the active | 251 // Open GL will remove a deleted render buffer from the active |
| 252 // frame buffer but not from any other frame buffer | 252 // frame buffer but not from any other frame buffer |
| 253 if (GrDebugGL::getInstance()->getFrameBuffer()) { | 253 if (GrDebugGL::getInstance()->getFrameBuffer()) { |
| 254 | 254 |
| 255 GrFrameBufferObj *frameBuffer = GrDebugGL::getInstance()->getFrameBuffe
r(); | 255 GrFrameBufferObj *frameBuffer = GrDebugGL::getInstance()->getFrameBuffe
r(); |
| 256 | 256 |
| 257 for (int i = 0; i < n; ++i) { | 257 for (int i = 0; i < n; ++i) { |
| 258 | 258 |
| 259 if (frameBuffer->getColor() && | 259 if (frameBuffer->getColor() && |
| 260 textures[i] == frameBuffer->getColor()->getID()) { | 260 textures[i] == frameBuffer->getColor()->getID()) { |
| 261 frameBuffer->setColor(NULL); | 261 frameBuffer->setColor(nullptr); |
| 262 } | 262 } |
| 263 if (frameBuffer->getDepth() && | 263 if (frameBuffer->getDepth() && |
| 264 textures[i] == frameBuffer->getDepth()->getID()) { | 264 textures[i] == frameBuffer->getDepth()->getID()) { |
| 265 frameBuffer->setDepth(NULL); | 265 frameBuffer->setDepth(nullptr); |
| 266 } | 266 } |
| 267 if (frameBuffer->getStencil() && | 267 if (frameBuffer->getStencil() && |
| 268 textures[i] == frameBuffer->getStencil()->getID()) { | 268 textures[i] == frameBuffer->getStencil()->getID()) { |
| 269 frameBuffer->setStencil(NULL); | 269 frameBuffer->setStencil(nullptr); |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 | 273 |
| 274 // then actually "delete" the buffers | 274 // then actually "delete" the buffers |
| 275 for (int i = 0; i < n; ++i) { | 275 for (int i = 0; i < n; ++i) { |
| 276 GrTextureObj *buffer = GR_FIND(textures[i], | 276 GrTextureObj *buffer = GR_FIND(textures[i], |
| 277 GrTextureObj, | 277 GrTextureObj, |
| 278 GrDebugGL::kTexture_ObjTypes); | 278 GrDebugGL::kTexture_ObjTypes); |
| 279 GrAlwaysAssert(buffer); | 279 GrAlwaysAssert(buffer); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 291 GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteFramebuffers(GrGLsizei n, | 291 GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteFramebuffers(GrGLsizei n, |
| 292 const GrGLuint *frameBuf
fers) { | 292 const GrGLuint *frameBuf
fers) { |
| 293 | 293 |
| 294 // first potentially unbind the buffers | 294 // first potentially unbind the buffers |
| 295 if (GrDebugGL::getInstance()->getFrameBuffer()) { | 295 if (GrDebugGL::getInstance()->getFrameBuffer()) { |
| 296 for (int i = 0; i < n; ++i) { | 296 for (int i = 0; i < n; ++i) { |
| 297 | 297 |
| 298 if (frameBuffers[i] == | 298 if (frameBuffers[i] == |
| 299 GrDebugGL::getInstance()->getFrameBuffer()->getID()) { | 299 GrDebugGL::getInstance()->getFrameBuffer()->getID()) { |
| 300 // this ID is the current frame buffer - rebind to the default | 300 // this ID is the current frame buffer - rebind to the default |
| 301 GrDebugGL::getInstance()->setFrameBuffer(NULL); | 301 GrDebugGL::getInstance()->setFrameBuffer(nullptr); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 // then actually "delete" the buffers | 306 // then actually "delete" the buffers |
| 307 for (int i = 0; i < n; ++i) { | 307 for (int i = 0; i < n; ++i) { |
| 308 GrFrameBufferObj *buffer = GR_FIND(frameBuffers[i], | 308 GrFrameBufferObj *buffer = GR_FIND(frameBuffers[i], |
| 309 GrFrameBufferObj, | 309 GrFrameBufferObj, |
| 310 GrDebugGL::kFrameBuffer_ObjTypes); | 310 GrDebugGL::kFrameBuffer_ObjTypes); |
| 311 GrAlwaysAssert(buffer); | 311 GrAlwaysAssert(buffer); |
| 312 | 312 |
| 313 GrAlwaysAssert(!buffer->getDeleted()); | 313 GrAlwaysAssert(!buffer->getDeleted()); |
| 314 buffer->deleteAction(); | 314 buffer->deleteAction(); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteRenderbuffers(GrGLsizei n, | 318 GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteRenderbuffers(GrGLsizei n, |
| 319 const GrGLuint *renderB
uffers) { | 319 const GrGLuint *renderB
uffers) { |
| 320 | 320 |
| 321 // first potentially unbind the buffers | 321 // first potentially unbind the buffers |
| 322 if (GrDebugGL::getInstance()->getRenderBuffer()) { | 322 if (GrDebugGL::getInstance()->getRenderBuffer()) { |
| 323 for (int i = 0; i < n; ++i) { | 323 for (int i = 0; i < n; ++i) { |
| 324 | 324 |
| 325 if (renderBuffers[i] == | 325 if (renderBuffers[i] == |
| 326 GrDebugGL::getInstance()->getRenderBuffer()->getID()) { | 326 GrDebugGL::getInstance()->getRenderBuffer()->getID()) { |
| 327 // this ID is the current render buffer - make no | 327 // this ID is the current render buffer - make no |
| 328 // render buffer be bound | 328 // render buffer be bound |
| 329 GrDebugGL::getInstance()->setRenderBuffer(NULL); | 329 GrDebugGL::getInstance()->setRenderBuffer(nullptr); |
| 330 } | 330 } |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 | 333 |
| 334 // TODO: fuse the following block with DeleteTextures? | 334 // TODO: fuse the following block with DeleteTextures? |
| 335 // Open GL will remove a deleted render buffer from the active frame | 335 // Open GL will remove a deleted render buffer from the active frame |
| 336 // buffer but not from any other frame buffer | 336 // buffer but not from any other frame buffer |
| 337 if (GrDebugGL::getInstance()->getFrameBuffer()) { | 337 if (GrDebugGL::getInstance()->getFrameBuffer()) { |
| 338 | 338 |
| 339 GrFrameBufferObj *frameBuffer = | 339 GrFrameBufferObj *frameBuffer = |
| 340 GrDebugGL::getInstance()->getFrameBuffer(); | 340 GrDebugGL::getInstance()->getFrameBuffer(); |
| 341 | 341 |
| 342 for (int i = 0; i < n; ++i) { | 342 for (int i = 0; i < n; ++i) { |
| 343 | 343 |
| 344 if (frameBuffer->getColor() && | 344 if (frameBuffer->getColor() && |
| 345 renderBuffers[i] == frameBuffer->getColor()->getID()) { | 345 renderBuffers[i] == frameBuffer->getColor()->getID()) { |
| 346 frameBuffer->setColor(NULL); | 346 frameBuffer->setColor(nullptr); |
| 347 } | 347 } |
| 348 if (frameBuffer->getDepth() && | 348 if (frameBuffer->getDepth() && |
| 349 renderBuffers[i] == frameBuffer->getDepth()->getID()) { | 349 renderBuffers[i] == frameBuffer->getDepth()->getID()) { |
| 350 frameBuffer->setDepth(NULL); | 350 frameBuffer->setDepth(nullptr); |
| 351 } | 351 } |
| 352 if (frameBuffer->getStencil() && | 352 if (frameBuffer->getStencil() && |
| 353 renderBuffers[i] == frameBuffer->getStencil()->getID()) { | 353 renderBuffers[i] == frameBuffer->getStencil()->getID()) { |
| 354 frameBuffer->setStencil(NULL); | 354 frameBuffer->setStencil(nullptr); |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 | 358 |
| 359 // then actually "delete" the buffers | 359 // then actually "delete" the buffers |
| 360 for (int i = 0; i < n; ++i) { | 360 for (int i = 0; i < n; ++i) { |
| 361 GrRenderBufferObj *buffer = GR_FIND(renderBuffers[i], | 361 GrRenderBufferObj *buffer = GR_FIND(renderBuffers[i], |
| 362 GrRenderBufferObj, | 362 GrRenderBufferObj, |
| 363 GrDebugGL::kRenderBuffer_ObjTypes); | 363 GrDebugGL::kRenderBuffer_ObjTypes); |
| 364 GrAlwaysAssert(buffer); | 364 GrAlwaysAssert(buffer); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 } | 545 } |
| 546 | 546 |
| 547 GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteVertexArrays(GrGLsizei n, const GrGLui
nt* ids) { | 547 GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteVertexArrays(GrGLsizei n, const GrGLui
nt* ids) { |
| 548 for (GrGLsizei i = 0; i < n; ++i) { | 548 for (GrGLsizei i = 0; i < n; ++i) { |
| 549 GrVertexArrayObj* array = | 549 GrVertexArrayObj* array = |
| 550 GR_FIND(ids[i], GrVertexArrayObj, GrDebugGL::kVertexArray_ObjTypes); | 550 GR_FIND(ids[i], GrVertexArrayObj, GrDebugGL::kVertexArray_ObjTypes); |
| 551 GrAlwaysAssert(array); | 551 GrAlwaysAssert(array); |
| 552 | 552 |
| 553 // Deleting the current vertex array binds object 0 | 553 // Deleting the current vertex array binds object 0 |
| 554 if (GrDebugGL::getInstance()->getVertexArray() == array) { | 554 if (GrDebugGL::getInstance()->getVertexArray() == array) { |
| 555 GrDebugGL::getInstance()->setVertexArray(NULL); | 555 GrDebugGL::getInstance()->setVertexArray(nullptr); |
| 556 } | 556 } |
| 557 | 557 |
| 558 if (array->getRefCount()) { | 558 if (array->getRefCount()) { |
| 559 // someone is still using this vertex array so we can't delete it he
re | 559 // someone is still using this vertex array so we can't delete it he
re |
| 560 array->setMarkedForDeletion(); | 560 array->setMarkedForDeletion(); |
| 561 } else { | 561 } else { |
| 562 array->deleteAction(); | 562 array->deleteAction(); |
| 563 } | 563 } |
| 564 } | 564 } |
| 565 } | 565 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 592 } | 592 } |
| 593 | 593 |
| 594 // deleting a bound buffer has the side effect of binding 0 | 594 // deleting a bound buffer has the side effect of binding 0 |
| 595 GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, const GrGLuint* i
ds) { | 595 GrGLvoid GR_GL_FUNCTION_TYPE debugGLDeleteBuffers(GrGLsizei n, const GrGLuint* i
ds) { |
| 596 // first potentially unbind the buffers | 596 // first potentially unbind the buffers |
| 597 for (int i = 0; i < n; ++i) { | 597 for (int i = 0; i < n; ++i) { |
| 598 | 598 |
| 599 if (GrDebugGL::getInstance()->getArrayBuffer() && | 599 if (GrDebugGL::getInstance()->getArrayBuffer() && |
| 600 ids[i] == GrDebugGL::getInstance()->getArrayBuffer()->getID()) { | 600 ids[i] == GrDebugGL::getInstance()->getArrayBuffer()->getID()) { |
| 601 // this ID is the current array buffer | 601 // this ID is the current array buffer |
| 602 GrDebugGL::getInstance()->setArrayBuffer(NULL); | 602 GrDebugGL::getInstance()->setArrayBuffer(nullptr); |
| 603 } | 603 } |
| 604 if (GrDebugGL::getInstance()->getElementArrayBuffer() && | 604 if (GrDebugGL::getInstance()->getElementArrayBuffer() && |
| 605 ids[i] == | 605 ids[i] == |
| 606 GrDebugGL::getInstance()->getElementArrayBuffer()->getID()) { | 606 GrDebugGL::getInstance()->getElementArrayBuffer()->getID()) { |
| 607 // this ID is the current element array buffer | 607 // this ID is the current element array buffer |
| 608 GrDebugGL::getInstance()->setElementArrayBuffer(NULL); | 608 GrDebugGL::getInstance()->setElementArrayBuffer(nullptr); |
| 609 } | 609 } |
| 610 } | 610 } |
| 611 | 611 |
| 612 // then actually "delete" the buffers | 612 // then actually "delete" the buffers |
| 613 for (int i = 0; i < n; ++i) { | 613 for (int i = 0; i < n; ++i) { |
| 614 GrBufferObj *buffer = GR_FIND(ids[i], | 614 GrBufferObj *buffer = GR_FIND(ids[i], |
| 615 GrBufferObj, | 615 GrBufferObj, |
| 616 GrDebugGL::kBuffer_ObjTypes); | 616 GrDebugGL::kBuffer_ObjTypes); |
| 617 GrAlwaysAssert(buffer); | 617 GrAlwaysAssert(buffer); |
| 618 | 618 |
| 619 GrAlwaysAssert(!buffer->getDeleted()); | 619 GrAlwaysAssert(!buffer->getDeleted()); |
| 620 buffer->deleteAction(); | 620 buffer->deleteAction(); |
| 621 } | 621 } |
| 622 } | 622 } |
| 623 | 623 |
| 624 // map a buffer to the caller's address space | 624 // map a buffer to the caller's address space |
| 625 GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBufferRange(GrGLenum target, GrGLintptr
offset, | 625 GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBufferRange(GrGLenum target, GrGLintptr
offset, |
| 626 GrGLsizeiptr length, GrGLbit
field access) { | 626 GrGLsizeiptr length, GrGLbit
field access) { |
| 627 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || | 627 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
| 628 GR_GL_ELEMENT_ARRAY_BUFFER == target); | 628 GR_GL_ELEMENT_ARRAY_BUFFER == target); |
| 629 | 629 |
| 630 // We only expect read access and we expect that the buffer or range is alwa
ys invalidated. | 630 // We only expect read access and we expect that the buffer or range is alwa
ys invalidated. |
| 631 GrAlwaysAssert(!SkToBool(GR_GL_MAP_READ_BIT & access)); | 631 GrAlwaysAssert(!SkToBool(GR_GL_MAP_READ_BIT & access)); |
| 632 GrAlwaysAssert((GR_GL_MAP_INVALIDATE_BUFFER_BIT | GR_GL_MAP_INVALIDATE_RANGE
_BIT) & access); | 632 GrAlwaysAssert((GR_GL_MAP_INVALIDATE_BUFFER_BIT | GR_GL_MAP_INVALIDATE_RANGE
_BIT) & access); |
| 633 | 633 |
| 634 GrBufferObj *buffer = NULL; | 634 GrBufferObj *buffer = nullptr; |
| 635 switch (target) { | 635 switch (target) { |
| 636 case GR_GL_ARRAY_BUFFER: | 636 case GR_GL_ARRAY_BUFFER: |
| 637 buffer = GrDebugGL::getInstance()->getArrayBuffer(); | 637 buffer = GrDebugGL::getInstance()->getArrayBuffer(); |
| 638 break; | 638 break; |
| 639 case GR_GL_ELEMENT_ARRAY_BUFFER: | 639 case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 640 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); | 640 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); |
| 641 break; | 641 break; |
| 642 default: | 642 default: |
| 643 SkFAIL("Unexpected target to glMapBufferRange"); | 643 SkFAIL("Unexpected target to glMapBufferRange"); |
| 644 break; | 644 break; |
| 645 } | 645 } |
| 646 | 646 |
| 647 if (buffer) { | 647 if (buffer) { |
| 648 GrAlwaysAssert(offset >= 0 && offset + length <= buffer->getSize()); | 648 GrAlwaysAssert(offset >= 0 && offset + length <= buffer->getSize()); |
| 649 GrAlwaysAssert(!buffer->getMapped()); | 649 GrAlwaysAssert(!buffer->getMapped()); |
| 650 buffer->setMapped(offset, length); | 650 buffer->setMapped(offset, length); |
| 651 return buffer->getDataPtr() + offset; | 651 return buffer->getDataPtr() + offset; |
| 652 } | 652 } |
| 653 | 653 |
| 654 GrAlwaysAssert(false); | 654 GrAlwaysAssert(false); |
| 655 return NULL; // no buffer bound to the target | 655 return nullptr; // no buffer bound to the target |
| 656 } | 656 } |
| 657 | 657 |
| 658 GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, GrGLenum access)
{ | 658 GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, GrGLenum access)
{ |
| 659 GrAlwaysAssert(GR_GL_WRITE_ONLY == access); | 659 GrAlwaysAssert(GR_GL_WRITE_ONLY == access); |
| 660 | 660 |
| 661 GrBufferObj *buffer = NULL; | 661 GrBufferObj *buffer = nullptr; |
| 662 switch (target) { | 662 switch (target) { |
| 663 case GR_GL_ARRAY_BUFFER: | 663 case GR_GL_ARRAY_BUFFER: |
| 664 buffer = GrDebugGL::getInstance()->getArrayBuffer(); | 664 buffer = GrDebugGL::getInstance()->getArrayBuffer(); |
| 665 break; | 665 break; |
| 666 case GR_GL_ELEMENT_ARRAY_BUFFER: | 666 case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 667 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); | 667 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); |
| 668 break; | 668 break; |
| 669 default: | 669 default: |
| 670 SkFAIL("Unexpected target to glMapBuffer"); | 670 SkFAIL("Unexpected target to glMapBuffer"); |
| 671 break; | 671 break; |
| 672 } | 672 } |
| 673 | 673 |
| 674 return debugGLMapBufferRange(target, 0, buffer->getSize(), | 674 return debugGLMapBufferRange(target, 0, buffer->getSize(), |
| 675 GR_GL_MAP_WRITE_BIT | GR_GL_MAP_INVALIDATE_BUFF
ER_BIT); | 675 GR_GL_MAP_WRITE_BIT | GR_GL_MAP_INVALIDATE_BUFF
ER_BIT); |
| 676 } | 676 } |
| 677 | 677 |
| 678 // remove a buffer from the caller's address space | 678 // remove a buffer from the caller's address space |
| 679 // TODO: check if the "access" method from "glMapBuffer" was honored | 679 // TODO: check if the "access" method from "glMapBuffer" was honored |
| 680 GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) { | 680 GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) { |
| 681 | 681 |
| 682 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || | 682 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
| 683 GR_GL_ELEMENT_ARRAY_BUFFER == target); | 683 GR_GL_ELEMENT_ARRAY_BUFFER == target); |
| 684 | 684 |
| 685 GrBufferObj *buffer = NULL; | 685 GrBufferObj *buffer = nullptr; |
| 686 switch (target) { | 686 switch (target) { |
| 687 case GR_GL_ARRAY_BUFFER: | 687 case GR_GL_ARRAY_BUFFER: |
| 688 buffer = GrDebugGL::getInstance()->getArrayBuffer(); | 688 buffer = GrDebugGL::getInstance()->getArrayBuffer(); |
| 689 break; | 689 break; |
| 690 case GR_GL_ELEMENT_ARRAY_BUFFER: | 690 case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 691 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); | 691 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); |
| 692 break; | 692 break; |
| 693 default: | 693 default: |
| 694 SkFAIL("Unexpected target to glUnmapBuffer"); | 694 SkFAIL("Unexpected target to glUnmapBuffer"); |
| 695 break; | 695 break; |
| 696 } | 696 } |
| 697 | 697 |
| 698 if (buffer) { | 698 if (buffer) { |
| 699 GrAlwaysAssert(buffer->getMapped()); | 699 GrAlwaysAssert(buffer->getMapped()); |
| 700 buffer->resetMapped(); | 700 buffer->resetMapped(); |
| 701 return GR_GL_TRUE; | 701 return GR_GL_TRUE; |
| 702 } | 702 } |
| 703 | 703 |
| 704 GrAlwaysAssert(false); | 704 GrAlwaysAssert(false); |
| 705 return GR_GL_FALSE; // GR_GL_INVALID_OPERATION; | 705 return GR_GL_FALSE; // GR_GL_INVALID_OPERATION; |
| 706 } | 706 } |
| 707 | 707 |
| 708 GrGLvoid GR_GL_FUNCTION_TYPE debugGLFlushMappedBufferRange(GrGLenum target, | 708 GrGLvoid GR_GL_FUNCTION_TYPE debugGLFlushMappedBufferRange(GrGLenum target, |
| 709 GrGLintptr offset, | 709 GrGLintptr offset, |
| 710 GrGLsizeiptr length)
{ | 710 GrGLsizeiptr length)
{ |
| 711 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || | 711 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
| 712 GR_GL_ELEMENT_ARRAY_BUFFER == target); | 712 GR_GL_ELEMENT_ARRAY_BUFFER == target); |
| 713 | 713 |
| 714 GrBufferObj *buffer = NULL; | 714 GrBufferObj *buffer = nullptr; |
| 715 switch (target) { | 715 switch (target) { |
| 716 case GR_GL_ARRAY_BUFFER: | 716 case GR_GL_ARRAY_BUFFER: |
| 717 buffer = GrDebugGL::getInstance()->getArrayBuffer(); | 717 buffer = GrDebugGL::getInstance()->getArrayBuffer(); |
| 718 break; | 718 break; |
| 719 case GR_GL_ELEMENT_ARRAY_BUFFER: | 719 case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 720 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); | 720 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); |
| 721 break; | 721 break; |
| 722 default: | 722 default: |
| 723 SkFAIL("Unexpected target to glUnmapBuffer"); | 723 SkFAIL("Unexpected target to glUnmapBuffer"); |
| 724 break; | 724 break; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 735 | 735 |
| 736 GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target, | 736 GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target, |
| 737 GrGLenum value, | 737 GrGLenum value, |
| 738 GrGLint* params) { | 738 GrGLint* params) { |
| 739 | 739 |
| 740 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || | 740 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || |
| 741 GR_GL_ELEMENT_ARRAY_BUFFER == target); | 741 GR_GL_ELEMENT_ARRAY_BUFFER == target); |
| 742 GrAlwaysAssert(GR_GL_BUFFER_SIZE == value || | 742 GrAlwaysAssert(GR_GL_BUFFER_SIZE == value || |
| 743 GR_GL_BUFFER_USAGE == value); | 743 GR_GL_BUFFER_USAGE == value); |
| 744 | 744 |
| 745 GrBufferObj *buffer = NULL; | 745 GrBufferObj *buffer = nullptr; |
| 746 switch (target) { | 746 switch (target) { |
| 747 case GR_GL_ARRAY_BUFFER: | 747 case GR_GL_ARRAY_BUFFER: |
| 748 buffer = GrDebugGL::getInstance()->getArrayBuffer(); | 748 buffer = GrDebugGL::getInstance()->getArrayBuffer(); |
| 749 break; | 749 break; |
| 750 case GR_GL_ELEMENT_ARRAY_BUFFER: | 750 case GR_GL_ELEMENT_ARRAY_BUFFER: |
| 751 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); | 751 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); |
| 752 break; | 752 break; |
| 753 } | 753 } |
| 754 | 754 |
| 755 GrAlwaysAssert(buffer); | 755 GrAlwaysAssert(buffer); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 777 }; | 777 }; |
| 778 } // end of namespace | 778 } // end of namespace |
| 779 | 779 |
| 780 //////////////////////////////////////////////////////////////////////////////// | 780 //////////////////////////////////////////////////////////////////////////////// |
| 781 struct GrDebugGLInterface : public GrGLInterface { | 781 struct GrDebugGLInterface : public GrGLInterface { |
| 782 | 782 |
| 783 public: | 783 public: |
| 784 | 784 |
| 785 | 785 |
| 786 GrDebugGLInterface() | 786 GrDebugGLInterface() |
| 787 : fWrapped(NULL) { | 787 : fWrapped(nullptr) { |
| 788 GrDebugGL::staticRef(); | 788 GrDebugGL::staticRef(); |
| 789 } | 789 } |
| 790 | 790 |
| 791 virtual ~GrDebugGLInterface() { | 791 virtual ~GrDebugGLInterface() { |
| 792 GrDebugGL::staticUnRef(); | 792 GrDebugGL::staticUnRef(); |
| 793 } | 793 } |
| 794 | 794 |
| 795 void setWrapped(GrGLInterface *interface) { | 795 void setWrapped(GrGLInterface *interface) { |
| 796 fWrapped.reset(interface); | 796 fWrapped.reset(interface); |
| 797 } | 797 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity; | 980 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity; |
| 981 | 981 |
| 982 functions->fBindFragDataLocationIndexed = | 982 functions->fBindFragDataLocationIndexed = |
| 983 noOpGLBindFragDataLocationIndexed; | 983 noOpGLBindFragDataLocationIndexed; |
| 984 | 984 |
| 985 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio
ns->fGetStringi, | 985 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio
ns->fGetStringi, |
| 986 functions->fGetIntegerv); | 986 functions->fGetIntegerv); |
| 987 | 987 |
| 988 return interface; | 988 return interface; |
| 989 } | 989 } |
| OLD | NEW |