From 471170949999f38214e22cfa8d271782b6185a97 Mon Sep 17 00:00:00 2001 From: Erik Dubbelboer Date: Sat, 27 Jan 2024 08:38:53 +0100 Subject: [PATCH] Implement changes to WebGPU timestamp-query Remove call to GPURenderPassEncoder.writeTimestamp as it is not part of the spec anymore, and was removed by Chrome. It is also not needed anymore. The new interface, GPURenderPassDescriptor.timestampWrites was already implemented so nothing is needed there. --- .../graphics/webgpu/webgpu-gpu-profiler.js | 29 ------------------- .../graphics/webgpu/webgpu-graphics-device.js | 5 +--- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/platform/graphics/webgpu/webgpu-gpu-profiler.js b/src/platform/graphics/webgpu/webgpu-gpu-profiler.js index a4e01201e1f..50a84b908f2 100644 --- a/src/platform/graphics/webgpu/webgpu-gpu-profiler.js +++ b/src/platform/graphics/webgpu/webgpu-gpu-profiler.js @@ -21,47 +21,18 @@ class WebgpuGpuProfiler extends GpuProfiler { this.timestampQueriesSet = null; } - frameMarker(isStart) { - - if (this.timestampQueriesSet) { - - const suffix = isStart ? 'Start' : 'End'; - const commandEncoder = this.device.wgpu.createCommandEncoder(); - DebugHelper.setLabel(commandEncoder, `GPUTimestampEncoder-${suffix}`); - - this.frameGPUMarkerSlot = isStart ? this.getSlot('GpuFrame') : this.frameGPUMarkerSlot; - commandEncoder.writeTimestamp(this.timestampQueriesSet.querySet, this.frameGPUMarkerSlot * 2 + (isStart ? 0 : 1)); - - const cb = commandEncoder.finish(); - DebugHelper.setLabel(cb, `GPUTimestampEncoder-${suffix}-CommandBuffer`); - - this.device.addCommandBuffer(cb, isStart); - } - } - frameStart() { - this.processEnableRequest(); - - if (this._enabled) { - // initial timing marker - this.frameMarker(true); - } } frameEnd() { - if (this._enabled) { - // final timing marker - this.frameMarker(false); - // schedule command buffer where timestamps are copied to CPU this.timestampQueriesSet?.resolve(this.slotCount * 2); } } request() { - if (this._enabled) { // request results const renderVersion = this.device.renderVersion; diff --git a/src/platform/graphics/webgpu/webgpu-graphics-device.js b/src/platform/graphics/webgpu/webgpu-graphics-device.js index 9a9365f808e..a3d1ce99a0b 100644 --- a/src/platform/graphics/webgpu/webgpu-graphics-device.js +++ b/src/platform/graphics/webgpu/webgpu-graphics-device.js @@ -222,10 +222,7 @@ class WebgpuGraphicsDevice extends GraphicsDevice { this.extCompressedTextureS3TC = requireFeature('texture-compression-bc'); this.extCompressedTextureETC = requireFeature('texture-compression-etc2'); this.extCompressedTextureASTC = requireFeature('texture-compression-astc'); - - // Do not request timestamp feature as it has changed and current form is not supported. - // See engine issue #5989 - // this.supportsTimestampQuery = requireFeature('timestamp-query'); + this.supportsTimestampQuery = requireFeature('timestamp-query'); this.textureRG11B10Renderable = requireFeature('rg11b10ufloat-renderable'); Debug.log(`WEBGPU features: ${requiredFeatures.join(', ')}`);