GL: Removed GLX context code.

This commit is contained in:
Бранимир Караџић
2023-06-26 19:18:49 -07:00
parent e8eb9782fa
commit b74da5c643
7 changed files with 71 additions and 503 deletions

View File

@@ -7,7 +7,6 @@
#include "debug_renderdoc.cpp"
#include "dxgi.cpp"
#include "glcontext_egl.cpp"
#include "glcontext_glx.cpp"
#include "glcontext_wgl.cpp"
#include "glcontext_html5.cpp"
#include "nvapi.cpp"

View File

@@ -25,6 +25,7 @@ namespace bgfx { namespace gl
typedef void (*EGLPROC)(void);
typedef EGLBoolean (EGLAPIENTRY* PGNEGLBINDAPIPROC)(EGLenum api);
typedef EGLBoolean (EGLAPIENTRY* PFNEGLCHOOSECONFIGPROC)(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size, EGLint* num_config);
typedef EGLContext (EGLAPIENTRY* PFNEGLCREATECONTEXTPROC)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint* attrib_list);
typedef EGLSurface (EGLAPIENTRY* PFNEGLCREATEPBUFFERSURFACEPROC)(EGLDisplay display, EGLConfig config, EGLint const* attrib_list);
@@ -42,9 +43,9 @@ namespace bgfx { namespace gl
typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval);
typedef EGLBoolean (EGLAPIENTRY* PFNEGLTERMINATEPROC)(EGLDisplay dpy);
typedef const char* (EGLAPIENTRY* PGNEGLQUERYSTRINGPROC)(EGLDisplay dpy, EGLint name);
typedef EGLBoolean (EGLAPIENTRY* PGNEGLBINDAPIPROC)(EGLenum api);
#define EGL_IMPORT \
EGL_IMPORT_FUNC(PGNEGLBINDAPIPROC, eglBindAPI); \
EGL_IMPORT_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig); \
EGL_IMPORT_FUNC(PFNEGLCREATECONTEXTPROC, eglCreateContext); \
EGL_IMPORT_FUNC(PFNEGLCREATEPBUFFERSURFACEPROC, eglCreatePbufferSurface); \
@@ -62,7 +63,6 @@ namespace bgfx { namespace gl
EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \
EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate); \
EGL_IMPORT_FUNC(PGNEGLQUERYSTRINGPROC, eglQueryString); \
EGL_IMPORT_FUNC(PGNEGLBINDAPIPROC, eglBindAPI); \
#define EGL_IMPORT_FUNC(_proto, _func) _proto _func
EGL_IMPORT
@@ -73,9 +73,9 @@ EGL_IMPORT
void* handle = bx::dlopen("libEGL." BX_DL_EXT);
BGFX_FATAL(NULL != handle, Fatal::UnableToInitialize, "Failed to load libEGL dynamic library.");
#define EGL_IMPORT_FUNC(_proto, _func) \
_func = (_proto)bx::dlsym(handle, #_func); \
BX_TRACE("%p " #_func, _func); \
#define EGL_IMPORT_FUNC(_proto, _func) \
_func = (_proto)bx::dlsym(handle, #_func); \
BX_TRACE("%p " #_func, _func); \
BGFX_FATAL(NULL != _func, Fatal::UnableToInitialize, "Failed get " #_func ".")
EGL_IMPORT
#undef EGL_IMPORT_FUNC
@@ -222,20 +222,22 @@ EGL_IMPORT
BX_TRACE("Supported EGL extensions:");
dumpExtensions(extensions);
#if BGFX_CONFIG_RENDERER_OPENGL
// choose OpenGL API for EGL, by default it uses OpenGL ES
EGLBoolean ok = eglBindAPI(EGL_OPENGL_API);
BGFX_FATAL(ok, Fatal::UnableToInitialize, "Could not set API! error: %d", eglGetError());
#endif //BGFX_CONFIG_RENDERER_OPENG
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
{
EGLBoolean ok = eglBindAPI(EGL_OPENGL_API);
BGFX_FATAL(ok, Fatal::UnableToInitialize, "Could not set API! error: %d", eglGetError());
}
// https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_recordable.txt
const bool hasEglAndroidRecordable = !bx::findIdentifierMatch(extensions, "EGL_ANDROID_recordable").isEmpty();
const uint32_t glVersion = BGFX_CONFIG_RENDERER_OPENGL ? BGFX_CONFIG_RENDERER_OPENGL : BGFX_CONFIG_RENDERER_OPENGLES;
const uint32_t glVersion = !!BGFX_CONFIG_RENDERER_OPENGL
? BGFX_CONFIG_RENDERER_OPENGL
: BGFX_CONFIG_RENDERER_OPENGLES
;
#if BX_PLATFORM_ANDROID
uint32_t msaa = (_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT;
uint32_t msaaSamples = msaa == 0 ? 0 : 1<<msaa;
const uint32_t msaa = (_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT;
const uint32_t msaaSamples = msaa == 0 ? 0 : 1<<msaa;
m_msaaContext = true;
#endif // BX_PLATFORM_ANDROID
@@ -243,17 +245,16 @@ EGL_IMPORT
EGLint attrs[] =
{
# if BGFX_CONFIG_RENDERER_OPENGL
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
# else
EGL_RENDERABLE_TYPE, (glVersion >= 30) ? EGL_OPENGL_ES3_BIT_KHR : EGL_OPENGL_ES2_BIT,
# endif
EGL_RENDERABLE_TYPE, !!BGFX_CONFIG_RENDERER_OPENGL
? EGL_OPENGL_BIT
: (glVersion >= 30) ? EGL_OPENGL_ES3_BIT_KHR : EGL_OPENGL_ES2_BIT
,
EGL_SURFACE_TYPE, headless ? EGL_PBUFFER_BIT : EGL_WINDOW_BIT,
EGL_BLUE_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
EGL_RED_SIZE, 8,
EGL_ALPHA_SIZE, 8,
# if BX_PLATFORM_ANDROID
@@ -265,8 +266,8 @@ EGL_IMPORT
EGL_STENCIL_SIZE, 8,
// Android Recordable surface
hasEglAndroidRecordable ? 0x3142 : EGL_NONE,
hasEglAndroidRecordable ? 1 : EGL_NONE,
hasEglAndroidRecordable ? EGL_RECORDABLE_ANDROID : EGL_NONE,
hasEglAndroidRecordable ? 1 : EGL_NONE,
EGL_NONE
};
@@ -341,15 +342,17 @@ EGL_IMPORT
# else
if (hasEglKhrCreateContext)
{
# if BGFX_CONFIG_RENDERER_OPENGL
bx::write(&writer, EGLint(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR), bx::ErrorAssert{} );
bx::write(&writer, EGLint(EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR), bx::ErrorAssert{} );
# endif
bx::write(&writer, EGLint(EGL_CONTEXT_MAJOR_VERSION_KHR), bx::ErrorAssert{} );
bx::write(&writer, EGLint(glVersion / 10), bx::ErrorAssert{} );
if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
{
bx::write(&writer, EGLint(EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR), bx::ErrorAssert{});
bx::write(&writer, EGLint(EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR), bx::ErrorAssert{});
}
bx::write(&writer, EGLint(EGL_CONTEXT_MINOR_VERSION_KHR), bx::ErrorAssert{} );
bx::write(&writer, EGLint(glVersion % 10), bx::ErrorAssert{} );
bx::write(&writer, EGLint(EGL_CONTEXT_MAJOR_VERSION_KHR), bx::ErrorAssert{});
bx::write(&writer, EGLint(glVersion / 10), bx::ErrorAssert{});
bx::write(&writer, EGLint(EGL_CONTEXT_MINOR_VERSION_KHR), bx::ErrorAssert{});
bx::write(&writer, EGLint(glVersion % 10), bx::ErrorAssert{});
flags |= BGFX_CONFIG_DEBUG && hasEglKhrNoError ? 0
| EGL_CONTEXT_FLAG_NO_ERROR_BIT_KHR
@@ -451,10 +454,10 @@ EGL_IMPORT
uint64_t GlContext::getCaps() const
{
return BX_ENABLED(0
| BX_PLATFORM_LINUX
| BX_PLATFORM_WINDOWS
| BX_PLATFORM_ANDROID
)
| BX_PLATFORM_LINUX
| BX_PLATFORM_WINDOWS
| BX_PLATFORM_ANDROID
)
? BGFX_CAPS_SWAP_CHAIN
: 0
;
@@ -521,13 +524,14 @@ EGL_IMPORT
# define LIBRARY_NAME "libGLESv2.so.2"
# endif
# endif
void* lib = bx::dlopen(LIBRARY_NAME);
# define GL_EXTENSION(_optional, _proto, _func, _import) \
{ \
if (NULL == _func) \
{ \
_func = bx::dlsym<_proto>(lib, #_import); \
_func = bx::dlsym<_proto>(lib, #_import); \
BX_TRACE("\t%p " #_func " (" #_import ")", _func); \
BGFX_FATAL(_optional || NULL != _func \
, Fatal::UnableToInitialize \

View File

@@ -10,11 +10,20 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
// EGL pulls X11 crap...
#if defined(None)
# undef None
#endif // defined(None)
#if defined(Success)
// X11 defines Success
# undef Success
#endif // defined(Success)
#if defined(Status)
# undef Status
#endif // defined(Status)
namespace bgfx { namespace gl
{
struct SwapChainGL;

View File

@@ -1,393 +0,0 @@
/*
* Copyright 2011-2023 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#include "bgfx_p.h"
#if (BX_PLATFORM_BSD || BX_PLATFORM_LINUX) && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
# include "renderer_gl.h"
# if BGFX_USE_GLX
# define GLX_GLXEXT_PROTOTYPES
# include <glx/glxext.h>
// glxext will include X11 which #defines None, Status, etc.
#undef None
#undef Status
namespace bgfx { namespace gl
{
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(uint32_t _interval);
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB;
PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT;
PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA;
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
# include "glimports.h"
struct SwapChainGL
{
SwapChainGL(::Display* display, ::Window _window, XVisualInfo* _visualInfo, GLXContext _context)
: m_display(display)
, m_window(_window)
{
m_context = glXCreateContext(m_display, _visualInfo, _context, GL_TRUE);
}
~SwapChainGL()
{
glXMakeCurrent(m_display, 0, 0);
glXDestroyContext(m_display, m_context);
}
void makeCurrent()
{
glXMakeCurrent(m_display, m_window, m_context);
}
void swapBuffers()
{
glXSwapBuffers(m_display, m_window);
}
::Display* m_display;
Window m_window;
GLXContext m_context;
};
static bool haveGlxExtension(const char* _ext, const char* _extList)
{
// _extList is assumed to be a space-separated, null-terminated list of
// extension names, and no extension name ever contains a space.
const char* end = _extList + bx::strLen(_extList);
const char* searchStart = _extList;
for(;;)
{
bx::StringView found = bx::strFind(searchStart, _ext);
if (found.isEmpty() )
{
return false;
}
// We found the substring, but need an exact match, with a word
// boundary at both the front and back of the found spot.
if ((found.getPtr() == _extList || *(found.getPtr() - 1) == ' ')
&& (found.getTerm() == end || *found.getTerm() == ' ') )
{
return true;
}
// else, keep searching
searchStart = found.getTerm();
}
}
template<typename ProtoT>
static ProtoT glXGetProcAddress(const char* _name)
{
return reinterpret_cast<ProtoT>( (void*)::glXGetProcAddress( (const GLubyte*)_name) );
}
void GlContext::create(uint32_t _width, uint32_t _height, uint32_t /*_flags*/)
{
BX_UNUSED(_width, _height);
m_context = (GLXContext)g_platformData.context;
m_display = (::Display*)g_platformData.ndt;
// It's possible the user has provided the window handle, but not
// the display handle. If this is the case, try opening the default
// display
if (NULL == m_display)
{
m_display = XOpenDisplay(NULL);
BGFX_FATAL(m_display, Fatal::UnableToInitialize, "XOpenDisplay(NULL) : Failed to open default display");
}
if (NULL == g_platformData.context)
{
XLockDisplay(m_display);
int major, minor;
bool version = glXQueryVersion(m_display, &major, &minor);
BGFX_FATAL(version, Fatal::UnableToInitialize, "Failed to query GLX version");
BGFX_FATAL( (major == 1 && minor >= 2) || major > 1
, Fatal::UnableToInitialize
, "GLX version is not >=1.2 (%d.%d)."
, major
, minor
);
int32_t screen = DefaultScreen(m_display);
const char* extensions = glXQueryExtensionsString(m_display, screen);
BX_TRACE("GLX extensions:");
dumpExtensions(extensions);
const int attrsGlx[] =
{
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_DOUBLEBUFFER, true,
GLX_RED_SIZE, 8,
GLX_BLUE_SIZE, 8,
GLX_GREEN_SIZE, 8,
// GLX_ALPHA_SIZE, 8,
GLX_DEPTH_SIZE, 24,
GLX_STENCIL_SIZE, 8,
0,
};
// Find suitable config
GLXFBConfig bestConfig = NULL;
int numConfigs;
GLXFBConfig* configs = glXChooseFBConfig(m_display, screen, attrsGlx, &numConfigs);
BX_TRACE("glX num configs %d", numConfigs);
for (int ii = 0; ii < numConfigs; ++ii)
{
m_visualInfo = glXGetVisualFromFBConfig(m_display, configs[ii]);
if (NULL != m_visualInfo)
{
BX_TRACE("---");
bool valid = true;
for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != 0; attr += 2)
{
int value;
glXGetFBConfigAttrib(m_display, configs[ii], attrsGlx[attr], &value);
BX_TRACE("glX %d/%d %2d: %4x, %8x (%8x%s)"
, ii
, numConfigs
, attr/2
, attrsGlx[attr]
, value
, attrsGlx[attr + 1]
, value < attrsGlx[attr + 1] ? " *" : ""
);
if (value < attrsGlx[attr + 1])
{
valid = false;
#if !BGFX_CONFIG_DEBUG
break;
#endif // BGFX_CONFIG_DEBUG
}
}
if (valid)
{
bestConfig = configs[ii];
BX_TRACE("Best config %d.", ii);
break;
}
}
XFree(m_visualInfo);
m_visualInfo = NULL;
}
XFree(configs);
BGFX_FATAL(m_visualInfo, Fatal::UnableToInitialize, "Failed to find a suitable X11 display configuration.");
BX_TRACE("Create GL 2.1 context.");
m_context = glXCreateContext(m_display, m_visualInfo, 0, GL_TRUE);
BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context.");
glXCreateContextAttribsARB = glXGetProcAddress<PFNGLXCREATECONTEXTATTRIBSARBPROC>("glXCreateContextAttribsARB");
if (NULL != glXCreateContextAttribsARB)
{
BX_TRACE("Create GL %d.%d context.", BGFX_CONFIG_RENDERER_OPENGL / 10, BGFX_CONFIG_RENDERER_OPENGL % 10);
int32_t flags = BGFX_CONFIG_DEBUG ? GLX_CONTEXT_DEBUG_BIT_ARB : 0;
const int contextAttrs[] =
{
GLX_CONTEXT_MAJOR_VERSION_ARB, BGFX_CONFIG_RENDERER_OPENGL / 10,
GLX_CONTEXT_MINOR_VERSION_ARB, BGFX_CONFIG_RENDERER_OPENGL % 10,
GLX_CONTEXT_FLAGS_ARB, flags,
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
0,
};
GLXContext context = glXCreateContextAttribsARB(m_display, bestConfig, 0, true, contextAttrs);
if (NULL != context)
{
glXDestroyContext(m_display, m_context);
m_context = context;
}
}
XUnlockDisplay(m_display);
}
import();
glXMakeCurrent(m_display, (::Window)g_platformData.nwh, m_context);
m_current = NULL;
const char* extensions = glXQueryExtensionsString(m_display, DefaultScreen(m_display) );
if (NULL != extensions)
{
bool foundSwapControl = false;
if (haveGlxExtension("GLX_EXT_swap_control", extensions) )
{
glXSwapIntervalEXT = glXGetProcAddress<PFNGLXSWAPINTERVALEXTPROC>("glXSwapIntervalEXT");
if (NULL != glXSwapIntervalEXT)
{
BX_TRACE("Using glXSwapIntervalEXT.");
glXSwapIntervalEXT(m_display, (::Window)g_platformData.nwh, 0);
foundSwapControl = true;
}
}
if (!foundSwapControl
&& haveGlxExtension("GLX_MESA_swap_control", extensions) )
{
glXSwapIntervalMESA = glXGetProcAddress<PFNGLXSWAPINTERVALMESAPROC>("glXSwapIntervalMESA");
if (NULL != glXSwapIntervalMESA)
{
BX_TRACE("Using glXSwapIntervalMESA.");
glXSwapIntervalMESA(0);
foundSwapControl = true;
}
}
if (!foundSwapControl
&& haveGlxExtension("GLX_SGI_swap_control", extensions) )
{
glXSwapIntervalSGI = glXGetProcAddress<PFNGLXSWAPINTERVALSGIPROC>("glXSwapIntervalSGI");
if (NULL != glXSwapIntervalSGI)
{
BX_TRACE("Using glXSwapIntervalSGI.");
glXSwapIntervalSGI(0);
foundSwapControl = true;
}
}
}
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glXSwapBuffers(m_display, (::Window)g_platformData.nwh);
g_internalData.context = m_context;
}
void GlContext::destroy()
{
glXMakeCurrent(m_display, 0, 0);
if (NULL == g_platformData.context)
{
glXDestroyContext(m_display, m_context);
XFree(m_visualInfo);
}
// If we opened the display, have to close it
if (NULL == g_platformData.ndt)
{
XCloseDisplay(m_display);
}
m_context = NULL;
m_visualInfo = NULL;
m_display = NULL;
}
void GlContext::resize(uint32_t /*_width*/, uint32_t /*_height*/, uint32_t _flags)
{
bool vsync = !!(_flags&BGFX_RESET_VSYNC);
int32_t interval = vsync ? 1 : 0;
if (NULL != glXSwapIntervalEXT)
{
glXSwapIntervalEXT(m_display, (::Window)g_platformData.nwh, interval);
}
else if (NULL != glXSwapIntervalMESA)
{
glXSwapIntervalMESA(interval);
}
else if (NULL != glXSwapIntervalSGI)
{
glXSwapIntervalSGI(interval);
}
}
uint64_t GlContext::getCaps() const
{
return BGFX_CAPS_SWAP_CHAIN;
}
SwapChainGL* GlContext::createSwapChain(void* _nwh)
{
return BX_NEW(g_allocator, SwapChainGL)(m_display, (::Window)_nwh, m_visualInfo, m_context);
}
void GlContext::destroySwapChain(SwapChainGL* _swapChain)
{
bx::deleteObject(g_allocator, _swapChain);
glXMakeCurrent(m_display, (::Window)g_platformData.nwh, m_context);
}
void GlContext::swap(SwapChainGL* _swapChain)
{
makeCurrent(_swapChain);
if (NULL == _swapChain)
{
glXSwapBuffers(m_display, (::Window)g_platformData.nwh);
}
else
{
_swapChain->swapBuffers();
}
}
void GlContext::makeCurrent(SwapChainGL* _swapChain)
{
if (m_current != _swapChain)
{
m_current = _swapChain;
if (NULL == _swapChain)
{
glXMakeCurrent(m_display, (::Window)g_platformData.nwh, m_context);
}
else
{
_swapChain->makeCurrent();
}
}
}
void GlContext::import()
{
BX_TRACE("Import:");
# define GL_EXTENSION(_optional, _proto, _func, _import) \
{ \
if (NULL == _func) \
{ \
_func = glXGetProcAddress<_proto>(#_import); \
BX_TRACE("%p " #_func " (" #_import ")", _func); \
BGFX_FATAL(_optional || NULL != _func \
, Fatal::UnableToInitialize \
, "Failed to create OpenGL context. glXGetProcAddress %s", #_import); \
} \
}
# include "glimports.h"
# undef GL_EXTENSION
}
} /* namespace gl */ } // namespace bgfx
# endif // BGFX_USE_GLX
#endif // (BX_PLATFORM_BSD || BX_PLATFORM_LINUX) && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)

View File

@@ -1,58 +0,0 @@
/*
* Copyright 2011-2023 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#ifndef BGFX_GLCONTEXT_GLX_H_HEADER_GUARD
#define BGFX_GLCONTEXT_GLX_H_HEADER_GUARD
#if BGFX_USE_GLX
# include <X11/Xlib.h>
# define GLX_GLXEXT_LEGACY
# include <GL/glx.h>
namespace bgfx { namespace gl
{
struct SwapChainGL;
struct GlContext
{
GlContext()
: m_current(NULL)
, m_context(0)
, m_visualInfo(NULL)
, m_display(NULL)
, m_msaaContext(false)
{
}
void create(uint32_t _width, uint32_t _height, uint32_t _flags);
void destroy();
void resize(uint32_t _width, uint32_t _height, uint32_t _flags);
uint64_t getCaps() const;
SwapChainGL* createSwapChain(void* _nwh);
void destroySwapChain(SwapChainGL* _swapChain);
void swap(SwapChainGL* _swapChain = NULL);
void makeCurrent(SwapChainGL* _swapChain = NULL);
void import();
bool isValid() const
{
return 0 != m_context;
}
SwapChainGL* m_current;
GLXContext m_context;
XVisualInfo* m_visualInfo;
::Display* m_display;
// true when MSAA is handled by the context instead of using MSAA FBO
bool m_msaaContext;
};
} /* namespace gl */ } // namespace bgfx
#endif // BGFX_USE_GLX
#endif // BGFX_GLCONTEXT_GLX_H_HEADER_GUARD

View File

@@ -6,13 +6,13 @@
#ifndef BGFX_RENDERER_GL_H_HEADER_GUARD
#define BGFX_RENDERER_GL_H_HEADER_GUARD
#define BGFX_USE_EGL (BGFX_CONFIG_RENDERER_OPENGLES && (0 \
|| BX_PLATFORM_ANDROID \
|| BX_PLATFORM_BSD \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_NX \
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_WINDOWS \
#define BGFX_USE_EGL ( (BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES) && (0 \
|| BX_PLATFORM_ANDROID \
|| BX_PLATFORM_BSD \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_NX \
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_WINDOWS \
) )
#define BGFX_USE_HTML5 (BGFX_CONFIG_RENDERER_OPENGLES && (0 \
@@ -23,11 +23,6 @@
|| BX_PLATFORM_WINDOWS \
) )
#define BGFX_USE_GLX (BGFX_CONFIG_RENDERER_OPENGL && (0 \
|| BX_PLATFORM_BSD \
|| BX_PLATFORM_LINUX \
) )
#define BGFX_USE_GL_DYNAMIC_LIB (0 \
|| BX_PLATFORM_BSD \
|| BX_PLATFORM_LINUX \
@@ -1139,8 +1134,6 @@ typedef uint64_t GLuint64;
# include "glcontext_egl.h"
#elif BGFX_USE_HTML5
# include "glcontext_html5.h"
#elif BGFX_USE_GLX
# include "glcontext_glx.h"
#elif BGFX_USE_WGL
# include "glcontext_wgl.h"
#endif // BGFX_USE_*

View File

@@ -32,6 +32,20 @@
#define VK_NO_STDINT_H
#define VK_NO_PROTOTYPES
#include <vulkan-local/vulkan.h>
// vulkan.h pulls X11 crap...
#if defined(None)
# undef None
#endif // defined(None)
#if defined(Success)
# undef Success
#endif // defined(Success)
#if defined(Status)
# undef Status
#endif // defined(Status)
#include "renderer.h"
#include "debug_renderdoc.h"