Skip to content

Commit

Permalink
If shader doesn't exist, put an error in the console, don't hard crash
Browse files Browse the repository at this point in the history
  • Loading branch information
HumanGamer committed Mar 30, 2024
1 parent e1989a9 commit e83e4a1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions engine/source/materials/shaderData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,22 @@ bool ShaderData::initShader()
pixelShaderPath = fullFilename2;
}

bool valid = true;
if (vtexShaderPath != NULL && !ResourceManager->find(vtexShaderPath))
{
Con::errorf("ShaderData::initShader - Could not find vertex shader file: %s", vtexShaderPath);
valid = false;
}

if (pixelShaderPath != NULL && !ResourceManager->find(pixelShaderPath))
{
Con::errorf("ShaderData::initShader - Could not find pixel shader file: %s", pixelShaderPath);
valid = false;
}

if (!valid)
return false;

shader = GFX->createShader( (char*)vtexShaderPath,
(char*)pixelShaderPath,
pixver );
Expand Down

0 comments on commit e83e4a1

Please sign in to comment.