| Flutter Impeller |

Public Types | Static Public Member Functions | List of all members
impeller::ComputePipelineBuilder< ComputeShader_ > Struct Template Reference

An optional (but highly recommended) utility for creating pipelines from reflected shader information. More...

`#include <compute_pipeline_builder.h>`

## Public Types
using | ComputeShader = ComputeShader_

## Static Public Member Functions
static std::optional< ComputePipelineDescriptor > | MakeDefaultPipelineDescriptor (const Context &context)
| Create a default pipeline descriptor using the combination reflected shader information. The descriptor can be configured further before a pipeline state object is created using it. More...
static bool | InitializePipelineDescriptorDefaults (const Context &context, ComputePipelineDescriptor &desc)

## Detailed Description

### template<class ComputeShader_>
struct impeller::ComputePipelineBuilder< ComputeShader_ >

An optional (but highly recommended) utility for creating pipelines from reflected shader information.

Template Parameters

  Compute_Shader | The reflected compute shader information. Found in a generated header file called <shader_name>.comp.h.

Definition at line 25 of file compute_pipeline_builder.h.

## Member Typedef Documentation

## ◆ ComputeShader

template<class ComputeShader_ >

using impeller::ComputePipelineBuilder< ComputeShader_ >::ComputeShader = ComputeShader_

Definition at line 27 of file compute_pipeline_builder.h.

## Member Function Documentation

## ◆ InitializePipelineDescriptorDefaults()

template<class ComputeShader_ >

static bool impeller::ComputePipelineBuilder< ComputeShader_ >::InitializePipelineDescriptorDefaults | ( | const Context & | context,
|  | ComputePipelineDescriptor & | desc
| ) |  |
| inline static

Definition at line 49 of file compute_pipeline_builder.h.

51 {
52 // Setup debug instrumentation.
53 desc.SetLabel(SPrintF("%s Pipeline", ComputeShader::kLabel.data()));
54
55 // Resolve pipeline entrypoints.
56 {
57 auto compute_function = context.GetShaderLibrary()->GetFunction(
58 ComputeShader::kEntrypointName, ShaderStage::kCompute);
59
60 if (!compute_function) {
61 VALIDATION_LOG << "Could not resolve compute pipeline entrypoint '"
62 << ComputeShader::kEntrypointName
63 << "' for pipeline named '" << ComputeShader::kLabel
64 << "'.";
65 return false;
66 }
67
68 if (!desc.RegisterDescriptorSetLayouts(
69 ComputeShader::kDescriptorSetLayouts)) {
70 VALIDATION_LOG << "Could not configure compute descriptor set layout "
71 "for pipeline named '"
72 << ComputeShader::kLabel << "'.";
73 return false;
74 }
75
76 desc.SetStageEntrypoint(std::move(compute_function));
77 }
78 return true;
79 }

References impeller::Context::GetShaderLibrary(), impeller::kCompute, impeller::ComputePipelineDescriptor::RegisterDescriptorSetLayouts(), impeller::ComputePipelineDescriptor::SetLabel(), impeller::ComputePipelineDescriptor::SetStageEntrypoint(), impeller::SPrintF(), and VALIDATION_LOG.

Referenced by impeller::ComputePipelineBuilder< ComputeShader_ >::MakeDefaultPipelineDescriptor().

## ◆ MakeDefaultPipelineDescriptor()

template<class ComputeShader_ >

static std::optional<ComputePipelineDescriptor> impeller::ComputePipelineBuilder< ComputeShader_ >::MakeDefaultPipelineDescriptor | ( | const Context & | context | ) |
| inline static

Create a default pipeline descriptor using the combination reflected shader information. The descriptor can be configured further before a pipeline state object is created using it.

Parameters

  [in] | context | The context

Returns
  If the combination of reflected shader information is compatible and the requisite functions can be found in the context, a pipeline descriptor.

Definition at line 40 of file compute_pipeline_builder.h.

41 {
42 ComputePipelineDescriptor desc;
43 if (InitializePipelineDescriptorDefaults(context, desc)) {
44 return {std::move(desc)};
45 }
46 return std::nullopt;
47 }

References impeller::ComputePipelineBuilder< ComputeShader_ >::InitializePipelineDescriptorDefaults().

Referenced by impeller::ContentContext::ContentContext().

The documentation for this struct was generated from the following file:

- impeller/renderer/compute_pipeline_builder.h

impeller::SPrintF
std::string SPrintF(const char *format,...)
Definition: strings.cc:12
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:67
impeller::ComputePipelineBuilder::InitializePipelineDescriptorDefaults
static bool InitializePipelineDescriptorDefaults(const Context &context, ComputePipelineDescriptor &desc)
Definition: compute_pipeline_builder.h:49
impeller::ShaderStage::kCompute
@ kCompute