summaryrefslogtreecommitdiffstats
path: root/Common
diff options
context:
space:
mode:
authorEgor <egor.yusov@gmail.com>2019-10-28 00:46:48 +0000
committerEgor <egor.yusov@gmail.com>2019-10-28 00:46:48 +0000
commitcf0268d40bbe5cf9be97d64bc4f90661705ac91f (patch)
tree12bb74169e992a0e4ddaabcdcc0899648392bcc2 /Common
parentFixed tabs in UWP app source (diff)
downloadDiligentEngine-cf0268d40bbe5cf9be97d64bc4f90661705ac91f.tar.gz
DiligentEngine-cf0268d40bbe5cf9be97d64bc4f90661705ac91f.zip
LinuxApp: attempting to initialize in OpenGL mode if Vulkan fails
Diffstat (limited to 'Common')
-rw-r--r--Common/NativeApp/include/Linux/LinuxAppBase.h2
-rw-r--r--Common/NativeApp/src/Linux/LinuxMain.cpp13
2 files changed, 12 insertions, 3 deletions
diff --git a/Common/NativeApp/include/Linux/LinuxAppBase.h b/Common/NativeApp/include/Linux/LinuxAppBase.h
index 83065d1..e4c6a3e 100644
--- a/Common/NativeApp/include/Linux/LinuxAppBase.h
+++ b/Common/NativeApp/include/Linux/LinuxAppBase.h
@@ -54,7 +54,7 @@ public:
virtual int HandleXEvent(XEvent* xev){}
#if VULKAN_SUPPORTED
- virtual void InitVulkan(xcb_connection_t* connection, uint32_t window) = 0;
+ virtual bool InitVulkan(xcb_connection_t* connection, uint32_t window) = 0;
virtual void HandleXCBEvent(xcb_generic_event_t* event){}
#endif
};
diff --git a/Common/NativeApp/src/Linux/LinuxMain.cpp b/Common/NativeApp/src/Linux/LinuxMain.cpp
index 93a3235..fc26c8a 100644
--- a/Common/NativeApp/src/Linux/LinuxMain.cpp
+++ b/Common/NativeApp/src/Linux/LinuxMain.cpp
@@ -214,7 +214,8 @@ int xcb_main()
std::string Title = TheApp->GetAppTitle();
auto xcbInfo = InitXCBConnectionAndWindow(Title);
- TheApp->InitVulkan(xcbInfo.connection, xcbInfo.window);
+ if(!TheApp->InitVulkan(xcbInfo.connection, xcbInfo.window))
+ return -1;
xcb_flush(xcbInfo.connection);
@@ -509,7 +510,15 @@ int main (int argc, char ** argv)
if (UseVulkan)
{
- return xcb_main();
+ auto ret = xcb_main();
+ if (ret >= 0)
+ {
+ return ret;
+ }
+ else
+ {
+ LOG_ERROR_MESSAGE("Failed to initialize the engine in Vulkan mode. Attempting to use OpenGL");
+ }
}
#endif