Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c0f4e6b

Browse files
authored
[Impeller] Reland move more files to core. (#40812)
[Impeller] Reland move more files to core.
1 parent 3f8bbcf commit c0f4e6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+181
-113
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,16 @@ ORIGIN: ../../../flutter/impeller/core/platform.cc + ../../../flutter/LICENSE
11241124
ORIGIN: ../../../flutter/impeller/core/platform.h + ../../../flutter/LICENSE
11251125
ORIGIN: ../../../flutter/impeller/core/range.cc + ../../../flutter/LICENSE
11261126
ORIGIN: ../../../flutter/impeller/core/range.h + ../../../flutter/LICENSE
1127+
ORIGIN: ../../../flutter/impeller/core/resource_binder.cc + ../../../flutter/LICENSE
1128+
ORIGIN: ../../../flutter/impeller/core/resource_binder.h + ../../../flutter/LICENSE
1129+
ORIGIN: ../../../flutter/impeller/core/runtime_types.cc + ../../../flutter/LICENSE
1130+
ORIGIN: ../../../flutter/impeller/core/runtime_types.h + ../../../flutter/LICENSE
1131+
ORIGIN: ../../../flutter/impeller/core/sampler.cc + ../../../flutter/LICENSE
1132+
ORIGIN: ../../../flutter/impeller/core/sampler.h + ../../../flutter/LICENSE
1133+
ORIGIN: ../../../flutter/impeller/core/sampler_descriptor.cc + ../../../flutter/LICENSE
1134+
ORIGIN: ../../../flutter/impeller/core/sampler_descriptor.h + ../../../flutter/LICENSE
1135+
ORIGIN: ../../../flutter/impeller/core/shader_types.cc + ../../../flutter/LICENSE
1136+
ORIGIN: ../../../flutter/impeller/core/shader_types.h + ../../../flutter/LICENSE
11271137
ORIGIN: ../../../flutter/impeller/core/texture.cc + ../../../flutter/LICENSE
11281138
ORIGIN: ../../../flutter/impeller/core/texture.h + ../../../flutter/LICENSE
11291139
ORIGIN: ../../../flutter/impeller/core/texture_descriptor.cc + ../../../flutter/LICENSE
@@ -1548,10 +1558,6 @@ ORIGIN: ../../../flutter/impeller/renderer/render_target.cc + ../../../flutter/L
15481558
ORIGIN: ../../../flutter/impeller/renderer/render_target.h + ../../../flutter/LICENSE
15491559
ORIGIN: ../../../flutter/impeller/renderer/renderer.cc + ../../../flutter/LICENSE
15501560
ORIGIN: ../../../flutter/impeller/renderer/renderer.h + ../../../flutter/LICENSE
1551-
ORIGIN: ../../../flutter/impeller/renderer/sampler.cc + ../../../flutter/LICENSE
1552-
ORIGIN: ../../../flutter/impeller/renderer/sampler.h + ../../../flutter/LICENSE
1553-
ORIGIN: ../../../flutter/impeller/renderer/sampler_descriptor.cc + ../../../flutter/LICENSE
1554-
ORIGIN: ../../../flutter/impeller/renderer/sampler_descriptor.h + ../../../flutter/LICENSE
15551561
ORIGIN: ../../../flutter/impeller/renderer/sampler_library.cc + ../../../flutter/LICENSE
15561562
ORIGIN: ../../../flutter/impeller/renderer/sampler_library.h + ../../../flutter/LICENSE
15571563
ORIGIN: ../../../flutter/impeller/renderer/shader_function.cc + ../../../flutter/LICENSE
@@ -1560,8 +1566,6 @@ ORIGIN: ../../../flutter/impeller/renderer/shader_key.cc + ../../../flutter/LICE
15601566
ORIGIN: ../../../flutter/impeller/renderer/shader_key.h + ../../../flutter/LICENSE
15611567
ORIGIN: ../../../flutter/impeller/renderer/shader_library.cc + ../../../flutter/LICENSE
15621568
ORIGIN: ../../../flutter/impeller/renderer/shader_library.h + ../../../flutter/LICENSE
1563-
ORIGIN: ../../../flutter/impeller/renderer/shader_types.cc + ../../../flutter/LICENSE
1564-
ORIGIN: ../../../flutter/impeller/renderer/shader_types.h + ../../../flutter/LICENSE
15651569
ORIGIN: ../../../flutter/impeller/renderer/snapshot.cc + ../../../flutter/LICENSE
15661570
ORIGIN: ../../../flutter/impeller/renderer/snapshot.h + ../../../flutter/LICENSE
15671571
ORIGIN: ../../../flutter/impeller/renderer/stroke.comp + ../../../flutter/LICENSE
@@ -1576,8 +1580,6 @@ ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_stage.fbs + ../../../flu
15761580
ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_stage.h + ../../../flutter/LICENSE
15771581
ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_stage_playground.cc + ../../../flutter/LICENSE
15781582
ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_stage_playground.h + ../../../flutter/LICENSE
1579-
ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_types.cc + ../../../flutter/LICENSE
1580-
ORIGIN: ../../../flutter/impeller/runtime_stage/runtime_types.h + ../../../flutter/LICENSE
15811583
ORIGIN: ../../../flutter/impeller/scene/animation/animation.cc + ../../../flutter/LICENSE
15821584
ORIGIN: ../../../flutter/impeller/scene/animation/animation.h + ../../../flutter/LICENSE
15831585
ORIGIN: ../../../flutter/impeller/scene/animation/animation_clip.cc + ../../../flutter/LICENSE
@@ -3699,6 +3701,16 @@ FILE: ../../../flutter/impeller/core/platform.cc
36993701
FILE: ../../../flutter/impeller/core/platform.h
37003702
FILE: ../../../flutter/impeller/core/range.cc
37013703
FILE: ../../../flutter/impeller/core/range.h
3704+
FILE: ../../../flutter/impeller/core/resource_binder.cc
3705+
FILE: ../../../flutter/impeller/core/resource_binder.h
3706+
FILE: ../../../flutter/impeller/core/runtime_types.cc
3707+
FILE: ../../../flutter/impeller/core/runtime_types.h
3708+
FILE: ../../../flutter/impeller/core/sampler.cc
3709+
FILE: ../../../flutter/impeller/core/sampler.h
3710+
FILE: ../../../flutter/impeller/core/sampler_descriptor.cc
3711+
FILE: ../../../flutter/impeller/core/sampler_descriptor.h
3712+
FILE: ../../../flutter/impeller/core/shader_types.cc
3713+
FILE: ../../../flutter/impeller/core/shader_types.h
37023714
FILE: ../../../flutter/impeller/core/texture.cc
37033715
FILE: ../../../flutter/impeller/core/texture.h
37043716
FILE: ../../../flutter/impeller/core/texture_descriptor.cc
@@ -4123,10 +4135,6 @@ FILE: ../../../flutter/impeller/renderer/render_target.cc
41234135
FILE: ../../../flutter/impeller/renderer/render_target.h
41244136
FILE: ../../../flutter/impeller/renderer/renderer.cc
41254137
FILE: ../../../flutter/impeller/renderer/renderer.h
4126-
FILE: ../../../flutter/impeller/renderer/sampler.cc
4127-
FILE: ../../../flutter/impeller/renderer/sampler.h
4128-
FILE: ../../../flutter/impeller/renderer/sampler_descriptor.cc
4129-
FILE: ../../../flutter/impeller/renderer/sampler_descriptor.h
41304138
FILE: ../../../flutter/impeller/renderer/sampler_library.cc
41314139
FILE: ../../../flutter/impeller/renderer/sampler_library.h
41324140
FILE: ../../../flutter/impeller/renderer/shader_function.cc
@@ -4135,8 +4143,6 @@ FILE: ../../../flutter/impeller/renderer/shader_key.cc
41354143
FILE: ../../../flutter/impeller/renderer/shader_key.h
41364144
FILE: ../../../flutter/impeller/renderer/shader_library.cc
41374145
FILE: ../../../flutter/impeller/renderer/shader_library.h
4138-
FILE: ../../../flutter/impeller/renderer/shader_types.cc
4139-
FILE: ../../../flutter/impeller/renderer/shader_types.h
41404146
FILE: ../../../flutter/impeller/renderer/snapshot.cc
41414147
FILE: ../../../flutter/impeller/renderer/snapshot.h
41424148
FILE: ../../../flutter/impeller/renderer/stroke.comp
@@ -4151,8 +4157,6 @@ FILE: ../../../flutter/impeller/runtime_stage/runtime_stage.fbs
41514157
FILE: ../../../flutter/impeller/runtime_stage/runtime_stage.h
41524158
FILE: ../../../flutter/impeller/runtime_stage/runtime_stage_playground.cc
41534159
FILE: ../../../flutter/impeller/runtime_stage/runtime_stage_playground.h
4154-
FILE: ../../../flutter/impeller/runtime_stage/runtime_types.cc
4155-
FILE: ../../../flutter/impeller/runtime_stage/runtime_types.h
41564160
FILE: ../../../flutter/impeller/scene/animation/animation.cc
41574161
FILE: ../../../flutter/impeller/scene/animation/animation.h
41584162
FILE: ../../../flutter/impeller/scene/animation/animation_clip.cc

impeller/aiks/canvas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
#include "impeller/aiks/image.h"
1414
#include "impeller/aiks/paint.h"
1515
#include "impeller/aiks/picture.h"
16+
#include "impeller/core/sampler_descriptor.h"
1617
#include "impeller/entity/entity_pass.h"
1718
#include "impeller/entity/geometry.h"
1819
#include "impeller/geometry/matrix.h"
1920
#include "impeller/geometry/path.h"
2021
#include "impeller/geometry/point.h"
2122
#include "impeller/geometry/vector.h"
22-
#include "impeller/renderer/sampler_descriptor.h"
2323
#include "impeller/typographer/glyph_atlas.h"
2424
#include "impeller/typographer/text_frame.h"
2525

impeller/compiler/code_gen_template.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ constexpr std::string_view kReflectionHeaderTemplate =
1818
{# file itself and the no-check declarations will be stripped in generated files.#}
1919
#include "impeller/core/buffer_view.h" {# // nogncheck #}
2020
21-
#include "impeller/renderer/command.h" {# // nogncheck #}
21+
#include "impeller/core/sampler.h" {# // nogncheck #}
2222
23-
#include "impeller/renderer/compute_command.h" {# // nogncheck #}
23+
#include "impeller/core/shader_types.h" {# // nogncheck #}
2424
25-
#include "impeller/renderer/sampler.h" {# // nogncheck #}
26-
27-
#include "impeller/renderer/shader_types.h" {# // nogncheck #}
25+
#include "impeller/core/resource_binder.h" {# // nogncheck #}
2826
2927
#include "impeller/core/texture.h" {# // nogncheck #}
3028

impeller/compiler/reflector.cc

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,6 @@ static std::string ExecutionModelToString(spv::ExecutionModel model) {
8686
}
8787
}
8888

89-
static std::string ExecutionModelToCommandTypeName(
90-
spv::ExecutionModel execution_model) {
91-
switch (execution_model) {
92-
case spv::ExecutionModel::ExecutionModelVertex:
93-
case spv::ExecutionModel::ExecutionModelFragment:
94-
case spv::ExecutionModel::ExecutionModelTessellationControl:
95-
case spv::ExecutionModel::ExecutionModelTessellationEvaluation:
96-
return "Command&";
97-
case spv::ExecutionModel::ExecutionModelGLCompute:
98-
return "ComputeCommand&";
99-
default:
100-
return "unsupported";
101-
}
102-
}
103-
10489
static std::string StringToShaderStage(std::string str) {
10590
if (str == "vertex") {
10691
return "ShaderStage::kVertex";
@@ -1100,7 +1085,7 @@ std::vector<Reflector::BindPrototype> Reflector::ReflectBindPrototypes(
11001085
proto.docstring = stream.str();
11011086
}
11021087
proto.args.push_back(BindPrototypeArgument{
1103-
.type_name = ExecutionModelToCommandTypeName(execution_model),
1088+
.type_name = "ResourceBinder&",
11041089
.argument_name = "command",
11051090
});
11061091
proto.args.push_back(BindPrototypeArgument{
@@ -1119,7 +1104,7 @@ std::vector<Reflector::BindPrototype> Reflector::ReflectBindPrototypes(
11191104
proto.docstring = stream.str();
11201105
}
11211106
proto.args.push_back(BindPrototypeArgument{
1122-
.type_name = ExecutionModelToCommandTypeName(execution_model),
1107+
.type_name = "ResourceBinder&",
11231108
.argument_name = "command",
11241109
});
11251110
proto.args.push_back(BindPrototypeArgument{
@@ -1138,7 +1123,7 @@ std::vector<Reflector::BindPrototype> Reflector::ReflectBindPrototypes(
11381123
proto.docstring = stream.str();
11391124
}
11401125
proto.args.push_back(BindPrototypeArgument{
1141-
.type_name = ExecutionModelToCommandTypeName(execution_model),
1126+
.type_name = "ResourceBinder&",
11421127
.argument_name = "command",
11431128
});
11441129
proto.args.push_back(BindPrototypeArgument{

impeller/core/BUILD.gn

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ impeller_component("core") {
2424
"platform.h",
2525
"range.cc",
2626
"range.h",
27+
"resource_binder.cc",
28+
"resource_binder.h",
29+
"runtime_types.cc",
30+
"runtime_types.h",
31+
"sampler.cc",
32+
"sampler.h",
33+
"sampler_descriptor.cc",
34+
"sampler_descriptor.h",
35+
"shader_types.cc",
36+
"shader_types.h",
2737
"texture.cc",
2838
"texture.h",
2939
"texture_descriptor.cc",

impeller/core/resource_binder.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "impeller/core/resource_binder.h"
6+
7+
namespace impeller {
8+
9+
//
10+
11+
} // namespace impeller

impeller/core/resource_binder.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#pragma once
6+
7+
#include <map>
8+
#include <memory>
9+
#include <optional>
10+
#include <string>
11+
12+
#include "flutter/fml/logging.h"
13+
#include "flutter/fml/macros.h"
14+
#include "impeller/core/buffer_view.h"
15+
#include "impeller/core/formats.h"
16+
#include "impeller/core/sampler.h"
17+
#include "impeller/core/shader_types.h"
18+
#include "impeller/core/texture.h"
19+
20+
namespace impeller {
21+
22+
//------------------------------------------------------------------------------
23+
/// @brief An interface for binding resources. This is implemented by
24+
/// |Command| and |ComputeCommand| to make GPU resources available
25+
/// to a given command's pipeline.
26+
///
27+
struct ResourceBinder {
28+
virtual ~ResourceBinder() = default;
29+
30+
virtual bool BindResource(ShaderStage stage,
31+
const ShaderUniformSlot& slot,
32+
const ShaderMetadata& metadata,
33+
const BufferView& view) = 0;
34+
35+
virtual bool BindResource(ShaderStage stage,
36+
const SampledImageSlot& slot,
37+
const ShaderMetadata& metadata,
38+
const std::shared_ptr<const Texture>& texture) = 0;
39+
40+
virtual bool BindResource(ShaderStage stage,
41+
const SampledImageSlot& slot,
42+
const ShaderMetadata& metadata,
43+
const std::shared_ptr<const Sampler>& sampler) = 0;
44+
45+
virtual bool BindResource(ShaderStage stage,
46+
const SampledImageSlot& slot,
47+
const ShaderMetadata& metadata,
48+
const std::shared_ptr<const Texture>& texture,
49+
const std::shared_ptr<const Sampler>& sampler) = 0;
50+
};
51+
52+
} // namespace impeller
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include "impeller/runtime_stage/runtime_types.h"
5+
#include "impeller/core/runtime_types.h"
66

77
namespace impeller {
88

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include "impeller/renderer/sampler.h"
5+
#include "impeller/core/sampler.h"
66

77
namespace impeller {
88

0 commit comments

Comments
 (0)