Flutter Impeller
compiler.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
6 
7 #include <cstdint>
8 #include <filesystem>
9 #include <memory>
10 #include <optional>
11 #include <sstream>
12 #include <string>
13 #include <utility>
14 
15 #include "flutter/fml/paths.h"
24 
25 namespace impeller {
26 namespace compiler {
27 
28 static uint32_t ParseMSLVersion(const std::string& msl_version) {
29  std::stringstream sstream(msl_version);
30  std::string version_part;
31  uint32_t major = 1;
32  uint32_t minor = 2;
33  uint32_t patch = 0;
34  if (std::getline(sstream, version_part, '.')) {
35  major = std::stoi(version_part);
36  if (std::getline(sstream, version_part, '.')) {
37  minor = std::stoi(version_part);
38  if (std::getline(sstream, version_part, '.')) {
39  patch = std::stoi(version_part);
40  }
41  }
42  }
43  if (major < 1 || (major == 1 && minor < 2)) {
44  std::cerr << "--metal-version version must be at least 1.2. Have "
45  << msl_version << std::endl;
46  }
47  return spirv_cross::CompilerMSL::Options::make_msl_version(major, minor,
48  patch);
49 }
50 
52  const spirv_cross::ParsedIR& ir,
53  const SourceOptions& source_options,
54  std::optional<uint32_t> msl_version_override = {}) {
55  auto sl_compiler = std::make_shared<spirv_cross::CompilerMSL>(ir);
56  spirv_cross::CompilerMSL::Options sl_options;
57  sl_options.platform =
59  sl_options.msl_version = msl_version_override.value_or(
60  ParseMSLVersion(source_options.metal_version));
61  sl_options.ios_use_simdgroup_functions =
62  sl_options.is_ios() &&
63  sl_options.msl_version >=
64  spirv_cross::CompilerMSL::Options::make_msl_version(2, 4, 0);
65  sl_options.use_framebuffer_fetch_subpasses = true;
66  sl_compiler->set_msl_options(sl_options);
67 
68  // Sort the float and sampler uniforms according to their declared/decorated
69  // order. For user authored fragment shaders, the API for setting uniform
70  // values uses the index of the uniform in the declared order. By default, the
71  // metal backend of spirv-cross will order uniforms according to usage. To fix
72  // this, we use the sorted order and the add_msl_resource_binding API to force
73  // the ordering to match the declared order. Note that while this code runs
74  // for all compiled shaders, it will only affect vertex and fragment shaders
75  // due to the specified stage.
76  auto floats =
77  SortUniforms(&ir, sl_compiler.get(), spirv_cross::SPIRType::Float);
78  auto images =
79  SortUniforms(&ir, sl_compiler.get(), spirv_cross::SPIRType::SampledImage);
80 
81  spv::ExecutionModel execution_model =
82  spv::ExecutionModel::ExecutionModelFragment;
83  if (source_options.type == SourceType::kVertexShader) {
84  execution_model = spv::ExecutionModel::ExecutionModelVertex;
85  }
86 
87  uint32_t buffer_offset = 0;
88  uint32_t sampler_offset = 0;
89  for (auto& float_id : floats) {
90  sl_compiler->add_msl_resource_binding(
91  {.stage = execution_model,
92  .basetype = spirv_cross::SPIRType::BaseType::Float,
93  .desc_set = sl_compiler->get_decoration(float_id,
94  spv::DecorationDescriptorSet),
95  .binding =
96  sl_compiler->get_decoration(float_id, spv::DecorationBinding),
97  .count = 1u,
98  .msl_buffer = buffer_offset});
99  buffer_offset++;
100  }
101  for (auto& image_id : images) {
102  sl_compiler->add_msl_resource_binding({
103  .stage = execution_model,
104  .basetype = spirv_cross::SPIRType::BaseType::SampledImage,
105  .desc_set =
106  sl_compiler->get_decoration(image_id, spv::DecorationDescriptorSet),
107  .binding =
108  sl_compiler->get_decoration(image_id, spv::DecorationBinding),
109  .count = 1u,
110  // A sampled image is both an image and a sampler, so both
111  // offsets need to be set or depending on the partiular shader
112  // the bindings may be incorrect.
113  .msl_texture = sampler_offset,
114  .msl_sampler = sampler_offset,
115  });
116  sampler_offset++;
117  }
118 
119  return CompilerBackend(sl_compiler);
120 }
121 
123  const spirv_cross::ParsedIR& ir,
124  const SourceOptions& source_options) {
125  // TODO(dnfield): It seems like what we'd want is a CompilerGLSL with
126  // vulkan_semantics set to true, but that has regressed some things on GLES
127  // somehow. In the mean time, go back to using CompilerMSL, but set the Metal
128  // Language version to something really high so that we don't get weird
129  // complaints about using Metal features while trying to build Vulkan shaders.
130  // https://github.com/flutter/flutter/issues/123795
131  return CreateMSLCompiler(
132  ir, source_options,
133  spirv_cross::CompilerMSL::Options::make_msl_version(3, 0, 0));
134 }
135 
136 static CompilerBackend CreateGLSLCompiler(const spirv_cross::ParsedIR& ir,
137  const SourceOptions& source_options) {
138  auto gl_compiler = std::make_shared<spirv_cross::CompilerGLSL>(ir);
139 
140  // Walk the variables and insert the external image extension if any of them
141  // begins with the external texture prefix. Unfortunately, we can't walk
142  // `gl_compiler->get_shader_resources().separate_samplers` until the compiler
143  // is further along.
144  //
145  // Unfortunately, we can't just let the shader author add this extension and
146  // use `samplerExternalOES` directly because compiling to spirv requires the
147  // source language profile to be at least 310 ES, but this extension is
148  // incompatible with ES 310+.
149  for (auto& id : ir.ids_for_constant_or_variable) {
150  if (StringStartsWith(ir.get_name(id), kExternalTexturePrefix)) {
151  gl_compiler->require_extension("GL_OES_EGL_image_external");
152  break;
153  }
154  }
155 
156  spirv_cross::CompilerGLSL::Options sl_options;
157  sl_options.force_zero_initialized_variables = true;
158  sl_options.vertex.fixup_clipspace = true;
159  if (source_options.target_platform == TargetPlatform::kOpenGLES ||
161  sl_options.version = source_options.gles_language_version > 0
162  ? source_options.gles_language_version
163  : 100;
164  sl_options.es = true;
165  if (source_options.require_framebuffer_fetch &&
166  source_options.type == SourceType::kFragmentShader) {
167  gl_compiler->remap_ext_framebuffer_fetch(0, 0, true);
168  }
169  gl_compiler->set_variable_type_remap_callback(
170  [&](const spirv_cross::SPIRType& type, const std::string& var_name,
171  std::string& name_of_type) {
172  if (StringStartsWith(var_name, kExternalTexturePrefix)) {
173  name_of_type = "samplerExternalOES";
174  }
175  });
176  } else {
177  sl_options.version = source_options.gles_language_version > 0
178  ? source_options.gles_language_version
179  : 120;
180  sl_options.es = false;
181  }
182  gl_compiler->set_common_options(sl_options);
183  return CompilerBackend(gl_compiler);
184 }
185 
186 static CompilerBackend CreateSkSLCompiler(const spirv_cross::ParsedIR& ir,
187  const SourceOptions& source_options) {
188  auto sksl_compiler = std::make_shared<CompilerSkSL>(ir);
189  return CompilerBackend(sksl_compiler);
190 }
191 
193  switch (platform) {
195  FML_UNREACHABLE();
201  return false;
206  return true;
207  }
208  FML_UNREACHABLE();
209 }
210 
211 static CompilerBackend CreateCompiler(const spirv_cross::ParsedIR& ir,
212  const SourceOptions& source_options) {
213  CompilerBackend compiler;
214  switch (source_options.target_platform) {
218  compiler = CreateMSLCompiler(ir, source_options);
219  break;
222  compiler = CreateVulkanCompiler(ir, source_options);
223  break;
228  compiler = CreateGLSLCompiler(ir, source_options);
229  break;
231  compiler = CreateSkSLCompiler(ir, source_options);
232  }
233  if (!compiler) {
234  return {};
235  }
236  auto* backend = compiler.GetCompiler();
237  if (!EntryPointMustBeNamedMain(source_options.target_platform) &&
238  source_options.source_language == SourceLanguage::kGLSL) {
239  backend->rename_entry_point("main", source_options.entry_point_name,
240  ToExecutionModel(source_options.type));
241  }
242  return compiler;
243 }
244 
245 Compiler::Compiler(const std::shared_ptr<const fml::Mapping>& source_mapping,
246  const SourceOptions& source_options,
247  Reflector::Options reflector_options)
248  : options_(source_options) {
249  if (!source_mapping || source_mapping->GetMapping() == nullptr) {
250  COMPILER_ERROR(error_stream_)
251  << "Could not read shader source or shader source was empty.";
252  return;
253  }
254 
255  if (source_options.target_platform == TargetPlatform::kUnknown) {
256  COMPILER_ERROR(error_stream_) << "Target platform not specified.";
257  return;
258  }
259 
260  SPIRVCompilerOptions spirv_options;
261 
262  // Make sure reflection is as effective as possible. The generated shaders
263  // will be processed later by backend specific compilers.
264  spirv_options.generate_debug_info = true;
265 
266  switch (options_.source_language) {
268  // Expects GLSL 4.60 (Core Profile).
269  // https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.pdf
270  spirv_options.source_langauge =
271  shaderc_source_language::shaderc_source_language_glsl;
273  shaderc_profile::shaderc_profile_core, //
274  460, //
275  };
276  break;
278  spirv_options.source_langauge =
279  shaderc_source_language::shaderc_source_language_hlsl;
280  break;
282  COMPILER_ERROR(error_stream_) << "Source language invalid.";
283  return;
284  }
285 
286  switch (source_options.target_platform) {
289  SPIRVCompilerTargetEnv target;
290 
291  if (source_options.use_half_textures) {
292  target.env = shaderc_target_env::shaderc_target_env_opengl;
293  target.version = shaderc_env_version::shaderc_env_version_opengl_4_5;
294  target.spirv_version = shaderc_spirv_version::shaderc_spirv_version_1_0;
295  } else {
296  target.env = shaderc_target_env::shaderc_target_env_vulkan;
297  target.version = shaderc_env_version::shaderc_env_version_vulkan_1_1;
298  target.spirv_version = shaderc_spirv_version::shaderc_spirv_version_1_3;
299  }
300 
301  spirv_options.target = target;
302  } break;
306  SPIRVCompilerTargetEnv target;
307 
308  target.env = shaderc_target_env::shaderc_target_env_vulkan;
309  target.version = shaderc_env_version::shaderc_env_version_vulkan_1_1;
310  target.spirv_version = shaderc_spirv_version::shaderc_spirv_version_1_3;
311 
312  spirv_options.target = target;
313  } break;
317  SPIRVCompilerTargetEnv target;
318 
319  target.env = shaderc_target_env::shaderc_target_env_opengl;
320  target.version = shaderc_env_version::shaderc_env_version_opengl_4_5;
321  target.spirv_version = shaderc_spirv_version::shaderc_spirv_version_1_0;
322 
323  spirv_options.target = target;
324  spirv_options.macro_definitions.push_back("IMPELLER_GRAPHICS_BACKEND");
325  } break;
326  case TargetPlatform::kSkSL: {
327  SPIRVCompilerTargetEnv target;
328 
329  target.env = shaderc_target_env::shaderc_target_env_opengl;
330  target.version = shaderc_env_version::shaderc_env_version_opengl_4_5;
331  target.spirv_version = shaderc_spirv_version::shaderc_spirv_version_1_0;
332 
333  // When any optimization level above 'zero' is enabled, the phi merges at
334  // loop continue blocks are rendered using syntax that is supported in
335  // GLSL, but not in SkSL.
336  // https://bugs.chromium.org/p/skia/issues/detail?id=13518.
337  spirv_options.optimization_level =
338  shaderc_optimization_level::shaderc_optimization_level_zero;
339  spirv_options.target = target;
340  spirv_options.macro_definitions.push_back("SKIA_GRAPHICS_BACKEND");
341  } break;
343  COMPILER_ERROR(error_stream_) << "Target platform invalid.";
344  return;
345  }
346 
347  // Implicit definition that indicates that this compilation is for the device
348  // (instead of the host).
349  spirv_options.macro_definitions.push_back("IMPELLER_DEVICE");
350  for (const auto& define : source_options.defines) {
351  spirv_options.macro_definitions.push_back(define);
352  }
353 
354  std::vector<std::string> included_file_names;
355  spirv_options.includer = std::make_shared<Includer>(
356  options_.working_directory, options_.include_dirs,
357  [&included_file_names](auto included_name) {
358  included_file_names.emplace_back(std::move(included_name));
359  });
360 
361  // SPIRV Generation.
362  SPIRVCompiler spv_compiler(source_options, source_mapping);
363 
364  spirv_assembly_ = spv_compiler.CompileToSPV(
365  error_stream_, spirv_options.BuildShadercOptions());
366 
367  if (!spirv_assembly_) {
368  return;
369  } else {
370  included_file_names_ = std::move(included_file_names);
371  }
372 
373  // SL Generation.
374  spirv_cross::Parser parser(
375  reinterpret_cast<const uint32_t*>(spirv_assembly_->GetMapping()),
376  spirv_assembly_->GetSize() / sizeof(uint32_t));
377  // The parser and compiler must be run separately because the parser contains
378  // meta information (like type member names) that are useful for reflection.
379  parser.parse();
380 
381  const auto parsed_ir =
382  std::make_shared<spirv_cross::ParsedIR>(parser.get_parsed_ir());
383 
384  auto sl_compiler = CreateCompiler(*parsed_ir, options_);
385 
386  if (!sl_compiler) {
387  COMPILER_ERROR(error_stream_)
388  << "Could not create compiler for target platform.";
389  return;
390  }
391 
392  // We need to invoke the compiler even if we don't use the SL mapping later
393  // for Vulkan. The reflector needs information that is only valid after a
394  // successful compilation call.
395  auto sl_compilation_result =
396  CreateMappingWithString(sl_compiler.GetCompiler()->compile());
397 
398  // If the target is Vulkan, our shading language is SPIRV which we already
399  // have. We just need to strip it of debug information. If it isn't, we need
400  // to invoke the appropriate compiler to compile the SPIRV to the target SL.
401  if (source_options.target_platform == TargetPlatform::kVulkan) {
402  auto stripped_spirv_options = spirv_options;
403  stripped_spirv_options.generate_debug_info = false;
404  sl_mapping_ = spv_compiler.CompileToSPV(
405  error_stream_, stripped_spirv_options.BuildShadercOptions());
406  } else {
407  sl_mapping_ = sl_compilation_result;
408  }
409 
410  if (!sl_mapping_) {
411  COMPILER_ERROR(error_stream_) << "Could not generate SL from SPIRV";
412  return;
413  }
414 
415  reflector_ = std::make_unique<Reflector>(std::move(reflector_options), //
416  parsed_ir, //
417  GetSLShaderSource(), //
418  sl_compiler //
419  );
420 
421  if (!reflector_->IsValid()) {
422  COMPILER_ERROR(error_stream_)
423  << "Could not complete reflection on generated shader.";
424  return;
425  }
426 
427  is_valid_ = true;
428 }
429 
430 Compiler::~Compiler() = default;
431 
432 std::shared_ptr<fml::Mapping> Compiler::GetSPIRVAssembly() const {
433  return spirv_assembly_;
434 }
435 
436 std::shared_ptr<fml::Mapping> Compiler::GetSLShaderSource() const {
437  return sl_mapping_;
438 }
439 
440 bool Compiler::IsValid() const {
441  return is_valid_;
442 }
443 
444 std::string Compiler::GetSourcePrefix() const {
445  std::stringstream stream;
446  stream << options_.file_name << ": ";
447  return stream.str();
448 }
449 
450 std::string Compiler::GetErrorMessages() const {
451  return error_stream_.str();
452 }
453 
454 const std::vector<std::string>& Compiler::GetIncludedFileNames() const {
455  return included_file_names_;
456 }
457 
458 static std::string JoinStrings(std::vector<std::string> items,
459  const std::string& separator) {
460  std::stringstream stream;
461  for (size_t i = 0, count = items.size(); i < count; i++) {
462  const auto is_last = (i == count - 1);
463 
464  stream << items[i];
465  if (!is_last) {
466  stream << separator;
467  }
468  }
469  return stream.str();
470 }
471 
472 std::string Compiler::GetDependencyNames(const std::string& separator) const {
473  std::vector<std::string> dependencies = included_file_names_;
474  dependencies.push_back(options_.file_name);
475  return JoinStrings(dependencies, separator);
476 }
477 
478 std::unique_ptr<fml::Mapping> Compiler::CreateDepfileContents(
479  std::initializer_list<std::string> targets_names) const {
480  // https://github.com/ninja-build/ninja/blob/master/src/depfile_parser.cc#L28
481  const auto targets = JoinStrings(targets_names, " ");
482  const auto dependencies = GetDependencyNames(" ");
483 
484  std::stringstream stream;
485  stream << targets << ": " << dependencies << "\n";
486 
487  auto contents = std::make_shared<std::string>(stream.str());
488  return std::make_unique<fml::NonOwnedMapping>(
489  reinterpret_cast<const uint8_t*>(contents->data()), contents->size(),
490  [contents](auto, auto) {});
491 }
492 
494  return reflector_.get();
495 }
496 
497 } // namespace compiler
498 } // namespace impeller
impeller::compiler::Compiler::~Compiler
~Compiler()
impeller::compiler::CreateVulkanCompiler
static CompilerBackend CreateVulkanCompiler(const spirv_cross::ParsedIR &ir, const SourceOptions &source_options)
Definition: compiler.cc:122
uniform_sorter.h
impeller::compiler::SourceOptions::type
SourceType type
Definition: source_options.h:21
impeller::compiler::Compiler::CreateDepfileContents
std::unique_ptr< fml::Mapping > CreateDepfileContents(std::initializer_list< std::string > targets) const
Definition: compiler.cc:478
impeller::compiler::SPIRVCompiler::CompileToSPV
std::shared_ptr< fml::Mapping > CompileToSPV(std::stringstream &error_stream, const shaderc::CompileOptions &spirv_options) const
Definition: spirv_compiler.cc:21
impeller::compiler::SPIRVCompilerOptions::generate_debug_info
bool generate_debug_info
Definition: spirv_compiler.h:33
logger.h
impeller::compiler::CreateSkSLCompiler
static CompilerBackend CreateSkSLCompiler(const spirv_cross::ParsedIR &ir, const SourceOptions &source_options)
Definition: compiler.cc:186
allocation.h
impeller::compiler::SourceOptions::include_dirs
std::vector< IncludeDir > include_dirs
Definition: source_options.h:25
impeller::compiler::CompilerBackend
Definition: compiler_backend.h:21
impeller::compiler::EntryPointMustBeNamedMain
static bool EntryPointMustBeNamedMain(TargetPlatform platform)
Definition: compiler.cc:192
impeller::compiler::ParseMSLVersion
static uint32_t ParseMSLVersion(const std::string &msl_version)
Definition: compiler.cc:28
impeller::compiler::TargetPlatform::kMetalDesktop
@ kMetalDesktop
impeller::compiler::SourceOptions::metal_version
std::string metal_version
Definition: source_options.h:31
impeller::compiler::TargetPlatformToMSLPlatform
spirv_cross::CompilerMSL::Options::Platform TargetPlatformToMSLPlatform(TargetPlatform platform)
Definition: types.cc:212
impeller::compiler::SourceOptions
Definition: source_options.h:20
impeller::compiler::SourceOptions::use_half_textures
bool use_half_textures
Whether half-precision textures should be supported, requiring opengl semantics. Only used on metal t...
Definition: source_options.h:35
impeller::compiler::SPIRVCompilerOptions::includer
std::shared_ptr< Includer > includer
Definition: spirv_compiler.h:50
impeller::compiler::CreateGLSLCompiler
static CompilerBackend CreateGLSLCompiler(const spirv_cross::ParsedIR &ir, const SourceOptions &source_options)
Definition: compiler.cc:136
impeller::compiler::TargetPlatform::kMetalIOS
@ kMetalIOS
impeller::compiler::Compiler::Compiler
Compiler(const std::shared_ptr< const fml::Mapping > &source_mapping, const SourceOptions &options, Reflector::Options reflector_options)
Definition: compiler.cc:245
impeller::compiler::TargetPlatform
TargetPlatform
Definition: types.h:28
impeller::compiler::SourceLanguage::kGLSL
@ kGLSL
impeller::compiler::SPIRVCompilerOptions::source_profile
std::optional< SPIRVCompilerSourceProfile > source_profile
Definition: spirv_compiler.h:38
impeller::compiler::SPIRVCompilerTargetEnv::env
shaderc_target_env env
Definition: spirv_compiler.h:25
includer.h
impeller::compiler::SourceOptions::source_language
SourceLanguage source_language
Definition: source_options.h:23
impeller::compiler::kExternalTexturePrefix
constexpr char kExternalTexturePrefix[]
Definition: constants.h:11
impeller::SortUniforms
std::vector< spirv_cross::ID > SortUniforms(const spirv_cross::ParsedIR *ir, const spirv_cross::Compiler *compiler, std::optional< spirv_cross::SPIRType::BaseType > type_filter, bool include)
Sorts uniform declarations in an IR according to decoration order.
Definition: uniform_sorter.cc:11
impeller::compiler::SPIRVCompilerOptions::target
std::optional< SPIRVCompilerTargetEnv > target
Definition: spirv_compiler.h:46
impeller::compiler::SourceLanguage::kHLSL
@ kHLSL
impeller::compiler::TargetPlatform::kVulkan
@ kVulkan
impeller::compiler::SourceOptions::entry_point_name
std::string entry_point_name
Definition: source_options.h:27
impeller::compiler::SourceType::kFragmentShader
@ kFragmentShader
impeller::compiler::Compiler::GetErrorMessages
std::string GetErrorMessages() const
Definition: compiler.cc:450
impeller::compiler::SourceOptions::require_framebuffer_fetch
bool require_framebuffer_fetch
Whether the GLSL framebuffer fetch extension will be required.
Definition: source_options.h:40
impeller::compiler::TargetPlatform::kRuntimeStageVulkan
@ kRuntimeStageVulkan
impeller::compiler::Compiler::GetSPIRVAssembly
std::shared_ptr< fml::Mapping > GetSPIRVAssembly() const
Definition: compiler.cc:432
impeller::compiler::SourceOptions::gles_language_version
uint32_t gles_language_version
Definition: source_options.h:28
impeller::compiler::SPIRVCompilerOptions
Definition: spirv_compiler.h:32
impeller::compiler::SPIRVCompilerSourceProfile
Definition: spirv_compiler.h:19
impeller::compiler::JoinStrings
static std::string JoinStrings(std::vector< std::string > items, const std::string &separator)
Definition: compiler.cc:458
impeller::compiler::Reflector
Definition: reflector.h:51
impeller::compiler::Compiler::GetReflector
const Reflector * GetReflector() const
Definition: compiler.cc:493
impeller::compiler::SourceOptions::file_name
std::string file_name
Definition: source_options.h:26
impeller::compiler::Reflector::Options
Definition: reflector.h:53
compiler_backend.h
compiler.h
impeller::compiler::SPIRVCompilerTargetEnv::version
shaderc_env_version version
Definition: spirv_compiler.h:26
spirv_compiler.h
utilities.h
impeller::compiler::SourceLanguage::kUnknown
@ kUnknown
impeller::compiler::CompilerBackend::GetCompiler
spirv_cross::Compiler * GetCompiler()
Definition: compiler_backend.cc:51
impeller::compiler::ToExecutionModel
spv::ExecutionModel ToExecutionModel(SourceType type)
Definition: types.cc:198
impeller::compiler::SPIRVCompilerOptions::source_langauge
std::optional< shaderc_source_language > source_langauge
Definition: spirv_compiler.h:37
impeller::compiler::SourceOptions::working_directory
std::shared_ptr< fml::UniqueFD > working_directory
Definition: source_options.h:24
impeller::compiler::SPIRVCompilerTargetEnv::spirv_version
shaderc_spirv_version spirv_version
Definition: spirv_compiler.h:28
impeller::compiler::SourceOptions::target_platform
TargetPlatform target_platform
Definition: source_options.h:22
impeller::compiler::SPIRVCompilerOptions::macro_definitions
std::vector< std::string > macro_definitions
Definition: spirv_compiler.h:48
impeller::compiler::Compiler::IsValid
bool IsValid() const
Definition: compiler.cc:440
impeller::CreateMappingWithString
std::shared_ptr< fml::Mapping > CreateMappingWithString(std::string string)
Definition: allocation.cc:111
impeller::compiler::SPIRVCompilerOptions::BuildShadercOptions
shaderc::CompileOptions BuildShadercOptions() const
Definition: spirv_compiler.cc:276
impeller::compiler::TargetPlatform::kOpenGLDesktop
@ kOpenGLDesktop
impeller::compiler::SourceOptions::defines
std::vector< std::string > defines
Definition: source_options.h:29
impeller::compiler::TargetPlatform::kUnknown
@ kUnknown
impeller::compiler::TargetPlatform::kOpenGLES
@ kOpenGLES
constants.h
impeller::compiler::Compiler::GetSLShaderSource
std::shared_ptr< fml::Mapping > GetSLShaderSource() const
Definition: compiler.cc:436
impeller::compiler::CreateMSLCompiler
static CompilerBackend CreateMSLCompiler(const spirv_cross::ParsedIR &ir, const SourceOptions &source_options, std::optional< uint32_t > msl_version_override={})
Definition: compiler.cc:51
impeller::compiler::CreateCompiler
static CompilerBackend CreateCompiler(const spirv_cross::ParsedIR &ir, const SourceOptions &source_options)
Definition: compiler.cc:211
impeller::compiler::Compiler::GetIncludedFileNames
const std::vector< std::string > & GetIncludedFileNames() const
Definition: compiler.cc:454
impeller::compiler::TargetPlatform::kRuntimeStageMetal
@ kRuntimeStageMetal
impeller::compiler::SPIRVCompiler
Definition: spirv_compiler.h:55
impeller::compiler::SourceType::kVertexShader
@ kVertexShader
impeller::compiler::StringStartsWith
bool StringStartsWith(const std::string &target, const std::string &prefix)
Definition: utilities.cc:87
impeller
Definition: aiks_context.cc:10
COMPILER_ERROR
#define COMPILER_ERROR(stream)
Definition: logger.h:39
impeller::compiler::SPIRVCompilerOptions::optimization_level
shaderc_optimization_level optimization_level
Definition: spirv_compiler.h:40
impeller::compiler::TargetPlatform::kSkSL
@ kSkSL
impeller::compiler::TargetPlatform::kRuntimeStageGLES
@ kRuntimeStageGLES
impeller::compiler::SPIRVCompilerTargetEnv
Definition: spirv_compiler.h:24