D3D11: Implement automatic backend buffer mapping This CL introduces a new device toggle "auto_map_backend_buffer" that enables automatic buffer mapping management in the D3D11 backend. When enabled, the backend maintains buffers in a mapped state whenever possible, allowing the frontend's MapAsync and Unmap operations to become lightweight operations that only update buffer state without acquiring backend locks such as the D3D11 device context lock. Implementation: - Backend automatically maps buffers when they are not in use by the GPU - Before GPU usage, TrackUsage() automatically unmaps buffers - After GPU operations complete, the queue automatically re-maps buffers via scheduled mapping operations - Frontend's MapAsync and Unmap operations become cheap state-only updates that do not interact with the D3D11 device context. Key components: - Buffer::TryMapNow(): Performs actual D3D11 mapping after GPU usage completes - Queue::ScheduleBufferMapping(): Schedules buffer for re-mapping after queue submission - Queue::CheckScheduledBufferMappings(): Processes and executes scheduled buffer mappings - mAutoMapMode: Stores the computed map mode (Read/Write/Both) per buffer based on usage flags Benefits: This optimization eliminates lock contention between the frontend's frequent MapAsync/Unmap calls and the backend's Queue::Submit operations. By centralizing all D3D11 mapping operations within the Queue's execution context, the frontend no longer needs to acquire the D3D11 device context lock during map/unmap operations, significantly reducing synchronization overhead. Bug: 481158754 Change-Id: If8ebcad133c73db4b0b5b65d56b19cf63c22d362 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/286675 Commit-Queue: Quyen Le <lehoangquyen@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Dawn is an open-source and cross-platform implementation of the WebGPU standard. More precisely it implements webgpu.h that is a one-to-one mapping with the WebGPU IDL. Dawn is meant to be integrated as part of a larger system and is the underlying implementation of WebGPU in Chromium.
Dawn provides several WebGPU building blocks:
webgpu.h version that Dawn implements.webgpu.h.Helpful links:
Developer documentation:
User documentation: (TODO, figure out what overlaps with the webgpu.h docs)
BSD 3-Clause License, please see LICENSE.
This is not an officially supported Google product.