mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Use eglCheck
macro as an expression instead of a statement
Applies missed changes in pr #3239
This commit is contained in:
parent
da1f652c22
commit
04b1808522
@ -484,7 +484,7 @@ EGLDisplay getInitializedDisplay()
|
|||||||
{
|
{
|
||||||
gladLoaderLoadEGL(EGL_NO_DISPLAY);
|
gladLoaderLoadEGL(EGL_NO_DISPLAY);
|
||||||
|
|
||||||
eglCheck(display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(gbmDevice)));
|
display = eglCheck(eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(gbmDevice)));
|
||||||
|
|
||||||
EGLint major = 0;
|
EGLint major = 0;
|
||||||
EGLint minor = 0;
|
EGLint minor = 0;
|
||||||
@ -576,8 +576,7 @@ DRMContext::DRMContext(DRMContext* shared, const ContextSettings& settings, Vect
|
|||||||
DRMContext::~DRMContext()
|
DRMContext::~DRMContext()
|
||||||
{
|
{
|
||||||
// Deactivate the current context
|
// Deactivate the current context
|
||||||
EGLContext currentContext = nullptr;
|
const EGLContext currentContext = eglCheck(eglGetCurrentContext());
|
||||||
eglCheck(currentContext = eglGetCurrentContext());
|
|
||||||
|
|
||||||
if (currentContext == m_context)
|
if (currentContext == m_context)
|
||||||
{
|
{
|
||||||
@ -618,7 +617,7 @@ bool DRMContext::makeCurrent(bool current)
|
|||||||
{
|
{
|
||||||
const EGLSurface surface = current ? m_surface : EGL_NO_SURFACE;
|
const EGLSurface surface = current ? m_surface : EGL_NO_SURFACE;
|
||||||
const EGLContext context = current ? m_context : EGL_NO_CONTEXT;
|
const EGLContext context = current ? m_context : EGL_NO_CONTEXT;
|
||||||
return m_surface != EGL_NO_SURFACE && eglMakeCurrent(m_display, surface, surface, context);
|
return m_surface != EGL_NO_SURFACE && eglCheck(eglMakeCurrent(m_display, surface, surface, context));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -700,10 +699,10 @@ void DRMContext::createContext(DRMContext* shared)
|
|||||||
toShared = EGL_NO_CONTEXT;
|
toShared = EGL_NO_CONTEXT;
|
||||||
|
|
||||||
if (toShared != EGL_NO_CONTEXT)
|
if (toShared != EGL_NO_CONTEXT)
|
||||||
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglCheck(eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
|
||||||
|
|
||||||
// Create EGL context
|
// Create EGL context
|
||||||
eglCheck(m_context = eglCreateContext(m_display, m_config, toShared, contextVersion));
|
m_context = eglCheck(eglCreateContext(m_display, m_config, toShared, contextVersion));
|
||||||
if (m_context == EGL_NO_CONTEXT)
|
if (m_context == EGL_NO_CONTEXT)
|
||||||
err() << "Failed to create EGL context" << std::endl;
|
err() << "Failed to create EGL context" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ EGLDisplay getInitializedDisplay()
|
|||||||
|
|
||||||
if (display == EGL_NO_DISPLAY)
|
if (display == EGL_NO_DISPLAY)
|
||||||
{
|
{
|
||||||
eglCheck(display = eglGetDisplay(EGL_DEFAULT_DISPLAY));
|
display = eglCheck(eglGetDisplay(EGL_DEFAULT_DISPLAY));
|
||||||
eglCheck(eglInitialize(display, nullptr, nullptr));
|
eglCheck(eglInitialize(display, nullptr, nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ EglContext::EglContext(EglContext* shared)
|
|||||||
// but this is resulting in a segfault. Bug in Android?
|
// but this is resulting in a segfault. Bug in Android?
|
||||||
EGLint attribList[] = {EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE};
|
EGLint attribList[] = {EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE};
|
||||||
|
|
||||||
eglCheck(m_surface = eglCreatePbufferSurface(m_display, m_config, attribList));
|
m_surface = eglCheck(eglCreatePbufferSurface(m_display, m_config, attribList));
|
||||||
|
|
||||||
// Create EGL context
|
// Create EGL context
|
||||||
createContext(shared);
|
createContext(shared);
|
||||||
@ -190,8 +190,7 @@ EglContext::~EglContext()
|
|||||||
cleanupUnsharedResources();
|
cleanupUnsharedResources();
|
||||||
|
|
||||||
// Deactivate the current context
|
// Deactivate the current context
|
||||||
EGLContext currentContext = EGL_NO_CONTEXT;
|
const EGLContext currentContext = eglCheck(eglGetCurrentContext());
|
||||||
eglCheck(currentContext = eglGetCurrentContext());
|
|
||||||
|
|
||||||
if (currentContext == m_context)
|
if (currentContext == m_context)
|
||||||
{
|
{
|
||||||
@ -227,18 +226,10 @@ bool EglContext::makeCurrent(bool current)
|
|||||||
if (m_surface == EGL_NO_SURFACE)
|
if (m_surface == EGL_NO_SURFACE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
EGLBoolean result = EGL_FALSE;
|
|
||||||
|
|
||||||
if (current)
|
if (current)
|
||||||
{
|
return EGL_FALSE != eglCheck(eglMakeCurrent(m_display, m_surface, m_surface, m_context));
|
||||||
eglCheck(result = eglMakeCurrent(m_display, m_surface, m_surface, m_context));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
eglCheck(result = eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result != EGL_FALSE;
|
return EGL_FALSE != eglCheck(eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -270,17 +261,17 @@ void EglContext::createContext(EglContext* shared)
|
|||||||
toShared = EGL_NO_CONTEXT;
|
toShared = EGL_NO_CONTEXT;
|
||||||
|
|
||||||
if (toShared != EGL_NO_CONTEXT)
|
if (toShared != EGL_NO_CONTEXT)
|
||||||
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglCheck(eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
|
||||||
|
|
||||||
// Create EGL context
|
// Create EGL context
|
||||||
eglCheck(m_context = eglCreateContext(m_display, m_config, toShared, contextVersion));
|
m_context = eglCheck(eglCreateContext(m_display, m_config, toShared, contextVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void EglContext::createSurface(EGLNativeWindowType window)
|
void EglContext::createSurface(EGLNativeWindowType window)
|
||||||
{
|
{
|
||||||
eglCheck(m_surface = eglCreateWindowSurface(m_display, m_config, window, nullptr));
|
m_surface = eglCheck(eglCreateWindowSurface(m_display, m_config, window, nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -378,30 +369,19 @@ void EglContext::updateSettings()
|
|||||||
m_settings.stencilBits = 0;
|
m_settings.stencilBits = 0;
|
||||||
m_settings.antiAliasingLevel = 0;
|
m_settings.antiAliasingLevel = 0;
|
||||||
|
|
||||||
EGLBoolean result = EGL_FALSE;
|
|
||||||
EGLint tmp = 0;
|
EGLint tmp = 0;
|
||||||
|
|
||||||
// Update the internal context settings with the current config
|
// Update the internal context settings with the current config
|
||||||
eglCheck(result = eglGetConfigAttrib(m_display, m_config, EGL_DEPTH_SIZE, &tmp));
|
if (eglCheck(eglGetConfigAttrib(m_display, m_config, EGL_DEPTH_SIZE, &tmp)) != EGL_FALSE)
|
||||||
|
|
||||||
if (result != EGL_FALSE)
|
|
||||||
m_settings.depthBits = static_cast<unsigned int>(tmp);
|
m_settings.depthBits = static_cast<unsigned int>(tmp);
|
||||||
|
|
||||||
eglCheck(result = eglGetConfigAttrib(m_display, m_config, EGL_STENCIL_SIZE, &tmp));
|
if (eglCheck(eglGetConfigAttrib(m_display, m_config, EGL_STENCIL_SIZE, &tmp)) != EGL_FALSE)
|
||||||
|
|
||||||
if (result != EGL_FALSE)
|
|
||||||
m_settings.stencilBits = static_cast<unsigned int>(tmp);
|
m_settings.stencilBits = static_cast<unsigned int>(tmp);
|
||||||
|
|
||||||
eglCheck(result = eglGetConfigAttrib(m_display, m_config, EGL_SAMPLE_BUFFERS, &tmp));
|
if (eglCheck(eglGetConfigAttrib(m_display, m_config, EGL_SAMPLE_BUFFERS, &tmp)) != EGL_FALSE && tmp &&
|
||||||
|
eglCheck(eglGetConfigAttrib(m_display, m_config, EGL_SAMPLES, &tmp)) != EGL_FALSE)
|
||||||
if ((result != EGL_FALSE) && tmp)
|
|
||||||
{
|
|
||||||
eglCheck(result = eglGetConfigAttrib(m_display, m_config, EGL_SAMPLES, &tmp));
|
|
||||||
|
|
||||||
if (result != EGL_FALSE)
|
|
||||||
m_settings.antiAliasingLevel = static_cast<unsigned int>(tmp);
|
m_settings.antiAliasingLevel = static_cast<unsigned int>(tmp);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(SFML_SYSTEM_LINUX) && !defined(SFML_USE_DRM)
|
#if defined(SFML_SYSTEM_LINUX) && !defined(SFML_USE_DRM)
|
||||||
|
Loading…
Reference in New Issue
Block a user