| 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 26 of file compute_pipeline_builder.h.

## Member Typedef Documentation

## ◆ ComputeShader

template<class ComputeShader_ >

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

Definition at line 28 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 50 of file compute_pipeline_builder.h.

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

References impeller::Context::GetShaderLibrary(), impeller::kCompute, impeller::ComputePipelineDescriptor::RegisterDescriptorSetLayouts(), impeller::ComputePipelineDescriptor::SetLabel(), impeller::ComputePipelineDescriptor::SetStageEntrypoint(), 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 41 of file compute_pipeline_builder.h.

42 {
43 ComputePipelineDescriptor desc;
44 if (InitializePipelineDescriptorDefaults(context, desc)) {
45 return {std::move(desc)};
46 }
47 return std::nullopt;
48 }
impeller::ComputePipelineBuilder::InitializePipelineDescriptorDefaults
static bool InitializePipelineDescriptorDefaults(const Context &context, ComputePipelineDescriptor &desc)
Definition: compute_pipeline_builder.h:50

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

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

- impeller/renderer/compute_pipeline_builder.h