| Flutter Impeller |

Public Member Functions | Public Attributes | List of all members
impeller::compiler::SPIRVCompilerOptions Struct Reference

`#include <spirv_compiler.h>`

## Public Member Functions
shaderc::CompileOptions | BuildShadercOptions () const

## Public Attributes
bool | generate_debug_info = true
std::optional< shaderc_source_language > | source_langauge
std::optional< SPIRVCompilerSourceProfile > | source_profile
shaderc_optimization_level | optimization_level
std::optional< SPIRVCompilerTargetEnv > | target
std::vector< std::string > | macro_definitions
std::shared_ptr< Includer > | includer

## Detailed Description

Definition at line 31 of file spirv_compiler.h.

## Member Function Documentation

## ◆ BuildShadercOptions()

shaderc::CompileOptions impeller::compiler::SPIRVCompilerOptions::BuildShadercOptions | ( |  | ) | const

Definition at line 274 of file spirv_compiler.cc.

274 {
275 shaderc::CompileOptions options;
276
277 SetDefaultLimitations(options);
278 SetBindingBaseOffset(options);
279
280 options.SetAutoBindUniforms(true);
281 options.SetAutoMapLocations(true);
282
283 options.SetOptimizationLevel(optimization_level);
284
285 if (generate_debug_info) {
286 options.SetGenerateDebugInfo();
287 }
288
289 if (source_langauge.has_value()) {
290 options.SetSourceLanguage(source_langauge.value());
291 }
292
293 if (source_profile.has_value()) {
294 options.SetForcedVersionProfile(source_profile->version,
295 source_profile->profile);
296 }
297
298 if (target.has_value()) {
299 options.SetTargetEnvironment(target->env, target->version);
300 options.SetTargetSpirv(target->spirv_version);
301 }
302
303 for (const auto& macro : macro_definitions) {
304 options.AddMacroDefinition(macro);
305 }
306
307 if (includer) {
308 options.SetIncluder(UniqueIncluder::Make(includer));
309 }
310
311 return options;
312 }

References generate_debug_info, includer, macro_definitions, impeller::compiler::UniqueIncluder::Make(), optimization_level, impeller::compiler::SetBindingBaseOffset(), impeller::compiler::SetDefaultLimitations(), source_langauge, source_profile, and target.

Referenced by impeller::compiler::Compiler::Compiler().

## Member Data Documentation

## ◆ generate_debug_info

bool impeller::compiler::SPIRVCompilerOptions::generate_debug_info = true

Definition at line 32 of file spirv_compiler.h.

Referenced by BuildShadercOptions(), and impeller::compiler::Compiler::Compiler().

## ◆ includer

std::shared_ptr<Includer> impeller::compiler::SPIRVCompilerOptions::includer

Definition at line 49 of file spirv_compiler.h.

Referenced by BuildShadercOptions(), and impeller::compiler::Compiler::Compiler().

## ◆ macro_definitions

std::vector<std::string> impeller::compiler::SPIRVCompilerOptions::macro_definitions

Definition at line 47 of file spirv_compiler.h.

Referenced by BuildShadercOptions(), and impeller::compiler::Compiler::Compiler().

## ◆ optimization_level

shaderc_optimization_level impeller::compiler::SPIRVCompilerOptions::optimization_level

Initial value:
=
shaderc_optimization_level::shaderc_optimization_level_performance

Definition at line 39 of file spirv_compiler.h.

Referenced by BuildShadercOptions(), and impeller::compiler::Compiler::Compiler().

## ◆ source_langauge

std::optional<shaderc_source_language> impeller::compiler::SPIRVCompilerOptions::source_langauge

Definition at line 36 of file spirv_compiler.h.

Referenced by BuildShadercOptions(), and impeller::compiler::Compiler::Compiler().

## ◆ source_profile

std::optional<SPIRVCompilerSourceProfile> impeller::compiler::SPIRVCompilerOptions::source_profile

Definition at line 37 of file spirv_compiler.h.

Referenced by BuildShadercOptions(), and impeller::compiler::Compiler::Compiler().

## ◆ target

std::optional<SPIRVCompilerTargetEnv> impeller::compiler::SPIRVCompilerOptions::target

Definition at line 45 of file spirv_compiler.h.

Referenced by BuildShadercOptions(), and impeller::compiler::Compiler::Compiler().

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

- impeller/compiler/spirv_compiler.h
- impeller/compiler/spirv_compiler.cc

impeller::compiler::SPIRVCompilerOptions::generate_debug_info
bool generate_debug_info
Definition: spirv_compiler.h:32
impeller::compiler::SPIRVCompilerOptions::includer
std::shared_ptr< Includer > includer
Definition: spirv_compiler.h:49
impeller::compiler::SetBindingBaseOffset
static void SetBindingBaseOffset(shaderc::CompileOptions &options)
Definition: spirv_compiler.cc:210
impeller::compiler::SPIRVCompilerOptions::source_profile
std::optional< SPIRVCompilerSourceProfile > source_profile
Definition: spirv_compiler.h:37
impeller::compiler::SPIRVCompilerOptions::target
std::optional< SPIRVCompilerTargetEnv > target
Definition: spirv_compiler.h:45
impeller::compiler::UniqueIncluder::Make
static std::unique_ptr< UniqueIncluder > Make(std::shared_ptr< Includer > includer)
Definition: spirv_compiler.cc:237
impeller::compiler::SetDefaultLimitations
static void SetDefaultLimitations(shaderc::CompileOptions &compiler_opts)
Definition: spirv_compiler.cc:92
impeller::compiler::SPIRVCompilerOptions::source_langauge
std::optional< shaderc_source_language > source_langauge
Definition: spirv_compiler.h:36
impeller::compiler::SPIRVCompilerOptions::macro_definitions
std::vector< std::string > macro_definitions
Definition: spirv_compiler.h:47
impeller::compiler::SPIRVCompilerOptions::optimization_level
shaderc_optimization_level optimization_level
Definition: spirv_compiler.h:39