Better handling of texture state