5#include "flutter/shell/common/shell_test_platform_view_gl.h"
11#include "flutter/shell/gpu/gpu_surface_gl_skia.h"
12#include "impeller/entity/gles/entity_shaders_gles.h"
15#include "impeller/scene/shaders/gles/scene_shaders_gles.h"
23 std::make_shared<fml::NonOwnedMapping>(
24 impeller_entity_shaders_gles_data,
25 impeller_entity_shaders_gles_length),
27 std::make_shared<fml::NonOwnedMapping>(
28 impeller_scene_shaders_gles_data, impeller_scene_shaders_gles_length),
36 std::shared_ptr<ShellTestVsyncClock> vsync_clock,
38 std::shared_ptr<ShellTestExternalViewEmbedder>
39 shell_test_external_view_embedder)
42 create_vsync_waiter_(
std::move(create_vsync_waiter)),
43 vsync_clock_(
std::move(vsync_clock)),
44 shell_test_external_view_embedder_(
45 std::move(shell_test_external_view_embedder)) {
47 auto resolver = [](
const char*
name) ->
void* {
48 return reinterpret_cast<void*
>(::eglGetProcAddress(
name));
53 auto gl = std::make_unique<impeller::ProcTableGLES>(resolver);
55 FML_LOG(
ERROR) <<
"Proc table when a shell unittests invalid.";
65std::unique_ptr<VsyncWaiter> ShellTestPlatformViewGL::CreateVSyncWaiter() {
66 return create_vsync_waiter_();
71 vsync_clock_->SimulateVSync();
75std::unique_ptr<Surface> ShellTestPlatformViewGL::CreateRenderingSurface() {
76 return std::make_unique<GPUSurfaceGLSkia>(
this,
true);
80std::shared_ptr<ExternalViewEmbedder>
81ShellTestPlatformViewGL::CreateExternalViewEmbedder() {
82 return shell_test_external_view_embedder_;
87 return [](DefaultPointerDataDispatcher::Delegate& delegate) {
88 return std::make_unique<SmoothPointerDataDispatcher>(delegate);
93std::unique_ptr<GLContextResult>
94ShellTestPlatformViewGL::GLContextMakeCurrent() {
95 return std::make_unique<GLContextDefaultResult>(gl_surface_.
MakeCurrent());
99bool ShellTestPlatformViewGL::GLContextClearCurrent() {
104bool ShellTestPlatformViewGL::GLContextPresent(
105 const GLPresentInfo& present_info) {
110GLFBOInfo ShellTestPlatformViewGL::GLContextFBO(GLFrameInfo frame_info)
const {
112 .fbo_id = gl_surface_.
GetFramebuffer(frame_info.width, frame_info.height),
118ShellTestPlatformViewGL::GetGLProcResolver()
const {
119 return [
surface = &gl_surface_](
const char*
name) ->
void* {
std::function< void *(const char *)> GLProcResolver
uint32_t GetFramebuffer(uint32_t width, uint32_t height) const
static std::shared_ptr< ContextGLES > Create(std::unique_ptr< ProcTableGLES > gl, const std::vector< std::shared_ptr< fml::Mapping > > &shader_libraries, bool enable_gpu_tracing)
#define FML_LOG(severity)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
std::function< std::unique_ptr< VsyncWaiter >()> CreateVsyncWaiter
static std::vector< std::shared_ptr< fml::Mapping > > ShaderLibraryMappings()
std::function< std::unique_ptr< PointerDataDispatcher >(PointerDataDispatcher::Delegate &)> PointerDataDispatcherMaker
Signature for constructing PointerDataDispatcher.
DEF_SWITCHES_START aot vmservice shared library name