Rename OpenGL event to GraphicsBackend (#4515)
This commit is contained in:
committed by
GitHub
parent
a33d3f00fb
commit
042f21da5c
@@ -24,7 +24,7 @@ enum class Event : uint8_t {
|
||||
HttpRequest,
|
||||
Sprite,
|
||||
Image,
|
||||
OpenGL,
|
||||
GraphicsBackend,
|
||||
JNI,
|
||||
Android,
|
||||
Crash,
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
~CGLDisplayConfig() {
|
||||
const CGLError error = CGLDestroyPixelFormat(pixelFormat);
|
||||
if (error != kCGLNoError) {
|
||||
Log::Error(Event::OpenGL,
|
||||
Log::Error(Event::GraphicsBackend,
|
||||
std::string("Error destroying pixel format:") + CGLErrorString(error));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ void tileLodZoomShift(mln::Map &map, bool positive) {
|
||||
auto shift = positive ? tileLodZoomShiftStep : -tileLodZoomShiftStep;
|
||||
shift = map.getTileLodZoomShift() + shift;
|
||||
shift = mln::util::clamp(shift, -2.5, 2.5);
|
||||
mln::Log::Info(mln::Event::OpenGL, "Zoom shift: " + std::to_string(shift));
|
||||
mln::Log::Info(mln::Event::GraphicsBackend, "Zoom shift: " + std::to_string(shift));
|
||||
map.setTileLodZoomShift(shift);
|
||||
map.triggerRepaint();
|
||||
}
|
||||
@@ -216,7 +216,8 @@ void addFillExtrusionLayer(mln::style::Style &style, bool visible) {
|
||||
} // namespace
|
||||
|
||||
void glfwError(int error, const char *description) {
|
||||
mln::Log::Error(mln::Event::OpenGL, std::string("GLFW error (") + std::to_string(error) + "): " + description);
|
||||
mln::Log::Error(mln::Event::GraphicsBackend,
|
||||
std::string("GLFW error (") + std::to_string(error) + "): " + description);
|
||||
}
|
||||
|
||||
GLFWView::GLFWView(bool fullscreen_,
|
||||
@@ -242,7 +243,7 @@ GLFWView::GLFWView(bool fullscreen_,
|
||||
#endif
|
||||
|
||||
if (!glfwInit()) {
|
||||
mln::Log::Error(mln::Event::OpenGL, "failed to initialize glfw");
|
||||
mln::Log::Error(mln::Event::GraphicsBackend, "failed to initialize glfw");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -288,7 +289,7 @@ GLFWView::GLFWView(bool fullscreen_,
|
||||
window = glfwCreateWindow(width, height, "MapLibre Native", monitor, nullptr);
|
||||
if (!window) {
|
||||
glfwTerminate();
|
||||
mln::Log::Error(mln::Event::OpenGL, "failed to initialize window");
|
||||
mln::Log::Error(mln::Event::GraphicsBackend, "failed to initialize window");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
}
|
||||
|
||||
if (!eglBindAPI(EGL_OPENGL_ES_API)) {
|
||||
mln::Log::Error(mln::Event::OpenGL,
|
||||
mln::Log::Error(mln::Event::GraphicsBackend,
|
||||
"eglBindAPI(EGL_OPENGL_ES_API) returned error " + std::to_string(eglGetError()));
|
||||
throw std::runtime_error("eglBindAPI() failed");
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
if (eglContext == EGL_NO_CONTEXT) {
|
||||
std::ostringstream logMsg;
|
||||
logMsg << "eglCreateContext() returned error 0x" << std::hex << eglGetError();
|
||||
mln::Log::Error(mln::Event::OpenGL, logMsg.str());
|
||||
mln::Log::Error(mln::Event::GraphicsBackend, logMsg.str());
|
||||
|
||||
throw std::runtime_error("Error creating the EGL context object.\n");
|
||||
}
|
||||
@@ -95,12 +95,12 @@ public:
|
||||
~EGLBackendImpl() final {
|
||||
if (eglSurface != EGL_NO_SURFACE) {
|
||||
if (!eglDestroySurface(eglDisplay->display, eglSurface)) {
|
||||
Log::Error(Event::OpenGL, "Failed to destroy EGL surface.");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to destroy EGL surface.");
|
||||
}
|
||||
eglSurface = EGL_NO_SURFACE;
|
||||
}
|
||||
if (!eglDestroyContext(eglDisplay->display, eglContext)) {
|
||||
Log::Error(Event::OpenGL, "Failed to destroy EGL context.");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to destroy EGL context.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
// Try to create a legacy context.
|
||||
glContext = glXCreateNewContext(glxDisplay->xDisplay, glxDisplay->fbConfigs[0], GLX_RGBA_TYPE, None, True);
|
||||
if (glContext && !glXIsDirect(glxDisplay->xDisplay, glContext)) {
|
||||
Log::Error(Event::OpenGL, "failed to create direct OpenGL Legacy context");
|
||||
Log::Error(Event::GraphicsBackend, "failed to create direct OpenGL Legacy context");
|
||||
glXDestroyContext(glxDisplay->xDisplay, glContext);
|
||||
glContext = nullptr;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
if (!eglBindAPI(EGL_OPENGL_ES_API)) {
|
||||
std::ostringstream logMsg;
|
||||
logMsg << "eglBindAPI(EGL_OPENGL_ES_API) returned error " << eglGetError();
|
||||
mln::Log::Error(mln::Event::OpenGL, logMsg.str());
|
||||
mln::Log::Error(mln::Event::GraphicsBackend, logMsg.str());
|
||||
throw std::runtime_error("eglBindAPI() failed");
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
std::ostringstream logMsg;
|
||||
logMsg << "eglCreateContext() returned error 0x" << std::setw(4) << std::setfill('0') << std::hex
|
||||
<< eglGetError();
|
||||
mln::Log::Error(mln::Event::OpenGL, logMsg.str());
|
||||
mln::Log::Error(mln::Event::GraphicsBackend, logMsg.str());
|
||||
throw std::runtime_error("Error creating the EGL context object.\n");
|
||||
}
|
||||
|
||||
@@ -97,12 +97,12 @@ public:
|
||||
~EGLBackendImpl() final {
|
||||
if (eglSurface != EGL_NO_SURFACE) {
|
||||
if (!eglDestroySurface(eglDisplay->display, eglSurface)) {
|
||||
Log::Error(Event::OpenGL, "Failed to destroy EGL surface.");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to destroy EGL surface.");
|
||||
}
|
||||
eglSurface = EGL_NO_SURFACE;
|
||||
}
|
||||
if (!eglDestroyContext(eglDisplay->display, eglContext)) {
|
||||
Log::Error(Event::OpenGL, "Failed to destroy EGL context.");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to destroy EGL context.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ private:
|
||||
GetModuleHandleExA(0, NULL, &helperWindowClass.hInstance);
|
||||
|
||||
if (!RegisterClassExA(&helperWindowClass)) {
|
||||
Log::Error(Event::OpenGL, "Failed to register helper window class");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to register helper window class");
|
||||
throw std::runtime_error("Failed to register helper window class");
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
NULL);
|
||||
|
||||
if (!helperWindowHandle) {
|
||||
Log::Error(Event::OpenGL, "Failed to create helper window");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to create helper window");
|
||||
throw std::runtime_error("Failed to create helper window");
|
||||
}
|
||||
|
||||
@@ -141,14 +141,14 @@ public:
|
||||
// the default surface anyway; all rendering will be directed to
|
||||
// framebuffers which have their own configuration.
|
||||
if (!SetPixelFormat(dummyDC, ChoosePixelFormat(dummyDC, &pfd), &pfd)) {
|
||||
Log::Error(Event::OpenGL, "Failed to set pixel format for dummy context");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to set pixel format for dummy context");
|
||||
throw std::runtime_error("Failed to set pixel format for dummy context");
|
||||
}
|
||||
|
||||
dummyRC = wglCreateContext(dummyDC);
|
||||
|
||||
if (!dummyRC) {
|
||||
Log::Error(Event::OpenGL, "Failed to create dummy context");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to create dummy context");
|
||||
throw std::runtime_error("Failed to create dummy context");
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
|
||||
DestroyHelperWindow();
|
||||
|
||||
Log::Error(Event::OpenGL, "Failed to make dummy context current");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to make dummy context current");
|
||||
throw std::runtime_error("Failed to make dummy context current");
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
ARB_ES3_compatibility = extensionSupportedWGL("GL_ARB_ES3_compatibility");
|
||||
|
||||
if (!ARB_create_context || !ARB_create_context_profile || !ARB_ES3_compatibility) {
|
||||
Log::Error(Event::OpenGL, "OpenGL ES 3.0 is unavailable");
|
||||
Log::Error(Event::GraphicsBackend, "OpenGL ES 3.0 is unavailable");
|
||||
throw std::runtime_error("OpenGL ES 3.0 is unavailable");
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public:
|
||||
GetModuleHandleExA(0, NULL, &renderingWindowClass.hInstance);
|
||||
|
||||
if (!RegisterClassExA(&renderingWindowClass)) {
|
||||
Log::Error(Event::OpenGL, "Failed to register rendering window class");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to register rendering window class");
|
||||
throw std::runtime_error("Failed to register rendering window class");
|
||||
}
|
||||
}
|
||||
@@ -236,7 +236,7 @@ private:
|
||||
NULL);
|
||||
|
||||
if (!renderingWindowHandle) {
|
||||
Log::Error(Event::OpenGL, "Failed to create helper window");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to create helper window");
|
||||
throw std::runtime_error("Failed to create helper window");
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ private:
|
||||
|
||||
HGLRC GetContext() {
|
||||
if (!(renderingWindowRenderingContext || CreateRenderingContext())) {
|
||||
Log::Error(Event::OpenGL, "Failed to create rendering context");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to create rendering context");
|
||||
throw std::runtime_error("Failed to create rendering context");
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ private:
|
||||
1,
|
||||
&pixelFormat,
|
||||
&numFormats)) {
|
||||
Log::Error(Event::OpenGL, "Failed to choose pixel format for context");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to choose pixel format for context");
|
||||
throw std::runtime_error("Failed to choose pixel format for context");
|
||||
}
|
||||
|
||||
@@ -314,12 +314,12 @@ private:
|
||||
pfd.nSize = sizeof(pfd);
|
||||
|
||||
if (!DescribePixelFormat(renderingWindowDeviceContext, pixelFormat, sizeof(pfd), &pfd)) {
|
||||
Log::Error(Event::OpenGL, "Failed to retrieve pixel format for context");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to retrieve pixel format for context");
|
||||
throw std::runtime_error("Failed to retrieve pixel format for context");
|
||||
}
|
||||
|
||||
if (!SetPixelFormat(renderingWindowDeviceContext, pixelFormat, &pfd)) {
|
||||
Log::Error(Event::OpenGL, "Failed to set pixel format for context");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to set pixel format for context");
|
||||
throw std::runtime_error("Failed to set pixel format for context");
|
||||
}
|
||||
|
||||
@@ -340,20 +340,20 @@ private:
|
||||
const DWORD error = GetLastError();
|
||||
|
||||
if (error == (0xc0070000 | ERROR_INVALID_VERSION_ARB)) {
|
||||
Log::Error(Event::OpenGL, "Driver does not support OpenGL ES version 2.0");
|
||||
Log::Error(Event::GraphicsBackend, "Driver does not support OpenGL ES version 2.0");
|
||||
throw std::runtime_error("Driver does not support OpenGL ES version 2.0");
|
||||
} else if (error == (0xc0070000 | ERROR_INVALID_PROFILE_ARB)) {
|
||||
Log::Error(Event::OpenGL, "Driver does not support the requested OpenGL profile");
|
||||
Log::Error(Event::GraphicsBackend, "Driver does not support the requested OpenGL profile");
|
||||
throw std::runtime_error("Driver does not support the requested OpenGL profile");
|
||||
} else if (error == (0xc0070000 | ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB)) {
|
||||
Log::Error(Event::OpenGL,
|
||||
Log::Error(Event::GraphicsBackend,
|
||||
"The share context is not compatible with the "
|
||||
"requested context");
|
||||
throw std::runtime_error(
|
||||
"The share context is not compatible with the "
|
||||
"requested context");
|
||||
} else {
|
||||
Log::Error(Event::OpenGL, "Failed to create OpenGL ES context");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to create OpenGL ES context");
|
||||
throw std::runtime_error("Failed to create OpenGL ES context");
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ private:
|
||||
renderingWindowRenderingContext = wglCreateContext(renderingWindowDeviceContext);
|
||||
|
||||
if (!renderingWindowRenderingContext) {
|
||||
Log::Error(Event::OpenGL, "Failed to create OpenGL context");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to create OpenGL context");
|
||||
throw std::runtime_error("Failed to create OpenGL context");
|
||||
}
|
||||
}
|
||||
@@ -380,13 +380,13 @@ private:
|
||||
|
||||
bool DestroyRenderingContext() {
|
||||
if (renderingWindowRenderingContext && !wglMakeCurrent(renderingWindowDeviceContext, NULL)) {
|
||||
Log::Error(Event::OpenGL, "Failed to make context current");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to make context current");
|
||||
// throw std::runtime_error("Failed to make context current");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (renderingWindowRenderingContext && !wglDeleteContext(renderingWindowRenderingContext)) {
|
||||
Log::Error(Event::OpenGL, "Failed to delete current context");
|
||||
Log::Error(Event::GraphicsBackend, "Failed to delete current context");
|
||||
// throw std::runtime_error("Failed to delete current context");
|
||||
return false;
|
||||
}
|
||||
@@ -414,14 +414,14 @@ public:
|
||||
void activateContext() final {
|
||||
if (renderingWindowRenderingContext &&
|
||||
!wglMakeCurrent(renderingWindowDeviceContext, renderingWindowRenderingContext)) {
|
||||
Log::Error(Event::OpenGL, "Switching OpenGL context failed");
|
||||
Log::Error(Event::GraphicsBackend, "Switching OpenGL context failed");
|
||||
// throw std::runtime_error("Switching OpenGL context failed");
|
||||
}
|
||||
}
|
||||
|
||||
void deactivateContext() final {
|
||||
if (renderingWindowRenderingContext && !wglMakeCurrent(NULL, NULL)) {
|
||||
Log::Error(Event::OpenGL, "Removing OpenGL context failed");
|
||||
Log::Error(Event::GraphicsBackend, "Removing OpenGL context failed");
|
||||
// throw std::runtime_error("Removing OpenGL context failed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ void Debugging::DebugCallback(GLenum source,
|
||||
}
|
||||
const std::string logMsg = "GL_" + strSource + " GL_" + strType + " " + std::to_string(id) + " GL_" + strSeverity +
|
||||
" - " + message;
|
||||
mln::Log::Record(evtSeverity, mln::Event::OpenGL, logMsg);
|
||||
mln::Log::Record(evtSeverity, mln::Event::GraphicsBackend, logMsg);
|
||||
}
|
||||
|
||||
} // namespace extension
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace platform {
|
||||
#ifndef NDEBUG
|
||||
void glCheckError(const char* cmd, const char* file, int line) {
|
||||
if (GLenum err = glGetError()) {
|
||||
Log::Warning(Event::OpenGL,
|
||||
Log::Warning(Event::GraphicsBackend,
|
||||
"Error" + std::to_string(err) + ": " + cmd + " - " + file + ":" + std::to_string(line));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ void RenderLayer::checkRenderability(const PaintParameters& parameters, const ui
|
||||
}
|
||||
|
||||
if (activeBindingCount > parameters.context.maximumVertexBindingCount) {
|
||||
Log::Error(Event::OpenGL,
|
||||
Log::Error(Event::GraphicsBackend,
|
||||
"The layer '" + getID() +
|
||||
"' uses more data-driven properties than the current device "
|
||||
"supports, and will have rendering errors. To ensure "
|
||||
@@ -105,7 +105,7 @@ void RenderLayer::checkRenderability(const PaintParameters& parameters, const ui
|
||||
" fewer data driven properties in this layer.");
|
||||
hasRenderFailures = true;
|
||||
} else if (activeBindingCount > gfx::Context::minimumRequiredVertexBindingCount) {
|
||||
Log::Warning(Event::OpenGL,
|
||||
Log::Warning(Event::GraphicsBackend,
|
||||
"The layer '" + getID() +
|
||||
"' uses more data-driven properties than some devices may "
|
||||
"support. "
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
gl::AttributeKey<AttributeList>::defines(attributeBindings)))
|
||||
.first;
|
||||
} catch (const std::runtime_error& e) {
|
||||
Log::Error(Event::OpenGL, e.what());
|
||||
Log::Error(Event::GraphicsBackend, e.what());
|
||||
failedInstances.insert(key);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ MBGL_DEFINE_ENUM(Event,
|
||||
{Event::HttpRequest, "HttpRequest"},
|
||||
{Event::Sprite, "Sprite"},
|
||||
{Event::Image, "Image"},
|
||||
{Event::OpenGL, "OpenGL"},
|
||||
{Event::GraphicsBackend, "GraphicsBackend"},
|
||||
{Event::JNI, "JNI"},
|
||||
{Event::Android, "Android"},
|
||||
{Event::Crash, "Crash"},
|
||||
|
||||
Reference in New Issue
Block a user