mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
3rdparty/bgfx: Cherry-picked upstream commits needed to support Wayland on Linux. (#11539)
This commit is contained in:
parent
30d92e397d
commit
80155dfa8c
@ -34,6 +34,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/01-cubes/cubes.cpp
vendored
1
3rdparty/bgfx/examples/01-cubes/cubes.cpp
vendored
@ -149,6 +149,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -508,6 +508,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -121,6 +121,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/04-mesh/mesh.cpp
vendored
1
3rdparty/bgfx/examples/04-mesh/mesh.cpp
vendored
@ -32,6 +32,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/06-bump/bump.cpp
vendored
1
3rdparty/bgfx/examples/06-bump/bump.cpp
vendored
@ -104,6 +104,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -331,6 +331,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/08-update/update.cpp
vendored
1
3rdparty/bgfx/examples/08-update/update.cpp
vendored
@ -247,6 +247,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/09-hdr/hdr.cpp
vendored
1
3rdparty/bgfx/examples/09-hdr/hdr.cpp
vendored
@ -159,6 +159,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/10-font/font.cpp
vendored
1
3rdparty/bgfx/examples/10-font/font.cpp
vendored
@ -73,6 +73,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/12-lod/lod.cpp
vendored
1
3rdparty/bgfx/examples/12-lod/lod.cpp
vendored
@ -48,6 +48,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -814,6 +814,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_viewState.m_width;
|
||||
init.resolution.height = m_viewState.m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -1786,6 +1786,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_viewState.m_width;
|
||||
init.resolution.height = m_viewState.m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -1159,6 +1159,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_viewState.m_width;
|
||||
init.resolution.height = m_viewState.m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -131,6 +131,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/18-ibl/ibl.cpp
vendored
1
3rdparty/bgfx/examples/18-ibl/ibl.cpp
vendored
@ -420,6 +420,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/19-oit/oit.cpp
vendored
1
3rdparty/bgfx/examples/19-oit/oit.cpp
vendored
@ -171,6 +171,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/20-nanovg/nanovg.cpp
vendored
1
3rdparty/bgfx/examples/20-nanovg/nanovg.cpp
vendored
@ -1404,6 +1404,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -213,6 +213,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -88,6 +88,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/24-nbody/nbody.cpp
vendored
1
3rdparty/bgfx/examples/24-nbody/nbody.cpp
vendored
@ -132,6 +132,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
2
3rdparty/bgfx/examples/25-c99/helloworld.c
vendored
2
3rdparty/bgfx/examples/25-c99/helloworld.c
vendored
@ -9,6 +9,7 @@
|
||||
extern bool entry_process_events(uint32_t* _width, uint32_t* _height, uint32_t* _debug, uint32_t* _reset);
|
||||
extern void* entry_get_default_native_window_handle();
|
||||
extern void* entry_get_native_display_handle();
|
||||
extern bgfx_native_window_handle_type_t entry_get_native_window_handle_type(void);
|
||||
|
||||
uint16_t uint16_max(uint16_t _a, uint16_t _b)
|
||||
{
|
||||
@ -29,6 +30,7 @@ int32_t _main_(int32_t _argc, char** _argv)
|
||||
|
||||
init.platformData.nwh = entry_get_default_native_window_handle();
|
||||
init.platformData.ndt = entry_get_native_display_handle();
|
||||
init.platformData.type = entry_get_native_window_handle_type();
|
||||
|
||||
bgfx_init(&init);
|
||||
bgfx_reset(width, height, reset, init.resolution.format);
|
||||
|
@ -84,6 +84,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -80,6 +80,7 @@ ExampleTerrain(const char* _name, const char* _description, const char* _url)
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -293,6 +293,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -780,6 +780,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -213,6 +213,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -248,6 +248,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/33-pom/pom.cpp
vendored
1
3rdparty/bgfx/examples/33-pom/pom.cpp
vendored
@ -130,6 +130,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/34-mvs/mvs.cpp
vendored
1
3rdparty/bgfx/examples/34-mvs/mvs.cpp
vendored
@ -126,6 +126,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -104,6 +104,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/36-sky/sky.cpp
vendored
1
3rdparty/bgfx/examples/36-sky/sky.cpp
vendored
@ -420,6 +420,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -330,6 +330,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/38-bloom/bloom.cpp
vendored
1
3rdparty/bgfx/examples/38-bloom/bloom.cpp
vendored
@ -200,6 +200,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/39-assao/assao.cpp
vendored
1
3rdparty/bgfx/examples/39-assao/assao.cpp
vendored
@ -271,6 +271,7 @@ namespace
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/40-svt/svt.cpp
vendored
1
3rdparty/bgfx/examples/40-svt/svt.cpp
vendored
@ -82,6 +82,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/41-tess/tess.cpp
vendored
1
3rdparty/bgfx/examples/41-tess/tess.cpp
vendored
@ -339,6 +339,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -264,6 +264,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -253,6 +253,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -265,6 +265,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
1
3rdparty/bgfx/examples/45-bokeh/bokeh.cpp
vendored
1
3rdparty/bgfx/examples/45-bokeh/bokeh.cpp
vendored
@ -247,6 +247,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -430,6 +430,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -146,6 +146,7 @@ public:
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -85,6 +85,7 @@ namespace
|
||||
init.vendorId = args.m_pciId;
|
||||
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
|
||||
init.platformData.ndt = entry::getNativeDisplayHandle();
|
||||
init.platformData.type = entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
init.resolution.width = m_width;
|
||||
init.resolution.height = m_height;
|
||||
init.resolution.reset = m_reset;
|
||||
|
@ -1037,3 +1037,8 @@ extern "C" void* entry_get_native_display_handle()
|
||||
{
|
||||
return entry::getNativeDisplayHandle();
|
||||
}
|
||||
|
||||
extern "C" bgfx::NativeWindowHandleType::Enum entry_get_native_window_handle_type()
|
||||
{
|
||||
return entry::getNativeWindowHandleType(entry::kDefaultWindowHandle);
|
||||
}
|
||||
|
4
3rdparty/bgfx/examples/common/entry/entry.h
vendored
4
3rdparty/bgfx/examples/common/entry/entry.h
vendored
@ -7,6 +7,7 @@
|
||||
#define ENTRY_H_HEADER_GUARD
|
||||
|
||||
#include "dbg.h"
|
||||
#include <bgfx/bgfx.h>
|
||||
#include <bx/bx.h>
|
||||
#include <bx/filepath.h>
|
||||
#include <bx/string.h>
|
||||
@ -297,6 +298,9 @@ namespace entry
|
||||
///
|
||||
void* getNativeDisplayHandle();
|
||||
|
||||
///
|
||||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle);
|
||||
|
||||
///
|
||||
void setCurrentDir(const char* _dir);
|
||||
|
||||
|
@ -550,6 +550,12 @@ namespace entry
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
|
||||
{
|
||||
BX_UNUSED(_handle);
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
}
|
||||
|
||||
int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData)
|
||||
{
|
||||
BX_UNUSED(_thread);
|
||||
|
@ -875,6 +875,19 @@ namespace entry
|
||||
# endif // BX_PLATFORM_*
|
||||
}
|
||||
|
||||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
|
||||
{
|
||||
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
|
||||
# if ENTRY_CONFIG_USE_WAYLAND
|
||||
return bgfx::NativeWindowHandleType::Wayland;
|
||||
# else
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
# endif // ENTRY_CONFIG_USE_WAYLAND
|
||||
# else
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
# endif // BX_PLATFORM_*
|
||||
}
|
||||
|
||||
int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData)
|
||||
{
|
||||
BX_UNUSED(_thread);
|
||||
|
@ -427,6 +427,12 @@ namespace entry
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
|
||||
{
|
||||
BX_UNUSED(_handle);
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int _argc, const char* const* _argv)
|
||||
|
@ -161,6 +161,12 @@ namespace entry
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
|
||||
{
|
||||
BX_UNUSED(_handle);
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
}
|
||||
|
||||
} // namespace entry
|
||||
|
||||
using namespace entry;
|
||||
|
@ -78,6 +78,12 @@ namespace entry
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
|
||||
{
|
||||
BX_UNUSED(_handle);
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
}
|
||||
|
||||
} // namespace entry
|
||||
|
||||
int main(int _argc, const char* const* _argv)
|
||||
|
@ -725,6 +725,12 @@ namespace entry
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
|
||||
{
|
||||
BX_UNUSED(_handle);
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
}
|
||||
|
||||
} // namespace entry
|
||||
|
||||
@implementation AppDelegate
|
||||
|
@ -50,21 +50,24 @@ namespace entry
|
||||
|
||||
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
|
||||
# if ENTRY_CONFIG_USE_WAYLAND
|
||||
wl_egl_window *win_impl = (wl_egl_window*)SDL_GetWindowData(_window, "wl_egl_window");
|
||||
if(!win_impl)
|
||||
{
|
||||
int width, height;
|
||||
SDL_GetWindowSize(_window, &width, &height);
|
||||
struct wl_surface* surface = wmi.info.wl.surface;
|
||||
if(!surface)
|
||||
return nullptr;
|
||||
win_impl = wl_egl_window_create(surface, width, height);
|
||||
SDL_SetWindowData(_window, "wl_egl_window", win_impl);
|
||||
}
|
||||
return (void*)(uintptr_t)win_impl;
|
||||
# else
|
||||
return (void*)wmi.info.x11.window;
|
||||
# endif
|
||||
if (wmi.subsystem == SDL_SYSWM_WAYLAND)
|
||||
{
|
||||
wl_egl_window *win_impl = (wl_egl_window*)SDL_GetWindowData(_window, "wl_egl_window");
|
||||
if(!win_impl)
|
||||
{
|
||||
int width, height;
|
||||
SDL_GetWindowSize(_window, &width, &height);
|
||||
struct wl_surface* surface = wmi.info.wl.surface;
|
||||
if(!surface)
|
||||
return nullptr;
|
||||
win_impl = wl_egl_window_create(surface, width, height);
|
||||
SDL_SetWindowData(_window, "wl_egl_window", win_impl);
|
||||
}
|
||||
return (void*)(uintptr_t)win_impl;
|
||||
}
|
||||
else
|
||||
# endif // ENTRY_CONFIG_USE_WAYLAND
|
||||
return (void*)wmi.info.x11.window;
|
||||
# elif BX_PLATFORM_OSX || BX_PLATFORM_IOS
|
||||
return wmi.info.cocoa.window;
|
||||
# elif BX_PLATFORM_WINDOWS
|
||||
@ -1145,18 +1148,38 @@ namespace entry
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
|
||||
# if ENTRY_CONFIG_USE_WAYLAND
|
||||
return wmi.info.wl.display;
|
||||
# else
|
||||
return wmi.info.x11.display;
|
||||
if (wmi.subsystem == SDL_SYSWM_WAYLAND)
|
||||
return wmi.info.wl.display;
|
||||
else
|
||||
# endif // ENTRY_CONFIG_USE_WAYLAND
|
||||
return wmi.info.x11.display;
|
||||
# else
|
||||
return NULL;
|
||||
# endif // BX_PLATFORM_*
|
||||
}
|
||||
|
||||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
|
||||
{
|
||||
SDL_SysWMinfo wmi;
|
||||
SDL_VERSION(&wmi.version);
|
||||
if (!SDL_GetWindowWMInfo(s_ctx.m_window[_handle.idx], &wmi) )
|
||||
{
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
}
|
||||
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
|
||||
# if ENTRY_CONFIG_USE_WAYLAND
|
||||
if (wmi.subsystem == SDL_SYSWM_WAYLAND)
|
||||
return bgfx::NativeWindowHandleType::Wayland;
|
||||
else
|
||||
# endif // ENTRY_CONFIG_USE_WAYLAND
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
# else
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
# endif // BX_PLATFORM_*
|
||||
}
|
||||
|
||||
int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData)
|
||||
{
|
||||
BX_UNUSED(_thread);
|
||||
|
@ -1169,6 +1169,12 @@ namespace entry
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
|
||||
{
|
||||
BX_UNUSED(_handle);
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
}
|
||||
|
||||
int32_t MainThreadEntry::threadFunc(bx::Thread* /*_thread*/, void* _userData)
|
||||
{
|
||||
MainThreadEntry* self = (MainThreadEntry*)_userData;
|
||||
|
@ -771,6 +771,12 @@ namespace entry
|
||||
return s_ctx.m_display;
|
||||
}
|
||||
|
||||
bgfx::NativeWindowHandleType::Enum getNativeWindowHandleType(WindowHandle _handle)
|
||||
{
|
||||
BX_UNUSED(_handle);
|
||||
return bgfx::NativeWindowHandleType::Default;
|
||||
}
|
||||
|
||||
} // namespace entry
|
||||
|
||||
int main(int _argc, const char* const* _argv)
|
||||
|
35
3rdparty/bgfx/include/bgfx/bgfx.h
vendored
35
3rdparty/bgfx/include/bgfx/bgfx.h
vendored
@ -403,6 +403,22 @@ namespace bgfx
|
||||
};
|
||||
};
|
||||
|
||||
/// Native window handle type.
|
||||
///
|
||||
/// @attention C99's equivalent binding is `bgfx_native_window_handle_type_t`.
|
||||
///
|
||||
|
||||
struct NativeWindowHandleType
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
Default = 0, //!< Platform default handle type (X11 on Linux).
|
||||
Wayland, //!< Wayland.
|
||||
|
||||
Count
|
||||
};
|
||||
};
|
||||
|
||||
static const uint16_t kInvalidHandle = UINT16_MAX;
|
||||
|
||||
BGFX_HANDLE(DynamicIndexBufferHandle)
|
||||
@ -622,15 +638,16 @@ namespace bgfx
|
||||
{
|
||||
PlatformData();
|
||||
|
||||
void* ndt; //!< Native display type (*nix specific).
|
||||
void* nwh; //!< Native window handle. If `NULL`, bgfx will create a headless
|
||||
/// context/device, provided the rendering API supports it.
|
||||
void* context; //!< GL context, D3D device, or Vulkan device. If `NULL`, bgfx
|
||||
/// will create context/device.
|
||||
void* backBuffer; //!< GL back-buffer, or D3D render target view. If `NULL` bgfx will
|
||||
/// create back-buffer color surface.
|
||||
void* backBufferDS; //!< Backbuffer depth/stencil. If `NULL`, bgfx will create a back-buffer
|
||||
/// depth/stencil surface.
|
||||
void* ndt; //!< Native display type (*nix specific).
|
||||
void* nwh; //!< Native window handle. If `NULL`, bgfx will create a headless
|
||||
/// context/device, provided the rendering API supports it.
|
||||
void* context; //!< GL context, D3D device, or Vulkan device. If `NULL`, bgfx
|
||||
/// will create context/device.
|
||||
void* backBuffer; //!< GL back-buffer, or D3D render target view. If `NULL` bgfx will
|
||||
/// create back-buffer color surface.
|
||||
void* backBufferDS; //!< Backbuffer depth/stencil. If `NULL`, bgfx will create a back-buffer
|
||||
/// depth/stencil surface.
|
||||
NativeWindowHandleType::Enum type; //!< Handle type. Needed for platforms having more than one option.
|
||||
};
|
||||
|
||||
/// Backbuffer resolution and reset parameters.
|
||||
|
18
3rdparty/bgfx/include/bgfx/c99/bgfx.h
vendored
18
3rdparty/bgfx/include/bgfx/c99/bgfx.h
vendored
@ -391,6 +391,19 @@ typedef enum bgfx_view_mode
|
||||
|
||||
} bgfx_view_mode_t;
|
||||
|
||||
/**
|
||||
* Native window handle type..
|
||||
*
|
||||
*/
|
||||
typedef enum bgfx_native_window_handle_type
|
||||
{
|
||||
BGFX_NATIVE_WINDOW_HANDLE_TYPE_DEFAULT, /** ( 0) Platform default handle type (X11 on Linux) */
|
||||
BGFX_NATIVE_WINDOW_HANDLE_TYPE_WAYLAND, /** ( 1) Wayland. */
|
||||
|
||||
BGFX_NATIVE_WINDOW_HANDLE_TYPE_COUNT
|
||||
|
||||
} bgfx_native_window_handle_type_t;
|
||||
|
||||
/**
|
||||
* Render frame enum.
|
||||
*
|
||||
@ -625,6 +638,11 @@ typedef struct bgfx_platform_data_s
|
||||
*/
|
||||
void* backBufferDS;
|
||||
|
||||
/**
|
||||
* Handle type. Needed for platforms having more than one option.
|
||||
*/
|
||||
bgfx_native_window_handle_type_t type;
|
||||
|
||||
} bgfx_platform_data_t;
|
||||
|
||||
/**
|
||||
|
1
3rdparty/bgfx/src/amalgamated.cpp
vendored
1
3rdparty/bgfx/src/amalgamated.cpp
vendored
@ -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"
|
||||
|
1
3rdparty/bgfx/src/bgfx.cpp
vendored
1
3rdparty/bgfx/src/bgfx.cpp
vendored
@ -3422,6 +3422,7 @@ namespace bgfx
|
||||
, context(NULL)
|
||||
, backBuffer(NULL)
|
||||
, backBufferDS(NULL)
|
||||
, type(NativeWindowHandleType::Default)
|
||||
{
|
||||
}
|
||||
|
||||
|
184
3rdparty/bgfx/src/glcontext_egl.cpp
vendored
184
3rdparty/bgfx/src/glcontext_egl.cpp
vendored
@ -25,36 +25,44 @@ namespace bgfx { namespace gl
|
||||
|
||||
typedef void (*EGLPROC)(void);
|
||||
|
||||
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* PFNEGLCREATEWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
|
||||
typedef EGLint (EGLAPIENTRY* PFNEGLGETERRORPROC)(void);
|
||||
typedef EGLDisplay (EGLAPIENTRY* PFNEGLGETDISPLAYPROC)(EGLNativeDisplayType display_id);
|
||||
typedef EGLPROC (EGLAPIENTRY* PFNEGLGETPROCADDRESSPROC)(const char *procname);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLINITIALIZEPROC)(EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLMAKECURRENTPROC)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
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);
|
||||
typedef EGLSurface (EGLAPIENTRY* PFNEGLCREATEWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint* attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLDESTROYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLDESTROYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface);
|
||||
typedef const char* (EGLAPIENTRY* PGNEGLQUERYSTRINGPROC)(EGLDisplay dpy, EGLint name);
|
||||
typedef EGLContext (EGLAPIENTRY* PFNEGLGETCURRENTCONTEXTPROC)(void);
|
||||
typedef EGLSurface (EGLAPIENTRY* PFNEGLGETCURRENTSURFACEPROC)(EGLint readdraw);
|
||||
typedef EGLDisplay (EGLAPIENTRY* PFNEGLGETDISPLAYPROC)(EGLNativeDisplayType display_id);
|
||||
typedef EGLint (EGLAPIENTRY* PFNEGLGETERRORPROC)(void);
|
||||
typedef EGLPROC (EGLAPIENTRY* PFNEGLGETPROCADDRESSPROC)(const char* procname);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLINITIALIZEPROC)(EGLDisplay dpy, EGLint* major, EGLint* minor);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLMAKECURRENTPROC)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval);
|
||||
typedef EGLBoolean (EGLAPIENTRY* PFNEGLTERMINATEPROC)(EGLDisplay dpy);
|
||||
typedef const char* (EGLAPIENTRY* PGNEGLQUERYSTRINGPROC)(EGLDisplay dpy, EGLint name);
|
||||
|
||||
#define EGL_IMPORT \
|
||||
EGL_IMPORT_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig); \
|
||||
EGL_IMPORT_FUNC(PFNEGLCREATECONTEXTPROC, eglCreateContext); \
|
||||
EGL_IMPORT_FUNC(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETDISPLAYPROC, eglGetDisplay); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETERRORPROC, eglGetError); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \
|
||||
EGL_IMPORT_FUNC(PFNEGLDESTROYCONTEXTPROC, eglDestroyContext); \
|
||||
EGL_IMPORT_FUNC(PFNEGLDESTROYSURFACEPROC, eglDestroySurface); \
|
||||
EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \
|
||||
EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \
|
||||
EGL_IMPORT_FUNC(PGNEGLQUERYSTRINGPROC, eglQueryString); \
|
||||
EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); \
|
||||
EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \
|
||||
EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate);
|
||||
#define EGL_IMPORT \
|
||||
EGL_IMPORT_FUNC(PGNEGLBINDAPIPROC, eglBindAPI); \
|
||||
EGL_IMPORT_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig); \
|
||||
EGL_IMPORT_FUNC(PFNEGLCREATECONTEXTPROC, eglCreateContext); \
|
||||
EGL_IMPORT_FUNC(PFNEGLCREATEPBUFFERSURFACEPROC, eglCreatePbufferSurface); \
|
||||
EGL_IMPORT_FUNC(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface); \
|
||||
EGL_IMPORT_FUNC(PFNEGLDESTROYCONTEXTPROC, eglDestroyContext); \
|
||||
EGL_IMPORT_FUNC(PFNEGLDESTROYSURFACEPROC, eglDestroySurface); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETCURRENTCONTEXTPROC, eglGetCurrentContext); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETCURRENTSURFACEPROC, eglGetCurrentSurface); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETDISPLAYPROC, eglGetDisplay); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETERRORPROC, eglGetError); \
|
||||
EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress); \
|
||||
EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC, eglInitialize); \
|
||||
EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent); \
|
||||
EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers); \
|
||||
EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval); \
|
||||
EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC, eglTerminate); \
|
||||
EGL_IMPORT_FUNC(PGNEGLQUERYSTRINGPROC, eglQueryString); \
|
||||
|
||||
#define EGL_IMPORT_FUNC(_proto, _func) _proto _func
|
||||
EGL_IMPORT
|
||||
@ -62,12 +70,19 @@ EGL_IMPORT
|
||||
|
||||
void* eglOpen()
|
||||
{
|
||||
void* handle = bx::dlopen("libEGL." BX_DL_EXT);
|
||||
void* handle = bx::dlopen(
|
||||
#if BX_PLATFORM_LINUX
|
||||
"libEGL.so.1"
|
||||
#else
|
||||
"libEGL." BX_DL_EXT
|
||||
#endif // BX_PLATFORM_*
|
||||
);
|
||||
|
||||
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
|
||||
@ -107,9 +122,17 @@ EGL_IMPORT
|
||||
: m_nwh(_nwh)
|
||||
, m_display(_display)
|
||||
{
|
||||
EGLSurface defaultSurface = eglGetCurrentSurface(EGL_DRAW);
|
||||
EGLSurface defaultSurface = eglGetCurrentSurface(EGL_DRAW);
|
||||
|
||||
if (EGLNativeWindowType(0) == _nwh)
|
||||
{
|
||||
m_surface = eglCreatePbufferSurface(m_display, _config, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_surface = eglCreateWindowSurface(m_display, _config, _nwh, NULL);
|
||||
}
|
||||
|
||||
m_surface = eglCreateWindowSurface(m_display, _config, _nwh, NULL);
|
||||
BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::UnableToInitialize, "Failed to create surface.");
|
||||
|
||||
m_context = eglCreateContext(m_display, _config, _context, s_contextAttrs);
|
||||
@ -119,15 +142,17 @@ EGL_IMPORT
|
||||
GL_CHECK(glClearColor(0.0f, 0.0f, 0.0f, 0.0f) );
|
||||
GL_CHECK(glClear(GL_COLOR_BUFFER_BIT) );
|
||||
swapBuffers();
|
||||
|
||||
GL_CHECK(glClear(GL_COLOR_BUFFER_BIT) );
|
||||
swapBuffers();
|
||||
eglMakeCurrent(m_display, defaultSurface, defaultSurface, _context);
|
||||
|
||||
eglMakeCurrent(m_display, defaultSurface, defaultSurface, _context);
|
||||
}
|
||||
|
||||
~SwapChainGL()
|
||||
{
|
||||
EGLSurface defaultSurface = eglGetCurrentSurface(EGL_DRAW);
|
||||
EGLContext defaultContext = eglGetCurrentContext();
|
||||
EGLSurface defaultSurface = eglGetCurrentSurface(EGL_DRAW);
|
||||
EGLContext defaultContext = eglGetCurrentContext();
|
||||
|
||||
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(m_display, m_context);
|
||||
@ -157,6 +182,8 @@ EGL_IMPORT
|
||||
|
||||
void GlContext::create(uint32_t _width, uint32_t _height, uint32_t _flags)
|
||||
{
|
||||
BX_UNUSED(_flags);
|
||||
|
||||
# if BX_PLATFORM_RPI
|
||||
bcm_host_init();
|
||||
# endif // BX_PLATFORM_RPI
|
||||
@ -180,7 +207,7 @@ EGL_IMPORT
|
||||
}
|
||||
# endif // BX_PLATFORM_WINDOWS
|
||||
|
||||
m_display = eglGetDisplay(ndt);
|
||||
m_display = eglGetDisplay(NULL == ndt ? EGL_DEFAULT_DISPLAY : ndt);
|
||||
BGFX_FATAL(m_display != EGL_NO_DISPLAY, Fatal::UnableToInitialize, "Failed to create display %p", m_display);
|
||||
|
||||
EGLint major = 0;
|
||||
@ -202,24 +229,39 @@ EGL_IMPORT
|
||||
BX_TRACE("Supported EGL extensions:");
|
||||
dumpExtensions(extensions);
|
||||
|
||||
// https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_recordable.txt
|
||||
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());
|
||||
}
|
||||
|
||||
const bool hasEglAndroidRecordable = !bx::findIdentifierMatch(extensions, "EGL_ANDROID_recordable").isEmpty();
|
||||
|
||||
const uint32_t gles = 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
|
||||
|
||||
const bool headless = EGLNativeWindowType(0) == nwh;
|
||||
|
||||
EGLint attrs[] =
|
||||
{
|
||||
EGL_RENDERABLE_TYPE, (gles >= 30) ? EGL_OPENGL_ES3_BIT_KHR : EGL_OPENGL_ES2_BIT,
|
||||
EGL_RENDERABLE_TYPE, !!BGFX_CONFIG_RENDERER_OPENGL
|
||||
? EGL_OPENGL_BIT
|
||||
: (glVersion >= 30) ? EGL_OPENGL_ES3_BIT_KHR : EGL_OPENGL_ES2_BIT
|
||||
,
|
||||
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_SURFACE_TYPE, headless ? EGL_PBUFFER_BIT : EGL_WINDOW_BIT,
|
||||
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_ALPHA_SIZE, 8,
|
||||
|
||||
# if BX_PLATFORM_ANDROID
|
||||
@ -231,8 +273,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
|
||||
};
|
||||
@ -274,7 +316,23 @@ EGL_IMPORT
|
||||
vc_dispmanx_update_submit_sync(dispmanUpdate);
|
||||
# endif // BX_PLATFORM_ANDROID
|
||||
|
||||
m_surface = eglCreateWindowSurface(m_display, m_config, nwh, NULL);
|
||||
if (headless)
|
||||
{
|
||||
EGLint pbAttribs[] =
|
||||
{
|
||||
EGL_WIDTH, EGLint(_width),
|
||||
EGL_HEIGHT, EGLint(_height),
|
||||
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
m_surface = eglCreatePbufferSurface(m_display, m_config, pbAttribs);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_surface = eglCreateWindowSurface(m_display, m_config, nwh, NULL);
|
||||
}
|
||||
|
||||
BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::UnableToInitialize, "Failed to create surface.");
|
||||
|
||||
const bool hasEglKhrCreateContext = !bx::findIdentifierMatch(extensions, "EGL_KHR_create_context").isEmpty();
|
||||
@ -291,11 +349,17 @@ EGL_IMPORT
|
||||
# else
|
||||
if (hasEglKhrCreateContext)
|
||||
{
|
||||
bx::write(&writer, EGLint(EGL_CONTEXT_MAJOR_VERSION_KHR), bx::ErrorAssert{} );
|
||||
bx::write(&writer, EGLint(gles / 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(gles % 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
|
||||
@ -318,7 +382,7 @@ EGL_IMPORT
|
||||
# endif // BX_PLATFORM_RPI
|
||||
{
|
||||
bx::write(&writer, EGLint(EGL_CONTEXT_CLIENT_VERSION), bx::ErrorAssert{} );
|
||||
bx::write(&writer, EGLint(gles / 10), bx::ErrorAssert{} );
|
||||
bx::write(&writer, EGLint(glVersion / 10), bx::ErrorAssert{} );
|
||||
}
|
||||
|
||||
bx::write(&writer, EGLint(EGL_NONE), bx::ErrorAssert{} );
|
||||
@ -397,10 +461,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
|
||||
;
|
||||
@ -458,13 +522,23 @@ EGL_IMPORT
|
||||
BX_TRACE("Import:");
|
||||
|
||||
# if BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX
|
||||
void* glesv2 = bx::dlopen("libGLESv2." BX_DL_EXT);
|
||||
# if BX_PLATFORM_WINDOWS
|
||||
# define LIBRARY_NAME "libGL.dll"
|
||||
# elif BX_PLATFORM_LINUX
|
||||
# if BGFX_CONFIG_RENDERER_OPENGL
|
||||
# define LIBRARY_NAME "libGL.so.1"
|
||||
# else
|
||||
# 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>(glesv2, #_import); \
|
||||
_func = bx::dlsym<_proto>(lib, #_import); \
|
||||
BX_TRACE("\t%p " #_func " (" #_import ")", _func); \
|
||||
BGFX_FATAL(_optional || NULL != _func \
|
||||
, Fatal::UnableToInitialize \
|
||||
|
11
3rdparty/bgfx/src/glcontext_egl.h
vendored
11
3rdparty/bgfx/src/glcontext_egl.h
vendored
@ -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;
|
||||
|
393
3rdparty/bgfx/src/glcontext_glx.cpp
vendored
393
3rdparty/bgfx/src/glcontext_glx.cpp
vendored
@ -1,393 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011-2022 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_DELETE(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)
|
58
3rdparty/bgfx/src/glcontext_glx.h
vendored
58
3rdparty/bgfx/src/glcontext_glx.h
vendored
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011-2022 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
|
38
3rdparty/bgfx/src/renderer_gl.h
vendored
38
3rdparty/bgfx/src/renderer_gl.h
vendored
@ -6,13 +6,12 @@
|
||||
#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 \
|
||||
) )
|
||||
|
||||
#define BGFX_USE_HTML5 (BGFX_CONFIG_RENDERER_OPENGLES && (0 \
|
||||
@ -23,11 +22,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 \
|
||||
@ -144,14 +138,6 @@ typedef uint64_t GLuint64;
|
||||
# include <GLES3/gl3ext.h>
|
||||
# endif // BGFX_CONFIG_RENDERER_
|
||||
|
||||
# if BGFX_USE_EGL
|
||||
# include "glcontext_egl.h"
|
||||
# endif // BGFX_USE_EGL
|
||||
|
||||
# if BGFX_USE_HTML5
|
||||
# include "glcontext_html5.h"
|
||||
# endif // BGFX_USE_EGL
|
||||
|
||||
#endif // BGFX_CONFIG_RENDERER_OPENGL
|
||||
|
||||
#include "renderer.h"
|
||||
@ -1162,18 +1148,18 @@ typedef uint64_t GLuint64;
|
||||
# define GL_TEXTURE_LOD_BIAS 0x8501
|
||||
#endif // GL_TEXTURE_LOD_BIAS
|
||||
|
||||
#if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
|
||||
# include "glcontext_glx.h"
|
||||
#if BGFX_USE_EGL
|
||||
# include "glcontext_egl.h"
|
||||
#elif BGFX_USE_HTML5
|
||||
# include "glcontext_html5.h"
|
||||
#elif BGFX_USE_WGL
|
||||
# include "glcontext_wgl.h"
|
||||
#elif BX_PLATFORM_OSX
|
||||
# include "glcontext_nsgl.h"
|
||||
#elif BX_PLATFORM_IOS
|
||||
# include "glcontext_eagl.h"
|
||||
#endif // BX_PLATFORM_
|
||||
|
||||
#if BGFX_USE_WGL
|
||||
# include "glcontext_wgl.h"
|
||||
#endif // BGFX_USE_WGL
|
||||
|
||||
#ifndef GL_APIENTRY
|
||||
# define GL_APIENTRY APIENTRY
|
||||
#endif // GL_APIENTRY
|
||||
|
70
3rdparty/bgfx/src/renderer_vk.cpp
vendored
70
3rdparty/bgfx/src/renderer_vk.cpp
vendored
@ -17,6 +17,10 @@
|
||||
# import <Metal/Metal.h>
|
||||
#endif // BX_PLATFORM_OSX
|
||||
|
||||
#if defined(WL_EGL_PLATFORM)
|
||||
# include <wayland-egl-backend.h>
|
||||
#endif // defined(WL_EGL_PLATFORM)
|
||||
|
||||
namespace bgfx { namespace vk
|
||||
{
|
||||
static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME];
|
||||
@ -1220,7 +1224,7 @@ VK_IMPORT
|
||||
BX_TRACE("\t%s", layer.m_name);
|
||||
}
|
||||
}
|
||||
#if BX_PLATFORM_OSX
|
||||
#if BX_PLATFORM_OSX || defined(WL_EGL_PLATFORM)
|
||||
uint32_t numEnabledExtensions = headless ? 0 : 3;
|
||||
|
||||
const char* enabledExtension[Extension::Count + 3] =
|
||||
@ -6759,41 +6763,57 @@ VK_DESTROY
|
||||
}
|
||||
#elif BX_PLATFORM_LINUX
|
||||
{
|
||||
if (NULL != vkCreateXlibSurfaceKHR)
|
||||
#if defined(WL_EGL_PLATFORM)
|
||||
if (g_platformData.type == bgfx::NativeWindowHandleType::Wayland)
|
||||
{
|
||||
VkXlibSurfaceCreateInfoKHR sci;
|
||||
sci.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
|
||||
VkWaylandSurfaceCreateInfoKHR sci;
|
||||
sci.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
|
||||
sci.pNext = NULL;
|
||||
sci.flags = 0;
|
||||
sci.dpy = (Display*)g_platformData.ndt;
|
||||
sci.window = (Window)m_nwh;
|
||||
result = vkCreateXlibSurfaceKHR(instance, &sci, allocatorCb, &m_surface);
|
||||
sci.flags = 0;
|
||||
sci.display = (wl_display*)g_platformData.ndt;
|
||||
sci.surface = (wl_surface*)((wl_egl_window*)m_nwh)->surface;
|
||||
result = vkCreateWaylandSurfaceKHR(instance, &sci, allocatorCb, &m_surface);
|
||||
}
|
||||
|
||||
if (VK_SUCCESS != result)
|
||||
else
|
||||
#endif // defined(WL_EGL_PLATFORM)
|
||||
{
|
||||
void* xcbdll = bx::dlopen("libX11-xcb.so.1");
|
||||
|
||||
if (NULL != xcbdll
|
||||
&& NULL != vkCreateXcbSurfaceKHR)
|
||||
if (NULL != vkCreateXlibSurfaceKHR)
|
||||
{
|
||||
typedef xcb_connection_t* (*PFN_XGETXCBCONNECTION)(Display*);
|
||||
PFN_XGETXCBCONNECTION XGetXCBConnection = (PFN_XGETXCBCONNECTION)bx::dlsym(xcbdll, "XGetXCBConnection");
|
||||
VkXlibSurfaceCreateInfoKHR sci;
|
||||
sci.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
|
||||
sci.pNext = NULL;
|
||||
sci.flags = 0;
|
||||
sci.dpy = (Display*)g_platformData.ndt;
|
||||
sci.window = (Window)m_nwh;
|
||||
result = vkCreateXlibSurfaceKHR(instance, &sci, allocatorCb, &m_surface);
|
||||
}
|
||||
|
||||
union { void* ptr; xcb_window_t window; } cast = { m_nwh };
|
||||
if (VK_SUCCESS != result)
|
||||
{
|
||||
void* xcbdll = bx::dlopen("libX11-xcb.so.1");
|
||||
|
||||
VkXcbSurfaceCreateInfoKHR sci;
|
||||
sci.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
|
||||
sci.pNext = NULL;
|
||||
sci.flags = 0;
|
||||
sci.connection = XGetXCBConnection( (Display*)g_platformData.ndt);
|
||||
sci.window = cast.window;
|
||||
result = vkCreateXcbSurfaceKHR(instance, &sci, allocatorCb, &m_surface);
|
||||
if (NULL != xcbdll
|
||||
&& NULL != vkCreateXcbSurfaceKHR)
|
||||
{
|
||||
typedef xcb_connection_t* (*PFN_XGETXCBCONNECTION)(Display*);
|
||||
PFN_XGETXCBCONNECTION XGetXCBConnection = (PFN_XGETXCBCONNECTION)bx::dlsym(xcbdll, "XGetXCBConnection");
|
||||
|
||||
bx::dlclose(xcbdll);
|
||||
union { void* ptr; xcb_window_t window; } cast = { m_nwh };
|
||||
|
||||
VkXcbSurfaceCreateInfoKHR sci;
|
||||
sci.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
|
||||
sci.pNext = NULL;
|
||||
sci.flags = 0;
|
||||
sci.connection = XGetXCBConnection( (Display*)g_platformData.ndt);
|
||||
sci.window = cast.window;
|
||||
result = vkCreateXcbSurfaceKHR(instance, &sci, allocatorCb, &m_surface);
|
||||
|
||||
bx::dlclose(xcbdll);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#elif BX_PLATFORM_OSX
|
||||
{
|
||||
if (NULL != vkCreateMacOSSurfaceMVK)
|
||||
|
42
3rdparty/bgfx/src/renderer_vk.h
vendored
42
3rdparty/bgfx/src/renderer_vk.h
vendored
@ -11,10 +11,17 @@
|
||||
# define KHR_SURFACE_EXTENSION_NAME VK_KHR_ANDROID_SURFACE_EXTENSION_NAME
|
||||
# define VK_IMPORT_INSTANCE_PLATFORM VK_IMPORT_INSTANCE_ANDROID
|
||||
#elif BX_PLATFORM_LINUX
|
||||
# if defined(WL_EGL_PLATFORM)
|
||||
# define VK_USE_PLATFORM_WAYLAND_KHR
|
||||
# endif // defined(WL_EGL_PLATFORM)
|
||||
# define VK_USE_PLATFORM_XLIB_KHR
|
||||
# define VK_USE_PLATFORM_XCB_KHR
|
||||
//# define VK_USE_PLATFORM_WAYLAND_KHR
|
||||
# define KHR_SURFACE_EXTENSION_NAME VK_KHR_XCB_SURFACE_EXTENSION_NAME
|
||||
# if defined(WL_EGL_PLATFORM)
|
||||
# define KHR_SURFACE_EXTENSION_NAME VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, \
|
||||
VK_KHR_XCB_SURFACE_EXTENSION_NAME
|
||||
# else
|
||||
# define KHR_SURFACE_EXTENSION_NAME VK_KHR_XCB_SURFACE_EXTENSION_NAME
|
||||
# endif // defined(WL_EGL_PLATFORM)
|
||||
# define VK_IMPORT_INSTANCE_PLATFORM VK_IMPORT_INSTANCE_LINUX
|
||||
#elif BX_PLATFORM_WINDOWS
|
||||
# define VK_USE_PLATFORM_WIN32_KHR
|
||||
@ -32,6 +39,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"
|
||||
|
||||
@ -48,6 +69,19 @@
|
||||
/* VK_KHR_android_surface */ \
|
||||
VK_IMPORT_INSTANCE_FUNC(true, vkCreateAndroidSurfaceKHR); \
|
||||
|
||||
#if defined(WL_EGL_PLATFORM)
|
||||
#define VK_IMPORT_INSTANCE_LINUX \
|
||||
/* VK_KHR_wayland_surface */ \
|
||||
VK_IMPORT_INSTANCE_FUNC(true, vkCreateWaylandSurfaceKHR); \
|
||||
VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceWaylandPresentationSupportKHR); \
|
||||
/* VK_KHR_xlib_surface */ \
|
||||
VK_IMPORT_INSTANCE_FUNC(true, vkCreateXlibSurfaceKHR); \
|
||||
VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceXlibPresentationSupportKHR); \
|
||||
/* VK_KHR_xcb_surface */ \
|
||||
VK_IMPORT_INSTANCE_FUNC(true, vkCreateXcbSurfaceKHR); \
|
||||
VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceXcbPresentationSupportKHR); \
|
||||
|
||||
#else
|
||||
#define VK_IMPORT_INSTANCE_LINUX \
|
||||
/* VK_KHR_xlib_surface */ \
|
||||
VK_IMPORT_INSTANCE_FUNC(true, vkCreateXlibSurfaceKHR); \
|
||||
@ -56,9 +90,7 @@
|
||||
VK_IMPORT_INSTANCE_FUNC(true, vkCreateXcbSurfaceKHR); \
|
||||
VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceXcbPresentationSupportKHR); \
|
||||
|
||||
// /* VK_KHR_wayland_surface */
|
||||
// VK_IMPORT_INSTANCE_FUNC(true, vkCreateWaylandSurfaceKHR);
|
||||
// VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceWaylandPresentationSupportKHR);
|
||||
#endif // defined(WL_EGL_PLATFORM)
|
||||
|
||||
#define VK_IMPORT_INSTANCE_WINDOWS \
|
||||
/* VK_KHR_win32_surface */ \
|
||||
|
@ -1484,7 +1484,6 @@ end
|
||||
MAME_DIR .. "3rdparty/bgfx/src/debug_renderdoc.cpp",
|
||||
MAME_DIR .. "3rdparty/bgfx/src/dxgi.cpp",
|
||||
MAME_DIR .. "3rdparty/bgfx/src/glcontext_egl.cpp",
|
||||
MAME_DIR .. "3rdparty/bgfx/src/glcontext_glx.cpp",
|
||||
MAME_DIR .. "3rdparty/bgfx/src/glcontext_html5.cpp",
|
||||
MAME_DIR .. "3rdparty/bgfx/src/glcontext_wgl.cpp",
|
||||
MAME_DIR .. "3rdparty/bgfx/src/nvapi.cpp",
|
||||
|
Loading…
Reference in New Issue
Block a user