From c7dec853de8899e1ad98a0758e2dd596cea265fa Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Sun, 5 May 2019 11:48:40 +0500 Subject: [PATCH] Don't crash if some shaders are missing Use DX10 path always and just return nullptr --- src/Layers/xrRender/ResourceManager.cpp | 26 ++++--------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/src/Layers/xrRender/ResourceManager.cpp b/src/Layers/xrRender/ResourceManager.cpp index 46288c098ec..8e6dee498b1 100644 --- a/src/Layers/xrRender/ResourceManager.cpp +++ b/src/Layers/xrRender/ResourceManager.cpp @@ -55,26 +55,14 @@ IBlender* CResourceManager::_GetBlender(LPCSTR Name) LPSTR N = LPSTR(Name); map_Blender::iterator I = m_blenders.find(N); -#ifdef _EDITOR - if (I == m_blenders.end()) - return 0; -#else -// TODO: DX10: When all shaders are ready switch to common path -#if defined(USE_DX10) || defined(USE_DX11) - if (I == m_blenders.end()) - { - Msg("DX10: Shader '%s' not found in library.", Name); - return 0; - } -#endif + if (I == m_blenders.end()) { - xrDebug::Fatal(DEBUG_INFO, "Shader '%s' not found in library.", Name); + Msg("! Shader '%s' not found in library.", Name); return nullptr; } -#endif - else - return I->second; + + return I->second; } IBlender* CResourceManager::_FindBlender(LPCSTR Name) @@ -274,16 +262,10 @@ Shader* CResourceManager::_cpp_Create(LPCSTR s_shader, LPCSTR s_textures, LPCSTR { if (!GEnv.isDedicatedServer) { -// TODO: DX10: When all shaders are ready switch to common path -#if defined(USE_DX10) || defined(USE_DX11) IBlender* pBlender = _GetBlender(s_shader ? s_shader : "null"); if (!pBlender) return nullptr; return _cpp_Create(pBlender, s_shader, s_textures, s_constants, s_matrices); -#else // USE_DX10 - return _cpp_Create(_GetBlender(s_shader ? s_shader : "null"), s_shader, s_textures, s_constants, s_matrices); -#endif // USE_DX10 - //#else } return nullptr; }