Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ group("unittests") {
if (is_mac) {
public_deps += [
"//flutter/impeller/golden_tests:impeller_golden_tests",
"//flutter/shell/gpu:gpu_surface_metal_unittests",
"//flutter/shell/platform/darwin/common:availability_version_check_unittests",
"//flutter/shell/platform/darwin/common:framework_common_unittests",
"//flutter/shell/surface:metal_unittests",
"//flutter/third_party/spring_animation:spring_animation_unittests",
]
}
Expand Down
8 changes: 4 additions & 4 deletions shell/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import("//flutter/common/config.gni")
import("//flutter/impeller/tools/impeller.gni")
import("//flutter/shell/gpu/gpu.gni")
import("//flutter/shell/surface/surface.gni")
import("//flutter/testing/testing.gni")

if (is_fuchsia) {
Expand Down Expand Up @@ -192,7 +192,7 @@ template("shell_host_executable") {
}

if (enable_unittests) {
shell_gpu_configuration("shell_unittests_gpu_configuration") {
surface_configuration("shell_unittests_surface_configuration") {
enable_software = test_enable_software
enable_vulkan = test_enable_vulkan
enable_gl = test_enable_gl
Expand Down Expand Up @@ -255,7 +255,7 @@ if (enable_unittests) {
]

deps = [
":shell_unittests_gpu_configuration",
":shell_unittests_surface_configuration",
"//flutter/assets",
"//flutter/common",
"//flutter/lib/ui",
Expand All @@ -271,7 +271,7 @@ if (enable_unittests) {

public_configs = [
":shell_test_fixture_sources_config",
":shell_unittests_gpu_configuration_config",
":shell_unittests_surface_configuration_config",
]

if (test_enable_gl) {
Expand Down
18 changes: 9 additions & 9 deletions shell/common/shell_test_platform_view_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <EGL/egl.h>

#include "flutter/shell/gpu/gpu_surface_gl_skia.h"
#include "flutter/shell/surface/surface_gl_skia.h"
#include "impeller/entity/gles/entity_shaders_gles.h"

#if IMPELLER_ENABLE_3D
Expand Down Expand Up @@ -73,7 +73,7 @@ void ShellTestPlatformViewGL::SimulateVSync() {

// |PlatformView|
std::unique_ptr<Surface> ShellTestPlatformViewGL::CreateRenderingSurface() {
return std::make_unique<GPUSurfaceGLSkia>(this, true);
return std::make_unique<SurfaceGLSkia>(this, true);
}

// |PlatformView|
Expand All @@ -89,33 +89,33 @@ PointerDataDispatcherMaker ShellTestPlatformViewGL::GetDispatcherMaker() {
};
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
std::unique_ptr<GLContextResult>
ShellTestPlatformViewGL::GLContextMakeCurrent() {
return std::make_unique<GLContextDefaultResult>(gl_surface_.MakeCurrent());
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
bool ShellTestPlatformViewGL::GLContextClearCurrent() {
return gl_surface_.ClearCurrent();
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
bool ShellTestPlatformViewGL::GLContextPresent(
const GLPresentInfo& present_info) {
return gl_surface_.Present();
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
GLFBOInfo ShellTestPlatformViewGL::GLContextFBO(GLFrameInfo frame_info) const {
return GLFBOInfo{
.fbo_id = gl_surface_.GetFramebuffer(frame_info.width, frame_info.height),
};
}

// |GPUSurfaceGLDelegate|
GPUSurfaceGLDelegate::GLProcResolver
ShellTestPlatformViewGL::GetGLProcResolver() const {
// |SurfaceGLDelegate|
SurfaceGLDelegate::GLProcResolver ShellTestPlatformViewGL::GetGLProcResolver()
const {
return [surface = &gl_surface_](const char* name) -> void* {
return surface->GetProcAddress(name);
};
Expand Down
14 changes: 7 additions & 7 deletions shell/common/shell_test_platform_view_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

#include "flutter/shell/common/shell_test_external_view_embedder.h"
#include "flutter/shell/common/shell_test_platform_view.h"
#include "flutter/shell/gpu/gpu_surface_gl_delegate.h"
#include "flutter/shell/surface/surface_gl_delegate.h"
#include "flutter/testing/test_gl_surface.h"
#include "impeller/renderer/backend/gles/context_gles.h"

namespace flutter {
namespace testing {

class ShellTestPlatformViewGL : public ShellTestPlatformView,
public GPUSurfaceGLDelegate {
public SurfaceGLDelegate {
public:
ShellTestPlatformViewGL(PlatformView::Delegate& delegate,
const TaskRunners& task_runners,
Expand Down Expand Up @@ -59,19 +59,19 @@ class ShellTestPlatformViewGL : public ShellTestPlatformView,
// |PlatformView|
PointerDataDispatcherMaker GetDispatcherMaker() override;

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
std::unique_ptr<GLContextResult> GLContextMakeCurrent() override;

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
bool GLContextClearCurrent() override;

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
bool GLContextPresent(const GLPresentInfo& present_info) override;

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
GLFBOInfo GLContextFBO(GLFrameInfo frame_info) const override;

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
GLProcResolver GetGLProcResolver() const override;

FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformViewGL);
Expand Down
12 changes: 6 additions & 6 deletions shell/common/shell_test_platform_view_metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

#include "flutter/fml/macros.h"
#include "flutter/shell/common/shell_test_platform_view.h"
#include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
#include "flutter/shell/surface/surface_metal_delegate.h"

namespace flutter {
namespace testing {

class DarwinContextMetal;

class ShellTestPlatformViewMetal final : public ShellTestPlatformView,
public GPUSurfaceMetalDelegate {
public SurfaceMetalDelegate {
public:
ShellTestPlatformViewMetal(PlatformView::Delegate& delegate,
const TaskRunners& task_runners,
Expand Down Expand Up @@ -54,17 +54,17 @@ class ShellTestPlatformViewMetal final : public ShellTestPlatformView,
// |PlatformView|
std::shared_ptr<impeller::Context> GetImpellerContext() const override;

// |GPUSurfaceMetalDelegate|
// |SurfaceMetalDelegate|
GPUCAMetalLayerHandle GetCAMetalLayer(
const SkISize& frame_info) const override;

// |GPUSurfaceMetalDelegate|
// |SurfaceMetalDelegate|
bool PresentDrawable(GrMTLHandle drawable) const override;

// |GPUSurfaceMetalDelegate|
// |SurfaceMetalDelegate|
GPUMTLTextureInfo GetMTLTexture(const SkISize& frame_info) const override;

// |GPUSurfaceMetalDelegate|
// |SurfaceMetalDelegate|
bool PresentTexture(GPUMTLTextureInfo texture) const override;

FML_DISALLOW_COPY_AND_ASSIGN(ShellTestPlatformViewMetal);
Expand Down
20 changes: 10 additions & 10 deletions shell/common/shell_test_platform_view_metal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <utility>

#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/gpu/gpu_surface_metal_impeller.h"
#include "flutter/shell/gpu/gpu_surface_metal_skia.h"
#include "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.h"
#include "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h"
#include "flutter/shell/surface/surface_metal_impeller.h"
#include "flutter/shell/surface/surface_metal_skia.h"

namespace flutter {
namespace testing {
Expand Down Expand Up @@ -74,7 +74,7 @@ GPUMTLTextureInfo offscreen_texture_info() const {
std::shared_ptr<ShellTestExternalViewEmbedder> shell_test_external_view_embedder,
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
: ShellTestPlatformView(delegate, task_runners),
GPUSurfaceMetalDelegate(MTLRenderTargetType::kMTLTexture),
SurfaceMetalDelegate(MTLRenderTargetType::kMTLTexture),
metal_context_(std::make_unique<DarwinContextMetal>(GetSettings().enable_impeller,
is_gpu_disabled_sync_switch)),
create_vsync_waiter_(std::move(create_vsync_waiter)),
Expand Down Expand Up @@ -113,37 +113,37 @@ GPUMTLTextureInfo offscreen_texture_info() const {
// |PlatformView|
std::unique_ptr<Surface> ShellTestPlatformViewMetal::CreateRenderingSurface() {
if (GetSettings().enable_impeller) {
return std::make_unique<GPUSurfaceMetalImpeller>(this,
[metal_context_->impeller_context() context]);
return std::make_unique<SurfaceMetalImpeller>(this,
[metal_context_->impeller_context() context]);
}
return std::make_unique<GPUSurfaceMetalSkia>(this, [metal_context_->context() mainContext]);
return std::make_unique<SurfaceMetalSkia>(this, [metal_context_->context() mainContext]);
}

// |PlatformView|
std::shared_ptr<impeller::Context> ShellTestPlatformViewMetal::GetImpellerContext() const {
return [metal_context_->impeller_context() context];
}

// |GPUSurfaceMetalDelegate|
// |SurfaceMetalDelegate|
GPUCAMetalLayerHandle ShellTestPlatformViewMetal::GetCAMetalLayer(const SkISize& frame_info) const {
FML_CHECK(false) << "A Metal Delegate configured with MTLRenderTargetType::kMTLTexture was asked "
"to acquire a layer.";
return nullptr;
}

// |GPUSurfaceMetalDelegate|
// |SurfaceMetalDelegate|
bool ShellTestPlatformViewMetal::PresentDrawable(GrMTLHandle drawable) const {
FML_CHECK(false) << "A Metal Delegate configured with MTLRenderTargetType::kMTLTexture was asked "
"to present a layer drawable.";
return true;
}

// |GPUSurfaceMetalDelegate|
// |SurfaceMetalDelegate|
GPUMTLTextureInfo ShellTestPlatformViewMetal::GetMTLTexture(const SkISize& frame_info) const {
return metal_context_->offscreen_texture_info();
}

// |GPUSurfaceMetalDelegate|
// |SurfaceMetalDelegate|
bool ShellTestPlatformViewMetal::PresentTexture(GPUMTLTextureInfo texture) const {
// The texture resides offscreen. There is nothing to render to.
return true;
Expand Down
2 changes: 1 addition & 1 deletion shell/common/shell_test_platform_view_vulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "flutter/shell/common/shell_test_external_view_embedder.h"
#include "flutter/shell/common/shell_test_platform_view.h"
#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h"
#include "flutter/shell/surface/surface_vulkan_delegate.h"
#include "flutter/vulkan/vulkan_application.h"
#include "flutter/vulkan/vulkan_device.h"
#include "flutter/vulkan/vulkan_skia_proc_table.h"
Expand Down
6 changes: 3 additions & 3 deletions shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import("//flutter/build/zip_bundle.gni")
import("//flutter/common/config.gni")
import("//flutter/impeller/tools/impeller.gni")
import("//flutter/shell/config.gni")
import("//flutter/shell/gpu/gpu.gni")
import("//flutter/shell/surface/surface.gni")
import("//flutter/shell/version/version.gni")
import("//flutter/vulkan/config.gni")

shell_gpu_configuration("android_gpu_configuration") {
surface_configuration("android_surface_configuration") {
enable_software = true
enable_gl = true
enable_vulkan = true
Expand Down Expand Up @@ -142,7 +142,7 @@ source_set("flutter_shell_native_src") {
sources += get_target_outputs(":icudtl_asm")

public_deps = [
":android_gpu_configuration",
":android_surface_configuration",
":icudtl_asm",
":image_generator",
"//flutter/assets",
Expand Down
18 changes: 9 additions & 9 deletions shell/platform/android/android_surface_gl_impeller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "flutter/fml/logging.h"
#include "flutter/impeller/toolkit/egl/surface.h"
#include "flutter/shell/gpu/gpu_surface_gl_impeller.h"
#include "flutter/shell/surface/surface_gl_impeller.h"

namespace flutter {

Expand Down Expand Up @@ -35,7 +35,7 @@ bool AndroidSurfaceGLImpeller::IsValid() const {
// |AndroidSurface|
std::unique_ptr<Surface> AndroidSurfaceGLImpeller::CreateGPUSurface(
GrDirectContext* gr_context) {
auto surface = std::make_unique<GPUSurfaceGLImpeller>(
auto surface = std::make_unique<SurfaceGLImpeller>(
this, // delegate
android_context_->GetImpellerContext(), // context
true // render to surface
Expand Down Expand Up @@ -90,7 +90,7 @@ AndroidSurfaceGLImpeller::GetImpellerContext() {
return android_context_->GetImpellerContext();
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
std::unique_ptr<GLContextResult>
AndroidSurfaceGLImpeller::GLContextMakeCurrent() {
return std::make_unique<GLContextDefaultResult>(OnGLContextMakeCurrent());
Expand All @@ -104,7 +104,7 @@ bool AndroidSurfaceGLImpeller::OnGLContextMakeCurrent() {
return android_context_->OnscreenContextMakeCurrent(onscreen_surface_.get());
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
bool AndroidSurfaceGLImpeller::GLContextClearCurrent() {
if (!onscreen_surface_) {
return false;
Expand All @@ -113,7 +113,7 @@ bool AndroidSurfaceGLImpeller::GLContextClearCurrent() {
return android_context_->OnscreenContextClearCurrent();
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
SurfaceFrame::FramebufferInfo
AndroidSurfaceGLImpeller::GLContextFramebufferInfo() const {
auto info = SurfaceFrame::FramebufferInfo{};
Expand All @@ -122,13 +122,13 @@ AndroidSurfaceGLImpeller::GLContextFramebufferInfo() const {
return info;
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
void AndroidSurfaceGLImpeller::GLContextSetDamageRegion(
const std::optional<SkIRect>& region) {
// Not supported.
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
bool AndroidSurfaceGLImpeller::GLContextPresent(
const GLPresentInfo& present_info) {
// The FBO ID is superfluous and was introduced for iOS where the default
Expand All @@ -139,15 +139,15 @@ bool AndroidSurfaceGLImpeller::GLContextPresent(
return onscreen_surface_->Present();
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
GLFBOInfo AndroidSurfaceGLImpeller::GLContextFBO(GLFrameInfo frame_info) const {
// FBO0 is the default window bound framebuffer in EGL environments.
return GLFBOInfo{
.fbo_id = 0,
};
}

// |GPUSurfaceGLDelegate|
// |SurfaceGLDelegate|
sk_sp<const GrGLInterface> AndroidSurfaceGLImpeller::GetGLInterface() const {
return nullptr;
}
Expand Down
Loading