mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Add bounds check for shaders
This commit is contained in:
parent
8fb4668dfc
commit
c67e777271
1 changed files with 9 additions and 1 deletions
|
@ -138,7 +138,15 @@ namespace TEN::Renderer::Utils
|
|||
|
||||
void ShaderManager::Bind(Shader shader, bool forceNull)
|
||||
{
|
||||
const auto& shaderObj = _shaders[(int)shader];
|
||||
int shaderIndex = (int)shader;
|
||||
|
||||
if (shaderIndex >= _shaders.size())
|
||||
{
|
||||
TENLog("Attempt to access nonexistent shader with index " + std::to_string(shaderIndex), LogLevel::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& shaderObj = _shaders[shaderIndex];
|
||||
|
||||
if (shaderObj.Vertex.Shader != nullptr || forceNull)
|
||||
_context->VSSetShader(shaderObj.Vertex.Shader.Get(), nullptr, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue