Fix issue 5393

Save the bound texture unit so that the sampler can be updated dynamically.