os -> wm; *_w32_ -> w32_*_, *_lnx_ -> lnx_*_

This commit is contained in:
Ryan Fleury committed 2026-05-08 21:17:21 -07:00
1 parent 9a7782de47
commit 2f6d0f9aaa
52 files changed
+3086 -3115

No files matched your search

@@ -23,7 +23,7 @@ r_ogl_os_init(CmdLine *cmdln)
r_ogl_lnx_state->display = eglGetDisplay((EGLNativeDisplayType)os_lnx_gfx_state->display);
if(r_ogl_lnx_state->display == EGL_NO_DISPLAY)
{
os_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Failed to get EGL display."));
wm_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Failed to get EGL display."));
abort_self(1);
}
}
@@ -33,14 +33,14 @@ r_ogl_os_init(CmdLine *cmdln)
EGLint egl_version_minor = 0;
if(!eglInitialize(r_ogl_lnx_state->display, &egl_version_major, &egl_version_minor))
{
os_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't initialize EGL display."));
wm_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't initialize EGL display."));
abort_self(1);
}
if(egl_version_major < 1 || (egl_version_major == 1 && egl_version_minor < 5))
{
Temp scratch = scratch_begin(0, 0);
String8 message = push_str8f(scratch.arena, "Unsupported EGL version (%i.%i, need at least 1.5)", egl_version_major, egl_version_minor);
os_graphical_message(1, str8_lit("Fatal Error"), message);
wm_graphical_message(1, str8_lit("Fatal Error"), message);
abort_self(1);
scratch_end(scratch);
}
@@ -48,7 +48,7 @@ r_ogl_os_init(CmdLine *cmdln)
//- rjf: pick GL API
if(!eglBindAPI(EGL_OPENGL_API))
{
os_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't initialize EGL API to OpenGL."));
wm_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't initialize EGL API to OpenGL."));
abort_self(1);
}
@@ -69,7 +69,7 @@ r_ogl_os_init(CmdLine *cmdln)
r_ogl_lnx_state->context = eglCreateContext(r_ogl_lnx_state->display, 0, EGL_NO_CONTEXT, options);
if(r_ogl_lnx_state->context == EGL_NO_CONTEXT)
{
os_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't create OpenGL context with EGL."));
wm_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't create OpenGL context with EGL."));
abort_self(1);
}
}
@@ -79,9 +79,9 @@ r_ogl_os_init(CmdLine *cmdln)
}
internal R_Handle
r_ogl_os_window_equip(OS_Window window)
r_ogl_os_window_equip(WM_Window window)
{
OS_LNX_Window *window_os = (OS_LNX_Window *)window.u64[0];
LNX_WM_Window *window_os = (LNX_WM_Window *)window.u64[0];
R_OGL_LNX_Window *w = r_ogl_lnx_state->free_window;
if(w != 0)
{
@@ -120,7 +120,7 @@ r_ogl_os_window_equip(OS_Window window)
};
if(!eglChooseConfig(r_ogl_lnx_state->display, options, configs, ArrayCount(configs), &configs_count) || configs_count == 0)
{
os_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't choose EGL configuration."));
wm_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't choose EGL configuration."));
abort_self(1);
}
}
@@ -143,7 +143,7 @@ r_ogl_os_window_equip(OS_Window window)
}
if(r_ogl_lnx_state->config == 0)
{
os_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't find a suitable EGL configuration."));
wm_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't find a suitable EGL configuration."));
abort_self(1);
}
}
@@ -154,7 +154,7 @@ r_ogl_os_window_equip(OS_Window window)
}
if(w->surface == EGL_NO_SURFACE)
{
os_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't create EGL surface."));
wm_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't create EGL surface."));
abort_self(1);
}
}
@@ -163,7 +163,7 @@ r_ogl_os_window_equip(OS_Window window)
}
internal void
r_ogl_os_window_unequip(OS_Window os, R_Handle r)
r_ogl_os_window_unequip(WM_Window os, R_Handle r)
{
R_OGL_LNX_Window *w = (R_OGL_LNX_Window *)r.u64[0];
{
@@ -173,17 +173,17 @@ r_ogl_os_window_unequip(OS_Window os, R_Handle r)
}
internal void
r_ogl_os_select_window(OS_Window os, R_Handle r)
r_ogl_os_select_window(WM_Window os, R_Handle r)
{
OS_LNX_Window *w = (OS_LNX_Window *)os.u64[0];
LNX_WM_Window *w = (LNX_WM_Window *)os.u64[0];
R_OGL_LNX_Window *w_r = (R_OGL_LNX_Window *)r.u64[0];
eglMakeCurrent(r_ogl_lnx_state->display, w_r->surface, w_r->surface, r_ogl_lnx_state->context);
}
internal void
r_ogl_os_window_swap(OS_Window os, R_Handle r)
r_ogl_os_window_swap(WM_Window os, R_Handle r)
{
OS_LNX_Window *w = (OS_LNX_Window *)os.u64[0];
LNX_WM_Window *w = (LNX_WM_Window *)os.u64[0];
R_OGL_LNX_Window *w_r = (R_OGL_LNX_Window *)r.u64[0];
eglSwapBuffers(r_ogl_lnx_state->display, w_r->surface);
}
@@ -20,7 +20,7 @@ r_ogl_os_init(CmdLine *cmdln)
{
Temp scratch = scratch_begin(0, 0);
String8 message = push_str8f(scratch.arena, "Unsupported GLX version (%i.%i, need at least 1.3)", glx_version_major, glx_version_minor);
os_graphical_message(1, str8_lit("Fatal Error"), message);
wm_graphical_message(1, str8_lit("Fatal Error"), message);
abort_self(1);
scratch_end(scratch);
}
@@ -45,7 +45,7 @@ r_ogl_os_init(CmdLine *cmdln)
GLXFBConfig *framebuffer_configs = glXChooseFBConfig(os_lnx_gfx_state->display, DefaultScreen(os_lnx_gfx_state->display), framebuffer_config_options, &framebuffer_configs_count);
if(framebuffer_configs == 0)
{
os_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Could not find a suitable framebuffer configuration."));
wm_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Could not find a suitable framebuffer configuration."));
abort_self(1);
}
GLXFBConfig framebuffer_config = framebuffer_configs[0];
@@ -79,28 +79,28 @@ r_ogl_os_init(CmdLine *cmdln)
}
internal R_Handle
r_ogl_os_window_equip(OS_Window window)
r_ogl_os_window_equip(WM_Window window)
{
R_Handle result = {0};
return result;
}
internal void
r_ogl_os_window_unequip(OS_Window os, R_Handle r)
r_ogl_os_window_unequip(WM_Window os, R_Handle r)
{
}
internal void
r_ogl_os_select_window(OS_Window os, R_Handle r)
r_ogl_os_select_window(WM_Window os, R_Handle r)
{
OS_LNX_Window *w = (OS_LNX_Window *)os.u64[0];
LNX_WM_Window *w = (LNX_WM_Window *)os.u64[0];
glXMakeCurrent(os_lnx_gfx_state->display, w->window, r_ogl_lnx_ctx);
}
internal void
r_ogl_os_window_swap(OS_Window os, R_Handle r)
r_ogl_os_window_swap(WM_Window os, R_Handle r)
{
OS_LNX_Window *w = (OS_LNX_Window *)os.u64[0];
LNX_WM_Window *w = (LNX_WM_Window *)os.u64[0];
glXSwapBuffers(os_lnx_gfx_state->display, w->window);
}
+7 -7
View File
@@ -201,14 +201,14 @@ r_init(CmdLine *cmdln)
//- rjf: window setup/teardown
r_hook R_Handle
r_window_equip(OS_Window window)
r_window_equip(WM_Window window)
{
R_Handle result = r_ogl_os_window_equip(window);
return result;
}
r_hook void
r_window_unequip(OS_Window window, R_Handle window_equip)
r_window_unequip(WM_Window window, R_Handle window_equip)
{
r_ogl_os_window_unequip(window, window_equip);
}
@@ -341,12 +341,12 @@ r_end_frame(void)
}
r_hook void
r_window_begin_frame(OS_Window os, R_Handle r)
r_window_begin_frame(WM_Window os, R_Handle r)
{
r_ogl_os_select_window(os, r);
//- rjf: unpack window viewport info
Rng2F32 client_rect = os_client_rect_from_window(os);
Rng2F32 client_rect = wm_client_rect_from_window(os);
Vec2F32 client_rect_dim = dim_2f32(client_rect);
//- rjf: clear and reset state
@@ -358,7 +358,7 @@ r_window_begin_frame(OS_Window os, R_Handle r)
}
r_hook void
r_window_end_frame(OS_Window os, R_Handle r)
r_window_end_frame(WM_Window os, R_Handle r)
{
for(R_OGL_FlushBuffer *flush_buffer = r_ogl_state->first_buffer_to_flush; flush_buffer != 0; flush_buffer = flush_buffer->next)
{
@@ -372,9 +372,9 @@ r_window_end_frame(OS_Window os, R_Handle r)
//- rjf: render pass submission
r_hook void
r_window_submit(OS_Window window, R_Handle window_equip, R_PassList *passes)
r_window_submit(WM_Window window, R_Handle window_equip, R_PassList *passes)
{
Rng2F32 viewport_rect = os_client_rect_from_window(window);
Rng2F32 viewport_rect = wm_client_rect_from_window(window);
Vec2F32 viewport_dim = dim_2f32(viewport_rect);
for(R_PassNode *pass_n = passes->first; pass_n != 0; pass_n = pass_n->next)
{
+4 -4
View File
@@ -224,9 +224,9 @@ internal void r_ogl_debug_message_callback(GLenum source, GLenum type, GLuint id
internal VoidProc *r_ogl_os_load_procedure(char *name);
internal void r_ogl_os_init(CmdLine *cmdln);
internal R_Handle r_ogl_os_window_equip(OS_Window window);
internal void r_ogl_os_window_unequip(OS_Window os, R_Handle r);
internal void r_ogl_os_select_window(OS_Window os, R_Handle r);
internal void r_ogl_os_window_swap(OS_Window os, R_Handle r);
internal R_Handle r_ogl_os_window_equip(WM_Window window);
internal void r_ogl_os_window_unequip(WM_Window os, R_Handle r);
internal void r_ogl_os_select_window(WM_Window os, R_Handle r);
internal void r_ogl_os_window_swap(WM_Window os, R_Handle r);
#endif // RENDER_OPENGL_H
@@ -101,10 +101,10 @@ r_ogl_os_init(CmdLine *cmdline)
}
internal R_Handle
r_ogl_os_window_equip(OS_Window window)
r_ogl_os_window_equip(WM_Window window)
{
//- rjf: unpack window
OS_W32_Window *w = os_w32_window_from_handle(window);
W32_WM_Window *w = w32_wm_window_from_handle(window);
HWND hwnd = w->hwnd;
HDC hdc = w->hdc;
@@ -155,14 +155,14 @@ r_ogl_os_window_equip(OS_Window window)
}
internal void
r_ogl_os_window_unequip(OS_Window os, R_Handle r)
r_ogl_os_window_unequip(WM_Window os, R_Handle r)
{
}
internal void
r_ogl_os_select_window(OS_Window os, R_Handle r)
r_ogl_os_select_window(WM_Window os, R_Handle r)
{
OS_W32_Window *w = os_w32_window_from_handle(os);
W32_WM_Window *w = w32_wm_window_from_handle(os);
if(w != 0)
{
HWND hwnd = w->hwnd;
@@ -172,9 +172,9 @@ r_ogl_os_select_window(OS_Window os, R_Handle r)
}
internal void
r_ogl_os_window_swap(OS_Window os, R_Handle r)
r_ogl_os_window_swap(WM_Window os, R_Handle r)
{
OS_W32_Window *w = os_w32_window_from_handle(os);
W32_WM_Window *w = w32_wm_window_from_handle(os);
if(w != 0)
{
HDC dc = w->hdc;