Cleanup: move all GLX stuff into render_context_glx.
This commit is contained in:
parent
65b25c8be3
commit
0c560890a4
@ -17,10 +17,12 @@
|
|||||||
#define _RK_ENGINE_RENDER_CONTEXT_H
|
#define _RK_ENGINE_RENDER_CONTEXT_H
|
||||||
|
|
||||||
#include "../render.hpp"
|
#include "../render.hpp"
|
||||||
#include <GL/glx.h>
|
|
||||||
|
|
||||||
extern PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC rk_DrawElementsInstancedBaseInstance;
|
typedef void (*rk_DrawElementsInstancedBaseInstanceFunc)(rk_uint, rk_uint, rk_uint, const void *, rk_uint, rk_uint);
|
||||||
extern PFNGLMULTIDRAWELEMENTSINDIRECTPROC rk_MultiDrawElementsIndirect;
|
typedef void (*rk_MultiDrawElementsIndirectFunc)(rk_uint, rk_uint, const void *, rk_uint, rk_uint);
|
||||||
|
|
||||||
|
extern rk_DrawElementsInstancedBaseInstanceFunc rk_DrawElementsInstancedBaseInstance;
|
||||||
|
extern rk_MultiDrawElementsIndirectFunc rk_MultiDrawElementsIndirect;
|
||||||
|
|
||||||
extern rk_window_t rk_create_context(
|
extern rk_window_t rk_create_context(
|
||||||
char const * name,
|
char const * name,
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <GLES3/gl32.h>
|
#include <GLES3/gl32.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#include <GL/glx.h>
|
||||||
|
|
||||||
extern unsigned rk_events_mask;
|
extern unsigned rk_events_mask;
|
||||||
|
|
||||||
@ -35,8 +36,8 @@ static bool rk_error_occured = false;
|
|||||||
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
|
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||||
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display *, GLXFBConfig, GLXContext, Bool, int const *);
|
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display *, GLXFBConfig, GLXContext, Bool, int const *);
|
||||||
|
|
||||||
PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC rk_DrawElementsInstancedBaseInstance = nullptr;
|
rk_DrawElementsInstancedBaseInstanceFunc rk_DrawElementsInstancedBaseInstance = nullptr;
|
||||||
PFNGLMULTIDRAWELEMENTSINDIRECTPROC rk_MultiDrawElementsIndirect = nullptr;
|
rk_MultiDrawElementsIndirectFunc rk_MultiDrawElementsIndirect = nullptr;
|
||||||
|
|
||||||
static int const rk_visual_attribs[] = {
|
static int const rk_visual_attribs[] = {
|
||||||
GLX_X_RENDERABLE, True,
|
GLX_X_RENDERABLE, True,
|
||||||
@ -202,13 +203,13 @@ rk_window_t rk_create_context(
|
|||||||
char const * const gl_exts = reinterpret_cast<char const *>(glGetString(GL_EXTENSIONS));
|
char const * const gl_exts = reinterpret_cast<char const *>(glGetString(GL_EXTENSIONS));
|
||||||
if (rk_extension_supported(gl_exts, "GL_EXT_base_instance")) {
|
if (rk_extension_supported(gl_exts, "GL_EXT_base_instance")) {
|
||||||
rk_DrawElementsInstancedBaseInstance =
|
rk_DrawElementsInstancedBaseInstance =
|
||||||
reinterpret_cast<PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC>(
|
reinterpret_cast<rk_DrawElementsInstancedBaseInstanceFunc>(
|
||||||
glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("DrawElementsInstancedBaseInstance")));
|
glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("DrawElementsInstancedBaseInstance")));
|
||||||
if (rk_DrawElementsInstancedBaseInstance) {
|
if (rk_DrawElementsInstancedBaseInstance) {
|
||||||
rk_printf("Using extension GL_EXT_base_instance::DrawElementsInstancedBaseInstance.");
|
rk_printf("Using extension GL_EXT_base_instance::DrawElementsInstancedBaseInstance.");
|
||||||
if (rk_extension_supported(gl_exts, "GL_EXT_multi_draw_indirect")) {
|
if (rk_extension_supported(gl_exts, "GL_EXT_multi_draw_indirect")) {
|
||||||
rk_MultiDrawElementsIndirect =
|
rk_MultiDrawElementsIndirect =
|
||||||
reinterpret_cast<PFNGLMULTIDRAWELEMENTSINDIRECTPROC>(
|
reinterpret_cast<rk_MultiDrawElementsIndirectFunc>(
|
||||||
glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("MultiDrawElementsIndirectEXT")));
|
glXGetProcAddressARB(reinterpret_cast<GLubyte const *>("MultiDrawElementsIndirectEXT")));
|
||||||
if (rk_MultiDrawElementsIndirect) {
|
if (rk_MultiDrawElementsIndirect) {
|
||||||
rk_printf("Using extension GL_EXT_multi_draw_indirect::MultiDrawElementsIndirectEXT.");
|
rk_printf("Using extension GL_EXT_multi_draw_indirect::MultiDrawElementsIndirectEXT.");
|
||||||
|
Loading…
Reference in New Issue
Block a user