CMake-only fork of https://dawn.googlesource.com/dawn with cleaned, vendored dependencies
Go to file
Sunny Sachanandani 7ae5c41412 d3d12: Destroy ExternalImageDXGI resources on device destruction
D3D12 objects can have implicit dependencies on device resources that
are not captured by holding ComPtrs:

"Direct3D 12 uses COM-style reference counting only for the lifetimes of
interfaces (by using the weak reference model of Direct3D tied to the
lifetime of the device). All resource and description memory lifetimes
are the sole responsibly of the app to maintain for the proper duration,
and are not reference counted. Direct3D 11 uses reference counting to
manage the lifetimes of interface dependencies as well."

Source: https://docs.microsoft.com/en-us/windows/win32/direct3d12/important-changes-from-directx-11-to-directx-12

ExternalImageDXGI can outlive the device it was created on e.g. the D3D
shared image backing holds on to the ExternalImageDXGI for its lifetime.
ExternalImageDXGI destructor can invoke code that depends on D3D12
resources that might have already been destroyed. In particular, this
shows up as ComPtr::Release for ID3D12Fence crashing mysteriously, and
is also speculated as the cause for a racy invalid function pointer
dereference in crbug.com/1338470.

This CL makes the D3D12 backend device destroy the ExternalImageDXGI's
resources on device destruction making it effectively a weak pointer.
This unblocks landing https://crrev.com/c/3700811 and hopefully fixes
crbug.com/1338470 as well.

This CL also deprecates unnecessary WGPUDevice param to ProduceTexture,
and adds an IsValid() method so that the shared image can check it and
decide to recreate the ExternalImageDXGI if needed.

Bug: dawn:576, chromium:1338470
Change-Id: I2122cf807587cf3b1218ba29ea291263df0cf698
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95860
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
2022-07-13 11:33:51 +00:00
.vscode .vscode/tasks.json - Add 'cmake gen' 2022-04-07 19:22:21 +00:00
build_overrides GN: Wayland build overrides 2022-06-27 15:17:34 +00:00
docs tint: Remove semicolon as struct member delimeter 2022-07-04 16:58:00 +00:00
generator api_cpp.h: Fix alignas declaration following ChainedStruct. 2022-06-29 17:37:41 +00:00
include d3d12: Destroy ExternalImageDXGI resources on device destruction 2022-07-13 11:33:51 +00:00
infra set $build/goma["use_luci_auth"] = True 2022-06-29 10:30:06 +00:00
scripts Add alternative method to use a version/git hash from a file. 2022-06-22 04:19:43 +00:00
src d3d12: Destroy ExternalImageDXGI resources on device destruction 2022-07-13 11:33:51 +00:00
test tint: Fix SPIR-V validation around interpolation decorations 2022-07-12 19:10:39 +00:00
third_party Roll third_party/webgpu-cts/ 7334f06d2..6c0f3bab4 (11 commits) 2022-07-05 21:20:42 +00:00
tools tools/cts: Fix go unit tests 2022-07-08 14:23:15 +00:00
webgpu-cts Roll third_party/webgpu-cts/ 5de908c54..8cfc317e2 (1 commit) 2022-07-06 18:01:40 +00:00
.clang-format Add InsertBraces: true to .clang-format 2022-05-19 20:08:19 +00:00
.clang-tidy Update some forward declarations. 2022-05-30 18:00:58 +00:00
.gitattributes Pipeline cache D3D12 backend impl 2022-06-02 15:16:20 +00:00
.gitignore Remove third_party/gpuweb-cts 2022-05-19 13:07:49 +00:00
.gn Roll third_party/angle/ 52c42e5a8..4aa0975e6 (35 commits) 2022-05-25 16:06:54 +00:00
AUTHORS Merge remote-tracking branch 'tint/main' into HEAD 2022-04-06 15:37:27 -04:00
BUILD.gn Remove old src/include folder 2022-06-18 16:16:11 +00:00
CMakeLists.txt GL: implement EGL context creation in Dawn native. 2022-06-29 15:29:41 +00:00
CMakeSettings.json Normalize all line endings to LF 2022-04-08 14:18:28 +00:00
CODE_OF_CONDUCT.md Initial commit 2020-03-02 15:47:43 -05:00
CONTRIBUTING.md Combine contributing files. 2022-04-10 22:14:00 +00:00
CPPLINT.cfg Fixup CQ and Kokoro lint mismatches. 2022-04-13 16:14:26 +00:00
DEPS Roll vulkan-deps from 136497f1126c to 50b3fdf7ad7d (2 revisions) 2022-07-13 10:10:30 +00:00
DIR_METADATA Move metadata in OWNERS files to DIR_METADATA files 2021-02-04 01:26:43 +00:00
Doxyfile tint: Re-enable doxygen 2022-04-11 22:27:34 +00:00
LICENSE Fix google3 license related issues 2021-12-02 21:25:58 +00:00
OWNERS Add bclayton's chromium account to OWNERS 2022-06-16 09:57:41 +00:00
PRESUBMIT.py Consistent formatting for Dawn/Tint. 2022-05-01 14:40:55 +00:00
README.chromium Add component to OWNERS and fixup repo URL in README.chromium 2018-09-25 20:53:37 +00:00
README.md Cleanup duplicate files; Combine README and build docs. 2022-04-28 16:25:43 +00:00
codereview.settings codereview.setings: default to not squashing on git cl upload 2021-03-10 18:35:58 +00:00
dawn.json Add clear alpha to one step to copy texture for browser 2022-07-11 18:11:14 +00:00
dawn_wire.json Add reflection APIs for wgpu::QuerySet. 2022-06-09 10:12:13 +00:00
go.mod tools: Add the 'cts export' sub-command 2022-05-02 20:44:21 +00:00
go.sum tools: Add the 'cts export' sub-command 2022-05-02 20:44:21 +00:00
tint_overrides_with_defaults.gni Move tint unittest behind a build flag. 2022-06-22 12:40:43 +00:00

README.md

Dawn's logo: a sun rising behind a stylized mountain inspired by the WebGPU logo. The text "Dawn" is written below it.

Dawn, a WebGPU implementation

Dawn is an open-source and cross-platform implementation of the work-in-progress 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 C/C++ headers that applications and other building blocks use.
    • The webgpu.h version that Dawn implements.
    • A C++ wrapper for the webgpu.h.
  • A "native" implementation of WebGPU using platforms' GPU APIs:
    • D3D12 on Windows 10
    • Metal on macOS and iOS
    • Vulkan on Windows, Linux, ChromeOS, Android and Fuchsia
    • OpenGL as best effort where available
  • A client-server implementation of WebGPU for applications that are in a sandbox without access to native drivers
  • Tint is a compiler for the WebGPU Shader Language (WGSL).

Helpful links:

Documentation table of content

Developer documentation:

User documentation: (TODO, figure out what overlaps with the webgpu.h docs)

Status

(TODO)

License

Apache 2.0 Public License, please see LICENSE.

Disclaimer

This is not an officially supported Google product.