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

Side by Side Diff: gpu/ipc/service/gpu_command_buffer_stub.cc

Issue 2698573002: Support offscreen contexts which own their backing surface (Closed)
Patch Set: Remove redundant supportOwnOffscreenSurface ContextAttribute Created 3 years, 10 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
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/ipc/service/gpu_command_buffer_stub.h" 5 #include "gpu/ipc/service/gpu_command_buffer_stub.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 decoder_.get())); 619 decoder_.get()));
620 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient( 620 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient(
621 channel_->GetSyncPointOrderData(stream_id_), 621 channel_->GetSyncPointOrderData(stream_id_),
622 CommandBufferNamespace::GPU_IO, command_buffer_id_); 622 CommandBufferNamespace::GPU_IO, command_buffer_id_);
623 623
624 executor_->SetPreemptByFlag(channel_->preempted_flag()); 624 executor_->SetPreemptByFlag(channel_->preempted_flag());
625 625
626 decoder_->set_engine(executor_.get()); 626 decoder_->set_engine(executor_.get());
627 627
628 if (offscreen) { 628 if (offscreen) {
629 surface_ = default_surface; 629 if (init_params.attribs.depth_size > 0) {
630 surface_format.SetDepthBits(init_params.attribs.depth_size);
631 }
632 if (init_params.attribs.samples > 0) {
633 surface_format.SetSamples(init_params.attribs.samples);
634 }
635 if (init_params.attribs.stencil_size > 0) {
636 surface_format.SetStencilBits(init_params.attribs.stencil_size);
637 }
638 // Currently, we can't separately control alpha channel for surfaces,
639 // it's generally enabled by default except for RGB565 and (on desktop)
640 // smaller-than-32bit formats.
641 //
642 // TODO(klausw): use init_params.attribs.alpha_size here if possible.
643 if (!surface_format.IsCompatible(default_surface->GetFormat())) {
644 DVLOG(1) << __FUNCTION__ << ": Hit the OwnOffscreenSurface path";
645 use_virtualized_gl_context_ = false;
646 surface_ = gl::init::CreateOffscreenGLSurfaceWithFormat(gfx::Size(),
647 surface_format);
648 if (!surface_) {
649 DLOG(ERROR) << "Failed to create surface.";
650 return false;
651 }
652 } else {
653 surface_ = default_surface;
654 }
630 } else { 655 } else {
631 surface_ = ImageTransportSurface::CreateNativeSurface( 656 surface_ = ImageTransportSurface::CreateNativeSurface(
632 AsWeakPtr(), surface_handle_, surface_format); 657 AsWeakPtr(), surface_handle_, surface_format);
633 if (!surface_ || !surface_->Initialize(surface_format)) { 658 if (!surface_ || !surface_->Initialize(surface_format)) {
634 surface_ = nullptr; 659 surface_ = nullptr;
635 DLOG(ERROR) << "Failed to create surface."; 660 DLOG(ERROR) << "Failed to create surface.";
636 return false; 661 return false;
637 } 662 }
638 } 663 }
639 664
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 command_buffer_->GetLastState().error == error::kLostContext) 1231 command_buffer_->GetLastState().error == error::kLostContext)
1207 return; 1232 return;
1208 1233
1209 command_buffer_->SetContextLostReason(error::kUnknown); 1234 command_buffer_->SetContextLostReason(error::kUnknown);
1210 if (decoder_) 1235 if (decoder_)
1211 decoder_->MarkContextLost(error::kUnknown); 1236 decoder_->MarkContextLost(error::kUnknown);
1212 command_buffer_->SetParseError(error::kLostContext); 1237 command_buffer_->SetParseError(error::kLostContext);
1213 } 1238 }
1214 1239
1215 } // namespace gpu 1240 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698