Reorganize project structure.

This commit is contained in:
Chinmay Garde 2021-06-01 14:53:18 -07:00 committed by Dan Field
parent 070e73868e
commit 60ca2b8fbc
81 changed files with 165 additions and 184 deletions

View File

@ -2,9 +2,28 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
config("impeller_public_config") {
include_dirs = [ ".." ]
}
group("impeller") {
deps = [
"compiler",
"compositor",
"entity",
"geometry",
"host",
"impeller",
"image",
"primitives",
"shader_glue",
]
}
group("unittests") {
testonly = true
deps = [
"compiler:compiler_unittests",
"compositor:compositor_unittests",
]
}

View File

@ -1,16 +0,0 @@
// 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

View File

@ -1,94 +0,0 @@
# 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.
import("//build/compiled_action.gni")
import("//flutter/impeller/tools/metal/metal_library.gni")
template("impeller_shaders") {
assert(defined(invoker.shaders), "Impeller shaders must be specified.")
assert(defined(invoker.name), "Name of the shader library must be specified.")
impellerc_target_name = "impellerc_$target_name"
compiled_action_foreach(impellerc_target_name) {
tool = "//flutter/impeller/compiler:impellerc"
sources = invoker.shaders
metal_intermediate = "$target_gen_dir/{{source_file_part}}.metal"
spirv_intermediate = "$target_gen_dir/{{source_file_part}}.spirv"
reflection_json_intermediate = "$target_gen_dir/{{source_file_part}}.json"
reflection_header_intermediate = "$target_gen_dir/{{source_file_part}}.h"
reflection_cc_intermediate = "$target_gen_dir/{{source_file_part}}.cc"
outputs = [
metal_intermediate,
reflection_header_intermediate,
reflection_cc_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)
reflection_json_path =
rebase_path(reflection_json_intermediate, root_build_dir)
reflection_header_path =
rebase_path(reflection_header_intermediate, root_build_dir)
reflection_cc_path = rebase_path(reflection_cc_intermediate, root_build_dir)
depfile = depfile_path
args = [
"--input=$source_path",
"--metal=$metal_intermediate_path",
"--spirv=$spirv_intermediate_path",
"--reflection-json=$reflection_json_path",
"--reflection-header=$reflection_header_path",
"--reflection-cc=$reflection_cc_path",
"--include={{source_dir}}",
"--depfile=$depfile_intermediate_path",
]
}
metal_library_target_name = "metal_library_$target_name"
metal_library(metal_library_target_name) {
name = invoker.name
sources = filter_include(get_target_outputs(":$impellerc_target_name"),
[ "*.metal" ])
deps = [ ":$impellerc_target_name" ]
}
shader_glue_target_name = "glue_$target_name"
shader_glue_config_name = "glue_config_$target_name"
config(shader_glue_config_name) {
# Contains the generated header headers.
include_dirs = [ target_gen_dir ]
}
source_set(shader_glue_target_name) {
public_configs = [ ":$shader_glue_config_name" ]
public =
filter_include(get_target_outputs(":$impellerc_target_name"), [ "*.h" ])
sources = filter_include(get_target_outputs(":$impellerc_target_name"),
[
"*.h",
"*.cc",
])
deps = [
":$impellerc_target_name",
"//flutter/impeller/impeller/shader_glue",
]
}
group(target_name) {
public_deps = [
":$metal_library_target_name",
":$shader_glue_target_name",
]
}
}

View File

@ -43,3 +43,7 @@ impeller_component("compositor") {
"../shader_glue",
]
}
executable("compositor_unittests") {
sources = [ "buffer_unittests.cc" ]
}

View File

@ -0,0 +1,5 @@
// 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 "gtest/gtest.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/impeller/impeller/compositor/pipeline.h"
#include "impeller/compositor/pipeline.h"
namespace impeller {

View File

@ -2,8 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//flutter/common/config.gni")
import("//flutter/impeller/tools/metal/metal_library.gni")
import("//flutter/impeller/tools/impeller.gni")
import("//flutter/testing/testing.gni")
metal_library("impeller_host_shaders") {
@ -47,7 +46,7 @@ executable("host") {
deps = [
":impeller_host_fixtures",
":impeller_host_shaders",
"../primitives",
"//flutter/fml",
"//flutter/impeller/impeller/primitives",
]
}

View File

@ -1,21 +0,0 @@
# 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.
import("//flutter/common/config.gni")
import("//flutter/impeller/compiler/tools/compiler.gni")
config("impeller_public_config") {
include_dirs = [ "//flutter/impeller" ]
}
group("impeller") {
deps = [
"compositor",
"entity",
"geometry",
"image",
"primitives",
"shader_glue",
]
}

View File

@ -2,8 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/compiled_action.gni")
import("//flutter/common/config.gni")
import("//flutter/impeller/compiler/tools/compiler.gni")
template("impeller_component") {
source_set(target_name) {
@ -30,7 +30,7 @@ template("impeller_component") {
cflags_objc += flutter_cflags_objc_arc + objc_warning_flags
cflags_objcc += flutter_cflags_objcc_arc + objc_warning_flags
public_configs += [ "//flutter/impeller/impeller:impeller_public_config" ]
public_configs += [ "//flutter/impeller:impeller_public_config" ]
deps += [
"//flutter/fml",
@ -40,3 +40,134 @@ template("impeller_component") {
]
}
}
template("metal_library") {
assert(defined(invoker.name), "Metal library name must be specified.")
assert(defined(invoker.sources), "Metal source files must be specified.")
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"
outputs = [ metal_library_path ]
script = "//flutter/impeller/tools/build_metal_library.py"
depfile = "$target_gen_dir/shader_deps/$metal_library_name.depfile"
args = [
"--output",
rebase_path(metal_library_path, root_out_dir),
"--depfile",
rebase_path(depfile),
]
foreach(source, invoker.sources) {
args += [
"--source",
rebase_path(source, root_out_dir),
]
}
}
}
template("impeller_shaders") {
assert(defined(invoker.shaders), "Impeller shaders must be specified.")
assert(defined(invoker.name), "Name of the shader library must be specified.")
impellerc_target_name = "impellerc_$target_name"
compiled_action_foreach(impellerc_target_name) {
tool = "//flutter/impeller/compiler:impellerc"
sources = invoker.shaders
metal_intermediate = "$target_gen_dir/{{source_file_part}}.metal"
spirv_intermediate = "$target_gen_dir/{{source_file_part}}.spirv"
reflection_json_intermediate = "$target_gen_dir/{{source_file_part}}.json"
reflection_header_intermediate = "$target_gen_dir/{{source_file_part}}.h"
reflection_cc_intermediate = "$target_gen_dir/{{source_file_part}}.cc"
outputs = [
metal_intermediate,
reflection_header_intermediate,
reflection_cc_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)
reflection_json_path =
rebase_path(reflection_json_intermediate, root_build_dir)
reflection_header_path =
rebase_path(reflection_header_intermediate, root_build_dir)
reflection_cc_path = rebase_path(reflection_cc_intermediate, root_build_dir)
depfile = depfile_path
args = [
"--input=$source_path",
"--metal=$metal_intermediate_path",
"--spirv=$spirv_intermediate_path",
"--reflection-json=$reflection_json_path",
"--reflection-header=$reflection_header_path",
"--reflection-cc=$reflection_cc_path",
"--include={{source_dir}}",
"--depfile=$depfile_intermediate_path",
]
}
metal_library_target_name = "metal_library_$target_name"
metal_library(metal_library_target_name) {
name = invoker.name
sources = filter_include(get_target_outputs(":$impellerc_target_name"),
[ "*.metal" ])
deps = [ ":$impellerc_target_name" ]
}
shader_glue_target_name = "glue_$target_name"
shader_glue_config_name = "glue_config_$target_name"
config(shader_glue_config_name) {
# Contains the generated header headers.
include_dirs = [ target_gen_dir ]
}
source_set(shader_glue_target_name) {
public_configs = [ ":$shader_glue_config_name" ]
public =
filter_include(get_target_outputs(":$impellerc_target_name"), [ "*.h" ])
sources = filter_include(get_target_outputs(":$impellerc_target_name"),
[
"*.h",
"*.cc",
])
deps = [
":$impellerc_target_name",
"//flutter/impeller/shader_glue",
]
}
group(target_name) {
public_deps = [
":$metal_library_target_name",
":$shader_glue_target_name",
]
}
}

View File

@ -1,46 +0,0 @@
# 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.
template("metal_library") {
assert(defined(invoker.name), "Metal library name must be specified.")
assert(defined(invoker.sources), "Metal source files must be specified.")
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"
outputs = [ metal_library_path ]
script = "//flutter/impeller/tools/metal/build_metal_library.py"
depfile = "$target_gen_dir/shader_deps/$metal_library_name.depfile"
args = [
"--output",
rebase_path(metal_library_path, root_out_dir),
"--depfile",
rebase_path(depfile),
]
foreach(source, invoker.sources) {
args += [
"--source",
rebase_path(source, root_out_dir),
]
}
}
}