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.