Skip to content

Commit

Permalink
Renderers: allow to fallback to stub shader if there's compilation er…
Browse files Browse the repository at this point in the history
…rors
  • Loading branch information
Xottab-DUTY committed May 29, 2018
1 parent e061f14 commit dd342d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Layers/xrRender/ShaderResourceTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>::GetShaderExt());
Msg(tmp);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit dd342d4

Please sign in to comment.