| 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
bool | relaxed_vulkan_rules = false

## 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 277 of file spirv_compiler.cc.

277 {
278 shaderc::CompileOptions options;
279
280 SetDefaultLimitations(options);
281 SetBindingBaseOffset(options);
282
283 options.SetAutoBindUniforms(true);
284 options.SetAutoMapLocations(true);
285 options.SetPreserveBindings(true);
286
287 options.SetOptimizationLevel(optimization_level);
288
289 if (generate_debug_info) {
290 options.SetGenerateDebugInfo();
291 }
292
293 if (source_langauge.has_value()) {
294 options.SetSourceLanguage(source_langauge.value());
295 }
296
297 if (source_profile.has_value()) {
298 options.SetForcedVersionProfile(source_profile->version,
299 source_profile->profile);
300 }
301
302 if (target.has_value()) {
303 options.SetTargetEnvironment(target->env, target->version);
304 options.SetTargetSpirv(target->spirv_version);
305 }
306
307 for (const auto& macro : macro_definitions) {
308 options.AddMacroDefinition(macro);
309 }
310
311 if (includer) {
312 options.SetIncluder(UniqueIncluder::Make(includer));
313 }
314
315 options.SetVulkanRulesRelaxed(relaxed_vulkan_rules);
316
317 return options;
318 }
impeller::compiler::UniqueIncluder::Make
static std::unique_ptr< UniqueIncluder > Make(std::shared_ptr< Includer > includer)
Definition: spirv_compiler.cc:237
impeller::compiler::SetBindingBaseOffset
static void SetBindingBaseOffset(shaderc::CompileOptions &options)
Definition: spirv_compiler.cc:210
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::relaxed_vulkan_rules
bool relaxed_vulkan_rules
Definition: spirv_compiler.h:52
impeller::compiler::SPIRVCompilerOptions::optimization_level
shaderc_optimization_level optimization_level
Definition: spirv_compiler.h:40
impeller::compiler::SPIRVCompilerOptions::source_profile
std::optional< SPIRVCompilerSourceProfile > source_profile
Definition: spirv_compiler.h:38
impeller::compiler::SPIRVCompilerOptions::includer
std::shared_ptr< Includer > includer
Definition: spirv_compiler.h:50
impeller::compiler::SPIRVCompilerOptions::generate_debug_info
bool generate_debug_info
Definition: spirv_compiler.h:33
impeller::compiler::SPIRVCompilerOptions::target
std::optional< SPIRVCompilerTargetEnv > target
Definition: spirv_compiler.h:46

References generate_debug_info, includer, macro_definitions, impeller::compiler::UniqueIncluder::Make(), optimization_level, relaxed_vulkan_rules, 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().

## ◆ relaxed_vulkan_rules

bool impeller::compiler::SPIRVCompilerOptions::relaxed_vulkan_rules = false

Definition at line 52 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