| 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 | ( |  | ) |
| overridedefault

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

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

## ◆ EndCommandBuffer()

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

End recording of the current command buffer.

Definition at line 106 of file command_buffer_vk.cc.

106 {
107 InsertDebugMarker("QueueSubmit");
108
109 auto command_buffer = GetCommandBuffer();
110 tracked_objects_->GetGPUProbe().RecordCmdBufferEnd(command_buffer);
111
112 auto status = command_buffer.end();
113 if (status != vk::Result::eSuccess) {
114 VALIDATION_LOG << "Failed to end command buffer: " << vk::to_string(status);
115 return false;
116 }
117 return true;
118 }
impeller::CommandBufferVK::InsertDebugMarker
void InsertDebugMarker(std::string_view label) const
Insert a new debug marker.
Definition: command_buffer_vk.cc:194
impeller::CommandBufferVK::GetCommandBuffer
vk::CommandBuffer GetCommandBuffer() const
Retrieve the native command buffer from this object.
Definition: command_buffer_vk.cc:120
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 120 of file command_buffer_vk.cc.

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

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

## ◆ GetDescriptorPool()

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

Definition at line 205 of file command_buffer_vk.cc.

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

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

194 {
195 if (!HasValidationLayers()) {
196 return;
197 }
198 vk::DebugUtilsLabelEXT label_info;
199 label_info.pLabelName = label.data();
200 if (auto command_buffer = GetCommandBuffer()) {
201 command_buffer.insertDebugUtilsLabelEXT(label_info);
202 }
203 }
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 185 of file command_buffer_vk.cc.

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

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

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

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

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

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

152 {
153 if (!IsValid()) {
154 return false;
155 }
156 if (!texture) {
157 return true;
158 }
159 return Track(TextureVK::Cast(*texture).GetTextureSource());
160 }
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:127
impeller::TextureVK::GetTextureSource
std::shared_ptr< const TextureSourceVK > GetTextureSource() const
Definition: texture_vk.cc:178

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

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

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

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

## 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