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

Side by Side Diff: gpu/command_buffer/common/gles2_cmd_utils.cc

Issue 199443004: gpu: Raise GL_OUT_OF_MEMORY when BeginQueryEXT fails to allocate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: checkmem: benchmark Created 6 years, 8 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 | « gpu/command_buffer/common/gles2_cmd_utils.h ('k') | gpu/command_buffer/service/context_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file is here so other GLES2 related files can have a common set of 5 // This file is here so other GLES2 related files can have a common set of
6 // includes where appropriate. 6 // includes where appropriate.
7 7
8 #include <sstream> 8 #include <sstream>
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 const int32 kSampleBuffers = 0x3032; // EGL_SAMPLE_BUFFERS 767 const int32 kSampleBuffers = 0x3032; // EGL_SAMPLE_BUFFERS
768 const int32 kNone = 0x3038; // EGL_NONE 768 const int32 kNone = 0x3038; // EGL_NONE
769 const int32 kSwapBehavior = 0x3093; // EGL_SWAP_BEHAVIOR 769 const int32 kSwapBehavior = 0x3093; // EGL_SWAP_BEHAVIOR
770 const int32 kBufferPreserved = 0x3094; // EGL_BUFFER_PRESERVED 770 const int32 kBufferPreserved = 0x3094; // EGL_BUFFER_PRESERVED
771 const int32 kBufferDestroyed = 0x3095; // EGL_BUFFER_DESTROYED 771 const int32 kBufferDestroyed = 0x3095; // EGL_BUFFER_DESTROYED
772 772
773 // Chromium only. 773 // Chromium only.
774 const int32 kShareResources = 0x10000; 774 const int32 kShareResources = 0x10000;
775 const int32 kBindGeneratesResource = 0x10001; 775 const int32 kBindGeneratesResource = 0x10001;
776 const int32 kFailIfMajorPerfCaveat = 0x10002; 776 const int32 kFailIfMajorPerfCaveat = 0x10002;
777 const int32 kLoseContextWhenOutOfMemory = 0x10003;
777 778
778 } // namespace 779 } // namespace
779 780
780 ContextCreationAttribHelper::ContextCreationAttribHelper() 781 ContextCreationAttribHelper::ContextCreationAttribHelper()
781 : alpha_size_(-1), 782 : alpha_size_(-1),
782 blue_size_(-1), 783 blue_size_(-1),
783 green_size_(-1), 784 green_size_(-1),
784 red_size_(-1), 785 red_size_(-1),
785 depth_size_(-1), 786 depth_size_(-1),
786 stencil_size_(-1), 787 stencil_size_(-1),
787 samples_(-1), 788 samples_(-1),
788 sample_buffers_(-1), 789 sample_buffers_(-1),
789 buffer_preserved_(true), 790 buffer_preserved_(true),
790 share_resources_(false), 791 share_resources_(false),
791 bind_generates_resource_(true), 792 bind_generates_resource_(true),
792 fail_if_major_perf_caveat_(false) { 793 fail_if_major_perf_caveat_(false),
793 } 794 lose_context_when_out_of_memory_(false) {}
794 795
795 void ContextCreationAttribHelper::Serialize(std::vector<int32>* attribs) { 796 void ContextCreationAttribHelper::Serialize(std::vector<int32>* attribs) {
796 if (alpha_size_ != -1) { 797 if (alpha_size_ != -1) {
797 attribs->push_back(kAlphaSize); 798 attribs->push_back(kAlphaSize);
798 attribs->push_back(alpha_size_); 799 attribs->push_back(alpha_size_);
799 } 800 }
800 if (blue_size_ != -1) { 801 if (blue_size_ != -1) {
801 attribs->push_back(kBlueSize); 802 attribs->push_back(kBlueSize);
802 attribs->push_back(blue_size_); 803 attribs->push_back(blue_size_);
803 } 804 }
(...skipping 22 matching lines...) Expand all
826 attribs->push_back(sample_buffers_); 827 attribs->push_back(sample_buffers_);
827 } 828 }
828 attribs->push_back(kSwapBehavior); 829 attribs->push_back(kSwapBehavior);
829 attribs->push_back(buffer_preserved_ ? kBufferPreserved : kBufferDestroyed); 830 attribs->push_back(buffer_preserved_ ? kBufferPreserved : kBufferDestroyed);
830 attribs->push_back(kShareResources); 831 attribs->push_back(kShareResources);
831 attribs->push_back(share_resources_ ? 1 : 0); 832 attribs->push_back(share_resources_ ? 1 : 0);
832 attribs->push_back(kBindGeneratesResource); 833 attribs->push_back(kBindGeneratesResource);
833 attribs->push_back(bind_generates_resource_ ? 1 : 0); 834 attribs->push_back(bind_generates_resource_ ? 1 : 0);
834 attribs->push_back(kFailIfMajorPerfCaveat); 835 attribs->push_back(kFailIfMajorPerfCaveat);
835 attribs->push_back(fail_if_major_perf_caveat_ ? 1 : 0); 836 attribs->push_back(fail_if_major_perf_caveat_ ? 1 : 0);
837 attribs->push_back(kLoseContextWhenOutOfMemory);
838 attribs->push_back(lose_context_when_out_of_memory_ ? 1 : 0);
836 attribs->push_back(kNone); 839 attribs->push_back(kNone);
837 } 840 }
838 841
839 bool ContextCreationAttribHelper::Parse(const std::vector<int32>& attribs) { 842 bool ContextCreationAttribHelper::Parse(const std::vector<int32>& attribs) {
840 for (size_t i = 0; i < attribs.size(); i += 2) { 843 for (size_t i = 0; i < attribs.size(); i += 2) {
841 const int32 attrib = attribs[i]; 844 const int32 attrib = attribs[i];
842 if (i + 1 >= attribs.size()) { 845 if (i + 1 >= attribs.size()) {
843 if (attrib == kNone) { 846 if (attrib == kNone) {
844 return true; 847 return true;
845 } 848 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 break; 883 break;
881 case kShareResources: 884 case kShareResources:
882 share_resources_ = value != 0; 885 share_resources_ = value != 0;
883 break; 886 break;
884 case kBindGeneratesResource: 887 case kBindGeneratesResource:
885 bind_generates_resource_ = value != 0; 888 bind_generates_resource_ = value != 0;
886 break; 889 break;
887 case kFailIfMajorPerfCaveat: 890 case kFailIfMajorPerfCaveat:
888 fail_if_major_perf_caveat_ = value != 0; 891 fail_if_major_perf_caveat_ = value != 0;
889 break; 892 break;
893 case kLoseContextWhenOutOfMemory:
894 lose_context_when_out_of_memory_ = value != 0;
895 break;
890 case kNone: 896 case kNone:
891 // Terminate list, even if more attributes. 897 // Terminate list, even if more attributes.
892 return true; 898 return true;
893 default: 899 default:
894 DLOG(ERROR) << "Invalid context creation attribute: " << attrib; 900 DLOG(ERROR) << "Invalid context creation attribute: " << attrib;
895 return false; 901 return false;
896 } 902 }
897 } 903 }
898 904
899 return true; 905 return true;
900 } 906 }
901 907
902 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" 908 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h"
903 909
904 } // namespace gles2 910 } // namespace gles2
905 } // namespace gpu 911 } // namespace gpu
906 912
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils.h ('k') | gpu/command_buffer/service/context_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698