65 handle_(nullptr, &DestroyWindowHandle),
66 data_(std::make_unique<Data>()),
69 ::glfwDefaultWindowHints();
70 ::glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
72 auto window = ::glfwCreateWindow(1, 1,
"Test",
nullptr,
nullptr);
74 return;
75 }
76
79 "Playground Library",
80 switches.enable_wide_gamut
82 : std::nullopt);
83 if (!context) {
84 return;
85 }
86 NSWindow* cocoa_window = ::glfwGetCocoaWindow(
window);
87 if (cocoa_window == nil) {
88 return;
89 }
90 data_->metal_layer = [CAMetalLayer layer];
92 data_->metal_layer.pixelFormat =
94 data_->metal_layer.framebufferOnly = NO;
95 cocoa_window.contentView.layer = data_->metal_layer;
96 cocoa_window.contentView.wantsLayer = YES;
97
99 context_ = std::move(context);
100}
static std::shared_ptr< ConcurrentMessageLoop > Create(size_t worker_count=std::thread::hardware_concurrency())
static ContextMTL & Cast(Context &base)
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)
id< MTLDevice > GetMTLDevice() const
PlaygroundImpl(PlaygroundSwitches switches)
static std::vector< std::shared_ptr< fml::Mapping > > ShaderLibraryMappingsForPlayground()
constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format)