import '../../../../../globals.js';
// Copyright 2024, University of Colorado Boulder
import { wgsl, WGSLStringModule } from '../../../imports.js';
/**
 * Converts premultiplied color to unpremultiplied color.
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
export default (vec4) => {
    return new WGSLStringModule('unpremultiply', wgsl `unpremultiply( ${vec4} )`, wgsl `
    fn unpremultiply( color: vec4f ) -> vec4f {
      // Max with a small epsilon to avoid NaNs
      let a_inv = 1.0 / max( color.a, 1e-6 );
    
      return vec4( color.rgb * a_inv, color.a );
    }
`);
};
//# sourceMappingURL=unpremultiplyWGSL.js.map