浏览代码

DefaultQueue

Sebastien Vandenberghe 5 年之前
父节点
当前提交
999d9b2de9
共有 2 个文件被更改,包括 10 次插入3 次删除
  1. 9 2
      src/Engines/webgpuEngine.ts
  2. 1 1
      src/LibDeclarations/webgpu.d.ts

+ 9 - 2
src/Engines/webgpuEngine.ts

@@ -61,6 +61,11 @@ export interface WebGPUEngineOptions extends GPURequestAdapterOptions {
     lockstepMaxSteps?: number;
 
     /**
+     * Defines the seconds between each deterministic lock step
+     */
+    timeStep?: number;
+
+    /**
      * Defines that engine should ignore modifying touch action attribute and style
      * If not handle, you might need to set it up on your side for expected touch devices behavior.
      */
@@ -218,6 +223,8 @@ export class WebGPUEngine extends Engine {
 
         this._deterministicLockstep = options.deterministicLockstep;
         this._lockstepMaxSteps = options.lockstepMaxSteps;
+        this._timeStep = options.timeStep || 1 / 60;
+
         this._doNotHandleContextLost = true;
 
         this._canvas = canvas;
@@ -1021,7 +1028,7 @@ export class WebGPUEngine extends Engine {
             commandEncoder.copyBufferToTexture(bufferView, textureView, textureExtent);
         }
 
-        this._device.getQueue().submit([commandEncoder.finish()]);
+        this._device.defaultQueue.submit([commandEncoder.finish()]);
 
         this._releaseBuffer(dataBuffer);
     }
@@ -1439,7 +1446,7 @@ export class WebGPUEngine extends Engine {
         this._commandBuffers[0] = this._uploadEncoder.finish();
         this._commandBuffers[1] = this._renderEncoder.finish();
 
-        this._device.getQueue().submit(this._commandBuffers);
+        this._device.defaultQueue.submit(this._commandBuffers);
 
         super.endFrame();
     }

+ 1 - 1
src/LibDeclarations/webgpu.d.ts

@@ -634,7 +634,7 @@ class GPUDevice extends EventTarget implements GPUObjectBase {
     descriptor: GPURenderBundleEncoderDescriptor
   ): GPURenderBundleEncoder;
 
-  getQueue(): GPUQueue;
+  defaultQueue: GPUQueue;
 
   pushErrorScope(filter: GPUErrorFilter): void;
   popErrorScope(): Promise<GPUError | null>;