Bug 1874684 - Part 17: Fix uninitialised variable warnings from clang-tidy. r=allstarschh
[gecko.git] / gfx / wgpu_bindings / wgpu.h
bloba744321d88a245d286e650854c253ba67d99bd9a
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef WGPU_h
8 #define WGPU_h
10 // We have to include nsString.h before wgpu_ffi_generated.h because the
11 // latter is wrapped in an extern "C" declaration but ends up including
12 // nsString.h (See bug 1784086)
13 #include "nsString.h"
14 #include "mozilla/UniquePtr.h"
16 // Prelude of types necessary before including wgpu_ffi_generated.h
17 namespace mozilla {
18 namespace ipc {
19 class ByteBuf;
20 } // namespace ipc
21 namespace webgpu {
22 namespace ffi {
24 #define WGPU_INLINE
25 #define WGPU_FUNC
27 extern "C" {
28 #include "mozilla/webgpu/ffi/wgpu_ffi_generated.h"
31 #undef WGPU_INLINE
32 #undef WGPU_FUNC
34 } // namespace ffi
36 inline ffi::WGPUByteBuf* ToFFI(ipc::ByteBuf* x) {
37 return reinterpret_cast<ffi::WGPUByteBuf*>(x);
39 inline const ffi::WGPUByteBuf* ToFFI(const ipc::ByteBuf* x) {
40 return reinterpret_cast<const ffi::WGPUByteBuf*>(x);
43 } // namespace webgpu
45 template <>
46 class DefaultDelete<webgpu::ffi::WGPUClient> {
47 public:
48 void operator()(webgpu::ffi::WGPUClient* aPtr) const {
49 webgpu::ffi::wgpu_client_delete(aPtr);
53 template <>
54 class DefaultDelete<webgpu::ffi::WGPUGlobal> {
55 public:
56 void operator()(webgpu::ffi::WGPUGlobal* aPtr) const {
57 webgpu::ffi::wgpu_server_delete(aPtr);
61 } // namespace mozilla
63 #endif // WGPU_h