Flutter Impeller
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< SPIRVCompilerSourceProfilesource_profile
 
shaderc_optimization_level optimization_level
 
std::optional< SPIRVCompilerTargetEnvtarget
 
std::vector< std::string > macro_definitions
 
std::shared_ptr< Includerincluder
 
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 278 of file spirv_compiler.cc.

278  {
279  shaderc::CompileOptions options;
280 
281  SetDefaultLimitations(options);
282  SetBindingBaseOffset(options);
283 
284  options.SetAutoBindUniforms(true);
285  options.SetAutoMapLocations(true);
286  options.SetPreserveBindings(true);
287 
288  options.SetOptimizationLevel(optimization_level);
289 
290  if (generate_debug_info) {
291  options.SetGenerateDebugInfo();
292  }
293 
294  if (source_langauge.has_value()) {
295  options.SetSourceLanguage(source_langauge.value());
296  }
297 
298  if (source_profile.has_value()) {
299  options.SetForcedVersionProfile(source_profile->version,
300  source_profile->profile);
301  }
302 
303  if (target.has_value()) {
304  options.SetTargetEnvironment(target->env, target->version);
305  options.SetTargetSpirv(target->spirv_version);
306  }
307 
308  for (const auto& macro : macro_definitions) {
309  options.AddMacroDefinition(macro);
310  }
311 
312  if (includer) {
313  options.SetIncluder(UniqueIncluder::Make(includer));
314  }
315 
316  options.SetVulkanRulesRelaxed(relaxed_vulkan_rules);
317 
318  return options;
319 }
static std::unique_ptr< UniqueIncluder > Make(std::shared_ptr< Includer > includer)
static void SetBindingBaseOffset(shaderc::CompileOptions &options)
static void SetDefaultLimitations(shaderc::CompileOptions &compiler_opts)
std::optional< shaderc_source_language > source_langauge
std::vector< std::string > macro_definitions
shaderc_optimization_level optimization_level
std::optional< SPIRVCompilerSourceProfile > source_profile
std::shared_ptr< Includer > includer
std::optional< SPIRVCompilerTargetEnv > target

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: