Better error message when GLEW initialization fails
This commit is contained in:
parent
c5c8a18c99
commit
e43a26d64c
10
kitty/gl.h
10
kitty/gl.h
@ -67,17 +67,17 @@ check_for_gl_error(int line) {
|
||||
#endif
|
||||
|
||||
static PyObject*
|
||||
glew_init(PyObject UNUSED *self) {
|
||||
glew_init(PyObject UNUSED *self, PyObject *is_wayland) {
|
||||
#ifndef __APPLE__
|
||||
GLenum err = glewInit();
|
||||
if (err != GLEW_OK) {
|
||||
PyErr_Format(PyExc_RuntimeError, "GLEW init failed: [%d] %s", err, glewGetErrorString(err));
|
||||
return NULL;
|
||||
if (PyObject_IsTrue(is_wayland)) {
|
||||
fatal("GLEW init failed: [%d] %s. On Wayland, GLEW must be compiled with the EGL backend instead of the GLX backend.", err, glewGetErrorString(err));
|
||||
} else fatal("GLEW init failed: [%d] %s", err, glewGetErrorString(err));
|
||||
}
|
||||
#define ARB_TEST(name) \
|
||||
if (!GLEW_ARB_##name) { \
|
||||
PyErr_Format(PyExc_RuntimeError, "The OpenGL driver on this system is missing the required extension: ARB_%s", #name); \
|
||||
return NULL; \
|
||||
fatal("The OpenGL driver on this system is missing the required extension: ARB_%s", #name); \
|
||||
}
|
||||
ARB_TEST(texture_storage);
|
||||
#undef ARB_TEST
|
||||
|
||||
@ -158,7 +158,7 @@ def initialize_window(window, opts):
|
||||
w, h = window.get_window_size()
|
||||
viewport_size.x_ratio = viewport_size.width / float(w)
|
||||
viewport_size.y_ratio = viewport_size.height / float(h)
|
||||
glewInit()
|
||||
glewInit(iswayland)
|
||||
glfw_swap_interval(0)
|
||||
clear_buffers(window.swap_buffers, color_as_int(opts.background))
|
||||
# We dont turn this on as it causes rendering performance to be much worse,
|
||||
|
||||
@ -596,7 +596,7 @@ PYWRAP0(check_for_extensions) {
|
||||
#define M(name, arg_type) {#name, (PyCFunction)name, arg_type, NULL}
|
||||
#define MW(name, arg_type) {#name, (PyCFunction)py##name, arg_type, NULL}
|
||||
static PyMethodDef module_methods[] = {
|
||||
{"glewInit", (PyCFunction)glew_init, METH_NOARGS, NULL},
|
||||
{"glewInit", (PyCFunction)glew_init, METH_O, NULL},
|
||||
M(compile_program, METH_VARARGS),
|
||||
MW(check_for_extensions, METH_NOARGS),
|
||||
MW(create_vao, METH_NOARGS),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user