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.
7
#ifndef LIBANGLE_RENDERER_GL_EAGL_IOSURFACESURFACEEAGL_H_
8
#define LIBANGLE_RENDERER_GL_EAGL_IOSURFACESURFACEEAGL_H_
10
#include "libANGLE/renderer/gl/SurfaceGL.h"
11
#include "libANGLE/renderer/gl/eagl/DisplayEAGL.h"
13
#include <IOSurface/IOSurfaceRef.h>
27
class IOSurfaceSurfaceEAGL : public SurfaceGL
30
IOSurfaceSurfaceEAGL(const egl::SurfaceState &state,
31
EAGLContextObj cglContext,
32
EGLClientBuffer buffer,
33
const egl::AttributeMap &attribs);
34
~IOSurfaceSurfaceEAGL() override;
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;
40
egl::Error swap(const gl::Context *context) override;
41
egl::Error postSubBuffer(const gl::Context *context,
45
EGLint height) override;
46
egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
47
egl::Error bindTexImage(const gl::Context *context,
49
EGLint buffer) override;
50
egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
51
void setSwapInterval(EGLint interval) override;
53
EGLint getWidth() const override;
54
EGLint getHeight() const override;
56
EGLint isPostSubBufferSupported() const override;
57
EGLint getSwapBehavior() const override;
59
static bool validateAttributes(EGLClientBuffer buffer, const egl::AttributeMap &attribs);
60
FramebufferImpl *createDefaultFramebuffer(const gl::Context *context,
61
const gl::FramebufferState &state) override;
63
bool hasEmulatedAlphaChannel() const override;
66
angle::Result initializeAlphaChannel(const gl::Context *context, GLuint texture);
68
#if defined(ANGLE_PLATFORM_IOS_SIMULATOR)
69
IOSurfaceLockOptions getIOSurfaceLockOptions() const;
72
EAGLContextObj mEAGLContext;
73
IOSurfaceRef mIOSurface;
79
bool mAlphaInitialized;
80
#if defined(ANGLE_PLATFORM_IOS_SIMULATOR)
81
GLuint mBoundTextureID;
82
bool mUploadFromIOSurface;
83
bool mReadbackToIOSurface;
89
#endif // LIBANGLE_RENDERER_GL_EAGL_IOSURFACESURFACEEAGL_H_