Przeglądaj źródła

Merge pull request #9515 from Popov72/webgpu-add-issupported

Add IsSupported getter to WebGPUEngine
David Catuhe 4 lat temu
rodzic
commit
e00943079b
1 zmienionych plików z 8 dodań i 0 usunięć
  1. 8 0
      src/Engines/webgpuEngine.ts

+ 8 - 0
src/Engines/webgpuEngine.ts

@@ -229,6 +229,14 @@ export class WebGPUEngine extends Engine {
     public dbgShowWarningsNotImplemented = false;
 
     /**
+     * Gets a boolean indicating if the engine can be instanciated (ie. if a WebGPU context can be found)
+     * @returns true if the engine can be created
+     */
+    public static get IsSupported(): boolean {
+        return !!navigator.gpu;
+    }
+
+    /**
      * Gets a boolean indicating that the engine supports uniform buffers
      */
     public get supportsUniformBuffers(): boolean {