Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
command_encoder_vk.h
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
5#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMMAND_ENCODER_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMMAND_ENCODER_VK_H_
7
8#include <cstdint>
9#include <functional>
10#include <optional>
11
20
21namespace impeller {
22
23class ContextVK;
24class DeviceBuffer;
25class Buffer;
26class Texture;
27class TextureSourceVK;
28class TrackedObjectsVK;
29class FenceWaiterVK;
30class GPUProbe;
31
33 public:
35 const std::weak_ptr<const ContextVK>& context);
36
37 std::shared_ptr<CommandEncoderVK> Create();
38
39 void SetLabel(const std::string& label);
40
41 private:
42 std::weak_ptr<const ContextVK> context_;
43 std::optional<std::string> label_;
44
46
47 CommandEncoderFactoryVK& operator=(const CommandEncoderFactoryVK&) = delete;
48};
49
51 public:
52 using SubmitCallback = std::function<void(bool)>;
53
54 // Visible for testing.
55 CommandEncoderVK(std::weak_ptr<const DeviceHolderVK> device_holder,
56 std::shared_ptr<TrackedObjectsVK> tracked_objects,
57 const std::shared_ptr<QueueVK>& queue,
58 std::shared_ptr<FenceWaiterVK> fence_waiter);
59
61
62 bool IsValid() const;
63
64 bool Track(std::shared_ptr<SharedObjectVK> object);
65
66 bool Track(std::shared_ptr<const DeviceBuffer> buffer);
67
68 bool IsTracking(const std::shared_ptr<const DeviceBuffer>& texture) const;
69
70 bool Track(const std::shared_ptr<const Texture>& texture);
71
72 bool IsTracking(const std::shared_ptr<const Texture>& texture) const;
73
74 bool Track(std::shared_ptr<const TextureSourceVK> texture);
75
76 vk::CommandBuffer GetCommandBuffer() const;
77
78 void PushDebugGroup(std::string_view label) const;
79
80 void PopDebugGroup() const;
81
82 void InsertDebugMarker(std::string_view label) const;
83
84 bool EndCommandBuffer() const;
85
87 const vk::DescriptorSetLayout& layout,
88 const ContextVK& context);
89
90 private:
91 friend class ContextVK;
92 friend class CommandQueueVK;
93
94 std::weak_ptr<const DeviceHolderVK> device_holder_;
95 std::shared_ptr<TrackedObjectsVK> tracked_objects_;
96 std::shared_ptr<QueueVK> queue_;
97 const std::shared_ptr<FenceWaiterVK> fence_waiter_;
98 std::shared_ptr<HostBuffer> host_buffer_;
99 bool is_valid_ = true;
100
101 void Reset();
102
103 CommandEncoderVK(const CommandEncoderVK&) = delete;
104
105 CommandEncoderVK& operator=(const CommandEncoderVK&) = delete;
106};
107
108} // namespace impeller
109
110#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMMAND_ENCODER_VK_H_
std::shared_ptr< CommandEncoderVK > Create()
void SetLabel(const std::string &label)
void PushDebugGroup(std::string_view label) const
bool Track(std::shared_ptr< SharedObjectVK > object)
vk::CommandBuffer GetCommandBuffer() const
bool IsTracking(const std::shared_ptr< const DeviceBuffer > &texture) const
std::function< void(bool)> SubmitCallback
fml::StatusOr< vk::DescriptorSet > AllocateDescriptorSets(const vk::DescriptorSetLayout &layout, const ContextVK &context)
void InsertDebugMarker(std::string_view label) const
static const uint8_t buffer[]
FlTexture * texture