header = """/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */"""
autogen_warning = """/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
 *
 * This file is generated based on the configuration in
 * `gfx/wgpu_bindings/moz.build`, which directs the build system module
 * `build/RunCbindgen.py` to run the following command at the top of
 * the object file directory:
 *
 *     $CBINDGEN $TOPSRCDIR --lockfile $TOPSRCDIR/Cargo.lock --crate wgpu_bindings --metadata config/cbindgen-metadata.json --cpp-compat > gfx/wgpu_bindings/wgpu_ffi_generated.h
 *
 * where:
 * - $TOPSRCDIR is the top of the Firefox source tree, and
 * - $CBINDGEN is the path to the cbindgen executable provided by mozbuild (the exact version often matters)
 */

#include "nsString.h"

struct WGPUByteBuf;
using WGPUNonZeroU64 = uint64_t;
using WGPUOption_BufferSize = uint64_t;
using WGPUOption_NonZeroU32 = uint32_t;
using WGPUOption_NonZeroU8 = uint8_t;
using WGPUOption_AdapterId = uint64_t;
using WGPUOption_BufferId = uint64_t;
using WGPUOption_PipelineLayoutId = uint64_t;
using WGPUOption_BindGroupId = uint64_t;
using WGPUOption_BindGroupLayoutId = uint64_t;
using WGPUOption_SamplerId = uint64_t;
using WGPUOption_SurfaceId = uint64_t;
using WGPUOption_TextureViewId = uint64_t;
using WGPUOption_ExternalTextureSourceId = uint64_t;
using WGPUOption_ExternalTextureId = uint64_t;
using WGPUOption_QuerySetId = uint64_t;
using WGPUOption_DeviceId = uint64_t;

using WGPUAdapterId = uint64_t;
using WGPUBindGroupId = uint64_t;
using WGPUBindGroupLayoutId = uint64_t;
using WGPUBufferId = uint64_t;
using WGPUCommandBufferId = uint64_t;
using WGPUCommandEncoderId = uint64_t;
using WGPURenderPassEncoderId = uint64_t;
using WGPUComputePassEncoderId = uint64_t;
using WGPURenderBundleEncoderId = uint64_t;
using WGPUComputePipelineId = uint64_t;
using WGPUDeviceId = uint64_t;
using WGPUFeaturesWebGPU = uint64_t;
using WGPUPipelineLayoutId = uint64_t;
using WGPUQuerySetId = uint64_t;
using WGPUQueueId = uint64_t;
using WGPURenderBundleId = uint64_t;
using WGPURenderPipelineId = uint64_t;
using WGPUSamplerId = uint64_t;
using WGPUShaderModuleId = uint64_t;
using WGPUStagingBufferId = uint64_t;
using WGPUSurfaceId = uint64_t;
using WGPUTextureId = uint64_t;
using WGPUTextureViewId = uint64_t;
using WGPUExternalTextureId = uint64_t;
using WGPUExternalTextureSourceId = uint64_t;

// This is a zero-sized type in wgpu's API, but cbindgen generates C++
// that leaves it as an incomplete type. Since WebGPU's GPULoadOp
// doesn't even have this variant (and probably never will, as its
// purpose is to allow behavior to vary freely per implementation), we
// can just give it a dummy definition that at least compiles.
struct WGPULoadOpDontCare {
    char dummy;
};
"""
include_version = true
braces = "SameLine"
line_length = 100
tab_width = 2
language = "C"
style = "tag"

[export]
prefix = "WGPU"
renaming_overrides_prefixing = true
exclude = [
	# NOTE: Bindings for macOS that `wgpu` creates manually.
	"dispatch_data_create",
	"dispatch_release",

	"LoadOpDontCare",
	"Option_AdapterId",
	"Option_BufferId",
	"Option_BindGroupId",
	"Option_PipelineLayoutId",
	"Option_BindGroupLayoutId",
	"Option_SamplerId",
	"Option_SurfaceId",
	"Option_TextureViewId",
	"Option_ExternalTextureSourceId",
	"Option_ExternalTextureId",
	"Option_BufferSize",
	"Option_NonZeroU32",
	"Option_NonZeroU8",
	"ANativeWindow_setBuffersGeometry",
	"Option_QuerySetId",
	"Option_DeviceId",
]
include = ["BufferUsages"]

[export.rename]
"nsString" = "nsString"
"nsCString" = "nsCString"
"nsAString" = "nsAString"
"nsACString" = "nsACString"
"nsStringRepr" = "nsString"
"BufferDescriptor______nsACString" = "WGPUBufferDescriptor"
"CommandBufferDescriptor______nsACString" = "WGPUCommandBufferDescriptor"
"CommandEncoderDescriptor______nsACString" = "WGPUCommandEncoderDescriptor"
"RenderBundleDescriptor______nsACString" = "WGPURenderBundleDescriptor"
"TextureDescriptor______nsACString__FfiSlice_TextureFormat" = "WGPUTextureDescriptor"
"ExternalTextureDescriptor______nsACString" = "WGPUExternalTextureDescriptor"
"SamplerDescriptor______nsACString" = "WGPUSamplerDescriptor"
"AdapterInformation_nsString" = "WGPUAdapterInformation"
"QuerySetDescriptor______nsACString" = "WGPUQuerySetDescriptor"

[parse]
parse_deps = true
include = ["naga-types", "wgpu-core", "wgpu-types", "wgpu-hal"]

extra_bindings = ["naga-types", "wgpu-core", "wgpu-types", "wgpu-hal"]

[fn]
prefix = "WGPU_INLINE"
postfix = "WGPU_FUNC"
args = "Vertical"
rename_args = "GeckoCase"

[struct]
derive_eq = true

[enum]
prefix_with_name = true
derive_helper_methods = true
add_sentinel = true

[macro_expansion]
bitflags = true

[defines]
"target_os = windows" = "XP_WIN"
"target_os = macos" = "XP_MACOSX"
"target_os = android" = "ANDROID"
"feature = id32" = "WGPU_FEATURE_ID32"
