| 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 32 of file spirv_compiler.h.

## Member Function Documentation

## ◆ BuildShadercOptions()

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

Definition at line 276 of file spirv_compiler.cc.

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

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 33 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 50 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 48 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 40 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 37 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 38 of file spirv_compiler.h.

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

## ◆ target

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

Definition at line 46 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:33
impeller::compiler::SPIRVCompilerOptions::includer
std::shared_ptr< Includer > includer
Definition: spirv_compiler.h:50
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:38
impeller::compiler::SPIRVCompilerOptions::target
std::optional< SPIRVCompilerTargetEnv > target
Definition: spirv_compiler.h:46
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:37
impeller::compiler::SPIRVCompilerOptions::macro_definitions
std::vector< std::string > macro_definitions
Definition: spirv_compiler.h:48
impeller::compiler::SPIRVCompilerOptions::optimization_level
shaderc_optimization_level optimization_level
Definition: spirv_compiler.h:40