1 // 2 // Copyright 2024 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 // WindowSurfaceWgpuMetalLayer.h: 7 // Defines the class interface for WindowSurfaceWgpuMetalLayer, implementing WindowSurfaceWgpu. 8 // 9 10 #ifndef LIBANGLE_RENDERER_WGPU_MAC_WINDOWSURFACEWGPUMETALLAYER_H_ 11 #define LIBANGLE_RENDERER_WGPU_MAC_WINDOWSURFACEWGPUMETALLAYER_H_ 12 13 #include "libANGLE/renderer/wgpu/SurfaceWgpu.h" 14 15 #import <Metal/Metal.h> 16 #import <QuartzCore/CAMetalLayer.h> 17 18 namespace rx 19 { 20 class WindowSurfaceWgpuMetalLayer : public WindowSurfaceWgpu 21 { 22 public: 23 WindowSurfaceWgpuMetalLayer(const egl::SurfaceState &surfaceState, EGLNativeWindowType window); 24 25 egl::Error initialize(const egl::Display *display) override; 26 void destroy(const egl::Display *display) override; 27 28 private: 29 angle::Result createWgpuSurface(const egl::Display *display, 30 wgpu::Surface *outSurface) override; 31 angle::Result getCurrentWindowSize(const egl::Display *display, gl::Extents *outSize) override; 32 33 id<MTLDevice> mMetalDevice; 34 CAMetalLayer *mMetalLayer; 35 }; 36 37 } // namespace rx 38 39 #endif // LIBANGLE_RENDERER_WGPU_MAC_WINDOWSURFACEWGPUMETALLAYER_H_ 40