2019-02-03 18:47:36 +00:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (c) Yuxuan Shui <yshuiv7@gmail.com>
|
2019-02-03 16:41:04 +00:00
|
|
|
#pragma once
|
2019-02-08 23:57:14 +00:00
|
|
|
#include <stdbool.h>
|
2019-03-09 01:39:18 +00:00
|
|
|
// Older version of glx.h defines function prototypes for these extensions...
|
|
|
|
// Rename them to avoid conflicts
|
2019-02-09 00:36:14 +00:00
|
|
|
#define glXSwapIntervalMESA glXSwapIntervalMESA_
|
2019-02-09 00:52:45 +00:00
|
|
|
#define glXBindTexImageEXT glXBindTexImageEXT_
|
|
|
|
#define glXReleaseTexImageEXT glXReleaseTexImageEXT
|
2019-02-03 16:41:04 +00:00
|
|
|
#include <GL/glx.h>
|
2019-02-09 00:36:14 +00:00
|
|
|
#undef glXSwapIntervalMESA
|
2019-02-09 00:52:45 +00:00
|
|
|
#undef glXBindTexImageEXT
|
|
|
|
#undef glXReleaseTexImageEXT
|
2019-02-03 16:41:04 +00:00
|
|
|
#include <X11/Xlib.h>
|
2019-02-07 22:47:42 +00:00
|
|
|
#include <xcb/render.h>
|
2023-07-21 21:11:21 +00:00
|
|
|
#include <xcb/xcb.h>
|
2019-02-07 00:00:39 +00:00
|
|
|
|
2019-02-07 22:47:42 +00:00
|
|
|
#include "compiler.h"
|
2023-07-21 21:11:21 +00:00
|
|
|
#include "log.h"
|
2019-02-07 22:47:42 +00:00
|
|
|
#include "utils.h"
|
2019-02-07 00:00:39 +00:00
|
|
|
#include "x.h"
|
2019-02-03 16:41:04 +00:00
|
|
|
|
|
|
|
struct glx_fbconfig_info {
|
|
|
|
GLXFBConfig cfg;
|
|
|
|
int texture_tgts;
|
|
|
|
int texture_fmt;
|
|
|
|
int y_inverted;
|
|
|
|
};
|
|
|
|
|
2019-02-07 00:00:39 +00:00
|
|
|
/// 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;
|
|
|
|
};
|
|
|
|
|
2023-06-29 04:39:36 +00:00
|
|
|
struct glx_fbconfig_info *glx_find_fbconfig(struct x_connection *, struct xvisual_info);
|
2019-02-08 22:34:53 +00:00
|
|
|
|
2019-02-08 23:57:14 +00:00
|
|
|
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;
|
2019-03-09 16:06:57 +00:00
|
|
|
bool has_GLX_ARB_create_context;
|
2019-03-09 01:39:18 +00:00
|
|
|
bool has_GLX_EXT_buffer_age;
|
2020-12-23 03:11:25 +00:00
|
|
|
bool has_GLX_MESA_query_renderer;
|
2022-02-08 07:53:15 +00:00
|
|
|
bool has_GLX_ARB_create_context_robustness;
|
2019-02-08 23:57:14 +00:00
|
|
|
};
|
2019-02-08 22:34:53 +00:00
|
|
|
|
2019-02-08 23:57:14 +00:00
|
|
|
extern struct glxext_info glxext;
|
2019-02-08 22:34:53 +00:00
|
|
|
|
2019-02-08 23:57:14 +00:00
|
|
|
extern PFNGLXGETVIDEOSYNCSGIPROC glXGetVideoSyncSGI;
|
|
|
|
extern PFNGLXWAITVIDEOSYNCSGIPROC glXWaitVideoSyncSGI;
|
|
|
|
extern PFNGLXGETSYNCVALUESOMLPROC glXGetSyncValuesOML;
|
|
|
|
extern PFNGLXWAITFORMSCOMLPROC glXWaitForMscOML;
|
|
|
|
extern PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT;
|
|
|
|
extern PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;
|
|
|
|
extern PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA;
|
|
|
|
extern PFNGLXBINDTEXIMAGEEXTPROC glXBindTexImageEXT;
|
|
|
|
extern PFNGLXRELEASETEXIMAGEEXTPROC glXReleaseTexImageEXT;
|
2019-03-09 16:06:57 +00:00
|
|
|
extern PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB;
|
2019-02-08 22:34:53 +00:00
|
|
|
|
2020-12-23 03:11:25 +00:00
|
|
|
#ifdef GLX_MESA_query_renderer
|
|
|
|
extern PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC glXQueryCurrentRendererIntegerMESA;
|
|
|
|
#endif
|
|
|
|
|
2019-02-08 23:57:14 +00:00
|
|
|
void glxext_init(Display *, int screen);
|