diff --git a/impeller/compiler/BUILD.gn b/impeller/compiler/BUILD.gn index 363377b10d5b7..77050e2a18f03 100644 --- a/impeller/compiler/BUILD.gn +++ b/impeller/compiler/BUILD.gn @@ -30,7 +30,9 @@ impeller_component("compiler_lib") { ] } -executable("impellerc") { +impeller_component("impellerc") { + target_type = "executable" + sources = [ "impellerc_main.cc" ] deps = [ ":compiler_lib" ] diff --git a/impeller/display_list/display_list_dispatcher.cc b/impeller/display_list/display_list_dispatcher.cc index a8e500ac89c23..fef486e321270 100644 --- a/impeller/display_list/display_list_dispatcher.cc +++ b/impeller/display_list/display_list_dispatcher.cc @@ -539,17 +539,7 @@ void DisplayListDispatcher::drawDisplayList( void DisplayListDispatcher::drawTextBlob(const sk_sp blob, SkScalar x, SkScalar y) { - if (!blob) { - return; - } - - auto bounds = blob->bounds(); - bounds.fLeft += x; - bounds.fTop += y; - - impeller::Paint paint; - paint.color = impeller::Color::Random().WithAlpha(0.2); - canvas_.DrawRect(ToRect(bounds), paint); + UNIMPLEMENTED; } // |flutter::Dispatcher| diff --git a/impeller/renderer/backend/metal/render_pass_mtl.mm b/impeller/renderer/backend/metal/render_pass_mtl.mm index 068dd67ba1dc0..ef1dd15b1d273 100644 --- a/impeller/renderer/backend/metal/render_pass_mtl.mm +++ b/impeller/renderer/backend/metal/render_pass_mtl.mm @@ -397,7 +397,6 @@ static bool Bind(PassBindingsCache& pass, fml::closure pop_debug_marker = [encoder]() { [encoder popDebugGroup]; }; for (const auto& command : commands_) { if (command.index_count == 0u) { - VALIDATION_LOG << "Zero index count in render pass command."; continue; } @@ -505,6 +504,12 @@ static bool Bind(PassBindingsCache& pass, } } + if (command.index_count == 0u) { + // Essentially a no-op. Don't record the command but this is not necessary + // an error either. + return true; + } + commands_.emplace_back(std::move(command)); return true; } diff --git a/impeller/renderer/renderer.h b/impeller/renderer/renderer.h index 3ba709923b28e..08be51856aac2 100644 --- a/impeller/renderer/renderer.h +++ b/impeller/renderer/renderer.h @@ -4,8 +4,6 @@ #pragma once -#include - #include #include diff --git a/impeller/tools/impeller.gni b/impeller/tools/impeller.gni index 3594914db1c2b..717f6bd19aec9 100644 --- a/impeller/tools/impeller.gni +++ b/impeller/tools/impeller.gni @@ -8,38 +8,69 @@ import("//flutter/common/config.gni") declare_args() { # Whether playgrounds are enabled for unit tests. impeller_enable_playground = false + + # Whether Impeller is supported on the platform. + impeller_supports_platform = is_mac || is_ios } +# ------------------------------------------------------------------------------ +# @brief Define an Impeller component. Components are different +# Impeller subsystems part of the umbrella framework. +# +# @param[optional] target_type The type of the component. This can be any of +# the target types supported by GN. Defaults to +# source_set. If Impeller is not supported on the +# target platform, this target is a no-op. +# template("impeller_component") { - source_set(target_name) { - forward_variables_from(invoker, "*") - - if (!defined(invoker.public_configs)) { - public_configs = [] + if (impeller_supports_platform) { + target_type = "source_set" + if (defined(invoker.target_type)) { + target_type = invoker.target_type } + target(target_type, target_name) { + forward_variables_from(invoker, "*") - if (!defined(invoker.cflags_objc)) { - cflags_objc = [] - } + if (!defined(invoker.public_configs)) { + public_configs = [] + } - if (!defined(invoker.cflags_objcc)) { - cflags_objcc = [] - } + public_configs += [ "//flutter/impeller:impeller_public_config" ] - if (!defined(invoker.deps)) { - deps = [] - } + if (!defined(invoker.cflags_objc)) { + cflags_objc = [] + } - objc_warning_flags = [ "-Wno-unused-private-field" ] + if (is_ios || is_mac) { + cflags_objc += flutter_cflags_objc_arc + } - cflags_objc += flutter_cflags_objc_arc + objc_warning_flags - cflags_objcc += flutter_cflags_objcc_arc + objc_warning_flags + if (!defined(invoker.cflags_objcc)) { + cflags_objcc = [] + } - public_configs += [ "//flutter/impeller:impeller_public_config" ] + if (is_ios || is_mac) { + cflags_objcc += flutter_cflags_objcc_arc + } + } + } else { + group(target_name) { + not_needed(invoker, "*") + } } } +# ------------------------------------------------------------------------------ +# @brief Build a Metal Library. The output is a single file. Use +# get_target_outputs to get its location on build. +# +# @param[required] name The name of the Metal library. +# +# @param[required] sources The GLSL (4.60) sources to compiled into the Metal +# library. +# template("metal_library") { + assert(is_ios || is_mac) assert(defined(invoker.name), "Metal library name must be specified.") assert(defined(invoker.sources), "Metal source files must be specified.") @@ -94,7 +125,17 @@ template("metal_library") { } } -template("impeller_shaders") { +# ------------------------------------------------------------------------------ +# @brief Build and reflect shader information. Reflected shader +# information will be added to a generated source set along +# with the shader contents. +# +# @param[required] name The name of the shader library. +# +# @param[required] sources The GLSL (4.60) sources to compiled into the shader +# library. +# +template("impeller_shaders_real") { assert(defined(invoker.shaders), "Impeller shaders must be specified.") assert(defined(invoker.name), "Name of the shader library must be specified.") @@ -229,3 +270,27 @@ template("impeller_shaders") { ] } } + +# ------------------------------------------------------------------------------ +# @brief Builds the shader library from shader sources, generates +# reflected shader information as source set, and, generates a +# translation unit added as a source set that allows embedding +# shaders into the final binary. On platforms where Impeller is +# not supported, this is a no-op. +# +# @note For additional information about parameters, see +# `impeller_shaders_real` +# +# @see impeller_shaders_real +# +template("impeller_shaders") { + if (impeller_supports_platform) { + impeller_shaders_real(target_name) { + forward_variables_from(invoker, "*") + } + } else { + group(target_name) { + not_needed(invoker, "*") + } + } +}