2019-02-03 13:47:36 -05:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (c) Yuxuan Shui <yshuiv7@gmail.com>
|
2019-02-03 11:41:04 -05:00
|
|
|
#pragma once
|
2019-02-08 18:57:14 -05:00
|
|
|
#include <stdbool.h>
|
2019-03-08 20:39:18 -05:00
|
|
|
// Older version of glx.h defines function prototypes for these extensions...
|
|
|
|
// Rename them to avoid conflicts
|
2019-02-08 19:36:14 -05:00
|
|
|
#define glXSwapIntervalMESA glXSwapIntervalMESA_
|
2019-02-08 19:52:45 -05:00
|
|
|
#define glXBindTexImageEXT glXBindTexImageEXT_
|
|
|
|
#define glXReleaseTexImageEXT glXReleaseTexImageEXT
|
2019-02-03 11:41:04 -05:00
|
|
|
#include <GL/glx.h>
|
2019-02-08 19:36:14 -05:00
|
|
|
#undef glXSwapIntervalMESA
|
2019-02-08 19:52:45 -05:00
|
|
|
#undef glXBindTexImageEXT
|
|
|
|
#undef glXReleaseTexImageEXT
|
2019-02-03 11:41:04 -05:00
|
|
|
#include <X11/Xlib.h>
|
2019-02-07 17:47:42 -05:00
|
|
|
#include <xcb/xcb.h>
|
|
|
|
#include <xcb/render.h>
|
2019-02-06 19:00:39 -05:00
|
|
|
|
|
|
|
#include "log.h"
|
2019-02-07 17:47:42 -05:00
|
|
|
#include "compiler.h"
|
|
|
|
#include "utils.h"
|
2019-02-06 19:00:39 -05:00
|
|
|
#include "x.h"
|
2019-02-03 11:41:04 -05:00
|
|
|
|
|
|
|
struct glx_fbconfig_info {
|
|
|
|
GLXFBConfig cfg;
|
|
|
|
int texture_tgts;
|
|
|
|
int texture_fmt;
|
|
|
|
int y_inverted;
|
|
|
|
};
|
|
|
|
|
2019-02-06 19:00:39 -05: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;
|
|
|
|
};
|
|
|
|
|
2019-02-26 18:52:37 -05:00
|
|
|
struct glx_fbconfig_info *glx_find_fbconfig(Display *, int screen, struct xvisual_info);
|
2019-02-06 19:00:39 -05:00
|
|
|
|
2019-02-08 17:34:53 -05:00
|
|
|
|
2019-02-08 18:57:14 -05: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 11:06:57 -05:00
|
|
|
bool has_GLX_ARB_create_context;
|
2019-03-08 20:39:18 -05:00
|
|
|
bool has_GLX_EXT_buffer_age;
|
2020-12-22 22:11:25 -05:00
|
|
|
bool has_GLX_MESA_query_renderer;
|
2019-02-08 18:57:14 -05:00
|
|
|
};
|
2019-02-08 17:34:53 -05:00
|
|
|
|
2019-02-08 18:57:14 -05:00
|
|
|
extern struct glxext_info glxext;
|
2019-02-08 17:34:53 -05:00
|
|
|
|
2019-02-08 18:57:14 -05: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 11:06:57 -05:00
|
|
|
extern PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB;
|
2019-02-08 17:34:53 -05:00
|
|
|
|
2020-12-22 22:11:25 -05:00
|
|
|
#ifdef GLX_MESA_query_renderer
|
|
|
|
extern PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC glXQueryCurrentRendererIntegerMESA;
|
|
|
|
#endif
|
|
|
|
|
2019-02-08 18:57:14 -05:00
|
|
|
void glxext_init(Display *, int screen);
|