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

Side by Side Diff: services/gles2/command_buffer_driver.cc

Issue 1343513002: When rendering offscreen, prefer size 0 instead of 1. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: review feedback Created 5 years, 3 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
« no previous file with comments | « no previous file | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "services/gles2/command_buffer_driver.h" 5 #include "services/gles2/command_buffer_driver.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "gpu/command_buffer/common/constants.h" 10 #include "gpu/command_buffer/common/constants.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 loss_observer_ = loss_observer.Pass(); 92 loss_observer_ = loss_observer.Pass();
93 bool success = DoInitialize(shared_state.Pass()); 93 bool success = DoInitialize(shared_state.Pass());
94 mojo::GpuCapabilitiesPtr capabilities = 94 mojo::GpuCapabilitiesPtr capabilities =
95 success ? mojo::GpuCapabilities::From(decoder_->GetCapabilities()) 95 success ? mojo::GpuCapabilities::From(decoder_->GetCapabilities())
96 : mojo::GpuCapabilities::New(); 96 : mojo::GpuCapabilities::New();
97 sync_client_->DidInitialize(success, capabilities.Pass()); 97 sync_client_->DidInitialize(success, capabilities.Pass());
98 } 98 }
99 99
100 bool CommandBufferDriver::DoInitialize( 100 bool CommandBufferDriver::DoInitialize(
101 mojo::ScopedSharedBufferHandle shared_state) { 101 mojo::ScopedSharedBufferHandle shared_state) {
102 if (widget_ == gfx::kNullAcceleratedWidget) 102 if (widget_ == gfx::kNullAcceleratedWidget) {
103 // This is a dummy surface, so attempt to skip actual surface
104 // allocation by passing size 0.
103 surface_ = gfx::GLSurface::CreateOffscreenGLSurface( 105 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(
104 gfx::Size(1, 1), requested_configuration_); 106 gfx::Size(0, 0), requested_configuration_);
105 else { 107 if (!surface_.get()) {
108 // If size 0 was a fail, retry with size 1.
109 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(
110 gfx::Size(1, 1), requested_configuration_);
111 }
112 } else {
106 surface_ = 113 surface_ =
107 gfx::GLSurface::CreateViewGLSurface(widget_, requested_configuration_); 114 gfx::GLSurface::CreateViewGLSurface(widget_, requested_configuration_);
108 if (auto vsync_provider = surface_->GetVSyncProvider()) { 115 if (auto vsync_provider = surface_->GetVSyncProvider()) {
109 vsync_provider->GetVSyncParameters( 116 vsync_provider->GetVSyncParameters(
110 base::Bind(&CommandBufferDriver::OnUpdateVSyncParameters, 117 base::Bind(&CommandBufferDriver::OnUpdateVSyncParameters,
111 weak_factory_.GetWeakPtr())); 118 weak_factory_.GetWeakPtr()));
112 } 119 }
113 } 120 }
114 121
115 if (!surface_.get()) 122 if (!surface_.get())
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 client_->DidLoseContext(); 254 client_->DidLoseContext();
248 } 255 }
249 256
250 void CommandBufferDriver::OnUpdateVSyncParameters( 257 void CommandBufferDriver::OnUpdateVSyncParameters(
251 const base::TimeTicks timebase, 258 const base::TimeTicks timebase,
252 const base::TimeDelta interval) { 259 const base::TimeDelta interval) {
253 client_->UpdateVSyncParameters(timebase, interval); 260 client_->UpdateVSyncParameters(timebase, interval);
254 } 261 }
255 262
256 } // namespace gles2 263 } // namespace gles2
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698