Flutter Engine
The Flutter Engine
command_buffer_vk.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7#include <memory>
8#include <utility>
9
10#include "fml/logging.h"
18
19namespace impeller {
20
21CommandBufferVK::CommandBufferVK(
22 std::weak_ptr<const Context> context,
23 std::shared_ptr<CommandEncoderFactoryVK> encoder_factory)
24 : CommandBuffer(std::move(context)),
25 encoder_factory_(std::move(encoder_factory)) {}
26
27CommandBufferVK::~CommandBufferVK() = default;
28
29void CommandBufferVK::SetLabel(const std::string& label) const {
30 if (!encoder_) {
31 encoder_factory_->SetLabel(label);
32 } else {
33 auto context = context_.lock();
34 if (!context || !encoder_) {
35 return;
36 }
37 ContextVK::Cast(*context).SetDebugName(encoder_->GetCommandBuffer(), label);
38 }
39}
40
41bool CommandBufferVK::IsValid() const {
42 return true;
43}
44
45const std::shared_ptr<CommandEncoderVK>& CommandBufferVK::GetEncoder() {
46 if (!encoder_) {
47 encoder_ = encoder_factory_->Create();
48 }
49 return encoder_;
50}
51
52bool CommandBufferVK::OnSubmitCommands(CompletionCallback callback) {
54}
55
56void CommandBufferVK::OnWaitUntilScheduled() {}
57
58std::shared_ptr<RenderPass> CommandBufferVK::OnCreateRenderPass(
60 auto context = context_.lock();
61 if (!context) {
62 return nullptr;
63 }
64 auto pass =
65 std::shared_ptr<RenderPassVK>(new RenderPassVK(context, //
66 target, //
67 shared_from_this() //
68 ));
69 if (!pass->IsValid()) {
70 return nullptr;
71 }
72 return pass;
73}
74
75std::shared_ptr<BlitPass> CommandBufferVK::OnCreateBlitPass() {
76 if (!IsValid()) {
77 return nullptr;
78 }
79 auto pass = std::shared_ptr<BlitPassVK>(new BlitPassVK(shared_from_this()));
80 if (!pass->IsValid()) {
81 return nullptr;
82 }
83 return pass;
84}
85
86std::shared_ptr<ComputePass> CommandBufferVK::OnCreateComputePass() {
87 if (!IsValid()) {
88 return nullptr;
89 }
90 auto context = context_.lock();
91 if (!context) {
92 return nullptr;
93 }
94 auto pass =
95 std::shared_ptr<ComputePassVK>(new ComputePassVK(context, //
96 shared_from_this() //
97 ));
98 if (!pass->IsValid()) {
99 return nullptr;
100 }
101 return pass;
102}
103
104} // namespace impeller
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
uint32_t * target
#define FML_UNREACHABLE()
Definition: logging.h:109
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
Definition: ref_ptr.h:256