#include "ui/gl/gl_context_egl.h"
#include <memory>
#include "base/command_line.h"
#include "base/logging.h"
#include "base/ranges/algorithm.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "third_party/khronos/EGL/egl.h"
#include "third_party/khronos/EGL/eglext.h"
#include "ui/gl/egl_util.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_display.h"
#include "ui/gl/gl_fence.h"
#include "ui/gl/gl_gl_api_implementation.h"
#include "ui/gl/gl_surface_egl.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "base/win/windows_version.h"
#endif
#ifndef EGL_CHROMIUM_create_context_bind_generates_resource
#define EGL_CHROMIUM_create_context_bind_generates_resource …
#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM …
#endif
#ifndef EGL_ANGLE_create_context_webgl_compatibility
#define EGL_ANGLE_create_context_webgl_compatibility …
#define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE …
#endif
#ifndef EGL_ANGLE_display_texture_share_group
#define EGL_ANGLE_display_texture_share_group …
#define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE …
#endif
#ifndef EGL_ANGLE_display_semaphore_share_group
#define EGL_ANGLE_display_semaphore_share_group …
#define EGL_DISPLAY_SEMAPHORE_SHARE_GROUP_ANGLE …
#endif
#ifndef EGL_ANGLE_external_context_and_surface
#define EGL_ANGLE_external_context_and_surface …
#define EGL_EXTERNAL_CONTEXT_ANGLE …
#endif
#ifndef EGL_ANGLE_create_context_client_arrays
#define EGL_ANGLE_create_context_client_arrays …
#define EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE …
#endif
#ifndef EGL_ANGLE_robust_resource_initialization
#define EGL_ANGLE_robust_resource_initialization …
#define EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE …
#endif
#ifndef EGL_ANGLE_create_context_backwards_compatible
#define EGL_ANGLE_create_context_backwards_compatible …
#define EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE …
#endif
#ifndef EGL_CONTEXT_PRIORITY_LEVEL_IMG
#define EGL_CONTEXT_PRIORITY_LEVEL_IMG …
#define EGL_CONTEXT_PRIORITY_HIGH_IMG …
#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG …
#define EGL_CONTEXT_PRIORITY_LOW_IMG …
#endif
#ifndef EGL_ANGLE_power_preference
#define EGL_ANGLE_power_preference …
#define EGL_POWER_PREFERENCE_ANGLE …
#define EGL_LOW_POWER_ANGLE …
#define EGL_HIGH_POWER_ANGLE …
#endif
#ifndef EGL_NV_robustness_video_memory_purge
#define EGL_NV_robustness_video_memory_purge …
#define EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV …
#endif
#ifndef EGL_ANGLE_context_virtualization
#define EGL_ANGLE_context_virtualization …
#define EGL_CONTEXT_VIRTUALIZATION_GROUP_ANGLE …
#endif
GetEGLErrorString;
GetLastEGLErrorString;
namespace gl {
namespace {
bool ChangeContextAttributes(std::vector<EGLint>& context_attributes,
EGLint attribute,
EGLint value) { … }
bool IsARMSwiftShaderPlatform() { … }
}
GLContextEGL::GLContextEGL(GLShareGroup* share_group)
: … { … }
bool GLContextEGL::InitializeImpl(GLSurface* compatible_surface,
const GLContextAttribs& attribs) { … }
void GLContextEGL::Destroy() { … }
void GLContextEGL::SetVisibility(bool visibility) { … }
GLDisplayEGL* GLContextEGL::GetGLDisplayEGL() { … }
GLContextEGL* GLContextEGL::AsGLContextEGL() { … }
bool GLContextEGL::CanShareTexturesWithContext(GLContext* other_context) { … }
void GLContextEGL::ReleaseBackpressureFences() { … }
bool GLContextEGL::MakeCurrentImpl(GLSurface* surface) { … }
void GLContextEGL::SetUnbindFboOnMakeCurrent() { … }
void GLContextEGL::ReleaseCurrent(GLSurface* surface) { … }
bool GLContextEGL::IsCurrent(GLSurface* surface) { … }
void* GLContextEGL::GetHandle() { … }
unsigned int GLContextEGL::CheckStickyGraphicsResetStatusImpl() { … }
GLContextEGL::~GLContextEGL() { … }
}