Flutter Impeller
impeller::CommandEncoderFactoryVK Class Reference

#include <command_encoder_vk.h>

Public Member Functions

 CommandEncoderFactoryVK (const std::weak_ptr< const ContextVK > &context)
 
std::shared_ptr< CommandEncoderVKCreate ()
 
void SetLabel (const std::string &label)
 

Detailed Description

Definition at line 32 of file command_encoder_vk.h.

Constructor & Destructor Documentation

◆ CommandEncoderFactoryVK()

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

Definition at line 19 of file command_encoder_vk.cc.

21  : context_(context) {}

Member Function Documentation

◆ Create()

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

Definition at line 27 of file command_encoder_vk.cc.

27  {
28  auto context = context_.lock();
29  if (!context) {
30  return nullptr;
31  }
32  auto recycler = context->GetCommandPoolRecycler();
33  if (!recycler) {
34  return nullptr;
35  }
36  auto tls_pool = recycler->Get();
37  if (!tls_pool) {
38  return nullptr;
39  }
40 
41  auto tracked_objects = std::make_shared<TrackedObjectsVK>(
42  context, tls_pool, context->GetGPUTracer()->CreateGPUProbe());
43  auto queue = context->GetGraphicsQueue();
44 
45  if (!tracked_objects || !tracked_objects->IsValid() || !queue) {
46  return nullptr;
47  }
48 
49  vk::CommandBufferBeginInfo begin_info;
50  begin_info.flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit;
51  if (tracked_objects->GetCommandBuffer().begin(begin_info) !=
52  vk::Result::eSuccess) {
53  VALIDATION_LOG << "Could not begin command buffer.";
54  return nullptr;
55  }
56 
57  if (label_.has_value()) {
58  context->SetDebugName(tracked_objects->GetCommandBuffer(), label_.value());
59  }
60  tracked_objects->GetGPUProbe().RecordCmdBufferStart(
61  tracked_objects->GetCommandBuffer());
62 
63  return std::make_shared<CommandEncoderVK>(context->GetDeviceHolder(),
64  tracked_objects, queue,
65  context->GetFenceWaiter());
66 }

References VALIDATION_LOG.

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

◆ SetLabel()

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

Definition at line 23 of file command_encoder_vk.cc.

23  {
24  label_ = label;
25 }

The documentation for this class was generated from the following files:
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:73