From f9d120dc8ea9af07416c71455be73af07733af79 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Tue, 26 Jan 2021 12:48:27 +0100 Subject: [PATCH 1/2] WebGPURenderer: Refactor glslang import. --- examples/jsm/renderers/webgpu/WebGPURenderer.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/jsm/renderers/webgpu/WebGPURenderer.js b/examples/jsm/renderers/webgpu/WebGPURenderer.js index 2fdb67096810e0..7df31df6d3919e 100644 --- a/examples/jsm/renderers/webgpu/WebGPURenderer.js +++ b/examples/jsm/renderers/webgpu/WebGPURenderer.js @@ -10,9 +10,10 @@ import WebGPUBindings from './WebGPUBindings.js'; import WebGPURenderLists from './WebGPURenderLists.js'; import WebGPUTextures from './WebGPUTextures.js'; import WebGPUBackground from './WebGPUBackground.js'; - import WebGPUNodes from './nodes/WebGPUNodes.js'; +import glslang from '../../libs/glslang.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.' ); @@ -157,9 +158,7 @@ class WebGPURenderer { const device = await adapter.requestDevice( deviceDescriptor ); - // https://cdn.jsdelivr.net/npm/@webgpu/glslang@0.0.15/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' ); From ca306c07511a63a257d07f505e6a0a7ef4dbc5a6 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Tue, 26 Jan 2021 12:51:00 +0100 Subject: [PATCH 2/2] Add version to glslang. --- examples/jsm/libs/glslang.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/jsm/libs/glslang.js b/examples/jsm/libs/glslang.js index 21bd32eafa285c..09a93bf23f4287 100644 --- a/examples/jsm/libs/glslang.js +++ b/examples/jsm/libs/glslang.js @@ -1,7 +1,7 @@ - +// 0.0.15 var Module = (function() { var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; - + return ( function(Module) { Module = Module || {};