OLD | NEW |
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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 decoder_.get())); | 616 decoder_.get())); |
617 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient( | 617 sync_point_client_ = channel_->sync_point_manager()->CreateSyncPointClient( |
618 channel_->GetSyncPointOrderData(stream_id_), | 618 channel_->GetSyncPointOrderData(stream_id_), |
619 CommandBufferNamespace::GPU_IO, command_buffer_id_); | 619 CommandBufferNamespace::GPU_IO, command_buffer_id_); |
620 | 620 |
621 executor_->SetPreemptByFlag(channel_->preempted_flag()); | 621 executor_->SetPreemptByFlag(channel_->preempted_flag()); |
622 | 622 |
623 decoder_->set_engine(executor_.get()); | 623 decoder_->set_engine(executor_.get()); |
624 | 624 |
625 if (offscreen) { | 625 if (offscreen) { |
626 surface_ = default_surface; | 626 if (init_params.attribs.own_offscreen_surface) { |
| 627 DVLOG(1) << __FUNCTION__ << "Hit the own_offscreen_surface path"; |
| 628 use_virtualized_gl_context_ = false; |
| 629 // Currently, we can't separately control alpha channel for surfaces, |
| 630 // it's generally enabled by default except for RGB565 and (on desktop) |
| 631 // smaller-than-32bit formats. |
| 632 // |
| 633 // TODO(klausw): use init_params.attribs.alpha_size here if possible. |
| 634 if (init_params.attribs.depth_size > 0) { |
| 635 surface_format.SetDepthBits(init_params.attribs.depth_size); |
| 636 } |
| 637 if (init_params.attribs.samples > 0) { |
| 638 surface_format.SetSamples(init_params.attribs.samples); |
| 639 } |
| 640 if (init_params.attribs.stencil_size > 0) { |
| 641 surface_format.SetStencilBits(init_params.attribs.stencil_size); |
| 642 } |
| 643 surface_ = gl::init::CreateOffscreenGLSurfaceWithFormat( |
| 644 gfx::Size(), surface_format); |
| 645 if (!surface_) { |
| 646 DLOG(ERROR) << "Failed to create surface."; |
| 647 return false; |
| 648 } |
| 649 } else { |
| 650 surface_ = default_surface; |
| 651 } |
627 } else { | 652 } else { |
628 surface_ = ImageTransportSurface::CreateNativeSurface( | 653 surface_ = ImageTransportSurface::CreateNativeSurface( |
629 AsWeakPtr(), surface_handle_, surface_format); | 654 AsWeakPtr(), surface_handle_, surface_format); |
630 if (!surface_ || !surface_->Initialize(surface_format)) { | 655 if (!surface_ || !surface_->Initialize(surface_format)) { |
631 surface_ = nullptr; | 656 surface_ = nullptr; |
632 DLOG(ERROR) << "Failed to create surface."; | 657 DLOG(ERROR) << "Failed to create surface."; |
633 return false; | 658 return false; |
634 } | 659 } |
635 } | 660 } |
636 | 661 |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 command_buffer_->GetLastState().error == error::kLostContext) | 1227 command_buffer_->GetLastState().error == error::kLostContext) |
1203 return; | 1228 return; |
1204 | 1229 |
1205 command_buffer_->SetContextLostReason(error::kUnknown); | 1230 command_buffer_->SetContextLostReason(error::kUnknown); |
1206 if (decoder_) | 1231 if (decoder_) |
1207 decoder_->MarkContextLost(error::kUnknown); | 1232 decoder_->MarkContextLost(error::kUnknown); |
1208 command_buffer_->SetParseError(error::kLostContext); | 1233 command_buffer_->SetParseError(error::kLostContext); |
1209 } | 1234 } |
1210 | 1235 |
1211 } // namespace gpu | 1236 } // namespace gpu |
OLD | NEW |