From 051164a0912f61b853b4fbc5a93e3c5cd6f1fd26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 17 Feb 2016 10:06:47 -0800 Subject: [PATCH] Bail out if only one renderer is present, but fails to initialize. --- src/bgfx.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/bgfx.cpp b/src/bgfx.cpp index e16d4f71c..070f2f462 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -1721,6 +1721,8 @@ namespace bgfx RendererContextI* rendererCreate(RendererType::Enum _type) { + RendererType::Enum last = RendererType::Count; + if (RendererType::Count == _type) { again: @@ -1823,14 +1825,17 @@ again: } RendererContextI* renderCtx = s_rendererCreator[_type].createFn(); - - if (NULL == renderCtx) + if (last != _type) { - s_rendererCreator[_type].supported = false; - goto again; - } + if (NULL == renderCtx) + { + s_rendererCreator[_type].supported = false; + last = _type; + goto again; + } - s_rendererDestroyFn = s_rendererCreator[_type].destroyFn; + s_rendererDestroyFn = s_rendererCreator[_type].destroyFn; + } return renderCtx; }