mirror of https://github.com/AxioDL/boo.git
Linux build fixes
This commit is contained in:
parent
1dc69c3468
commit
872ab3900d
|
@ -58,6 +58,8 @@ int ApplicationRun(IApplication::EPlatformType platform,
|
||||||
std::string_view friendlyName,
|
std::string_view friendlyName,
|
||||||
std::string_view pname,
|
std::string_view pname,
|
||||||
const std::vector<std::string>& args,
|
const std::vector<std::string>& args,
|
||||||
|
uint32_t samples,
|
||||||
|
uint32_t anisotropy,
|
||||||
bool singleInstance)
|
bool singleInstance)
|
||||||
{
|
{
|
||||||
std::string thrName = std::string(friendlyName) + " Main Thread";
|
std::string thrName = std::string(friendlyName) + " Main Thread";
|
||||||
|
@ -65,10 +67,10 @@ int ApplicationRun(IApplication::EPlatformType platform,
|
||||||
if (APP)
|
if (APP)
|
||||||
return 1;
|
return 1;
|
||||||
if (platform == IApplication::EPlatformType::Wayland)
|
if (platform == IApplication::EPlatformType::Wayland)
|
||||||
APP = new ApplicationWayland(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
APP = new ApplicationWayland(cb, uniqueName, friendlyName, pname, args, samples, anisotropy, singleInstance);
|
||||||
else if (platform == IApplication::EPlatformType::Xlib ||
|
else if (platform == IApplication::EPlatformType::Xlib ||
|
||||||
platform == IApplication::EPlatformType::Auto)
|
platform == IApplication::EPlatformType::Auto)
|
||||||
APP = new ApplicationXlib(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
APP = new ApplicationXlib(cb, uniqueName, friendlyName, pname, args, samples, anisotropy, singleInstance);
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
return APP->run();
|
return APP->run();
|
||||||
|
|
|
@ -32,6 +32,8 @@ public:
|
||||||
std::string_view friendlyName,
|
std::string_view friendlyName,
|
||||||
std::string_view pname,
|
std::string_view pname,
|
||||||
const std::vector<std::string>& args,
|
const std::vector<std::string>& args,
|
||||||
|
uint32_t samples,
|
||||||
|
uint32_t anisotropy,
|
||||||
bool singleInstance)
|
bool singleInstance)
|
||||||
: m_callback(callback),
|
: m_callback(callback),
|
||||||
m_uniqueName(uniqueName),
|
m_uniqueName(uniqueName),
|
||||||
|
@ -71,7 +73,7 @@ public:
|
||||||
return m_args;
|
return m_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<IWindow> newWindow(std::string_view title, uint32_t drawSamples)
|
std::shared_ptr<IWindow> newWindow(std::string_view title)
|
||||||
{
|
{
|
||||||
return _WindowWaylandNew(title);
|
return _WindowWaylandNew(title);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "boo/IApplication.hpp"
|
#include "boo/IApplication.hpp"
|
||||||
|
#include "boo/graphicsdev/GL.hpp"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
|
@ -117,7 +118,7 @@ static Window GetWindowOfEvent(XEvent* event, bool& windowEvent)
|
||||||
std::shared_ptr<IWindow> _WindowXlibNew(std::string_view title,
|
std::shared_ptr<IWindow> _WindowXlibNew(std::string_view title,
|
||||||
Display* display, void* xcbConn,
|
Display* display, void* xcbConn,
|
||||||
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
|
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
|
||||||
GLXContext lastCtx, void* vulkanHandle, uint32_t drawSamples);
|
GLXContext lastCtx, void* vulkanHandle, GLContext* glCtx);
|
||||||
|
|
||||||
static XIMStyle ChooseBetterStyle(XIMStyle style1, XIMStyle style2)
|
static XIMStyle ChooseBetterStyle(XIMStyle style1, XIMStyle style2)
|
||||||
{
|
{
|
||||||
|
@ -162,6 +163,7 @@ class ApplicationXlib final : public IApplication
|
||||||
const std::string m_friendlyName;
|
const std::string m_friendlyName;
|
||||||
const std::string m_pname;
|
const std::string m_pname;
|
||||||
const std::vector<std::string> m_args;
|
const std::vector<std::string> m_args;
|
||||||
|
GLContext m_glContext;
|
||||||
|
|
||||||
/* DBus single-instance */
|
/* DBus single-instance */
|
||||||
bool m_singleInstance;
|
bool m_singleInstance;
|
||||||
|
@ -223,6 +225,8 @@ public:
|
||||||
std::string_view friendlyName,
|
std::string_view friendlyName,
|
||||||
std::string_view pname,
|
std::string_view pname,
|
||||||
const std::vector<std::string>& args,
|
const std::vector<std::string>& args,
|
||||||
|
uint32_t samples,
|
||||||
|
uint32_t anisotropy,
|
||||||
bool singleInstance)
|
bool singleInstance)
|
||||||
: m_callback(callback),
|
: m_callback(callback),
|
||||||
m_uniqueName(uniqueName),
|
m_uniqueName(uniqueName),
|
||||||
|
@ -231,6 +235,8 @@ public:
|
||||||
m_args(args),
|
m_args(args),
|
||||||
m_singleInstance(singleInstance)
|
m_singleInstance(singleInstance)
|
||||||
{
|
{
|
||||||
|
m_glContext.m_sampleCount = samples;
|
||||||
|
m_glContext.m_anisotropy = anisotropy;
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
/* Check for Vulkan presence and preference */
|
/* Check for Vulkan presence and preference */
|
||||||
bool tryVulkan = true;
|
bool tryVulkan = true;
|
||||||
|
@ -527,14 +533,14 @@ public:
|
||||||
return m_args;
|
return m_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<IWindow> newWindow(std::string_view title, uint32_t drawSamples)
|
std::shared_ptr<IWindow> newWindow(std::string_view title)
|
||||||
{
|
{
|
||||||
#if BOO_HAS_VULKAN
|
#if BOO_HAS_VULKAN
|
||||||
std::shared_ptr<IWindow> newWindow = _WindowXlibNew(title, m_xDisp, m_xcbConn, m_xDefaultScreen, m_xIM,
|
std::shared_ptr<IWindow> newWindow = _WindowXlibNew(title, m_xDisp, m_xcbConn, m_xDefaultScreen, m_xIM,
|
||||||
m_bestStyle, m_fontset, m_lastGlxCtx, (void*)m_getVkProc, drawSamples);
|
m_bestStyle, m_fontset, m_lastGlxCtx, (void*)m_getVkProc, &m_glContext);
|
||||||
#else
|
#else
|
||||||
std::shared_ptr<IWindow> newWindow = _WindowXlibNew(title, m_xDisp, nullptr, m_xDefaultScreen, m_xIM,
|
std::shared_ptr<IWindow> newWindow = _WindowXlibNew(title, m_xDisp, nullptr, m_xDefaultScreen, m_xIM,
|
||||||
m_bestStyle, m_fontset, m_lastGlxCtx, nullptr, drawSamples);
|
m_bestStyle, m_fontset, m_lastGlxCtx, nullptr, &m_glCtx);
|
||||||
#endif
|
#endif
|
||||||
m_windows[(Window)newWindow->getPlatformHandle()] = newWindow;
|
m_windows[(Window)newWindow->getPlatformHandle()] = newWindow;
|
||||||
return newWindow;
|
return newWindow;
|
||||||
|
|
|
@ -295,16 +295,17 @@ struct GraphicsContextXlib : IGraphicsContext
|
||||||
EPixelFormat m_pf;
|
EPixelFormat m_pf;
|
||||||
uint32_t m_drawSamples;
|
uint32_t m_drawSamples;
|
||||||
IWindow* m_parentWindow;
|
IWindow* m_parentWindow;
|
||||||
|
GLContext* m_glCtx;
|
||||||
Display* m_xDisp;
|
Display* m_xDisp;
|
||||||
|
|
||||||
std::mutex m_vsyncmt;
|
std::mutex m_vsyncmt;
|
||||||
std::condition_variable m_vsynccv;
|
std::condition_variable m_vsynccv;
|
||||||
|
|
||||||
GraphicsContextXlib(EGraphicsAPI api, EPixelFormat pf, IWindow* parentWindow, Display* disp, uint32_t drawSamples)
|
GraphicsContextXlib(EGraphicsAPI api, EPixelFormat pf, IWindow* parentWindow, Display* disp, GLContext* glCtx)
|
||||||
: m_api(api),
|
: m_api(api),
|
||||||
m_pf(pf),
|
m_pf(pf),
|
||||||
m_drawSamples(drawSamples),
|
|
||||||
m_parentWindow(parentWindow),
|
m_parentWindow(parentWindow),
|
||||||
|
m_glCtx(glCtx),
|
||||||
m_xDisp(disp) {}
|
m_xDisp(disp) {}
|
||||||
virtual void destroy()=0;
|
virtual void destroy()=0;
|
||||||
virtual void resized(const SWindowRect& rect)=0;
|
virtual void resized(const SWindowRect& rect)=0;
|
||||||
|
@ -333,11 +334,11 @@ public:
|
||||||
|
|
||||||
GraphicsContextXlibGLX(EGraphicsAPI api, IWindow* parentWindow,
|
GraphicsContextXlibGLX(EGraphicsAPI api, IWindow* parentWindow,
|
||||||
Display* display, int defaultScreen,
|
Display* display, int defaultScreen,
|
||||||
GLXContext lastCtx, uint32_t& visualIdOut, uint32_t drawSamples)
|
GLXContext lastCtx, uint32_t& visualIdOut, GLContext* glCtx)
|
||||||
: GraphicsContextXlib(api, EPixelFormat::RGBA8, parentWindow, display, drawSamples),
|
: GraphicsContextXlib(api, EPixelFormat::RGBA8, parentWindow, display, glCtx),
|
||||||
m_lastCtx(lastCtx)
|
m_lastCtx(lastCtx)
|
||||||
{
|
{
|
||||||
m_dataFactory = _NewGLDataFactory(this, drawSamples);
|
m_dataFactory = _NewGLDataFactory(this, m_glCtx);
|
||||||
|
|
||||||
/* Query framebuffer configurations */
|
/* Query framebuffer configurations */
|
||||||
GLXFBConfig* fbConfigs = nullptr;
|
GLXFBConfig* fbConfigs = nullptr;
|
||||||
|
@ -531,7 +532,7 @@ public:
|
||||||
initcv.wait(outerLk);
|
initcv.wait(outerLk);
|
||||||
|
|
||||||
XUnlockDisplay(m_xDisp);
|
XUnlockDisplay(m_xDisp);
|
||||||
m_commandQueue = _NewGLCommandQueue(this);
|
m_commandQueue = _NewGLCommandQueue(this, m_glCtx);
|
||||||
XLockDisplay(m_xDisp);
|
XLockDisplay(m_xDisp);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -633,8 +634,8 @@ public:
|
||||||
|
|
||||||
GraphicsContextXlibVulkan(IWindow* parentWindow,
|
GraphicsContextXlibVulkan(IWindow* parentWindow,
|
||||||
Display* display, xcb_connection_t* xcbConn, int defaultScreen,
|
Display* display, xcb_connection_t* xcbConn, int defaultScreen,
|
||||||
VulkanContext* ctx, uint32_t& visualIdOut, uint32_t drawSamples)
|
VulkanContext* ctx, uint32_t& visualIdOut, GLContext* glCtx)
|
||||||
: GraphicsContextXlib(EGraphicsAPI::Vulkan, EPixelFormat::RGBA8, parentWindow, display, drawSamples),
|
: GraphicsContextXlib(EGraphicsAPI::Vulkan, EPixelFormat::RGBA8, parentWindow, display, glCtx),
|
||||||
m_xcbConn(xcbConn), m_ctx(ctx)
|
m_xcbConn(xcbConn), m_ctx(ctx)
|
||||||
{
|
{
|
||||||
Screen* screen = ScreenOfDisplay(display, defaultScreen);
|
Screen* screen = ScreenOfDisplay(display, defaultScreen);
|
||||||
|
@ -935,7 +936,7 @@ public:
|
||||||
WindowXlib(std::string_view title,
|
WindowXlib(std::string_view title,
|
||||||
Display* display, void* xcbConn,
|
Display* display, void* xcbConn,
|
||||||
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
|
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
|
||||||
GLXContext lastCtx, void* vulkanHandle, uint32_t drawSamples)
|
GLXContext lastCtx, void* vulkanHandle, GLContext* glCtx)
|
||||||
: m_xDisp(display), m_callback(nullptr),
|
: m_xDisp(display), m_callback(nullptr),
|
||||||
m_bestStyle(bestInputStyle)
|
m_bestStyle(bestInputStyle)
|
||||||
{
|
{
|
||||||
|
@ -948,14 +949,14 @@ public:
|
||||||
if (vulkanHandle && i == 1)
|
if (vulkanHandle && i == 1)
|
||||||
{
|
{
|
||||||
m_gfxCtx.reset(new GraphicsContextXlibVulkan(this, display, (xcb_connection_t*)xcbConn, defaultScreen,
|
m_gfxCtx.reset(new GraphicsContextXlibVulkan(this, display, (xcb_connection_t*)xcbConn, defaultScreen,
|
||||||
&g_VulkanContext, m_visualId, drawSamples));
|
&g_VulkanContext, m_visualId, glCtx));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
i = 0;
|
i = 0;
|
||||||
m_gfxCtx.reset(new GraphicsContextXlibGLX(IGraphicsContext::EGraphicsAPI::OpenGL3_3,
|
m_gfxCtx.reset(new GraphicsContextXlibGLX(IGraphicsContext::EGraphicsAPI::OpenGL3_3,
|
||||||
this, display, defaultScreen, lastCtx, m_visualId, drawSamples));
|
this, display, defaultScreen, lastCtx, m_visualId, glCtx));
|
||||||
m_openGL = true;
|
m_openGL = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2010,12 +2011,12 @@ public:
|
||||||
std::shared_ptr<IWindow> _WindowXlibNew(std::string_view title,
|
std::shared_ptr<IWindow> _WindowXlibNew(std::string_view title,
|
||||||
Display* display, void* xcbConn,
|
Display* display, void* xcbConn,
|
||||||
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
|
int defaultScreen, XIM xIM, XIMStyle bestInputStyle, XFontSet fontset,
|
||||||
GLXContext lastCtx, void* vulkanHandle, uint32_t drawSamples)
|
GLXContext lastCtx, void* vulkanHandle, GLContext* glCtx)
|
||||||
{
|
{
|
||||||
XLockDisplay(display);
|
XLockDisplay(display);
|
||||||
std::shared_ptr<IWindow> ret = std::make_shared<WindowXlib>(title, display, xcbConn,
|
std::shared_ptr<IWindow> ret = std::make_shared<WindowXlib>(title, display, xcbConn,
|
||||||
defaultScreen, xIM, bestInputStyle, fontset, lastCtx,
|
defaultScreen, xIM, bestInputStyle, fontset, lastCtx,
|
||||||
vulkanHandle, drawSamples);
|
vulkanHandle, glCtx);
|
||||||
XUnlockDisplay(display);
|
XUnlockDisplay(display);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -497,7 +497,7 @@ struct TestApplicationCallback : IApplicationCallback
|
||||||
|
|
||||||
int appMain(IApplication* app)
|
int appMain(IApplication* app)
|
||||||
{
|
{
|
||||||
mainWindow = app->newWindow(_S("YAY!"), 1);
|
mainWindow = app->newWindow(_S("YAY!"));
|
||||||
mainWindow->setCallback(&windowCallback);
|
mainWindow->setCallback(&windowCallback);
|
||||||
mainWindow->showWindow();
|
mainWindow->showWindow();
|
||||||
windowCallback.m_lastRect = mainWindow->getWindowFrame();
|
windowCallback.m_lastRect = mainWindow->getWindowFrame();
|
||||||
|
|
Loading…
Reference in New Issue