Skip to content

Rename/remove/redocument waitForGPU #32012

@greggman

Description

@greggman

Related issue: #31925 (comment)

Description

waitForGPU is a wrapper around onSubmittedWorkDone. You should never have to call onSubmittedWorkDone when using WebGPU. onSubmittedWorkDone is not for sychronization, it is for throttling. That's it. It is never used for synchronization. If calling it appears to fix a bug you have a different bug and the call is just hiding the actual bug.

Reproduction steps

grep for waitForGPU. See it's documented as "synchronize CPU operations with GPU tasks". This is FALSE!

Code

	/**
	 * Can be used to synchronize CPU operations with GPU tasks. So when this method is called,
	 * the CPU waits for the GPU to complete its operation (e.g. a compute task).
	 *
	 * @async
	 * @return {Promise} A Promise that resolves when synchronization has been finished.
	 */
	async waitForGPU() {

		await this.device.queue.onSubmittedWorkDone();

	}

Live example

N/A

Screenshots

N/A

Version

Top of Tree

Device

No response

Browser

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions