2015-12-13 18:38:26 +01:00
|
|
|
// Copyright 2014 Dolphin Emulator Project
|
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
2016-07-01 08:07:31 -07:00
|
|
|
#include <android/native_window.h>
|
2015-12-16 21:37:09 +01:00
|
|
|
#include "Common/Log.h"
|
2015-12-13 18:38:26 +01:00
|
|
|
#include "Common/GL/GLInterface/EGLAndroid.h"
|
|
|
|
|
|
2015-12-16 21:37:09 +01:00
|
|
|
EGLDisplay cInterfaceEGLAndroid::OpenDisplay() {
|
2015-12-13 18:38:26 +01:00
|
|
|
return eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-16 21:37:09 +01:00
|
|
|
EGLNativeWindowType cInterfaceEGLAndroid::InitializePlatform(EGLNativeWindowType host_window, EGLConfig config) {
|
|
|
|
|
EGLint format;
|
|
|
|
|
if (EGL_FALSE == eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &format)) {
|
2016-01-23 18:41:29 +01:00
|
|
|
EGL_ELOG("Failed getting EGL_NATIVE_VISUAL_ID: error %s", EGLGetErrorString(eglGetError()));
|
2015-12-16 21:37:09 +01:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-23 18:41:29 +01:00
|
|
|
int32_t result = ANativeWindow_setBuffersGeometry(host_window, internalWidth_, internalHeight_, format);
|
|
|
|
|
EGL_ILOG("ANativeWindow_setBuffersGeometry returned %d", result);
|
2015-12-13 18:38:26 +01:00
|
|
|
|
|
|
|
|
const int width = ANativeWindow_getWidth(host_window);
|
|
|
|
|
const int height = ANativeWindow_getHeight(host_window);
|
|
|
|
|
SetBackBufferDimensions(width, height);
|
|
|
|
|
|
|
|
|
|
return host_window;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-16 21:37:09 +01:00
|
|
|
void cInterfaceEGLAndroid::ShutdownPlatform() {
|
2015-12-13 18:38:26 +01:00
|
|
|
}
|