refactored shader utils