| Flutter Impeller |

Public Types | Public Member Functions | List of all members
impeller::compiler::CompilerBackend Struct Reference

`#include <compiler_backend.h>`

## Public Types
enum class | Type { kMSL , kGLSL , kGLSLVulkan , kSkSL }
enum class | ExtendedResourceIndex { kPrimary , kSecondary }
using | MSLCompiler = std::shared_ptr< spirv_cross::CompilerMSL >
using | GLSLCompiler = std::shared_ptr< spirv_cross::CompilerGLSL >
using | SkSLCompiler = std::shared_ptr< CompilerSkSL >
using | Compiler = std::variant< MSLCompiler, GLSLCompiler, SkSLCompiler >

## Public Member Functions
| CompilerBackend (MSLCompiler compiler)
| CompilerBackend (GLSLCompiler compiler)
| CompilerBackend (SkSLCompiler compiler)
| CompilerBackend (Type type, Compiler compiler)
| CompilerBackend ()
| ~CompilerBackend ()
Type | GetType () const
const spirv_cross::Compiler * | operator-> () const
spirv_cross::Compiler * | GetCompiler ()
| operator bool () const
uint32_t | GetExtendedMSLResourceBinding (ExtendedResourceIndex index, spirv_cross::ID id) const
const spirv_cross::Compiler * | GetCompiler () const

## Detailed Description

Definition at line 19 of file compiler_backend.h.

## Member Typedef Documentation

## ◆ Compiler

using impeller::compiler::CompilerBackend::Compiler = std::variant<MSLCompiler, GLSLCompiler, SkSLCompiler>

Definition at line 23 of file compiler_backend.h.

## ◆ GLSLCompiler

using impeller::compiler::CompilerBackend::GLSLCompiler = std::shared_ptr<spirv_cross::CompilerGLSL>

Definition at line 21 of file compiler_backend.h.

## ◆ MSLCompiler

using impeller::compiler::CompilerBackend::MSLCompiler = std::shared_ptr<spirv_cross::CompilerMSL>

Definition at line 20 of file compiler_backend.h.

## ◆ SkSLCompiler

using impeller::compiler::CompilerBackend::SkSLCompiler = std::shared_ptr<CompilerSkSL>

Definition at line 22 of file compiler_backend.h.

## Member Enumeration Documentation

## ◆ ExtendedResourceIndex

enum impeller::compiler::CompilerBackend::ExtendedResourceIndex
| strong

Enumerator
kPrimary |
kSecondary |

Definition at line 52 of file compiler_backend.h.

52 {
53 kPrimary,
54 kSecondary,
55 };

## ◆ Type

enum impeller::compiler::CompilerBackend::Type
| strong

Enumerator
kMSL |
kGLSL |
kGLSLVulkan |
kSkSL |

Definition at line 25 of file compiler_backend.h.

25 {
26 kMSL,
27 kGLSL,
28 kGLSLVulkan,
29 kSkSL,
30 };
impeller::compiler::SourceLanguage::kGLSL
@ kGLSL
impeller::compiler::TargetPlatform::kSkSL
@ kSkSL

## Constructor & Destructor Documentation

## ◆ CompilerBackend() [1/5]

impeller::compiler::CompilerBackend::CompilerBackend | ( | MSLCompiler | compiler | ) |
| explicit

Definition at line 12 of file compiler_backend.cc.

13 : CompilerBackend(Type::kMSL, compiler) {}
impeller::compiler::CompilerBackend::CompilerBackend
CompilerBackend()
impeller::compiler::CompilerBackend::Type::kMSL
@ kMSL

## ◆ CompilerBackend() [2/5]

impeller::compiler::CompilerBackend::CompilerBackend | ( | GLSLCompiler | compiler | ) |
| explicit

Definition at line 15 of file compiler_backend.cc.

16 : CompilerBackend(compiler->get_common_options().vulkan_semantics
17 ? Type::kGLSLVulkan
18 : Type::kGLSL,
19 compiler) {}
impeller::compiler::CompilerBackend::Type::kGLSLVulkan
@ kGLSLVulkan
impeller::compiler::CompilerBackend::Type::kGLSL
@ kGLSL

References impeller::compiler::kGLSL.

## ◆ CompilerBackend() [3/5]

impeller::compiler::CompilerBackend::CompilerBackend | ( | SkSLCompiler | compiler | ) |
| explicit

