OpenGL: Check if uniform block exists before updating it (#2581)

This commit is contained in:
Jannik Vogel 2017-02-18 20:46:26 +01:00 committed by Yuri Kunde Schlesner
parent 3a96dd023f
commit e594e63bb5

View file

@ -1071,8 +1071,8 @@ void RasterizerOpenGL::SetShader() {
current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get(); current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get();
unsigned int block_index = GLuint block_index = glGetUniformBlockIndex(current_shader->shader.handle, "shader_data");
glGetUniformBlockIndex(current_shader->shader.handle, "shader_data"); if (block_index != GL_INVALID_INDEX) {
GLint block_size; GLint block_size;
glGetActiveUniformBlockiv(current_shader->shader.handle, block_index, glGetActiveUniformBlockiv(current_shader->shader.handle, block_index,
GL_UNIFORM_BLOCK_DATA_SIZE, &block_size); GL_UNIFORM_BLOCK_DATA_SIZE, &block_size);
@ -1103,6 +1103,7 @@ void RasterizerOpenGL::SetShader() {
SyncFogColor(); SyncFogColor();
} }
}
} }
void RasterizerOpenGL::SyncCullMode() { void RasterizerOpenGL::SyncCullMode() {