| Flutter Impeller |

Public Member Functions | List of all members
impeller::CommandEncoderFactoryVK Class Reference

`#include <command_encoder_vk.h>`

## Public Member Functions
| CommandEncoderFactoryVK (const std::weak_ptr< const ContextVK > &context)
std::shared_ptr< CommandEncoderVK > | Create ()
void | SetLabel (const std::string &label)

## Detailed Description

Definition at line 31 of file command_encoder_vk.h.

## Constructor & Destructor Documentation

## ◆ CommandEncoderFactoryVK()

impeller::CommandEncoderFactoryVK::CommandEncoderFactoryVK | ( | const std::weak_ptr< const ContextVK > & | context | ) |
| explicit

Definition at line 101 of file command_encoder_vk.cc.

103 : context_(context) {}

## Member Function Documentation

## ◆ Create()

std::shared_ptr< CommandEncoderVK > impeller::CommandEncoderFactoryVK::Create | ( |  | ) |

Definition at line 109 of file command_encoder_vk.cc.

109 {
110 auto context = context_.lock();
111 if (!context) {
112 return nullptr;
113 }
114 auto recycler = context->GetCommandPoolRecycler();
115 if (!recycler) {
116 return nullptr;
117 }
118 auto tls_pool = recycler->Get();
119 if (!tls_pool) {
120 return nullptr;
121 }
122
123 auto tracked_objects = std::make_shared<TrackedObjectsVK>(
124 context, tls_pool, context->GetGPUTracer()->CreateGPUProbe());
125 auto queue = context->GetGraphicsQueue();
126
127 if (!tracked_objects || !tracked_objects->IsValid() || !queue) {
128 return nullptr;
129 }
130
131 vk::CommandBufferBeginInfo begin_info;
132 begin_info.flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit;
133 if (tracked_objects->GetCommandBuffer().begin(begin_info) !=
134 vk::Result::eSuccess) {
135 VALIDATION_LOG << "Could not begin command buffer.";
136 return nullptr;
137 }
138
139 if (label_.has_value()) {
140 context->SetDebugName(tracked_objects->GetCommandBuffer(), label_.value());
141 }
142 tracked_objects->GetGPUProbe().RecordCmdBufferStart(
143 tracked_objects->GetCommandBuffer());
144
145 return std::make_shared<CommandEncoderVK>(context->GetDeviceHolder(),
146 tracked_objects, queue,
147 context->GetFenceWaiter());
148 }

References VALIDATION_LOG.

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

## ◆ SetLabel()

void impeller::CommandEncoderFactoryVK::SetLabel | ( | const std::string & | label | ) |

Definition at line 105 of file command_encoder_vk.cc.

105 {
106 label_ = label;
107 }

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

VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:67