| Flutter Impeller |

Public Types | Public Member Functions | Friends | List of all members
impeller::CommandEncoderVK Class Reference

`#include <command_encoder_vk.h>`

## Public Types
using | SubmitCallback = std::function< void(bool)>

## Public Member Functions
| CommandEncoderVK (std::weak_ptr< const DeviceHolderVK > device_holder, std::shared_ptr< TrackedObjectsVK > tracked_objects, const std::shared_ptr< QueueVK > &queue, std::shared_ptr< FenceWaiterVK > fence_waiter)
| ~CommandEncoderVK ()
bool | IsValid () const
bool | Track (std::shared_ptr< SharedObjectVK > object)
bool | Track (std::shared_ptr< const DeviceBuffer > buffer)
bool | IsTracking (const std::shared_ptr< const DeviceBuffer > &texture) const
bool | Track (const std::shared_ptr< const Texture > &texture)
bool | IsTracking (const std::shared_ptr< const Texture > &texture) const
bool | Track (std::shared_ptr< const TextureSourceVK > texture)
vk::CommandBuffer | GetCommandBuffer () const
void | PushDebugGroup (std::string_view label) const
void | PopDebugGroup () const
void | InsertDebugMarker (std::string_view label) const
bool | EndCommandBuffer () const
fml::StatusOr< vk::DescriptorSet > | AllocateDescriptorSets (const vk::DescriptorSetLayout &layout, const ContextVK &context)

## Friends
class | ContextVK
class | CommandQueueVK

## Detailed Description

Definition at line 50 of file command_encoder_vk.h.

## Member Typedef Documentation

## ◆ SubmitCallback

using impeller::CommandEncoderVK::SubmitCallback = std::function<void(bool)>

Definition at line 52 of file command_encoder_vk.h.

## Constructor & Destructor Documentation

## ◆ CommandEncoderVK()

impeller::CommandEncoderVK::CommandEncoderVK | ( | std::weak_ptr< const DeviceHolderVK > | device_holder,
|  | std::shared_ptr< TrackedObjectsVK > | tracked_objects,
|  | const std::shared_ptr< QueueVK > & | queue,
|  | std::shared_ptr< FenceWaiterVK > | fence_waiter
| ) |  |

Definition at line 68 of file command_encoder_vk.cc.

73 : device_holder_(std::move(device_holder)),
74 tracked_objects_(std::move(tracked_objects)),
75 queue_(queue),
76 fence_waiter_(std::move(fence_waiter)) {}

## ◆ ~CommandEncoderVK()

impeller::CommandEncoderVK::~CommandEncoderVK | ( |  | ) |
| default

## Member Function Documentation

## ◆ AllocateDescriptorSets()

fml::StatusOr< vk::DescriptorSet > impeller::CommandEncoderVK::AllocateDescriptorSets | ( | const vk::DescriptorSetLayout & | layout,
|  | const ContextVK & | context
| ) |  |

Definition at line 164 of file command_encoder_vk.cc.

166 {
167 if (!IsValid()) {
168 return fml::Status(fml::StatusCode::kUnknown, "command encoder invalid");
169 }
170
171 return tracked_objects_->GetDescriptorPool().AllocateDescriptorSets(layout,
172 context);
173 }

References IsValid().

## ◆ EndCommandBuffer()

bool impeller::CommandEncoderVK::EndCommandBuffer | ( |  | ) | const

Definition at line 84 of file command_encoder_vk.cc.

84 {
85 InsertDebugMarker("QueueSubmit");
86
87 auto command_buffer = GetCommandBuffer();
88 tracked_objects_->GetGPUProbe().RecordCmdBufferEnd(command_buffer);
89
90 auto status = command_buffer.end();
91 if (status != vk::Result::eSuccess) {
92 VALIDATION_LOG << "Failed to end command buffer: " << vk::to_string(status);
93 return false;
94 }
95 return true;
96 }

References GetCommandBuffer(), InsertDebugMarker(), and VALIDATION_LOG.

## ◆ GetCommandBuffer()

vk::CommandBuffer impeller::CommandEncoderVK::GetCommandBuffer | ( |  | ) | const

Definition at line 98 of file command_encoder_vk.cc.

98 {
99 if (tracked_objects_) {
100 return tracked_objects_->GetCommandBuffer();
101 }
102 return {};
103 }

Referenced by impeller::BlitCopyTextureToTextureCommandVK::Encode(), impeller::BlitCopyTextureToBufferCommandVK::Encode(), impeller::BlitCopyBufferToTextureCommandVK::Encode(), impeller::BlitGenerateMipmapCommandVK::Encode(), EndCommandBuffer(), InsertDebugMarker(), PopDebugGroup(), and PushDebugGroup().

## ◆ InsertDebugMarker()

void impeller::CommandEncoderVK::InsertDebugMarker | ( | std::string_view | label | ) | const

Definition at line 195 of file command_encoder_vk.cc.

195 {
196 if (!HasValidationLayers()) {
197 return;
198 }
199 vk::DebugUtilsLabelEXT label_info;
200 label_info.pLabelName = label.data();
201 if (auto command_buffer = GetCommandBuffer()) {
202 command_buffer.insertDebugUtilsLabelEXT(label_info);
203 }
204 if (queue_) {
205 queue_->InsertDebugMarker(label);
206 }
207 }

References GetCommandBuffer(), and impeller::HasValidationLayers().

Referenced by EndCommandBuffer().

## ◆ IsTracking() [1/2]

bool impeller::CommandEncoderVK::IsTracking | ( | const std::shared_ptr< const DeviceBuffer > & | texture | ) | const

