Flutter Engine
 
Loading...
Searching...
No Matches
command_buffer_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_BUFFER_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMMAND_BUFFER_VK_H_
7
8#include "fml/status_or.h"
17
18namespace impeller {
19
20class ContextVK;
21class CommandEncoderFactoryVK;
22class CommandEncoderVK;
23
24class CommandBufferVK final
25 : public CommandBuffer,
26 public BackendCast<CommandBufferVK, CommandBuffer>,
27 public std::enable_shared_from_this<CommandBufferVK> {
28 public:
29 // |CommandBuffer|
30 ~CommandBufferVK() override;
31
32 // Encoder Functionality
33
34 /// @brief Ensure that [object] is kept alive until this command buffer
35 /// completes execution.
36 bool Track(const std::shared_ptr<SharedObjectVK>& object);
37
38 /// @brief Ensure that [buffer] is kept alive until this command buffer
39 /// completes execution.
40 bool Track(const std::shared_ptr<const DeviceBuffer>& buffer);
41
42 /// @brief Ensure that [texture] is kept alive until this command buffer
43 /// completes execution.
44 bool Track(const std::shared_ptr<const Texture>& texture);
45
46 /// @brief Ensure that [texture] is kept alive until this command buffer
47 /// completes execution.
48 bool Track(const std::shared_ptr<const TextureSourceVK>& texture);
49
50 /// @brief Retrieve the native command buffer from this object.
51 vk::CommandBuffer GetCommandBuffer() const;
52
53 /// @brief Push a debug group.
54 ///
55 /// This label is only visible in debuggers like RenderDoc. This function is
56 /// ignored in release builds.
57 void PushDebugGroup(std::string_view label) const;
58
59 /// @brief Pop the previous debug group.
60 ///
61 /// This label is only visible in debuggers like RenderDoc. This function is
62 /// ignored in release builds.
63 void PopDebugGroup() const;
64
65 /// @brief Insert a new debug marker.
66 ///
67 /// This label is only visible in debuggers like RenderDoc. This function is
68 /// ignored in release builds.
69 void InsertDebugMarker(std::string_view label) const;
70
71 /// @brief End recording of the current command buffer.
72 bool EndCommandBuffer() const;
73
74 /// @brief Allocate a new descriptor set for the given [layout].
76 const vk::DescriptorSetLayout& layout,
77 PipelineKey pipeline_key,
78 const ContextVK& context);
79
80 // Visible for testing.
82
83 private:
84 friend class ContextVK;
85 friend class CommandQueueVK;
86
87 std::weak_ptr<const DeviceHolderVK> device_holder_;
88 std::shared_ptr<TrackedObjectsVK> tracked_objects_;
89
90 CommandBufferVK(std::weak_ptr<const Context> context,
91 std::weak_ptr<const DeviceHolderVK> device_holder,
92 std::shared_ptr<TrackedObjectsVK> tracked_objects);
93
94 // |CommandBuffer|
95 void SetLabel(std::string_view label) const override;
96
97 // |CommandBuffer|
98 bool IsValid() const override;
99
100 // |CommandBuffer|
101 bool OnSubmitCommands(bool block_on_schedule,
103
104 // |CommandBuffer|
105 void OnWaitUntilCompleted() override;
106
107 // |CommandBuffer|
108 void OnWaitUntilScheduled() override;
109
110 // |CommandBuffer|
111 std::shared_ptr<RenderPass> OnCreateRenderPass(RenderTarget target) override;
112
113 // |CommandBuffer|
114 std::shared_ptr<BlitPass> OnCreateBlitPass() override;
115
116 // |CommandBuffer|
117 std::shared_ptr<ComputePass> OnCreateComputePass() override;
118
119 CommandBufferVK(const CommandBufferVK&) = delete;
120
121 CommandBufferVK& operator=(const CommandBufferVK&) = delete;
122};
123
124} // namespace impeller
125
126#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_COMMAND_BUFFER_VK_H_
A collection of encoded commands to be submitted to the GPU for execution. A command buffer is obtain...
std::function< void(Status)> CompletionCallback
fml::StatusOr< vk::DescriptorSet > AllocateDescriptorSets(const vk::DescriptorSetLayout &layout, PipelineKey pipeline_key, const ContextVK &context)
Allocate a new descriptor set for the given [layout].
void PushDebugGroup(std::string_view label) const
Push a debug group.
void InsertDebugMarker(std::string_view label) const
Insert a new debug marker.
DescriptorPoolVK & GetDescriptorPool() const
bool Track(const std::shared_ptr< SharedObjectVK > &object)
Ensure that [object] is kept alive until this command buffer completes execution.
bool EndCommandBuffer() const
End recording of the current command buffer.
void PopDebugGroup() const
Pop the previous debug group.
vk::CommandBuffer GetCommandBuffer() const
Retrieve the native command buffer from this object.
A per-frame descriptor pool. Descriptors from this pool don't need to be freed individually....
uint32_t * target
FlutterDesktopBinaryReply callback
FlTexture * texture
int64_t PipelineKey
Definition pipeline.h:21