summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-04-17 09:56:08 -0400
committerAndrew Opalach <andrew@akon.city> 2025-04-17 09:56:08 -0400
commit10fe1253ffdc3ffc775226291a87159a626e4823 (patch)
tree50ba9093d60cd82983311593702c97f17dd00343 /src
parenta3fb42db50542a7e1fca8662d08d3764006c9887 (diff)
downloadstela-10fe1253ffdc3ffc775226291a87159a626e4823.tar.gz
stela-10fe1253ffdc3ffc775226291a87159a626e4823.tar.bz2
stela-10fe1253ffdc3ffc775226291a87159a626e4823.zip
Bring in-line with logging changes
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src')
-rw-r--r--src/egl_common.c26
-rw-r--r--src/gl_common.c2
-rw-r--r--src/poll_common.c4
-rw-r--r--src/window.c4
-rw-r--r--src/window_glfm.c4
-rw-r--r--src/window_glfw.c16
-rw-r--r--src/window_wayland.c10
-rw-r--r--src/window_win32.c2
-rw-r--r--src/window_x11.c6
9 files changed, 38 insertions, 36 deletions
diff --git a/src/egl_common.c b/src/egl_common.c
index ae37f67..cfb2f23 100644
--- a/src/egl_common.c
+++ b/src/egl_common.c
@@ -22,7 +22,7 @@ bool stl_maybe_load_egl(void)
#ifdef STELA_USE_GLAD
s32 egl_version = gladLoaderLoadEGL(NULL);
if (!egl_version) {
- error("Failed to pre-load EGL (glad).");
+ log_error("Failed to pre-load EGL (glad).");
return false;
}
#endif
@@ -33,20 +33,20 @@ bool stl_load_egl(struct stl_egl_global *global)
{
EGLint major, minor;
if (!eglInitialize(global->display, &major, &minor)) {
- error("Failed to initialize.");
+ log_error("Failed to initialize.");
return false;
}
- info("Initialized EGL version %d.%d.", major, minor);
+ log_info("Initialized EGL version %d.%d.", major, minor);
#ifdef STELA_USE_GLAD
s32 egl_version = gladLoaderLoadEGL(global->display);
if (!egl_version) {
- error("Failed to load EGL (glad).");
+ log_error("Failed to load EGL (glad).");
return false;
}
- info("Using EGL (glad) version %s.", eglQueryString(global->display, EGL_VERSION));
+ log_info("Using EGL (glad) version %s.", eglQueryString(global->display, EGL_VERSION));
#else
- info("Using EGL version %s.", eglQueryString(global->display, EGL_VERSION));
+ log_info("Using EGL version %s.", eglQueryString(global->display, EGL_VERSION));
#endif
return true;
@@ -80,14 +80,14 @@ static bool egl_choose_config(EGLDisplay display, const EGLint *attribs, EGLint
EGLint count = 0;
if (!eglGetConfigs(display, NULL, 0, &count) || count <= 0) {
- error("No configs to choose from.");
+ log_error("No configs to choose from.");
return false;
}
EGLint matched = 0;
EGLConfig *configs = (EGLConfig *)al_malloc(count * sizeof(EGLConfig));
if (!eglChooseConfig(display, attribs, configs, count, &matched) || !matched) {
- error("No configs with appropriate attributes.");
+ log_error("No configs with appropriate attributes.");
goto out;
}
@@ -137,11 +137,11 @@ bool stl_init_egl_context(struct stl_egl *egl, struct stl_egl_global *global, EG
};
if (!egl_choose_config(egl->display, window_attr, visual_id, config)) {
- error("Failed to get config.");
+ log_error("Failed to get config.");
continue;
}
- info("Trying to create a %s context of version %i.%i (GLSL %i).",
+ log_info("Trying to create a %s context of version %i.%i (GLSL %i).",
stl_gl_vers[i].api == STELA_GL_API ? "GL" : "GLES",
stl_gl_vers[i].major, stl_gl_vers[i].minor, stl_gl_vers[i].glsl_ver);
@@ -150,13 +150,13 @@ bool stl_init_egl_context(struct stl_egl *egl, struct stl_egl_global *global, EG
if (egl->context == EGL_NO_CONTEXT) {
continue;
} else {
- info("Context successfully created.");
+ log_info("Context successfully created.");
break;
}
}
if (egl->context == EGL_NO_CONTEXT) {
- info("Failed to create context.");
+ log_info("Failed to create context.");
return false;
}
@@ -247,6 +247,6 @@ void stl_egl_check_error()
{
EGLint error;
while ((error = eglGetError()) != EGL_SUCCESS) {
- error("EGL error %s, %d.", eglGetErrorString(error), error);
+ log_error("EGL error %s, %d.", eglGetErrorString(error), error);
}
}
diff --git a/src/gl_common.c b/src/gl_common.c
index 93d1384..0005e5d 100644
--- a/src/gl_common.c
+++ b/src/gl_common.c
@@ -24,7 +24,7 @@ bool stl_gl_check_error()
GLenum error;
bool any_error = false;
while ((error = glGetError()) != GL_NO_ERROR) {
- error("GL error %s, %d.", glGetErrorString(error), error);
+ log_error("GL error %s, %d.", glGetErrorString(error), error);
any_error = true;
}
return any_error;
diff --git a/src/poll_common.c b/src/poll_common.c
index a575bf5..a79e0de 100644
--- a/src/poll_common.c
+++ b/src/poll_common.c
@@ -17,14 +17,14 @@ bool stl_poll_common(struct nn_pollfd *fds, bool block)
#else
if (nn_poll_fds(fds, 1, (block) ? -1 : 0) < 0 && errno != EINTR) {
#endif
- error("poll() failed %s (%d).", nn_strerror(errno), errno);
+ log_error("poll() failed %s (%d).", nn_strerror(errno), errno);
return false;
}
// On Wayland this will happen consistantly if the program is lagging too hard.
// https://github.com/swaywm/sway/commit/e3f0ba4cd9ca709cac115ade54958885614d889c
if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) { // Fatal error.
- error("poll() returned error in revents (%d).", fds[0].revents);
+ log_error("poll() returned error in revents (%d).", fds[0].revents);
al_assert(false);
exit(0);
return false;
diff --git a/src/window.c b/src/window.c
index 505e1a7..bb54461 100644
--- a/src/window.c
+++ b/src/window.c
@@ -14,14 +14,16 @@ void stl_window_init(struct stl_window *window)
#endif
}
+#ifdef STELA_EVENT_BUFFER
#define GET_EVENT_CHUNK(op) \
size_t size; \
u8 *ptr = al_ring_buffer_write_chunk(&window->events, &size); \
if (size < STELA_EVENT_SIZE) { \
- warn("Buffer full, discarding event."); \
+ log_warn("Buffer full, discarding event."); \
return; \
} \
ptr[0] = op
+#endif
#define APPEND_EVENT_CHUNK() \
al_ring_buffer_append(&window->events, ptr, STELA_EVENT_SIZE)
diff --git a/src/window_glfm.c b/src/window_glfm.c
index 34a631e..dd16d77 100644
--- a/src/window_glfm.c
+++ b/src/window_glfm.c
@@ -38,7 +38,7 @@ static void onSurfaceCreated(GLFMDisplay *display, s32 width, s32 height)
GLFMRenderingAPI api = glfmGetRenderingAPI(display);
(void)width;
(void)height;
- info("Created GLES context of version %s.",
+ log_info("Created GLES context of version %s.",
api == GLFMRenderingAPIOpenGLES32 ? "3.2" :
api == GLFMRenderingAPIOpenGLES31 ? "3.1" :
api == GLFMRenderingAPIOpenGLES3 ? "3.0" : "2.0");
@@ -181,7 +181,7 @@ static void window_glfm_gl_swap_buffers(void *data)
struct stl_window *stl_window_create(void)
{
- info("Wrapping GLFM window.");
+ log_info("Wrapping GLFM window.");
struct stl_window_glfm *glfm = al_alloc_object(struct stl_window_glfm);
stl_window_init(&glfm->w);
glfm->w.fullscreen = false;
diff --git a/src/window_glfw.c b/src/window_glfw.c
index 5ea00ac..eca7e91 100644
--- a/src/window_glfw.c
+++ b/src/window_glfw.c
@@ -34,7 +34,7 @@ void stl_set_output_discovered_callback(void (*output_discovered)(void *, struct
static void error_callback(s32 error_code, const char *description)
{
- error("GLFW Error %d: %s.", error_code, description);
+ log_error("GLFW Error %d: %s.", error_code, description);
}
bool stl_global_init(bool skip_graphics)
@@ -43,7 +43,7 @@ bool stl_global_init(bool skip_graphics)
glfwSetErrorCallback(error_callback);
if (!glfwInit()) {
- error("Failed to initialize GLFW.");
+ log_error("Failed to initialize GLFW.");
return false;
}
@@ -79,7 +79,7 @@ static void key_callback(GLFWwindow *window, s32 key, s32 scancode, s32 action,
(void)mods;
al_assert(key >= 0 && key <= UINT16_MAX);
if (key == GLFW_KEY_F25 || key == GLFW_KEY_WORLD_1 || key == GLFW_KEY_WORLD_2) {
- warn("Unmapped GLFW key pressed (%hu).", (u16)key);
+ log_warn("Unmapped GLFW key pressed (%hu).", (u16)key);
return;
}
if (action == GLFW_PRESS) {
@@ -187,7 +187,7 @@ static bool window_glfw_create_window(struct stl_window *window, u32 width, u32
#if defined STELA_API_VULKAN
if (!glfwVulkanSupported()) {
- error("Vulkan not supported.");
+ log_error("Vulkan not supported.");
return false;
}
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
@@ -207,21 +207,21 @@ static bool window_glfw_create_window(struct stl_window *window, u32 width, u32
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
}
#endif
- info("Trying to make a %s context of version %i.%i (GLSL %i).",
+ log_info("Trying to make a %s context of version %i.%i (GLSL %i).",
stl_gl_vers[i].api == STELA_GL_API ? "GL" : "GLES",
stl_gl_vers[i].major, stl_gl_vers[i].minor, stl_gl_vers[i].glsl_ver);
#endif
glfw->window = glfwCreateWindow(width, height, name, NULL, global.master_window);
#ifdef STELA_API_OPENGL
if (glfw->window) {
- info("Context successfully created.");
+ log_info("Context successfully created.");
break;
}
}
#endif
if (!glfw->window) {
- info("Failed to create window.");
+ log_info("Failed to create window.");
return false;
}
@@ -456,7 +456,7 @@ static void window_glfw_gl_swap_buffers(void *data)
struct stl_window *stl_window_create(void)
{
- info("Creating GLFW3 window.");
+ log_info("Creating GLFW3 window.");
struct stl_window_glfw *glfw = al_alloc_object(struct stl_window_glfw);
stl_window_init(&glfw->w);
glfw->w.fullscreen = false;
diff --git a/src/window_wayland.c b/src/window_wayland.c
index e047363..ff5875b 100644
--- a/src/window_wayland.c
+++ b/src/window_wayland.c
@@ -56,7 +56,7 @@ static void handle_output_done(void *data, struct wl_output *output)
{
struct stl_monitor_wayland *monitor = (struct stl_monitor_wayland *)data;
(void)output;
- info("Output discovered: %s (%ux%u) (vertical: %s).",
+ log_info("Output discovered: %s (%ux%u) (vertical: %s).",
monitor->m.name, monitor->m.width, monitor->m.height, BOOLSTR(monitor->m.vertical));
if (global.output_discovered) {
global.output_discovered(global.userdata, (struct stl_monitor *)monitor);
@@ -262,7 +262,7 @@ bool stl_global_init(bool skip_graphics)
{
global.display = wl_display_connect(NULL);
if (!global.display) {
- error("Failed to connect to the display.");
+ log_error("Failed to connect to the display.");
return false;
}
global.display_fd = wl_display_get_fd(global.display);
@@ -272,7 +272,7 @@ bool stl_global_init(bool skip_graphics)
if (!stl_maybe_load_egl()) return false;
global.egl.display = eglGetDisplay((EGLNativeDisplayType)global.display);
if (!global.egl.display) {
- error("Failed to get wayland-native EGL display.");
+ log_error("Failed to get wayland-native EGL display.");
return false;
}
if (!stl_load_egl(&global.egl)) return false;
@@ -973,7 +973,7 @@ static bool window_wayland_create_window(struct stl_window *window, u32 width, u
return true;
err:
- error("Failed to create window.");
+ log_error("Failed to create window.");
wl->w.free((struct stl_window **)&wl);
return false;
}
@@ -1127,7 +1127,7 @@ static void window_wayland_gl_swap_buffers(void *data)
struct stl_window *stl_window_create(void)
{
- info("Creating Wayland (EGL) window.");
+ log_info("Creating Wayland (EGL) window.");
struct stl_window_wayland *wl = al_alloc_object(struct stl_window_wayland);
stl_window_init(&wl->w);
wl->w.fullscreen = false;
diff --git a/src/window_win32.c b/src/window_win32.c
index a1ab236..84ecc16 100644
--- a/src/window_win32.c
+++ b/src/window_win32.c
@@ -452,7 +452,7 @@ static void window_win32_free(struct stl_window **window)
struct stl_window *stl_window_create(void)
{
- info("Creating Win32 window.");
+ log_info("Creating Win32 window.");
struct stl_window_win32 *w32 = al_alloc_object(struct stl_window_win32);
stl_window_init(&w32->w);
w32->w.fullscreen = true;
diff --git a/src/window_x11.c b/src/window_x11.c
index 2dc62ee..8d6fe91 100644
--- a/src/window_x11.c
+++ b/src/window_x11.c
@@ -26,7 +26,7 @@ bool stl_global_init(bool skip_graphics)
{
global.x11_d = XOpenDisplay(NULL);
if (!global.x11_d) {
- error("Couldn't open display.");
+ log_error("Couldn't open display.");
return false;
}
global.root = XRootWindow(global.x11_d, XDefaultScreen(global.x11_d));
@@ -36,7 +36,7 @@ bool stl_global_init(bool skip_graphics)
if (!stl_maybe_load_egl()) return false;
global.egl.display = eglGetDisplay((EGLNativeDisplayType)global.x11_d);
if (!global.egl.display) {
- error("Failed to get x11 EGL display.");
+ log_error("Failed to get x11 EGL display.");
}
if (!stl_load_egl(&global.egl)) return false;
#endif
@@ -360,7 +360,7 @@ static void window_x11_gl_swap_buffers(void *data)
struct stl_window *stl_window_create(void)
{
- info("Creating X11 (EGL) window.");
+ log_info("Creating X11 (EGL) window.");
struct stl_window_x11 *xw = al_alloc_object(struct stl_window_x11);
stl_window_init(&xw->w);
xw->w.fullscreen = false;