[impellerc] Adds an --iplr flag (flutter/engine#34822)

This commit is contained in:
Zachary Anderson 2022-07-21 13:52:33 -07:00 committed by GitHub
parent 0fd8f28571
commit 26a5b40455
9 changed files with 27 additions and 2 deletions

View File

@ -85,7 +85,7 @@ bool Main(const fml::CommandLine& command_line) {
if (TargetPlatformNeedsSL(options.target_platform)) {
auto sl_file_name = std::filesystem::absolute(
std::filesystem::current_path() / switches.sl_file_name);
const bool is_runtime_stage_data = HasSuffix(switches.sl_file_name, "iplr");
const bool is_runtime_stage_data = switches.iplr;
if (is_runtime_stage_data) {
auto reflector = compiler.GetReflector();
if (reflector == nullptr) {

View File

@ -52,6 +52,8 @@ void Switches::PrintHelp(std::ostream& stream) {
stream << "}" << std::endl;
stream << "--sl=<sl_output_file>" << std::endl;
stream << "--spirv=<spirv_output_file>" << std::endl;
stream << "[optional] --iplr (causes --sl file to be emitted in iplr format)"
<< std::endl;
stream << "[optional] --reflection-json=<reflection_json_file>" << std::endl;
stream << "[optional] --reflection-header=<reflection_header_file>"
<< std::endl;
@ -103,6 +105,7 @@ Switches::Switches(const fml::CommandLine& command_line)
source_file_name(command_line.GetOptionValueWithDefault("input", "")),
input_type(SourceTypeFromCommandLine(command_line)),
sl_file_name(command_line.GetOptionValueWithDefault("sl", "")),
iplr(command_line.HasOption("iplr")),
spirv_file_name(command_line.GetOptionValueWithDefault("spirv", "")),
reflection_json_name(
command_line.GetOptionValueWithDefault("reflection-json", "")),

View File

@ -24,6 +24,7 @@ struct Switches {
std::string source_file_name;
SourceType input_type;
std::string sl_file_name;
bool iplr;
std::string spirv_file_name;
std::string reflection_json_name;
std::string reflection_header_name;

View File

@ -26,6 +26,7 @@ impellerc("runtime_stages") {
shaders = [ "ink_sparkle.frag" ]
sl_file_extension = "iplr"
shader_target_flag = "--runtime-stage-metal"
iplr = true
}
test_fixtures("file_fixtures") {

View File

@ -248,7 +248,18 @@ template("impellerc") {
defined(invoker.sl_file_extension),
"The extension of the SL file must be specified (metal, glsl, etc..).")
}
iplr = false
if (defined(invoker.iplr) && invoker.iplr) {
iplr = invoker.iplr
}
# Not needed on every path.
not_needed([
"iplr",
"sksl",
])
# Optional: invoker.iplr Causes --sl output to be in iplr format.
# Optional: invoker.defines specifies a list of valueless macro definitions.
# Optional: invoker.intermediates_subdir specifies the subdirectory in which
# to put intermediates.
@ -281,7 +292,6 @@ template("impellerc") {
]
if (flutter_spirv) {
not_needed([ "sksl" ])
args += [ "--spirv=$spirv_intermediate_path" ]
outputs = [ spirv_intermediate ]
} else if (sksl) {
@ -292,6 +302,9 @@ template("impellerc") {
"--sl=$sl_intermediate_path",
"--spirv=$spirv_intermediate_path",
]
if (iplr) {
args += [ "--iplr" ]
}
outputs = [ sl_intermediate ]
} else {
@ -316,6 +329,9 @@ template("impellerc") {
"--reflection-header=$reflection_header_path",
"--reflection-cc=$reflection_cc_path",
]
if (iplr) {
args += [ "--iplr" ]
}
outputs = [
sl_intermediate,

View File

@ -51,6 +51,7 @@ if (enable_unittests) {
shader_target_flag = "--sksl"
intermediates_subdir = "iplr"
sl_file_extension = "iplr"
iplr = true
}
test_fixtures("fixtures") {

View File

@ -44,6 +44,7 @@ if (enable_unittests) {
shader_target_flag = "--sksl"
intermediates_subdir = "iplr"
sl_file_extension = "iplr"
iplr = true
}
test_fixtures("fixtures") {

View File

@ -70,6 +70,7 @@ if (enable_unittests) {
shader_target_flag = "--sksl"
intermediates_subdir = "iplr"
sl_file_extension = "iplr"
iplr = true
}
test_fixtures("fixtures") {

View File

@ -66,6 +66,7 @@ if (enable_unittests) {
shader_target_flag = "--sksl"
intermediates_subdir = "iplr"
sl_file_extension = "iplr"
iplr = true
}
test_fixtures("fixtures") {