diff --git a/examples/jsm/capabilities/WebGPU.js b/examples/jsm/capabilities/WebGPU.js index 53397f44f5cc4a..27bad1b4439baf 100644 --- a/examples/jsm/capabilities/WebGPU.js +++ b/examples/jsm/capabilities/WebGPU.js @@ -6,14 +6,7 @@ if ( self.GPUShaderStage === undefined ) { // statics -let isAvailable = navigator.gpu !== undefined; - - -if ( typeof window !== 'undefined' && isAvailable ) { - - isAvailable = await navigator.gpu.requestAdapter(); - -} +const isAvailable = navigator.gpu !== undefined; class WebGPU { @@ -23,9 +16,15 @@ class WebGPU { } - static getStaticAdapter() { + static async getStaticAdapter() { + + if ( typeof window !== 'undefined' && isAvailable ) { + + return await navigator.gpu.requestAdapter(); + + } - return isAvailable; + return false; }