From dd342d4be45625b970d0d2b0d5a13cd1cae23f5d Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Wed, 30 May 2018 00:50:50 +0500 Subject: [PATCH] Renderers: allow to fallback to stub shader if there's compilation errors --- src/Layers/xrRender/ShaderResourceTraits.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Layers/xrRender/ShaderResourceTraits.h b/src/Layers/xrRender/ShaderResourceTraits.h index a6019e8ff7b..732baa60e84 100644 --- a/src/Layers/xrRender/ShaderResourceTraits.h +++ b/src/Layers/xrRender/ShaderResourceTraits.h @@ -362,8 +362,12 @@ inline T* CResourceManager::CreateShader(const char* name, const bool searchForE // Try to open IReader* file = FS.r_open(cname); - if (!file && strstr(Core.Params, "-lack_of_shaders")) + bool fallback = strstr(Core.Params, "-lack_of_shaders"); + if (!file && fallback) { + fallback: + fallback = false; + string1024 tmp; xr_sprintf(tmp, "CreateShader: %s is missing. Replacing it with stub_default%s", cname, ShaderTypeTraits::GetShaderExt()); Msg(tmp); @@ -401,6 +405,9 @@ inline T* CResourceManager::CreateShader(const char* name, const bool searchForE VERIFY(SUCCEEDED(_hr)); + if (FAILED(_hr) && fallback) + goto fallback; + CHECK_OR_EXIT(!FAILED(_hr), "Your video card doesn't meet game requirements.\n\nTry to lower game settings."); return sh;