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

Side by Side Diff: mojo/gles2/gles2_context.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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/gles2/gles2_context.h" 5 #include "mojo/gles2/gles2_context.h"
6 6
7 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 7 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
8 #include "gpu/command_buffer/client/gles2_implementation.h" 8 #include "gpu/command_buffer/client/gles2_implementation.h"
9 #include "gpu/command_buffer/client/transfer_buffer.h" 9 #include "gpu/command_buffer/client/transfer_buffer.h"
10 #include "mojo/public/c/gles2/gles2.h" 10 #include "mojo/public/c/gles2/gles2.h"
(...skipping 22 matching lines...) Expand all
33 GLES2Context::~GLES2Context() {} 33 GLES2Context::~GLES2Context() {}
34 34
35 bool GLES2Context::Initialize() { 35 bool GLES2Context::Initialize() {
36 if (!command_buffer_.Initialize()) 36 if (!command_buffer_.Initialize())
37 return false; 37 return false;
38 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(&command_buffer_)); 38 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(&command_buffer_));
39 if (!gles2_helper_->Initialize(kDefaultCommandBufferSize)) 39 if (!gles2_helper_->Initialize(kDefaultCommandBufferSize))
40 return false; 40 return false;
41 gles2_helper_->SetAutomaticFlushes(false); 41 gles2_helper_->SetAutomaticFlushes(false);
42 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get())); 42 transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get()));
43 bool bind_generates_resource = true;
44 // TODO(piman): Some contexts (such as compositor) want this to be true, so
45 // this needs to be a public parameter.
46 bool lose_context_when_out_of_memory = false;
43 implementation_.reset( 47 implementation_.reset(
44 new gpu::gles2::GLES2Implementation(gles2_helper_.get(), 48 new gpu::gles2::GLES2Implementation(gles2_helper_.get(),
45 NULL, 49 NULL,
46 transfer_buffer_.get(), 50 transfer_buffer_.get(),
47 true, 51 bind_generates_resource,
52 lose_context_when_out_of_memory,
48 &command_buffer_)); 53 &command_buffer_));
49 return implementation_->Initialize(kDefaultStartTransferBufferSize, 54 return implementation_->Initialize(kDefaultStartTransferBufferSize,
50 kDefaultMinTransferBufferSize, 55 kDefaultMinTransferBufferSize,
51 kDefaultMaxTransferBufferSize, 56 kDefaultMaxTransferBufferSize,
52 gpu::gles2::GLES2Implementation::kNoLimit); 57 gpu::gles2::GLES2Implementation::kNoLimit);
53 } 58 }
54 59
55 void GLES2Context::RequestAnimationFrames() { 60 void GLES2Context::RequestAnimationFrames() {
56 command_buffer_.RequestAnimationFrames(); 61 command_buffer_.RequestAnimationFrames();
57 } 62 }
58 63
59 void GLES2Context::CancelAnimationFrames() { 64 void GLES2Context::CancelAnimationFrames() {
60 command_buffer_.CancelAnimationFrames(); 65 command_buffer_.CancelAnimationFrames();
61 } 66 }
62 67
63 void GLES2Context::ContextLost() { lost_callback_(closure_); } 68 void GLES2Context::ContextLost() { lost_callback_(closure_); }
64 69
65 void GLES2Context::DrawAnimationFrame() { animation_callback_(closure_); } 70 void GLES2Context::DrawAnimationFrame() { animation_callback_(closure_); }
66 71
67 } // namespace gles2 72 } // namespace gles2
68 } // namespace mojo 73 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/aura_demo/demo_context_factory.cc ('k') | ppapi/shared_impl/ppb_graphics_3d_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698