GLContext: Fix Android context creation
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
#include "context_egl_android.h"
|
||||
#include "../log.h"
|
||||
#include <android/native_window.h>
|
||||
Log_SetChannel(GL::ContextEGLAndroid);
|
||||
|
||||
namespace GL {
|
||||
ContextEGLX11::ContextEGLAndroid(const WindowInfo& wi) : ContextEGL(wi) {}
|
||||
ContextEGLX11::~ContextEGLAndroid() = default;
|
||||
ContextEGLAndroid::ContextEGLAndroid(const WindowInfo& wi) : ContextEGL(wi) {}
|
||||
ContextEGLAndroid::~ContextEGLAndroid() = default;
|
||||
|
||||
std::unique_ptr<Context> ContextEGLAndroid::Create(const WindowInfo& wi, const Version* versions_to_try,
|
||||
size_t num_versions_to_try)
|
||||
@ -29,16 +30,16 @@ std::unique_ptr<Context> ContextEGLAndroid::CreateSharedContext(const WindowInfo
|
||||
|
||||
EGLNativeWindowType ContextEGLAndroid::GetNativeWindow(EGLConfig config)
|
||||
{
|
||||
X11InhibitErrors ei;
|
||||
|
||||
EGLint native_visual_id = 0;
|
||||
if (!eglGetConfigAttrib(m_display, m_config, EGL_NATIVE_VISUAL_ID, &native_visual_id))
|
||||
{
|
||||
Log_ErrorPrintf("Failed to get X11 visual ID");
|
||||
return false;
|
||||
Log_ErrorPrintf("Failed to get native visual ID");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ANativeWindow_setBuffersGeometry(static_cast<ANativeWindow*>(m_wi.window_handle), 0, 0, static_cast<int32_t>(native_visual_id));
|
||||
m_wi.surface_width = ANativeWindow_getWidth(static_cast<ANativeWindow*>(m_wi.window_handle));
|
||||
m_wi.surface_height = ANativeWindow_getHeight(static_cast<ANativeWindow*>(m_wi.window_handle));
|
||||
return static_cast<EGLNativeWindowType>(m_wi.window_handle);
|
||||
}
|
||||
} // namespace GL
|
||||
|
||||
Reference in New Issue
Block a user