Skip to content

Commit

Permalink
Merge branch 'main' into add-share-to-selection-controls
Browse files Browse the repository at this point in the history
  • Loading branch information
LouiseHsu committed Aug 10, 2023
2 parents 9b6d693 + d5db728 commit 208b7aa
Show file tree
Hide file tree
Showing 35 changed files with 524 additions and 247 deletions.
12 changes: 6 additions & 6 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ vars = {
'llvm_git': 'https://llvm.googlesource.com',
# OCMock is for testing only so there is no google clone
'ocmock_git': 'https://github.com/erikdoe/ocmock.git',
'skia_revision': '491f67637e6ef7b63546c4ed98fb7431b938c00a',
'skia_revision': 'b6492f5ce8c3b44bea9299a5850770d150d01b76',

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

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

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

'src/third_party/dart/third_party/pkg/pool':
Var('dart_git') + '/pool.git@77001024a16126cc5718e654ea3e57bbf6e7fac3',
Expand Down Expand Up @@ -884,7 +884,7 @@ deps = {
'packages': [
{
'package': 'fuchsia/sdk/core/mac-amd64',
'version': 'zoCGnScKZWbm5s9HyAjx76EBVB8sGlXfVdo-mqVQ5PMC'
'version': 'SoKcmsZ5H8uHJXV1S-usFW2d9gflCTQCiZ7pJIgc7FcC'
}
],
'condition': 'host_os == "mac" and not download_fuchsia_sdk',
Expand All @@ -894,7 +894,7 @@ deps = {
'packages': [
{
'package': 'fuchsia/sdk/core/linux-amd64',
'version': 'ZCP8LDbKF4LTBFz_W5JeK5PEaIsrWaGGiH9iKZoHTJkC'
'version': 'konJQZKk2qXc276iAIxQgmZOqP26ZATMf3alFxYkhDIC'
}
],
'condition': 'host_os == "linux" and not download_fuchsia_sdk',
Expand Down
6 changes: 6 additions & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,8 @@ ORIGIN: ../../../flutter/impeller/compiler/compiler_backend.cc + ../../../flutte
ORIGIN: ../../../flutter/impeller/compiler/compiler_backend.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/compiler_test.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/compiler_test.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/constants.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/constants.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/impellerc_main.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/include_dir.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/compiler/includer.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -1348,6 +1350,7 @@ ORIGIN: ../../../flutter/impeller/entity/shaders/sweep_gradient_fill.frag + ../.
ORIGIN: ../../../flutter/impeller/entity/shaders/sweep_gradient_ssbo_fill.frag + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/texture_fill.frag + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/texture_fill.vert + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/texture_fill_external.frag + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/tiled_texture_fill.frag + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/vertices.frag + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/yuv_to_rgb_filter.frag + ../../../flutter/LICENSE
Expand Down Expand Up @@ -3797,6 +3800,8 @@ FILE: ../../../flutter/impeller/compiler/compiler_backend.cc
FILE: ../../../flutter/impeller/compiler/compiler_backend.h
FILE: ../../../flutter/impeller/compiler/compiler_test.cc
FILE: ../../../flutter/impeller/compiler/compiler_test.h
FILE: ../../../flutter/impeller/compiler/constants.cc
FILE: ../../../flutter/impeller/compiler/constants.h
FILE: ../../../flutter/impeller/compiler/impellerc_main.cc
FILE: ../../../flutter/impeller/compiler/include_dir.h
FILE: ../../../flutter/impeller/compiler/includer.cc
Expand Down Expand Up @@ -4063,6 +4068,7 @@ FILE: ../../../flutter/impeller/entity/shaders/sweep_gradient_fill.frag
FILE: ../../../flutter/impeller/entity/shaders/sweep_gradient_ssbo_fill.frag
FILE: ../../../flutter/impeller/entity/shaders/texture_fill.frag
FILE: ../../../flutter/impeller/entity/shaders/texture_fill.vert
FILE: ../../../flutter/impeller/entity/shaders/texture_fill_external.frag
FILE: ../../../flutter/impeller/entity/shaders/tiled_texture_fill.frag
FILE: ../../../flutter/impeller/entity/shaders/vertices.frag
FILE: ../../../flutter/impeller/entity/shaders/yuv_to_rgb_filter.frag
Expand Down
2 changes: 1 addition & 1 deletion ci/licenses_golden/licenses_fuchsia
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: 2c7fdf5c1134dc23605ffd2945adc1f9
Signature: 41ab664d5f5ccd89ca5fb1207a63c8f8

====================================================================================================
LIBRARY: fuchsia_sdk
Expand Down
6 changes: 5 additions & 1 deletion ci/licenses_golden/licenses_skia
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: 610c49b8771144a1fca107bf8ed22d88
Signature: 7cb81751a45b1d0e3abc1b6c276eee26

====================================================================================================
LIBRARY: etc1
Expand Down Expand Up @@ -8916,6 +8916,8 @@ ORIGIN: ../../../third_party/skia/src/core/SkBitmapProcState_opts_ssse3.cpp + ..
ORIGIN: ../../../third_party/skia/src/core/SkBlitMask.h + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkBlitMask_opts.cpp + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkBlitMask_opts_ssse3.cpp + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkBlitRow_opts.cpp + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkBlitRow_opts_hsw.cpp + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkBlitter_A8.h + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkBlurMaskFilterImpl.h + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkCanvas_Raster.cpp + ../../../third_party/skia/LICENSE
Expand Down Expand Up @@ -9143,6 +9145,8 @@ FILE: ../../../third_party/skia/src/core/SkBitmapProcState_opts_ssse3.cpp
FILE: ../../../third_party/skia/src/core/SkBlitMask.h
FILE: ../../../third_party/skia/src/core/SkBlitMask_opts.cpp
FILE: ../../../third_party/skia/src/core/SkBlitMask_opts_ssse3.cpp
FILE: ../../../third_party/skia/src/core/SkBlitRow_opts.cpp
FILE: ../../../third_party/skia/src/core/SkBlitRow_opts_hsw.cpp
FILE: ../../../third_party/skia/src/core/SkBlitter_A8.h
FILE: ../../../third_party/skia/src/core/SkBlurMaskFilterImpl.h
FILE: ../../../third_party/skia/src/core/SkCanvas_Raster.cpp
Expand Down
2 changes: 2 additions & 0 deletions impeller/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ impeller_component("compiler_lib") {
"compiler.h",
"compiler_backend.cc",
"compiler_backend.h",
"constants.cc",
"constants.h",
"include_dir.h",
"includer.cc",
"includer.h",
Expand Down
27 changes: 26 additions & 1 deletion impeller/compiler/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
#include "flutter/fml/paths.h"
#include "impeller/base/allocation.h"
#include "impeller/compiler/compiler_backend.h"
#include "impeller/compiler/constants.h"
#include "impeller/compiler/includer.h"
#include "impeller/compiler/logger.h"
#include "impeller/compiler/spirv_compiler.h"
#include "impeller/compiler/types.h"
#include "impeller/compiler/uniform_sorter.h"
#include "impeller/compiler/utilities.h"

namespace impeller {
namespace compiler {
Expand Down Expand Up @@ -128,6 +129,23 @@ static CompilerBackend CreateVulkanCompiler(
static CompilerBackend CreateGLSLCompiler(const spirv_cross::ParsedIR& ir,
const SourceOptions& source_options) {
auto gl_compiler = std::make_shared<spirv_cross::CompilerGLSL>(ir);

// Walk the variables and insert the external image extension if any of them
// begins with the external texture prefix. Unfortunately, we can't walk
// `gl_compiler->get_shader_resources().separate_samplers` until the compiler
// is further along.
//
// Unfortunately, we can't just let the shader author add this extension and
// use `samplerExternalOES` directly because compiling to spirv requires the
// source language profile to be at least 310 ES, but this extension is
// incompatible with ES 310+.
for (auto& id : ir.ids_for_constant_or_variable) {
if (StringStartsWith(ir.get_name(id), kExternalTexturePrefix)) {
gl_compiler->require_extension("GL_OES_EGL_image_external");
break;
}
}

spirv_cross::CompilerGLSL::Options sl_options;
sl_options.force_zero_initialized_variables = true;
sl_options.vertex.fixup_clipspace = true;
Expand All @@ -137,6 +155,13 @@ static CompilerBackend CreateGLSLCompiler(const spirv_cross::ParsedIR& ir,
? source_options.gles_language_version
: 100;
sl_options.es = true;
gl_compiler->set_variable_type_remap_callback(
[&](const spirv_cross::SPIRType& type, const std::string& var_name,
std::string& name_of_type) {
if (StringStartsWith(var_name, kExternalTexturePrefix)) {
name_of_type = "samplerExternalOES";
}
});
} else {
sl_options.version = source_options.gles_language_version > 0
? source_options.gles_language_version
Expand Down
13 changes: 13 additions & 0 deletions impeller/compiler/constants.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 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/compiler/constants.h"

namespace impeller {
namespace compiler {

//

} // namespace compiler
} // namespace impeller
13 changes: 13 additions & 0 deletions impeller/compiler/constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 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

namespace impeller {
namespace compiler {

constexpr char kExternalTexturePrefix[] = "SAMPLER_EXTERNAL_OES_";

} // namespace compiler
} // namespace impeller
1 change: 1 addition & 0 deletions impeller/compiler/reflector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "impeller/base/strings.h"
#include "impeller/base/validation.h"
#include "impeller/compiler/code_gen_template.h"
#include "impeller/compiler/types.h"
#include "impeller/compiler/uniform_sorter.h"
#include "impeller/compiler/utilities.h"
#include "impeller/geometry/half.h"
Expand Down
12 changes: 12 additions & 0 deletions impeller/compiler/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,17 @@ std::string ConvertToEntrypointName(std::string_view string) {
return stream.str();
}

bool StringStartsWith(const std::string& target, const std::string& prefix) {
if (prefix.length() > target.length()) {
return false;
}
for (size_t i = 0; i < prefix.length(); i++) {
if (target[i] != prefix[i]) {
return false;
}
}
return true;
}

} // namespace compiler
} // namespace impeller
2 changes: 2 additions & 0 deletions impeller/compiler/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ std::string ConvertToCamelCase(std::string_view string);
/// language.
std::string ConvertToEntrypointName(std::string_view string);

bool StringStartsWith(const std::string& target, const std::string& prefix);

} // namespace compiler
} // namespace impeller
4 changes: 4 additions & 0 deletions impeller/core/formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ enum class TextureType {
kTexture2D,
kTexture2DMultisample,
kTextureCube,
kTextureExternalOES,
};

constexpr const char* TextureTypeToString(TextureType type) {
Expand All @@ -244,6 +245,8 @@ constexpr const char* TextureTypeToString(TextureType type) {
return "Texture2DMultisample";
case TextureType::kTextureCube:
return "TextureCube";
case TextureType::kTextureExternalOES:
return "TextureExternalOES";
}
FML_UNREACHABLE();
}
Expand All @@ -252,6 +255,7 @@ constexpr bool IsMultisampleCapable(TextureType type) {
switch (type) {
case TextureType::kTexture2D:
case TextureType::kTextureCube:
case TextureType::kTextureExternalOES:
return false;
case TextureType::kTexture2DMultisample:
return true;
Expand Down
1 change: 1 addition & 0 deletions impeller/core/texture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ bool Texture::IsSliceValid(size_t slice) const {
switch (desc_.type) {
case TextureType::kTexture2D:
case TextureType::kTexture2DMultisample:
case TextureType::kTextureExternalOES:
return slice == 0;
case TextureType::kTextureCube:
return slice <= 5;
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ impeller_shaders("entity_shaders") {
"shaders/sweep_gradient_fill.frag",
"shaders/texture_fill.frag",
"shaders/texture_fill.vert",
"shaders/texture_fill_external.frag",
"shaders/tiled_texture_fill.frag",
"shaders/vertices.frag",
"shaders/yuv_to_rgb_filter.frag",
Expand Down
10 changes: 10 additions & 0 deletions impeller/entity/contents/content_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <optional>
#include <unordered_map>

#include "flutter/fml/build_config.h"
#include "flutter/fml/hash_combine.h"
#include "flutter/fml/logging.h"
#include "flutter/fml/macros.h"
Expand Down Expand Up @@ -53,6 +54,7 @@
#include "impeller/entity/sweep_gradient_fill.frag.h"
#include "impeller/entity/texture_fill.frag.h"
#include "impeller/entity/texture_fill.vert.h"
#include "impeller/entity/texture_fill_external.frag.h"
#include "impeller/entity/tiled_texture_fill.frag.h"
#include "impeller/entity/uv.comp.h"
#include "impeller/entity/vertices.frag.h"
Expand Down Expand Up @@ -143,6 +145,8 @@ using RRectBlurPipeline =
using BlendPipeline = RenderPipelineT<BlendVertexShader, BlendFragmentShader>;
using TexturePipeline =
RenderPipelineT<TextureFillVertexShader, TextureFillFragmentShader>;
using TextureExternalPipeline =
RenderPipelineT<TextureFillVertexShader, TextureFillExternalFragmentShader>;
using PositionUVPipeline =
RenderPipelineT<TextureFillVertexShader, TiledTextureFillFragmentShader>;
using TiledTexturePipeline =
Expand Down Expand Up @@ -413,6 +417,11 @@ class ContentContext {
return GetPipeline(texture_pipelines_, opts);
}

std::shared_ptr<Pipeline<PipelineDescriptor>> GetTextureExternalPipeline(
ContentContextOptions opts) const {
return GetPipeline(texture_external_pipelines_, opts);
}

std::shared_ptr<Pipeline<PipelineDescriptor>> GetPositionUVPipeline(
ContentContextOptions opts) const {
return GetPipeline(position_uv_pipelines_, opts);
Expand Down Expand Up @@ -733,6 +742,7 @@ class ContentContext {
mutable Variants<RRectBlurPipeline> rrect_blur_pipelines_;
mutable Variants<BlendPipeline> texture_blend_pipelines_;
mutable Variants<TexturePipeline> texture_pipelines_;
mutable Variants<TextureExternalPipeline> texture_external_pipelines_;
mutable Variants<PositionUVPipeline> position_uv_pipelines_;
mutable Variants<TiledTexturePipeline> tiled_texture_pipelines_;
mutable Variants<GaussianBlurAlphaDecalPipeline>
Expand Down
7 changes: 6 additions & 1 deletion impeller/entity/contents/texture_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ bool TextureContents::Render(const ContentContext& renderer,
}
pipeline_options.primitive_type = PrimitiveType::kTriangleStrip;

cmd.pipeline = renderer.GetTexturePipeline(pipeline_options);
if (texture_->GetTextureDescriptor().type ==
TextureType::kTextureExternalOES) {
cmd.pipeline = renderer.GetTextureExternalPipeline(pipeline_options);
} else {
cmd.pipeline = renderer.GetTexturePipeline(pipeline_options);
}
cmd.stencil_reference = entity.GetStencilDepth();
cmd.BindVertices(vertex_builder.CreateVertexBuffer(host_buffer));
VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info));
Expand Down
16 changes: 16 additions & 0 deletions impeller/entity/shaders/texture_fill_external.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

uniform sampler2D SAMPLER_EXTERNAL_OES_texture_sampler;

in vec2 v_texture_coords;
in float v_alpha;

out vec4 frag_color;

void main() {
vec4 sampled =
texture(SAMPLER_EXTERNAL_OES_texture_sampler, v_texture_coords);
frag_color = sampled * v_alpha;
}
8 changes: 7 additions & 1 deletion impeller/fixtures/dart_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
// found in the LICENSE file.

import 'dart:ui' as ui;
//import 'dart:gpu';
import '../../lib/gpu/lib/gpu.dart' as gpu;

void main() {}

@pragma('vm:entry-point')
void sayHi() {
print('Hi');
}

@pragma('vm:entry-point')
void instantiateDefaultContext() {
// ignore: unused_local_variable
final gpu.GpuContext context = gpu.gpuContext;
}

0 comments on commit 208b7aa

Please sign in to comment.