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

Side by Side Diff: gpu/command_buffer/client/gl_in_process_context.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
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 "gpu/command_buffer/client/gl_in_process_context.h" 5 #include "gpu/command_buffer/client/gl_in_process_context.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 const int32 GREEN_SIZE = 0x3023; 140 const int32 GREEN_SIZE = 0x3023;
141 const int32 RED_SIZE = 0x3024; 141 const int32 RED_SIZE = 0x3024;
142 const int32 DEPTH_SIZE = 0x3025; 142 const int32 DEPTH_SIZE = 0x3025;
143 const int32 STENCIL_SIZE = 0x3026; 143 const int32 STENCIL_SIZE = 0x3026;
144 const int32 SAMPLES = 0x3031; 144 const int32 SAMPLES = 0x3031;
145 const int32 SAMPLE_BUFFERS = 0x3032; 145 const int32 SAMPLE_BUFFERS = 0x3032;
146 const int32 NONE = 0x3038; 146 const int32 NONE = 0x3038;
147 147
148 // Chromium-specific attributes 148 // Chromium-specific attributes
149 const int32 FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002; 149 const int32 FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002;
150 const int32 LOSE_CONTEXT_WHEN_OUT_OF_MEMORY = 0x10003;
151 150
152 std::vector<int32> attrib_vector; 151 std::vector<int32> attrib_vector;
153 if (attribs.alpha_size >= 0) { 152 if (attribs.alpha_size >= 0) {
154 attrib_vector.push_back(ALPHA_SIZE); 153 attrib_vector.push_back(ALPHA_SIZE);
155 attrib_vector.push_back(attribs.alpha_size); 154 attrib_vector.push_back(attribs.alpha_size);
156 } 155 }
157 if (attribs.blue_size >= 0) { 156 if (attribs.blue_size >= 0) {
158 attrib_vector.push_back(BLUE_SIZE); 157 attrib_vector.push_back(BLUE_SIZE);
159 attrib_vector.push_back(attribs.blue_size); 158 attrib_vector.push_back(attribs.blue_size);
160 } 159 }
(...skipping 18 matching lines...) Expand all
179 attrib_vector.push_back(attribs.samples); 178 attrib_vector.push_back(attribs.samples);
180 } 179 }
181 if (attribs.sample_buffers >= 0) { 180 if (attribs.sample_buffers >= 0) {
182 attrib_vector.push_back(SAMPLE_BUFFERS); 181 attrib_vector.push_back(SAMPLE_BUFFERS);
183 attrib_vector.push_back(attribs.sample_buffers); 182 attrib_vector.push_back(attribs.sample_buffers);
184 } 183 }
185 if (attribs.fail_if_major_perf_caveat > 0) { 184 if (attribs.fail_if_major_perf_caveat > 0) {
186 attrib_vector.push_back(FAIL_IF_MAJOR_PERF_CAVEAT); 185 attrib_vector.push_back(FAIL_IF_MAJOR_PERF_CAVEAT);
187 attrib_vector.push_back(attribs.fail_if_major_perf_caveat); 186 attrib_vector.push_back(attribs.fail_if_major_perf_caveat);
188 } 187 }
189 if (attribs.lose_context_when_out_of_memory > 0) {
190 attrib_vector.push_back(LOSE_CONTEXT_WHEN_OUT_OF_MEMORY);
191 attrib_vector.push_back(attribs.lose_context_when_out_of_memory);
192 }
193 attrib_vector.push_back(NONE); 188 attrib_vector.push_back(NONE);
194 189
195 base::Closure wrapped_callback = 190 base::Closure wrapped_callback =
196 base::Bind(&GLInProcessContextImpl::OnContextLost, AsWeakPtr()); 191 base::Bind(&GLInProcessContextImpl::OnContextLost, AsWeakPtr());
197 command_buffer_.reset(new InProcessCommandBuffer(service)); 192 command_buffer_.reset(new InProcessCommandBuffer(service));
198 193
199 scoped_ptr<base::AutoLock> scoped_shared_context_lock; 194 scoped_ptr<base::AutoLock> scoped_shared_context_lock;
200 scoped_refptr<gles2::ShareGroup> share_group; 195 scoped_refptr<gles2::ShareGroup> share_group;
201 InProcessCommandBuffer* share_command_buffer = NULL; 196 InProcessCommandBuffer* share_command_buffer = NULL;
202 if (use_global_share_group) { 197 if (use_global_share_group) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); 243 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get()));
249 244
250 bool bind_generates_resources = false; 245 bool bind_generates_resources = false;
251 246
252 // Create the object exposing the OpenGL API. 247 // Create the object exposing the OpenGL API.
253 gles2_implementation_.reset(new gles2::GLES2Implementation( 248 gles2_implementation_.reset(new gles2::GLES2Implementation(
254 gles2_helper_.get(), 249 gles2_helper_.get(),
255 share_group, 250 share_group,
256 transfer_buffer_.get(), 251 transfer_buffer_.get(),
257 bind_generates_resources, 252 bind_generates_resources,
258 attribs.lose_context_when_out_of_memory > 0,
259 command_buffer_.get())); 253 command_buffer_.get()));
260 254
261 if (use_global_share_group) { 255 if (use_global_share_group) {
262 g_all_shared_contexts.Get().insert(this); 256 g_all_shared_contexts.Get().insert(this);
263 scoped_shared_context_lock.reset(); 257 scoped_shared_context_lock.reset();
264 } 258 }
265 259
266 if (!gles2_implementation_->Initialize( 260 if (!gles2_implementation_->Initialize(
267 kStartTransferBufferSize, 261 kStartTransferBufferSize,
268 kMinTransferBufferSize, 262 kMinTransferBufferSize,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } // anonymous namespace 295 } // anonymous namespace
302 296
303 GLInProcessContextAttribs::GLInProcessContextAttribs() 297 GLInProcessContextAttribs::GLInProcessContextAttribs()
304 : alpha_size(-1), 298 : alpha_size(-1),
305 blue_size(-1), 299 blue_size(-1),
306 green_size(-1), 300 green_size(-1),
307 red_size(-1), 301 red_size(-1),
308 depth_size(-1), 302 depth_size(-1),
309 stencil_size(-1), 303 stencil_size(-1),
310 samples(-1), 304 samples(-1),
311 sample_buffers(-1), 305 sample_buffers(-1) {}
312 fail_if_major_perf_caveat(-1),
313 lose_context_when_out_of_memory(-1) {}
314 306
315 // static 307 // static
316 GLInProcessContext* GLInProcessContext::CreateContext( 308 GLInProcessContext* GLInProcessContext::CreateContext(
317 bool is_offscreen, 309 bool is_offscreen,
318 gfx::AcceleratedWidget window, 310 gfx::AcceleratedWidget window,
319 const gfx::Size& size, 311 const gfx::Size& size,
320 bool share_resources, 312 bool share_resources,
321 const GLInProcessContextAttribs& attribs, 313 const GLInProcessContextAttribs& attribs,
322 gfx::GpuPreference gpu_preference) { 314 gfx::GpuPreference gpu_preference) {
323 scoped_ptr<GLInProcessContextImpl> context( 315 scoped_ptr<GLInProcessContextImpl> context(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 surface->GetSize(), 347 surface->GetSize(),
356 attribs, 348 attribs,
357 gpu_preference, 349 gpu_preference,
358 service)) 350 service))
359 return NULL; 351 return NULL;
360 352
361 return context.release(); 353 return context.release();
362 } 354 }
363 355
364 } // namespace gpu 356 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gl_in_process_context.h ('k') | gpu/command_buffer/client/gles2_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698