Document GN rules and make targets that cannot be built on the platform be no-ops. (flutter/engine#70)
This commit is contained in:
@@ -30,7 +30,9 @@ impeller_component("compiler_lib") {
|
||||
]
|
||||
}
|
||||
|
||||
executable("impellerc") {
|
||||
impeller_component("impellerc") {
|
||||
target_type = "executable"
|
||||
|
||||
sources = [ "impellerc_main.cc" ]
|
||||
|
||||
deps = [ ":compiler_lib" ]
|
||||
|
||||
@@ -539,17 +539,7 @@ void DisplayListDispatcher::drawDisplayList(
|
||||
void DisplayListDispatcher::drawTextBlob(const sk_sp<SkTextBlob> 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|
|
||||
|
||||
@@ -397,7 +397,6 @@ bool RenderPassMTL::EncodeCommands(Allocator& allocator,
|
||||
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 @@ bool RenderPassMTL::AddCommand(Command command) {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <dispatch/dispatch.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
|
||||
@@ -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 = []
|
||||
}
|
||||
|
||||
public_configs += [ "//flutter/impeller:impeller_public_config" ]
|
||||
|
||||
if (!defined(invoker.cflags_objc)) {
|
||||
cflags_objc = []
|
||||
}
|
||||
|
||||
if (is_ios || is_mac) {
|
||||
cflags_objc += flutter_cflags_objc_arc
|
||||
}
|
||||
|
||||
if (!defined(invoker.cflags_objcc)) {
|
||||
cflags_objcc = []
|
||||
}
|
||||
|
||||
if (is_ios || is_mac) {
|
||||
cflags_objcc += flutter_cflags_objcc_arc
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined(invoker.cflags_objcc)) {
|
||||
cflags_objcc = []
|
||||
} else {
|
||||
group(target_name) {
|
||||
not_needed(invoker, "*")
|
||||
}
|
||||
|
||||
if (!defined(invoker.deps)) {
|
||||
deps = []
|
||||
}
|
||||
|
||||
objc_warning_flags = [ "-Wno-unused-private-field" ]
|
||||
|
||||
cflags_objc += flutter_cflags_objc_arc + objc_warning_flags
|
||||
cflags_objcc += flutter_cflags_objcc_arc + objc_warning_flags
|
||||
|
||||
public_configs += [ "//flutter/impeller:impeller_public_config" ]
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# @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, "*")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user