use custom es6 modularization instead of MODULARIZE=1
This commit is contained in:
parent
4391924ac5
commit
230117a02c
3 changed files with 42 additions and 11 deletions
26
glslang/OSDependent/Web/glslang.after.js
Normal file
26
glslang/OSDependent/Web/glslang.after.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
export default (() => {
|
||||
const initialize = () => {
|
||||
return new Promise(resolve => {
|
||||
Module({
|
||||
locateFile() {
|
||||
const i = import.meta.url.lastIndexOf('/')
|
||||
return import.meta.url.substring(0, i) + '/glslang.wasm';
|
||||
},
|
||||
onRuntimeInitialized() {
|
||||
resolve({
|
||||
compileGLSLZeroCopy: this.compileGLSLZeroCopy,
|
||||
compileGLSL: this.compileGLSL,
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
let instance;
|
||||
return () => {
|
||||
if (!instance) {
|
||||
instance = initialize();
|
||||
}
|
||||
return instance;
|
||||
};
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue