| 1 | // Copyright 2014 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "Common/GL/GLInterface/EGLAndroid.h" |
| 5 | |
| 6 | #include <android/native_window.h> |
| 7 | |
| 8 | EGLDisplay GLContextEGLAndroid::OpenEGLDisplay() |
| 9 | { |
| 10 | return eglGetDisplay(EGL_DEFAULT_DISPLAY); |
| 11 | } |
| 12 | |
| 13 | EGLNativeWindowType GLContextEGLAndroid::GetEGLNativeWindow(EGLConfig config) |
| 14 | { |
| 15 | EGLint format; |
| 16 | eglGetConfigAttrib(m_egl_display, config, EGL_NATIVE_VISUAL_ID, &format); |
| 17 | ANativeWindow_setBuffersGeometry(static_cast<ANativeWindow*>(m_wsi.render_surface), 0, 0, format); |
| 18 | m_backbuffer_width = ANativeWindow_getWidth(static_cast<ANativeWindow*>(m_wsi.render_surface)); |
| 19 | m_backbuffer_height = ANativeWindow_getHeight(static_cast<ANativeWindow*>(m_wsi.render_surface)); |
| 20 | return static_cast<EGLNativeWindowType>(m_wsi.render_surface); |
| 21 | } |