mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-13 13:01:25 -07:00
egl/glx work; eliminate unneeded path normalization paths; do not assume os current path when normalizing paths; gl synchronous debug strings
This commit is contained in:
@@ -52,7 +52,9 @@ r_ogl_os_init(CmdLine *cmdln)
|
||||
os_abort(1);
|
||||
}
|
||||
|
||||
//- rjf: set up EGL config
|
||||
//- rjf: get all EGL configs
|
||||
EGLConfig configs[256] = {0};
|
||||
EGLint configs_count = 0;
|
||||
{
|
||||
EGLint options[] =
|
||||
{
|
||||
@@ -69,14 +71,39 @@ r_ogl_os_init(CmdLine *cmdln)
|
||||
|
||||
EGL_NONE,
|
||||
};
|
||||
EGLint config_count = 0;
|
||||
if(!eglChooseConfig(r_ogl_lnx_state->display, options, &r_ogl_lnx_state->config, 1, &config_count) || config_count != 1)
|
||||
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."));
|
||||
os_abort(1);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: actually choose the egl config
|
||||
{
|
||||
Window dummy_window = XCreateWindow(os_lnx_gfx_state->display, XDefaultRootWindow(os_lnx_gfx_state->display), 0, 0, 100, 100, 0, CopyFromParent, InputOutput, CopyFromParent, 0, 0);
|
||||
EGLint options[] =
|
||||
{
|
||||
EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_SRGB,
|
||||
EGL_NONE,
|
||||
};
|
||||
for(U32 idx = 0; idx < configs_count; idx += 1)
|
||||
{
|
||||
EGLSurface *dummy_surface = eglCreateWindowSurface(r_ogl_lnx_state->display, configs[idx], dummy_window, options);
|
||||
if(dummy_surface != EGL_NO_SURFACE)
|
||||
{
|
||||
r_ogl_lnx_state->config = configs[idx];
|
||||
eglDestroySurface(r_ogl_lnx_state->display, dummy_surface);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(r_ogl_lnx_state->config == 0)
|
||||
{
|
||||
os_graphical_message(1, str8_lit("Fatal Error"), str8_lit("Couldn't find a suitable EGL configuration."));
|
||||
os_abort(1);
|
||||
}
|
||||
XDestroyWindow(os_lnx_gfx_state->display, dummy_window);
|
||||
}
|
||||
|
||||
//- rjf: construct context
|
||||
{
|
||||
B32 debug_mode = cmd_line_has_flag(cmdln, str8_lit("opengl_debug"));
|
||||
@@ -118,8 +145,7 @@ r_ogl_os_window_equip(OS_Handle window)
|
||||
{
|
||||
EGLint options[] =
|
||||
{
|
||||
EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR,
|
||||
EGL_RENDER_BUFFER, EGL_BACK_BUFFER,
|
||||
EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_SRGB,
|
||||
EGL_NONE,
|
||||
};
|
||||
w->surface = eglCreateWindowSurface(r_ogl_lnx_state->display, r_ogl_lnx_state->config, window_os->window, options);
|
||||
|
||||
@@ -51,10 +51,6 @@ r_ogl_os_init(CmdLine *cmdln)
|
||||
GLXFBConfig framebuffer_config = framebuffer_configs[0];
|
||||
XFree(framebuffer_configs);
|
||||
|
||||
//- rjf: get visual info; create color map
|
||||
XVisualInfo *visual_info = glXGetVisualFromFBConfig(os_lnx_gfx_state->display, framebuffer_config);
|
||||
Colormap cmap = XCreateColormap(os_lnx_gfx_state->display, RootWindow(os_lnx_gfx_state->display, visual_info->screen), visual_info->visual, AllocNone);
|
||||
|
||||
//- rjf: construct set-window-attributes
|
||||
XSetWindowAttributes set_window_attributes = {0};
|
||||
set_window_attributes.background_pixmap = None;
|
||||
@@ -79,7 +75,7 @@ r_ogl_os_init(CmdLine *cmdln)
|
||||
r_ogl_lnx_ctx = glXCreateContextAttribsARB(os_lnx_gfx_state->display, framebuffer_config, 0, 1, context_options);
|
||||
}
|
||||
|
||||
glXMakeCurrent(os_lnx_gfx_state->display, RootWindow(os_lnx_gfx_state->display, visual_info->screen), r_ogl_lnx_ctx);
|
||||
glXMakeCurrent(os_lnx_gfx_state->display, 0, r_ogl_lnx_ctx);
|
||||
}
|
||||
|
||||
internal R_Handle
|
||||
|
||||
@@ -193,7 +193,7 @@ r_init(CmdLine *cmdln)
|
||||
#endif
|
||||
if(debug_mode)
|
||||
{
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
glDebugMessageCallback(r_ogl_debug_message_callback, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ typedef ptrdiff_t GLintptr;
|
||||
#define GL_TEXTURE31 0x84DF
|
||||
|
||||
#define GL_DEBUG_OUTPUT 0x92E0
|
||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: OS Backend Includes
|
||||
|
||||
@@ -98,8 +98,6 @@ r_ogl_os_init(CmdLine *cmdline)
|
||||
wglDeleteContext(bootstrap_ctx);
|
||||
wglMakeCurrent(dc, real_ctx);
|
||||
wglSwapIntervalEXT(1);
|
||||
ReleaseDC(bootstrap_hwnd, dc);
|
||||
DestroyWindow(bootstrap_hwnd);
|
||||
}
|
||||
|
||||
internal R_Handle
|
||||
@@ -108,7 +106,7 @@ r_ogl_os_window_equip(OS_Handle window)
|
||||
//- rjf: unpack window
|
||||
OS_W32_Window *w = os_w32_window_from_handle(window);
|
||||
HWND hwnd = w->hwnd;
|
||||
HDC hdc = GetDC(hwnd);
|
||||
HDC hdc = w->hdc;
|
||||
|
||||
//- rjf: select in ctx
|
||||
wglMakeCurrent(hdc, r_ogl_w32_hglrc);
|
||||
@@ -152,7 +150,6 @@ r_ogl_os_window_equip(OS_Handle window)
|
||||
SetPixelFormat(hdc, pixel_format, &pfd);
|
||||
|
||||
//- rjf: release hdc
|
||||
ReleaseDC(hwnd, hdc);
|
||||
R_Handle result = {0};
|
||||
return result;
|
||||
}
|
||||
@@ -169,9 +166,8 @@ r_ogl_os_select_window(OS_Handle os, R_Handle r)
|
||||
if(w != 0)
|
||||
{
|
||||
HWND hwnd = w->hwnd;
|
||||
HDC hdc = GetDC(hwnd);
|
||||
HDC hdc = w->hdc;
|
||||
wglMakeCurrent(hdc, r_ogl_w32_hglrc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,8 +177,7 @@ r_ogl_os_window_swap(OS_Handle os, R_Handle r)
|
||||
OS_W32_Window *w = os_w32_window_from_handle(os);
|
||||
if(w != 0)
|
||||
{
|
||||
HDC dc = GetDC(w->hwnd);
|
||||
HDC dc = w->hdc;
|
||||
SwapBuffers(dc);
|
||||
ReleaseDC(w->hwnd, dc);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user