| Flutter Impeller |

Public Member Functions | Friends | List of all members
impeller::CommandBufferVK Class Referencefinal

`#include <command_buffer_vk.h>`

Inheritance diagram for impeller::CommandBufferVK:

## Public Member Functions
| ~CommandBufferVK () override
bool | Track (std::shared_ptr< SharedObjectVK > object)
| Ensure that [object] is kept alive until this command buffer completes execution. More...
bool | Track (const std::shared_ptr< const DeviceBuffer > &buffer)
| Ensure that [buffer] is kept alive until this command buffer completes execution. More...
bool | Track (const std::shared_ptr< const Texture > &texture)
| Ensure that [texture] is kept alive until this command buffer completes execution. More...
bool | Track (std::shared_ptr< const TextureSourceVK > texture)
| Ensure that [texture] is kept alive until this command buffer completes execution. More...
vk::CommandBuffer | GetCommandBuffer () const
| Retrieve the native command buffer from this object. More...
void | PushDebugGroup (std::string_view label) const
| Push a debug group. More...
void | PopDebugGroup () const
| Pop the previous debug group. More...
void | InsertDebugMarker (std::string_view label) const
| Insert a new debug marker. More...
bool | EndCommandBuffer () const
| End recording of the current command buffer. More...
fml::StatusOr< vk::DescriptorSet > | AllocateDescriptorSets (const vk::DescriptorSetLayout &layout, const ContextVK &context)
| Allocate a new descriptor set for the given [layout]. More...
bool | IsTracking (const std::shared_ptr< const DeviceBuffer > &texture) const
bool | IsTracking (const std::shared_ptr< const Texture > &texture) const
Public Member Functions inherited from impeller::CommandBuffer
virtual | ~CommandBuffer ()
void | WaitUntilScheduled ()
| Force execution of pending GPU commands. More...
std::shared_ptr< RenderPass > | CreateRenderPass (const RenderTarget &render_target)
| Create a render pass to record render commands into. More...
std::shared_ptr< BlitPass > | CreateBlitPass ()
| Create a blit pass to record blit commands into. More...
std::shared_ptr< ComputePass > | CreateComputePass ()
| Create a compute pass to record compute commands into. More...

## Friends
class | ContextVK
class | CommandQueueVK

## Additional Inherited Members
Public Types inherited from impeller::CommandBuffer
enum | Status { Status::kPending, Status::kError, Status::kCompleted }
using | CompletionCallback = std::function< void(Status)>
Static Public Member Functions inherited from impeller::BackendCast< CommandBufferVK, CommandBuffer >
static CommandBufferVK & | Cast (CommandBuffer &base)
static const CommandBufferVK & | Cast (const CommandBuffer &base)
static CommandBufferVK * | Cast (CommandBuffer *base)
static const CommandBufferVK * | Cast (const CommandBuffer *base)
Protected Member Functions inherited from impeller::CommandBuffer
| CommandBuffer (std::weak_ptr< const Context > context)
Protected Attributes inherited from impeller::CommandBuffer
std::weak_ptr< const Context > | context_

## Detailed Description

Definition at line 23 of file command_buffer_vk.h.

## Constructor & Destructor Documentation

## ◆ ~CommandBufferVK()

impeller::CommandBufferVK::~CommandBufferVK | ( |  | ) |
| override default

## Member Function Documentation

## ◆ AllocateDescriptorSets()

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

Allocate a new descriptor set for the given [layout].

Definition at line 171 of file command_buffer_vk.cc.

173 {
174 if (!IsValid()) {
175 return fml::Status(fml::StatusCode::kUnknown, "command encoder invalid");
176 }
177
178 return tracked_objects_->GetDescriptorPool().AllocateDescriptorSets(layout,
179 context);
180 }

## ◆ EndCommandBuffer()

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

End recording of the current command buffer.

Definition at line 98 of file command_buffer_vk.cc.

98 {
99 InsertDebugMarker("QueueSubmit");
100
101 auto command_buffer = GetCommandBuffer();
102 tracked_objects_->GetGPUProbe().RecordCmdBufferEnd(command_buffer);
103
104 auto status = command_buffer.end();
105 if (status != vk::Result::eSuccess) {
106 VALIDATION_LOG << "Failed to end command buffer: " << vk::to_string(status);
107 return false;
108 }
109 return true;
110 }

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

Referenced by impeller::CommandQueueVK::Submit().

## ◆ GetCommandBuffer()

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

Retrieve the native command buffer from this object.

Definition at line 112 of file command_buffer_vk.cc.

112 {
113 if (tracked_objects_) {
114 return tracked_objects_->GetCommandBuffer();
115 }
116 return {};
117 }

