Skip to content

Commit dd342d4

Browse files
committed
Renderers: allow to fallback to stub shader if there's compilation errors
1 parent e061f14 commit dd342d4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Layers/xrRender/ShaderResourceTraits.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,12 @@ inline T* CResourceManager::CreateShader(const char* name, const bool searchForE
362362

363363
// Try to open
364364
IReader* file = FS.r_open(cname);
365-
if (!file && strstr(Core.Params, "-lack_of_shaders"))
365+
bool fallback = strstr(Core.Params, "-lack_of_shaders");
366+
if (!file && fallback)
366367
{
368+
fallback:
369+
fallback = false;
370+
367371
string1024 tmp;
368372
xr_sprintf(tmp, "CreateShader: %s is missing. Replacing it with stub_default%s", cname, ShaderTypeTraits<T>::GetShaderExt());
369373
Msg(tmp);
@@ -401,6 +405,9 @@ inline T* CResourceManager::CreateShader(const char* name, const bool searchForE
401405

402406
VERIFY(SUCCEEDED(_hr));
403407

408+
if (FAILED(_hr) && fallback)
409+
goto fallback;
410+
404411
CHECK_OR_EXIT(!FAILED(_hr), "Your video card doesn't meet game requirements.\n\nTry to lower game settings.");
405412

406413
return sh;

0 commit comments

Comments
 (0)