medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 679c8f028ec38c1a3e684bfa67c91fcee9138837
parent c463902a0cc268d385e577f420a1a22c86744de1
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Fri Nov  4 19:34:54 +0200

Check link status before binding uniform blocks

Diffstat:
renderer.cc | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/renderer.cc b/renderer.cc @@ -170,15 +170,6 @@ Shader renderer_new_shader( ShaderConfig config ) { glLinkProgram( program ); - const char * ubo_names[] = { "v_hot", "v_cold", "f_hot", "f_cold" }; - const u32 ubo_bindings[] = { UB_VS_HOT, UB_VS_COLD, UB_FS_HOT, UB_FS_COLD }; - for( size_t i = 0; i < ARRAY_COUNT( ubo_names ); i++ ) { - GLuint idx = glGetUniformBlockIndex( program, ubo_names[ i ] ); - if( idx != GL_INVALID_INDEX ) { - glUniformBlockBinding( program, idx, checked_cast< GLuint >( ubo_bindings[ i ] ) ); - } - } - glDeleteShader( vs ); glDeleteShader( fs ); if( gs != 0 ) { @@ -201,6 +192,15 @@ Shader renderer_new_shader( ShaderConfig config ) { FATAL( "%s", buf ); } + const char * ubo_names[] = { "v_hot", "v_cold", "f_hot", "f_cold" }; + const u32 ubo_bindings[] = { UB_VS_HOT, UB_VS_COLD, UB_FS_HOT, UB_FS_COLD }; + for( size_t i = 0; i < ARRAY_COUNT( ubo_names ); i++ ) { + GLuint idx = glGetUniformBlockIndex( program, ubo_names[ i ] ); + if( idx != GL_INVALID_INDEX ) { + glUniformBlockBinding( program, idx, checked_cast< GLuint >( ubo_bindings[ i ] ) ); + } + } + return checked_cast< Shader >( program ); }