File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -409,10 +409,27 @@ shader_ref(shader_t* it)
409409void
410410shader_unref (shader_t * it )
411411{
412+ struct uniform * uniform ;
413+
414+ iter_t iter ;
415+
412416 if (it == NULL || -- it -> refcount > 0 )
413417 return ;
414418
415419 console_log (3 , "disposing shader program #%u no longer in use" , it -> id );
420+
421+ iter = vector_enum (it -> uniforms );
422+ while ((uniform = iter_next (& iter ))) {
423+ switch (uniform -> type ) {
424+ case UNIFORM_FLOAT_ARR :
425+ free (uniform -> float_list );
426+ break ;
427+ case UNIFORM_INT_ARR :
428+ free (uniform -> int_list );
429+ break ;
430+ }
431+ }
432+
416433 al_destroy_shader (it -> program );
417434 vector_free (it -> uniforms );
418435 free (it );
@@ -831,8 +848,18 @@ free_cached_uniform(shader_t* shader, const char* name)
831848
832849 iter = vector_enum (shader -> uniforms );
833850 while ((uniform = iter_next (& iter ))) {
834- if (strcmp (uniform -> name , name ) == 0 )
851+ if (strcmp (uniform -> name , name ) == 0 ) {
852+ switch (uniform -> type ) {
853+ case UNIFORM_FLOAT_ARR :
854+ free (uniform -> float_list );
855+ break ;
856+ case UNIFORM_INT_ARR :
857+ free (uniform -> int_list );
858+ break ;
859+ }
860+
835861 iter_remove (& iter );
862+ }
836863 }
837864}
838865
You can’t perform that action at this time.
0 commit comments