Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2062)

Side by Side Diff: src/gpu/gl/debug/GrGLCreateDebugInterface.cpp

Issue 257393004: Convert GrCrash->SkFAIL GrDebugCrash->SkDEBUGFAIL (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: whitespace change Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« include/core/SkTypes.h ('K') | « src/gpu/gl/GrGpuGL_program.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 GrBufferObj *buffer = NULL; 87 GrBufferObj *buffer = NULL;
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 GrCrash("Unexpected target to glBufferData"); 96 SkFAIL("Unexpected target to glBufferData");
97 break; 97 break;
98 } 98 }
99 99
100 GrAlwaysAssert(buffer); 100 GrAlwaysAssert(buffer);
101 GrAlwaysAssert(buffer->getBound()); 101 GrAlwaysAssert(buffer->getBound());
102 102
103 buffer->allocate(size, reinterpret_cast<const GrGLchar *>(data)); 103 buffer->allocate(size, reinterpret_cast<const GrGLchar *>(data));
104 buffer->setUsage(usage); 104 buffer->setUsage(usage);
105 } 105 }
106 106
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 // 0 is a permissible bufferID - it unbinds the current buffer 579 // 0 is a permissible bufferID - it unbinds the current buffer
580 580
581 switch (target) { 581 switch (target) {
582 case GR_GL_ARRAY_BUFFER: 582 case GR_GL_ARRAY_BUFFER:
583 GrDebugGL::getInstance()->setArrayBuffer(buffer); 583 GrDebugGL::getInstance()->setArrayBuffer(buffer);
584 break; 584 break;
585 case GR_GL_ELEMENT_ARRAY_BUFFER: 585 case GR_GL_ELEMENT_ARRAY_BUFFER:
586 GrDebugGL::getInstance()->setElementArrayBuffer(buffer); 586 GrDebugGL::getInstance()->setElementArrayBuffer(buffer);
587 break; 587 break;
588 default: 588 default:
589 GrCrash("Unexpected target to glBindBuffer"); 589 SkFAIL("Unexpected target to glBindBuffer");
590 break; 590 break;
591 } 591 }
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() &&
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 631
632 GrBufferObj *buffer = NULL; 632 GrBufferObj *buffer = NULL;
633 switch (target) { 633 switch (target) {
634 case GR_GL_ARRAY_BUFFER: 634 case GR_GL_ARRAY_BUFFER:
635 buffer = GrDebugGL::getInstance()->getArrayBuffer(); 635 buffer = GrDebugGL::getInstance()->getArrayBuffer();
636 break; 636 break;
637 case GR_GL_ELEMENT_ARRAY_BUFFER: 637 case GR_GL_ELEMENT_ARRAY_BUFFER:
638 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); 638 buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
639 break; 639 break;
640 default: 640 default:
641 GrCrash("Unexpected target to glMapBuffer"); 641 SkFAIL("Unexpected target to glMapBuffer");
642 break; 642 break;
643 } 643 }
644 644
645 if (buffer) { 645 if (buffer) {
646 GrAlwaysAssert(!buffer->getMapped()); 646 GrAlwaysAssert(!buffer->getMapped());
647 buffer->setMapped(); 647 buffer->setMapped();
648 return buffer->getDataPtr(); 648 return buffer->getDataPtr();
649 } 649 }
650 650
651 GrAlwaysAssert(false); 651 GrAlwaysAssert(false);
652 return NULL; // no buffer bound to the target 652 return NULL; // no buffer bound to the target
653 } 653 }
654 654
655 // remove a buffer from the caller's address space 655 // remove a buffer from the caller's address space
656 // TODO: check if the "access" method from "glMapBuffer" was honored 656 // TODO: check if the "access" method from "glMapBuffer" was honored
657 GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) { 657 GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) {
658 658
659 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || 659 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
660 GR_GL_ELEMENT_ARRAY_BUFFER == target); 660 GR_GL_ELEMENT_ARRAY_BUFFER == target);
661 661
662 GrBufferObj *buffer = NULL; 662 GrBufferObj *buffer = NULL;
663 switch (target) { 663 switch (target) {
664 case GR_GL_ARRAY_BUFFER: 664 case GR_GL_ARRAY_BUFFER:
665 buffer = GrDebugGL::getInstance()->getArrayBuffer(); 665 buffer = GrDebugGL::getInstance()->getArrayBuffer();
666 break; 666 break;
667 case GR_GL_ELEMENT_ARRAY_BUFFER: 667 case GR_GL_ELEMENT_ARRAY_BUFFER:
668 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); 668 buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
669 break; 669 break;
670 default: 670 default:
671 GrCrash("Unexpected target to glUnmapBuffer"); 671 SkFAIL("Unexpected target to glUnmapBuffer");
672 break; 672 break;
673 } 673 }
674 674
675 if (buffer) { 675 if (buffer) {
676 GrAlwaysAssert(buffer->getMapped()); 676 GrAlwaysAssert(buffer->getMapped());
677 buffer->resetMapped(); 677 buffer->resetMapped();
678 return GR_GL_TRUE; 678 return GR_GL_TRUE;
679 } 679 }
680 680
681 GrAlwaysAssert(false); 681 GrAlwaysAssert(false);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 *params = 0; 713 *params = 0;
714 if (buffer) 714 if (buffer)
715 *params = SkToInt(buffer->getSize()); 715 *params = SkToInt(buffer->getSize());
716 break; 716 break;
717 case GR_GL_BUFFER_USAGE: 717 case GR_GL_BUFFER_USAGE:
718 *params = GR_GL_STATIC_DRAW; 718 *params = GR_GL_STATIC_DRAW;
719 if (buffer) 719 if (buffer)
720 *params = buffer->getUsage(); 720 *params = buffer->getUsage();
721 break; 721 break;
722 default: 722 default:
723 GrCrash("Unexpected value to glGetBufferParamateriv"); 723 SkFAIL("Unexpected value to glGetBufferParamateriv");
724 break; 724 break;
725 } 725 }
726 }; 726 };
727 } // end of namespace 727 } // end of namespace
728 728
729 //////////////////////////////////////////////////////////////////////////////// 729 ////////////////////////////////////////////////////////////////////////////////
730 struct GrDebugGLInterface : public GrGLInterface { 730 struct GrDebugGLInterface : public GrGLInterface {
731 731
732 public: 732 public:
733 SK_DECLARE_INST_COUNT(GrDebugGLInterface) 733 SK_DECLARE_INST_COUNT(GrDebugGLInterface)
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity; 914 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity;
915 functions->fUnmapBuffer = debugGLUnmapBuffer; 915 functions->fUnmapBuffer = debugGLUnmapBuffer;
916 functions->fBindFragDataLocationIndexed = 916 functions->fBindFragDataLocationIndexed =
917 noOpGLBindFragDataLocationIndexed; 917 noOpGLBindFragDataLocationIndexed;
918 918
919 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio ns->fGetStringi, 919 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio ns->fGetStringi,
920 functions->fGetIntegerv); 920 functions->fGetIntegerv);
921 921
922 return interface; 922 return interface;
923 } 923 }
OLDNEW
« include/core/SkTypes.h ('K') | « src/gpu/gl/GrGpuGL_program.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698