Referenced by EndCommandBuffer(), impeller::GPUTracerVK::InitializeQueryPool(), InsertDebugMarker(), PopDebugGroup(), PushDebugGroup(), and impeller::CommandQueueVK::Submit().

## ◆ InsertDebugMarker()

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

Insert a new debug marker.

This label is only visible in debuggers like RenderDoc. This function is ignored in release builds.

Definition at line 202 of file command_buffer_vk.cc.

202 {
203 if (!HasValidationLayers()) {
204 return;
205 }
206 vk::DebugUtilsLabelEXT label_info;
207 label_info.pLabelName = label.data();
208 if (auto command_buffer = GetCommandBuffer()) {
209 command_buffer.insertDebugUtilsLabelEXT(label_info);
210 }
211 }

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

Referenced by EndCommandBuffer().

## ◆ IsTracking() [1/2]

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

Definition at line 135 of file command_buffer_vk.cc.

136 {
137 if (!IsValid()) {
138 return false;
139 }
140 return tracked_objects_->IsTracking(buffer);
141 }

## ◆ IsTracking() [2/2]

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

Definition at line 161 of file command_buffer_vk.cc.

162 {
163 if (!IsValid()) {
164 return false;
165 }
166 std::shared_ptr<const TextureSourceVK> source =
167 TextureVK::Cast(*texture).GetTextureSource();
168 return tracked_objects_->IsTracking(source);
169 }

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

## ◆ PopDebugGroup()

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

Pop the previous debug group.

This label is only visible in debuggers like RenderDoc. This function is ignored in release builds.

Definition at line 193 of file command_buffer_vk.cc.

193 {
194 if (!HasValidationLayers()) {
195 return;
196 }
197 if (auto command_buffer = GetCommandBuffer()) {
198 command_buffer.endDebugUtilsLabelEXT();
199 }
200 }

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

## ◆ PushDebugGroup()

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

Push a debug group.

This label is only visible in debuggers like RenderDoc. This function is ignored in release builds.

Definition at line 182 of file command_buffer_vk.cc.

182 {
183 if (!HasValidationLayers()) {
184 return;
185 }
186 vk::DebugUtilsLabelEXT label_info;
187 label_info.pLabelName = label.data();
188 if (auto command_buffer = GetCommandBuffer()) {
189 command_buffer.beginDebugUtilsLabelEXT(label_info);
190 }
191 }

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

## ◆ Track() [1/4]

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

Ensure that [buffer] is kept alive until this command buffer completes execution.

Definition at line 127 of file command_buffer_vk.cc.

127 {
128 if (!IsValid()) {
129 return false;
130 }
131 tracked_objects_->Track(buffer);
132 return true;
133 }

## ◆ Track() [2/4]

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

Ensure that [texture] is kept alive until this command buffer completes execution.

Definition at line 151 of file command_buffer_vk.cc.

151 {
152 if (!IsValid()) {
153 return false;
154 }
155 if (!texture) {
156 return true;
157 }
158 return Track(TextureVK::Cast(*texture).GetTextureSource());
159 }

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

## ◆ Track() [3/4]

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

Ensure that [texture] is kept alive until this command buffer completes execution.

Definition at line 143 of file command_buffer_vk.cc.

143 {
144 if (!IsValid()) {
145 return false;
146 }
147 tracked_objects_->Track(std::move(texture));
148 return true;
149 }

## ◆ Track() [4/4]

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

Ensure that [object] is kept alive until this command buffer completes execution.

Definition at line 119 of file command_buffer_vk.cc.

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

Referenced by Track().

## Friends And Related Function Documentation

## ◆ CommandQueueVK

friend class CommandQueueVK
| friend

Definition at line 86 of file command_buffer_vk.h.

## ◆ ContextVK

friend class ContextVK
| friend

Definition at line 85 of file command_buffer_vk.h.

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

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

impeller::CommandBufferVK::InsertDebugMarker
void InsertDebugMarker(std::string_view label) const
Insert a new debug marker.
Definition: command_buffer_vk.cc:202
impeller::CommandBufferVK::Track
bool Track(std::shared_ptr< SharedObjectVK > object)
Ensure that [object] is kept alive until this command buffer completes execution.
Definition: command_buffer_vk.cc:119
impeller::TextureVK::GetTextureSource
std::shared_ptr< const TextureSourceVK > GetTextureSource() const
Definition: texture_vk.cc:154
impeller::CommandBufferVK::GetCommandBuffer
vk::CommandBuffer GetCommandBuffer() const
Retrieve the native command buffer from this object.
Definition: command_buffer_vk.cc:112
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91
impeller::BackendCast< TextureVK, Texture >::Cast
static TextureVK & Cast(Texture &base)
Definition: backend_cast.h:13
impeller::HasValidationLayers
bool HasValidationLayers()
Definition: context_vk.cc:46