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

Side by Side Diff: webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 221783002: Revert of gpu: Raise GL_OUT_OF_MEMORY when BeginQueryEXT fails to allocate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h ('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 // 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 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" 5 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #ifndef GL_GLEXT_PROTOTYPES 8 #ifndef GL_GLEXT_PROTOTYPES
9 #define GL_GLEXT_PROTOTYPES 1 9 #define GL_GLEXT_PROTOTYPES 1
10 #endif 10 #endif
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 static base::LazyInstance<GLES2Initializer> g_gles2_initializer = 67 static base::LazyInstance<GLES2Initializer> g_gles2_initializer =
68 LAZY_INSTANCE_INITIALIZER; 68 LAZY_INSTANCE_INITIALIZER;
69 69
70 } // namespace anonymous 70 } // namespace anonymous
71 71
72 // static 72 // static
73 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 73 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
74 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( 74 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
75 const blink::WebGraphicsContext3D::Attributes& attributes, 75 const blink::WebGraphicsContext3D::Attributes& attributes,
76 bool lose_context_when_out_of_memory,
77 gfx::AcceleratedWidget window) { 76 gfx::AcceleratedWidget window) {
78 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); 77 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone);
79 bool is_offscreen = false;
80 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 78 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
81 scoped_ptr< ::gpu::GLInProcessContext>(), 79 scoped_ptr< ::gpu::GLInProcessContext>(), attributes, false, window));
82 attributes,
83 lose_context_when_out_of_memory,
84 is_offscreen,
85 window));
86 } 80 }
87 81
88 // static 82 // static
89 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 83 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
90 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( 84 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
91 const blink::WebGraphicsContext3D::Attributes& attributes, 85 const blink::WebGraphicsContext3D::Attributes& attributes) {
92 bool lose_context_when_out_of_memory) {
93 bool is_offscreen = true;
94 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 86 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
95 scoped_ptr< ::gpu::GLInProcessContext>(), 87 scoped_ptr< ::gpu::GLInProcessContext>(),
96 attributes, 88 attributes,
97 lose_context_when_out_of_memory, 89 true,
98 is_offscreen,
99 gfx::kNullAcceleratedWidget)); 90 gfx::kNullAcceleratedWidget));
100 } 91 }
101 92
102 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 93 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
103 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( 94 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext(
104 scoped_ptr< ::gpu::GLInProcessContext> context, 95 scoped_ptr< ::gpu::GLInProcessContext> context,
105 const blink::WebGraphicsContext3D::Attributes& attributes) { 96 const blink::WebGraphicsContext3D::Attributes& attributes) {
106 bool lose_context_when_out_of_memory = false; // Not used.
107 bool is_offscreen = true; // Not used.
108 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 97 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
109 context.Pass(), 98 context.Pass(),
110 attributes, 99 attributes,
111 lose_context_when_out_of_memory, 100 true /* is_offscreen. Not used. */,
112 is_offscreen,
113 gfx::kNullAcceleratedWidget /* window. Not used. */)); 101 gfx::kNullAcceleratedWidget /* window. Not used. */));
114 } 102 }
115 103
116 WebGraphicsContext3DInProcessCommandBufferImpl:: 104 WebGraphicsContext3DInProcessCommandBufferImpl::
117 WebGraphicsContext3DInProcessCommandBufferImpl( 105 WebGraphicsContext3DInProcessCommandBufferImpl(
118 scoped_ptr< ::gpu::GLInProcessContext> context, 106 scoped_ptr< ::gpu::GLInProcessContext> context,
119 const blink::WebGraphicsContext3D::Attributes& attributes, 107 const blink::WebGraphicsContext3D::Attributes& attributes,
120 bool lose_context_when_out_of_memory,
121 bool is_offscreen, 108 bool is_offscreen,
122 gfx::AcceleratedWidget window) 109 gfx::AcceleratedWidget window)
123 : is_offscreen_(is_offscreen), 110 : is_offscreen_(is_offscreen),
124 window_(window), 111 window_(window),
125 initialized_(false), 112 initialized_(false),
126 initialize_failed_(false), 113 initialize_failed_(false),
127 context_(context.Pass()), 114 context_(context.Pass()),
128 gl_(NULL), 115 gl_(NULL),
129 context_lost_callback_(NULL), 116 context_lost_callback_(NULL),
130 context_lost_reason_(GL_NO_ERROR), 117 context_lost_reason_(GL_NO_ERROR),
131 attributes_(attributes), 118 attributes_(attributes),
132 lose_context_when_out_of_memory_(lose_context_when_out_of_memory), 119 flush_id_(0) {
133 flush_id_(0) {} 120 }
134 121
135 WebGraphicsContext3DInProcessCommandBufferImpl:: 122 WebGraphicsContext3DInProcessCommandBufferImpl::
136 ~WebGraphicsContext3DInProcessCommandBufferImpl() { 123 ~WebGraphicsContext3DInProcessCommandBufferImpl() {
137 } 124 }
138 125
139 // static 126 // static
140 void WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( 127 void WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes(
141 const blink::WebGraphicsContext3D::Attributes& attributes, 128 const blink::WebGraphicsContext3D::Attributes& attributes,
142 ::gpu::GLInProcessContextAttribs* output_attribs) { 129 ::gpu::GLInProcessContextAttribs* output_attribs) {
143 output_attribs->alpha_size = attributes.alpha ? 8 : 0; 130 output_attribs->alpha_size = attributes.alpha ? 8 : 0;
(...skipping 17 matching lines...) Expand all
161 148
162 if (!context_) { 149 if (!context_) {
163 // TODO(kbr): More work will be needed in this implementation to 150 // TODO(kbr): More work will be needed in this implementation to
164 // properly support GPU switching. Like in the out-of-process 151 // properly support GPU switching. Like in the out-of-process
165 // command buffer implementation, all previously created contexts 152 // command buffer implementation, all previously created contexts
166 // will need to be lost either when the first context requesting the 153 // will need to be lost either when the first context requesting the
167 // discrete GPU is created, or the last one is destroyed. 154 // discrete GPU is created, or the last one is destroyed.
168 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; 155 gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
169 156
170 ::gpu::GLInProcessContextAttribs attrib_struct; 157 ::gpu::GLInProcessContextAttribs attrib_struct;
171 ConvertAttributes(attributes_, &attrib_struct); 158 ConvertAttributes(attributes_, &attrib_struct),
172 attrib_struct.lose_context_when_out_of_memory =
173 lose_context_when_out_of_memory_;
174 159
175 context_.reset(GLInProcessContext::CreateContext( 160 context_.reset(GLInProcessContext::CreateContext(
176 is_offscreen_, 161 is_offscreen_,
177 window_, 162 window_,
178 gfx::Size(1, 1), 163 gfx::Size(1, 1),
179 attributes_.shareResources, 164 attributes_.shareResources,
180 attrib_struct, 165 attrib_struct,
181 gpu_preference)); 166 gpu_preference));
182 } 167 }
183 168
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 1180
1196 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, 1181 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM,
1197 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, 1182 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei,
1198 WGC3Denum, WGC3Denum, const void*) 1183 WGC3Denum, WGC3Denum, const void*)
1199 1184
1200 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, 1185 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM,
1201 WGC3Denum) 1186 WGC3Denum)
1202 1187
1203 } // namespace gpu 1188 } // namespace gpu
1204 } // namespace webkit 1189 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698