| 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 (const 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 (const 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, PipelineKey pipeline_key, const ContextVK &context)
| Allocate a new descriptor set for the given [layout]. More...
DescriptorPoolVK & | GetDescriptorPool () const
Public Member Functions inherited from impeller::CommandBuffer
virtual | ~CommandBuffer ()
void | WaitUntilCompleted ()
| Block the current thread until the GPU has completed execution of the commands. More...
void | WaitUntilScheduled ()
| Block the current thread until the GPU has completed scheduling execution of the 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 class | Status { kPending , kError , 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 24 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,
|  | PipelineKey | pipeline_key,
|  | const ContextVK & | context
| ) |  |

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

Definition at line 161 of file command_buffer_vk.cc.

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

## ◆ EndCommandBuffer()

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

End recording of the current command buffer.

Definition at line 105 of file command_buffer_vk.cc.

105 {
106 InsertDebugMarker("QueueSubmit");
107
108 auto command_buffer = GetCommandBuffer();
109 tracked_objects_->GetGPUProbe().RecordCmdBufferEnd(command_buffer);
110
111 auto status = command_buffer.end();
112 if (status != vk::Result::eSuccess) {
113 VALIDATION_LOG << "Failed to end command buffer: " << vk::to_string(status);
114 return false;
115 }
116 return true;
117 }
impeller::CommandBufferVK::InsertDebugMarker
void InsertDebugMarker(std::string_view label) const
Insert a new debug marker.
Definition: command_buffer_vk.cc:193
impeller::CommandBufferVK::GetCommandBuffer
vk::CommandBuffer GetCommandBuffer() const
Retrieve the native command buffer from this object.
Definition: command_buffer_vk.cc:119
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:91

References 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 119 of file command_buffer_vk.cc.

119 {
120 if (tracked_objects_) {
121 return tracked_objects_->GetCommandBuffer();
122 }
123 return {};
124 }

Referenced by impeller::GPUTracerVK::InitializeQueryPool(), and impeller::CommandQueueVK::Submit().

## ◆ GetDescriptorPool()

DescriptorPoolVK & impeller::CommandBufferVK::GetDescriptorPool | ( |  | ) | const

Definition at line 204 of file command_buffer_vk.cc.

204 {
205 return tracked_objects_->GetDescriptorPool();
206 }

Referenced by impeller::testing::TEST().

## ◆ 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 193 of file command_buffer_vk.cc.

193 {
194 if (!HasValidationLayers()) {
195 return;
196 }
197 vk::DebugUtilsLabelEXT label_info;
198 label_info.pLabelName = label.data();
199 if (auto command_buffer = GetCommandBuffer()) {
200 command_buffer.insertDebugUtilsLabelEXT(label_info);
201 }
202 }
impeller::HasValidationLayers
bool HasValidationLayers()
Definition: context_vk.cc:53

References impeller::HasValidationLayers().

## ◆ 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 184 of file command_buffer_vk.cc.

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

References 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 173 of file command_buffer_vk.cc.

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

References 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 134 of file command_buffer_vk.cc.

134 {
135 if (!IsValid()) {
136 return false;
137 }
138 tracked_objects_->Track(buffer);
139 return true;
140 }

## ◆ 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 }
impeller::BackendCast< TextureVK, Texture >::Cast
static TextureVK & Cast(Texture &base)
Definition: backend_cast.h:13
impeller::CommandBufferVK::Track
bool Track(const std::shared_ptr< SharedObjectVK > &object)
Ensure that [object] is kept alive until this command buffer completes execution.
Definition: command_buffer_vk.cc:126
impeller::TextureVK::GetTextureSource
std::shared_ptr< const TextureSourceVK > GetTextureSource() const
Definition: texture_vk.cc:177

## ◆ Track() [3/4]

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

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

Definition at line 142 of file command_buffer_vk.cc.

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

## ◆ Track() [4/4]

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

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

Definition at line 126 of file command_buffer_vk.cc.

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

## Friends And Related Function Documentation

## ◆ CommandQueueVK

friend class CommandQueueVK
| friend

Definition at line 85 of file command_buffer_vk.h.

## ◆ ContextVK

friend class ContextVK
| friend

Definition at line 84 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