From 9eae89cb6739664317e463df507fe8bec9a6e00e Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 30 Mar 2023 14:02:40 -0700 Subject: [PATCH 1/6] [Impeller] move everything needed by the code gen template to core --- ci/licenses_golden/licenses_flutter | 28 +++++----- impeller/aiks/canvas.h | 2 +- impeller/compiler/code_gen_template.h | 8 ++- impeller/compiler/reflector.cc | 21 ++------ impeller/core/BUILD.gn | 8 +++ impeller/core/resource_binder.cc | 11 ++++ impeller/core/resource_binder.h | 52 +++++++++++++++++++ impeller/{renderer => core}/sampler.cc | 2 +- impeller/core/sampler.h | 29 +++++++++++ .../{renderer => core}/sampler_descriptor.cc | 3 +- .../{renderer => core}/sampler_descriptor.h | 0 impeller/{renderer => core}/shader_types.cc | 2 +- impeller/{renderer => core}/shader_types.h | 0 impeller/core/vertex_buffer_builder.cc | 11 ++++ impeller/display_list/nine_patch_converter.h | 2 +- impeller/entity/contents/atlas_contents.h | 2 +- .../entity/contents/color_source_contents.cc | 3 +- impeller/entity/contents/contents.h | 2 +- .../filters/gaussian_blur_filter_contents.cc | 2 +- impeller/entity/contents/gradient_generator.h | 2 +- .../contents/runtime_effect_contents.cc | 2 +- .../entity/contents/runtime_effect_contents.h | 2 +- impeller/entity/contents/text_contents.cc | 2 +- impeller/entity/contents/texture_contents.h | 2 +- .../entity/contents/tiled_texture_contents.h | 2 +- impeller/entity/contents/vertices_contents.h | 2 +- impeller/entity/geometry.h | 3 ++ .../playground/imgui/imgui_impl_impeller.cc | 2 +- impeller/renderer/BUILD.gn | 6 --- .../renderer/backend/gles/capabilities_gles.h | 2 +- impeller/renderer/backend/gles/formats_gles.h | 2 +- impeller/renderer/backend/gles/sampler_gles.h | 2 +- .../backend/gles/sampler_library_gles.h | 2 +- .../renderer/backend/metal/blit_pass_mtl.mm | 2 +- .../backend/metal/compute_pass_mtl.mm | 2 +- impeller/renderer/backend/metal/context_mtl.h | 2 +- .../renderer/backend/metal/context_mtl.mm | 2 +- .../renderer/backend/metal/render_pass_mtl.mm | 2 +- .../backend/metal/sampler_library_mtl.h | 2 +- impeller/renderer/backend/metal/sampler_mtl.h | 2 +- impeller/renderer/backend/vulkan/formats_vk.h | 2 +- .../renderer/backend/vulkan/render_pass_vk.cc | 4 +- .../backend/vulkan/sampler_library_vk.h | 2 +- impeller/renderer/backend/vulkan/sampler_vk.h | 2 +- .../backend/vulkan/vertex_descriptor_vk.h | 2 +- impeller/renderer/command.h | 19 ++++--- impeller/renderer/compute_command.h | 19 ++++--- .../renderer/compute_pipeline_descriptor.h | 2 +- impeller/renderer/pipeline_descriptor.h | 2 +- impeller/renderer/renderer_unittests.cc | 4 +- impeller/renderer/sampler.h | 2 +- impeller/renderer/sampler_library.h | 2 +- impeller/renderer/shader_function.h | 2 +- impeller/renderer/shader_key.h | 2 +- impeller/renderer/shader_library.h | 2 +- impeller/renderer/snapshot.h | 2 +- impeller/renderer/vertex_descriptor.h | 2 +- .../runtime_stage/runtime_stage_playground.cc | 2 +- .../runtime_stage/runtime_stage_unittests.cc | 2 +- impeller/scene/geometry.cc | 2 +- impeller/scene/material.cc | 2 +- 61 files changed, 211 insertions(+), 104 deletions(-) create mode 100644 impeller/core/resource_binder.cc create mode 100644 impeller/core/resource_binder.h rename impeller/{renderer => core}/sampler.cc (90%) create mode 100644 impeller/core/sampler.h rename impeller/{renderer => core}/sampler_descriptor.cc (92%) rename impeller/{renderer => core}/sampler_descriptor.h (100%) rename impeller/{renderer => core}/shader_types.cc (83%) rename impeller/{renderer => core}/shader_types.h (100%) create mode 100644 impeller/core/vertex_buffer_builder.cc diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index d15d5c90e344b..54b7ca348735e 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -1124,6 +1124,14 @@ ORIGIN: ../../../flutter/impeller/core/platform.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/platform.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/range.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/range.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/core/resource_binder.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/core/resource_binder.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/core/sampler.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/core/sampler.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/core/sampler_descriptor.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/core/sampler_descriptor.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/core/shader_types.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/core/shader_types.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/texture.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/texture.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/texture_descriptor.cc + ../../../flutter/LICENSE @@ -1544,10 +1552,6 @@ ORIGIN: ../../../flutter/impeller/renderer/render_target.cc + ../../../flutter/L ORIGIN: ../../../flutter/impeller/renderer/render_target.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/renderer/renderer.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/renderer/renderer.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/renderer/sampler.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/renderer/sampler.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/renderer/sampler_descriptor.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/renderer/sampler_descriptor.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/renderer/sampler_library.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/renderer/sampler_library.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/renderer/shader_function.cc + ../../../flutter/LICENSE @@ -1556,8 +1560,6 @@ ORIGIN: ../../../flutter/impeller/renderer/shader_key.cc + ../../../flutter/LICE ORIGIN: ../../../flutter/impeller/renderer/shader_key.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/renderer/shader_library.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/renderer/shader_library.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/renderer/shader_types.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/renderer/shader_types.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/renderer/snapshot.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/renderer/snapshot.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/renderer/stroke.comp + ../../../flutter/LICENSE @@ -3693,6 +3695,14 @@ FILE: ../../../flutter/impeller/core/platform.cc FILE: ../../../flutter/impeller/core/platform.h FILE: ../../../flutter/impeller/core/range.cc FILE: ../../../flutter/impeller/core/range.h +FILE: ../../../flutter/impeller/core/resource_binder.cc +FILE: ../../../flutter/impeller/core/resource_binder.h +FILE: ../../../flutter/impeller/core/sampler.cc +FILE: ../../../flutter/impeller/core/sampler.h +FILE: ../../../flutter/impeller/core/sampler_descriptor.cc +FILE: ../../../flutter/impeller/core/sampler_descriptor.h +FILE: ../../../flutter/impeller/core/shader_types.cc +FILE: ../../../flutter/impeller/core/shader_types.h FILE: ../../../flutter/impeller/core/texture.cc FILE: ../../../flutter/impeller/core/texture.h FILE: ../../../flutter/impeller/core/texture_descriptor.cc @@ -4113,10 +4123,6 @@ FILE: ../../../flutter/impeller/renderer/render_target.cc FILE: ../../../flutter/impeller/renderer/render_target.h FILE: ../../../flutter/impeller/renderer/renderer.cc FILE: ../../../flutter/impeller/renderer/renderer.h -FILE: ../../../flutter/impeller/renderer/sampler.cc -FILE: ../../../flutter/impeller/renderer/sampler.h -FILE: ../../../flutter/impeller/renderer/sampler_descriptor.cc -FILE: ../../../flutter/impeller/renderer/sampler_descriptor.h FILE: ../../../flutter/impeller/renderer/sampler_library.cc FILE: ../../../flutter/impeller/renderer/sampler_library.h FILE: ../../../flutter/impeller/renderer/shader_function.cc @@ -4125,8 +4131,6 @@ FILE: ../../../flutter/impeller/renderer/shader_key.cc FILE: ../../../flutter/impeller/renderer/shader_key.h FILE: ../../../flutter/impeller/renderer/shader_library.cc FILE: ../../../flutter/impeller/renderer/shader_library.h -FILE: ../../../flutter/impeller/renderer/shader_types.cc -FILE: ../../../flutter/impeller/renderer/shader_types.h FILE: ../../../flutter/impeller/renderer/snapshot.cc FILE: ../../../flutter/impeller/renderer/snapshot.h FILE: ../../../flutter/impeller/renderer/stroke.comp diff --git a/impeller/aiks/canvas.h b/impeller/aiks/canvas.h index 80b9c74dc9564..226ef14c8c576 100644 --- a/impeller/aiks/canvas.h +++ b/impeller/aiks/canvas.h @@ -13,13 +13,13 @@ #include "impeller/aiks/image.h" #include "impeller/aiks/paint.h" #include "impeller/aiks/picture.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/entity/entity_pass.h" #include "impeller/entity/geometry.h" #include "impeller/geometry/matrix.h" #include "impeller/geometry/path.h" #include "impeller/geometry/point.h" #include "impeller/geometry/vector.h" -#include "impeller/renderer/sampler_descriptor.h" #include "impeller/typographer/glyph_atlas.h" #include "impeller/typographer/text_frame.h" diff --git a/impeller/compiler/code_gen_template.h b/impeller/compiler/code_gen_template.h index b7015b0457c7d..4bea4aa37c64d 100644 --- a/impeller/compiler/code_gen_template.h +++ b/impeller/compiler/code_gen_template.h @@ -18,13 +18,11 @@ constexpr std::string_view kReflectionHeaderTemplate = {# file itself and the no-check declarations will be stripped in generated files.#} #include "impeller/core/buffer_view.h" {# // nogncheck #} -#include "impeller/renderer/command.h" {# // nogncheck #} +#include "impeller/core/sampler.h" {# // nogncheck #} -#include "impeller/renderer/compute_command.h" {# // nogncheck #} +#include "impeller/core/shader_types.h" {# // nogncheck #} -#include "impeller/renderer/sampler.h" {# // nogncheck #} - -#include "impeller/renderer/shader_types.h" {# // nogncheck #} +#include "impeller/core/resource_binder.h" {# // nogncheck #} #include "impeller/core/texture.h" {# // nogncheck #} diff --git a/impeller/compiler/reflector.cc b/impeller/compiler/reflector.cc index 93863aa03c234..45391a272f451 100644 --- a/impeller/compiler/reflector.cc +++ b/impeller/compiler/reflector.cc @@ -86,21 +86,6 @@ static std::string ExecutionModelToString(spv::ExecutionModel model) { } } -static std::string ExecutionModelToCommandTypeName( - spv::ExecutionModel execution_model) { - switch (execution_model) { - case spv::ExecutionModel::ExecutionModelVertex: - case spv::ExecutionModel::ExecutionModelFragment: - case spv::ExecutionModel::ExecutionModelTessellationControl: - case spv::ExecutionModel::ExecutionModelTessellationEvaluation: - return "Command&"; - case spv::ExecutionModel::ExecutionModelGLCompute: - return "ComputeCommand&"; - default: - return "unsupported"; - } -} - static std::string StringToShaderStage(std::string str) { if (str == "vertex") { return "ShaderStage::kVertex"; @@ -1126,7 +1111,7 @@ std::vector Reflector::ReflectBindPrototypes( proto.docstring = stream.str(); } proto.args.push_back(BindPrototypeArgument{ - .type_name = ExecutionModelToCommandTypeName(execution_model), + .type_name = "ResourceBinder&", .argument_name = "command", }); proto.args.push_back(BindPrototypeArgument{ @@ -1145,7 +1130,7 @@ std::vector Reflector::ReflectBindPrototypes( proto.docstring = stream.str(); } proto.args.push_back(BindPrototypeArgument{ - .type_name = ExecutionModelToCommandTypeName(execution_model), + .type_name = "ResourceBinder&", .argument_name = "command", }); proto.args.push_back(BindPrototypeArgument{ @@ -1164,7 +1149,7 @@ std::vector Reflector::ReflectBindPrototypes( proto.docstring = stream.str(); } proto.args.push_back(BindPrototypeArgument{ - .type_name = ExecutionModelToCommandTypeName(execution_model), + .type_name = "ResourceBinder&", .argument_name = "command", }); proto.args.push_back(BindPrototypeArgument{ diff --git a/impeller/core/BUILD.gn b/impeller/core/BUILD.gn index 6b34c1326e5e4..f52d9ac047243 100644 --- a/impeller/core/BUILD.gn +++ b/impeller/core/BUILD.gn @@ -24,6 +24,14 @@ impeller_component("core") { "platform.h", "range.cc", "range.h", + "resource_binder.cc", + "resource_binder.h", + "sampler.cc", + "sampler.h", + "sampler_descriptor.cc", + "sampler_descriptor.h", + "shader_types.cc", + "shader_types.h", "texture.cc", "texture.h", "texture_descriptor.cc", diff --git a/impeller/core/resource_binder.cc b/impeller/core/resource_binder.cc new file mode 100644 index 0000000000000..6972ec45591b7 --- /dev/null +++ b/impeller/core/resource_binder.cc @@ -0,0 +1,11 @@ +// 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 "impeller/core/resource_binder.h" + +namespace impeller { + +// + +} // namespace impeller diff --git a/impeller/core/resource_binder.h b/impeller/core/resource_binder.h new file mode 100644 index 0000000000000..d7e4f532a8e22 --- /dev/null +++ b/impeller/core/resource_binder.h @@ -0,0 +1,52 @@ +// 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. + +#pragma once + +#include +#include +#include +#include + +#include "flutter/fml/logging.h" +#include "flutter/fml/macros.h" +#include "impeller/core/buffer_view.h" +#include "impeller/core/formats.h" +#include "impeller/core/sampler.h" +#include "impeller/core/shader_types.h" +#include "impeller/core/texture.h" + +namespace impeller { + +//------------------------------------------------------------------------------ +/// @brief An interface for binding resources. This is implemented by +/// |Command| and |ComputeCommand| to make CPU resources available +/// to the GPU. +/// +struct ResourceBinder { + virtual ~ResourceBinder() = default; + + virtual bool BindResource(ShaderStage stage, + const ShaderUniformSlot& slot, + const ShaderMetadata& metadata, + const BufferView& view) = 0; + + virtual bool BindResource(ShaderStage stage, + const SampledImageSlot& slot, + const ShaderMetadata& metadata, + const std::shared_ptr& texture) = 0; + + virtual bool BindResource(ShaderStage stage, + const SampledImageSlot& slot, + const ShaderMetadata& metadata, + const std::shared_ptr& sampler) = 0; + + virtual bool BindResource(ShaderStage stage, + const SampledImageSlot& slot, + const ShaderMetadata& metadata, + const std::shared_ptr& texture, + const std::shared_ptr& sampler) = 0; +}; + +} // namespace impeller diff --git a/impeller/renderer/sampler.cc b/impeller/core/sampler.cc similarity index 90% rename from impeller/renderer/sampler.cc rename to impeller/core/sampler.cc index 47d44e8996c3d..12b87d3e91b1a 100644 --- a/impeller/renderer/sampler.cc +++ b/impeller/core/sampler.cc @@ -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 "impeller/renderer/sampler.h" +#include "impeller/core/sampler.h" namespace impeller { diff --git a/impeller/core/sampler.h b/impeller/core/sampler.h new file mode 100644 index 0000000000000..3dd19cf71fed8 --- /dev/null +++ b/impeller/core/sampler.h @@ -0,0 +1,29 @@ +// 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. + +#pragma once + +#include "flutter/fml/macros.h" +#include "impeller/core/sampler_descriptor.h" + +namespace impeller { + +class Sampler { + public: + virtual ~Sampler(); + + virtual bool IsValid() const = 0; + + const SamplerDescriptor& GetDescriptor() const; + + protected: + SamplerDescriptor desc_; + + explicit Sampler(SamplerDescriptor desc); + + private: + FML_DISALLOW_COPY_AND_ASSIGN(Sampler); +}; + +} // namespace impeller diff --git a/impeller/renderer/sampler_descriptor.cc b/impeller/core/sampler_descriptor.cc similarity index 92% rename from impeller/renderer/sampler_descriptor.cc rename to impeller/core/sampler_descriptor.cc index b2e10cab10d49..9e99089813dd3 100644 --- a/impeller/renderer/sampler_descriptor.cc +++ b/impeller/core/sampler_descriptor.cc @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "impeller/renderer/sampler_descriptor.h" +#include "impeller/core/sampler_descriptor.h" + #include "fml/logging.h" namespace impeller { diff --git a/impeller/renderer/sampler_descriptor.h b/impeller/core/sampler_descriptor.h similarity index 100% rename from impeller/renderer/sampler_descriptor.h rename to impeller/core/sampler_descriptor.h diff --git a/impeller/renderer/shader_types.cc b/impeller/core/shader_types.cc similarity index 83% rename from impeller/renderer/shader_types.cc rename to impeller/core/shader_types.cc index f49b27cc45e68..8018c18eef0e6 100644 --- a/impeller/renderer/shader_types.cc +++ b/impeller/core/shader_types.cc @@ -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 "impeller/renderer/shader_types.h" +#include "impeller/core/shader_types.h" namespace impeller { diff --git a/impeller/renderer/shader_types.h b/impeller/core/shader_types.h similarity index 100% rename from impeller/renderer/shader_types.h rename to impeller/core/shader_types.h diff --git a/impeller/core/vertex_buffer_builder.cc b/impeller/core/vertex_buffer_builder.cc new file mode 100644 index 0000000000000..b29e4032132a0 --- /dev/null +++ b/impeller/core/vertex_buffer_builder.cc @@ -0,0 +1,11 @@ +// 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 "impeller/renderer/vertex_buffer_builder.h" + +namespace impeller { + +// + +} // namespace impeller diff --git a/impeller/display_list/nine_patch_converter.h b/impeller/display_list/nine_patch_converter.h index 6795f4dc7feb8..422a8943a0bd6 100644 --- a/impeller/display_list/nine_patch_converter.h +++ b/impeller/display_list/nine_patch_converter.h @@ -10,8 +10,8 @@ #include "impeller/aiks/canvas.h" #include "impeller/aiks/image.h" #include "impeller/aiks/paint.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/geometry/path.h" -#include "impeller/renderer/sampler_descriptor.h" namespace impeller { diff --git a/impeller/entity/contents/atlas_contents.h b/impeller/entity/contents/atlas_contents.h index 67fa20ef66fdf..44a31e12be215 100644 --- a/impeller/entity/contents/atlas_contents.h +++ b/impeller/entity/contents/atlas_contents.h @@ -9,9 +9,9 @@ #include #include "flutter/fml/macros.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/entity/contents/contents.h" #include "impeller/entity/entity.h" -#include "impeller/renderer/sampler_descriptor.h" namespace impeller { diff --git a/impeller/entity/contents/color_source_contents.cc b/impeller/entity/contents/color_source_contents.cc index 4eef31d6e9f9f..12918b3ac6d3c 100644 --- a/impeller/entity/contents/color_source_contents.cc +++ b/impeller/entity/contents/color_source_contents.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "color_source_contents.h" +#include "impeller/entity/contents/color_source_contents.h" #include "impeller/entity/entity.h" #include "impeller/geometry/matrix.h" +#include "impeller/geometry/point.h" namespace impeller { diff --git a/impeller/entity/contents/contents.h b/impeller/entity/contents/contents.h index 1d444e57f7bb4..3d22803a6de26 100644 --- a/impeller/entity/contents/contents.h +++ b/impeller/entity/contents/contents.h @@ -9,10 +9,10 @@ #include #include "flutter/fml/macros.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/core/texture.h" #include "impeller/geometry/color.h" #include "impeller/geometry/rect.h" -#include "impeller/renderer/sampler_descriptor.h" #include "impeller/renderer/snapshot.h" namespace impeller { diff --git a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc index 73f9591c7696a..ae96d963a7224 100644 --- a/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc +++ b/impeller/entity/contents/filters/gaussian_blur_filter_contents.cc @@ -11,6 +11,7 @@ #include "impeller/base/strings.h" #include "impeller/base/validation.h" #include "impeller/core/formats.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/entity/contents/content_context.h" #include "impeller/entity/contents/filters/filter_contents.h" #include "impeller/geometry/rect.h" @@ -18,7 +19,6 @@ #include "impeller/renderer/command_buffer.h" #include "impeller/renderer/render_pass.h" #include "impeller/renderer/render_target.h" -#include "impeller/renderer/sampler_descriptor.h" #include "impeller/renderer/sampler_library.h" namespace impeller { diff --git a/impeller/entity/contents/gradient_generator.h b/impeller/entity/contents/gradient_generator.h index 11cff7883da8e..24321d861218f 100644 --- a/impeller/entity/contents/gradient_generator.h +++ b/impeller/entity/contents/gradient_generator.h @@ -10,11 +10,11 @@ #include "flutter/fml/macros.h" #include "flutter/impeller/core/texture.h" +#include "impeller/core/shader_types.h" #include "impeller/geometry/color.h" #include "impeller/geometry/gradient.h" #include "impeller/geometry/path.h" #include "impeller/geometry/point.h" -#include "impeller/renderer/shader_types.h" namespace impeller { diff --git a/impeller/entity/contents/runtime_effect_contents.cc b/impeller/entity/contents/runtime_effect_contents.cc index 4b9f64d914e29..df9fa0547ce61 100644 --- a/impeller/entity/contents/runtime_effect_contents.cc +++ b/impeller/entity/contents/runtime_effect_contents.cc @@ -11,6 +11,7 @@ #include "flutter/fml/make_copyable.h" #include "impeller/base/validation.h" #include "impeller/core/formats.h" +#include "impeller/core/shader_types.h" #include "impeller/entity/contents/clip_contents.h" #include "impeller/entity/contents/content_context.h" #include "impeller/entity/runtime_effect.vert.h" @@ -18,7 +19,6 @@ #include "impeller/renderer/render_pass.h" #include "impeller/renderer/sampler_library.h" #include "impeller/renderer/shader_function.h" -#include "impeller/renderer/shader_types.h" namespace impeller { diff --git a/impeller/entity/contents/runtime_effect_contents.h b/impeller/entity/contents/runtime_effect_contents.h index a1baab42d6e34..0a85d5ae4bca9 100644 --- a/impeller/entity/contents/runtime_effect_contents.h +++ b/impeller/entity/contents/runtime_effect_contents.h @@ -6,8 +6,8 @@ #include #include +#include "impeller/core/sampler_descriptor.h" #include "impeller/entity/contents/color_source_contents.h" -#include "impeller/renderer/sampler_descriptor.h" #include "impeller/runtime_stage/runtime_stage.h" namespace impeller { diff --git a/impeller/entity/contents/text_contents.cc b/impeller/entity/contents/text_contents.cc index e77ee50d76808..617d1a64ee6a2 100644 --- a/impeller/entity/contents/text_contents.cc +++ b/impeller/entity/contents/text_contents.cc @@ -9,11 +9,11 @@ #include #include "impeller/core/formats.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/entity/contents/content_context.h" #include "impeller/entity/entity.h" #include "impeller/geometry/path_builder.h" #include "impeller/renderer/render_pass.h" -#include "impeller/renderer/sampler_descriptor.h" #include "impeller/renderer/sampler_library.h" #include "impeller/tessellator/tessellator.h" #include "impeller/typographer/glyph_atlas.h" diff --git a/impeller/entity/contents/texture_contents.h b/impeller/entity/contents/texture_contents.h index 2dd485f5f1e5c..56600978e5ac2 100644 --- a/impeller/entity/contents/texture_contents.h +++ b/impeller/entity/contents/texture_contents.h @@ -9,9 +9,9 @@ #include #include "flutter/fml/macros.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/entity/contents/contents.h" #include "impeller/geometry/path.h" -#include "impeller/renderer/sampler_descriptor.h" namespace impeller { diff --git a/impeller/entity/contents/tiled_texture_contents.h b/impeller/entity/contents/tiled_texture_contents.h index 953d5f6c10cdc..925c91bd8132d 100644 --- a/impeller/entity/contents/tiled_texture_contents.h +++ b/impeller/entity/contents/tiled_texture_contents.h @@ -9,11 +9,11 @@ #include #include "flutter/fml/macros.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/entity/contents/color_source_contents.h" #include "impeller/entity/contents/filters/color_filter_contents.h" #include "impeller/entity/entity.h" #include "impeller/geometry/path.h" -#include "impeller/renderer/sampler_descriptor.h" namespace impeller { diff --git a/impeller/entity/contents/vertices_contents.h b/impeller/entity/contents/vertices_contents.h index 88facd3b4b8bd..1ba524899cff4 100644 --- a/impeller/entity/contents/vertices_contents.h +++ b/impeller/entity/contents/vertices_contents.h @@ -9,13 +9,13 @@ #include #include "flutter/fml/macros.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/entity/contents/contents.h" #include "impeller/entity/entity.h" #include "impeller/entity/geometry.h" #include "impeller/geometry/color.h" #include "impeller/geometry/path.h" #include "impeller/geometry/point.h" -#include "impeller/renderer/sampler_descriptor.h" namespace impeller { diff --git a/impeller/entity/geometry.h b/impeller/entity/geometry.h index 5061dc19f7cb3..bcf9190766a32 100644 --- a/impeller/entity/geometry.h +++ b/impeller/entity/geometry.h @@ -12,6 +12,9 @@ #include "impeller/entity/solid_fill.vert.h" #include "impeller/geometry/color.h" #include "impeller/geometry/path.h" +#include "impeller/geometry/point.h" +#include "impeller/geometry/scalar.h" +#include "impeller/renderer/vertex_buffer_builder.h" namespace impeller { diff --git a/impeller/playground/imgui/imgui_impl_impeller.cc b/impeller/playground/imgui/imgui_impl_impeller.cc index e8c58325dbaae..1024e56c053ce 100644 --- a/impeller/playground/imgui/imgui_impl_impeller.cc +++ b/impeller/playground/imgui/imgui_impl_impeller.cc @@ -18,6 +18,7 @@ #include "impeller/core/allocator.h" #include "impeller/core/formats.h" #include "impeller/core/range.h" +#include "impeller/core/sampler.h" #include "impeller/core/texture.h" #include "impeller/core/texture_descriptor.h" #include "impeller/core/vertex_buffer.h" @@ -31,7 +32,6 @@ #include "impeller/renderer/pipeline_descriptor.h" #include "impeller/renderer/pipeline_library.h" #include "impeller/renderer/render_pass.h" -#include "impeller/renderer/sampler.h" #include "impeller/renderer/sampler_library.h" struct ImGui_ImplImpeller_Data { diff --git a/impeller/renderer/BUILD.gn b/impeller/renderer/BUILD.gn index e1f9c5532b8d8..3e1cc1a5de95d 100644 --- a/impeller/renderer/BUILD.gn +++ b/impeller/renderer/BUILD.gn @@ -78,10 +78,6 @@ impeller_component("renderer") { "render_target.h", "renderer.cc", "renderer.h", - "sampler.cc", - "sampler.h", - "sampler_descriptor.cc", - "sampler_descriptor.h", "sampler_library.cc", "sampler_library.h", "shader_function.cc", @@ -90,8 +86,6 @@ impeller_component("renderer") { "shader_key.h", "shader_library.cc", "shader_library.h", - "shader_types.cc", - "shader_types.h", "snapshot.cc", "snapshot.h", "surface.cc", diff --git a/impeller/renderer/backend/gles/capabilities_gles.h b/impeller/renderer/backend/gles/capabilities_gles.h index 5cce9125cac1c..edcfb99892c9c 100644 --- a/impeller/renderer/backend/gles/capabilities_gles.h +++ b/impeller/renderer/backend/gles/capabilities_gles.h @@ -7,8 +7,8 @@ #include #include "flutter/fml/macros.h" +#include "impeller/core/shader_types.h" #include "impeller/geometry/size.h" -#include "impeller/renderer/shader_types.h" namespace impeller { diff --git a/impeller/renderer/backend/gles/formats_gles.h b/impeller/renderer/backend/gles/formats_gles.h index ef4cc418a76c2..fa44297ba50e8 100644 --- a/impeller/renderer/backend/gles/formats_gles.h +++ b/impeller/renderer/backend/gles/formats_gles.h @@ -7,8 +7,8 @@ #include "flutter/fml/logging.h" #include "flutter/fml/macros.h" #include "impeller/core/formats.h" +#include "impeller/core/shader_types.h" #include "impeller/renderer/backend/gles/gles.h" -#include "impeller/renderer/shader_types.h" namespace impeller { diff --git a/impeller/renderer/backend/gles/sampler_gles.h b/impeller/renderer/backend/gles/sampler_gles.h index 7fa58daa45215..bb318f6a35278 100644 --- a/impeller/renderer/backend/gles/sampler_gles.h +++ b/impeller/renderer/backend/gles/sampler_gles.h @@ -6,7 +6,7 @@ #include "flutter/fml/macros.h" #include "impeller/base/backend_cast.h" -#include "impeller/renderer/sampler.h" +#include "impeller/core/sampler.h" namespace impeller { diff --git a/impeller/renderer/backend/gles/sampler_library_gles.h b/impeller/renderer/backend/gles/sampler_library_gles.h index 9bf35d6740ec8..43794426d9ed5 100644 --- a/impeller/renderer/backend/gles/sampler_library_gles.h +++ b/impeller/renderer/backend/gles/sampler_library_gles.h @@ -5,7 +5,7 @@ #pragma once #include "flutter/fml/macros.h" -#include "impeller/renderer/sampler_descriptor.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/renderer/sampler_library.h" namespace impeller { diff --git a/impeller/renderer/backend/metal/blit_pass_mtl.mm b/impeller/renderer/backend/metal/blit_pass_mtl.mm index ddbba0772c219..b884d01c0c151 100644 --- a/impeller/renderer/backend/metal/blit_pass_mtl.mm +++ b/impeller/renderer/backend/metal/blit_pass_mtl.mm @@ -13,6 +13,7 @@ #include "impeller/base/backend_cast.h" #include "impeller/core/formats.h" #include "impeller/core/host_buffer.h" +#include "impeller/core/shader_types.h" #include "impeller/renderer/backend/metal/blit_command_mtl.h" #include "impeller/renderer/backend/metal/device_buffer_mtl.h" #include "impeller/renderer/backend/metal/formats_mtl.h" @@ -20,7 +21,6 @@ #include "impeller/renderer/backend/metal/sampler_mtl.h" #include "impeller/renderer/backend/metal/texture_mtl.h" #include "impeller/renderer/blit_command.h" -#include "impeller/renderer/shader_types.h" namespace impeller { diff --git a/impeller/renderer/backend/metal/compute_pass_mtl.mm b/impeller/renderer/backend/metal/compute_pass_mtl.mm index dd5e7aee00680..031717ec77ed8 100644 --- a/impeller/renderer/backend/metal/compute_pass_mtl.mm +++ b/impeller/renderer/backend/metal/compute_pass_mtl.mm @@ -15,13 +15,13 @@ #include "impeller/base/backend_cast.h" #include "impeller/core/formats.h" #include "impeller/core/host_buffer.h" +#include "impeller/core/shader_types.h" #include "impeller/renderer/backend/metal/compute_pipeline_mtl.h" #include "impeller/renderer/backend/metal/device_buffer_mtl.h" #include "impeller/renderer/backend/metal/formats_mtl.h" #include "impeller/renderer/backend/metal/sampler_mtl.h" #include "impeller/renderer/backend/metal/texture_mtl.h" #include "impeller/renderer/compute_command.h" -#include "impeller/renderer/shader_types.h" namespace impeller { diff --git a/impeller/renderer/backend/metal/context_mtl.h b/impeller/renderer/backend/metal/context_mtl.h index ac5de3a66bac9..26ba5ace3fead 100644 --- a/impeller/renderer/backend/metal/context_mtl.h +++ b/impeller/renderer/backend/metal/context_mtl.h @@ -11,6 +11,7 @@ #include "flutter/fml/macros.h" #include "impeller/base/backend_cast.h" +#include "impeller/core/sampler.h" #include "impeller/renderer/backend/metal/allocator_mtl.h" #include "impeller/renderer/backend/metal/command_buffer_mtl.h" #include "impeller/renderer/backend/metal/gpu_tracer_mtl.h" @@ -18,7 +19,6 @@ #include "impeller/renderer/backend/metal/shader_library_mtl.h" #include "impeller/renderer/capabilities.h" #include "impeller/renderer/context.h" -#include "impeller/renderer/sampler.h" namespace impeller { diff --git a/impeller/renderer/backend/metal/context_mtl.mm b/impeller/renderer/backend/metal/context_mtl.mm index 9bee27963f740..b42946fdd1b92 100644 --- a/impeller/renderer/backend/metal/context_mtl.mm +++ b/impeller/renderer/backend/metal/context_mtl.mm @@ -9,9 +9,9 @@ #include "flutter/fml/file.h" #include "flutter/fml/logging.h" #include "flutter/fml/paths.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/renderer/backend/metal/sampler_library_mtl.h" #include "impeller/renderer/capabilities.h" -#include "impeller/renderer/sampler_descriptor.h" namespace impeller { diff --git a/impeller/renderer/backend/metal/render_pass_mtl.mm b/impeller/renderer/backend/metal/render_pass_mtl.mm index 540309532ff26..4c912e9772935 100644 --- a/impeller/renderer/backend/metal/render_pass_mtl.mm +++ b/impeller/renderer/backend/metal/render_pass_mtl.mm @@ -10,12 +10,12 @@ #include "impeller/base/backend_cast.h" #include "impeller/core/formats.h" #include "impeller/core/host_buffer.h" +#include "impeller/core/shader_types.h" #include "impeller/renderer/backend/metal/device_buffer_mtl.h" #include "impeller/renderer/backend/metal/formats_mtl.h" #include "impeller/renderer/backend/metal/pipeline_mtl.h" #include "impeller/renderer/backend/metal/sampler_mtl.h" #include "impeller/renderer/backend/metal/texture_mtl.h" -#include "impeller/renderer/shader_types.h" namespace impeller { diff --git a/impeller/renderer/backend/metal/sampler_library_mtl.h b/impeller/renderer/backend/metal/sampler_library_mtl.h index 74297ebcb5320..d72cc11a0c3c7 100644 --- a/impeller/renderer/backend/metal/sampler_library_mtl.h +++ b/impeller/renderer/backend/metal/sampler_library_mtl.h @@ -11,7 +11,7 @@ #include "flutter/fml/macros.h" #include "impeller/base/backend_cast.h" #include "impeller/base/comparable.h" -#include "impeller/renderer/sampler_descriptor.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/renderer/sampler_library.h" namespace impeller { diff --git a/impeller/renderer/backend/metal/sampler_mtl.h b/impeller/renderer/backend/metal/sampler_mtl.h index dc26deff68108..22f548e368729 100644 --- a/impeller/renderer/backend/metal/sampler_mtl.h +++ b/impeller/renderer/backend/metal/sampler_mtl.h @@ -8,7 +8,7 @@ #include "flutter/fml/macros.h" #include "impeller/base/backend_cast.h" -#include "impeller/renderer/sampler.h" +#include "impeller/core/sampler.h" namespace impeller { diff --git a/impeller/renderer/backend/vulkan/formats_vk.h b/impeller/renderer/backend/vulkan/formats_vk.h index f11887a48c3a9..8c8155b5b025a 100644 --- a/impeller/renderer/backend/vulkan/formats_vk.h +++ b/impeller/renderer/backend/vulkan/formats_vk.h @@ -6,8 +6,8 @@ #include "flutter/fml/macros.h" #include "impeller/core/formats.h" +#include "impeller/core/shader_types.h" #include "impeller/renderer/backend/vulkan/vk.h" -#include "impeller/renderer/shader_types.h" #include "vulkan/vulkan_enums.hpp" namespace impeller { diff --git a/impeller/renderer/backend/vulkan/render_pass_vk.cc b/impeller/renderer/backend/vulkan/render_pass_vk.cc index 8553aebd0c3f4..23adb1829ba33 100644 --- a/impeller/renderer/backend/vulkan/render_pass_vk.cc +++ b/impeller/renderer/backend/vulkan/render_pass_vk.cc @@ -13,6 +13,8 @@ #include "flutter/fml/trace_event.h" #include "impeller/base/validation.h" #include "impeller/core/formats.h" +#include "impeller/core/sampler.h" +#include "impeller/core/shader_types.h" #include "impeller/renderer/backend/vulkan/command_encoder_vk.h" #include "impeller/renderer/backend/vulkan/context_vk.h" #include "impeller/renderer/backend/vulkan/device_buffer_vk.h" @@ -21,8 +23,6 @@ #include "impeller/renderer/backend/vulkan/sampler_vk.h" #include "impeller/renderer/backend/vulkan/shared_object_vk.h" #include "impeller/renderer/backend/vulkan/texture_vk.h" -#include "impeller/renderer/sampler.h" -#include "impeller/renderer/shader_types.h" #include "vulkan/vulkan_enums.hpp" #include "vulkan/vulkan_structs.hpp" diff --git a/impeller/renderer/backend/vulkan/sampler_library_vk.h b/impeller/renderer/backend/vulkan/sampler_library_vk.h index 72129ca496757..8b5a4fca82fe3 100644 --- a/impeller/renderer/backend/vulkan/sampler_library_vk.h +++ b/impeller/renderer/backend/vulkan/sampler_library_vk.h @@ -7,8 +7,8 @@ #include "flutter/fml/macros.h" #include "impeller/base/backend_cast.h" #include "impeller/base/comparable.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/renderer/backend/vulkan/vk.h" -#include "impeller/renderer/sampler_descriptor.h" #include "impeller/renderer/sampler_library.h" namespace impeller { diff --git a/impeller/renderer/backend/vulkan/sampler_vk.h b/impeller/renderer/backend/vulkan/sampler_vk.h index bf78d63a1b271..f67a64f9e83d6 100644 --- a/impeller/renderer/backend/vulkan/sampler_vk.h +++ b/impeller/renderer/backend/vulkan/sampler_vk.h @@ -6,9 +6,9 @@ #include "flutter/fml/macros.h" #include "impeller/base/backend_cast.h" +#include "impeller/core/sampler.h" #include "impeller/renderer/backend/vulkan/shared_object_vk.h" #include "impeller/renderer/backend/vulkan/vk.h" -#include "impeller/renderer/sampler.h" #include "vulkan/vulkan_handles.hpp" namespace impeller { diff --git a/impeller/renderer/backend/vulkan/vertex_descriptor_vk.h b/impeller/renderer/backend/vulkan/vertex_descriptor_vk.h index 519dd2e7f3a03..31d3f447c7d61 100644 --- a/impeller/renderer/backend/vulkan/vertex_descriptor_vk.h +++ b/impeller/renderer/backend/vulkan/vertex_descriptor_vk.h @@ -5,8 +5,8 @@ #pragma once #include "flutter/fml/macros.h" +#include "impeller/core/shader_types.h" #include "impeller/renderer/backend/vulkan/vk.h" -#include "impeller/renderer/shader_types.h" namespace impeller { diff --git a/impeller/renderer/command.h b/impeller/renderer/command.h index aa219dfd5fc25..a75083ddc629f 100644 --- a/impeller/renderer/command.h +++ b/impeller/renderer/command.h @@ -13,12 +13,13 @@ #include "flutter/fml/macros.h" #include "impeller/core/buffer_view.h" #include "impeller/core/formats.h" +#include "impeller/core/resource_binder.h" +#include "impeller/core/sampler.h" +#include "impeller/core/shader_types.h" #include "impeller/core/texture.h" #include "impeller/core/vertex_buffer.h" #include "impeller/geometry/rect.h" #include "impeller/renderer/pipeline.h" -#include "impeller/renderer/sampler.h" -#include "impeller/renderer/shader_types.h" #include "impeller/renderer/vertex_buffer_builder.h" #include "impeller/tessellator/tessellator.h" @@ -63,7 +64,7 @@ struct Bindings { /// views into buffers managed by other allocators and resource /// managers. /// -struct Command { +struct Command : public ResourceBinder { //---------------------------------------------------------------------------- /// The pipeline to use for this command. /// @@ -145,26 +146,30 @@ struct Command { /// bool BindVertices(const VertexBuffer& buffer); + // |ResourceBinder| bool BindResource(ShaderStage stage, const ShaderUniformSlot& slot, const ShaderMetadata& metadata, - const BufferView& view); + const BufferView& view) override; + // |ResourceBinder| bool BindResource(ShaderStage stage, const SampledImageSlot& slot, const ShaderMetadata& metadata, - const std::shared_ptr& texture); + const std::shared_ptr& texture) override; + // |ResourceBinder| bool BindResource(ShaderStage stage, const SampledImageSlot& slot, const ShaderMetadata& metadata, - const std::shared_ptr& sampler); + const std::shared_ptr& sampler) override; + // |ResourceBinder| bool BindResource(ShaderStage stage, const SampledImageSlot& slot, const ShaderMetadata& metadata, const std::shared_ptr& texture, - const std::shared_ptr& sampler); + const std::shared_ptr& sampler) override; BufferView GetVertexBuffer() const; diff --git a/impeller/renderer/compute_command.h b/impeller/renderer/compute_command.h index 15ee42f98a5d8..467777d22deda 100644 --- a/impeller/renderer/compute_command.h +++ b/impeller/renderer/compute_command.h @@ -13,14 +13,15 @@ #include "flutter/fml/macros.h" #include "impeller/core/buffer_view.h" #include "impeller/core/formats.h" +#include "impeller/core/resource_binder.h" +#include "impeller/core/sampler.h" +#include "impeller/core/shader_types.h" #include "impeller/core/texture.h" #include "impeller/core/vertex_buffer.h" #include "impeller/geometry/rect.h" #include "impeller/renderer/command.h" #include "impeller/renderer/compute_pipeline_descriptor.h" #include "impeller/renderer/pipeline.h" -#include "impeller/renderer/sampler.h" -#include "impeller/renderer/shader_types.h" #include "impeller/renderer/vertex_buffer_builder.h" #include "impeller/tessellator/tessellator.h" @@ -39,7 +40,7 @@ namespace impeller { /// views into buffers managed by other allocators and resource /// managers. /// -struct ComputeCommand { +struct ComputeCommand : public ResourceBinder { //---------------------------------------------------------------------------- /// The pipeline to use for this command. /// @@ -54,26 +55,30 @@ struct ComputeCommand { /// std::string label; + // |ResourceBinder| bool BindResource(ShaderStage stage, const ShaderUniformSlot& slot, const ShaderMetadata& metadata, - const BufferView& view); + const BufferView& view) override; + // |ResourceBinder| bool BindResource(ShaderStage stage, const SampledImageSlot& slot, const ShaderMetadata& metadata, - const std::shared_ptr& texture); + const std::shared_ptr& texture) override; + // |ResourceBinder| bool BindResource(ShaderStage stage, const SampledImageSlot& slot, const ShaderMetadata& metadata, - const std::shared_ptr& sampler); + const std::shared_ptr& sampler) override; + // |ResourceBinder| bool BindResource(ShaderStage stage, const SampledImageSlot& slot, const ShaderMetadata& metadata, const std::shared_ptr& texture, - const std::shared_ptr& sampler); + const std::shared_ptr& sampler) override; constexpr operator bool() const { return pipeline && pipeline->IsValid(); } }; diff --git a/impeller/renderer/compute_pipeline_descriptor.h b/impeller/renderer/compute_pipeline_descriptor.h index 5bd513f43c863..9886d2691ddf8 100644 --- a/impeller/renderer/compute_pipeline_descriptor.h +++ b/impeller/renderer/compute_pipeline_descriptor.h @@ -17,7 +17,7 @@ #include "flutter/fml/macros.h" #include "impeller/base/comparable.h" #include "impeller/core/formats.h" -#include "impeller/renderer/shader_types.h" +#include "impeller/core/shader_types.h" #include "impeller/tessellator/tessellator.h" namespace impeller { diff --git a/impeller/renderer/pipeline_descriptor.h b/impeller/renderer/pipeline_descriptor.h index 552fcfedf23c0..3d0eddf880e28 100644 --- a/impeller/renderer/pipeline_descriptor.h +++ b/impeller/renderer/pipeline_descriptor.h @@ -17,7 +17,7 @@ #include "flutter/fml/macros.h" #include "impeller/base/comparable.h" #include "impeller/core/formats.h" -#include "impeller/renderer/shader_types.h" +#include "impeller/core/shader_types.h" #include "impeller/tessellator/tessellator.h" namespace impeller { diff --git a/impeller/renderer/renderer_unittests.cc b/impeller/renderer/renderer_unittests.cc index 9705fc7864043..e995aaea2cec4 100644 --- a/impeller/renderer/renderer_unittests.cc +++ b/impeller/renderer/renderer_unittests.cc @@ -6,6 +6,8 @@ #include "impeller/base/strings.h" #include "impeller/core/device_buffer_descriptor.h" #include "impeller/core/formats.h" +#include "impeller/core/sampler.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/fixtures/array.frag.h" #include "impeller/fixtures/array.vert.h" #include "impeller/fixtures/box_fade.frag.h" @@ -31,8 +33,6 @@ #include "impeller/renderer/pipeline_builder.h" #include "impeller/renderer/pipeline_library.h" #include "impeller/renderer/renderer.h" -#include "impeller/renderer/sampler.h" -#include "impeller/renderer/sampler_descriptor.h" #include "impeller/renderer/sampler_library.h" #include "impeller/renderer/surface.h" #include "impeller/renderer/vertex_buffer_builder.h" diff --git a/impeller/renderer/sampler.h b/impeller/renderer/sampler.h index 41a16f5b74865..3dd19cf71fed8 100644 --- a/impeller/renderer/sampler.h +++ b/impeller/renderer/sampler.h @@ -5,7 +5,7 @@ #pragma once #include "flutter/fml/macros.h" -#include "impeller/renderer/sampler_descriptor.h" +#include "impeller/core/sampler_descriptor.h" namespace impeller { diff --git a/impeller/renderer/sampler_library.h b/impeller/renderer/sampler_library.h index e515b6facab36..777420776dc62 100644 --- a/impeller/renderer/sampler_library.h +++ b/impeller/renderer/sampler_library.h @@ -7,7 +7,7 @@ #include #include "flutter/fml/macros.h" -#include "impeller/renderer/sampler_descriptor.h" +#include "impeller/core/sampler_descriptor.h" namespace impeller { diff --git a/impeller/renderer/shader_function.h b/impeller/renderer/shader_function.h index 273b280f068b2..a271496e0762e 100644 --- a/impeller/renderer/shader_function.h +++ b/impeller/renderer/shader_function.h @@ -7,7 +7,7 @@ #include "flutter/fml/hash_combine.h" #include "flutter/fml/macros.h" #include "impeller/base/comparable.h" -#include "impeller/renderer/shader_types.h" +#include "impeller/core/shader_types.h" namespace impeller { diff --git a/impeller/renderer/shader_key.h b/impeller/renderer/shader_key.h index 24e7c0a455a72..802908647b149 100644 --- a/impeller/renderer/shader_key.h +++ b/impeller/renderer/shader_key.h @@ -10,7 +10,7 @@ #include "flutter/fml/hash_combine.h" #include "flutter/fml/macros.h" -#include "impeller/renderer/shader_types.h" +#include "impeller/core/shader_types.h" namespace impeller { diff --git a/impeller/renderer/shader_library.h b/impeller/renderer/shader_library.h index 3c1b4f9a730d3..76b1aeb8cd499 100644 --- a/impeller/renderer/shader_library.h +++ b/impeller/renderer/shader_library.h @@ -10,7 +10,7 @@ #include "flutter/fml/macros.h" #include "fml/mapping.h" -#include "impeller/renderer/shader_types.h" +#include "impeller/core/shader_types.h" namespace impeller { diff --git a/impeller/renderer/snapshot.h b/impeller/renderer/snapshot.h index 6d2d2fb74f085..0d9a57471aaaa 100644 --- a/impeller/renderer/snapshot.h +++ b/impeller/renderer/snapshot.h @@ -10,10 +10,10 @@ #include "flutter/fml/macros.h" #include "impeller/core/formats.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/core/texture.h" #include "impeller/geometry/matrix.h" #include "impeller/geometry/rect.h" -#include "impeller/renderer/sampler_descriptor.h" namespace impeller { diff --git a/impeller/renderer/vertex_descriptor.h b/impeller/renderer/vertex_descriptor.h index 8d145bb0f503e..19d9b9d1bfd9e 100644 --- a/impeller/renderer/vertex_descriptor.h +++ b/impeller/renderer/vertex_descriptor.h @@ -8,7 +8,7 @@ #include "flutter/fml/macros.h" #include "impeller/base/comparable.h" -#include "impeller/renderer/shader_types.h" +#include "impeller/core/shader_types.h" namespace impeller { diff --git a/impeller/runtime_stage/runtime_stage_playground.cc b/impeller/runtime_stage/runtime_stage_playground.cc index de0d3cf66f99e..3762581e85213 100644 --- a/impeller/runtime_stage/runtime_stage_playground.cc +++ b/impeller/runtime_stage/runtime_stage_playground.cc @@ -8,8 +8,8 @@ #include "flutter/fml/make_copyable.h" #include "flutter/testing/testing.h" +#include "impeller/core/shader_types.h" #include "impeller/renderer/shader_library.h" -#include "impeller/renderer/shader_types.h" namespace impeller { diff --git a/impeller/runtime_stage/runtime_stage_unittests.cc b/impeller/runtime_stage/runtime_stage_unittests.cc index d5596afa6748f..fbe4d5f447eee 100644 --- a/impeller/runtime_stage/runtime_stage_unittests.cc +++ b/impeller/runtime_stage/runtime_stage_unittests.cc @@ -9,11 +9,11 @@ #include "flutter/testing/testing.h" #include "impeller/base/allocation.h" #include "impeller/base/validation.h" +#include "impeller/core/shader_types.h" #include "impeller/playground/playground.h" #include "impeller/renderer/pipeline_descriptor.h" #include "impeller/renderer/pipeline_library.h" #include "impeller/renderer/shader_library.h" -#include "impeller/renderer/shader_types.h" #include "impeller/runtime_stage/runtime_stage.h" #include "impeller/runtime_stage/runtime_stage_playground.h" diff --git a/impeller/scene/geometry.cc b/impeller/scene/geometry.cc index 016211499aa95..4804377850a66 100644 --- a/impeller/scene/geometry.cc +++ b/impeller/scene/geometry.cc @@ -10,10 +10,10 @@ #include "impeller/core/device_buffer_descriptor.h" #include "impeller/core/formats.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/core/vertex_buffer.h" #include "impeller/geometry/point.h" #include "impeller/geometry/vector.h" -#include "impeller/renderer/sampler_descriptor.h" #include "impeller/renderer/sampler_library.h" #include "impeller/renderer/vertex_buffer_builder.h" #include "impeller/scene/importer/scene_flatbuffers.h" diff --git a/impeller/scene/material.cc b/impeller/scene/material.cc index 1e3493dadd3e5..d4f4c7161f3c8 100644 --- a/impeller/scene/material.cc +++ b/impeller/scene/material.cc @@ -5,7 +5,7 @@ #include "impeller/scene/material.h" #include "impeller/base/validation.h" #include "impeller/core/formats.h" -#include "impeller/renderer/sampler_descriptor.h" +#include "impeller/core/sampler_descriptor.h" #include "impeller/renderer/sampler_library.h" #include "impeller/scene/importer/conversions.h" #include "impeller/scene/importer/scene_flatbuffers.h" From 45ed04feaf7f82d95301af84f84c6113e2898d9a Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 30 Mar 2023 14:17:12 -0700 Subject: [PATCH 2/6] Move runtime_types as well --- ci/licenses_golden/licenses_flutter | 6 ++-- impeller/core/BUILD.gn | 2 ++ .../{runtime_stage => core}/runtime_types.cc | 2 +- .../{runtime_stage => core}/runtime_types.h | 0 impeller/core/shader_types.h | 2 +- impeller/runtime_stage/BUILD.gn | 2 -- impeller/runtime_stage/runtime_stage.h | 2 +- .../android/android_context_impeller.cc | 18 ++++++++++++ .../android/android_context_impeller.h | 28 +++++++++++++++++++ 9 files changed, 55 insertions(+), 7 deletions(-) rename impeller/{runtime_stage => core}/runtime_types.cc (89%) rename impeller/{runtime_stage => core}/runtime_types.h (100%) create mode 100644 shell/platform/android/android_context_impeller.cc create mode 100644 shell/platform/android/android_context_impeller.h diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 54b7ca348735e..e44ba313fe566 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -1126,6 +1126,8 @@ ORIGIN: ../../../flutter/impeller/core/range.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/range.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/resource_binder.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/resource_binder.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/core/runtime_types.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/impeller/core/runtime_types.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/sampler.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/sampler.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/core/sampler_descriptor.cc + ../../../flutter/LICENSE @@ -1574,8 +1576,6 @@ ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_stage.fbs + ../../../flu ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_stage.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_stage_playground.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_stage_playground.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_types.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_types.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/scene/animation/animation.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/scene/animation/animation.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/impeller/scene/animation/animation_clip.cc + ../../../flutter/LICENSE @@ -3697,6 +3697,8 @@ FILE: ../../../flutter/impeller/core/range.cc FILE: ../../../flutter/impeller/core/range.h FILE: ../../../flutter/impeller/core/resource_binder.cc FILE: ../../../flutter/impeller/core/resource_binder.h +FILE: ../../../flutter/impeller/core/runtime_types.cc +FILE: ../../../flutter/impeller/core/runtime_types.h FILE: ../../../flutter/impeller/core/sampler.cc FILE: ../../../flutter/impeller/core/sampler.h FILE: ../../../flutter/impeller/core/sampler_descriptor.cc diff --git a/impeller/core/BUILD.gn b/impeller/core/BUILD.gn index f52d9ac047243..68891ed145198 100644 --- a/impeller/core/BUILD.gn +++ b/impeller/core/BUILD.gn @@ -26,6 +26,8 @@ impeller_component("core") { "range.h", "resource_binder.cc", "resource_binder.h", + "runtime_types.cc", + "runtime_types.h", "sampler.cc", "sampler.h", "sampler_descriptor.cc", diff --git a/impeller/runtime_stage/runtime_types.cc b/impeller/core/runtime_types.cc similarity index 89% rename from impeller/runtime_stage/runtime_types.cc rename to impeller/core/runtime_types.cc index 4236eae89bbfc..0c530699ecda3 100644 --- a/impeller/runtime_stage/runtime_types.cc +++ b/impeller/core/runtime_types.cc @@ -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 "impeller/runtime_stage/runtime_types.h" +#include "impeller/core/runtime_types.h" namespace impeller { diff --git a/impeller/runtime_stage/runtime_types.h b/impeller/core/runtime_types.h similarity index 100% rename from impeller/runtime_stage/runtime_types.h rename to impeller/core/runtime_types.h diff --git a/impeller/core/shader_types.h b/impeller/core/shader_types.h index 8767924b42271..ad7cddbb5104c 100644 --- a/impeller/core/shader_types.h +++ b/impeller/core/shader_types.h @@ -11,9 +11,9 @@ #include "flutter/fml/hash_combine.h" #include "flutter/fml/logging.h" +#include "impeller/core/runtime_types.h" #include "impeller/geometry/half.h" #include "impeller/geometry/matrix.h" -#include "impeller/runtime_stage/runtime_types.h" namespace impeller { diff --git a/impeller/runtime_stage/BUILD.gn b/impeller/runtime_stage/BUILD.gn index 5756887562edb..970445d49b7bc 100644 --- a/impeller/runtime_stage/BUILD.gn +++ b/impeller/runtime_stage/BUILD.gn @@ -20,8 +20,6 @@ impeller_component("runtime_stage") { sources = [ "runtime_stage.cc", "runtime_stage.h", - "runtime_types.cc", - "runtime_types.h", ] public_deps = [ ":runtime_stage_flatbuffers", diff --git a/impeller/runtime_stage/runtime_stage.h b/impeller/runtime_stage/runtime_stage.h index 2c5eca0e3badd..f3a795c0caeb3 100644 --- a/impeller/runtime_stage/runtime_stage.h +++ b/impeller/runtime_stage/runtime_stage.h @@ -10,7 +10,7 @@ #include "flutter/fml/macros.h" #include "flutter/fml/mapping.h" -#include "flutter/impeller/runtime_stage/runtime_types.h" +#include "flutter/impeller/core/runtime_types.h" namespace impeller { diff --git a/shell/platform/android/android_context_impeller.cc b/shell/platform/android/android_context_impeller.cc new file mode 100644 index 0000000000000..d167e7d0c00c5 --- /dev/null +++ b/shell/platform/android/android_context_impeller.cc @@ -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. + +#include "flutter/shell/platform/android/android_context_impeller.h" + +namespace flutter { + +AndroidContextImpeller::AndroidContextImpeller() + : AndroidContext(AndroidRenderingAPI::kGPU) {} + +AndroidContextImpeller::~AndroidContextImpeller() = default; + +bool AndroidContextImpeller::IsValid() const { + return true; +} + +} // namespace flutter diff --git a/shell/platform/android/android_context_impeller.h b/shell/platform/android/android_context_impeller.h new file mode 100644 index 0000000000000..f9b2a5e40cac2 --- /dev/null +++ b/shell/platform/android/android_context_impeller.h @@ -0,0 +1,28 @@ +// 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. + +#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_android_context_impeller_H_ +#define FLUTTER_SHELL_PLATFORM_ANDROID_android_context_impeller_H_ + +#include "flutter/fml/macros.h" +#include "flutter/shell/platform/android/context/android_context.h" + +namespace flutter { + +class AndroidContextImpeller : public AndroidContext { + public: + AndroidContextImpeller(); + + ~AndroidContextImpeller(); + + // |AndroidContext| + bool IsValid() const override; + + private: + FML_DISALLOW_COPY_AND_ASSIGN(AndroidContextImpeller); +}; + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_ANDROID_android_context_impeller_H_ From 2dd1eb3a2dfda6ce27a3b7b6b00417c63e0c03f3 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 30 Mar 2023 14:32:17 -0700 Subject: [PATCH 3/6] delete stray file --- impeller/core/vertex_buffer_builder.cc | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 impeller/core/vertex_buffer_builder.cc diff --git a/impeller/core/vertex_buffer_builder.cc b/impeller/core/vertex_buffer_builder.cc deleted file mode 100644 index b29e4032132a0..0000000000000 --- a/impeller/core/vertex_buffer_builder.cc +++ /dev/null @@ -1,11 +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. - -#include "impeller/renderer/vertex_buffer_builder.h" - -namespace impeller { - -// - -} // namespace impeller From e65aa02b1e09655c0570fda9817e3c1f6e84d464 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 30 Mar 2023 14:32:51 -0700 Subject: [PATCH 4/6] missing dep --- impeller/runtime_stage/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/impeller/runtime_stage/BUILD.gn b/impeller/runtime_stage/BUILD.gn index 970445d49b7bc..f5768280d6d6b 100644 --- a/impeller/runtime_stage/BUILD.gn +++ b/impeller/runtime_stage/BUILD.gn @@ -24,6 +24,7 @@ impeller_component("runtime_stage") { public_deps = [ ":runtime_stage_flatbuffers", "../base", + "../core", "//flutter/fml", ] } From 65ee62b7dbc3a4077a8d2df72f5629d73fd7d8c7 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 30 Mar 2023 15:08:21 -0700 Subject: [PATCH 5/6] sundry issues --- impeller/renderer/sampler.h | 29 ------------------- .../android/android_context_impeller.cc | 18 ------------ .../android/android_context_impeller.h | 28 ------------------ 3 files changed, 75 deletions(-) delete mode 100644 impeller/renderer/sampler.h delete mode 100644 shell/platform/android/android_context_impeller.cc delete mode 100644 shell/platform/android/android_context_impeller.h diff --git a/impeller/renderer/sampler.h b/impeller/renderer/sampler.h deleted file mode 100644 index 3dd19cf71fed8..0000000000000 --- a/impeller/renderer/sampler.h +++ /dev/null @@ -1,29 +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. - -#pragma once - -#include "flutter/fml/macros.h" -#include "impeller/core/sampler_descriptor.h" - -namespace impeller { - -class Sampler { - public: - virtual ~Sampler(); - - virtual bool IsValid() const = 0; - - const SamplerDescriptor& GetDescriptor() const; - - protected: - SamplerDescriptor desc_; - - explicit Sampler(SamplerDescriptor desc); - - private: - FML_DISALLOW_COPY_AND_ASSIGN(Sampler); -}; - -} // namespace impeller diff --git a/shell/platform/android/android_context_impeller.cc b/shell/platform/android/android_context_impeller.cc deleted file mode 100644 index d167e7d0c00c5..0000000000000 --- a/shell/platform/android/android_context_impeller.cc +++ /dev/null @@ -1,18 +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. - -#include "flutter/shell/platform/android/android_context_impeller.h" - -namespace flutter { - -AndroidContextImpeller::AndroidContextImpeller() - : AndroidContext(AndroidRenderingAPI::kGPU) {} - -AndroidContextImpeller::~AndroidContextImpeller() = default; - -bool AndroidContextImpeller::IsValid() const { - return true; -} - -} // namespace flutter diff --git a/shell/platform/android/android_context_impeller.h b/shell/platform/android/android_context_impeller.h deleted file mode 100644 index f9b2a5e40cac2..0000000000000 --- a/shell/platform/android/android_context_impeller.h +++ /dev/null @@ -1,28 +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. - -#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_android_context_impeller_H_ -#define FLUTTER_SHELL_PLATFORM_ANDROID_android_context_impeller_H_ - -#include "flutter/fml/macros.h" -#include "flutter/shell/platform/android/context/android_context.h" - -namespace flutter { - -class AndroidContextImpeller : public AndroidContext { - public: - AndroidContextImpeller(); - - ~AndroidContextImpeller(); - - // |AndroidContext| - bool IsValid() const override; - - private: - FML_DISALLOW_COPY_AND_ASSIGN(AndroidContextImpeller); -}; - -} // namespace flutter - -#endif // FLUTTER_SHELL_PLATFORM_ANDROID_android_context_impeller_H_ From 3d9491d0802ab70a696e64ca5a7375b90bdfa198 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Thu, 30 Mar 2023 15:08:49 -0700 Subject: [PATCH 6/6] one missing --- ci/licenses_golden/licenses_flutter | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index e44ba313fe566..7c72a05dffb95 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -4147,8 +4147,6 @@ FILE: ../../../flutter/impeller/runtime_stage/runtime_stage.fbs FILE: ../../../flutter/impeller/runtime_stage/runtime_stage.h FILE: ../../../flutter/impeller/runtime_stage/runtime_stage_playground.cc FILE: ../../../flutter/impeller/runtime_stage/runtime_stage_playground.h -FILE: ../../../flutter/impeller/runtime_stage/runtime_types.cc -FILE: ../../../flutter/impeller/runtime_stage/runtime_types.h FILE: ../../../flutter/impeller/scene/animation/animation.cc FILE: ../../../flutter/impeller/scene/animation/animation.h FILE: ../../../flutter/impeller/scene/animation/animation_clip.cc