• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2020 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 // IOSurfaceSurfaceVkMac.h:
7 //    Subclasses SurfaceVk for the Mac platform to implement PBuffers using an IOSurface
8 //
9 
10 #ifndef LIBANGLE_RENDERER_VULKAN_MAC_IOSURFACESURFACEVKMAC_H_
11 #define LIBANGLE_RENDERER_VULKAN_MAC_IOSURFACESURFACEVKMAC_H_
12 
13 #include "libANGLE/renderer/vulkan/SurfaceVk.h"
14 
15 struct __IOSurface;
16 typedef __IOSurface *IOSurfaceRef;
17 
18 namespace egl
19 {
20 class AttributeMap;
21 }  // namespace egl
22 
23 namespace rx
24 {
25 
26 class IOSurfaceSurfaceVkMac : public OffscreenSurfaceVk
27 {
28   public:
29     IOSurfaceSurfaceVkMac(const egl::SurfaceState &state,
30                           EGLClientBuffer buffer,
31                           const egl::AttributeMap &attribs);
32     ~IOSurfaceSurfaceVkMac() override;
33 
34     egl::Error initialize(const egl::Display *display) override;
35 
36     egl::Error unMakeCurrent(const gl::Context *context) override;
37 
38     egl::Error bindTexImage(const gl::Context *context,
39                             gl::Texture *texture,
40                             EGLint buffer) override;
41     egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
42 
43     static bool ValidateAttributes(const DisplayVk *displayVk,
44                                    EGLClientBuffer buffer,
45                                    const egl::AttributeMap &attribs);
46 
47   protected:
48     angle::Result initializeImpl(DisplayVk *displayVk) override;
49 
50   private:
51     IOSurfaceRef mIOSurface;
52 
53     int mPlane;
54     int mFormatIndex;
55 };
56 
57 }  // namespace rx
58 
59 #endif  // LIBANGLE_RENDERER_VULKAN_MAC_IOSURFACESURFACEVKMAC_H_
60