proper selection of vulkan renderer

This commit is contained in:
niki
2022-07-10 03:46:12 +02:00
parent b1fb5b551e
commit 565455c3ea
3 changed files with 33 additions and 37 deletions
+9 -4
View File
@@ -109,16 +109,20 @@ namespace opengl { extern love::graphics::Graphics *createInstance(); }
#ifdef LOVE_GRAPHICS_METAL
namespace metal { extern love::graphics::Graphics *createInstance(); }
#endif
#ifdef LOVE_GRAPHICS_VULKAN
namespace vulkan { extern love::graphics::Graphics* createInstance(); }
#endif
static const Renderer rendererOrder[] = {
RENDERER_METAL,
RENDERER_VULKAN,
RENDERER_OPENGL,
};
static std::vector<Renderer> defaultRenderers =
{
RENDERER_METAL,
RENDERER_VULKAN,
RENDERER_OPENGL,
};
@@ -149,14 +153,14 @@ Graphics *Graphics::createInstance()
{
for (auto r : rendererOrder)
{
#ifdef LOVE_GRAPHICS_VULKAN
// FIX ME: proper selection of vulkan backend
instance = vulkan::createInstance();
#endif
if (std::find(_renderers.begin(), _renderers.end(), r) == _renderers.end())
continue;
#ifdef LOVE_GRAPHICS_VULKAN
if (r == RENDERER_VULKAN)
instance = vulkan::createInstance();
#endif
if (r == RENDERER_OPENGL)
instance = opengl::createInstance();
#ifdef LOVE_GRAPHICS_METAL
@@ -2554,6 +2558,7 @@ STRINGMAP_CLASS_END(Graphics, Graphics::StackType, Graphics::STACK_MAX_ENUM, sta
STRINGMAP_BEGIN(Renderer, RENDERER_MAX_ENUM, renderer)
{
{ "opengl", RENDERER_OPENGL },
{ "vulkan", RENDERER_VULKAN },
{ "metal", RENDERER_METAL },
}
STRINGMAP_END(Renderer, RENDERER_MAX_ENUM, renderer)