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

Commit 208b7aa

Browse files
authored
Merge branch 'main' into add-share-to-selection-controls
2 parents 9b6d693 + d5db728 commit 208b7aa

35 files changed

+524
-247
lines changed

DEPS

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ vars = {
1818
'llvm_git': 'https://llvm.googlesource.com',
1919
# OCMock is for testing only so there is no google clone
2020
'ocmock_git': 'https://github.com/erikdoe/ocmock.git',
21-
'skia_revision': '491f67637e6ef7b63546c4ed98fb7431b938c00a',
21+
'skia_revision': 'b6492f5ce8c3b44bea9299a5850770d150d01b76',
2222

2323
# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
2424
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
@@ -53,7 +53,7 @@ vars = {
5353
# Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS
5454
# You can use //tools/dart/create_updated_flutter_deps.py to produce
5555
# updated revision list of existing dependencies.
56-
'dart_revision': 'd89e4ead966d9f58020b93c69007bc14a20ee745',
56+
'dart_revision': '46da53e7abe2e430c20baf0a9249d2a14a470073',
5757

5858
# WARNING: DO NOT EDIT MANUALLY
5959
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
@@ -72,7 +72,7 @@ vars = {
7272
'dart_root_certificates_rev': '692f6d6488af68e0121317a9c2c9eb393eb0ee50',
7373
'dart_tools_rev': 'f14bf2eb3d4d5bdcb6ea5d6862d33a319dfd9564',
7474
'dart_watcher_rev': '7457413060ed7403b90b01533a61bd959932122e',
75-
'dart_webdev_rev': '5081dff0952eb7163f98a508d7b2d976c1573c55',
75+
'dart_webdev_rev': 'f8f752cb455935a7dfe626bcb357645c41749725',
7676
'dart_webkit_inspection_protocol_rev': '39a3c297ff573635e7936b015ce4f3466e4739d6',
7777
'dart_yaml_edit_rev': '87dcf31fcaada207ae7c3527f9885982534badce',
7878
'dart_zlib_rev': '14dd4c4455602c9b71a1a89b5cafd1f4030d2e3f',
@@ -431,7 +431,7 @@ deps = {
431431
Var('dart_git') + '/package_config.git@981c49dfec1e3e3e90f336dcd7c225923d2fd321',
432432

433433
'src/third_party/dart/third_party/pkg/path':
434-
Var('dart_git') + '/path.git@282dd18bd9ae2e265ea40a29b2c637194e9be8b7',
434+
Var('dart_git') + '/path.git@7c2324bdb4c75a17de8a3d1e6afe8cc0756ef5f9',
435435

436436
'src/third_party/dart/third_party/pkg/pool':
437437
Var('dart_git') + '/pool.git@77001024a16126cc5718e654ea3e57bbf6e7fac3',
@@ -884,7 +884,7 @@ deps = {
884884
'packages': [
885885
{
886886
'package': 'fuchsia/sdk/core/mac-amd64',
887-
'version': 'zoCGnScKZWbm5s9HyAjx76EBVB8sGlXfVdo-mqVQ5PMC'
887+
'version': 'SoKcmsZ5H8uHJXV1S-usFW2d9gflCTQCiZ7pJIgc7FcC'
888888
}
889889
],
890890
'condition': 'host_os == "mac" and not download_fuchsia_sdk',
@@ -894,7 +894,7 @@ deps = {
894894
'packages': [
895895
{
896896
'package': 'fuchsia/sdk/core/linux-amd64',
897-
'version': 'ZCP8LDbKF4LTBFz_W5JeK5PEaIsrWaGGiH9iKZoHTJkC'
897+
'version': 'konJQZKk2qXc276iAIxQgmZOqP26ZATMf3alFxYkhDIC'
898898
}
899899
],
900900
'condition': 'host_os == "linux" and not download_fuchsia_sdk',

ci/licenses_golden/licenses_flutter

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,8 @@ ORIGIN: ../../../flutter/impeller/compiler/compiler_backend.cc + ../../../flutte
10821082
ORIGIN: ../../../flutter/impeller/compiler/compiler_backend.h + ../../../flutter/LICENSE
10831083
ORIGIN: ../../../flutter/impeller/compiler/compiler_test.cc + ../../../flutter/LICENSE
10841084
ORIGIN: ../../../flutter/impeller/compiler/compiler_test.h + ../../../flutter/LICENSE
1085+
ORIGIN: ../../../flutter/impeller/compiler/constants.cc + ../../../flutter/LICENSE
1086+
ORIGIN: ../../../flutter/impeller/compiler/constants.h + ../../../flutter/LICENSE
10851087
ORIGIN: ../../../flutter/impeller/compiler/impellerc_main.cc + ../../../flutter/LICENSE
10861088
ORIGIN: ../../../flutter/impeller/compiler/include_dir.h + ../../../flutter/LICENSE
10871089
ORIGIN: ../../../flutter/impeller/compiler/includer.cc + ../../../flutter/LICENSE
@@ -1348,6 +1350,7 @@ ORIGIN: ../../../flutter/impeller/entity/shaders/sweep_gradient_fill.frag + ../.
13481350
ORIGIN: ../../../flutter/impeller/entity/shaders/sweep_gradient_ssbo_fill.frag + ../../../flutter/LICENSE
13491351
ORIGIN: ../../../flutter/impeller/entity/shaders/texture_fill.frag + ../../../flutter/LICENSE
13501352
ORIGIN: ../../../flutter/impeller/entity/shaders/texture_fill.vert + ../../../flutter/LICENSE
1353+
ORIGIN: ../../../flutter/impeller/entity/shaders/texture_fill_external.frag + ../../../flutter/LICENSE
13511354
ORIGIN: ../../../flutter/impeller/entity/shaders/tiled_texture_fill.frag + ../../../flutter/LICENSE
13521355
ORIGIN: ../../../flutter/impeller/entity/shaders/vertices.frag + ../../../flutter/LICENSE
13531356
ORIGIN: ../../../flutter/impeller/entity/shaders/yuv_to_rgb_filter.frag + ../../../flutter/LICENSE
@@ -3797,6 +3800,8 @@ FILE: ../../../flutter/impeller/compiler/compiler_backend.cc
37973800
FILE: ../../../flutter/impeller/compiler/compiler_backend.h
37983801
FILE: ../../../flutter/impeller/compiler/compiler_test.cc
37993802
FILE: ../../../flutter/impeller/compiler/compiler_test.h
3803+
FILE: ../../../flutter/impeller/compiler/constants.cc
3804+
FILE: ../../../flutter/impeller/compiler/constants.h
38003805
FILE: ../../../flutter/impeller/compiler/impellerc_main.cc
38013806
FILE: ../../../flutter/impeller/compiler/include_dir.h
38023807
FILE: ../../../flutter/impeller/compiler/includer.cc
@@ -4063,6 +4068,7 @@ FILE: ../../../flutter/impeller/entity/shaders/sweep_gradient_fill.frag
40634068
FILE: ../../../flutter/impeller/entity/shaders/sweep_gradient_ssbo_fill.frag
40644069
FILE: ../../../flutter/impeller/entity/shaders/texture_fill.frag
40654070
FILE: ../../../flutter/impeller/entity/shaders/texture_fill.vert
4071+
FILE: ../../../flutter/impeller/entity/shaders/texture_fill_external.frag
40664072
FILE: ../../../flutter/impeller/entity/shaders/tiled_texture_fill.frag
40674073
FILE: ../../../flutter/impeller/entity/shaders/vertices.frag
40684074
FILE: ../../../flutter/impeller/entity/shaders/yuv_to_rgb_filter.frag

ci/licenses_golden/licenses_fuchsia

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: 2c7fdf5c1134dc23605ffd2945adc1f9
1+
Signature: 41ab664d5f5ccd89ca5fb1207a63c8f8
22

33
====================================================================================================
44
LIBRARY: fuchsia_sdk

ci/licenses_golden/licenses_skia

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: 610c49b8771144a1fca107bf8ed22d88
1+
Signature: 7cb81751a45b1d0e3abc1b6c276eee26
22

33
====================================================================================================
44
LIBRARY: etc1
@@ -8916,6 +8916,8 @@ ORIGIN: ../../../third_party/skia/src/core/SkBitmapProcState_opts_ssse3.cpp + ..
89168916
ORIGIN: ../../../third_party/skia/src/core/SkBlitMask.h + ../../../third_party/skia/LICENSE
89178917
ORIGIN: ../../../third_party/skia/src/core/SkBlitMask_opts.cpp + ../../../third_party/skia/LICENSE
89188918
ORIGIN: ../../../third_party/skia/src/core/SkBlitMask_opts_ssse3.cpp + ../../../third_party/skia/LICENSE
8919+
ORIGIN: ../../../third_party/skia/src/core/SkBlitRow_opts.cpp + ../../../third_party/skia/LICENSE
8920+
ORIGIN: ../../../third_party/skia/src/core/SkBlitRow_opts_hsw.cpp + ../../../third_party/skia/LICENSE
89198921
ORIGIN: ../../../third_party/skia/src/core/SkBlitter_A8.h + ../../../third_party/skia/LICENSE
89208922
ORIGIN: ../../../third_party/skia/src/core/SkBlurMaskFilterImpl.h + ../../../third_party/skia/LICENSE
89218923
ORIGIN: ../../../third_party/skia/src/core/SkCanvas_Raster.cpp + ../../../third_party/skia/LICENSE
@@ -9143,6 +9145,8 @@ FILE: ../../../third_party/skia/src/core/SkBitmapProcState_opts_ssse3.cpp
91439145
FILE: ../../../third_party/skia/src/core/SkBlitMask.h
91449146
FILE: ../../../third_party/skia/src/core/SkBlitMask_opts.cpp
91459147
FILE: ../../../third_party/skia/src/core/SkBlitMask_opts_ssse3.cpp
9148+
FILE: ../../../third_party/skia/src/core/SkBlitRow_opts.cpp
9149+
FILE: ../../../third_party/skia/src/core/SkBlitRow_opts_hsw.cpp
91469150
FILE: ../../../third_party/skia/src/core/SkBlitter_A8.h
91479151
FILE: ../../../third_party/skia/src/core/SkBlurMaskFilterImpl.h
91489152
FILE: ../../../third_party/skia/src/core/SkCanvas_Raster.cpp

impeller/compiler/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ impeller_component("compiler_lib") {
3636
"compiler.h",
3737
"compiler_backend.cc",
3838
"compiler_backend.h",
39+
"constants.cc",
40+
"constants.h",
3941
"include_dir.h",
4042
"includer.cc",
4143
"includer.h",

impeller/compiler/compiler.cc

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
#include "flutter/fml/paths.h"
1515
#include "impeller/base/allocation.h"
1616
#include "impeller/compiler/compiler_backend.h"
17+
#include "impeller/compiler/constants.h"
1718
#include "impeller/compiler/includer.h"
1819
#include "impeller/compiler/logger.h"
1920
#include "impeller/compiler/spirv_compiler.h"
20-
#include "impeller/compiler/types.h"
2121
#include "impeller/compiler/uniform_sorter.h"
22+
#include "impeller/compiler/utilities.h"
2223

2324
namespace impeller {
2425
namespace compiler {
@@ -128,6 +129,23 @@ static CompilerBackend CreateVulkanCompiler(
128129
static CompilerBackend CreateGLSLCompiler(const spirv_cross::ParsedIR& ir,
129130
const SourceOptions& source_options) {
130131
auto gl_compiler = std::make_shared<spirv_cross::CompilerGLSL>(ir);
132+
133+
// Walk the variables and insert the external image extension if any of them
134+
// begins with the external texture prefix. Unfortunately, we can't walk
135+
// `gl_compiler->get_shader_resources().separate_samplers` until the compiler
136+
// is further along.
137+
//
138+
// Unfortunately, we can't just let the shader author add this extension and
139+
// use `samplerExternalOES` directly because compiling to spirv requires the
140+
// source language profile to be at least 310 ES, but this extension is
141+
// incompatible with ES 310+.
142+
for (auto& id : ir.ids_for_constant_or_variable) {
143+
if (StringStartsWith(ir.get_name(id), kExternalTexturePrefix)) {
144+
gl_compiler->require_extension("GL_OES_EGL_image_external");
145+
break;
146+
}
147+
}
148+
131149
spirv_cross::CompilerGLSL::Options sl_options;
132150
sl_options.force_zero_initialized_variables = true;
133151
sl_options.vertex.fixup_clipspace = true;
@@ -137,6 +155,13 @@ static CompilerBackend CreateGLSLCompiler(const spirv_cross::ParsedIR& ir,
137155
? source_options.gles_language_version
138156
: 100;
139157
sl_options.es = true;
158+
gl_compiler->set_variable_type_remap_callback(
159+
[&](const spirv_cross::SPIRType& type, const std::string& var_name,
160+
std::string& name_of_type) {
161+
if (StringStartsWith(var_name, kExternalTexturePrefix)) {
162+
name_of_type = "samplerExternalOES";
163+
}
164+
});
140165
} else {
141166
sl_options.version = source_options.gles_language_version > 0
142167
? source_options.gles_language_version

impeller/compiler/constants.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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/compiler/constants.h"
6+
7+
namespace impeller {
8+
namespace compiler {
9+
10+
//
11+
12+
} // namespace compiler
13+
} // namespace impeller

impeller/compiler/constants.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
namespace impeller {
8+
namespace compiler {
9+
10+
constexpr char kExternalTexturePrefix[] = "SAMPLER_EXTERNAL_OES_";
11+
12+
} // namespace compiler
13+
} // namespace impeller

impeller/compiler/reflector.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "impeller/base/strings.h"
1717
#include "impeller/base/validation.h"
1818
#include "impeller/compiler/code_gen_template.h"
19+
#include "impeller/compiler/types.h"
1920
#include "impeller/compiler/uniform_sorter.h"
2021
#include "impeller/compiler/utilities.h"
2122
#include "impeller/geometry/half.h"

impeller/compiler/utilities.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,17 @@ std::string ConvertToEntrypointName(std::string_view string) {
6161
return stream.str();
6262
}
6363

64+
bool StringStartsWith(const std::string& target, const std::string& prefix) {
65+
if (prefix.length() > target.length()) {
66+
return false;
67+
}
68+
for (size_t i = 0; i < prefix.length(); i++) {
69+
if (target[i] != prefix[i]) {
70+
return false;
71+
}
72+
}
73+
return true;
74+
}
75+
6476
} // namespace compiler
6577
} // namespace impeller

impeller/compiler/utilities.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@ std::string ConvertToCamelCase(std::string_view string);
2929
/// language.
3030
std::string ConvertToEntrypointName(std::string_view string);
3131

32+
bool StringStartsWith(const std::string& target, const std::string& prefix);
33+
3234
} // namespace compiler
3335
} // namespace impeller

impeller/core/formats.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ enum class TextureType {
234234
kTexture2D,
235235
kTexture2DMultisample,
236236
kTextureCube,
237+
kTextureExternalOES,
237238
};
238239

239240
constexpr const char* TextureTypeToString(TextureType type) {
@@ -244,6 +245,8 @@ constexpr const char* TextureTypeToString(TextureType type) {
244245
return "Texture2DMultisample";
245246
case TextureType::kTextureCube:
246247
return "TextureCube";
248+
case TextureType::kTextureExternalOES:
249+
return "TextureExternalOES";
247250
}
248251
FML_UNREACHABLE();
249252
}
@@ -252,6 +255,7 @@ constexpr bool IsMultisampleCapable(TextureType type) {
252255
switch (type) {
253256
case TextureType::kTexture2D:
254257
case TextureType::kTextureCube:
258+
case TextureType::kTextureExternalOES:
255259
return false;
256260
case TextureType::kTexture2DMultisample:
257261
return true;

impeller/core/texture.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ bool Texture::IsSliceValid(size_t slice) const {
6262
switch (desc_.type) {
6363
case TextureType::kTexture2D:
6464
case TextureType::kTexture2DMultisample:
65+
case TextureType::kTextureExternalOES:
6566
return slice == 0;
6667
case TextureType::kTextureCube:
6768
return slice <= 5;

impeller/entity/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ impeller_shaders("entity_shaders") {
6565
"shaders/sweep_gradient_fill.frag",
6666
"shaders/texture_fill.frag",
6767
"shaders/texture_fill.vert",
68+
"shaders/texture_fill_external.frag",
6869
"shaders/tiled_texture_fill.frag",
6970
"shaders/vertices.frag",
7071
"shaders/yuv_to_rgb_filter.frag",

impeller/entity/contents/content_context.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <optional>
99
#include <unordered_map>
1010

11+
#include "flutter/fml/build_config.h"
1112
#include "flutter/fml/hash_combine.h"
1213
#include "flutter/fml/logging.h"
1314
#include "flutter/fml/macros.h"
@@ -53,6 +54,7 @@
5354
#include "impeller/entity/sweep_gradient_fill.frag.h"
5455
#include "impeller/entity/texture_fill.frag.h"
5556
#include "impeller/entity/texture_fill.vert.h"
57+
#include "impeller/entity/texture_fill_external.frag.h"
5658
#include "impeller/entity/tiled_texture_fill.frag.h"
5759
#include "impeller/entity/uv.comp.h"
5860
#include "impeller/entity/vertices.frag.h"
@@ -143,6 +145,8 @@ using RRectBlurPipeline =
143145
using BlendPipeline = RenderPipelineT<BlendVertexShader, BlendFragmentShader>;
144146
using TexturePipeline =
145147
RenderPipelineT<TextureFillVertexShader, TextureFillFragmentShader>;
148+
using TextureExternalPipeline =
149+
RenderPipelineT<TextureFillVertexShader, TextureFillExternalFragmentShader>;
146150
using PositionUVPipeline =
147151
RenderPipelineT<TextureFillVertexShader, TiledTextureFillFragmentShader>;
148152
using TiledTexturePipeline =
@@ -413,6 +417,11 @@ class ContentContext {
413417
return GetPipeline(texture_pipelines_, opts);
414418
}
415419

420+
std::shared_ptr<Pipeline<PipelineDescriptor>> GetTextureExternalPipeline(
421+
ContentContextOptions opts) const {
422+
return GetPipeline(texture_external_pipelines_, opts);
423+
}
424+
416425
std::shared_ptr<Pipeline<PipelineDescriptor>> GetPositionUVPipeline(
417426
ContentContextOptions opts) const {
418427
return GetPipeline(position_uv_pipelines_, opts);
@@ -733,6 +742,7 @@ class ContentContext {
733742
mutable Variants<RRectBlurPipeline> rrect_blur_pipelines_;
734743
mutable Variants<BlendPipeline> texture_blend_pipelines_;
735744
mutable Variants<TexturePipeline> texture_pipelines_;
745+
mutable Variants<TextureExternalPipeline> texture_external_pipelines_;
736746
mutable Variants<PositionUVPipeline> position_uv_pipelines_;
737747
mutable Variants<TiledTexturePipeline> tiled_texture_pipelines_;
738748
mutable Variants<GaussianBlurAlphaDecalPipeline>

impeller/entity/contents/texture_contents.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,12 @@ bool TextureContents::Render(const ContentContext& renderer,
149149
}
150150
pipeline_options.primitive_type = PrimitiveType::kTriangleStrip;
151151

152-
cmd.pipeline = renderer.GetTexturePipeline(pipeline_options);
152+
if (texture_->GetTextureDescriptor().type ==
153+
TextureType::kTextureExternalOES) {
154+
cmd.pipeline = renderer.GetTextureExternalPipeline(pipeline_options);
155+
} else {
156+
cmd.pipeline = renderer.GetTexturePipeline(pipeline_options);
157+
}
153158
cmd.stencil_reference = entity.GetStencilDepth();
154159
cmd.BindVertices(vertex_builder.CreateVertexBuffer(host_buffer));
155160
VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info));
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
uniform sampler2D SAMPLER_EXTERNAL_OES_texture_sampler;
6+
7+
in vec2 v_texture_coords;
8+
in float v_alpha;
9+
10+
out vec4 frag_color;
11+
12+
void main() {
13+
vec4 sampled =
14+
texture(SAMPLER_EXTERNAL_OES_texture_sampler, v_texture_coords);
15+
frag_color = sampled * v_alpha;
16+
}

impeller/fixtures/dart_tests.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
// found in the LICENSE file.
44

55
import 'dart:ui' as ui;
6-
//import 'dart:gpu';
6+
import '../../lib/gpu/lib/gpu.dart' as gpu;
77

88
void main() {}
99

1010
@pragma('vm:entry-point')
1111
void sayHi() {
1212
print('Hi');
1313
}
14+
15+
@pragma('vm:entry-point')
16+
void instantiateDefaultContext() {
17+
// ignore: unused_local_variable
18+
final gpu.GpuContext context = gpu.gpuContext;
19+
}

0 commit comments

Comments
 (0)