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

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

Issue 262963002: Revert of Add support for glMapBufferRange. Use glMapBufferRange and glMapBufferSubData. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/debug/GrBufferObj.h ('k') | src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp » ('j') | 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 debugGLMapBuffer(GrGLenum target, GrGLenum access) {
626 GrGLsizeiptr length, GrGLbit field access) { 626
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 // GR_GL_READ_ONLY == access || || GR_GL_READ_WRIT == access);
630 // We only expect read access and we expect that the buffer or range is alwa ys invalidated. 630 GrAlwaysAssert(GR_GL_WRITE_ONLY == 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);
633 631
634 GrBufferObj *buffer = NULL; 632 GrBufferObj *buffer = NULL;
635 switch (target) { 633 switch (target) {
636 case GR_GL_ARRAY_BUFFER: 634 case GR_GL_ARRAY_BUFFER:
637 buffer = GrDebugGL::getInstance()->getArrayBuffer(); 635 buffer = GrDebugGL::getInstance()->getArrayBuffer();
638 break; 636 break;
639 case GR_GL_ELEMENT_ARRAY_BUFFER: 637 case GR_GL_ELEMENT_ARRAY_BUFFER:
640 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); 638 buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
641 break; 639 break;
642 default: 640 default:
643 SkFAIL("Unexpected target to glMapBufferRange"); 641 SkFAIL("Unexpected target to glMapBuffer");
644 break; 642 break;
645 } 643 }
646 644
647 if (NULL != buffer) { 645 if (buffer) {
648 GrAlwaysAssert(offset >= 0 && offset + length <= buffer->getSize());
649 GrAlwaysAssert(!buffer->getMapped()); 646 GrAlwaysAssert(!buffer->getMapped());
650 buffer->setMapped(offset, length); 647 buffer->setMapped();
651 return buffer->getDataPtr() + offset; 648 return buffer->getDataPtr();
652 } 649 }
653 650
654 GrAlwaysAssert(false); 651 GrAlwaysAssert(false);
655 return NULL; // no buffer bound to the target 652 return NULL; // no buffer bound to the target
656 } 653 }
657 654
658 GrGLvoid* GR_GL_FUNCTION_TYPE debugGLMapBuffer(GrGLenum target, GrGLenum access) { 655 // remove a buffer from the caller's address space
659 GrAlwaysAssert(GR_GL_WRITE_ONLY == access); 656 // TODO: check if the "access" method from "glMapBuffer" was honored
657 GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) {
658
659 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
660 GR_GL_ELEMENT_ARRAY_BUFFER == target);
660 661
661 GrBufferObj *buffer = NULL; 662 GrBufferObj *buffer = NULL;
662 switch (target) { 663 switch (target) {
663 case GR_GL_ARRAY_BUFFER: 664 case GR_GL_ARRAY_BUFFER:
664 buffer = GrDebugGL::getInstance()->getArrayBuffer(); 665 buffer = GrDebugGL::getInstance()->getArrayBuffer();
665 break; 666 break;
666 case GR_GL_ELEMENT_ARRAY_BUFFER: 667 case GR_GL_ELEMENT_ARRAY_BUFFER:
667 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); 668 buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
668 break; 669 break;
669 default: 670 default:
670 SkFAIL("Unexpected target to glMapBuffer"); 671 SkFAIL("Unexpected target to glUnmapBuffer");
671 break; 672 break;
672 } 673 }
673 674
674 return debugGLMapBufferRange(target, 0, buffer->getSize(), 675 if (buffer) {
675 GR_GL_MAP_WRITE_BIT | GR_GL_MAP_INVALIDATE_BUFF ER_BIT); 676 GrAlwaysAssert(buffer->getMapped());
677 buffer->resetMapped();
678 return GR_GL_TRUE;
679 }
680
681 GrAlwaysAssert(false);
682 return GR_GL_FALSE; // GR_GL_INVALID_OPERATION;
676 } 683 }
677 684
678 // remove a buffer from the caller's address space 685 GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target,
679 // TODO: check if the "access" method from "glMapBuffer" was honored 686 GrGLenum value,
680 GrGLboolean GR_GL_FUNCTION_TYPE debugGLUnmapBuffer(GrGLenum target) { 687 GrGLint* params) {
681 688
682 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target || 689 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
683 GR_GL_ELEMENT_ARRAY_BUFFER == target); 690 GR_GL_ELEMENT_ARRAY_BUFFER == target);
691 GrAlwaysAssert(GR_GL_BUFFER_SIZE == value ||
692 GR_GL_BUFFER_USAGE == value);
684 693
685 GrBufferObj *buffer = NULL; 694 GrBufferObj *buffer = NULL;
686 switch (target) { 695 switch (target) {
687 case GR_GL_ARRAY_BUFFER: 696 case GR_GL_ARRAY_BUFFER:
688 buffer = GrDebugGL::getInstance()->getArrayBuffer(); 697 buffer = GrDebugGL::getInstance()->getArrayBuffer();
689 break; 698 break;
690 case GR_GL_ELEMENT_ARRAY_BUFFER: 699 case GR_GL_ELEMENT_ARRAY_BUFFER:
691 buffer = GrDebugGL::getInstance()->getElementArrayBuffer(); 700 buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
692 break; 701 break;
693 default:
694 SkFAIL("Unexpected target to glUnmapBuffer");
695 break;
696 }
697
698 if (NULL != buffer) {
699 GrAlwaysAssert(buffer->getMapped());
700 buffer->resetMapped();
701 return GR_GL_TRUE;
702 }
703
704 GrAlwaysAssert(false);
705 return GR_GL_FALSE; // GR_GL_INVALID_OPERATION;
706 }
707
708 GrGLvoid GR_GL_FUNCTION_TYPE debugGLFlushMappedBufferRange(GrGLenum target,
709 GrGLintptr offset,
710 GrGLsizeiptr length) {
711 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
712 GR_GL_ELEMENT_ARRAY_BUFFER == target);
713
714 GrBufferObj *buffer = NULL;
715 switch (target) {
716 case GR_GL_ARRAY_BUFFER:
717 buffer = GrDebugGL::getInstance()->getArrayBuffer();
718 break;
719 case GR_GL_ELEMENT_ARRAY_BUFFER:
720 buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
721 break;
722 default:
723 SkFAIL("Unexpected target to glUnmapBuffer");
724 break;
725 }
726
727 if (NULL != buffer) {
728 GrAlwaysAssert(buffer->getMapped());
729 GrAlwaysAssert(offset >= 0 && (offset + length) <= buffer->getMappedLeng th());
730 } else {
731 GrAlwaysAssert(false);
732 }
733 }
734
735
736 GrGLvoid GR_GL_FUNCTION_TYPE debugGLGetBufferParameteriv(GrGLenum target,
737 GrGLenum value,
738 GrGLint* params) {
739
740 GrAlwaysAssert(GR_GL_ARRAY_BUFFER == target ||
741 GR_GL_ELEMENT_ARRAY_BUFFER == target);
742 GrAlwaysAssert(GR_GL_BUFFER_SIZE == value ||
743 GR_GL_BUFFER_USAGE == value);
744
745 GrBufferObj *buffer = NULL;
746 switch (target) {
747 case GR_GL_ARRAY_BUFFER:
748 buffer = GrDebugGL::getInstance()->getArrayBuffer();
749 break;
750 case GR_GL_ELEMENT_ARRAY_BUFFER:
751 buffer = GrDebugGL::getInstance()->getElementArrayBuffer();
752 break;
753 } 702 }
754 703
755 GrAlwaysAssert(buffer); 704 GrAlwaysAssert(buffer);
756 705
757 switch (value) { 706 switch (value) {
758 case GR_GL_BUFFER_MAPPED: 707 case GR_GL_BUFFER_MAPPED:
759 *params = GR_GL_FALSE; 708 *params = GR_GL_FALSE;
760 if (NULL != buffer) 709 if (buffer)
761 *params = buffer->getMapped() ? GR_GL_TRUE : GR_GL_FALSE; 710 *params = buffer->getMapped() ? GR_GL_TRUE : GR_GL_FALSE;
762 break; 711 break;
763 case GR_GL_BUFFER_SIZE: 712 case GR_GL_BUFFER_SIZE:
764 *params = 0; 713 *params = 0;
765 if (NULL != buffer) 714 if (buffer)
766 *params = SkToInt(buffer->getSize()); 715 *params = SkToInt(buffer->getSize());
767 break; 716 break;
768 case GR_GL_BUFFER_USAGE: 717 case GR_GL_BUFFER_USAGE:
769 *params = GR_GL_STATIC_DRAW; 718 *params = GR_GL_STATIC_DRAW;
770 if (NULL != buffer) 719 if (buffer)
771 *params = buffer->getUsage(); 720 *params = buffer->getUsage();
772 break; 721 break;
773 default: 722 default:
774 SkFAIL("Unexpected value to glGetBufferParamateriv"); 723 SkFAIL("Unexpected value to glGetBufferParamateriv");
775 break; 724 break;
776 } 725 }
777 }; 726 };
778 } // end of namespace 727 } // end of namespace
779 728
780 //////////////////////////////////////////////////////////////////////////////// 729 ////////////////////////////////////////////////////////////////////////////////
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray; 819 functions->fDisableVertexAttribArray = noOpGLDisableVertexAttribArray;
871 functions->fDrawArrays = noOpGLDrawArrays; 820 functions->fDrawArrays = noOpGLDrawArrays;
872 functions->fDrawBuffer = noOpGLDrawBuffer; 821 functions->fDrawBuffer = noOpGLDrawBuffer;
873 functions->fDrawBuffers = noOpGLDrawBuffers; 822 functions->fDrawBuffers = noOpGLDrawBuffers;
874 functions->fDrawElements = noOpGLDrawElements; 823 functions->fDrawElements = noOpGLDrawElements;
875 functions->fEnable = noOpGLEnable; 824 functions->fEnable = noOpGLEnable;
876 functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray; 825 functions->fEnableVertexAttribArray = noOpGLEnableVertexAttribArray;
877 functions->fEndQuery = noOpGLEndQuery; 826 functions->fEndQuery = noOpGLEndQuery;
878 functions->fFinish = noOpGLFinish; 827 functions->fFinish = noOpGLFinish;
879 functions->fFlush = noOpGLFlush; 828 functions->fFlush = noOpGLFlush;
880 functions->fFlushMappedBufferRange = debugGLFlushMappedBufferRange;
881 functions->fFrontFace = noOpGLFrontFace; 829 functions->fFrontFace = noOpGLFrontFace;
882 functions->fGenerateMipmap = debugGLGenerateMipmap; 830 functions->fGenerateMipmap = debugGLGenerateMipmap;
883 functions->fGenBuffers = debugGLGenBuffers; 831 functions->fGenBuffers = debugGLGenBuffers;
884 functions->fGenQueries = noOpGLGenIds; 832 functions->fGenQueries = noOpGLGenIds;
885 functions->fGenTextures = debugGLGenTextures; 833 functions->fGenTextures = debugGLGenTextures;
886 functions->fGetBufferParameteriv = debugGLGetBufferParameteriv; 834 functions->fGetBufferParameteriv = debugGLGetBufferParameteriv;
887 functions->fGetError = noOpGLGetError; 835 functions->fGetError = noOpGLGetError;
888 functions->fGetIntegerv = noOpGLGetIntegerv; 836 functions->fGetIntegerv = noOpGLGetIntegerv;
889 functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v; 837 functions->fGetQueryObjecti64v = noOpGLGetQueryObjecti64v;
890 functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv; 838 functions->fGetQueryObjectiv = noOpGLGetQueryObjectiv;
891 functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v; 839 functions->fGetQueryObjectui64v = noOpGLGetQueryObjectui64v;
892 functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv; 840 functions->fGetQueryObjectuiv = noOpGLGetQueryObjectuiv;
893 functions->fGetQueryiv = noOpGLGetQueryiv; 841 functions->fGetQueryiv = noOpGLGetQueryiv;
894 functions->fGetProgramInfoLog = noOpGLGetInfoLog; 842 functions->fGetProgramInfoLog = noOpGLGetInfoLog;
895 functions->fGetProgramiv = noOpGLGetShaderOrProgramiv; 843 functions->fGetProgramiv = noOpGLGetShaderOrProgramiv;
896 functions->fGetShaderInfoLog = noOpGLGetInfoLog; 844 functions->fGetShaderInfoLog = noOpGLGetInfoLog;
897 functions->fGetShaderiv = noOpGLGetShaderOrProgramiv; 845 functions->fGetShaderiv = noOpGLGetShaderOrProgramiv;
898 functions->fGetString = noOpGLGetString; 846 functions->fGetString = noOpGLGetString;
899 functions->fGetStringi = noOpGLGetStringi; 847 functions->fGetStringi = noOpGLGetStringi;
900 functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv; 848 functions->fGetTexLevelParameteriv = noOpGLGetTexLevelParameteriv;
901 functions->fGetUniformLocation = noOpGLGetUniformLocation; 849 functions->fGetUniformLocation = noOpGLGetUniformLocation;
902 functions->fGenVertexArrays = debugGLGenVertexArrays; 850 functions->fGenVertexArrays = debugGLGenVertexArrays;
903 functions->fLineWidth = noOpGLLineWidth; 851 functions->fLineWidth = noOpGLLineWidth;
904 functions->fLinkProgram = noOpGLLinkProgram; 852 functions->fLinkProgram = noOpGLLinkProgram;
905 functions->fMapBuffer = debugGLMapBuffer;
906 functions->fMapBufferRange = debugGLMapBufferRange;
907 functions->fPixelStorei = debugGLPixelStorei; 853 functions->fPixelStorei = debugGLPixelStorei;
908 functions->fQueryCounter = noOpGLQueryCounter; 854 functions->fQueryCounter = noOpGLQueryCounter;
909 functions->fReadBuffer = noOpGLReadBuffer; 855 functions->fReadBuffer = noOpGLReadBuffer;
910 functions->fReadPixels = debugGLReadPixels; 856 functions->fReadPixels = debugGLReadPixels;
911 functions->fScissor = noOpGLScissor; 857 functions->fScissor = noOpGLScissor;
912 functions->fShaderSource = noOpGLShaderSource; 858 functions->fShaderSource = noOpGLShaderSource;
913 functions->fStencilFunc = noOpGLStencilFunc; 859 functions->fStencilFunc = noOpGLStencilFunc;
914 functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate; 860 functions->fStencilFuncSeparate = noOpGLStencilFuncSeparate;
915 functions->fStencilMask = noOpGLStencilMask; 861 functions->fStencilMask = noOpGLStencilMask;
916 functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate; 862 functions->fStencilMaskSeparate = noOpGLStencilMaskSeparate;
(...skipping 17 matching lines...) Expand all
934 functions->fUniform3i = noOpGLUniform3i; 880 functions->fUniform3i = noOpGLUniform3i;
935 functions->fUniform3fv = noOpGLUniform3fv; 881 functions->fUniform3fv = noOpGLUniform3fv;
936 functions->fUniform3iv = noOpGLUniform3iv; 882 functions->fUniform3iv = noOpGLUniform3iv;
937 functions->fUniform4f = noOpGLUniform4f; 883 functions->fUniform4f = noOpGLUniform4f;
938 functions->fUniform4i = noOpGLUniform4i; 884 functions->fUniform4i = noOpGLUniform4i;
939 functions->fUniform4fv = noOpGLUniform4fv; 885 functions->fUniform4fv = noOpGLUniform4fv;
940 functions->fUniform4iv = noOpGLUniform4iv; 886 functions->fUniform4iv = noOpGLUniform4iv;
941 functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv; 887 functions->fUniformMatrix2fv = noOpGLUniformMatrix2fv;
942 functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv; 888 functions->fUniformMatrix3fv = noOpGLUniformMatrix3fv;
943 functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv; 889 functions->fUniformMatrix4fv = noOpGLUniformMatrix4fv;
944 functions->fUnmapBuffer = debugGLUnmapBuffer;
945 functions->fUseProgram = debugGLUseProgram; 890 functions->fUseProgram = debugGLUseProgram;
946 functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv; 891 functions->fVertexAttrib4fv = noOpGLVertexAttrib4fv;
947 functions->fVertexAttribPointer = noOpGLVertexAttribPointer; 892 functions->fVertexAttribPointer = noOpGLVertexAttribPointer;
948 functions->fViewport = noOpGLViewport; 893 functions->fViewport = noOpGLViewport;
949 functions->fBindFramebuffer = debugGLBindFramebuffer; 894 functions->fBindFramebuffer = debugGLBindFramebuffer;
950 functions->fBindRenderbuffer = debugGLBindRenderbuffer; 895 functions->fBindRenderbuffer = debugGLBindRenderbuffer;
951 functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus; 896 functions->fCheckFramebufferStatus = noOpGLCheckFramebufferStatus;
952 functions->fDeleteFramebuffers = debugGLDeleteFramebuffers; 897 functions->fDeleteFramebuffers = debugGLDeleteFramebuffers;
953 functions->fDeleteRenderbuffers = debugGLDeleteRenderbuffers; 898 functions->fDeleteRenderbuffers = debugGLDeleteRenderbuffers;
954 functions->fFramebufferRenderbuffer = debugGLFramebufferRenderbuffer; 899 functions->fFramebufferRenderbuffer = debugGLFramebufferRenderbuffer;
955 functions->fFramebufferTexture2D = debugGLFramebufferTexture2D; 900 functions->fFramebufferTexture2D = debugGLFramebufferTexture2D;
956 functions->fGenFramebuffers = debugGLGenFramebuffers; 901 functions->fGenFramebuffers = debugGLGenFramebuffers;
957 functions->fGenRenderbuffers = debugGLGenRenderbuffers; 902 functions->fGenRenderbuffers = debugGLGenRenderbuffers;
958 functions->fGetFramebufferAttachmentParameteriv = 903 functions->fGetFramebufferAttachmentParameteriv =
959 noOpGLGetFramebufferAttachmentParameteriv; 904 noOpGLGetFramebufferAttachmentParameteriv;
960 functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv; 905 functions->fGetRenderbufferParameteriv = noOpGLGetRenderbufferParameteriv;
961 functions->fRenderbufferStorage = noOpGLRenderbufferStorage; 906 functions->fRenderbufferStorage = noOpGLRenderbufferStorage;
962 functions->fRenderbufferStorageMultisample = 907 functions->fRenderbufferStorageMultisample =
963 noOpGLRenderbufferStorageMultisample; 908 noOpGLRenderbufferStorageMultisample;
964 functions->fBlitFramebuffer = noOpGLBlitFramebuffer; 909 functions->fBlitFramebuffer = noOpGLBlitFramebuffer;
965 functions->fResolveMultisampleFramebuffer = 910 functions->fResolveMultisampleFramebuffer =
966 noOpGLResolveMultisampleFramebuffer; 911 noOpGLResolveMultisampleFramebuffer;
912 functions->fMapBuffer = debugGLMapBuffer;
967 functions->fMatrixLoadf = noOpGLMatrixLoadf; 913 functions->fMatrixLoadf = noOpGLMatrixLoadf;
968 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity; 914 functions->fMatrixLoadIdentity = noOpGLMatrixLoadIdentity;
969 915 functions->fUnmapBuffer = debugGLUnmapBuffer;
970 functions->fBindFragDataLocationIndexed = 916 functions->fBindFragDataLocationIndexed =
971 noOpGLBindFragDataLocationIndexed; 917 noOpGLBindFragDataLocationIndexed;
972 918
973 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio ns->fGetStringi, 919 interface->fExtensions.init(kGL_GrGLStandard, functions->fGetString, functio ns->fGetStringi,
974 functions->fGetIntegerv); 920 functions->fGetIntegerv);
975 921
976 return interface; 922 return interface;
977 } 923 }
OLDNEW
« no previous file with comments | « src/gpu/gl/debug/GrBufferObj.h ('k') | src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698