summaryrefslogtreecommitdiff
path: root/platform/uwp/gl_context_egl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/uwp/gl_context_egl.cpp')
-rw-r--r--platform/uwp/gl_context_egl.cpp84
1 files changed, 35 insertions, 49 deletions
diff --git a/platform/uwp/gl_context_egl.cpp b/platform/uwp/gl_context_egl.cpp
index c9c03db8a1..6c9efc26b4 100644
--- a/platform/uwp/gl_context_egl.cpp
+++ b/platform/uwp/gl_context_egl.cpp
@@ -62,8 +62,7 @@ void ContextEGL::reset() {
void ContextEGL::swap_buffers() {
- if (eglSwapBuffers(mEglDisplay, mEglSurface) != EGL_TRUE)
- {
+ if (eglSwapBuffers(mEglDisplay, mEglSurface) != EGL_TRUE) {
cleanup();
window = CoreWindow::GetForCurrentThread();
@@ -102,69 +101,61 @@ Error ContextEGL::initialize() {
try {
const EGLint displayAttributes[] =
- {
- /*EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+ {
+ /*EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9,
EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, 3,
EGL_NONE,*/
- // These are the default display attributes, used to request ANGLE's D3D11 renderer.
- // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+.
- EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
-
- // EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER is an optimization that can have large performance benefits on mobile devices.
- // Its syntax is subject to change, though. Please update your Visual Studio templates if you experience compilation issues with it.
- //EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
-
- // EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is an option that enables ANGLE to automatically call
- // the IDXGIDevice3::Trim method on behalf of the application when it gets suspended.
- // Calling IDXGIDevice3::Trim when an application is suspended is a Windows Store application certification requirement.
- EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
- EGL_NONE,
- };
+ // These are the default display attributes, used to request ANGLE's D3D11 renderer.
+ // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+.
+ EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
+
+ // EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER is an optimization that can have large performance benefits on mobile devices.
+ // Its syntax is subject to change, though. Please update your Visual Studio templates if you experience compilation issues with it.
+ //EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE,
+
+ // EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is an option that enables ANGLE to automatically call
+ // the IDXGIDevice3::Trim method on behalf of the application when it gets suspended.
+ // Calling IDXGIDevice3::Trim when an application is suspended is a Windows Store application certification requirement.
+ EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE,
+ EGL_NONE,
+ };
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT"));
- if (!eglGetPlatformDisplayEXT)
- {
+ if (!eglGetPlatformDisplayEXT) {
throw Exception::CreateException(E_FAIL, L"Failed to get function eglGetPlatformDisplayEXT");
}
display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, displayAttributes);
- if (display == EGL_NO_DISPLAY)
- {
+ if (display == EGL_NO_DISPLAY) {
throw Exception::CreateException(E_FAIL, L"Failed to get default EGL display");
}
- if (eglInitialize(display, &majorVersion, &minorVersion) == EGL_FALSE)
- {
+ if (eglInitialize(display, &majorVersion, &minorVersion) == EGL_FALSE) {
throw Exception::CreateException(E_FAIL, L"Failed to initialize EGL");
}
- if (eglGetConfigs(display, NULL, 0, &numConfigs) == EGL_FALSE)
- {
+ if (eglGetConfigs(display, NULL, 0, &numConfigs) == EGL_FALSE) {
throw Exception::CreateException(E_FAIL, L"Failed to get EGLConfig count");
}
- if (eglChooseConfig(display, configAttribList, &config, 1, &numConfigs) == EGL_FALSE)
- {
+ if (eglChooseConfig(display, configAttribList, &config, 1, &numConfigs) == EGL_FALSE) {
throw Exception::CreateException(E_FAIL, L"Failed to choose first EGLConfig count");
}
- surface = eglCreateWindowSurface(display, config, reinterpret_cast<IInspectable*>(window), surfaceAttribList);
- if (surface == EGL_NO_SURFACE)
- {
+ surface = eglCreateWindowSurface(display, config, reinterpret_cast<IInspectable *>(window), surfaceAttribList);
+ if (surface == EGL_NO_SURFACE) {
throw Exception::CreateException(E_FAIL, L"Failed to create EGL fullscreen surface");
}
context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs);
- if (context == EGL_NO_CONTEXT)
- {
+ if (context == EGL_NO_CONTEXT) {
throw Exception::CreateException(E_FAIL, L"Failed to create EGL context");
}
- if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE)
- {
+ if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
throw Exception::CreateException(E_FAIL, L"Failed to make fullscreen EGLSurface current");
}
} catch (...) {
@@ -175,38 +166,34 @@ Error ContextEGL::initialize() {
mEglSurface = surface;
mEglContext = context;
- eglQuerySurface(display,surface,EGL_WIDTH,&width);
- eglQuerySurface(display,surface,EGL_HEIGHT,&height);
+ eglQuerySurface(display, surface, EGL_WIDTH, &width);
+ eglQuerySurface(display, surface, EGL_HEIGHT, &height);
return OK;
};
void ContextEGL::cleanup() {
- if (mEglDisplay != EGL_NO_DISPLAY && mEglSurface != EGL_NO_SURFACE)
- {
+ if (mEglDisplay != EGL_NO_DISPLAY && mEglSurface != EGL_NO_SURFACE) {
eglDestroySurface(mEglDisplay, mEglSurface);
mEglSurface = EGL_NO_SURFACE;
}
- if (mEglDisplay != EGL_NO_DISPLAY && mEglContext != EGL_NO_CONTEXT)
- {
+ if (mEglDisplay != EGL_NO_DISPLAY && mEglContext != EGL_NO_CONTEXT) {
eglDestroyContext(mEglDisplay, mEglContext);
mEglContext = EGL_NO_CONTEXT;
}
- if (mEglDisplay != EGL_NO_DISPLAY)
- {
+ if (mEglDisplay != EGL_NO_DISPLAY) {
eglTerminate(mEglDisplay);
mEglDisplay = EGL_NO_DISPLAY;
}
};
-ContextEGL::ContextEGL(CoreWindow^ p_window) :
- mEglDisplay(EGL_NO_DISPLAY),
- mEglContext(EGL_NO_CONTEXT),
- mEglSurface(EGL_NO_SURFACE)
- {
+ContextEGL::ContextEGL(CoreWindow ^ p_window)
+ : mEglDisplay(EGL_NO_DISPLAY),
+ mEglContext(EGL_NO_CONTEXT),
+ mEglSurface(EGL_NO_SURFACE) {
window = p_window;
};
@@ -215,4 +202,3 @@ ContextEGL::~ContextEGL() {
cleanup();
};
-