Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement changes to WebGPU timestamp-query #6001

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions src/platform/graphics/webgpu/webgpu-gpu-profiler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { DebugHelper } from "../../../core/debug.js";
import { GpuProfiler } from "../gpu-profiler.js";
import { WebgpuQuerySet } from "./webgpu-query-set.js";

Expand All @@ -21,47 +20,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;
Expand Down
5 changes: 1 addition & 4 deletions src/platform/graphics/webgpu/webgpu-graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
Expand Down