void GlslManager::delete_sync(GLsync sync)
{
	// We do not know which thread we are called from, and we can only
	// delete this if we are in one with a valid OpenGL context.
	// Thus, store it for later deletion in render_frame_texture().
	GlslManager* g = GlslManager::get_instance();
	g->lock();
	g->syncs_to_delete.push_back(sync);
	g->unlock();
}
void GlslManager::release_texture(glsl_texture texture)
{
#if USE_TEXTURE_POOL
	texture->used = 0;
#else
	GlslManager* g = GlslManager::get_instance();
	g->lock();
	g->texture_list.push_back(texture);
	g->unlock();
#endif
}