import EventEmitter from "eventemitter3" ; export { EventEmitter } ; let glslangModule = null ; /**
 * Load the glslang module
 */ export async function LoadGLSLang ( ) { if ( glslangModule !== null ) return glslangModule ; const module = await ( window [ "eval" ] ) ( `import("https://unpkg.com/@webgpu/glslang@0.0.15/dist/web-devel/glslang.js")` ) ; glslangModule = await module . default ( ) ; return glslangModule ; } param glsl param type export function CompileGLSL ( glsl , type ) { return glslangModule . compileGLSL ( glsl , type ) ; } let uid = 0 ; /**
 * Returns a unique id
 */ export function GetUniqueId ( ) { return uid ++ ; } param path export function FetchText ( path ) { return new Promise ( resolve => { fetch ( path ) . then ( resp => resp . text ( ) . then ( resolve ) ) ; } ) ; } param args export function Log ( ... args ) { console . log ( ... args ) ; } param args export function Warn ( ... args ) { console . warn ( ... args ) ; } param args export function Error ( ... args ) { console . error ( ... args ) ; } /**
 * Throws an unrachable error
 */ export function Unreachable ( ) { throw new ReferenceError ( `Unreachable code hit` ) ; } param str export function GetStringHash ( str ) { let hash = 0 ; for ( let ii = 0 ; ii < str . length ; ++ ii ) { hash = ( ( hash << 5 ) - hash + str . charCodeAt ( ii ) ) << 0 ; } return hash ; } /**
 * Returns a high-resolution timestamp
 */ export function GetTimeStamp ( ) { return ( performance as any ) . now ( ) ; } param value param range export function FixateToZero ( value , range ) { if ( value > 0 && value <= range ) return 0.0 ; if ( value < 0 && value >= - range ) return 0.0 ; return value ; } param value param min param max export function Clamp ( value , min , max ) { return Math . max ( Math . min ( max , value ) , min ) ; }