Definition at line 128 of file command_encoder_vk.cc.

129 {
130 if (!IsValid()) {
131 return false;
132 }
133 return tracked_objects_->IsTracking(buffer);
134 }

References IsValid().

## ◆ IsTracking() [2/2]

bool impeller::CommandEncoderVK::IsTracking | ( | const std::shared_ptr< const Texture > & | texture | ) | const

Definition at line 154 of file command_encoder_vk.cc.

155 {
156 if (!IsValid()) {
157 return false;
158 }
159 std::shared_ptr<const TextureSourceVK> source =
160 TextureVK::Cast(*texture).GetTextureSource();
161 return tracked_objects_->IsTracking(source);
162 }

References impeller::BackendCast< TextureVK, Texture >::Cast(), impeller::TextureVK::GetTextureSource(), and IsValid().

## ◆ IsValid()

bool impeller::CommandEncoderVK::IsValid | ( |  | ) | const

Definition at line 80 of file command_encoder_vk.cc.

80 {
81 return is_valid_;
82 }

Referenced by AllocateDescriptorSets(), IsTracking(), and Track().

## ◆ PopDebugGroup()

void impeller::CommandEncoderVK::PopDebugGroup | ( |  | ) | const

Definition at line 186 of file command_encoder_vk.cc.

186 {
187 if (!HasValidationLayers()) {
188 return;
189 }
190 if (auto command_buffer = GetCommandBuffer()) {
191 command_buffer.endDebugUtilsLabelEXT();
192 }
193 }

References GetCommandBuffer(), and impeller::HasValidationLayers().

## ◆ PushDebugGroup()

void impeller::CommandEncoderVK::PushDebugGroup | ( | std::string_view | label | ) | const

Definition at line 175 of file command_encoder_vk.cc.

175 {
176 if (!HasValidationLayers()) {
177 return;
178 }
179 vk::DebugUtilsLabelEXT label_info;
180 label_info.pLabelName = label.data();
181 if (auto command_buffer = GetCommandBuffer()) {
182 command_buffer.beginDebugUtilsLabelEXT(label_info);
183 }
184 }

References GetCommandBuffer(), and impeller::HasValidationLayers().

## ◆ Track() [1/4]

bool impeller::CommandEncoderVK::Track | ( | const std::shared_ptr< const Texture > & | texture | ) |

Definition at line 144 of file command_encoder_vk.cc.

144 {
145 if (!IsValid()) {
146 return false;
147 }
148 if (!texture) {
149 return true;
150 }
151 return Track(TextureVK::Cast(*texture).GetTextureSource());
152 }

References impeller::BackendCast< TextureVK, Texture >::Cast(), impeller::TextureVK::GetTextureSource(), IsValid(), and Track().

## ◆ Track() [2/4]

bool impeller::CommandEncoderVK::Track | ( | std::shared_ptr< const DeviceBuffer > | buffer | ) |

Definition at line 120 of file command_encoder_vk.cc.

120 {
121 if (!IsValid()) {
122 return false;
123 }
124 tracked_objects_->Track(std::move(buffer));
125 return true;
126 }

References IsValid().

## ◆ Track() [3/4]

bool impeller::CommandEncoderVK::Track | ( | std::shared_ptr< const TextureSourceVK > | texture | ) |

Definition at line 136 of file command_encoder_vk.cc.

136 {
137 if (!IsValid()) {
138 return false;
139 }
140 tracked_objects_->Track(std::move(texture));
141 return true;
142 }

References IsValid().

## ◆ Track() [4/4]

bool impeller::CommandEncoderVK::Track | ( | std::shared_ptr< SharedObjectVK > | object | ) |

Definition at line 112 of file command_encoder_vk.cc.

112 {
113 if (!IsValid()) {
114 return false;
115 }
116 tracked_objects_->Track(std::move(object));
117 return true;
118 }

References IsValid().

Referenced by impeller::BlitCopyTextureToTextureCommandVK::Encode(), impeller::BlitCopyTextureToBufferCommandVK::Encode(), impeller::BlitCopyBufferToTextureCommandVK::Encode(), impeller::BlitGenerateMipmapCommandVK::Encode(), and Track().

## Friends And Related Function Documentation

## ◆ CommandQueueVK

friend class CommandQueueVK
| friend

Definition at line 92 of file command_encoder_vk.h.

## ◆ ContextVK

friend class ContextVK
| friend

Definition at line 91 of file command_encoder_vk.h.

The documentation for this class was generated from the following files:

- impeller/renderer/backend/vulkan/command_encoder_vk.h
- impeller/renderer/backend/vulkan/command_encoder_vk.cc

impeller::CommandEncoderVK::InsertDebugMarker
void InsertDebugMarker(std::string_view label) const
Definition: command_encoder_vk.cc:195
impeller::TextureVK::GetTextureSource
std::shared_ptr< const TextureSourceVK > GetTextureSource() const
Definition: texture_vk.cc:155
impeller::CommandEncoderVK::Track
bool Track(std::shared_ptr< SharedObjectVK > object)
Definition: command_encoder_vk.cc:112
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:73
impeller::BackendCast< TextureVK, Texture >::Cast
static TextureVK & Cast(Texture &base)
Definition: backend_cast.h:13
impeller::HasValidationLayers
bool HasValidationLayers()
Definition: context_vk.cc:48
impeller::CommandEncoderVK::IsValid
bool IsValid() const
Definition: command_encoder_vk.cc:80
impeller::CommandEncoderVK::GetCommandBuffer
vk::CommandBuffer GetCommandBuffer() const
Definition: command_encoder_vk.cc:98