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

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

Issue 2761153002: Ignore custom offscreen surface unless explicitly opted in (Closed)
Patch Set: Make "own offscreen surface" support explicit with its own attribute. Created 3 years, 9 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 | « gpu/ipc/common/gpu_command_buffer_traits_multi.h ('k') | 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 (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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 sync_point_client_ = base::MakeUnique<SyncPointClient>( 648 sync_point_client_ = base::MakeUnique<SyncPointClient>(
649 channel_->sync_point_manager(), 649 channel_->sync_point_manager(),
650 channel_->GetSyncPointOrderData(stream_id_), 650 channel_->GetSyncPointOrderData(stream_id_),
651 CommandBufferNamespace::GPU_IO, command_buffer_id_); 651 CommandBufferNamespace::GPU_IO, command_buffer_id_);
652 652
653 executor_->SetPreemptByFlag(channel_->preempted_flag()); 653 executor_->SetPreemptByFlag(channel_->preempted_flag());
654 654
655 decoder_->set_engine(executor_.get()); 655 decoder_->set_engine(executor_.get());
656 656
657 if (offscreen) { 657 if (offscreen) {
658 if (init_params.attribs.depth_size > 0) { 658 // Do we want to create an offscreen rendering context suitable
659 surface_format.SetDepthBits(init_params.attribs.depth_size); 659 // for directly drawing to a separately supplied surface? In that
660 // case, we must ensure that the surface used for context creation
661 // is compatible with the requested attributes. This is explicitly
662 // opt-in since some context such as for NaCl request custom
663 // attributes but don't expect to get their own surface, and not
664 // all surface factories support custom formats.
665 if (init_params.attribs.own_offscreen_surface) {
666 if (init_params.attribs.depth_size > 0) {
667 surface_format.SetDepthBits(init_params.attribs.depth_size);
668 }
669 if (init_params.attribs.samples > 0) {
670 surface_format.SetSamples(init_params.attribs.samples);
671 }
672 if (init_params.attribs.stencil_size > 0) {
673 surface_format.SetStencilBits(init_params.attribs.stencil_size);
674 }
675 // Currently, we can't separately control alpha channel for surfaces,
676 // it's generally enabled by default except for RGB565 and (on desktop)
677 // smaller-than-32bit formats.
678 //
679 // TODO(klausw): use init_params.attribs.alpha_size here if possible.
660 } 680 }
661 if (init_params.attribs.samples > 0) {
662 surface_format.SetSamples(init_params.attribs.samples);
663 }
664 if (init_params.attribs.stencil_size > 0) {
665 surface_format.SetStencilBits(init_params.attribs.stencil_size);
666 }
667 // Currently, we can't separately control alpha channel for surfaces,
668 // it's generally enabled by default except for RGB565 and (on desktop)
669 // smaller-than-32bit formats.
670 //
671 // TODO(klausw): use init_params.attribs.alpha_size here if possible.
672 if (!surface_format.IsCompatible(default_surface->GetFormat())) { 681 if (!surface_format.IsCompatible(default_surface->GetFormat())) {
673 DVLOG(1) << __FUNCTION__ << ": Hit the OwnOffscreenSurface path"; 682 DVLOG(1) << __FUNCTION__ << ": Hit the OwnOffscreenSurface path";
674 use_virtualized_gl_context_ = false; 683 use_virtualized_gl_context_ = false;
675 surface_ = gl::init::CreateOffscreenGLSurfaceWithFormat(gfx::Size(), 684 surface_ = gl::init::CreateOffscreenGLSurfaceWithFormat(gfx::Size(),
676 surface_format); 685 surface_format);
677 if (!surface_) { 686 if (!surface_) {
678 DLOG(ERROR) << "Failed to create surface."; 687 DLOG(ERROR) << "Failed to create surface.";
679 return false; 688 return false;
680 } 689 }
681 } else { 690 } else {
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 command_buffer_->GetLastState().error == error::kLostContext) 1237 command_buffer_->GetLastState().error == error::kLostContext)
1229 return; 1238 return;
1230 1239
1231 command_buffer_->SetContextLostReason(error::kUnknown); 1240 command_buffer_->SetContextLostReason(error::kUnknown);
1232 if (decoder_) 1241 if (decoder_)
1233 decoder_->MarkContextLost(error::kUnknown); 1242 decoder_->MarkContextLost(error::kUnknown);
1234 command_buffer_->SetParseError(error::kLostContext); 1243 command_buffer_->SetParseError(error::kLostContext);
1235 } 1244 }
1236 1245
1237 } // namespace gpu 1246 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/common/gpu_command_buffer_traits_multi.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698