5#include <Foundation/Foundation.h>
6#include <QuartzCore/QuartzCore.h>
8#include "flutter/shell/gpu/gpu_surface_metal_impeller.h"
9#include "gtest/gtest.h"
10#include "impeller/entity/mtl/entity_shaders.h"
11#include "impeller/entity/mtl/framebuffer_blend_shaders.h"
12#include "impeller/entity/mtl/modern_shaders.h"
21 layer_ = [[CAMetalLayer alloc]
init];
27 layer_.drawableSize = CGSizeMake(frame_info.
width(), frame_info.
height());
39 void SetDevice() { layer_.device = ::MTLCreateSystemDefaultDevice(); }
42 CAMetalLayer* layer_ = nil;
46 std::vector<std::shared_ptr<fml::Mapping>> shader_mappings = {
47 std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_data,
48 impeller_entity_shaders_length),
49 std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_data,
50 impeller_modern_shaders_length),
51 std::make_shared<fml::NonOwnedMapping>(impeller_framebuffer_blend_shaders_data,
52 impeller_framebuffer_blend_shaders_length),
54 auto sync_switch = std::make_shared<fml::SyncSwitch>(
false);
59 auto delegate = std::make_shared<TestGPUSurfaceMetalDelegate>();
60 auto surface = std::make_shared<GPUSurfaceMetalImpeller>(delegate.get(),
nullptr);
62 ASSERT_FALSE(
surface->IsValid());
66 auto delegate = std::make_shared<TestGPUSurfaceMetalDelegate>();
69 ASSERT_TRUE(
surface->IsValid());
73 auto delegate = std::make_shared<TestGPUSurfaceMetalDelegate>();
74 std::shared_ptr<Surface>
surface =
77 ASSERT_TRUE(
surface->IsValid());
80 ASSERT_EQ(
frame,
nullptr);
84 auto delegate = std::make_shared<TestGPUSurfaceMetalDelegate>();
85 delegate->SetDevice();
86 std::unique_ptr<Surface>
surface =
89 ASSERT_TRUE(
surface->IsValid());
97 ASSERT_TRUE(
frame->Submit());
static std::shared_ptr< ContextMTL > Create(const std::vector< std::string > &shader_library_paths, std::shared_ptr< const fml::SyncSwitch > is_gpu_disabled_sync_switch)
static std::shared_ptr< impeller::ContextMTL > CreateImpellerContext()
TEST(DisplayListComplexity, EmptyDisplayList)
void * GPUCAMetalLayerHandle
static constexpr SkISize Make(int32_t w, int32_t h)
constexpr int32_t width() const
constexpr int32_t height() const