Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ TEST_P(EntityTest, TiledTextureContentsRendersWithCorrectPipeline) {
// GL_OES_EGL_image_external isn't supported on MacOS hosts.
#if !defined(FML_OS_MACOSX)
TEST_P(EntityTest, TiledTextureContentsRendersWithCorrectPipelineExternalOES) {
if (GetParam() != PlaygroundBackend::kOpenGLES) {
if (GetParam() != PlaygroundBackend::kOpenGLES &&
GetParam() != PlaygroundBackend::kOpenGLESSDF) {
GTEST_SKIP()
<< "External OES textures are only valid for the OpenGLES backend.";
}
Expand Down
3 changes: 2 additions & 1 deletion engine/src/flutter/impeller/entity/entity_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,8 @@ static std::vector<std::shared_ptr<Texture>> CreateTestYUVTextures(
}

TEST_P(EntityTest, YUVToRGBFilter) {
if (GetParam() == PlaygroundBackend::kOpenGLES) {
if (GetParam() == PlaygroundBackend::kOpenGLES ||
GetParam() == PlaygroundBackend::kOpenGLESSDF) {
// TODO(114588) : Support YUV to RGB filter on OpenGLES backend.
GTEST_SKIP()
<< "YUV to RGB filter is not supported on OpenGLES backend yet.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,35 @@ const std::unique_ptr<PlaygroundImpl>& GetSharedVulkanPlayground(
}
}

std::unique_ptr<PlaygroundImpl> MakeOpenGLESPlayground() {
std::unique_ptr<PlaygroundImpl> MakeOpenGLESPlayground(bool use_sdfs = false) {
FML_CHECK(::glfwInit() == GLFW_TRUE);
PlaygroundSwitches playground_switches;
playground_switches.use_angle = true;
return PlaygroundImpl::Create(PlaygroundBackend::kOpenGLES,
playground_switches);
playground_switches.flags.use_sdfs = use_sdfs;
return PlaygroundImpl::Create(
use_sdfs ? PlaygroundBackend::kOpenGLESSDF : PlaygroundBackend::kOpenGLES,
playground_switches);
}

// Returns a static instance to an OpenGL ES playground that can be used across
// tests.
const std::unique_ptr<PlaygroundImpl>& GetSharedOpenGLESPlayground() {
static absl::NoDestructor<std::unique_ptr<PlaygroundImpl>> opengl_playground(
MakeOpenGLESPlayground());
// TODO(142237): This can be removed when the thread local storage is
// removed.
static fml::ScopedCleanupClosure context_cleanup(
[&] { (*opengl_playground)->GetContext()->Shutdown(); });
return *opengl_playground;
const std::unique_ptr<PlaygroundImpl>& GetSharedOpenGLESPlayground(
bool use_sdfs) {
if (use_sdfs) {
static absl::NoDestructor<std::unique_ptr<PlaygroundImpl>>
opengl_playground(MakeOpenGLESPlayground(/*use_sdfs=*/true));
static fml::ScopedCleanupClosure context_cleanup(
[&] { (*opengl_playground)->GetContext()->Shutdown(); });
return *opengl_playground;
} else {
static absl::NoDestructor<std::unique_ptr<PlaygroundImpl>>
opengl_playground(MakeOpenGLESPlayground(/*use_sdfs=*/false));
// TODO(142237): This can be removed when the thread local storage is
// removed.
static fml::ScopedCleanupClosure context_cleanup(
[&] { (*opengl_playground)->GetContext()->Shutdown(); });
return *opengl_playground;
}
}

} // namespace
Expand Down Expand Up @@ -215,6 +226,9 @@ void GoldenPlaygroundTest::SetUp() {
std::make_unique<testing::VulkanScreenshotter>(playground);
break;
}
case PlaygroundBackend::kOpenGLESSDF:
switches.flags.use_sdfs = true;
[[fallthrough]];
case PlaygroundBackend::kOpenGLES: {
if (switches.enable_wide_gamut) {
GTEST_SKIP() << "OpenGLES doesn't support wide gamut golden tests.";
Expand All @@ -224,7 +238,7 @@ void GoldenPlaygroundTest::SetUp() {
<< "OpenGLES doesn't support antialiased lines golden tests.";
}
const std::unique_ptr<PlaygroundImpl>& playground =
GetSharedOpenGLESPlayground();
GetSharedOpenGLESPlayground(switches.flags.use_sdfs);
::glfwMakeContextCurrent(
reinterpret_cast<GLFWwindow*>(playground->GetWindowHandle()));
pimpl_->screenshotter =
Expand Down Expand Up @@ -378,10 +392,12 @@ std::shared_ptr<Context> GoldenPlaygroundTest::MakeContext() const {
pimpl_->screenshotter = std::make_unique<testing::VulkanScreenshotter>(
pimpl_->test_vulkan_playground);
return pimpl_->test_vulkan_playground->GetContext();
} else if (GetParam() == PlaygroundBackend::kOpenGLES) {
} else if (GetParam() == PlaygroundBackend::kOpenGLES ||
GetParam() == PlaygroundBackend::kOpenGLESSDF) {
FML_CHECK(!pimpl_->test_opengl_playground)
<< "We don't support creating multiple contexts for one test";
pimpl_->test_opengl_playground = MakeOpenGLESPlayground();
bool use_sdfs = (GetParam() == PlaygroundBackend::kOpenGLESSDF);
pimpl_->test_opengl_playground = MakeOpenGLESPlayground(use_sdfs);
pimpl_->screenshotter = std::make_unique<testing::VulkanScreenshotter>(
pimpl_->test_opengl_playground);
return pimpl_->test_opengl_playground->GetContext();
Expand Down
3 changes: 3 additions & 0 deletions engine/src/flutter/impeller/playground/playground.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ std::string PlaygroundBackendToString(PlaygroundBackend backend) {
return "MetalSDF";
case PlaygroundBackend::kOpenGLES:
return "OpenGLES";
case PlaygroundBackend::kOpenGLESSDF:
return "OpenGLESSDF";
case PlaygroundBackend::kVulkan:
return "Vulkan";
}
Expand Down Expand Up @@ -111,6 +113,7 @@ bool Playground::SupportsBackend(PlaygroundBackend backend) {
return false;
#endif // IMPELLER_ENABLE_METAL
case PlaygroundBackend::kOpenGLES:
case PlaygroundBackend::kOpenGLESSDF:
#if IMPELLER_ENABLE_OPENGLES
return true;
#else // IMPELLER_ENABLE_OPENGLES
Expand Down
1 change: 1 addition & 0 deletions engine/src/flutter/impeller/playground/playground.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enum class PlaygroundBackend {
kMetal,
kMetalSDF,
kOpenGLES,
kOpenGLESSDF,
kVulkan,
};

Expand Down
3 changes: 3 additions & 0 deletions engine/src/flutter/impeller/playground/playground_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ std::unique_ptr<PlaygroundImpl> PlaygroundImpl::Create(
#if IMPELLER_ENABLE_OPENGLES
case PlaygroundBackend::kOpenGLES:
return std::make_unique<PlaygroundImplGLES>(switches);
case PlaygroundBackend::kOpenGLESSDF:
switches.flags.use_sdfs = true;
return std::make_unique<PlaygroundImplGLES>(switches);
Comment thread
walley892 marked this conversation as resolved.
#endif // IMPELLER_ENABLE_OPENGLES
#if IMPELLER_ENABLE_VULKAN
case PlaygroundBackend::kVulkan:
Expand Down
1 change: 1 addition & 0 deletions engine/src/flutter/impeller/playground/playground_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ std::string PlaygroundTest::GetWindowTitle() const {
case PlaygroundBackend::kMetalSDF:
break;
case PlaygroundBackend::kOpenGLES:
case PlaygroundBackend::kOpenGLESSDF:
if (switches_.use_angle) {
stream << " (Angle) ";
}
Expand Down
3 changes: 2 additions & 1 deletion engine/src/flutter/impeller/playground/playground_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class PlaygroundTest : public Playground,
Play, playground, \
::testing::Values( \
PlaygroundBackend::kMetal, PlaygroundBackend::kMetalSDF, \
PlaygroundBackend::kOpenGLES, PlaygroundBackend::kVulkan), \
PlaygroundBackend::kOpenGLES, PlaygroundBackend::kOpenGLESSDF, \
PlaygroundBackend::kVulkan), \
[](const ::testing::TestParamInfo<PlaygroundTest::ParamType>& info) { \
return PlaygroundBackendToString(info.param); \
});
Expand Down
12 changes: 8 additions & 4 deletions engine/src/flutter/impeller/renderer/renderer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ TEST_P(RendererTest, CanRenderToTexture) {
}

TEST_P(RendererTest, CanRenderInstanced) {
if (GetParam() == PlaygroundBackend::kOpenGLES) {
if (GetParam() == PlaygroundBackend::kOpenGLES ||
GetParam() == PlaygroundBackend::kOpenGLESSDF) {
// This test drives instancing through gl_InstanceIndex and a storage
// buffer, both of which require OpenGL ES 3.1. The portable instance-rate
// vertex attribute path, which works down to OpenGL ES 2.0, is covered by
Expand Down Expand Up @@ -485,7 +486,8 @@ TEST_P(RendererTest, CanRenderInstanced) {
}

TEST_P(RendererTest, CanBlitTextureToTexture) {
if (GetBackend() == PlaygroundBackend::kOpenGLES) {
if (GetBackend() == PlaygroundBackend::kOpenGLES ||
GetBackend() == PlaygroundBackend::kOpenGLESSDF) {
GTEST_SKIP() << "Mipmap test shader not supported on GLES.";
}
auto context = GetContext();
Expand Down Expand Up @@ -595,7 +597,8 @@ TEST_P(RendererTest, CanBlitTextureToTexture) {
}

TEST_P(RendererTest, CanBlitTextureToBuffer) {
if (GetBackend() == PlaygroundBackend::kOpenGLES) {
if (GetBackend() == PlaygroundBackend::kOpenGLES ||
GetBackend() == PlaygroundBackend::kOpenGLESSDF) {
GTEST_SKIP() << "Mipmap test shader not supported on GLES.";
}
auto context = GetContext();
Expand Down Expand Up @@ -724,7 +727,8 @@ TEST_P(RendererTest, CanBlitTextureToBuffer) {
}

TEST_P(RendererTest, CanGenerateMipmaps) {
if (GetBackend() == PlaygroundBackend::kOpenGLES) {
if (GetBackend() == PlaygroundBackend::kOpenGLES ||
GetBackend() == PlaygroundBackend::kOpenGLESSDF) {
GTEST_SKIP() << "Mipmap test shader not supported on GLES.";
}
auto context = GetContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ TEST_P(RuntimeStageTest, CanReadUniforms) {
[[fallthrough]];
case PlaygroundBackend::kMetalSDF:
[[fallthrough]];
case PlaygroundBackend::kOpenGLES: {
case PlaygroundBackend::kOpenGLES:
[[fallthrough]];
case PlaygroundBackend::kOpenGLESSDF: {
ASSERT_EQ(stage->GetUniforms().size(), 14u);
{
// uFloat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ TEST_P(InteropPlaygroundTest, CanCreateDisplayListBuilder) {
}

TEST_P(InteropPlaygroundTest, CanCreateSurface) {
if (GetBackend() != PlaygroundBackend::kOpenGLES) {
if (GetBackend() != PlaygroundBackend::kOpenGLES &&
GetBackend() != PlaygroundBackend::kOpenGLESSDF) {
GTEST_SKIP()
<< "This test checks wrapping FBOs which is an OpenGL ES only call.";
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ ScopedObject<Context> PlaygroundTest::CreateContext() const {
case PlaygroundBackend::kMetalSDF:
return Adopt<Context>(
ImpellerContextCreateMetalNew(ImpellerGetVersion()));
case PlaygroundBackend::kOpenGLES: {
case PlaygroundBackend::kOpenGLES:
case PlaygroundBackend::kOpenGLESSDF: {
Playground::GLProcAddressResolver playground_gl_proc_address_callback =
CreateGLProcAddressResolver();
ImpellerProcAddressCallback gl_proc_address_callback =
Expand Down Expand Up @@ -112,6 +113,7 @@ static ScopedObject<Surface> CreateSharedSurface(

#if IMPELLER_ENABLE_OPENGLES
case PlaygroundBackend::kOpenGLES:
case PlaygroundBackend::kOpenGLESSDF:
return Adopt<Surface>(
new SurfaceGLES(context, std::move(shared_surface)));
#endif
Expand Down Expand Up @@ -156,6 +158,7 @@ static ScopedObject<Context> CreateSharedContext(
#endif
#if IMPELLER_ENABLE_OPENGLES
case PlaygroundBackend::kOpenGLES:
case PlaygroundBackend::kOpenGLESSDF:
return ContextGLES::Create(std::move(shared_context));
#endif
#if IMPELLER_ENABLE_VULKAN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ TEST(TypographerTest, RectanglePackerFillsRows) {
}

TEST_P(TypographerTest, GlyphAtlasTextureWillGrowTilMaxTextureSize) {
if (GetBackend() == PlaygroundBackend::kOpenGLES) {
if (GetBackend() == PlaygroundBackend::kOpenGLES ||
GetBackend() == PlaygroundBackend::kOpenGLESSDF) {
GTEST_SKIP() << "Atlas growth isn't supported for OpenGLES currently.";
}

Expand Down
Loading