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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 1776453003: Added initial implementation of Vulkan Render Passes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn_vulkan
Patch Set: Ensure vulkan handles all initialized to null, check destruction in destructor Created 4 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
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 "content/common/gpu/gpu_command_buffer_stub.h" 5 #include "content/common/gpu/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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 #if defined(OS_WIN) 45 #if defined(OS_WIN)
46 #include "base/win/win_util.h" 46 #include "base/win/win_util.h"
47 #include "content/public/common/sandbox_init.h" 47 #include "content/public/common/sandbox_init.h"
48 #endif 48 #endif
49 49
50 #if defined(OS_ANDROID) 50 #if defined(OS_ANDROID)
51 #include "content/common/gpu/stream_texture_android.h" 51 #include "content/common/gpu/stream_texture_android.h"
52 #endif 52 #endif
53 53
54 #if defined(ENABLE_VULKAN)
55 #include "gpu/vulkan/vulkan_surface.h"
56 #endif
57
54 namespace content { 58 namespace content {
55 struct WaitForCommandState { 59 struct WaitForCommandState {
56 WaitForCommandState(int32_t start, int32_t end, IPC::Message* reply) 60 WaitForCommandState(int32_t start, int32_t end, IPC::Message* reply)
57 : start(start), end(end), reply(reply) {} 61 : start(start), end(end), reply(reply) {}
58 62
59 int32_t start; 63 int32_t start;
60 int32_t end; 64 int32_t end;
61 scoped_ptr<IPC::Message> reply; 65 scoped_ptr<IPC::Message> reply;
62 }; 66 };
63 67
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 destruction_observers_, 488 destruction_observers_,
485 OnWillDestroyStub()); 489 OnWillDestroyStub());
486 490
487 if (decoder_) { 491 if (decoder_) {
488 decoder_->Destroy(have_context); 492 decoder_->Destroy(have_context);
489 decoder_.reset(); 493 decoder_.reset();
490 } 494 }
491 495
492 command_buffer_.reset(); 496 command_buffer_.reset();
493 497
498 #if defined(ENABLE_VULKAN)
499 if (vk_surface_) {
500 vk_surface_->Destroy();
501 vk_surface_.reset();
502 }
503 #endif
504
494 // Remove this after crbug.com/248395 is sorted out. 505 // Remove this after crbug.com/248395 is sorted out.
495 surface_ = NULL; 506 surface_ = NULL;
496 } 507 }
497 508
498 void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) { 509 void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) {
499 Destroy(); 510 Destroy();
500 GpuCommandBufferMsg_Initialize::WriteReplyParams( 511 GpuCommandBufferMsg_Initialize::WriteReplyParams(
501 reply_message, false, gpu::Capabilities()); 512 reply_message, false, gpu::Capabilities());
502 Send(reply_message); 513 Send(reply_message);
503 } 514 }
(...skipping 28 matching lines...) Expand all
532 scheduler_->SetPreemptByFlag(preemption_flag_); 543 scheduler_->SetPreemptByFlag(preemption_flag_);
533 544
534 decoder_->set_engine(scheduler_.get()); 545 decoder_->set_engine(scheduler_.get());
535 546
536 if (!handle_.is_null()) { 547 if (!handle_.is_null()) {
537 surface_ = ImageTransportSurface::CreateSurface( 548 surface_ = ImageTransportSurface::CreateSurface(
538 channel_->gpu_channel_manager(), 549 channel_->gpu_channel_manager(),
539 this, 550 this,
540 handle_, 551 handle_,
541 surface_format_); 552 surface_format_);
553 #if defined(ENABLE_VULKAN)
554 vk_surface_ = gfx::VulkanSurface::CreateViewSurface(handle_.handle);
555 bool vk_result = vk_surface_->Initialize(
556 static_cast<gfx::VulkanSurface::Format>(surface_format_));
557 DCHECK(vk_result);
558 #endif
542 } else { 559 } else {
543 surface_ = manager->GetDefaultOffscreenSurface(); 560 surface_ = manager->GetDefaultOffscreenSurface();
544 } 561 }
545 562
546 if (!surface_.get()) { 563 if (!surface_.get()) {
547 DLOG(ERROR) << "Failed to create surface."; 564 DLOG(ERROR) << "Failed to create surface.";
548 OnInitializeFailed(reply_message); 565 OnInitializeFailed(reply_message);
549 return; 566 return;
550 } 567 }
551 568
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 result)); 1148 result));
1132 } 1149 }
1133 1150
1134 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1151 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1135 base::TimeDelta interval) { 1152 base::TimeDelta interval) {
1136 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1153 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1137 interval)); 1154 interval));
1138 } 1155 }
1139 1156
1140 } // namespace content 1157 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698