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

Side by Side Diff: components/mus/gles2/command_buffer_driver.cc

Issue 1420503011: GLES2CmdDecoder should resize GLSurface using GLSurface::Resize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 "components/mus/gles2/command_buffer_driver.h" 5 #include "components/mus/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 "base/process/process_handle.h" 10 #include "base/process/process_handle.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 command_buffer_.reset( 107 command_buffer_.reset(
108 new gpu::CommandBufferService(context_group->transfer_buffer_manager())); 108 new gpu::CommandBufferService(context_group->transfer_buffer_manager()));
109 bool result = command_buffer_->Initialize(); 109 bool result = command_buffer_->Initialize();
110 DCHECK(result); 110 DCHECK(result);
111 111
112 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get())); 112 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get()));
113 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(), 113 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), decoder_.get(),
114 decoder_.get())); 114 decoder_.get()));
115 decoder_->set_engine(scheduler_.get()); 115 decoder_->set_engine(scheduler_.get());
116 decoder_->SetResizeCallback(
117 base::Bind(&CommandBufferDriver::OnResize, base::Unretained(this)));
118 decoder_->SetWaitSyncPointCallback(base::Bind( 116 decoder_->SetWaitSyncPointCallback(base::Bind(
119 &CommandBufferDriver::OnWaitSyncPoint, base::Unretained(this))); 117 &CommandBufferDriver::OnWaitSyncPoint, base::Unretained(this)));
120 decoder_->SetFenceSyncReleaseCallback(base::Bind( 118 decoder_->SetFenceSyncReleaseCallback(base::Bind(
121 &CommandBufferDriver::OnFenceSyncRelease, base::Unretained(this))); 119 &CommandBufferDriver::OnFenceSyncRelease, base::Unretained(this)));
122 decoder_->SetWaitFenceSyncCallback(base::Bind( 120 decoder_->SetWaitFenceSyncCallback(base::Bind(
123 &CommandBufferDriver::OnWaitFenceSync, base::Unretained(this))); 121 &CommandBufferDriver::OnWaitFenceSync, base::Unretained(this)));
124 122
125 gpu::gles2::DisallowedFeatures disallowed_features; 123 gpu::gles2::DisallowedFeatures disallowed_features;
126 124
127 const bool offscreen = true; 125 const bool offscreen = true;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (!MakeCurrent()) 267 if (!MakeCurrent())
270 return; 268 return;
271 image_manager->RemoveImage(id); 269 image_manager->RemoveImage(id);
272 } 270 }
273 271
274 void CommandBufferDriver::OnParseError() { 272 void CommandBufferDriver::OnParseError() {
275 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); 273 gpu::CommandBuffer::State state = command_buffer_->GetLastState();
276 OnContextLost(state.context_lost_reason); 274 OnContextLost(state.context_lost_reason);
277 } 275 }
278 276
279 void CommandBufferDriver::OnResize(gfx::Size size, float scale_factor) {
280 surface_->Resize(size);
281 }
282
283 bool CommandBufferDriver::OnWaitSyncPoint(uint32_t sync_point) { 277 bool CommandBufferDriver::OnWaitSyncPoint(uint32_t sync_point) {
284 if (!sync_point) 278 if (!sync_point)
285 return true; 279 return true;
286 if (gpu_state_->sync_point_manager()->IsSyncPointRetired(sync_point)) 280 if (gpu_state_->sync_point_manager()->IsSyncPointRetired(sync_point))
287 return true; 281 return true;
288 scheduler_->SetScheduled(false); 282 scheduler_->SetScheduled(false);
289 gpu_state_->sync_point_manager()->AddSyncPointCallback( 283 gpu_state_->sync_point_manager()->AddSyncPointCallback(
290 sync_point, base::Bind(&CommandBufferDriver::OnSyncPointRetired, 284 sync_point, base::Bind(&CommandBufferDriver::OnSyncPointRetired,
291 weak_factory_.GetWeakPtr())); 285 weak_factory_.GetWeakPtr()));
292 return scheduler_->scheduled(); 286 return scheduler_->scheduled();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 336
343 void CommandBufferDriver::DestroyDecoder() { 337 void CommandBufferDriver::DestroyDecoder() {
344 if (decoder_) { 338 if (decoder_) {
345 bool have_context = decoder_->MakeCurrent(); 339 bool have_context = decoder_->MakeCurrent();
346 decoder_->Destroy(have_context); 340 decoder_->Destroy(have_context);
347 decoder_.reset(); 341 decoder_.reset();
348 } 342 }
349 } 343 }
350 344
351 } // namespace mus 345 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/gles2/command_buffer_driver.h ('k') | components/mus/gles2/command_buffer_local.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698