mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 14:21:04 +08:00
Drain errors in [E]GLCheck via loop
This commit is contained in:
parent
7cec342b2b
commit
eb4a2dbe0f
@ -29,10 +29,15 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
|
||||
#include <SFML/Graphics/GLExtensions.hpp>
|
||||
|
||||
#include <SFML/System/Err.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
namespace sf::priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -56,16 +61,24 @@ bool glCheckError(const std::filesystem::path& file, unsigned int line, std::str
|
||||
#define glCheck(...) \
|
||||
[](auto&& glCheckInternalFunction) \
|
||||
{ \
|
||||
if (const GLenum glCheckInternalError = glGetError(); glCheckInternalError != GL_NO_ERROR) \
|
||||
sf::err() << "OpenGL error (" << glCheckInternalError << ") detected during glCheck call" << std::endl; \
|
||||
\
|
||||
if constexpr (!std::is_void_v<decltype(glCheckInternalFunction())>) \
|
||||
{ \
|
||||
const auto glCheckInternalReturnValue = glCheckInternalFunction(); \
|
||||
sf::priv::glCheckError(__FILE__, static_cast<unsigned int>(__LINE__), #__VA_ARGS__); \
|
||||
\
|
||||
while (!sf::priv::glCheckError(__FILE__, static_cast<unsigned int>(__LINE__), #__VA_ARGS__)) \
|
||||
/* no-op */; \
|
||||
\
|
||||
return glCheckInternalReturnValue; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
glCheckInternalFunction(); \
|
||||
sf::priv::glCheckError(__FILE__, static_cast<unsigned int>(__LINE__), #__VA_ARGS__); \
|
||||
\
|
||||
while (!sf::priv::glCheckError(__FILE__, static_cast<unsigned int>(__LINE__), #__VA_ARGS__)) \
|
||||
/* no-op */; \
|
||||
} \
|
||||
}([&]() { return __VA_ARGS__; })
|
||||
#else
|
||||
|
@ -29,8 +29,13 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
|
||||
#include <SFML/System/Err.hpp>
|
||||
|
||||
#include <glad/egl.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
namespace sf::priv
|
||||
@ -57,16 +62,24 @@ bool eglCheckError(const std::filesystem::path& file, unsigned int line, std::st
|
||||
#define eglCheck(...) \
|
||||
[](auto&& eglCheckInternalFunction) \
|
||||
{ \
|
||||
if (const EGLint eglCheckInternalError = eglGetError(); eglCheckInternalError != EGL_SUCCESS) \
|
||||
sf::err() << "EGL error (" << eglCheckInternalError << ") detected during eglCheck call" << std::endl; \
|
||||
\
|
||||
if constexpr (!std::is_void_v<decltype(eglCheckInternalFunction())>) \
|
||||
{ \
|
||||
const auto eglCheckInternalReturnValue = eglCheckInternalFunction(); \
|
||||
sf::priv::eglCheckError(__FILE__, static_cast<unsigned int>(__LINE__), #__VA_ARGS__); \
|
||||
\
|
||||
while (!sf::priv::eglCheckError(__FILE__, static_cast<unsigned int>(__LINE__), #__VA_ARGS__)) \
|
||||
/* no-op */; \
|
||||
\
|
||||
return eglCheckInternalReturnValue; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
eglCheckInternalFunction(); \
|
||||
sf::priv::eglCheckError(__FILE__, static_cast<unsigned int>(__LINE__), #__VA_ARGS__); \
|
||||
\
|
||||
while (!sf::priv::eglCheckError(__FILE__, static_cast<unsigned int>(__LINE__), #__VA_ARGS__)) \
|
||||
/* no-op */; \
|
||||
} \
|
||||
}([&]() { return __VA_ARGS__; })
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user