From 87d1a4fa8ee4dece39b31515165361e0ad43c18c Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 14 May 2021 11:27:30 -0700 Subject: [PATCH] Wire up depfile support and Metal shader linking in GN rules. --- engine/src/flutter/impeller/compiler/BUILD.gn | 1 + .../src/flutter/impeller/compiler/compiler.cc | 92 +++++++-- .../src/flutter/impeller/compiler/compiler.h | 12 +- .../impeller/compiler/fixtures/common_types.h | 16 ++ .../impeller/compiler/fixtures/types.h | 11 +- .../impeller/compiler/impellerc_main.cc | 10 + .../flutter/impeller/compiler/include_dir.h | 21 +++ .../flutter/impeller/compiler/reflector.cc | 178 +++++++++--------- .../src/flutter/impeller/compiler/switches.cc | 14 +- .../src/flutter/impeller/compiler/switches.h | 4 +- .../impeller/compiler/tools/compiler.gni | 23 ++- engine/src/flutter/impeller/impeller/BUILD.gn | 1 + .../impeller/compositor/shaders/box/box.frag | 2 + .../impeller/compositor/shaders/box/box.vert | 7 +- .../impeller/tools/metal/metal_library.gni | 10 + 15 files changed, 282 insertions(+), 120 deletions(-) create mode 100644 engine/src/flutter/impeller/compiler/fixtures/common_types.h create mode 100644 engine/src/flutter/impeller/compiler/include_dir.h diff --git a/engine/src/flutter/impeller/compiler/BUILD.gn b/engine/src/flutter/impeller/compiler/BUILD.gn index aaacc2a27c..540ccc7328 100644 --- a/engine/src/flutter/impeller/compiler/BUILD.gn +++ b/engine/src/flutter/impeller/compiler/BUILD.gn @@ -8,6 +8,7 @@ source_set("compiler_lib") { sources = [ "compiler.cc", "compiler.h", + "include_dir.h", "logger.h", "reflector.cc", "reflector.h", diff --git a/engine/src/flutter/impeller/compiler/compiler.cc b/engine/src/flutter/impeller/compiler/compiler.cc index 8dea97f465..d7c4b0afad 100644 --- a/engine/src/flutter/impeller/compiler/compiler.cc +++ b/engine/src/flutter/impeller/compiler/compiler.cc @@ -4,9 +4,11 @@ #include "flutter/impeller/compiler/compiler.h" -#include "flutter/impeller/compiler/logger.h" - #include +#include + +#include "flutter/fml/paths.h" +#include "flutter/impeller/compiler/logger.h" namespace impeller { namespace compiler { @@ -27,17 +29,19 @@ struct IncluderData { class Includer final : public shaderc::CompileOptions::IncluderInterface { public: Includer(std::shared_ptr working_directory, - std::vector> include_dirs) + std::vector include_dirs, + std::function on_file_included) : working_directory_(std::move(working_directory)), - include_dirs_(std::move(include_dirs)) {} + include_dirs_(std::move(include_dirs)), + on_file_included_(std::move(on_file_included)) {} // |shaderc::CompileOptions::IncluderInterface| ~Includer() override = default; std::unique_ptr TryOpenMapping( - const std::shared_ptr& des, - const char* requested_source) const { - if (!des || !des->is_valid()) { + const IncludeDir& dir, + const char* requested_source) { + if (!dir.dir || !dir.dir->is_valid()) { return nullptr; } @@ -50,15 +54,27 @@ class Includer final : public shaderc::CompileOptions::IncluderInterface { return nullptr; } - return fml::FileMapping::CreateReadOnly(*des, requested_source); + auto mapping = fml::FileMapping::CreateReadOnly(*dir.dir, requested_source); + if (!mapping || !mapping->IsValid()) { + return nullptr; + } + + on_file_included_(fml::paths::JoinPaths({dir.name, requested_source})); + + return mapping; } std::unique_ptr FindFirstMapping( - const char* requested_source) const { + const char* requested_source) { // Always try the working directory first no matter what the include // directories are. - if (auto mapping = TryOpenMapping(working_directory_, requested_source)) { - return mapping; + { + IncludeDir dir; + dir.name = "."; + dir.dir = working_directory_; + if (auto mapping = TryOpenMapping(dir, requested_source)) { + return mapping; + } } for (const auto& include_dir : include_dirs_) { @@ -120,8 +136,8 @@ class Includer final : public shaderc::CompileOptions::IncluderInterface { private: std::shared_ptr working_directory_; - std::vector> include_dirs_; - std::string included_file_paths_; + std::vector include_dirs_; + std::function on_file_included_; FML_DISALLOW_COPY_AND_ASSIGN(Includer); }; @@ -203,8 +219,14 @@ Compiler::Compiler(const fml::Mapping& source_mapping, options.SetAutoBindUniforms(true); options.SetAutoMapLocations(true); - options.SetIncluder(std::make_unique(options_.working_directory, - options_.include_dirs)); + options.AddMacroDefinition("IMPELLER_DEVICE"); + + std::vector included_file_names; + options.SetIncluder(std::make_unique( + options_.working_directory, options_.include_dirs, + [&included_file_names](auto included_name) { + included_file_names.emplace_back(std::move(included_name)); + })); shaderc::Compiler spv_compiler; if (!spv_compiler.IsValid()) { @@ -234,6 +256,8 @@ Compiler::Compiler(const fml::Mapping& source_mapping, COMPILER_ERROR_NO_PREFIX << spv_result_->GetErrorMessage(); } return; + } else { + included_file_names_ = std::move(included_file_names); } // MSL Generation. @@ -329,5 +353,43 @@ std::string Compiler::GetErrorMessages() const { return error_stream_.str(); } +const std::vector& Compiler::GetIncludedFileNames() const { + return included_file_names_; +} + +static std::string JoinStrings(std::vector items, + std::string separator) { + std::stringstream stream; + for (size_t i = 0, count = items.size(); i < count; i++) { + const auto is_last = (i == count - 1); + + stream << items[i]; + if (!is_last) { + stream << separator; + } + } + return stream.str(); +} + +std::string Compiler::GetDependencyNames(std::string separator) const { + std::vector dependencies = included_file_names_; + dependencies.push_back(options_.file_name); + return JoinStrings(dependencies, separator); +} + +std::unique_ptr Compiler::CreateDepfileContents( + std::initializer_list targets_names) const { + const auto targets = JoinStrings(targets_names, " "); + const auto dependencies = GetDependencyNames(" "); + + std::stringstream stream; + stream << targets << ":\n\t" << dependencies << "\n"; + + auto contents = std::make_shared(stream.str()); + return std::make_unique( + reinterpret_cast(contents->data()), contents->size(), + [contents](auto, auto) {}); +} + } // namespace compiler } // namespace impeller diff --git a/engine/src/flutter/impeller/compiler/compiler.h b/engine/src/flutter/impeller/compiler/compiler.h index a162cd98e9..d9d64708a1 100644 --- a/engine/src/flutter/impeller/compiler/compiler.h +++ b/engine/src/flutter/impeller/compiler/compiler.h @@ -4,11 +4,13 @@ #pragma once +#include #include #include #include "flutter/fml/macros.h" #include "flutter/fml/mapping.h" +#include "flutter/impeller/compiler/include_dir.h" #include "flutter/impeller/compiler/reflector.h" #include "shaderc/shaderc.hpp" #include "third_party/spirv_cross/spirv_msl.hpp" @@ -29,7 +31,7 @@ class Compiler { struct SourceOptions { SourceType type = SourceType::kUnknown; std::shared_ptr working_directory; - std::vector> include_dirs; + std::vector include_dirs; std::string file_name = "main.glsl"; std::string entry_point_name = "main"; @@ -51,16 +53,24 @@ class Compiler { std::string GetErrorMessages() const; + const std::vector& GetIncludedFileNames() const; + + std::unique_ptr CreateDepfileContents( + std::initializer_list targets) const; + private: SourceOptions options_; std::shared_ptr spv_result_; std::shared_ptr msl_string_; std::stringstream error_stream_; std::unique_ptr reflector_; + std::vector included_file_names_; bool is_valid_ = false; std::string GetSourcePrefix() const; + std::string GetDependencyNames(std::string separator) const; + FML_DISALLOW_COPY_AND_ASSIGN(Compiler); }; diff --git a/engine/src/flutter/impeller/compiler/fixtures/common_types.h b/engine/src/flutter/impeller/compiler/fixtures/common_types.h new file mode 100644 index 0000000000..ad4d31f94b --- /dev/null +++ b/engine/src/flutter/impeller/compiler/fixtures/common_types.h @@ -0,0 +1,16 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifdef IMPELLER_DEVICE + +#define Vector3 vec3 +#define Vector4 vec4 +#define Matrix mat4 + +#else // IMPELLER_DEVICE + +#include "flutter/impeller/impeller/geometry/matrix.h" +#include "flutter/impeller/impeller/geometry/vector.h" + +#endif // IMPELLER_DEVICE diff --git a/engine/src/flutter/impeller/compiler/fixtures/types.h b/engine/src/flutter/impeller/compiler/fixtures/types.h index 448c331072..86572a6655 100644 --- a/engine/src/flutter/impeller/compiler/fixtures/types.h +++ b/engine/src/flutter/impeller/compiler/fixtures/types.h @@ -1,8 +1,13 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "common_types.h" struct Hello { - vec4 stuff; - vec2 more_stuff; + Vector4 stuff; + Vector3 more_stuff; float dunno; float this_bit_is_not_used; - vec2 yet_more_stuff; + Vector4 yet_more_stuff; }; diff --git a/engine/src/flutter/impeller/compiler/impellerc_main.cc b/engine/src/flutter/impeller/compiler/impellerc_main.cc index 4142bd6365..6443d6e131 100644 --- a/engine/src/flutter/impeller/compiler/impellerc_main.cc +++ b/engine/src/flutter/impeller/compiler/impellerc_main.cc @@ -62,6 +62,16 @@ bool Main(const fml::CommandLine& command_line) { return false; } + if (!switches.depfile_path.empty()) { + if (!fml::WriteAtomically( + *switches.working_directory, switches.depfile_path.c_str(), + *compiler.CreateDepfileContents({switches.metal_file_name}))) { + std::cerr << "Could not write depfile to " << switches.depfile_path + << std::endl; + return false; + } + } + return true; } diff --git a/engine/src/flutter/impeller/compiler/include_dir.h b/engine/src/flutter/impeller/compiler/include_dir.h new file mode 100644 index 0000000000..0c7927a47f --- /dev/null +++ b/engine/src/flutter/impeller/compiler/include_dir.h @@ -0,0 +1,21 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#pragma once + +#include +#include + +#include "flutter/fml/unique_fd.h" + +namespace impeller { +namespace compiler { + +struct IncludeDir { + std::shared_ptr dir; + std::string name; +}; + +} // namespace compiler +} // namespace impeller diff --git a/engine/src/flutter/impeller/compiler/reflector.cc b/engine/src/flutter/impeller/compiler/reflector.cc index cc1d82c404..347ba8d21d 100644 --- a/engine/src/flutter/impeller/compiler/reflector.cc +++ b/engine/src/flutter/impeller/compiler/reflector.cc @@ -11,108 +11,108 @@ namespace impeller { namespace compiler { -std::string SpvReflectInterfaceVariableToString( - const SpvReflectInterfaceVariable& var) { - std::stringstream stream; - stream << "--- Interface Variable" << std::endl; - stream << "spirv_id=" << var.spirv_id << std::endl; - if (var.name) { - stream << "name=" << var.name << std::endl; - } - stream << "location=" << var.location << std::endl; - stream << "storage_class=" << var.storage_class << std::endl; - if (var.semantic) { - stream << "semantic=" << var.semantic << std::endl; - } - stream << "decoration_flags=" << var.decoration_flags << std::endl; - stream << "built_in=" << var.built_in << std::endl; - // stream << "numeric=" << var.numeric << std::endl; - // stream << "array=" << var.array << std::endl; - stream << "member_count=" << var.member_count << std::endl; - // stream << "members=" << var.members << std::endl; - stream << "format=" << var.format << std::endl; - stream << "type_description=" << var.type_description << std::endl; - return stream.str(); -} +// std::string SpvReflectInterfaceVariableToString( +// const SpvReflectInterfaceVariable& var) { +// std::stringstream stream; +// stream << "--- Interface Variable" << std::endl; +// stream << "spirv_id=" << var.spirv_id << std::endl; +// if (var.name) { +// stream << "name=" << var.name << std::endl; +// } +// stream << "location=" << var.location << std::endl; +// stream << "storage_class=" << var.storage_class << std::endl; +// if (var.semantic) { +// stream << "semantic=" << var.semantic << std::endl; +// } +// stream << "decoration_flags=" << var.decoration_flags << std::endl; +// stream << "built_in=" << var.built_in << std::endl; +// // stream << "numeric=" << var.numeric << std::endl; +// // stream << "array=" << var.array << std::endl; +// stream << "member_count=" << var.member_count << std::endl; +// // stream << "members=" << var.members << std::endl; +// stream << "format=" << var.format << std::endl; +// stream << "type_description=" << var.type_description << std::endl; +// return stream.str(); +// } -std::string SpvReflectDescriptorBindingToString( - const SpvReflectDescriptorBinding& des) { - std::stringstream stream; - stream << "--- Descriptor Set Binding" << std::endl; - stream << "spirv_id=" << des.spirv_id << std::endl; - if (des.name) { - stream << "name=" << des.name << std::endl; - } - stream << "binding=" << des.binding << std::endl; - stream << "input_attachment_index=" << des.input_attachment_index - << std::endl; - stream << "set=" << des.set << std::endl; - stream << "descriptor_type=" << des.descriptor_type << std::endl; - stream << "resource_type=" << des.resource_type << std::endl; - // stream << "image=" << des.image << std::endl; - // stream << "block=" << des.block << std::endl; - // stream << "array=" << des.array << std::endl; - stream << "count=" << des.count << std::endl; - stream << "accessed=" << des.accessed << std::endl; - stream << "uav_counter_id=" << des.uav_counter_id << std::endl; - stream << "uav_counter_binding=" << des.uav_counter_binding << std::endl; - stream << "type_description=" << des.type_description << std::endl; - return stream.str(); -} +// std::string SpvReflectDescriptorBindingToString( +// const SpvReflectDescriptorBinding& des) { +// std::stringstream stream; +// stream << "--- Descriptor Set Binding" << std::endl; +// stream << "spirv_id=" << des.spirv_id << std::endl; +// if (des.name) { +// stream << "name=" << des.name << std::endl; +// } +// stream << "binding=" << des.binding << std::endl; +// stream << "input_attachment_index=" << des.input_attachment_index +// << std::endl; +// stream << "set=" << des.set << std::endl; +// stream << "descriptor_type=" << des.descriptor_type << std::endl; +// stream << "resource_type=" << des.resource_type << std::endl; +// // stream << "image=" << des.image << std::endl; +// // stream << "block=" << des.block << std::endl; +// // stream << "array=" << des.array << std::endl; +// stream << "count=" << des.count << std::endl; +// stream << "accessed=" << des.accessed << std::endl; +// stream << "uav_counter_id=" << des.uav_counter_id << std::endl; +// stream << "uav_counter_binding=" << des.uav_counter_binding << std::endl; +// stream << "type_description=" << des.type_description << std::endl; +// return stream.str(); +// } Reflector::Reflector(const fml::Mapping& spirv_binary) { - if (spirv_binary.GetMapping() == nullptr) { - return; - } + // if (spirv_binary.GetMapping() == nullptr) { + // return; + // } - spv_reflect::ShaderModule module(spirv_binary.GetSize(), - spirv_binary.GetMapping()); + // spv_reflect::ShaderModule module(spirv_binary.GetSize(), + // spirv_binary.GetMapping()); - if (module.GetResult() != SpvReflectResult::SPV_REFLECT_RESULT_SUCCESS) { - return; - } + // if (module.GetResult() != SpvReflectResult::SPV_REFLECT_RESULT_SUCCESS) { + // return; + // } - FML_LOG(ERROR) << "~~~~~~~~~~~~~ Interface Variables ~~~~~~~~~~~~~"; + // FML_LOG(ERROR) << "~~~~~~~~~~~~~ Interface Variables ~~~~~~~~~~~~~"; - { - uint32_t count = 0; - if (module.EnumerateInterfaceVariables(&count, nullptr) != - SpvReflectResult::SPV_REFLECT_RESULT_SUCCESS) { - return; - } + // { + // uint32_t count = 0; + // if (module.EnumerateInterfaceVariables(&count, nullptr) != + // SpvReflectResult::SPV_REFLECT_RESULT_SUCCESS) { + // return; + // } - std::vector input_variables; - input_variables.resize(count); - if (module.EnumerateInterfaceVariables(&count, input_variables.data()) != - SpvReflectResult::SPV_REFLECT_RESULT_SUCCESS) { - return; - } + // std::vector input_variables; + // input_variables.resize(count); + // if (module.EnumerateInterfaceVariables(&count, input_variables.data()) != + // SpvReflectResult::SPV_REFLECT_RESULT_SUCCESS) { + // return; + // } - for (const auto& input_variable : input_variables) { - FML_LOG(ERROR) << SpvReflectInterfaceVariableToString(*input_variable); - } - } + // for (const auto& input_variable : input_variables) { + // FML_LOG(ERROR) << SpvReflectInterfaceVariableToString(*input_variable); + // } + // } - FML_LOG(ERROR) << "~~~~~~~~~~~~~ Descriptor Bindings ~~~~~~~~~~~~~"; + // FML_LOG(ERROR) << "~~~~~~~~~~~~~ Descriptor Bindings ~~~~~~~~~~~~~"; - { - uint32_t count = 0; - if (module.EnumerateDescriptorBindings(&count, nullptr) != - SpvReflectResult::SPV_REFLECT_RESULT_SUCCESS) { - return; - } + // { + // uint32_t count = 0; + // if (module.EnumerateDescriptorBindings(&count, nullptr) != + // SpvReflectResult::SPV_REFLECT_RESULT_SUCCESS) { + // return; + // } - std::vector input_variables; - input_variables.resize(count); - if (module.EnumerateDescriptorBindings(&count, input_variables.data()) != - SpvReflectResult::SPV_REFLECT_RESULT_SUCCESS) { - return; - } + // std::vector input_variables; + // input_variables.resize(count); + // if (module.EnumerateDescriptorBindings(&count, input_variables.data()) != + // SpvReflectResult::SPV_REFLECT_RESULT_SUCCESS) { + // return; + // } - for (const auto& input_variable : input_variables) { - FML_LOG(ERROR) << SpvReflectDescriptorBindingToString(*input_variable); - } - } + // for (const auto& input_variable : input_variables) { + // FML_LOG(ERROR) << SpvReflectDescriptorBindingToString(*input_variable); + // } + // } is_valid_ = true; } diff --git a/engine/src/flutter/impeller/compiler/switches.cc b/engine/src/flutter/impeller/compiler/switches.cc index e7f2a8b5d6..2ea0e8549d 100644 --- a/engine/src/flutter/impeller/compiler/switches.cc +++ b/engine/src/flutter/impeller/compiler/switches.cc @@ -16,7 +16,8 @@ void Switches::PrintHelp(std::ostream& stream) { stream << "--input=" << std::endl; stream << "--metal=" << std::endl; stream << "--spirv=" << std::endl; - stream << "[Multiple] --include=" << std::endl; + stream << "[optional,multiple] --include=" << std::endl; + stream << "[optional] --depfile=" << std::endl; } Switches::Switches() = default; @@ -30,10 +31,12 @@ Switches::Switches(const fml::CommandLine& command_line) fml::FilePermission::kRead))), source_file_name(command_line.GetOptionValueWithDefault("input", "")), metal_file_name(command_line.GetOptionValueWithDefault("metal", "")), - spirv_file_name(command_line.GetOptionValueWithDefault("spirv", "")) { + spirv_file_name(command_line.GetOptionValueWithDefault("spirv", "")), + depfile_path(command_line.GetOptionValueWithDefault("depfile", "")) { if (!working_directory || !working_directory->is_valid()) { return; } + for (const auto& include_dir_path : command_line.GetOptionValues("include")) { if (!include_dir_path.data()) { continue; @@ -43,7 +46,12 @@ Switches::Switches(const fml::CommandLine& command_line) if (!dir || !dir->is_valid()) { continue; } - include_directories.emplace_back(std::move(dir)); + + IncludeDir dir_entry; + dir_entry.name = include_dir_path; + dir_entry.dir = std::move(dir); + + include_directories.emplace_back(std::move(dir_entry)); } } diff --git a/engine/src/flutter/impeller/compiler/switches.h b/engine/src/flutter/impeller/compiler/switches.h index afd437a457..d9e1df1d92 100644 --- a/engine/src/flutter/impeller/compiler/switches.h +++ b/engine/src/flutter/impeller/compiler/switches.h @@ -10,16 +10,18 @@ #include "flutter/fml/command_line.h" #include "flutter/fml/macros.h" #include "flutter/fml/unique_fd.h" +#include "flutter/impeller/compiler/include_dir.h" namespace impeller { namespace compiler { struct Switches { std::shared_ptr working_directory; - std::vector> include_directories; + std::vector include_directories; std::string source_file_name; std::string metal_file_name; std::string spirv_file_name; + std::string depfile_path; Switches(); diff --git a/engine/src/flutter/impeller/compiler/tools/compiler.gni b/engine/src/flutter/impeller/compiler/tools/compiler.gni index 92bdc70df8..e3230b4244 100644 --- a/engine/src/flutter/impeller/compiler/tools/compiler.gni +++ b/engine/src/flutter/impeller/compiler/tools/compiler.gni @@ -3,11 +3,14 @@ # found in the LICENSE file. import("//build/compiled_action.gni") +import("//flutter/impeller/tools/metal/metal_library.gni") template("impeller_shaders") { - compiled_action_foreach(target_name) { - assert(defined(invoker.shaders), "Impeller shaders must be specified.") + assert(defined(invoker.shaders), "Impeller shaders must be specified.") + assert(defined(invoker.name), "Name of the shader library must be specified.") + metal_sources_target_name = "metal_sources_$target_name" + compiled_action_foreach(metal_sources_target_name) { tool = "//flutter/impeller/compiler:impellerc" sources = invoker.shaders @@ -15,20 +18,28 @@ template("impeller_shaders") { metal_intermediate = "$target_gen_dir/{{source_file_part}}.metal" spirv_intermediate = "$target_gen_dir/{{source_file_part}}.spirv" - outputs = [ - metal_intermediate, - spirv_intermediate, - ] + outputs = [ metal_intermediate ] + depfile_path = "$target_gen_dir/{{source_file_part}}.d" source_path = "{{source}}" metal_intermediate_path = rebase_path(metal_intermediate, root_build_dir) spirv_intermediate_path = rebase_path(spirv_intermediate, root_build_dir) + depfile_intermediate_path = rebase_path(depfile_path, root_build_dir) + + depfile = depfile_path args = [ "--input=$source_path", "--metal=$metal_intermediate_path", "--spirv=$spirv_intermediate_path", "--include={{source_dir}}", + "--depfile=$depfile_intermediate_path", ] } + + metal_library(target_name) { + name = invoker.name + sources = get_target_outputs(":$metal_sources_target_name") + deps = [ ":$metal_sources_target_name" ] + } } diff --git a/engine/src/flutter/impeller/impeller/BUILD.gn b/engine/src/flutter/impeller/impeller/BUILD.gn index 1199d9a593..aa4ff9845b 100644 --- a/engine/src/flutter/impeller/impeller/BUILD.gn +++ b/engine/src/flutter/impeller/impeller/BUILD.gn @@ -10,6 +10,7 @@ config("impeller_config") { } impeller_shaders("shaders") { + name = "impeller" shaders = [ "compositor/shaders/box/box.frag", "compositor/shaders/box/box.vert", diff --git a/engine/src/flutter/impeller/impeller/compositor/shaders/box/box.frag b/engine/src/flutter/impeller/impeller/compositor/shaders/box/box.frag index 1b9f713ace..333c266ada 100644 --- a/engine/src/flutter/impeller/impeller/compositor/shaders/box/box.frag +++ b/engine/src/flutter/impeller/impeller/compositor/shaders/box/box.frag @@ -1,3 +1,5 @@ +#include "types.h" + out vec4 outColor; void main() { diff --git a/engine/src/flutter/impeller/impeller/compositor/shaders/box/box.vert b/engine/src/flutter/impeller/impeller/compositor/shaders/box/box.vert index e86bae3da2..b3a757b5a4 100644 --- a/engine/src/flutter/impeller/impeller/compositor/shaders/box/box.vert +++ b/engine/src/flutter/impeller/impeller/compositor/shaders/box/box.vert @@ -6,11 +6,14 @@ uniform UniformBufferObject { in vec3 inPosition; -in float stuff; +in vec4 inAnotherPosition; + +layout(location = 3) in float stuff; out float outStuff; void main() { - gl_Position = ubo.uniforms.projection * ubo.uniforms.view * ubo.uniforms.model * vec4(inPosition, 1.0); + gl_Position = ubo.uniforms.projection * ubo.uniforms.view * ubo.uniforms.model * vec4(inPosition, 1.0) * inAnotherPosition; outStuff = stuff; } + diff --git a/engine/src/flutter/impeller/tools/metal/metal_library.gni b/engine/src/flutter/impeller/tools/metal/metal_library.gni index ca077e8a3c..8c2f4c98e5 100644 --- a/engine/src/flutter/impeller/tools/metal/metal_library.gni +++ b/engine/src/flutter/impeller/tools/metal/metal_library.gni @@ -9,6 +9,16 @@ template("metal_library") { metal_library_name = invoker.name action("$target_name") { + forward_variables_from(invoker, + "*", + [ + "inputs", + "outputs", + "script", + "depfile", + "args", + ]) + inputs = invoker.sources metal_library_path = "$root_out_dir/shaders/$metal_library_name.metallib"