Currently there is no mechanism to "unregister" a texture for each shader using it, when deleting the texture. The texture could keep a record of all programs it has been used in. Or we could look at all programs when deleting. Or in PBRDemo we reset the textures when setting a scene.