~mmach/netext73/webkit2gtk

« back to all changes in this revision

Viewing changes to Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.h

  • Committer: mmach
  • Date: 2023-06-16 17:21:37 UTC
  • Revision ID: netbit73@gmail.com-20230616172137-2rqx6yr96ga9g3kp
1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
7
#ifndef LIBANGLE_RENDERER_GL_EAGL_IOSURFACESURFACEEAGL_H_
 
8
#define LIBANGLE_RENDERER_GL_EAGL_IOSURFACESURFACEEAGL_H_
 
9
 
 
10
#include "libANGLE/renderer/gl/SurfaceGL.h"
 
11
#include "libANGLE/renderer/gl/eagl/DisplayEAGL.h"
 
12
 
 
13
#include <IOSurface/IOSurfaceRef.h>
 
14
 
 
15
namespace egl
 
16
{
 
17
class AttributeMap;
 
18
}  // namespace egl
 
19
 
 
20
namespace rx
 
21
{
 
22
 
 
23
class DisplayEAGL;
 
24
class FunctionsGL;
 
25
class StateManagerGL;
 
26
 
 
27
class IOSurfaceSurfaceEAGL : public SurfaceGL
 
28
{
 
29
  public:
 
30
    IOSurfaceSurfaceEAGL(const egl::SurfaceState &state,
 
31
                         EAGLContextObj cglContext,
 
32
                         EGLClientBuffer buffer,
 
33
                         const egl::AttributeMap &attribs);
 
34
    ~IOSurfaceSurfaceEAGL() override;
 
35
 
 
36
    egl::Error initialize(const egl::Display *display) override;
 
37
    egl::Error makeCurrent(const gl::Context *context) override;
 
38
    egl::Error unMakeCurrent(const gl::Context *context) override;
 
39
 
 
40
    egl::Error swap(const gl::Context *context) override;
 
41
    egl::Error postSubBuffer(const gl::Context *context,
 
42
                             EGLint x,
 
43
                             EGLint y,
 
44
                             EGLint width,
 
45
                             EGLint height) override;
 
46
    egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
 
47
    egl::Error bindTexImage(const gl::Context *context,
 
48
                            gl::Texture *texture,
 
49
                            EGLint buffer) override;
 
50
    egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
 
51
    void setSwapInterval(EGLint interval) override;
 
52
 
 
53
    EGLint getWidth() const override;
 
54
    EGLint getHeight() const override;
 
55
 
 
56
    EGLint isPostSubBufferSupported() const override;
 
57
    EGLint getSwapBehavior() const override;
 
58
 
 
59
    static bool validateAttributes(EGLClientBuffer buffer, const egl::AttributeMap &attribs);
 
60
    FramebufferImpl *createDefaultFramebuffer(const gl::Context *context,
 
61
                                              const gl::FramebufferState &state) override;
 
62
 
 
63
    bool hasEmulatedAlphaChannel() const override;
 
64
 
 
65
  private:
 
66
    angle::Result initializeAlphaChannel(const gl::Context *context, GLuint texture);
 
67
 
 
68
#if defined(ANGLE_PLATFORM_IOS_SIMULATOR)
 
69
    IOSurfaceLockOptions getIOSurfaceLockOptions() const;
 
70
#endif
 
71
 
 
72
    EAGLContextObj mEAGLContext;
 
73
    IOSurfaceRef mIOSurface;
 
74
    int mWidth;
 
75
    int mHeight;
 
76
    int mPlane;
 
77
    int mFormatIndex;
 
78
 
 
79
    bool mAlphaInitialized;
 
80
#if defined(ANGLE_PLATFORM_IOS_SIMULATOR)
 
81
    GLuint mBoundTextureID;
 
82
    bool mUploadFromIOSurface;
 
83
    bool mReadbackToIOSurface;
 
84
#endif
 
85
};
 
86
 
 
87
}  // namespace rx
 
88
 
 
89
#endif  // LIBANGLE_RENDERER_GL_EAGL_IOSURFACESURFACEEAGL_H_