Now try Metal, Vulkan and then finally Dummy in that order
This only applies to the SDL backend though, this will be expanded upon though.
This commit is contained in:
parent
ca57de8f99
commit
138cbf3f4b
1 changed files with 22 additions and 4 deletions
|
@ -16,6 +16,8 @@
|
|||
#include "gfx_metal.hpp"
|
||||
#endif
|
||||
|
||||
#include "gfx_dummy.hpp"
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#include <winrt/Windows.UI.ViewManagement.h>
|
||||
#pragma comment(lib, "windowsapp")
|
||||
|
@ -391,17 +393,33 @@ void* platform::get_next_image(window_ptr window) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
template<class GFXBackend>
|
||||
void try_initialize() {
|
||||
if(gfx_interface == nullptr) {
|
||||
auto backend = new GFXBackend();
|
||||
const bool supported = backend->is_supported();
|
||||
if(!supported) {
|
||||
prism::log("Failed to initialize GFX backend... trying next...");
|
||||
} else {
|
||||
gfx_interface = backend;
|
||||
platform::initialize_context(gfx_interface->required_context());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
|
||||
|
||||
// determine gfx context at the beginning
|
||||
#ifdef ENABLE_METAL
|
||||
gfx_interface = new GFXMetal();
|
||||
#else
|
||||
gfx_interface = new GFXVulkan();
|
||||
try_initialize<GFXMetal>();
|
||||
#endif
|
||||
|
||||
platform::initialize_context(gfx_interface->required_context());
|
||||
#ifdef ENABLE_VULKAN
|
||||
try_initialize<GFXVulkan>();
|
||||
#endif
|
||||
|
||||
try_initialize<GFXDummy>();
|
||||
|
||||
engine = new prism::engine(argc, argv);
|
||||
|
||||
|
|
Reference in a new issue