Browse Source

WebGPURenderer: Refactor glslang import.

Mugen87 4 years ago
parent
commit
f9d120dc8e
1 changed files with 3 additions and 4 deletions
  1. 3 4
      examples/jsm/renderers/webgpu/WebGPURenderer.js

+ 3 - 4
examples/jsm/renderers/webgpu/WebGPURenderer.js

@@ -10,9 +10,10 @@ import WebGPUBindings from './WebGPUBindings.js';
 import WebGPURenderLists from './WebGPURenderLists.js';
 import WebGPURenderLists from './WebGPURenderLists.js';
 import WebGPUTextures from './WebGPUTextures.js';
 import WebGPUTextures from './WebGPUTextures.js';
 import WebGPUBackground from './WebGPUBackground.js';
 import WebGPUBackground from './WebGPUBackground.js';
-
 import WebGPUNodes from './nodes/WebGPUNodes.js';
 import WebGPUNodes from './nodes/WebGPUNodes.js';
 
 
+import glslang from '../../libs/glslang.js';
+
 import { Frustum, Matrix4, Vector3, Color } from '../../../../build/three.module.js';
 import { Frustum, Matrix4, Vector3, Color } from '../../../../build/three.module.js';
 
 
 console.info( 'THREE.WebGPURenderer: Modified Matrix4.makePerspective() and Matrix4.makeOrtographic() to work with WebGPU, see https://github.com/mrdoob/three.js/issues/20276.' );
 console.info( 'THREE.WebGPURenderer: Modified Matrix4.makePerspective() and Matrix4.makeOrtographic() to work with WebGPU, see https://github.com/mrdoob/three.js/issues/20276.' );
@@ -157,9 +158,7 @@ class WebGPURenderer {
 
 
 		const device = await adapter.requestDevice( deviceDescriptor );
 		const device = await adapter.requestDevice( deviceDescriptor );
 
 
-		// https://cdn.jsdelivr.net/npm/@webgpu/[email protected]/dist/web-devel/glslang.js
-		const glslang = await import( '../../libs/glslang.js' );
-		const compiler = await glslang.default();
+		const compiler = await glslang();
 
 
 		const context = ( parameters.context !== undefined ) ? parameters.context : this.domElement.getContext( 'gpupresent' );
 		const context = ( parameters.context !== undefined ) ? parameters.context : this.domElement.getContext( 'gpupresent' );