Modularize build rules.
This commit is contained in:
@@ -203,7 +203,8 @@ Compiler::Compiler(const fml::Mapping& source_mapping,
|
||||
Reflector::Options reflector_options)
|
||||
: options_(source_options) {
|
||||
if (source_mapping.GetMapping() == nullptr) {
|
||||
COMPILER_ERROR << "Could not read shader source.";
|
||||
COMPILER_ERROR
|
||||
<< "Could not read shader source or shader source was empty.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ template("impeller_shaders") {
|
||||
])
|
||||
deps = [
|
||||
":$impellerc_target_name",
|
||||
"//flutter/impeller/impeller:impeller_shader_glue_lib",
|
||||
"//flutter/impeller/impeller/shader_glue",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,6 @@ executable("host") {
|
||||
":impeller_host_fixtures",
|
||||
":impeller_host_shaders",
|
||||
"//flutter/fml",
|
||||
"//flutter/impeller/impeller",
|
||||
"//flutter/impeller/impeller/primitives",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,111 +5,17 @@
|
||||
import("//flutter/common/config.gni")
|
||||
import("//flutter/impeller/compiler/tools/compiler.gni")
|
||||
|
||||
config("impeller_config") {
|
||||
include_dirs = [ ".." ]
|
||||
config("impeller_public_config") {
|
||||
include_dirs = [ "//flutter/impeller" ]
|
||||
}
|
||||
|
||||
impeller_shaders("shaders") {
|
||||
name = "impeller"
|
||||
shaders = [
|
||||
"compositor/shaders/box/box.frag",
|
||||
"compositor/shaders/box/box.vert",
|
||||
]
|
||||
}
|
||||
|
||||
config("impeller_shader_glue_lib_config") {
|
||||
include_dirs = [ "compositor" ]
|
||||
}
|
||||
|
||||
source_set("impeller_shader_glue_lib") {
|
||||
public_configs = [ ":impeller_shader_glue_lib_config" ]
|
||||
|
||||
public = [ "compositor/shader_types.h" ]
|
||||
|
||||
sources = [ "compositor/shader_types.cc" ]
|
||||
}
|
||||
|
||||
source_set("impeller") {
|
||||
public_configs = [ ":impeller_config" ]
|
||||
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
if (is_clang) {
|
||||
cflags_cc = [ "-Wno-unused-private-field" ]
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
group("impeller") {
|
||||
deps = [
|
||||
"compositor",
|
||||
"entity",
|
||||
"geometry",
|
||||
"image",
|
||||
"compositor",
|
||||
]
|
||||
|
||||
compositor_sources = [
|
||||
"compositor/context.h",
|
||||
"compositor/context.mm",
|
||||
"compositor/pipeline_builder.h",
|
||||
"compositor/pipeline_builder.mm",
|
||||
"compositor/pipeline_descriptor.h",
|
||||
"compositor/pipeline_descriptor.mm",
|
||||
"compositor/pipeline_library.h",
|
||||
"compositor/pipeline_library.mm",
|
||||
"compositor/renderer.h",
|
||||
"compositor/renderer.mm",
|
||||
"compositor/shader_library.h",
|
||||
"compositor/shader_library.mm",
|
||||
"compositor/surface.h",
|
||||
"compositor/surface.mm",
|
||||
"compositor/vertex_descriptor.h",
|
||||
"compositor/vertex_descriptor.mm",
|
||||
]
|
||||
|
||||
geometry_sources = [
|
||||
"geometry/matrix.cc",
|
||||
"geometry/matrix.h",
|
||||
"geometry/path.cc",
|
||||
"geometry/path.h",
|
||||
"geometry/path_builder.cc",
|
||||
"geometry/path_builder.h",
|
||||
"geometry/path_component.cc",
|
||||
"geometry/path_component.h",
|
||||
"geometry/point.cc",
|
||||
"geometry/point.h",
|
||||
"geometry/quaternion.cc",
|
||||
"geometry/quaternion.h",
|
||||
"geometry/rect.cc",
|
||||
"geometry/rect.h",
|
||||
"geometry/shear.cc",
|
||||
"geometry/shear.h",
|
||||
"geometry/size.cc",
|
||||
"geometry/size.h",
|
||||
"geometry/vector.cc",
|
||||
"geometry/vector.h",
|
||||
]
|
||||
|
||||
entity_sources = [
|
||||
"entity/color.cc",
|
||||
"entity/color.h",
|
||||
"entity/entity.cc",
|
||||
"entity/entity.h",
|
||||
]
|
||||
|
||||
image_sources = [
|
||||
"image/image.cc",
|
||||
"image/image.h",
|
||||
"image/image_result.cc",
|
||||
"image/image_result.h",
|
||||
]
|
||||
|
||||
sources =
|
||||
compositor_sources + geometry_sources + entity_sources + image_sources
|
||||
|
||||
deps = [
|
||||
":impeller_shader_glue_lib",
|
||||
":shaders",
|
||||
"//flutter/fml",
|
||||
"//flutter/impeller/third_party/stb",
|
||||
"//flutter/runtime:libdart", # For tracing, seems to be pulled in by FML.
|
||||
"primitives",
|
||||
"shader_glue",
|
||||
]
|
||||
}
|
||||
|
||||
31
engine/src/flutter/impeller/impeller/compositor/BUILD.gn
Normal file
31
engine/src/flutter/impeller/impeller/compositor/BUILD.gn
Normal file
@@ -0,0 +1,31 @@
|
||||
# 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/impeller/tools/impeller.gni")
|
||||
|
||||
impeller_component("compositor") {
|
||||
sources = [
|
||||
"context.h",
|
||||
"context.mm",
|
||||
"pipeline_builder.h",
|
||||
"pipeline_builder.mm",
|
||||
"pipeline_descriptor.h",
|
||||
"pipeline_descriptor.mm",
|
||||
"pipeline_library.h",
|
||||
"pipeline_library.mm",
|
||||
"renderer.h",
|
||||
"renderer.mm",
|
||||
"shader_library.h",
|
||||
"shader_library.mm",
|
||||
"surface.h",
|
||||
"surface.mm",
|
||||
"vertex_descriptor.h",
|
||||
"vertex_descriptor.mm",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
"../geometry",
|
||||
"../shader_glue",
|
||||
]
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/impeller/impeller/compositor/shader_types.h"
|
||||
#include "impeller/shader_glue/shader_types.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#include "types.h"
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
outColor = vec4(1.0);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#include "types.h"
|
||||
|
||||
uniform UniformBufferObject {
|
||||
Uniforms uniforms;
|
||||
} ubo;
|
||||
|
||||
uniform sampler2D world;
|
||||
|
||||
in vec2 position;
|
||||
in vec3 position2;
|
||||
in vec4 anotherPosition;
|
||||
in float stuff;
|
||||
|
||||
out vec4 otherStuff;
|
||||
|
||||
void main() {
|
||||
gl_Position = ubo.uniforms.projection * ubo.uniforms.view * ubo.uniforms.model * vec4(position2, 1.0) * anotherPosition;
|
||||
otherStuff = texture(world, position);
|
||||
}
|
||||
|
||||
16
engine/src/flutter/impeller/impeller/entity/BUILD.gn
Normal file
16
engine/src/flutter/impeller/impeller/entity/BUILD.gn
Normal file
@@ -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.
|
||||
|
||||
import("//flutter/impeller/tools/impeller.gni")
|
||||
|
||||
impeller_component("entity") {
|
||||
sources = [
|
||||
"color.cc",
|
||||
"color.h",
|
||||
"entity.cc",
|
||||
"entity.h",
|
||||
]
|
||||
|
||||
public_deps = [ "../image" ]
|
||||
}
|
||||
@@ -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 "entity.h"
|
||||
#include "impeller/entity/entity.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "color.h"
|
||||
#include "image.h"
|
||||
#include "matrix.h"
|
||||
#include "path.h"
|
||||
#include "rect.h"
|
||||
#include "impeller/entity/color.h"
|
||||
#include "impeller/geometry/matrix.h"
|
||||
#include "impeller/geometry/path.h"
|
||||
#include "impeller/geometry/rect.h"
|
||||
#include "impeller/image/image.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
|
||||
30
engine/src/flutter/impeller/impeller/geometry/BUILD.gn
Normal file
30
engine/src/flutter/impeller/impeller/geometry/BUILD.gn
Normal file
@@ -0,0 +1,30 @@
|
||||
# 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/impeller/tools/impeller.gni")
|
||||
|
||||
impeller_component("geometry") {
|
||||
sources = [
|
||||
"matrix.cc",
|
||||
"matrix.h",
|
||||
"path.cc",
|
||||
"path.h",
|
||||
"path_builder.cc",
|
||||
"path_builder.h",
|
||||
"path_component.cc",
|
||||
"path_component.h",
|
||||
"point.cc",
|
||||
"point.h",
|
||||
"quaternion.cc",
|
||||
"quaternion.h",
|
||||
"rect.cc",
|
||||
"rect.h",
|
||||
"shear.cc",
|
||||
"shear.h",
|
||||
"size.cc",
|
||||
"size.h",
|
||||
"vector.cc",
|
||||
"vector.h",
|
||||
]
|
||||
}
|
||||
16
engine/src/flutter/impeller/impeller/image/BUILD.gn
Normal file
16
engine/src/flutter/impeller/impeller/image/BUILD.gn
Normal file
@@ -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.
|
||||
|
||||
import("//flutter/impeller/tools/impeller.gni")
|
||||
|
||||
impeller_component("image") {
|
||||
sources = [
|
||||
"image.cc",
|
||||
"image.h",
|
||||
"image_result.cc",
|
||||
"image_result.h",
|
||||
]
|
||||
|
||||
public_deps = [ "../geometry" ]
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/fml/mapping.h"
|
||||
#include "image_result.h"
|
||||
#include "size.h"
|
||||
#include "impeller/geometry/size.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "flutter/fml/mapping.h"
|
||||
#include "size.h"
|
||||
#include "impeller/geometry/size.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
|
||||
24
engine/src/flutter/impeller/impeller/primitives/BUILD.gn
Normal file
24
engine/src/flutter/impeller/impeller/primitives/BUILD.gn
Normal file
@@ -0,0 +1,24 @@
|
||||
# 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/impeller/tools/impeller.gni")
|
||||
|
||||
impeller_shaders("shaders") {
|
||||
name = "impeller"
|
||||
shaders = [
|
||||
"box.vert",
|
||||
"box.frag",
|
||||
]
|
||||
}
|
||||
|
||||
impeller_component("primitives") {
|
||||
sources = [
|
||||
"box.cc",
|
||||
"box.h",
|
||||
]
|
||||
|
||||
public_deps = [ "../compositor" ]
|
||||
|
||||
deps = [ ":shaders" ]
|
||||
}
|
||||
@@ -2,8 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
struct Uniforms {
|
||||
mat4 model;
|
||||
mat4 view;
|
||||
mat4 projection;
|
||||
};
|
||||
in vec3 color;
|
||||
|
||||
out vec3 fragColor;
|
||||
|
||||
void main() {
|
||||
fragColor = color;
|
||||
}
|
||||
18
engine/src/flutter/impeller/impeller/primitives/box.vert
Normal file
18
engine/src/flutter/impeller/impeller/primitives/box.vert
Normal file
@@ -0,0 +1,18 @@
|
||||
// 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.
|
||||
|
||||
uniform UniformBuffer{
|
||||
mat4 mvp;
|
||||
} uniforms;
|
||||
|
||||
in vec3 vertexPosition;
|
||||
in vec3 vertexColor;
|
||||
|
||||
out vec3 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = uniforms.mvp * vec4(vertexPosition, 1.0);
|
||||
color = vertexColor;
|
||||
}
|
||||
20
engine/src/flutter/impeller/impeller/shader_glue/BUILD.gn
Normal file
20
engine/src/flutter/impeller/impeller/shader_glue/BUILD.gn
Normal file
@@ -0,0 +1,20 @@
|
||||
# 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/impeller/tools/impeller.gni")
|
||||
|
||||
config("shader_glue_public_config") {
|
||||
include_dirs = [ "." ]
|
||||
}
|
||||
|
||||
impeller_component("shader_glue") {
|
||||
public_configs = [ ":shader_glue_public_config" ]
|
||||
|
||||
public = [ "shader_types.h" ]
|
||||
|
||||
sources = [
|
||||
"shader_types.cc",
|
||||
"shader_types.h",
|
||||
]
|
||||
}
|
||||
@@ -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/shader_types.h"
|
||||
#include "impeller/shader_glue/shader_types.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
42
engine/src/flutter/impeller/tools/impeller.gni
Normal file
42
engine/src/flutter/impeller/tools/impeller.gni
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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")
|
||||
|
||||
template("impeller_component") {
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
if (!defined(invoker.public_configs)) {
|
||||
public_configs = []
|
||||
}
|
||||
|
||||
if (!defined(invoker.cflags_objc)) {
|
||||
cflags_objc = []
|
||||
}
|
||||
|
||||
if (!defined(invoker.cflags_objcc)) {
|
||||
cflags_objcc = []
|
||||
}
|
||||
|
||||
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:impeller_public_config" ]
|
||||
|
||||
deps += [
|
||||
"//flutter/fml",
|
||||
|
||||
# For tracing, seems to be pulled in by FML. Must be removed.
|
||||
"//flutter/runtime:libdart",
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user