From c9436765b4273b80278d4aa571a33d796a950621 Mon Sep 17 00:00:00 2001 From: halx99 Date: Tue, 18 Jul 2023 15:16:29 +0800 Subject: [PATCH] FIx GL error --- core/renderer/backend/opengl/ProgramGL.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/renderer/backend/opengl/ProgramGL.cpp b/core/renderer/backend/opengl/ProgramGL.cpp index 265c43b071..ec88a0fc47 100644 --- a/core/renderer/backend/opengl/ProgramGL.cpp +++ b/core/renderer/backend/opengl/ProgramGL.cpp @@ -431,6 +431,11 @@ void UniformBlockDescriptor::bindUniformBlock(GLint _program, UniformBlockStage const char* blockName = stage == UniformBlockStage::VERTEX ? "vs_ub" : "fs_ub"; blockIndex = glGetUniformBlockIndex(_program, blockName); + if (blockIndex == GL_INVALID_INDEX) + { + stage = UniformBlockStage::UBO_NOT_FOUND; + return; + } bindingPoint = (GLint)stage - 1; glUniformBlockBinding(_program, blockIndex, bindingPoint);