commit | 563fe25db020e87742d09b0a11db3ec423fa5285 | [log] [tgz] |
---|---|---|
author | Austin Eng <enga@chromium.org> | Sat Apr 27 16:46:49 2024 +0000 |
committer | Dawn LUCI CQ <dawn-scoped@luci-project-accounts.iam.gserviceaccount.com> | Sat Apr 27 16:46:49 2024 +0000 |
tree | 74cc73d332ba7d14f09233f53b4c7888d2194b77 | |
parent | 544321a458b5cbd1d803e7df76d8262e23068f5d [diff] |
cpp: allow casting C++ struct reference types to C types This is safe because the C++ layout is static_assert'ed to be the same as the C layout. It removes bad-looking reinterpret_cast from application code. Mutable reference casts are not allowed. This is because: - Some C++ structs have RAII objects in them. Casting to C and then changing the members could cause unexpected lifetime changes - Structs with "free members" functions only get const conversion operators. This is because output structs like this have RAII data which should not be mutated. The C structs do not have const-qualified members, so conversion to a mutable C struct would be unsafe. Bug: chromium:40195122 Change-Id: I18cd06b04da2ea34803f517e2b640ceaaba408af Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/185966 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Loko Kung <lokokung@google.com>
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.