Definition at line 21 of file compiler_backend.cc.

22 : CompilerBackend(Type::kSkSL, compiler) {}
impeller::compiler::CompilerBackend::Type::kSkSL
@ kSkSL

References impeller::compiler::kSkSL.

## ◆ CompilerBackend() [4/5]

impeller::compiler::CompilerBackend::CompilerBackend | ( | Type | type,
|  | Compiler | compiler
| ) |  |

Definition at line 26 of file compiler_backend.cc.

27 : type_(type), compiler_(std::move(compiler)){};
type
GLenum type
Definition: blit_command_gles.cc:151

## ◆ CompilerBackend() [5/5]

impeller::compiler::CompilerBackend::CompilerBackend | ( |  | ) |
| default

## ◆ ~CompilerBackend()

impeller::compiler::CompilerBackend::~CompilerBackend | ( |  | ) |
| default

## Member Function Documentation

## ◆ GetCompiler() [1/2]

spirv_cross::Compiler * impeller::compiler::CompilerBackend::GetCompiler | ( |  | ) |

Definition at line 70 of file compiler_backend.cc.

70 {
71 if (auto* msl = std::get_if<MSLCompiler>(&compiler_)) {
72 return msl->get();
73 }
74 if (auto* glsl = std::get_if<GLSLCompiler>(&compiler_)) {
75 return glsl->get();
76 }
77 if (auto* sksl = std::get_if<SkSLCompiler>(&compiler_)) {
78 return sksl->get();
79 }
80 return nullptr;
81 }

Referenced by impeller::compiler::CreateCompiler(), and operator->().

## ◆ GetCompiler() [2/2]

const spirv_cross::Compiler * impeller::compiler::CompilerBackend::GetCompiler | ( |  | ) | const

Definition at line 54 of file compiler_backend.cc.

54 {
55 if (auto compiler = GetGLSLCompiler()) {
56 return compiler;
57 }
58
59 if (auto compiler = GetMSLCompiler()) {
60 return compiler;
61 }
62
63 if (auto compiler = GetSkSLCompiler()) {
64 return compiler;
65 }
66
67 return nullptr;
68 }

## ◆ GetExtendedMSLResourceBinding()

uint32_t impeller::compiler::CompilerBackend::GetExtendedMSLResourceBinding | ( | ExtendedResourceIndex | index,
|  | spirv_cross::ID | id
| ) |  | const

Definition at line 35 of file compiler_backend.cc.

37 {
38 if (auto compiler = GetMSLCompiler()) {
39 switch (index) {
40 case ExtendedResourceIndex::kPrimary:
41 return compiler->get_automatic_msl_resource_binding(id);
42 case ExtendedResourceIndex::kSecondary:
43 return compiler->get_automatic_msl_resource_binding_secondary(id);
44 break;
45 }
46 }
47 if (auto compiler = GetGLSLCompiler()) {
48 return compiler->get_decoration(id, spv::Decoration::DecorationBinding);
49 }
50 const auto kOOBIndex = static_cast<uint32_t>(-1);
51 return kOOBIndex;
52 }
impeller::compiler::CompilerBackend::ExtendedResourceIndex::kSecondary
@ kSecondary
impeller::compiler::CompilerBackend::ExtendedResourceIndex::kPrimary
@ kPrimary

References kPrimary, and kSecondary.

## ◆ GetType()

CompilerBackend::Type impeller::compiler::CompilerBackend::GetType | ( |  | ) | const

Definition at line 108 of file compiler_backend.cc.

108 {
109 return type_;
110 }

## ◆ operator bool()

impeller::compiler::CompilerBackend::operator bool | ( |  | ) | const
| explicit

Definition at line 104 of file compiler_backend.cc.

104 {
105 return !!GetCompiler();
106 }
impeller::compiler::CompilerBackend::GetCompiler
spirv_cross::Compiler * GetCompiler()
Definition: compiler_backend.cc:70

## ◆ operator->()

const spirv_cross::Compiler * impeller::compiler::CompilerBackend::operator-> | ( |  | ) | const

Definition at line 31 of file compiler_backend.cc.

31 {
32 return GetCompiler();
33 }

References GetCompiler().

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

- impeller/compiler/compiler_backend.h
- impeller/compiler/compiler_backend.cc