| 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 30 of file command_encoder_vk.h.

## Constructor & Destructor Documentation

## ◆ CommandEncoderFactoryVK()

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

Definition at line 93 of file command_encoder_vk.cc.

95 : context_(context) {}

## Member Function Documentation

## ◆ Create()

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

Definition at line 101 of file command_encoder_vk.cc.

101 {
102 auto context = context_.lock();
103 if (!context) {
104 return nullptr;
105 }
106 auto& context_vk = ContextVK::Cast(*context);
107 auto recycler = context_vk.GetCommandPoolRecycler();
108 if (!recycler) {
109 return nullptr;
110 }
111 auto tls_pool = recycler->Get();
112 if (!tls_pool) {
113 return nullptr;
114 }
115
116 auto tracked_objects = std::make_shared<TrackedObjectsVK>(
117 context_vk.GetDeviceHolder(), tls_pool);
118 auto queue = context_vk.GetGraphicsQueue();
119
120 if (!tracked_objects || !tracked_objects->IsValid() || !queue) {
121 return nullptr;
122 }
123
124 vk::CommandBufferBeginInfo begin_info;
125 begin_info.flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit;
126 if (tracked_objects->GetCommandBuffer().begin(begin_info) !=
127 vk::Result::eSuccess) {
128 VALIDATION_LOG << "Could not begin command buffer.";
129 return nullptr;
130 }
131
132 if (label_.has_value()) {
133 context_vk.SetDebugName(tracked_objects->GetCommandBuffer(),
134 label_.value());
135 }
136
137 return std::make_shared<CommandEncoderVK>(context_vk.GetDeviceHolder(),
138 tracked_objects, queue,
139 context_vk.GetFenceWaiter());
140 }

References impeller::BackendCast< ContextVK, Context >::Cast(), and VALIDATION_LOG.

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

## ◆ SetLabel()

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

Definition at line 97 of file command_encoder_vk.cc.

97 {
98 label_ = label;
99 }

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:60
impeller::BackendCast< ContextVK, Context >::Cast
static ContextVK & Cast(Context &base)
Definition: backend_cast.h:14