There is actually no specification what symbols are exported from a libGL implementation. The (extremely outdated) OpenGL ABI specification says only GL 1.2 functions are guaranteed. Don't know how relevant that is now, but different libGL implementations do export different set of symbols. On Linux we are most likely to be linked with libglvnd, which has everything we need. But on other platforms this is not necessarily the case, for example on OpenBSD we are missing glGetQueryObjectui64v. Use libepoxy so we can outsource this problem and never worry about it ever again. Plus it also saves us from calling GetProcAddress ourselves. Changes other than trivial build fixes I have to make: 1. Can't use eglCreatePlatformWindowSurface/eglGetPlatformDisplay. libepoxy checks for EGL 1.5 when resolving these functions. But without a current context, libepoxy assumes we only have EGL 1.4. This creates a chicken and egg problem - we need a display to call eglGetPlatformDisplay. We have to use the *EXT version instead. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) Yuxuan Shui <yshuiv7@gmail.com>
|
|
#pragma once
|
|
#include <X11/Xlib.h>
|
|
#include <epoxy/glx.h>
|
|
#include <stdbool.h>
|
|
#include <xcb/render.h>
|
|
#include <xcb/xcb.h>
|
|
|
|
#include "compiler.h"
|
|
#include "log.h"
|
|
#include "utils.h"
|
|
#include "x.h"
|
|
|
|
struct glx_fbconfig_info {
|
|
GLXFBConfig cfg;
|
|
int texture_tgts;
|
|
int texture_fmt;
|
|
int y_inverted;
|
|
};
|
|
|
|
/// The search criteria for glx_find_fbconfig
|
|
struct glx_fbconfig_criteria {
|
|
/// Bit width of the red component
|
|
int red_size;
|
|
/// Bit width of the green component
|
|
int green_size;
|
|
/// Bit width of the blue component
|
|
int blue_size;
|
|
/// Bit width of the alpha component
|
|
int alpha_size;
|
|
/// The depth of X visual
|
|
int visual_depth;
|
|
};
|
|
|
|
struct glx_fbconfig_info *glx_find_fbconfig(struct x_connection *, struct xvisual_info);
|
|
|
|
struct glxext_info {
|
|
bool initialized;
|
|
bool has_GLX_SGI_video_sync;
|
|
bool has_GLX_SGI_swap_control;
|
|
bool has_GLX_OML_sync_control;
|
|
bool has_GLX_MESA_swap_control;
|
|
bool has_GLX_EXT_swap_control;
|
|
bool has_GLX_EXT_texture_from_pixmap;
|
|
bool has_GLX_ARB_create_context;
|
|
bool has_GLX_EXT_buffer_age;
|
|
bool has_GLX_MESA_query_renderer;
|
|
bool has_GLX_ARB_create_context_robustness;
|
|
};
|
|
|
|
extern struct glxext_info glxext;
|
|
|
|
void glxext_init(Display *, int screen);
|