Refactor #3938: Refactor Texture to decouple it from resources.