From 1b7b80d5bb7a9afe09ae28d6c00bbceb4c679635 Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Wed, 30 Sep 2026 22:41:00 -0400 Subject: [PATCH 1/8] Generate Cython declarations of Dawn's webgpu.h in the codegen
Claude's draft Vendor Dawn's webgpu.h (v20260929.200159, from the conda package) as wgpu/resources/dawn_webgpu.h and extend the codegen to generate, from it: * backends/dawn/_webgpu.pxd: the complete Cython declaration of the C API (handles, enums, flags, structs, callbacks, 276 functions, constants and the WGPU_*_INIT struct initializers), parsed with pycparser after the same cleaning step that is used for the wgpu-native headers. It also contains generated helpers to convert WGPULimits from/to a dict. * backends/dawn/_mappings.py: enum string <-> int maps for Dawn. webgpu.h is used rather than dawn.json because it is what the conda package ships, it is the exact ABI that is compiled against, and the existing hparser already digests it. The codegen also checks the Cython backend (_api.pyx) against the base API and lists methods that are not implemented in the report. Resume this Claude session: ``` cd /home/mark/git/feedstock/staged-recipes claude --resume 2cab6db9-a6ea-4976-a0e6-f4153fe5a651 ```
Claude-Session: https://claude.ai/code/session_01QMLpZTQYYCu2K7EaWNnkEG --- codegen/__init__.py | 19 + codegen/apipatcher.py | 38 + codegen/dawn_patcher.py | 422 +++ codegen/files.py | 3 + codegen/hparser.py | 48 +- wgpu/backends/dawn/_mappings.py | 655 ++++ wgpu/backends/dawn/_webgpu.pxd | 2908 +++++++++++++++++ wgpu/resources/codegen_report.md | 11 + wgpu/resources/dawn_webgpu.h | 5118 ++++++++++++++++++++++++++++++ 9 files changed, 9214 insertions(+), 8 deletions(-) create mode 100644 codegen/dawn_patcher.py create mode 100644 wgpu/backends/dawn/_mappings.py create mode 100644 wgpu/backends/dawn/_webgpu.pxd create mode 100644 wgpu/resources/dawn_webgpu.h diff --git a/codegen/__init__.py b/codegen/__init__.py index d194bc4ef..b8b84d4b2 100644 --- a/codegen/__init__.py +++ b/codegen/__init__.py @@ -2,6 +2,7 @@ from .utils import print, PrintToFile from . import apiwriter, apipatcher, wgpu_native_patcher, idlparser, hparser +from . import dawn_patcher from .files import file_cache @@ -15,6 +16,7 @@ def main(): prepare() update_api() update_wgpu_native() + update_dawn() file_cache.write("resources/codegen_report.md", log.getvalue()) @@ -24,6 +26,7 @@ def prepare(): file_cache.reset() idlparser.get_idl_parser(allow_cache=False) hparser.get_h_parser(allow_cache=False) + hparser.get_dawn_h_parser(allow_cache=False) def update_api(): @@ -63,3 +66,19 @@ def update_wgpu_native(): code1 = file_cache.read("backends/wgpu_native/_api.py") code2 = wgpu_native_patcher.patch_wgpu_native_backend(code1) file_cache.write("backends/wgpu_native/_api.py", code2) + + +def update_dawn(): + """Update and check the Dawn backend.""" + + print("## Validating backends/dawn") + + dawn_patcher.compare_flags() + dawn_patcher.write_dawn_mappings() + dawn_patcher.write_dawn_pxd() + + # Check the API of the Cython backend against the base API (report only) + code = file_cache.read("backends/dawn/_api.pyx") + print("### Checking API for backends/dawn/_api.pyx") + code = apipatcher.check_backend_api(code) + file_cache.write("backends/dawn/_api.pyx", code) diff --git a/codegen/apipatcher.py b/codegen/apipatcher.py index c88286ee9..dc6afe8d1 100644 --- a/codegen/apipatcher.py +++ b/codegen/apipatcher.py @@ -77,6 +77,44 @@ def patch_backend_api(code): return code +def check_backend_api(code): + """Check a (Cython) backend against the base API, without modifying it. + + Cython code cannot be formatted/patched like the Python backends, so + instead we report the classes and methods that are not (yet) implemented. + Methods that are not implemented raise NotImplementedError via the base class. + """ + base_api_code = file_cache.read("_classes.py") + reference = BackendApiPatcher(base_api_code) + + # Collect classes and methods with a simple line-based scan + implemented = {} + current = None + for line in code.splitlines(): + if line.startswith("class "): + current = line[6:].split("(")[0].split(":")[0].strip() + implemented[current] = set() + elif line and not line[0].isspace() and not line.startswith(("#", "@", ")")): + current = None + elif current and line.startswith((" def ", " async def ")): + name = line.split("def ", 1)[1].split("(")[0].strip() + implemented[current].add(name) + + n_missing = 0 + for classname in reference.get_class_names(): + required = reference.get_required_method_names(classname) + if classname not in implemented: + if required: + print(f"Missing class {classname}") + continue + missing = [m for m in required if m not in implemented[classname]] + for m in missing: + n_missing += 1 + print(f"Not implemented: {classname}.{m}") + print(f"Found {len(implemented)} classes, {n_missing} methods not implemented") + return code + + class CommentRemover(Patcher): """A patcher that removes comments that we add in other parsers, to prevent accumulating comments. diff --git a/codegen/dawn_patcher.py b/codegen/dawn_patcher.py new file mode 100644 index 000000000..ec7fb4956 --- /dev/null +++ b/codegen/dawn_patcher.py @@ -0,0 +1,422 @@ +""" +Codegen for the Dawn backend. + +Dawn's ``webgpu.h`` (vendored as ``wgpu/resources/dawn_webgpu.h``) is the single +source of truth for the Dawn backend. From it we generate: + +* ``backends/dawn/_webgpu.pxd``: the complete Cython declaration of the C API + (handles, enums, flags, structs, callbacks, functions, constants and the + ``WGPU_*_INIT`` struct initializers). This file is fully generated; the Cython + compiler checks every field/function used by ``backends/dawn/_api.pyx`` + against it, and the C compiler checks it against the real header. +* ``backends/dawn/_mappings.py``: dicts to map WebGPU enum strings to the + integer values that Dawn uses (and back). + +We parse the header with pycparser (which cffi already depends on), using the +same cleaning step as for the wgpu-native headers. +""" + +import re + +from pycparser import c_ast, c_parser + +from codegen.utils import print, format_code, to_snake_case +from codegen.hparser import get_dawn_h_parser +from codegen.idlparser import get_idl_parser +from codegen.files import file_cache, read_file + + +# Type names that pycparser needs to know about, but that the pxd gets from libc +STDINT_TYPES = [ + "int8_t", + "int16_t", + "int32_t", + "int64_t", + "uint8_t", + "uint16_t", + "uint32_t", + "uint64_t", + "size_t", + "uintptr_t", +] + +PXD_PREAMBLE = """ +# Cython declarations of Dawn's webgpu.h, for the Dawn backend. +# +# THIS CODE IS AUTOGENERATED BY THE CODEGEN FROM wgpu/resources/dawn_webgpu.h - DO NOT EDIT + +from libc.stdint cimport int8_t, int16_t, int32_t, int64_t +from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + + +cdef extern from "webgpu/webgpu.h" nogil: +""".lstrip() + + +def _render_type(node, name=""): + """Render a pycparser type node as Cython-compatible C declaration.""" + if isinstance(node, c_ast.TypeDecl): + quals = " ".join(node.quals) + t = node.type + if isinstance(t, c_ast.IdentifierType): + base = " ".join(t.names) + elif isinstance(t, (c_ast.Struct, c_ast.Enum)): + base = t.name + else: # no-cover + raise TypeError(f"Unexpected type node {t}") + prefix = (quals + " ") if quals else "" + return f"{prefix}{base} {name}".strip() + elif isinstance(node, c_ast.PtrDecl): + inner = node.type + if isinstance(inner, c_ast.FuncDecl): + ret = _render_type(inner.type, "") + args = _render_args(inner.args) + return f"{ret} (*{name})({args})" + # Note: qualifiers on the pointer itself (e.g. "* const") are dropped. + base = _render_type(inner, "") + return f"{base}* {name}".strip() + elif isinstance(node, c_ast.FuncDecl): + ret = _render_type(node.type, "") + args = _render_args(node.args) + return f"{ret} {name}({args})" + else: # no-cover + raise TypeError(f"Unexpected node {node}") + + +def _render_args(params): + if params is None: + return "" + args = [] + for p in params.params: + if isinstance(p, c_ast.Typename): # e.g. (void) + r = _render_type(p.type, "") + if r == "void": + continue + args.append(r) + else: + args.append(_render_type(p.type, p.name or "")) + return ", ".join(args) + + +def _tidy(s): + s = re.sub(r"\s+", " ", s).strip() + s = s.replace("* *", "**").replace("* ", "* ") + return s + + +def get_dawn_pxd_code(): + """Generate the Cython pxd for Dawn's webgpu.h.""" + + hp = get_dawn_h_parser() + raw_header = read_file("resources", "dawn_webgpu.h") + + # Prepare a source that pycparser can digest + lines = [] + macros = {} + for line in hp.source.splitlines(): + if line.startswith("#define "): + parts = line.split() + if len(parts) == 3: + macros[parts[1]] = parts[2] + continue + if line.startswith("//"): + continue + lines.append(line) + fake_typedefs = "\n".join(f"typedef int {t};" for t in STDINT_TYPES) + source = fake_typedefs + "\n" + "\n".join(lines) + ast = c_parser.CParser().parse(source, "dawn_webgpu.h") + + # The struct initializer macros (C compound literals) are very useful to + # get Dawn's defaults for a struct. + init_macros = re.findall( + r"#define (WGPU_[A-Z0-9_]+_INIT) _wgpu_MAKE_INIT_STRUCT\((WGPU\w+),", raw_header + ) + + struct_names = [] # forward declarations + handle_lines = [] + enum_lines = [] + flag_lines = [] + callback_lines = [] + struct_lines = [] + func_lines = [] + seen_structs = set() + + for node in ast.ext: + if isinstance(node, c_ast.Typedef): + name = node.name + t = node.type + if name in STDINT_TYPES: + continue + if name.startswith("WGPUProc") and name != "WGPUProc": + continue # The proc-table typedefs are not needed + if isinstance(t, c_ast.TypeDecl) and isinstance(t.type, c_ast.Enum): + enum = t.type + enum_lines.append(f" ctypedef enum {name}:") + for e in enum.values.enumerators: + if e.name.endswith("_Force32"): + continue + enum_lines.append(f" {e.name}") + enum_lines.append("") + elif isinstance(t, c_ast.TypeDecl) and isinstance(t.type, c_ast.Struct): + struct = t.type + if struct.decls is None: # no-cover + continue + seen_structs.add(struct.name) + struct_lines.append(f" cdef struct {struct.name}:") + for decl in struct.decls: + struct_lines.append( + " " + _tidy(_render_type(decl.type, decl.name)) + ) + struct_lines.append("") + if struct.name != name: # no-cover + struct_lines.append(f" ctypedef {struct.name} {name}") + elif ( + isinstance(t, c_ast.PtrDecl) + and isinstance(t.type, c_ast.TypeDecl) + and isinstance(t.type.type, c_ast.Struct) + ): + # Opaque handle: typedef struct WGPUAdapterImpl* WGPUAdapter; + impl = t.type.type.name + handle_lines.append(f" cdef struct {impl}") + handle_lines.append(f" ctypedef {impl}* {name}") + elif isinstance(t, c_ast.PtrDecl) and isinstance(t.type, c_ast.FuncDecl): + callback_lines.append( + " ctypedef " + _tidy(_render_type(t, name)) + " noexcept" + ) + elif isinstance(t, c_ast.TypeDecl) and isinstance( + t.type, c_ast.IdentifierType + ): + line = f" ctypedef {' '.join(t.type.names)} {name}" + # WGPUFlags and WGPUBool must come before the flags + if name in ("WGPUFlags", "WGPUBool"): + handle_lines.insert(0, line) + else: + flag_lines.append(line) + else: # no-cover + raise TypeError(f"Unexpected typedef {name}: {t}") + elif isinstance(node, c_ast.Decl): + t = node.type + if isinstance(t, c_ast.FuncDecl): + func_lines.append(" " + _tidy(_render_type(t, node.name))) + elif isinstance(t, c_ast.Struct): + if t.decls is None: + struct_names.append(t.name) # forward declaration + else: # no-cover + raise TypeError(f"Unexpected struct declaration {t.name}") + elif isinstance(t, c_ast.TypeDecl) and "static" in node.storage: + # static const WGPUBufferUsage WGPUBufferUsage_MapRead = 0x01; + flag_lines.append(" " + _tidy(_render_type(t, node.name))) + else: # no-cover + raise TypeError(f"Unexpected declaration {node.name}: {t}") + else: # no-cover + raise TypeError(f"Unexpected node {node}") + + # Constants from macros + const_lines = [] + for key, val in macros.items(): + try: + ival = int(val, 0) + except ValueError: + continue + if key == "WGPU_STRLEN": + ctype = "size_t" + elif ival > 0xFFFFFFFF: + ctype = "uint64_t" + else: + ctype = "uint32_t" + const_lines.append(f" const {ctype} {key}") + const_lines.append(" const WGPUBool WGPU_TRUE") + const_lines.append(" const WGPUBool WGPU_FALSE") + + init_lines = [f" const {sname} {mname}" for mname, sname in init_macros] + + # Make sure that every struct has a forward declaration, so that order does not matter + forward = [ + f" cdef struct {name}" for name in sorted(set(struct_names) | seen_structs) + ] + + sections = [ + ("Basic types and opaque handles", handle_lines), + ("Constants", const_lines), + ("Enums", enum_lines), + ("Flags", flag_lines), + ("Struct forward declarations", forward), + ("Callbacks", callback_lines), + ("Structs", struct_lines), + ("Struct initializers (C compound literals with Dawn's defaults)", init_lines), + ("Functions", func_lines), + ] + + code = PXD_PREAMBLE + for title, section_lines in sections: + code += f"\n # %% {title}\n\n" + code += "\n".join(section_lines).rstrip() + "\n" + + code += "\n\n" + _get_limits_helpers(hp) + + print( + f"Wrote _webgpu.pxd with {len(func_lines)} functions, {len(seen_structs)} structs, {len(init_lines)} initializers" + ) + return code + + +def _get_limits_helpers(hp): + """Generate inline helpers to convert WGPULimits from/to a dict.""" + fields = [key for key in hp.structs["WGPULimits"] if key != "nextInChain"] + lines = [] + lines.append("# %% Generated helpers") + lines.append("") + lines.append("") + lines.append("cdef inline dict limits_to_dict(const WGPULimits* c):") + lines.append( + ' """Convert a WGPULimits struct to a dict with wgpu-py limit names."""' + ) + lines.append(" return {") + for key in fields: + lines.append(f' "{to_snake_case(key, "-")}": c.{key},') + lines.append(" }") + lines.append("") + lines.append("") + lines.append("cdef inline int dict_to_limits(dict d, WGPULimits* c) except -1:") + lines.append( + ' """Set the fields of a WGPULimits struct from a dict with wgpu-py limit names."""' + ) + lines.append(" cdef object v") + for key in fields: + lines.append(f' v = d.get("{to_snake_case(key, "-")}")') + lines.append(" if v is not None:") + lines.append(f" c.{key} = v") + lines.append(" return 0") + return "\n".join(lines) + "\n" + + +def write_dawn_pxd(): + code = get_dawn_pxd_code() + file_cache.write("backends/dawn/_webgpu.pxd", code) + + +def to_dashed_name(name): + """Convert a CamelCase name to a lowercase dashed name, keeping acronyms together. + + E.g. "SharedFenceSyncFD" -> "shared-fence-sync-fd", "D3D11MultithreadProtected" + -> "d3d11-multithread-protected". + """ + out = "" + for i, c in enumerate(name): + if i > 0 and c.isupper(): + prev = name[i - 1] + nxt = name[i + 1] if i + 1 < len(name) else "" + if prev.islower() or (nxt.islower() and (prev.isupper() or prev.isdigit())): + out += "-" + out += c.lower() + return out + + +mappings_preamble = ''' +""" Mappings for the Dawn backend. """ + +# THIS CODE IS AUTOGENERATED - DO NOT EDIT + +'''.lstrip() + + +def compare_flags(): + """Check that the WebGPU flags have the same values in Dawn's webgpu.h.""" + idl = get_idl_parser() + hp = get_dawn_h_parser() + name_map = {"ColorWrite": "ColorWriteMask"} + for name, flag in idl.flags.items(): + name = name_map.get(name, name) + if name not in hp.flags: + print(f"Flag {name} missing in Dawn's webgpu.h") + else: + for key, val in flag.items(): + key = key.title().replace("_", "") # MAP_READ -> MapRead + if key not in hp.flags[name]: + print(f"Flag field {name}.{key} missing in Dawn's webgpu.h") + elif val != hp.flags[name][key]: + print(f"Warning: Flag field {name}.{key} have different values.") + + +def write_dawn_mappings(): + """Generate the file with dicts to map enums strings to ints for Dawn.""" + + idl = get_idl_parser() + hp = get_dawn_h_parser() + + pylines = [mappings_preamble] + + # enummap: "TextureFormat.rgba8unorm" -> int, only for the WebGPU enums + enummap = {} + for name in idl.enums: + if name not in hp.enums: + print(f"Enum {name} missing in Dawn's webgpu.h") + continue + hp_enum = { + key.lower().replace("_", ""): val for key, val in hp.enums[name].items() + } + for ikey in idl.enums[name].values(): + hkey = ikey.lower().replace("-", "") + if hkey in hp_enum: + enummap[name + "." + ikey] = hp_enum[hkey] + else: + print(f"Enum field {name}.{ikey} missing in Dawn's webgpu.h") + + pylines.append(f"# There are {len(enummap)} enum mappings\n") + pylines.append("enummap = {") + for key in sorted(enummap.keys()): + pylines.append(f' "{key}": {enummap[key]!r},') + pylines.append("}\n") + + # Dawn-specific mappings: key => int + pylines.append("enum_str2int = {") + for name, use_snake in (("BackendType", False), ("FeatureName", True)): + pylines.append(f' "{name}":' + " {") + for key, val in hp.enums[name].items(): + if key == "Force32": + continue + if use_snake: + key = to_dashed_name(key) + pylines.append(f' "{key}": {val},') + pylines.append(" },") + pylines.append("}") + pylines.append("") + + # int => key, resolving to WebGPU names where possible + pylines.append("enum_int2str = {") + for name in [ + "BackendType", + "AdapterType", + "ErrorType", + "DeviceLostReason", + "FeatureName", + "TextureFormat", + "TextureDimension", + "PresentMode", + "CompositeAlphaMode", + "SurfaceGetCurrentTextureStatus", + "CompilationMessageType", + ]: + webgpu_names = {} + if name in idl.enums: + webgpu_names = { + val.replace("-", ""): val for val in idl.enums[name].values() + } + if "unknown" in webgpu_names: + webgpu_names["undefined"] = "unknown" + pylines.append(f' "{name}":' + " {") + for key, val in hp.enums[name].items(): + if key == "Force32": + continue + if name == "FeatureName": + enum_val = webgpu_names.get(key.lower(), to_dashed_name(key)) + else: + enum_val = webgpu_names.get(key.lower(), key) + pylines.append(f' {val}: "{enum_val}",') + pylines.append(" },") + pylines.append("}") + pylines.append("") + + code = format_code("\n".join(pylines)) + file_cache.write("backends/dawn/_mappings.py", code) + print(f"Wrote {len(enummap)} enum mappings to dawn/_mappings.py") diff --git a/codegen/files.py b/codegen/files.py index ad1a89d10..a1f418bba 100644 --- a/codegen/files.py +++ b/codegen/files.py @@ -35,6 +35,9 @@ class FileCache: "structs.py", "backends/wgpu_native/_api.py", "backends/wgpu_native/_mappings.py", + "backends/dawn/_api.pyx", + "backends/dawn/_mappings.py", + "backends/dawn/_webgpu.pxd", "resources/codegen_report.md", ] diff --git a/codegen/hparser.py b/codegen/hparser.py index 3bee43dd7..4072a1ac4 100644 --- a/codegen/hparser.py +++ b/codegen/hparser.py @@ -9,8 +9,12 @@ _parser = None -def _get_wgpu_header(*filenames): - """Func written so we can use this in both wgpu_native/_ffi.py and codegen/hparser.py""" +def _get_wgpu_header(*filenames, output_filename="combined_header.h"): + """Func written so we can use this in both wgpu_native/_ffi.py and codegen/hparser.py + + The cleaned (cffi-compatible) source is written to the resource + ``output_filename``, unless that is None. + """ cleaned_contents = [] # one for each filename @@ -78,9 +82,10 @@ def _get_wgpu_header(*filenames): # Write the combined source, which is what will be loaded at wgpu import time combined_source = "\n\n".join(cleaned_contents) - combined_header_file = get_header_filename("combined_header.h") - with open(combined_header_file, "wb") as f: - f.write(combined_source.encode()) + if output_filename: + combined_header_file = get_header_filename(output_filename) + with open(combined_header_file, "wb") as f: + f.write(combined_source.encode()) return combined_source @@ -104,11 +109,38 @@ def get_h_parser(*, allow_cache=True): return hp +_dawn_parser = None + + +def get_dawn_h_parser(*, allow_cache=True): + """Get the global HParser object for Dawn's webgpu.h.""" + + global _dawn_parser + if _dawn_parser and allow_cache: + return _dawn_parser + + source = _get_wgpu_header( + get_header_filename("dawn_webgpu.h"), output_filename=None + ) + # Dawn's header declares this unconditionally, but libwebgpu_dawn does not export it. + source = "\n".join( + line + for line in source.splitlines() + if "emscripten_webgpu_get_device" not in line + ) + + hp = HParser(source, "Dawn webgpu.h") + hp.parse() + _dawn_parser = hp + return hp + + class HParser: """Object to parse the webgpu.h/wgpu.h header files, by letting cffi do the heavy lifting.""" - def __init__(self, source): + def __init__(self, source, name="webgpu.h/wgpu.h"): self.source = source + self.name = name def parse(self, verbose=True): self.flags = {} @@ -120,10 +152,10 @@ def parse(self, verbose=True): self._parse_from_cffi() if verbose: - print(f"webgpu.h/wgpu.h define {len(self.functions)} functions") + print(f"{self.name} define {len(self.functions)} functions") keys = "flags", "enums", "structs" stats = ", ".join(f"{len(getattr(self, key))} {key}" for key in keys) - print("webgpu.h/wgpu.h define " + stats) + print(f"{self.name} define " + stats) # NOTE: we could use pycparser as it's used by cffi anyway and we have that. def _parse_from_h(self): diff --git a/wgpu/backends/dawn/_mappings.py b/wgpu/backends/dawn/_mappings.py new file mode 100644 index 000000000..d74c29521 --- /dev/null +++ b/wgpu/backends/dawn/_mappings.py @@ -0,0 +1,655 @@ +"""Mappings for the Dawn backend.""" + +# THIS CODE IS AUTOGENERATED - DO NOT EDIT + + +# There are 268 enum mappings + +enummap = { + "AddressMode.clamp-to-edge": 1, + "AddressMode.mirror-repeat": 3, + "AddressMode.repeat": 2, + "BlendFactor.constant": 12, + "BlendFactor.dst": 7, + "BlendFactor.dst-alpha": 9, + "BlendFactor.one": 2, + "BlendFactor.one-minus-constant": 13, + "BlendFactor.one-minus-dst": 8, + "BlendFactor.one-minus-dst-alpha": 10, + "BlendFactor.one-minus-src": 4, + "BlendFactor.one-minus-src-alpha": 6, + "BlendFactor.one-minus-src1": 15, + "BlendFactor.one-minus-src1-alpha": 17, + "BlendFactor.src": 3, + "BlendFactor.src-alpha": 5, + "BlendFactor.src-alpha-saturated": 11, + "BlendFactor.src1": 14, + "BlendFactor.src1-alpha": 16, + "BlendFactor.zero": 1, + "BlendOperation.add": 1, + "BlendOperation.max": 5, + "BlendOperation.min": 4, + "BlendOperation.reverse-subtract": 3, + "BlendOperation.subtract": 2, + "BufferBindingType.read-only-storage": 4, + "BufferBindingType.storage": 3, + "BufferBindingType.uniform": 2, + "BufferMapState.mapped": 3, + "BufferMapState.pending": 2, + "BufferMapState.unmapped": 1, + "CompareFunction.always": 8, + "CompareFunction.equal": 3, + "CompareFunction.greater": 5, + "CompareFunction.greater-equal": 7, + "CompareFunction.less": 2, + "CompareFunction.less-equal": 4, + "CompareFunction.never": 1, + "CompareFunction.not-equal": 6, + "CompilationMessageType.error": 1, + "CompilationMessageType.info": 3, + "CompilationMessageType.warning": 2, + "CullMode.back": 3, + "CullMode.front": 2, + "CullMode.none": 1, + "DeviceLostReason.destroyed": 2, + "DeviceLostReason.unknown": 1, + "ErrorFilter.internal": 3, + "ErrorFilter.out-of-memory": 2, + "ErrorFilter.validation": 1, + "FeatureName.bgra8unorm-storage": 13, + "FeatureName.clip-distances": 16, + "FeatureName.core-features-and-limits": 1, + "FeatureName.depth-clip-control": 2, + "FeatureName.depth32float-stencil8": 3, + "FeatureName.dual-source-blending": 17, + "FeatureName.float32-blendable": 15, + "FeatureName.float32-filterable": 14, + "FeatureName.indirect-first-instance": 10, + "FeatureName.primitive-index": 21, + "FeatureName.rg11b10ufloat-renderable": 12, + "FeatureName.shader-f16": 11, + "FeatureName.subgroups": 18, + "FeatureName.texture-component-swizzle": 22, + "FeatureName.texture-compression-astc": 7, + "FeatureName.texture-compression-astc-sliced-3d": 8, + "FeatureName.texture-compression-bc": 4, + "FeatureName.texture-compression-bc-sliced-3d": 5, + "FeatureName.texture-compression-etc2": 6, + "FeatureName.texture-formats-tier1": 19, + "FeatureName.texture-formats-tier2": 20, + "FeatureName.timestamp-query": 9, + "FilterMode.linear": 2, + "FilterMode.nearest": 1, + "FrontFace.ccw": 1, + "FrontFace.cw": 2, + "IndexFormat.uint16": 1, + "IndexFormat.uint32": 2, + "LoadOp.clear": 2, + "LoadOp.load": 1, + "MipmapFilterMode.linear": 2, + "MipmapFilterMode.nearest": 1, + "PowerPreference.high-performance": 2, + "PowerPreference.low-power": 1, + "PrimitiveTopology.line-list": 2, + "PrimitiveTopology.line-strip": 3, + "PrimitiveTopology.point-list": 1, + "PrimitiveTopology.triangle-list": 4, + "PrimitiveTopology.triangle-strip": 5, + "QueryType.occlusion": 1, + "QueryType.timestamp": 2, + "SamplerBindingType.comparison": 4, + "SamplerBindingType.filtering": 2, + "SamplerBindingType.non-filtering": 3, + "StencilOperation.decrement-clamp": 6, + "StencilOperation.decrement-wrap": 8, + "StencilOperation.increment-clamp": 5, + "StencilOperation.increment-wrap": 7, + "StencilOperation.invert": 4, + "StencilOperation.keep": 1, + "StencilOperation.replace": 3, + "StencilOperation.zero": 2, + "StorageTextureAccess.read-only": 3, + "StorageTextureAccess.read-write": 4, + "StorageTextureAccess.write-only": 2, + "StoreOp.discard": 2, + "StoreOp.store": 1, + "TextureAspect.all": 1, + "TextureAspect.depth-only": 3, + "TextureAspect.stencil-only": 2, + "TextureDimension.1d": 1, + "TextureDimension.2d": 2, + "TextureDimension.3d": 3, + "TextureFormat.astc-10x10-unorm": 96, + "TextureFormat.astc-10x10-unorm-srgb": 97, + "TextureFormat.astc-10x5-unorm": 90, + "TextureFormat.astc-10x5-unorm-srgb": 91, + "TextureFormat.astc-10x6-unorm": 92, + "TextureFormat.astc-10x6-unorm-srgb": 93, + "TextureFormat.astc-10x8-unorm": 94, + "TextureFormat.astc-10x8-unorm-srgb": 95, + "TextureFormat.astc-12x10-unorm": 98, + "TextureFormat.astc-12x10-unorm-srgb": 99, + "TextureFormat.astc-12x12-unorm": 100, + "TextureFormat.astc-12x12-unorm-srgb": 101, + "TextureFormat.astc-4x4-unorm": 74, + "TextureFormat.astc-4x4-unorm-srgb": 75, + "TextureFormat.astc-5x4-unorm": 76, + "TextureFormat.astc-5x4-unorm-srgb": 77, + "TextureFormat.astc-5x5-unorm": 78, + "TextureFormat.astc-5x5-unorm-srgb": 79, + "TextureFormat.astc-6x5-unorm": 80, + "TextureFormat.astc-6x5-unorm-srgb": 81, + "TextureFormat.astc-6x6-unorm": 82, + "TextureFormat.astc-6x6-unorm-srgb": 83, + "TextureFormat.astc-8x5-unorm": 84, + "TextureFormat.astc-8x5-unorm-srgb": 85, + "TextureFormat.astc-8x6-unorm": 86, + "TextureFormat.astc-8x6-unorm-srgb": 87, + "TextureFormat.astc-8x8-unorm": 88, + "TextureFormat.astc-8x8-unorm-srgb": 89, + "TextureFormat.bc1-rgba-unorm": 50, + "TextureFormat.bc1-rgba-unorm-srgb": 51, + "TextureFormat.bc2-rgba-unorm": 52, + "TextureFormat.bc2-rgba-unorm-srgb": 53, + "TextureFormat.bc3-rgba-unorm": 54, + "TextureFormat.bc3-rgba-unorm-srgb": 55, + "TextureFormat.bc4-r-snorm": 57, + "TextureFormat.bc4-r-unorm": 56, + "TextureFormat.bc5-rg-snorm": 59, + "TextureFormat.bc5-rg-unorm": 58, + "TextureFormat.bc6h-rgb-float": 61, + "TextureFormat.bc6h-rgb-ufloat": 60, + "TextureFormat.bc7-rgba-unorm": 62, + "TextureFormat.bc7-rgba-unorm-srgb": 63, + "TextureFormat.bgra8unorm": 27, + "TextureFormat.bgra8unorm-srgb": 28, + "TextureFormat.depth16unorm": 45, + "TextureFormat.depth24plus": 46, + "TextureFormat.depth24plus-stencil8": 47, + "TextureFormat.depth32float": 48, + "TextureFormat.depth32float-stencil8": 49, + "TextureFormat.eac-r11snorm": 71, + "TextureFormat.eac-r11unorm": 70, + "TextureFormat.eac-rg11snorm": 73, + "TextureFormat.eac-rg11unorm": 72, + "TextureFormat.etc2-rgb8a1unorm": 66, + "TextureFormat.etc2-rgb8a1unorm-srgb": 67, + "TextureFormat.etc2-rgb8unorm": 64, + "TextureFormat.etc2-rgb8unorm-srgb": 65, + "TextureFormat.etc2-rgba8unorm": 68, + "TextureFormat.etc2-rgba8unorm-srgb": 69, + "TextureFormat.r16float": 9, + "TextureFormat.r16sint": 8, + "TextureFormat.r16snorm": 6, + "TextureFormat.r16uint": 7, + "TextureFormat.r16unorm": 5, + "TextureFormat.r32float": 14, + "TextureFormat.r32sint": 16, + "TextureFormat.r32uint": 15, + "TextureFormat.r8sint": 4, + "TextureFormat.r8snorm": 2, + "TextureFormat.r8uint": 3, + "TextureFormat.r8unorm": 1, + "TextureFormat.rg11b10ufloat": 31, + "TextureFormat.rg16float": 21, + "TextureFormat.rg16sint": 20, + "TextureFormat.rg16snorm": 18, + "TextureFormat.rg16uint": 19, + "TextureFormat.rg16unorm": 17, + "TextureFormat.rg32float": 33, + "TextureFormat.rg32sint": 35, + "TextureFormat.rg32uint": 34, + "TextureFormat.rg8sint": 13, + "TextureFormat.rg8snorm": 11, + "TextureFormat.rg8uint": 12, + "TextureFormat.rg8unorm": 10, + "TextureFormat.rgb10a2uint": 29, + "TextureFormat.rgb10a2unorm": 30, + "TextureFormat.rgb9e5ufloat": 32, + "TextureFormat.rgba16float": 40, + "TextureFormat.rgba16sint": 39, + "TextureFormat.rgba16snorm": 37, + "TextureFormat.rgba16uint": 38, + "TextureFormat.rgba16unorm": 36, + "TextureFormat.rgba32float": 41, + "TextureFormat.rgba32sint": 43, + "TextureFormat.rgba32uint": 42, + "TextureFormat.rgba8sint": 26, + "TextureFormat.rgba8snorm": 24, + "TextureFormat.rgba8uint": 25, + "TextureFormat.rgba8unorm": 22, + "TextureFormat.rgba8unorm-srgb": 23, + "TextureFormat.stencil8": 44, + "TextureSampleType.depth": 4, + "TextureSampleType.float": 2, + "TextureSampleType.sint": 5, + "TextureSampleType.uint": 6, + "TextureSampleType.unfilterable-float": 3, + "TextureViewDimension.1d": 1, + "TextureViewDimension.2d": 2, + "TextureViewDimension.2d-array": 3, + "TextureViewDimension.3d": 6, + "TextureViewDimension.cube": 4, + "TextureViewDimension.cube-array": 5, + "VertexFormat.float16": 25, + "VertexFormat.float16x2": 26, + "VertexFormat.float16x4": 27, + "VertexFormat.float32": 28, + "VertexFormat.float32x2": 29, + "VertexFormat.float32x3": 30, + "VertexFormat.float32x4": 31, + "VertexFormat.sint16": 16, + "VertexFormat.sint16x2": 17, + "VertexFormat.sint16x4": 18, + "VertexFormat.sint32": 36, + "VertexFormat.sint32x2": 37, + "VertexFormat.sint32x3": 38, + "VertexFormat.sint32x4": 39, + "VertexFormat.sint8": 4, + "VertexFormat.sint8x2": 5, + "VertexFormat.sint8x4": 6, + "VertexFormat.snorm16": 22, + "VertexFormat.snorm16x2": 23, + "VertexFormat.snorm16x4": 24, + "VertexFormat.snorm8": 10, + "VertexFormat.snorm8x2": 11, + "VertexFormat.snorm8x4": 12, + "VertexFormat.uint16": 13, + "VertexFormat.uint16x2": 14, + "VertexFormat.uint16x4": 15, + "VertexFormat.uint32": 32, + "VertexFormat.uint32x2": 33, + "VertexFormat.uint32x3": 34, + "VertexFormat.uint32x4": 35, + "VertexFormat.uint8": 1, + "VertexFormat.uint8x2": 2, + "VertexFormat.uint8x4": 3, + "VertexFormat.unorm10-10-10-2": 40, + "VertexFormat.unorm16": 19, + "VertexFormat.unorm16x2": 20, + "VertexFormat.unorm16x4": 21, + "VertexFormat.unorm8": 7, + "VertexFormat.unorm8x2": 8, + "VertexFormat.unorm8x4": 9, + "VertexFormat.unorm8x4-bgra": 41, + "VertexStepMode.instance": 2, + "VertexStepMode.vertex": 1, +} + +enum_str2int = { + "BackendType": { + "Undefined": 0, + "Null": 1, + "WebGPU": 2, + "D3D11": 3, + "D3D12": 4, + "Metal": 5, + "Vulkan": 6, + "OpenGL": 7, + "OpenGLES": 8, + }, + "FeatureName": { + "core-features-and-limits": 1, + "depth-clip-control": 2, + "depth32-float-stencil8": 3, + "texture-compression-bc": 4, + "texture-compression-bc-sliced3d": 5, + "texture-compression-etc2": 6, + "texture-compression-astc": 7, + "texture-compression-astc-sliced3d": 8, + "timestamp-query": 9, + "indirect-first-instance": 10, + "shader-f16": 11, + "rg11b10-ufloat-renderable": 12, + "bgra8-unorm-storage": 13, + "float32-filterable": 14, + "float32-blendable": 15, + "clip-distances": 16, + "dual-source-blending": 17, + "subgroups": 18, + "texture-formats-tier1": 19, + "texture-formats-tier2": 20, + "primitive-index": 21, + "texture-component-swizzle": 22, + "subgroup-size-control": 23, + "texture-compression-unaligned": 24, + "dawn-internal-usages": 327680, + "dawn-multi-planar-formats": 327681, + "dawn-native": 327682, + "chromium-experimental-timestamp-query-inside-passes": 327683, + "implicit-device-synchronization": 327684, + "transient-attachments": 327686, + "msaa-render-to-single-sampled": 327687, + "d3d11-multithread-protected": 327688, + "angle-texture-sharing": 327689, + "pixel-local-storage-coherent": 327690, + "pixel-local-storage-non-coherent": 327691, + "unorm16-texture-formats": 327692, + "multi-planar-format-extended-usages": 327693, + "multi-planar-format-p010": 327694, + "host-mapped-pointer": 327695, + "multi-planar-render-targets": 327696, + "multi-planar-format-nv12a": 327697, + "framebuffer-fetch": 327698, + "buffer-map-extended-usages": 327699, + "adapter-properties-memory-heaps": 327700, + "adapter-properties-d3d": 327701, + "adapter-properties-vk": 327702, + "dawn-format-capabilities": 327703, + "dawn-drm-format-capabilities": 327704, + "multi-planar-format-nv16": 327705, + "multi-planar-format-nv24": 327706, + "multi-planar-format-p210": 327707, + "multi-planar-format-p410": 327708, + "shared-texture-memory-vk-dedicated-allocation": 327709, + "shared-texture-memory-a-hardware-buffer": 327710, + "shared-texture-memory-dma-buf": 327711, + "shared-texture-memory-opaque-fd": 327712, + "shared-texture-memory-zircon-handle": 327713, + "shared-texture-memory-dxgi-shared-handle": 327714, + "shared-texture-memory-d3d11-texture2d": 327715, + "shared-texture-memory-io-surface": 327716, + "shared-texture-memory-egl-image": 327717, + "shared-fence-vk-semaphore-opaque-fd": 327718, + "shared-fence-sync-fd": 327719, + "shared-fence-vk-semaphore-zircon-handle": 327720, + "shared-fence-dxgi-shared-handle": 327721, + "shared-fence-mtl-shared-event": 327722, + "shared-buffer-memory-d3d12-resource": 327723, + "static-samplers": 327724, + "y-cb-cr-vulkan-samplers": 327725, + "shader-module-compilation-options": 327726, + "dawn-load-resolve-texture": 327727, + "dawn-partial-load-resolve-texture": 327728, + "multi-draw-indirect": 327729, + "dawn-texel-copy-buffer-row-alignment": 327730, + "flexible-texture-views": 327731, + "chromium-experimental-subgroup-matrix": 327732, + "shared-fence-egl-sync": 327733, + "dawn-device-allocator-control": 327734, + "adapter-properties-wgpu": 327735, + "shared-buffer-memory-from-windows-handle": 327736, + "shared-texture-memory-d3d12-resource": 327737, + "chromium-experimental-sampling-resource-table": 327738, + "atomic-vec2u-min-max": 327739, + "unorm16-formats-for-external-texture": 327740, + "opaque-y-cb-cr-android-for-external-texture": 327741, + "unorm16-filterable": 327742, + "render-pass-render-area": 327743, + "adapter-properties-drm": 327744, + "dawn-allow-undefined-load-store-op": 327745, + "buffer-map-write-extended-usages": 327746, + "shared-buffer-memory-host-pointer": 327747, + }, +} + +enum_int2str = { + "BackendType": { + 0: "Undefined", + 1: "Null", + 2: "WebGPU", + 3: "D3D11", + 4: "D3D12", + 5: "Metal", + 6: "Vulkan", + 7: "OpenGL", + 8: "OpenGLES", + }, + "AdapterType": { + 1: "DiscreteGPU", + 2: "IntegratedGPU", + 3: "CPU", + 4: "Unknown", + }, + "ErrorType": { + 1: "NoError", + 2: "Validation", + 3: "OutOfMemory", + 4: "Internal", + 5: "Unknown", + }, + "DeviceLostReason": { + 1: "unknown", + 2: "destroyed", + 3: "CallbackCancelled", + 4: "FailedCreation", + }, + "FeatureName": { + 1: "core-features-and-limits", + 2: "depth-clip-control", + 3: "depth32float-stencil8", + 4: "texture-compression-bc", + 5: "texture-compression-bc-sliced-3d", + 6: "texture-compression-etc2", + 7: "texture-compression-astc", + 8: "texture-compression-astc-sliced-3d", + 9: "timestamp-query", + 10: "indirect-first-instance", + 11: "shader-f16", + 12: "rg11b10ufloat-renderable", + 13: "bgra8unorm-storage", + 14: "float32-filterable", + 15: "float32-blendable", + 16: "clip-distances", + 17: "dual-source-blending", + 18: "subgroups", + 19: "texture-formats-tier1", + 20: "texture-formats-tier2", + 21: "primitive-index", + 22: "texture-component-swizzle", + 23: "subgroup-size-control", + 24: "texture-compression-unaligned", + 327680: "dawn-internal-usages", + 327681: "dawn-multi-planar-formats", + 327682: "dawn-native", + 327683: "chromium-experimental-timestamp-query-inside-passes", + 327684: "implicit-device-synchronization", + 327686: "transient-attachments", + 327687: "msaa-render-to-single-sampled", + 327688: "d3d11-multithread-protected", + 327689: "angle-texture-sharing", + 327690: "pixel-local-storage-coherent", + 327691: "pixel-local-storage-non-coherent", + 327692: "unorm16-texture-formats", + 327693: "multi-planar-format-extended-usages", + 327694: "multi-planar-format-p010", + 327695: "host-mapped-pointer", + 327696: "multi-planar-render-targets", + 327697: "multi-planar-format-nv12a", + 327698: "framebuffer-fetch", + 327699: "buffer-map-extended-usages", + 327700: "adapter-properties-memory-heaps", + 327701: "adapter-properties-d3d", + 327702: "adapter-properties-vk", + 327703: "dawn-format-capabilities", + 327704: "dawn-drm-format-capabilities", + 327705: "multi-planar-format-nv16", + 327706: "multi-planar-format-nv24", + 327707: "multi-planar-format-p210", + 327708: "multi-planar-format-p410", + 327709: "shared-texture-memory-vk-dedicated-allocation", + 327710: "shared-texture-memory-a-hardware-buffer", + 327711: "shared-texture-memory-dma-buf", + 327712: "shared-texture-memory-opaque-fd", + 327713: "shared-texture-memory-zircon-handle", + 327714: "shared-texture-memory-dxgi-shared-handle", + 327715: "shared-texture-memory-d3d11-texture2d", + 327716: "shared-texture-memory-io-surface", + 327717: "shared-texture-memory-egl-image", + 327718: "shared-fence-vk-semaphore-opaque-fd", + 327719: "shared-fence-sync-fd", + 327720: "shared-fence-vk-semaphore-zircon-handle", + 327721: "shared-fence-dxgi-shared-handle", + 327722: "shared-fence-mtl-shared-event", + 327723: "shared-buffer-memory-d3d12-resource", + 327724: "static-samplers", + 327725: "y-cb-cr-vulkan-samplers", + 327726: "shader-module-compilation-options", + 327727: "dawn-load-resolve-texture", + 327728: "dawn-partial-load-resolve-texture", + 327729: "multi-draw-indirect", + 327730: "dawn-texel-copy-buffer-row-alignment", + 327731: "flexible-texture-views", + 327732: "chromium-experimental-subgroup-matrix", + 327733: "shared-fence-egl-sync", + 327734: "dawn-device-allocator-control", + 327735: "adapter-properties-wgpu", + 327736: "shared-buffer-memory-from-windows-handle", + 327737: "shared-texture-memory-d3d12-resource", + 327738: "chromium-experimental-sampling-resource-table", + 327739: "atomic-vec2u-min-max", + 327740: "unorm16-formats-for-external-texture", + 327741: "opaque-y-cb-cr-android-for-external-texture", + 327742: "unorm16-filterable", + 327743: "render-pass-render-area", + 327744: "adapter-properties-drm", + 327745: "dawn-allow-undefined-load-store-op", + 327746: "buffer-map-write-extended-usages", + 327747: "shared-buffer-memory-host-pointer", + }, + "TextureFormat": { + 0: "Undefined", + 1: "r8unorm", + 2: "r8snorm", + 3: "r8uint", + 4: "r8sint", + 5: "r16unorm", + 6: "r16snorm", + 7: "r16uint", + 8: "r16sint", + 9: "r16float", + 10: "rg8unorm", + 11: "rg8snorm", + 12: "rg8uint", + 13: "rg8sint", + 14: "r32float", + 15: "r32uint", + 16: "r32sint", + 17: "rg16unorm", + 18: "rg16snorm", + 19: "rg16uint", + 20: "rg16sint", + 21: "rg16float", + 22: "rgba8unorm", + 23: "rgba8unorm-srgb", + 24: "rgba8snorm", + 25: "rgba8uint", + 26: "rgba8sint", + 27: "bgra8unorm", + 28: "bgra8unorm-srgb", + 29: "rgb10a2uint", + 30: "rgb10a2unorm", + 31: "rg11b10ufloat", + 32: "rgb9e5ufloat", + 33: "rg32float", + 34: "rg32uint", + 35: "rg32sint", + 36: "rgba16unorm", + 37: "rgba16snorm", + 38: "rgba16uint", + 39: "rgba16sint", + 40: "rgba16float", + 41: "rgba32float", + 42: "rgba32uint", + 43: "rgba32sint", + 44: "stencil8", + 45: "depth16unorm", + 46: "depth24plus", + 47: "depth24plus-stencil8", + 48: "depth32float", + 49: "depth32float-stencil8", + 50: "bc1-rgba-unorm", + 51: "bc1-rgba-unorm-srgb", + 52: "bc2-rgba-unorm", + 53: "bc2-rgba-unorm-srgb", + 54: "bc3-rgba-unorm", + 55: "bc3-rgba-unorm-srgb", + 56: "bc4-r-unorm", + 57: "bc4-r-snorm", + 58: "bc5-rg-unorm", + 59: "bc5-rg-snorm", + 60: "bc6h-rgb-ufloat", + 61: "bc6h-rgb-float", + 62: "bc7-rgba-unorm", + 63: "bc7-rgba-unorm-srgb", + 64: "etc2-rgb8unorm", + 65: "etc2-rgb8unorm-srgb", + 66: "etc2-rgb8a1unorm", + 67: "etc2-rgb8a1unorm-srgb", + 68: "etc2-rgba8unorm", + 69: "etc2-rgba8unorm-srgb", + 70: "eac-r11unorm", + 71: "eac-r11snorm", + 72: "eac-rg11unorm", + 73: "eac-rg11snorm", + 74: "astc-4x4-unorm", + 75: "astc-4x4-unorm-srgb", + 76: "astc-5x4-unorm", + 77: "astc-5x4-unorm-srgb", + 78: "astc-5x5-unorm", + 79: "astc-5x5-unorm-srgb", + 80: "astc-6x5-unorm", + 81: "astc-6x5-unorm-srgb", + 82: "astc-6x6-unorm", + 83: "astc-6x6-unorm-srgb", + 84: "astc-8x5-unorm", + 85: "astc-8x5-unorm-srgb", + 86: "astc-8x6-unorm", + 87: "astc-8x6-unorm-srgb", + 88: "astc-8x8-unorm", + 89: "astc-8x8-unorm-srgb", + 90: "astc-10x5-unorm", + 91: "astc-10x5-unorm-srgb", + 92: "astc-10x6-unorm", + 93: "astc-10x6-unorm-srgb", + 94: "astc-10x8-unorm", + 95: "astc-10x8-unorm-srgb", + 96: "astc-10x10-unorm", + 97: "astc-10x10-unorm-srgb", + 98: "astc-12x10-unorm", + 99: "astc-12x10-unorm-srgb", + 100: "astc-12x12-unorm", + 101: "astc-12x12-unorm-srgb", + 327680: "R8BG8Biplanar420Unorm", + 327681: "R10X6BG10X6Biplanar420Unorm", + 327682: "R8BG8A8Triplanar420Unorm", + 327683: "R8BG8Biplanar422Unorm", + 327684: "R8BG8Biplanar444Unorm", + 327685: "R10X6BG10X6Biplanar422Unorm", + 327686: "R10X6BG10X6Biplanar444Unorm", + 327687: "OpaqueYCbCrAndroid", + }, + "TextureDimension": { + 0: "Undefined", + 1: "1d", + 2: "2d", + 3: "3d", + }, + "PresentMode": { + 0: "Undefined", + 1: "Fifo", + 2: "FifoRelaxed", + 3: "Immediate", + 4: "Mailbox", + }, + "CompositeAlphaMode": { + 0: "Auto", + 1: "Opaque", + 2: "Premultiplied", + 3: "Unpremultiplied", + 4: "Inherit", + }, + "SurfaceGetCurrentTextureStatus": { + 1: "SuccessOptimal", + 2: "SuccessSuboptimal", + 3: "Timeout", + 4: "Outdated", + 5: "Lost", + 6: "Error", + }, + "CompilationMessageType": { + 1: "error", + 2: "warning", + 3: "info", + }, +} diff --git a/wgpu/backends/dawn/_webgpu.pxd b/wgpu/backends/dawn/_webgpu.pxd new file mode 100644 index 000000000..8f1022b92 --- /dev/null +++ b/wgpu/backends/dawn/_webgpu.pxd @@ -0,0 +1,2908 @@ +# Cython declarations of Dawn's webgpu.h, for the Dawn backend. +# +# THIS CODE IS AUTOGENERATED BY THE CODEGEN FROM wgpu/resources/dawn_webgpu.h - DO NOT EDIT + +from libc.stdint cimport int8_t, int16_t, int32_t, int64_t +from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t + + +cdef extern from "webgpu/webgpu.h" nogil: + + # %% Basic types and opaque handles + + ctypedef uint32_t WGPUBool + ctypedef uint64_t WGPUFlags + cdef struct WGPUAdapterImpl + ctypedef WGPUAdapterImpl* WGPUAdapter + cdef struct WGPUBindGroupImpl + ctypedef WGPUBindGroupImpl* WGPUBindGroup + cdef struct WGPUBindGroupLayoutImpl + ctypedef WGPUBindGroupLayoutImpl* WGPUBindGroupLayout + cdef struct WGPUBufferImpl + ctypedef WGPUBufferImpl* WGPUBuffer + cdef struct WGPUCommandBufferImpl + ctypedef WGPUCommandBufferImpl* WGPUCommandBuffer + cdef struct WGPUCommandEncoderImpl + ctypedef WGPUCommandEncoderImpl* WGPUCommandEncoder + cdef struct WGPUComputePassEncoderImpl + ctypedef WGPUComputePassEncoderImpl* WGPUComputePassEncoder + cdef struct WGPUComputePipelineImpl + ctypedef WGPUComputePipelineImpl* WGPUComputePipeline + cdef struct WGPUDeviceImpl + ctypedef WGPUDeviceImpl* WGPUDevice + cdef struct WGPUExternalTextureImpl + ctypedef WGPUExternalTextureImpl* WGPUExternalTexture + cdef struct WGPUInstanceImpl + ctypedef WGPUInstanceImpl* WGPUInstance + cdef struct WGPUPipelineLayoutImpl + ctypedef WGPUPipelineLayoutImpl* WGPUPipelineLayout + cdef struct WGPUQuerySetImpl + ctypedef WGPUQuerySetImpl* WGPUQuerySet + cdef struct WGPUQueueImpl + ctypedef WGPUQueueImpl* WGPUQueue + cdef struct WGPURenderBundleImpl + ctypedef WGPURenderBundleImpl* WGPURenderBundle + cdef struct WGPURenderBundleEncoderImpl + ctypedef WGPURenderBundleEncoderImpl* WGPURenderBundleEncoder + cdef struct WGPURenderPassEncoderImpl + ctypedef WGPURenderPassEncoderImpl* WGPURenderPassEncoder + cdef struct WGPURenderPipelineImpl + ctypedef WGPURenderPipelineImpl* WGPURenderPipeline + cdef struct WGPUResourceTableImpl + ctypedef WGPUResourceTableImpl* WGPUResourceTable + cdef struct WGPUSamplerImpl + ctypedef WGPUSamplerImpl* WGPUSampler + cdef struct WGPUShaderModuleImpl + ctypedef WGPUShaderModuleImpl* WGPUShaderModule + cdef struct WGPUSharedBufferMemoryImpl + ctypedef WGPUSharedBufferMemoryImpl* WGPUSharedBufferMemory + cdef struct WGPUSharedFenceImpl + ctypedef WGPUSharedFenceImpl* WGPUSharedFence + cdef struct WGPUSharedTextureMemoryImpl + ctypedef WGPUSharedTextureMemoryImpl* WGPUSharedTextureMemory + cdef struct WGPUSurfaceImpl + ctypedef WGPUSurfaceImpl* WGPUSurface + cdef struct WGPUTexelBufferViewImpl + ctypedef WGPUTexelBufferViewImpl* WGPUTexelBufferView + cdef struct WGPUTextureImpl + ctypedef WGPUTextureImpl* WGPUTexture + cdef struct WGPUTextureViewImpl + ctypedef WGPUTextureViewImpl* WGPUTextureView + + # %% Constants + + const uint32_t WGPU_ARRAY_LAYER_COUNT_UNDEFINED + const uint32_t WGPU_COPY_STRIDE_UNDEFINED + const uint32_t WGPU_DEPTH_SLICE_UNDEFINED + const uint32_t WGPU_INVALID_BINDING + const uint32_t WGPU_LIMIT_U32_UNDEFINED + const uint64_t WGPU_LIMIT_U64_UNDEFINED + const uint32_t WGPU_MIP_LEVEL_COUNT_UNDEFINED + const uint32_t WGPU_QUERY_SET_INDEX_UNDEFINED + const size_t WGPU_STRLEN + const uint64_t WGPU_WHOLE_MAP_SIZE + const uint64_t WGPU_WHOLE_SIZE + const WGPUBool WGPU_TRUE + const WGPUBool WGPU_FALSE + + # %% Enums + + ctypedef enum WGPUAdapterType: + WGPUAdapterType_DiscreteGPU + WGPUAdapterType_IntegratedGPU + WGPUAdapterType_CPU + WGPUAdapterType_Unknown + + ctypedef enum WGPUAddressMode: + WGPUAddressMode_Undefined + WGPUAddressMode_ClampToEdge + WGPUAddressMode_Repeat + WGPUAddressMode_MirrorRepeat + + ctypedef enum WGPUAlphaMode: + WGPUAlphaMode_Opaque + WGPUAlphaMode_Premultiplied + WGPUAlphaMode_Unpremultiplied + + ctypedef enum WGPUBackendType: + WGPUBackendType_Undefined + WGPUBackendType_Null + WGPUBackendType_WebGPU + WGPUBackendType_D3D11 + WGPUBackendType_D3D12 + WGPUBackendType_Metal + WGPUBackendType_Vulkan + WGPUBackendType_OpenGL + WGPUBackendType_OpenGLES + + ctypedef enum WGPUBlendFactor: + WGPUBlendFactor_Undefined + WGPUBlendFactor_Zero + WGPUBlendFactor_One + WGPUBlendFactor_Src + WGPUBlendFactor_OneMinusSrc + WGPUBlendFactor_SrcAlpha + WGPUBlendFactor_OneMinusSrcAlpha + WGPUBlendFactor_Dst + WGPUBlendFactor_OneMinusDst + WGPUBlendFactor_DstAlpha + WGPUBlendFactor_OneMinusDstAlpha + WGPUBlendFactor_SrcAlphaSaturated + WGPUBlendFactor_Constant + WGPUBlendFactor_OneMinusConstant + WGPUBlendFactor_Src1 + WGPUBlendFactor_OneMinusSrc1 + WGPUBlendFactor_Src1Alpha + WGPUBlendFactor_OneMinusSrc1Alpha + + ctypedef enum WGPUBlendOperation: + WGPUBlendOperation_Undefined + WGPUBlendOperation_Add + WGPUBlendOperation_Subtract + WGPUBlendOperation_ReverseSubtract + WGPUBlendOperation_Min + WGPUBlendOperation_Max + + ctypedef enum WGPUBufferBindingType: + WGPUBufferBindingType_BindingNotUsed + WGPUBufferBindingType_Undefined + WGPUBufferBindingType_Uniform + WGPUBufferBindingType_Storage + WGPUBufferBindingType_ReadOnlyStorage + + ctypedef enum WGPUBufferMapState: + WGPUBufferMapState_Unmapped + WGPUBufferMapState_Pending + WGPUBufferMapState_Mapped + + ctypedef enum WGPUCallbackMode: + WGPUCallbackMode_WaitAnyOnly + WGPUCallbackMode_AllowProcessEvents + WGPUCallbackMode_AllowSpontaneous + + ctypedef enum WGPUCallbackStatus: + WGPUCallbackStatus_Success + WGPUCallbackStatus_Error + + ctypedef enum WGPUColorSpacePrimariesDawn: + WGPUColorSpacePrimariesDawn_SRGB + WGPUColorSpacePrimariesDawn_Rec709 + WGPUColorSpacePrimariesDawn_Rec601 + WGPUColorSpacePrimariesDawn_Rec2020 + WGPUColorSpacePrimariesDawn_DisplayP3 + + ctypedef enum WGPUColorSpaceTransferDawn: + WGPUColorSpaceTransferDawn_Identity + WGPUColorSpaceTransferDawn_SRGB + WGPUColorSpaceTransferDawn_DisplayP3 + WGPUColorSpaceTransferDawn_SMPTE_170M + WGPUColorSpaceTransferDawn_HLG + WGPUColorSpaceTransferDawn_PQ + WGPUColorSpaceTransferDawn_BT_1886 + + ctypedef enum WGPUColorSpaceYCbCrMatrixDawn: + WGPUColorSpaceYCbCrMatrixDawn_Identity + WGPUColorSpaceYCbCrMatrixDawn_Rec601 + WGPUColorSpaceYCbCrMatrixDawn_Rec709 + WGPUColorSpaceYCbCrMatrixDawn_Rec2020 + + ctypedef enum WGPUColorSpaceYCbCrRangeDawn: + WGPUColorSpaceYCbCrRangeDawn_Identity + WGPUColorSpaceYCbCrRangeDawn_Narrow + WGPUColorSpaceYCbCrRangeDawn_Full + + ctypedef enum WGPUCompareFunction: + WGPUCompareFunction_Undefined + WGPUCompareFunction_Never + WGPUCompareFunction_Less + WGPUCompareFunction_Equal + WGPUCompareFunction_LessEqual + WGPUCompareFunction_Greater + WGPUCompareFunction_NotEqual + WGPUCompareFunction_GreaterEqual + WGPUCompareFunction_Always + + ctypedef enum WGPUCompilationInfoRequestStatus: + WGPUCompilationInfoRequestStatus_Success + WGPUCompilationInfoRequestStatus_CallbackCancelled + + ctypedef enum WGPUCompilationMessageType: + WGPUCompilationMessageType_Error + WGPUCompilationMessageType_Warning + WGPUCompilationMessageType_Info + + ctypedef enum WGPUComponentSwizzle: + WGPUComponentSwizzle_Undefined + WGPUComponentSwizzle_Zero + WGPUComponentSwizzle_One + WGPUComponentSwizzle_R + WGPUComponentSwizzle_G + WGPUComponentSwizzle_B + WGPUComponentSwizzle_A + + ctypedef enum WGPUCompositeAlphaMode: + WGPUCompositeAlphaMode_Auto + WGPUCompositeAlphaMode_Opaque + WGPUCompositeAlphaMode_Premultiplied + WGPUCompositeAlphaMode_Unpremultiplied + WGPUCompositeAlphaMode_Inherit + + ctypedef enum WGPUCreatePipelineAsyncStatus: + WGPUCreatePipelineAsyncStatus_Success + WGPUCreatePipelineAsyncStatus_CallbackCancelled + WGPUCreatePipelineAsyncStatus_ValidationError + WGPUCreatePipelineAsyncStatus_InternalError + + ctypedef enum WGPUCullMode: + WGPUCullMode_Undefined + WGPUCullMode_None + WGPUCullMode_Front + WGPUCullMode_Back + + ctypedef enum WGPUDeviceLostReason: + WGPUDeviceLostReason_Unknown + WGPUDeviceLostReason_Destroyed + WGPUDeviceLostReason_CallbackCancelled + WGPUDeviceLostReason_FailedCreation + + ctypedef enum WGPUErrorFilter: + WGPUErrorFilter_Validation + WGPUErrorFilter_OutOfMemory + WGPUErrorFilter_Internal + + ctypedef enum WGPUErrorType: + WGPUErrorType_NoError + WGPUErrorType_Validation + WGPUErrorType_OutOfMemory + WGPUErrorType_Internal + WGPUErrorType_Unknown + + ctypedef enum WGPUExternalTextureRotation: + WGPUExternalTextureRotation_Rotate0Degrees + WGPUExternalTextureRotation_Rotate90Degrees + WGPUExternalTextureRotation_Rotate180Degrees + WGPUExternalTextureRotation_Rotate270Degrees + + ctypedef enum WGPUFeatureLevel: + WGPUFeatureLevel_Undefined + WGPUFeatureLevel_Compatibility + WGPUFeatureLevel_Core + + ctypedef enum WGPUFeatureName: + WGPUFeatureName_CoreFeaturesAndLimits + WGPUFeatureName_DepthClipControl + WGPUFeatureName_Depth32FloatStencil8 + WGPUFeatureName_TextureCompressionBC + WGPUFeatureName_TextureCompressionBCSliced3D + WGPUFeatureName_TextureCompressionETC2 + WGPUFeatureName_TextureCompressionASTC + WGPUFeatureName_TextureCompressionASTCSliced3D + WGPUFeatureName_TimestampQuery + WGPUFeatureName_IndirectFirstInstance + WGPUFeatureName_ShaderF16 + WGPUFeatureName_RG11B10UfloatRenderable + WGPUFeatureName_BGRA8UnormStorage + WGPUFeatureName_Float32Filterable + WGPUFeatureName_Float32Blendable + WGPUFeatureName_ClipDistances + WGPUFeatureName_DualSourceBlending + WGPUFeatureName_Subgroups + WGPUFeatureName_TextureFormatsTier1 + WGPUFeatureName_TextureFormatsTier2 + WGPUFeatureName_PrimitiveIndex + WGPUFeatureName_TextureComponentSwizzle + WGPUFeatureName_SubgroupSizeControl + WGPUFeatureName_TextureCompressionUnaligned + WGPUFeatureName_DawnInternalUsages + WGPUFeatureName_DawnMultiPlanarFormats + WGPUFeatureName_DawnNative + WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses + WGPUFeatureName_ImplicitDeviceSynchronization + WGPUFeatureName_TransientAttachments + WGPUFeatureName_MSAARenderToSingleSampled + WGPUFeatureName_D3D11MultithreadProtected + WGPUFeatureName_ANGLETextureSharing + WGPUFeatureName_PixelLocalStorageCoherent + WGPUFeatureName_PixelLocalStorageNonCoherent + WGPUFeatureName_Unorm16TextureFormats + WGPUFeatureName_MultiPlanarFormatExtendedUsages + WGPUFeatureName_MultiPlanarFormatP010 + WGPUFeatureName_HostMappedPointer + WGPUFeatureName_MultiPlanarRenderTargets + WGPUFeatureName_MultiPlanarFormatNv12a + WGPUFeatureName_FramebufferFetch + WGPUFeatureName_BufferMapExtendedUsages + WGPUFeatureName_AdapterPropertiesMemoryHeaps + WGPUFeatureName_AdapterPropertiesD3D + WGPUFeatureName_AdapterPropertiesVk + WGPUFeatureName_DawnFormatCapabilities + WGPUFeatureName_DawnDrmFormatCapabilities + WGPUFeatureName_MultiPlanarFormatNv16 + WGPUFeatureName_MultiPlanarFormatNv24 + WGPUFeatureName_MultiPlanarFormatP210 + WGPUFeatureName_MultiPlanarFormatP410 + WGPUFeatureName_SharedTextureMemoryVkDedicatedAllocation + WGPUFeatureName_SharedTextureMemoryAHardwareBuffer + WGPUFeatureName_SharedTextureMemoryDmaBuf + WGPUFeatureName_SharedTextureMemoryOpaqueFD + WGPUFeatureName_SharedTextureMemoryZirconHandle + WGPUFeatureName_SharedTextureMemoryDXGISharedHandle + WGPUFeatureName_SharedTextureMemoryD3D11Texture2D + WGPUFeatureName_SharedTextureMemoryIOSurface + WGPUFeatureName_SharedTextureMemoryEGLImage + WGPUFeatureName_SharedFenceVkSemaphoreOpaqueFD + WGPUFeatureName_SharedFenceSyncFD + WGPUFeatureName_SharedFenceVkSemaphoreZirconHandle + WGPUFeatureName_SharedFenceDXGISharedHandle + WGPUFeatureName_SharedFenceMTLSharedEvent + WGPUFeatureName_SharedBufferMemoryD3D12Resource + WGPUFeatureName_StaticSamplers + WGPUFeatureName_YCbCrVulkanSamplers + WGPUFeatureName_ShaderModuleCompilationOptions + WGPUFeatureName_DawnLoadResolveTexture + WGPUFeatureName_DawnPartialLoadResolveTexture + WGPUFeatureName_MultiDrawIndirect + WGPUFeatureName_DawnTexelCopyBufferRowAlignment + WGPUFeatureName_FlexibleTextureViews + WGPUFeatureName_ChromiumExperimentalSubgroupMatrix + WGPUFeatureName_SharedFenceEGLSync + WGPUFeatureName_DawnDeviceAllocatorControl + WGPUFeatureName_AdapterPropertiesWGPU + WGPUFeatureName_SharedBufferMemoryFromWindowsHandle + WGPUFeatureName_SharedTextureMemoryD3D12Resource + WGPUFeatureName_ChromiumExperimentalSamplingResourceTable + WGPUFeatureName_AtomicVec2uMinMax + WGPUFeatureName_Unorm16FormatsForExternalTexture + WGPUFeatureName_OpaqueYCbCrAndroidForExternalTexture + WGPUFeatureName_Unorm16Filterable + WGPUFeatureName_RenderPassRenderArea + WGPUFeatureName_AdapterPropertiesDrm + WGPUFeatureName_DawnAllowUndefinedLoadStoreOp + WGPUFeatureName_BufferMapWriteExtendedUsages + WGPUFeatureName_SharedBufferMemoryHostPointer + + ctypedef enum WGPUFilterMode: + WGPUFilterMode_Undefined + WGPUFilterMode_Nearest + WGPUFilterMode_Linear + + ctypedef enum WGPUFrontFace: + WGPUFrontFace_Undefined + WGPUFrontFace_CCW + WGPUFrontFace_CW + + ctypedef enum WGPUIndexFormat: + WGPUIndexFormat_Undefined + WGPUIndexFormat_Uint16 + WGPUIndexFormat_Uint32 + + ctypedef enum WGPUInstanceFeatureName: + WGPUInstanceFeatureName_TimedWaitAny + WGPUInstanceFeatureName_ShaderSourceSPIRV + WGPUInstanceFeatureName_MultipleDevicesPerAdapter + + ctypedef enum WGPULoadOp: + WGPULoadOp_Undefined + WGPULoadOp_Load + WGPULoadOp_Clear + WGPULoadOp_ExpandResolveTexture + + ctypedef enum WGPULoggingType: + WGPULoggingType_Verbose + WGPULoggingType_Info + WGPULoggingType_Warning + WGPULoggingType_Error + + ctypedef enum WGPUMapAsyncStatus: + WGPUMapAsyncStatus_Success + WGPUMapAsyncStatus_CallbackCancelled + WGPUMapAsyncStatus_Error + WGPUMapAsyncStatus_Aborted + + ctypedef enum WGPUMipmapFilterMode: + WGPUMipmapFilterMode_Undefined + WGPUMipmapFilterMode_Nearest + WGPUMipmapFilterMode_Linear + + ctypedef enum WGPUOptionalBool: + WGPUOptionalBool_False + WGPUOptionalBool_True + WGPUOptionalBool_Undefined + + ctypedef enum WGPUPopErrorScopeStatus: + WGPUPopErrorScopeStatus_Success + WGPUPopErrorScopeStatus_CallbackCancelled + WGPUPopErrorScopeStatus_Error + + ctypedef enum WGPUPowerPreference: + WGPUPowerPreference_Undefined + WGPUPowerPreference_LowPower + WGPUPowerPreference_HighPerformance + + ctypedef enum WGPUPredefinedColorSpace: + WGPUPredefinedColorSpace_SRGB + WGPUPredefinedColorSpace_DisplayP3 + WGPUPredefinedColorSpace_SRGBLinear + WGPUPredefinedColorSpace_DisplayP3Linear + WGPUPredefinedColorSpace_Rec2020Linear + + ctypedef enum WGPUPresentMode: + WGPUPresentMode_Undefined + WGPUPresentMode_Fifo + WGPUPresentMode_FifoRelaxed + WGPUPresentMode_Immediate + WGPUPresentMode_Mailbox + + ctypedef enum WGPUPrimitiveTopology: + WGPUPrimitiveTopology_Undefined + WGPUPrimitiveTopology_PointList + WGPUPrimitiveTopology_LineList + WGPUPrimitiveTopology_LineStrip + WGPUPrimitiveTopology_TriangleList + WGPUPrimitiveTopology_TriangleStrip + + ctypedef enum WGPUQueryType: + WGPUQueryType_Occlusion + WGPUQueryType_Timestamp + + ctypedef enum WGPUQueueWorkDoneStatus: + WGPUQueueWorkDoneStatus_Success + WGPUQueueWorkDoneStatus_CallbackCancelled + WGPUQueueWorkDoneStatus_Error + + ctypedef enum WGPURequestAdapterStatus: + WGPURequestAdapterStatus_Success + WGPURequestAdapterStatus_CallbackCancelled + WGPURequestAdapterStatus_Unavailable + WGPURequestAdapterStatus_Error + + ctypedef enum WGPURequestDeviceStatus: + WGPURequestDeviceStatus_Success + WGPURequestDeviceStatus_CallbackCancelled + WGPURequestDeviceStatus_Error + + ctypedef enum WGPUSamplerBindingType: + WGPUSamplerBindingType_BindingNotUsed + WGPUSamplerBindingType_Undefined + WGPUSamplerBindingType_Filtering + WGPUSamplerBindingType_NonFiltering + WGPUSamplerBindingType_Comparison + + ctypedef enum WGPUSharedFenceType: + WGPUSharedFenceType_VkSemaphoreOpaqueFD + WGPUSharedFenceType_SyncFD + WGPUSharedFenceType_VkSemaphoreZirconHandle + WGPUSharedFenceType_DXGISharedHandle + WGPUSharedFenceType_MTLSharedEvent + WGPUSharedFenceType_EGLSync + + ctypedef enum WGPUStatus: + WGPUStatus_Success + WGPUStatus_Error + + ctypedef enum WGPUStencilOperation: + WGPUStencilOperation_Undefined + WGPUStencilOperation_Keep + WGPUStencilOperation_Zero + WGPUStencilOperation_Replace + WGPUStencilOperation_Invert + WGPUStencilOperation_IncrementClamp + WGPUStencilOperation_DecrementClamp + WGPUStencilOperation_IncrementWrap + WGPUStencilOperation_DecrementWrap + + ctypedef enum WGPUStorageTextureAccess: + WGPUStorageTextureAccess_BindingNotUsed + WGPUStorageTextureAccess_Undefined + WGPUStorageTextureAccess_WriteOnly + WGPUStorageTextureAccess_ReadOnly + WGPUStorageTextureAccess_ReadWrite + + ctypedef enum WGPUStoreOp: + WGPUStoreOp_Undefined + WGPUStoreOp_Store + WGPUStoreOp_Discard + + ctypedef enum WGPUSType: + WGPUSType_ShaderSourceSPIRV + WGPUSType_ShaderSourceWGSL + WGPUSType_RenderPassMaxDrawCount + WGPUSType_SurfaceSourceMetalLayer + WGPUSType_SurfaceSourceWindowsHWND + WGPUSType_SurfaceSourceXlibWindow + WGPUSType_SurfaceSourceWaylandSurface + WGPUSType_SurfaceSourceAndroidNativeWindow + WGPUSType_SurfaceSourceXCBWindow + WGPUSType_SurfaceColorManagement + WGPUSType_RequestAdapterWebXROptions + WGPUSType_TextureComponentSwizzleDescriptor + WGPUSType_ExternalTextureBindingLayout + WGPUSType_ExternalTextureBindingEntry + WGPUSType_CompatibilityModeLimits + WGPUSType_TextureBindingViewDimension + WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector + WGPUSType_SurfaceDescriptorFromWindowsCoreWindow + WGPUSType_SurfaceDescriptorFromWindowsUWPSwapChainPanel + WGPUSType_DawnTextureInternalUsageDescriptor + WGPUSType_DawnEncoderInternalUsageDescriptor + WGPUSType_DawnInstanceDescriptor + WGPUSType_DawnCacheDeviceDescriptor + WGPUSType_DawnAdapterPropertiesPowerPreference + WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient + WGPUSType_DawnTogglesDescriptor + WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor + WGPUSType_RequestAdapterOptionsLUID + WGPUSType_RequestAdapterOptionsGetGLProc + WGPUSType_RequestAdapterOptionsD3D11Device + WGPUSType_DawnRenderPassSampleCount + WGPUSType_RenderPassPixelLocalStorage + WGPUSType_PipelineLayoutPixelLocalStorage + WGPUSType_BufferHostMappedPointer + WGPUSType_AdapterPropertiesMemoryHeaps + WGPUSType_AdapterPropertiesD3D + WGPUSType_AdapterPropertiesVk + WGPUSType_DawnWireWGSLControl + WGPUSType_DawnWGSLBlocklist + WGPUSType_DawnDrmFormatCapabilities + WGPUSType_ShaderModuleCompilationOptions + WGPUSType_ColorTargetStateExpandResolveTextureDawn + WGPUSType_RenderPassRenderAreaRect + WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor + WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor + WGPUSType_SharedTextureMemoryDmaBufDescriptor + WGPUSType_SharedTextureMemoryOpaqueFDDescriptor + WGPUSType_SharedTextureMemoryZirconHandleDescriptor + WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor + WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor + WGPUSType_SharedTextureMemoryIOSurfaceDescriptor + WGPUSType_SharedTextureMemoryEGLImageDescriptor + WGPUSType_SharedTextureMemoryInitializedBeginState + WGPUSType_SharedTextureMemoryInitializedEndState + WGPUSType_SharedTextureMemoryVkImageLayoutBeginState + WGPUSType_SharedTextureMemoryVkImageLayoutEndState + WGPUSType_SharedTextureMemoryD3DSwapchainBeginState + WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor + WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo + WGPUSType_SharedFenceSyncFDDescriptor + WGPUSType_SharedFenceSyncFDExportInfo + WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor + WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo + WGPUSType_SharedFenceDXGISharedHandleDescriptor + WGPUSType_SharedFenceDXGISharedHandleExportInfo + WGPUSType_SharedFenceMTLSharedEventDescriptor + WGPUSType_SharedFenceMTLSharedEventExportInfo + WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor + WGPUSType_StaticSamplerBindingLayout + WGPUSType_YCbCrVkDescriptor + WGPUSType_SharedTextureMemoryAHardwareBufferProperties + WGPUSType_AHardwareBufferProperties + WGPUSType_DawnTexelCopyBufferRowAlignmentLimits + WGPUSType_AdapterPropertiesSubgroupMatrixConfigs + WGPUSType_SharedFenceEGLSyncDescriptor + WGPUSType_SharedFenceEGLSyncExportInfo + WGPUSType_DawnInjectedInvalidSType + WGPUSType_DawnCompilationMessageUtf16 + WGPUSType_DawnFakeBufferOOMForTesting + WGPUSType_SurfaceDescriptorFromWindowsWinUISwapChainPanel + WGPUSType_DawnDeviceAllocatorControl + WGPUSType_DawnHostMappedPointerLimits + WGPUSType_RenderPassDescriptorResolveRect + WGPUSType_RequestAdapterWebGPUBackendOptions + WGPUSType_DawnFakeDeviceInitializeErrorForTesting + WGPUSType_SharedTextureMemoryD3D11BeginState + WGPUSType_DawnConsumeAdapterDescriptor + WGPUSType_TexelBufferBindingEntry + WGPUSType_TexelBufferBindingLayout + WGPUSType_SharedTextureMemoryMetalEndAccessState + WGPUSType_AdapterPropertiesWGPU + WGPUSType_SharedBufferMemoryFromWindowsHandleDescriptor + WGPUSType_SharedTextureMemoryD3D12ResourceDescriptor + WGPUSType_RequestAdapterOptionsAngleVirtualizationGroup + WGPUSType_PipelineLayoutResourceTable + WGPUSType_AdapterPropertiesDrm + WGPUSType_RenderBundleEncoderResourceTable + WGPUSType_DawnShaderSourceSPIRV + WGPUSType_SharedBufferMemoryHostPointerDescriptor + + ctypedef enum WGPUSubgroupMatrixComponentType: + WGPUSubgroupMatrixComponentType_F32 + WGPUSubgroupMatrixComponentType_F16 + WGPUSubgroupMatrixComponentType_U32 + WGPUSubgroupMatrixComponentType_I32 + WGPUSubgroupMatrixComponentType_U8 + WGPUSubgroupMatrixComponentType_I8 + + ctypedef enum WGPUSurfaceGetCurrentTextureStatus: + WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal + WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal + WGPUSurfaceGetCurrentTextureStatus_Timeout + WGPUSurfaceGetCurrentTextureStatus_Outdated + WGPUSurfaceGetCurrentTextureStatus_Lost + WGPUSurfaceGetCurrentTextureStatus_Error + + ctypedef enum WGPUTexelBufferAccess: + WGPUTexelBufferAccess_Undefined + WGPUTexelBufferAccess_ReadOnly + WGPUTexelBufferAccess_ReadWrite + + ctypedef enum WGPUTextureAspect: + WGPUTextureAspect_Undefined + WGPUTextureAspect_All + WGPUTextureAspect_StencilOnly + WGPUTextureAspect_DepthOnly + WGPUTextureAspect_Plane0Only + WGPUTextureAspect_Plane1Only + WGPUTextureAspect_Plane2Only + + ctypedef enum WGPUTextureDimension: + WGPUTextureDimension_Undefined + WGPUTextureDimension_1D + WGPUTextureDimension_2D + WGPUTextureDimension_3D + + ctypedef enum WGPUTextureFormat: + WGPUTextureFormat_Undefined + WGPUTextureFormat_R8Unorm + WGPUTextureFormat_R8Snorm + WGPUTextureFormat_R8Uint + WGPUTextureFormat_R8Sint + WGPUTextureFormat_R16Unorm + WGPUTextureFormat_R16Snorm + WGPUTextureFormat_R16Uint + WGPUTextureFormat_R16Sint + WGPUTextureFormat_R16Float + WGPUTextureFormat_RG8Unorm + WGPUTextureFormat_RG8Snorm + WGPUTextureFormat_RG8Uint + WGPUTextureFormat_RG8Sint + WGPUTextureFormat_R32Float + WGPUTextureFormat_R32Uint + WGPUTextureFormat_R32Sint + WGPUTextureFormat_RG16Unorm + WGPUTextureFormat_RG16Snorm + WGPUTextureFormat_RG16Uint + WGPUTextureFormat_RG16Sint + WGPUTextureFormat_RG16Float + WGPUTextureFormat_RGBA8Unorm + WGPUTextureFormat_RGBA8UnormSrgb + WGPUTextureFormat_RGBA8Snorm + WGPUTextureFormat_RGBA8Uint + WGPUTextureFormat_RGBA8Sint + WGPUTextureFormat_BGRA8Unorm + WGPUTextureFormat_BGRA8UnormSrgb + WGPUTextureFormat_RGB10A2Uint + WGPUTextureFormat_RGB10A2Unorm + WGPUTextureFormat_RG11B10Ufloat + WGPUTextureFormat_RGB9E5Ufloat + WGPUTextureFormat_RG32Float + WGPUTextureFormat_RG32Uint + WGPUTextureFormat_RG32Sint + WGPUTextureFormat_RGBA16Unorm + WGPUTextureFormat_RGBA16Snorm + WGPUTextureFormat_RGBA16Uint + WGPUTextureFormat_RGBA16Sint + WGPUTextureFormat_RGBA16Float + WGPUTextureFormat_RGBA32Float + WGPUTextureFormat_RGBA32Uint + WGPUTextureFormat_RGBA32Sint + WGPUTextureFormat_Stencil8 + WGPUTextureFormat_Depth16Unorm + WGPUTextureFormat_Depth24Plus + WGPUTextureFormat_Depth24PlusStencil8 + WGPUTextureFormat_Depth32Float + WGPUTextureFormat_Depth32FloatStencil8 + WGPUTextureFormat_BC1RGBAUnorm + WGPUTextureFormat_BC1RGBAUnormSrgb + WGPUTextureFormat_BC2RGBAUnorm + WGPUTextureFormat_BC2RGBAUnormSrgb + WGPUTextureFormat_BC3RGBAUnorm + WGPUTextureFormat_BC3RGBAUnormSrgb + WGPUTextureFormat_BC4RUnorm + WGPUTextureFormat_BC4RSnorm + WGPUTextureFormat_BC5RGUnorm + WGPUTextureFormat_BC5RGSnorm + WGPUTextureFormat_BC6HRGBUfloat + WGPUTextureFormat_BC6HRGBFloat + WGPUTextureFormat_BC7RGBAUnorm + WGPUTextureFormat_BC7RGBAUnormSrgb + WGPUTextureFormat_ETC2RGB8Unorm + WGPUTextureFormat_ETC2RGB8UnormSrgb + WGPUTextureFormat_ETC2RGB8A1Unorm + WGPUTextureFormat_ETC2RGB8A1UnormSrgb + WGPUTextureFormat_ETC2RGBA8Unorm + WGPUTextureFormat_ETC2RGBA8UnormSrgb + WGPUTextureFormat_EACR11Unorm + WGPUTextureFormat_EACR11Snorm + WGPUTextureFormat_EACRG11Unorm + WGPUTextureFormat_EACRG11Snorm + WGPUTextureFormat_ASTC4x4Unorm + WGPUTextureFormat_ASTC4x4UnormSrgb + WGPUTextureFormat_ASTC5x4Unorm + WGPUTextureFormat_ASTC5x4UnormSrgb + WGPUTextureFormat_ASTC5x5Unorm + WGPUTextureFormat_ASTC5x5UnormSrgb + WGPUTextureFormat_ASTC6x5Unorm + WGPUTextureFormat_ASTC6x5UnormSrgb + WGPUTextureFormat_ASTC6x6Unorm + WGPUTextureFormat_ASTC6x6UnormSrgb + WGPUTextureFormat_ASTC8x5Unorm + WGPUTextureFormat_ASTC8x5UnormSrgb + WGPUTextureFormat_ASTC8x6Unorm + WGPUTextureFormat_ASTC8x6UnormSrgb + WGPUTextureFormat_ASTC8x8Unorm + WGPUTextureFormat_ASTC8x8UnormSrgb + WGPUTextureFormat_ASTC10x5Unorm + WGPUTextureFormat_ASTC10x5UnormSrgb + WGPUTextureFormat_ASTC10x6Unorm + WGPUTextureFormat_ASTC10x6UnormSrgb + WGPUTextureFormat_ASTC10x8Unorm + WGPUTextureFormat_ASTC10x8UnormSrgb + WGPUTextureFormat_ASTC10x10Unorm + WGPUTextureFormat_ASTC10x10UnormSrgb + WGPUTextureFormat_ASTC12x10Unorm + WGPUTextureFormat_ASTC12x10UnormSrgb + WGPUTextureFormat_ASTC12x12Unorm + WGPUTextureFormat_ASTC12x12UnormSrgb + WGPUTextureFormat_R8BG8Biplanar420Unorm + WGPUTextureFormat_R10X6BG10X6Biplanar420Unorm + WGPUTextureFormat_R8BG8A8Triplanar420Unorm + WGPUTextureFormat_R8BG8Biplanar422Unorm + WGPUTextureFormat_R8BG8Biplanar444Unorm + WGPUTextureFormat_R10X6BG10X6Biplanar422Unorm + WGPUTextureFormat_R10X6BG10X6Biplanar444Unorm + WGPUTextureFormat_OpaqueYCbCrAndroid + + ctypedef enum WGPUTextureSampleType: + WGPUTextureSampleType_BindingNotUsed + WGPUTextureSampleType_Undefined + WGPUTextureSampleType_Float + WGPUTextureSampleType_UnfilterableFloat + WGPUTextureSampleType_Depth + WGPUTextureSampleType_Sint + WGPUTextureSampleType_Uint + + ctypedef enum WGPUTextureViewDimension: + WGPUTextureViewDimension_Undefined + WGPUTextureViewDimension_1D + WGPUTextureViewDimension_2D + WGPUTextureViewDimension_2DArray + WGPUTextureViewDimension_Cube + WGPUTextureViewDimension_CubeArray + WGPUTextureViewDimension_3D + + ctypedef enum WGPUToneMappingMode: + WGPUToneMappingMode_Standard + WGPUToneMappingMode_Extended + + ctypedef enum WGPUVertexFormat: + WGPUVertexFormat_Uint8 + WGPUVertexFormat_Uint8x2 + WGPUVertexFormat_Uint8x4 + WGPUVertexFormat_Sint8 + WGPUVertexFormat_Sint8x2 + WGPUVertexFormat_Sint8x4 + WGPUVertexFormat_Unorm8 + WGPUVertexFormat_Unorm8x2 + WGPUVertexFormat_Unorm8x4 + WGPUVertexFormat_Snorm8 + WGPUVertexFormat_Snorm8x2 + WGPUVertexFormat_Snorm8x4 + WGPUVertexFormat_Uint16 + WGPUVertexFormat_Uint16x2 + WGPUVertexFormat_Uint16x4 + WGPUVertexFormat_Sint16 + WGPUVertexFormat_Sint16x2 + WGPUVertexFormat_Sint16x4 + WGPUVertexFormat_Unorm16 + WGPUVertexFormat_Unorm16x2 + WGPUVertexFormat_Unorm16x4 + WGPUVertexFormat_Snorm16 + WGPUVertexFormat_Snorm16x2 + WGPUVertexFormat_Snorm16x4 + WGPUVertexFormat_Float16 + WGPUVertexFormat_Float16x2 + WGPUVertexFormat_Float16x4 + WGPUVertexFormat_Float32 + WGPUVertexFormat_Float32x2 + WGPUVertexFormat_Float32x3 + WGPUVertexFormat_Float32x4 + WGPUVertexFormat_Uint32 + WGPUVertexFormat_Uint32x2 + WGPUVertexFormat_Uint32x3 + WGPUVertexFormat_Uint32x4 + WGPUVertexFormat_Sint32 + WGPUVertexFormat_Sint32x2 + WGPUVertexFormat_Sint32x3 + WGPUVertexFormat_Sint32x4 + WGPUVertexFormat_Unorm10_10_10_2 + WGPUVertexFormat_Unorm8x4BGRA + WGPUVertexFormat_Snorm10_10_10_2 + + ctypedef enum WGPUVertexStepMode: + WGPUVertexStepMode_Undefined + WGPUVertexStepMode_Vertex + WGPUVertexStepMode_Instance + + ctypedef enum WGPUWaitStatus: + WGPUWaitStatus_Success + WGPUWaitStatus_TimedOut + WGPUWaitStatus_Error + + ctypedef enum WGPUWGSLLanguageFeatureName: + WGPUWGSLLanguageFeatureName_ReadonlyAndReadwriteStorageTextures + WGPUWGSLLanguageFeatureName_Packed4x8IntegerDotProduct + WGPUWGSLLanguageFeatureName_UnrestrictedPointerParameters + WGPUWGSLLanguageFeatureName_PointerCompositeAccess + WGPUWGSLLanguageFeatureName_UniformBufferStandardLayout + WGPUWGSLLanguageFeatureName_SubgroupId + WGPUWGSLLanguageFeatureName_TextureAndSamplerLet + WGPUWGSLLanguageFeatureName_SubgroupUniformity + WGPUWGSLLanguageFeatureName_TextureFormatsTier1 + WGPUWGSLLanguageFeatureName_LinearIndexing + WGPUWGSLLanguageFeatureName_ImmediateAddressSpace + WGPUWGSLLanguageFeatureName_BufferView + WGPUWGSLLanguageFeatureName_SwizzleAssignment + WGPUWGSLLanguageFeatureName_FragmentDepth + WGPUWGSLLanguageFeatureName_ChromiumTestingUnimplemented + WGPUWGSLLanguageFeatureName_ChromiumTestingUnsafeExperimental + WGPUWGSLLanguageFeatureName_ChromiumTestingExperimental + WGPUWGSLLanguageFeatureName_ChromiumTestingShippedWithKillswitch + WGPUWGSLLanguageFeatureName_ChromiumTestingShipped + WGPUWGSLLanguageFeatureName_SizedBindingArray + WGPUWGSLLanguageFeatureName_TexelBuffers + WGPUWGSLLanguageFeatureName_ChromiumPrint + WGPUWGSLLanguageFeatureName_MultisampledArrayTextures + + # %% Flags + + ctypedef WGPUFlags WGPUBufferUsage + const WGPUBufferUsage WGPUBufferUsage_None + const WGPUBufferUsage WGPUBufferUsage_MapRead + const WGPUBufferUsage WGPUBufferUsage_MapWrite + const WGPUBufferUsage WGPUBufferUsage_CopySrc + const WGPUBufferUsage WGPUBufferUsage_CopyDst + const WGPUBufferUsage WGPUBufferUsage_Index + const WGPUBufferUsage WGPUBufferUsage_Vertex + const WGPUBufferUsage WGPUBufferUsage_Uniform + const WGPUBufferUsage WGPUBufferUsage_Storage + const WGPUBufferUsage WGPUBufferUsage_Indirect + const WGPUBufferUsage WGPUBufferUsage_QueryResolve + const WGPUBufferUsage WGPUBufferUsage_TexelBuffer + ctypedef WGPUFlags WGPUColorWriteMask + const WGPUColorWriteMask WGPUColorWriteMask_None + const WGPUColorWriteMask WGPUColorWriteMask_Red + const WGPUColorWriteMask WGPUColorWriteMask_Green + const WGPUColorWriteMask WGPUColorWriteMask_Blue + const WGPUColorWriteMask WGPUColorWriteMask_Alpha + const WGPUColorWriteMask WGPUColorWriteMask_All + ctypedef WGPUFlags WGPUHeapProperty + const WGPUHeapProperty WGPUHeapProperty_None + const WGPUHeapProperty WGPUHeapProperty_DeviceLocal + const WGPUHeapProperty WGPUHeapProperty_HostVisible + const WGPUHeapProperty WGPUHeapProperty_HostCoherent + const WGPUHeapProperty WGPUHeapProperty_HostUncached + const WGPUHeapProperty WGPUHeapProperty_HostCached + ctypedef WGPUFlags WGPUMapMode + const WGPUMapMode WGPUMapMode_None + const WGPUMapMode WGPUMapMode_Read + const WGPUMapMode WGPUMapMode_Write + ctypedef WGPUFlags WGPUShaderStage + const WGPUShaderStage WGPUShaderStage_None + const WGPUShaderStage WGPUShaderStage_Vertex + const WGPUShaderStage WGPUShaderStage_Fragment + const WGPUShaderStage WGPUShaderStage_Compute + ctypedef WGPUFlags WGPUTextureUsage + const WGPUTextureUsage WGPUTextureUsage_None + const WGPUTextureUsage WGPUTextureUsage_CopySrc + const WGPUTextureUsage WGPUTextureUsage_CopyDst + const WGPUTextureUsage WGPUTextureUsage_TextureBinding + const WGPUTextureUsage WGPUTextureUsage_StorageBinding + const WGPUTextureUsage WGPUTextureUsage_RenderAttachment + const WGPUTextureUsage WGPUTextureUsage_TransientAttachment + const WGPUTextureUsage WGPUTextureUsage_StorageAttachment + + # %% Struct forward declarations + + cdef struct WGPUAHardwareBufferProperties + cdef struct WGPUAdapterInfo + cdef struct WGPUAdapterPropertiesD3D + cdef struct WGPUAdapterPropertiesDrm + cdef struct WGPUAdapterPropertiesMemoryHeaps + cdef struct WGPUAdapterPropertiesSubgroupMatrixConfigs + cdef struct WGPUAdapterPropertiesVk + cdef struct WGPUAdapterPropertiesWGPU + cdef struct WGPUBindGroupDescriptor + cdef struct WGPUBindGroupEntry + cdef struct WGPUBindGroupLayoutDescriptor + cdef struct WGPUBindGroupLayoutEntry + cdef struct WGPUBindingResource + cdef struct WGPUBlendComponent + cdef struct WGPUBlendState + cdef struct WGPUBufferBindingLayout + cdef struct WGPUBufferDescriptor + cdef struct WGPUBufferHostMappedPointer + cdef struct WGPUBufferMapCallbackInfo + cdef struct WGPUChainedStruct + cdef struct WGPUColor + cdef struct WGPUColorSpaceDawn + cdef struct WGPUColorTargetState + cdef struct WGPUColorTargetStateExpandResolveTextureDawn + cdef struct WGPUCommandBufferDescriptor + cdef struct WGPUCommandEncoderDescriptor + cdef struct WGPUCompatibilityModeLimits + cdef struct WGPUCompilationInfo + cdef struct WGPUCompilationInfoCallbackInfo + cdef struct WGPUCompilationMessage + cdef struct WGPUComputePassDescriptor + cdef struct WGPUComputePipelineDescriptor + cdef struct WGPUComputeState + cdef struct WGPUConstantEntry + cdef struct WGPUCopyTextureForBrowserOptions + cdef struct WGPUCreateComputePipelineAsyncCallbackInfo + cdef struct WGPUCreateRenderPipelineAsyncCallbackInfo + cdef struct WGPUDawnAdapterPropertiesPowerPreference + cdef struct WGPUDawnBufferDescriptorErrorInfoFromWireClient + cdef struct WGPUDawnCacheDeviceDescriptor + cdef struct WGPUDawnCompilationMessageUtf16 + cdef struct WGPUDawnConsumeAdapterDescriptor + cdef struct WGPUDawnDeviceAllocatorControl + cdef struct WGPUDawnDrmFormatCapabilities + cdef struct WGPUDawnDrmFormatProperties + cdef struct WGPUDawnEncoderInternalUsageDescriptor + cdef struct WGPUDawnFakeBufferOOMForTesting + cdef struct WGPUDawnFakeDeviceInitializeErrorForTesting + cdef struct WGPUDawnFormatCapabilities + cdef struct WGPUDawnHostMappedPointerLimits + cdef struct WGPUDawnInjectedInvalidSType + cdef struct WGPUDawnLoadCacheDataCallbackInfo + cdef struct WGPUDawnRenderPassSampleCount + cdef struct WGPUDawnShaderModuleSPIRVOptionsDescriptor + cdef struct WGPUDawnShaderSourceSPIRV + cdef struct WGPUDawnStoreCacheDataCallbackInfo + cdef struct WGPUDawnTexelCopyBufferRowAlignmentLimits + cdef struct WGPUDawnTextureInternalUsageDescriptor + cdef struct WGPUDawnTogglesDescriptor + cdef struct WGPUDawnWGSLBlocklist + cdef struct WGPUDawnWireWGSLControl + cdef struct WGPUDepthStencilState + cdef struct WGPUDeviceDescriptor + cdef struct WGPUDeviceLostCallbackInfo + cdef struct WGPUDisposeCallbackInfo + cdef struct WGPUEmscriptenSurfaceSourceCanvasHTMLSelector + cdef struct WGPUExtent2D + cdef struct WGPUExtent3D + cdef struct WGPUExternalTextureBindingEntry + cdef struct WGPUExternalTextureBindingLayout + cdef struct WGPUExternalTextureDescriptor + cdef struct WGPUFragmentState + cdef struct WGPUFuture + cdef struct WGPUFutureWaitInfo + cdef struct WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER + cdef struct WGPUImageCopyExternalTexture + cdef struct WGPUInstanceDescriptor + cdef struct WGPUInstanceLimits + cdef struct WGPULimits + cdef struct WGPULoggingCallbackInfo + cdef struct WGPUMemoryHeapInfo + cdef struct WGPUMultisampleState + cdef struct WGPUOrigin2D + cdef struct WGPUOrigin3D + cdef struct WGPUPassTimestampWrites + cdef struct WGPUPipelineLayoutDescriptor + cdef struct WGPUPipelineLayoutPixelLocalStorage + cdef struct WGPUPipelineLayoutResourceTable + cdef struct WGPUPipelineLayoutStorageAttachment + cdef struct WGPUPopErrorScopeCallbackInfo + cdef struct WGPUPrimitiveState + cdef struct WGPUQuerySetDescriptor + cdef struct WGPUQueueDescriptor + cdef struct WGPUQueueWorkDoneCallbackInfo + cdef struct WGPURenderBundleDescriptor + cdef struct WGPURenderBundleEncoderDescriptor + cdef struct WGPURenderBundleEncoderResourceTable + cdef struct WGPURenderPassColorAttachment + cdef struct WGPURenderPassDepthStencilAttachment + cdef struct WGPURenderPassDescriptor + cdef struct WGPURenderPassDescriptorResolveRect + cdef struct WGPURenderPassMaxDrawCount + cdef struct WGPURenderPassPixelLocalStorage + cdef struct WGPURenderPassRenderAreaRect + cdef struct WGPURenderPassStorageAttachment + cdef struct WGPURenderPipelineDescriptor + cdef struct WGPURequestAdapterCallbackInfo + cdef struct WGPURequestAdapterOptions + cdef struct WGPURequestAdapterWebGPUBackendOptions + cdef struct WGPURequestAdapterWebXROptions + cdef struct WGPURequestDeviceCallbackInfo + cdef struct WGPUResourceTableDescriptor + cdef struct WGPUSamplerBindingLayout + cdef struct WGPUSamplerDescriptor + cdef struct WGPUShaderModuleCompilationOptions + cdef struct WGPUShaderModuleDescriptor + cdef struct WGPUShaderSourceSPIRV + cdef struct WGPUShaderSourceWGSL + cdef struct WGPUSharedBufferMemoryBeginAccessDescriptor + cdef struct WGPUSharedBufferMemoryDescriptor + cdef struct WGPUSharedBufferMemoryEndAccessState + cdef struct WGPUSharedBufferMemoryFromWindowsHandleDescriptor + cdef struct WGPUSharedBufferMemoryHostPointerDescriptor + cdef struct WGPUSharedBufferMemoryProperties + cdef struct WGPUSharedFenceDXGISharedHandleDescriptor + cdef struct WGPUSharedFenceDXGISharedHandleExportInfo + cdef struct WGPUSharedFenceDescriptor + cdef struct WGPUSharedFenceEGLSyncDescriptor + cdef struct WGPUSharedFenceEGLSyncExportInfo + cdef struct WGPUSharedFenceExportInfo + cdef struct WGPUSharedFenceMTLSharedEventDescriptor + cdef struct WGPUSharedFenceMTLSharedEventExportInfo + cdef struct WGPUSharedFenceSyncFDDescriptor + cdef struct WGPUSharedFenceSyncFDExportInfo + cdef struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor + cdef struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo + cdef struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor + cdef struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo + cdef struct WGPUSharedTextureMemoryAHardwareBufferDescriptor + cdef struct WGPUSharedTextureMemoryAHardwareBufferProperties + cdef struct WGPUSharedTextureMemoryBeginAccessDescriptor + cdef struct WGPUSharedTextureMemoryD3D11BeginState + cdef struct WGPUSharedTextureMemoryD3DSwapchainBeginState + cdef struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor + cdef struct WGPUSharedTextureMemoryDescriptor + cdef struct WGPUSharedTextureMemoryDmaBufDescriptor + cdef struct WGPUSharedTextureMemoryDmaBufPlane + cdef struct WGPUSharedTextureMemoryEGLImageDescriptor + cdef struct WGPUSharedTextureMemoryEndAccessState + cdef struct WGPUSharedTextureMemoryIOSurfaceDescriptor + cdef struct WGPUSharedTextureMemoryMetalEndAccessState + cdef struct WGPUSharedTextureMemoryOpaqueFDDescriptor + cdef struct WGPUSharedTextureMemoryProperties + cdef struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor + cdef struct WGPUSharedTextureMemoryVkImageLayoutBeginState + cdef struct WGPUSharedTextureMemoryVkImageLayoutEndState + cdef struct WGPUSharedTextureMemoryZirconHandleDescriptor + cdef struct WGPUStaticSamplerBindingLayout + cdef struct WGPUStencilFaceState + cdef struct WGPUStorageTextureBindingLayout + cdef struct WGPUStringView + cdef struct WGPUSubgroupMatrixConfig + cdef struct WGPUSupportedFeatures + cdef struct WGPUSupportedInstanceFeatures + cdef struct WGPUSupportedWGSLLanguageFeatures + cdef struct WGPUSurfaceCapabilities + cdef struct WGPUSurfaceColorManagement + cdef struct WGPUSurfaceConfiguration + cdef struct WGPUSurfaceDescriptor + cdef struct WGPUSurfaceDescriptorFromWindowsCoreWindow + cdef struct WGPUSurfaceDescriptorFromWindowsUWPSwapChainPanel + cdef struct WGPUSurfaceDescriptorFromWindowsWinUISwapChainPanel + cdef struct WGPUSurfaceSourceAndroidNativeWindow + cdef struct WGPUSurfaceSourceMetalLayer + cdef struct WGPUSurfaceSourceWaylandSurface + cdef struct WGPUSurfaceSourceWindowsHWND + cdef struct WGPUSurfaceSourceXCBWindow + cdef struct WGPUSurfaceSourceXlibWindow + cdef struct WGPUSurfaceTexture + cdef struct WGPUTexelBufferBindingEntry + cdef struct WGPUTexelBufferBindingLayout + cdef struct WGPUTexelBufferViewDescriptor + cdef struct WGPUTexelCopyBufferInfo + cdef struct WGPUTexelCopyBufferLayout + cdef struct WGPUTexelCopyTextureInfo + cdef struct WGPUTextureBindingLayout + cdef struct WGPUTextureBindingViewDimension + cdef struct WGPUTextureComponentSwizzle + cdef struct WGPUTextureComponentSwizzleDescriptor + cdef struct WGPUTextureDescriptor + cdef struct WGPUTextureViewDescriptor + cdef struct WGPUUncapturedErrorCallbackInfo + cdef struct WGPUVertexAttribute + cdef struct WGPUVertexBufferLayout + cdef struct WGPUVertexState + cdef struct WGPUYCbCrVkDescriptor + + # %% Callbacks + + ctypedef void (*WGPUCallback)(void* userdata) noexcept + ctypedef size_t (*WGPUDawnLoadCacheDataFunction)(const void* key, size_t keySize, void* value, size_t valueSize, void* userdata) noexcept + ctypedef void (*WGPUDawnStoreCacheDataFunction)(const void* key, size_t keySize, const void* value, size_t valueSize, void* userdata) noexcept + ctypedef void (*WGPUProc)() noexcept + ctypedef void (*WGPUBufferMapCallback)(WGPUMapAsyncStatus status, WGPUStringView message, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPUCompilationInfoCallback)(WGPUCompilationInfoRequestStatus status, const WGPUCompilationInfo* compilationInfo, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPUCreateComputePipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, WGPUStringView message, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPUCreateRenderPipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, WGPUStringView message, void* userdata1, void* userdata2) noexcept + ctypedef size_t (*WGPUDawnLoadCacheDataCallback)(size_t keySize, const uint8_t* key, size_t valueSize, uint8_t* value, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPUDawnStoreCacheDataCallback)(size_t keySize, const uint8_t* key, size_t valueSize, const uint8_t* value, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPUDeviceLostCallback)(const WGPUDevice* device, WGPUDeviceLostReason reason, WGPUStringView message, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPUDisposeCallback)(WGPUCallbackStatus status, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPULoggingCallback)(WGPULoggingType type, WGPUStringView message, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPUPopErrorScopeCallback)(WGPUPopErrorScopeStatus status, WGPUErrorType type, WGPUStringView message, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPUQueueWorkDoneCallback)(WGPUQueueWorkDoneStatus status, WGPUStringView message, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPUAdapter adapter, WGPUStringView message, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, WGPUStringView message, void* userdata1, void* userdata2) noexcept + ctypedef void (*WGPUUncapturedErrorCallback)(const WGPUDevice* device, WGPUErrorType type, WGPUStringView message, void* userdata1, void* userdata2) noexcept + + # %% Structs + + cdef struct WGPUStringView: + const char* data + size_t length + + cdef struct WGPUChainedStruct: + WGPUChainedStruct* next + WGPUSType sType + + cdef struct WGPUBufferMapCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUCallbackMode mode + WGPUBufferMapCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUCompilationInfoCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUCallbackMode mode + WGPUCompilationInfoCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUCreateComputePipelineAsyncCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUCallbackMode mode + WGPUCreateComputePipelineAsyncCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUCreateRenderPipelineAsyncCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUCallbackMode mode + WGPUCreateRenderPipelineAsyncCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUDawnLoadCacheDataCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUDawnLoadCacheDataCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUDawnStoreCacheDataCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUDawnStoreCacheDataCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUDeviceLostCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUCallbackMode mode + WGPUDeviceLostCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUDisposeCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUCallbackMode mode + WGPUDisposeCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPULoggingCallbackInfo: + WGPUChainedStruct* nextInChain + WGPULoggingCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUPopErrorScopeCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUCallbackMode mode + WGPUPopErrorScopeCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUQueueWorkDoneCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUCallbackMode mode + WGPUQueueWorkDoneCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPURequestAdapterCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUCallbackMode mode + WGPURequestAdapterCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPURequestDeviceCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUCallbackMode mode + WGPURequestDeviceCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUUncapturedErrorCallbackInfo: + WGPUChainedStruct* nextInChain + WGPUUncapturedErrorCallback callback + void* userdata1 + void* userdata2 + + cdef struct WGPUAdapterPropertiesD3D: + WGPUChainedStruct chain + uint32_t shaderModel + uint32_t adapterLUIDLowPart + uint32_t adapterLUIDHighPart + + cdef struct WGPUAdapterPropertiesDrm: + WGPUChainedStruct chain + WGPUBool hasPrimary + WGPUBool hasRender + uint64_t primaryMajor + uint64_t primaryMinor + uint64_t renderMajor + uint64_t renderMinor + + cdef struct WGPUAdapterPropertiesVk: + WGPUChainedStruct chain + uint32_t driverVersion + + cdef struct WGPUAdapterPropertiesWGPU: + WGPUChainedStruct chain + WGPUBackendType backendType + + cdef struct WGPUBindingResource: + WGPUChainedStruct* nextInChain + WGPUBuffer buffer + uint64_t offset + uint64_t size + WGPUSampler sampler + WGPUTextureView textureView + + cdef struct WGPUBlendComponent: + WGPUBlendOperation operation + WGPUBlendFactor srcFactor + WGPUBlendFactor dstFactor + + cdef struct WGPUBufferBindingLayout: + WGPUChainedStruct* nextInChain + WGPUBufferBindingType type + WGPUBool hasDynamicOffset + uint64_t minBindingSize + + cdef struct WGPUBufferHostMappedPointer: + WGPUChainedStruct chain + void* pointer + WGPUCallback disposeCallback + void* userdata + + cdef struct WGPUColor: + double r + double g + double b + double a + + cdef struct WGPUColorSpaceDawn: + WGPUChainedStruct* nextInChain + WGPUColorSpacePrimariesDawn primaries + WGPUColorSpaceTransferDawn transfer + WGPUColorSpaceYCbCrRangeDawn yCbCrRange + WGPUColorSpaceYCbCrMatrixDawn yCbCrMatrix + float hdrReferenceWhiteLuminance + + cdef struct WGPUColorTargetStateExpandResolveTextureDawn: + WGPUChainedStruct chain + WGPUBool enabled + + cdef struct WGPUCommandBufferDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + + cdef struct WGPUCompatibilityModeLimits: + WGPUChainedStruct chain + uint32_t maxStorageBuffersInVertexStage + uint32_t maxStorageTexturesInVertexStage + uint32_t maxStorageBuffersInFragmentStage + uint32_t maxStorageTexturesInFragmentStage + + cdef struct WGPUConstantEntry: + WGPUChainedStruct* nextInChain + WGPUStringView key + double value + + cdef struct WGPUCopyTextureForBrowserOptions: + WGPUChainedStruct* nextInChain + WGPUBool flipY + WGPUBool needsColorSpaceConversion + WGPUAlphaMode srcAlphaMode + const float* srcTransferFunctionParameters + const float* conversionMatrix + const float* dstTransferFunctionParameters + WGPUAlphaMode dstAlphaMode + WGPUBool internalUsage + + cdef struct WGPUDawnAdapterPropertiesPowerPreference: + WGPUChainedStruct chain + WGPUPowerPreference powerPreference + + cdef struct WGPUDawnBufferDescriptorErrorInfoFromWireClient: + WGPUChainedStruct chain + WGPUBool outOfMemory + + cdef struct WGPUDawnCacheDeviceDescriptor: + WGPUChainedStruct chain + WGPUStringView isolationKey + WGPUDawnLoadCacheDataCallbackInfo dawnLoadCacheDataCallbackInfo + WGPUDawnStoreCacheDataCallbackInfo dawnStoreCacheDataCallbackInfo + + cdef struct WGPUDawnCompilationMessageUtf16: + WGPUChainedStruct chain + uint64_t linePos + uint64_t offset + uint64_t length + + cdef struct WGPUDawnConsumeAdapterDescriptor: + WGPUChainedStruct chain + WGPUBool consumeAdapter + + cdef struct WGPUDawnDeviceAllocatorControl: + WGPUChainedStruct chain + size_t allocatorHeapBlockSize + + cdef struct WGPUDawnDrmFormatProperties: + uint64_t modifier + uint32_t modifierPlaneCount + + cdef struct WGPUDawnEncoderInternalUsageDescriptor: + WGPUChainedStruct chain + WGPUBool useInternalUsages + + cdef struct WGPUDawnFakeBufferOOMForTesting: + WGPUChainedStruct chain + WGPUBool fakeOOMAtWireClientMap + WGPUBool fakeOOMAtNativeMap + WGPUBool fakeOOMAtDevice + + cdef struct WGPUDawnFakeDeviceInitializeErrorForTesting: + WGPUChainedStruct chain + + cdef struct WGPUDawnHostMappedPointerLimits: + WGPUChainedStruct chain + uint32_t hostMappedPointerAlignment + + cdef struct WGPUDawnInjectedInvalidSType: + WGPUChainedStruct chain + WGPUSType invalidSType + + cdef struct WGPUDawnRenderPassSampleCount: + WGPUChainedStruct chain + uint32_t sampleCount + + cdef struct WGPUDawnShaderModuleSPIRVOptionsDescriptor: + WGPUChainedStruct chain + WGPUBool allowNonUniformDerivatives + + cdef struct WGPUDawnShaderSourceSPIRV: + WGPUChainedStruct chain + size_t codeSize + const uint32_t* code + + cdef struct WGPUDawnTexelCopyBufferRowAlignmentLimits: + WGPUChainedStruct chain + uint32_t minTexelCopyBufferRowAlignment + + cdef struct WGPUDawnTextureInternalUsageDescriptor: + WGPUChainedStruct chain + WGPUTextureUsage internalUsage + + cdef struct WGPUDawnTogglesDescriptor: + WGPUChainedStruct chain + size_t enabledToggleCount + const char** enabledToggles + size_t disabledToggleCount + const char** disabledToggles + + cdef struct WGPUDawnWGSLBlocklist: + WGPUChainedStruct chain + size_t blocklistedFeatureCount + const char** blocklistedFeatures + + cdef struct WGPUDawnWireWGSLControl: + WGPUChainedStruct chain + WGPUBool enableExperimental + WGPUBool enableUnsafe + WGPUBool enableTesting + + cdef struct WGPUEmscriptenSurfaceSourceCanvasHTMLSelector: + WGPUChainedStruct chain + WGPUStringView selector + + cdef struct WGPUExtent2D: + uint32_t width + uint32_t height + + cdef struct WGPUExtent3D: + uint32_t width + uint32_t height + uint32_t depthOrArrayLayers + + cdef struct WGPUExternalTextureBindingEntry: + WGPUChainedStruct chain + WGPUExternalTexture externalTexture + + cdef struct WGPUExternalTextureBindingLayout: + WGPUChainedStruct chain + + cdef struct WGPUFuture: + uint64_t id + + cdef struct WGPUInstanceLimits: + WGPUChainedStruct* nextInChain + size_t timedWaitAnyMaxCount + + cdef struct WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER: + WGPUBool unused + + cdef struct WGPUMemoryHeapInfo: + WGPUHeapProperty properties + uint64_t size + + cdef struct WGPUMultisampleState: + WGPUChainedStruct* nextInChain + uint32_t count + uint32_t mask + WGPUBool alphaToCoverageEnabled + + cdef struct WGPUOrigin2D: + uint32_t x + uint32_t y + + cdef struct WGPUOrigin3D: + uint32_t x + uint32_t y + uint32_t z + + cdef struct WGPUPassTimestampWrites: + WGPUChainedStruct* nextInChain + WGPUQuerySet querySet + uint32_t beginningOfPassWriteIndex + uint32_t endOfPassWriteIndex + + cdef struct WGPUPipelineLayoutResourceTable: + WGPUChainedStruct chain + WGPUBool usesResourceTable + + cdef struct WGPUPipelineLayoutStorageAttachment: + WGPUChainedStruct* nextInChain + uint64_t offset + WGPUTextureFormat format + + cdef struct WGPUPrimitiveState: + WGPUChainedStruct* nextInChain + WGPUPrimitiveTopology topology + WGPUIndexFormat stripIndexFormat + WGPUFrontFace frontFace + WGPUCullMode cullMode + WGPUBool unclippedDepth + + cdef struct WGPUQuerySetDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + WGPUQueryType type + uint32_t count + + cdef struct WGPUQueueDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + + cdef struct WGPURenderBundleDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + + cdef struct WGPURenderBundleEncoderResourceTable: + WGPUChainedStruct chain + WGPUBool usesResourceTable + + cdef struct WGPURenderPassDepthStencilAttachment: + WGPUChainedStruct* nextInChain + WGPUTextureView view + WGPULoadOp depthLoadOp + WGPUStoreOp depthStoreOp + float depthClearValue + WGPUBool depthReadOnly + WGPULoadOp stencilLoadOp + WGPUStoreOp stencilStoreOp + uint32_t stencilClearValue + WGPUBool stencilReadOnly + + cdef struct WGPURenderPassDescriptorResolveRect: + WGPUChainedStruct chain + uint32_t colorOffsetX + uint32_t colorOffsetY + uint32_t resolveOffsetX + uint32_t resolveOffsetY + uint32_t width + uint32_t height + + cdef struct WGPURenderPassMaxDrawCount: + WGPUChainedStruct chain + uint64_t maxDrawCount + + cdef struct WGPURequestAdapterWebGPUBackendOptions: + WGPUChainedStruct chain + + cdef struct WGPURequestAdapterWebXROptions: + WGPUChainedStruct chain + WGPUBool xrCompatible + + cdef struct WGPUResourceTableDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + uint32_t size + + cdef struct WGPUSamplerBindingLayout: + WGPUChainedStruct* nextInChain + WGPUSamplerBindingType type + + cdef struct WGPUShaderModuleCompilationOptions: + WGPUChainedStruct chain + WGPUBool strictMath + + cdef struct WGPUShaderSourceSPIRV: + WGPUChainedStruct chain + uint32_t codeSize + const uint32_t* code + + cdef struct WGPUShaderSourceWGSL: + WGPUChainedStruct chain + WGPUStringView code + + cdef struct WGPUSharedBufferMemoryBeginAccessDescriptor: + WGPUChainedStruct* nextInChain + WGPUBool initialized + size_t fenceCount + const WGPUSharedFence* fences + size_t signaledValueCount + const uint64_t* signaledValues + + cdef struct WGPUSharedBufferMemoryEndAccessState: + WGPUChainedStruct* nextInChain + WGPUBool initialized + size_t fenceCount + const WGPUSharedFence* fences + size_t signaledValueCount + const uint64_t* signaledValues + + cdef struct WGPUSharedBufferMemoryFromWindowsHandleDescriptor: + WGPUChainedStruct chain + void* handle + uint64_t size + + cdef struct WGPUSharedBufferMemoryHostPointerDescriptor: + WGPUChainedStruct chain + void* pointer + uint64_t size + WGPUDisposeCallbackInfo disposeCallbackInfo + + cdef struct WGPUSharedBufferMemoryProperties: + WGPUChainedStruct* nextInChain + WGPUBufferUsage usage + uint64_t size + + cdef struct WGPUSharedFenceDXGISharedHandleDescriptor: + WGPUChainedStruct chain + void* handle + + cdef struct WGPUSharedFenceDXGISharedHandleExportInfo: + WGPUChainedStruct chain + void* handle + + cdef struct WGPUSharedFenceEGLSyncDescriptor: + WGPUChainedStruct chain + void* sync + + cdef struct WGPUSharedFenceEGLSyncExportInfo: + WGPUChainedStruct chain + void* sync + + cdef struct WGPUSharedFenceMTLSharedEventDescriptor: + WGPUChainedStruct chain + void* sharedEvent + + cdef struct WGPUSharedFenceMTLSharedEventExportInfo: + WGPUChainedStruct chain + void* sharedEvent + + cdef struct WGPUSharedFenceSyncFDDescriptor: + WGPUChainedStruct chain + int handle + + cdef struct WGPUSharedFenceSyncFDExportInfo: + WGPUChainedStruct chain + int handle + + cdef struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor: + WGPUChainedStruct chain + int handle + + cdef struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo: + WGPUChainedStruct chain + int handle + + cdef struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor: + WGPUChainedStruct chain + uint32_t handle + + cdef struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo: + WGPUChainedStruct chain + uint32_t handle + + cdef struct WGPUSharedTextureMemoryAHardwareBufferDescriptor: + WGPUChainedStruct chain + void* handle + + cdef struct WGPUSharedTextureMemoryD3D11BeginState: + WGPUChainedStruct chain + WGPUBool requiresEndAccessFence + + cdef struct WGPUSharedTextureMemoryD3DSwapchainBeginState: + WGPUChainedStruct chain + WGPUBool isSwapchain + + cdef struct WGPUSharedTextureMemoryDmaBufPlane: + int fd + uint64_t offset + uint32_t stride + + cdef struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor: + WGPUChainedStruct chain + void* handle + WGPUBool useKeyedMutex + + cdef struct WGPUSharedTextureMemoryEGLImageDescriptor: + WGPUChainedStruct chain + void* image + + cdef struct WGPUSharedTextureMemoryIOSurfaceDescriptor: + WGPUChainedStruct chain + void* ioSurface + WGPUBool allowStorageBinding + + cdef struct WGPUSharedTextureMemoryOpaqueFDDescriptor: + WGPUChainedStruct chain + const void* vkImageCreateInfo + int memoryFD + uint32_t memoryTypeIndex + uint64_t allocationSize + WGPUBool dedicatedAllocation + + cdef struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor: + WGPUChainedStruct chain + WGPUBool dedicatedAllocation + + cdef struct WGPUSharedTextureMemoryVkImageLayoutBeginState: + WGPUChainedStruct chain + int32_t oldLayout + int32_t newLayout + + cdef struct WGPUSharedTextureMemoryVkImageLayoutEndState: + WGPUChainedStruct chain + int32_t oldLayout + int32_t newLayout + + cdef struct WGPUSharedTextureMemoryZirconHandleDescriptor: + WGPUChainedStruct chain + uint32_t memoryFD + uint64_t allocationSize + + cdef struct WGPUStaticSamplerBindingLayout: + WGPUChainedStruct chain + WGPUSampler sampler + uint32_t sampledTextureBinding + + cdef struct WGPUStencilFaceState: + WGPUCompareFunction compare + WGPUStencilOperation failOp + WGPUStencilOperation depthFailOp + WGPUStencilOperation passOp + + cdef struct WGPUStorageTextureBindingLayout: + WGPUChainedStruct* nextInChain + WGPUStorageTextureAccess access + WGPUTextureFormat format + WGPUTextureViewDimension viewDimension + + cdef struct WGPUSubgroupMatrixConfig: + WGPUSubgroupMatrixComponentType componentType + WGPUSubgroupMatrixComponentType resultComponentType + uint32_t M + uint32_t N + uint32_t K + uint32_t minSubgroupSize + uint32_t maxSubgroupSize + + cdef struct WGPUSupportedFeatures: + size_t featureCount + const WGPUFeatureName* features + + cdef struct WGPUSupportedInstanceFeatures: + size_t featureCount + const WGPUInstanceFeatureName* features + + cdef struct WGPUSupportedWGSLLanguageFeatures: + size_t featureCount + const WGPUWGSLLanguageFeatureName* features + + cdef struct WGPUSurfaceCapabilities: + WGPUChainedStruct* nextInChain + WGPUTextureUsage usages + size_t formatCount + const WGPUTextureFormat* formats + size_t presentModeCount + const WGPUPresentMode* presentModes + size_t alphaModeCount + const WGPUCompositeAlphaMode* alphaModes + + cdef struct WGPUSurfaceColorManagement: + WGPUChainedStruct chain + WGPUPredefinedColorSpace colorSpace + WGPUToneMappingMode toneMappingMode + + cdef struct WGPUSurfaceConfiguration: + WGPUChainedStruct* nextInChain + WGPUDevice device + WGPUTextureFormat format + WGPUTextureUsage usage + uint32_t width + uint32_t height + size_t viewFormatCount + const WGPUTextureFormat* viewFormats + WGPUCompositeAlphaMode alphaMode + WGPUPresentMode presentMode + + cdef struct WGPUSurfaceDescriptorFromWindowsCoreWindow: + WGPUChainedStruct chain + void* coreWindow + + cdef struct WGPUSurfaceDescriptorFromWindowsUWPSwapChainPanel: + WGPUChainedStruct chain + void* swapChainPanel + + cdef struct WGPUSurfaceDescriptorFromWindowsWinUISwapChainPanel: + WGPUChainedStruct chain + void* swapChainPanel + + cdef struct WGPUSurfaceSourceAndroidNativeWindow: + WGPUChainedStruct chain + void* window + + cdef struct WGPUSurfaceSourceMetalLayer: + WGPUChainedStruct chain + void* layer + + cdef struct WGPUSurfaceSourceWaylandSurface: + WGPUChainedStruct chain + void* display + void* surface + + cdef struct WGPUSurfaceSourceWindowsHWND: + WGPUChainedStruct chain + void* hinstance + void* hwnd + + cdef struct WGPUSurfaceSourceXCBWindow: + WGPUChainedStruct chain + void* connection + uint32_t window + + cdef struct WGPUSurfaceSourceXlibWindow: + WGPUChainedStruct chain + void* display + uint64_t window + + cdef struct WGPUSurfaceTexture: + WGPUChainedStruct* nextInChain + WGPUTexture texture + WGPUSurfaceGetCurrentTextureStatus status + + cdef struct WGPUTexelBufferBindingEntry: + WGPUChainedStruct chain + WGPUTexelBufferView texelBufferView + + cdef struct WGPUTexelBufferBindingLayout: + WGPUChainedStruct chain + WGPUTexelBufferAccess access + WGPUTextureFormat format + + cdef struct WGPUTexelBufferViewDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + WGPUTextureFormat format + uint64_t offset + uint64_t size + + cdef struct WGPUTexelCopyBufferLayout: + uint64_t offset + uint32_t bytesPerRow + uint32_t rowsPerImage + + cdef struct WGPUTextureBindingLayout: + WGPUChainedStruct* nextInChain + WGPUTextureSampleType sampleType + WGPUTextureViewDimension viewDimension + WGPUBool multisampled + + cdef struct WGPUTextureBindingViewDimension: + WGPUChainedStruct chain + WGPUTextureViewDimension textureBindingViewDimension + + cdef struct WGPUTextureComponentSwizzle: + WGPUComponentSwizzle r + WGPUComponentSwizzle g + WGPUComponentSwizzle b + WGPUComponentSwizzle a + + cdef struct WGPUVertexAttribute: + WGPUChainedStruct* nextInChain + WGPUVertexFormat format + uint64_t offset + uint32_t shaderLocation + + cdef struct WGPUYCbCrVkDescriptor: + WGPUChainedStruct chain + uint32_t vkFormat + uint32_t vkYCbCrModel + uint32_t vkYCbCrRange + uint32_t vkComponentSwizzleRed + uint32_t vkComponentSwizzleGreen + uint32_t vkComponentSwizzleBlue + uint32_t vkComponentSwizzleAlpha + uint32_t vkXChromaOffset + uint32_t vkYChromaOffset + WGPUFilterMode vkChromaFilter + WGPUBool forceExplicitReconstruction + uint64_t externalFormat + + cdef struct WGPUAdapterPropertiesMemoryHeaps: + WGPUChainedStruct chain + size_t heapCount + const WGPUMemoryHeapInfo* heapInfo + + cdef struct WGPUAdapterPropertiesSubgroupMatrixConfigs: + WGPUChainedStruct chain + size_t configCount + const WGPUSubgroupMatrixConfig* configs + + cdef struct WGPUAHardwareBufferProperties: + WGPUYCbCrVkDescriptor yCbCrInfo + + cdef struct WGPUBindGroupEntry: + WGPUChainedStruct* nextInChain + uint32_t binding + WGPUBuffer buffer + uint64_t offset + uint64_t size + WGPUSampler sampler + WGPUTextureView textureView + + cdef struct WGPUBindGroupLayoutEntry: + WGPUChainedStruct* nextInChain + uint32_t binding + WGPUShaderStage visibility + uint32_t bindingArraySize + WGPUBufferBindingLayout buffer + WGPUSamplerBindingLayout sampler + WGPUTextureBindingLayout texture + WGPUStorageTextureBindingLayout storageTexture + + cdef struct WGPUBlendState: + WGPUBlendComponent color + WGPUBlendComponent alpha + + cdef struct WGPUBufferDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + WGPUBufferUsage usage + uint64_t size + WGPUBool mappedAtCreation + + cdef struct WGPUCommandEncoderDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + + cdef struct WGPUCompilationMessage: + WGPUChainedStruct* nextInChain + WGPUStringView message + WGPUCompilationMessageType type + uint64_t lineNum + uint64_t linePos + uint64_t offset + uint64_t length + + cdef struct WGPUComputePassDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + const WGPUPassTimestampWrites* timestampWrites + + cdef struct WGPUComputeState: + WGPUChainedStruct* nextInChain + WGPUShaderModule module + WGPUStringView entryPoint + size_t constantCount + const WGPUConstantEntry* constants + + cdef struct WGPUDawnDrmFormatCapabilities: + WGPUChainedStruct chain + size_t propertiesCount + const WGPUDawnDrmFormatProperties* properties + + cdef struct WGPUDepthStencilState: + WGPUChainedStruct* nextInChain + WGPUTextureFormat format + WGPUOptionalBool depthWriteEnabled + WGPUCompareFunction depthCompare + WGPUStencilFaceState stencilFront + WGPUStencilFaceState stencilBack + uint32_t stencilReadMask + uint32_t stencilWriteMask + int32_t depthBias + float depthBiasSlopeScale + float depthBiasClamp + + cdef struct WGPUExternalTextureDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + WGPUTextureView plane0 + WGPUTextureView plane1 + WGPUOrigin2D cropOrigin + WGPUExtent2D cropSize + WGPUExtent2D apparentSize + WGPUBool doYuvToRgbConversionOnly + const float* yuvToRgbConversionMatrix + const float* srcTransferFunctionParameters + const float* dstTransferFunctionParameters + const float* gamutConversionMatrix + WGPUBool mirrored + WGPUExternalTextureRotation rotation + + cdef struct WGPUFutureWaitInfo: + WGPUFuture future + WGPUBool completed + + cdef struct WGPUImageCopyExternalTexture: + WGPUChainedStruct* nextInChain + WGPUExternalTexture externalTexture + WGPUOrigin3D origin + WGPUExtent2D naturalSize + + cdef struct WGPUInstanceDescriptor: + WGPUChainedStruct* nextInChain + size_t requiredFeatureCount + const WGPUInstanceFeatureName* requiredFeatures + const WGPUInstanceLimits* requiredLimits + + cdef struct WGPULimits: + WGPUChainedStruct* nextInChain + uint32_t maxTextureDimension1D + uint32_t maxTextureDimension2D + uint32_t maxTextureDimension3D + uint32_t maxTextureArrayLayers + uint32_t maxBindGroups + uint32_t maxBindGroupsPlusVertexBuffers + uint32_t maxBindingsPerBindGroup + uint32_t maxDynamicUniformBuffersPerPipelineLayout + uint32_t maxDynamicStorageBuffersPerPipelineLayout + uint32_t maxSampledTexturesPerShaderStage + uint32_t maxSamplersPerShaderStage + uint32_t maxStorageBuffersPerShaderStage + uint32_t maxStorageTexturesPerShaderStage + uint32_t maxUniformBuffersPerShaderStage + uint64_t maxUniformBufferBindingSize + uint64_t maxStorageBufferBindingSize + uint32_t minUniformBufferOffsetAlignment + uint32_t minStorageBufferOffsetAlignment + uint32_t maxVertexBuffers + uint64_t maxBufferSize + uint32_t maxVertexAttributes + uint32_t maxVertexBufferArrayStride + uint32_t maxInterStageShaderVariables + uint32_t maxColorAttachments + uint32_t maxColorAttachmentBytesPerSample + uint32_t maxComputeWorkgroupStorageSize + uint32_t maxComputeInvocationsPerWorkgroup + uint32_t maxComputeWorkgroupSizeX + uint32_t maxComputeWorkgroupSizeY + uint32_t maxComputeWorkgroupSizeZ + uint32_t maxComputeWorkgroupsPerDimension + uint32_t maxImmediateSize + + cdef struct WGPUPipelineLayoutPixelLocalStorage: + WGPUChainedStruct chain + uint64_t totalPixelLocalStorageSize + size_t storageAttachmentCount + const WGPUPipelineLayoutStorageAttachment* storageAttachments + + cdef struct WGPURenderBundleEncoderDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + size_t colorFormatCount + const WGPUTextureFormat* colorFormats + WGPUTextureFormat depthStencilFormat + uint32_t sampleCount + WGPUBool depthReadOnly + WGPUBool stencilReadOnly + + cdef struct WGPURenderPassColorAttachment: + WGPUChainedStruct* nextInChain + WGPUTextureView view + uint32_t depthSlice + WGPUTextureView resolveTarget + WGPULoadOp loadOp + WGPUStoreOp storeOp + WGPUColor clearValue + + cdef struct WGPURenderPassRenderAreaRect: + WGPUChainedStruct chain + WGPUOrigin2D origin + WGPUExtent2D size + + cdef struct WGPURenderPassStorageAttachment: + WGPUChainedStruct* nextInChain + uint64_t offset + WGPUTextureView storage + WGPULoadOp loadOp + WGPUStoreOp storeOp + WGPUColor clearValue + + cdef struct WGPURequestAdapterOptions: + WGPUChainedStruct* nextInChain + WGPUFeatureLevel featureLevel + WGPUPowerPreference powerPreference + WGPUBool forceFallbackAdapter + WGPUBackendType backendType + WGPUSurface compatibleSurface + + cdef struct WGPUSamplerDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + WGPUAddressMode addressModeU + WGPUAddressMode addressModeV + WGPUAddressMode addressModeW + WGPUFilterMode magFilter + WGPUFilterMode minFilter + WGPUMipmapFilterMode mipmapFilter + float lodMinClamp + float lodMaxClamp + WGPUCompareFunction compare + uint16_t maxAnisotropy + + cdef struct WGPUShaderModuleDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + + cdef struct WGPUSharedBufferMemoryDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + + cdef struct WGPUSharedFenceDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + + cdef struct WGPUSharedFenceExportInfo: + WGPUChainedStruct* nextInChain + WGPUSharedFenceType type + + cdef struct WGPUSharedTextureMemoryAHardwareBufferProperties: + WGPUChainedStruct chain + WGPUYCbCrVkDescriptor yCbCrInfo + + cdef struct WGPUSharedTextureMemoryBeginAccessDescriptor: + WGPUChainedStruct* nextInChain + WGPUBool concurrentRead + WGPUBool initialized + size_t fenceCount + const WGPUSharedFence* fences + size_t signaledValueCount + const uint64_t* signaledValues + + cdef struct WGPUSharedTextureMemoryDmaBufDescriptor: + WGPUChainedStruct chain + WGPUExtent3D size + uint32_t drmFormat + uint64_t drmModifier + size_t planeCount + const WGPUSharedTextureMemoryDmaBufPlane* planes + + cdef struct WGPUSharedTextureMemoryMetalEndAccessState: + WGPUChainedStruct chain + WGPUFuture commandsScheduledFuture + + cdef struct WGPUSurfaceDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + + cdef struct WGPUTexelCopyBufferInfo: + WGPUTexelCopyBufferLayout layout + WGPUBuffer buffer + + cdef struct WGPUTexelCopyTextureInfo: + WGPUTexture texture + uint32_t mipLevel + WGPUOrigin3D origin + WGPUTextureAspect aspect + + cdef struct WGPUTextureComponentSwizzleDescriptor: + WGPUChainedStruct chain + WGPUTextureComponentSwizzle swizzle + + cdef struct WGPUTextureDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + WGPUTextureUsage usage + WGPUTextureDimension dimension + WGPUExtent3D size + WGPUTextureFormat format + uint32_t mipLevelCount + uint32_t sampleCount + size_t viewFormatCount + const WGPUTextureFormat* viewFormats + + cdef struct WGPUVertexBufferLayout: + WGPUChainedStruct* nextInChain + WGPUVertexStepMode stepMode + uint64_t arrayStride + size_t attributeCount + const WGPUVertexAttribute* attributes + + cdef struct WGPUAdapterInfo: + WGPUChainedStruct* nextInChain + WGPUStringView vendor + WGPUStringView architecture + WGPUStringView device + WGPUStringView description + WGPUBackendType backendType + WGPUAdapterType adapterType + uint32_t vendorID + uint32_t deviceID + uint32_t subgroupMinSize + uint32_t subgroupMaxSize + + cdef struct WGPUBindGroupDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + WGPUBindGroupLayout layout + size_t entryCount + const WGPUBindGroupEntry* entries + + cdef struct WGPUBindGroupLayoutDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + size_t entryCount + const WGPUBindGroupLayoutEntry* entries + + cdef struct WGPUColorTargetState: + WGPUChainedStruct* nextInChain + WGPUTextureFormat format + const WGPUBlendState* blend + WGPUColorWriteMask writeMask + + cdef struct WGPUCompilationInfo: + WGPUChainedStruct* nextInChain + size_t messageCount + const WGPUCompilationMessage* messages + + cdef struct WGPUComputePipelineDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + WGPUPipelineLayout layout + WGPUComputeState compute + + cdef struct WGPUDawnFormatCapabilities: + WGPUChainedStruct* nextInChain + + cdef struct WGPUDeviceDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + size_t requiredFeatureCount + const WGPUFeatureName* requiredFeatures + const WGPULimits* requiredLimits + WGPUQueueDescriptor defaultQueue + WGPUDeviceLostCallbackInfo deviceLostCallbackInfo + WGPUUncapturedErrorCallbackInfo uncapturedErrorCallbackInfo + + cdef struct WGPUPipelineLayoutDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + size_t bindGroupLayoutCount + const WGPUBindGroupLayout* bindGroupLayouts + uint32_t immediateSize + + cdef struct WGPURenderPassPixelLocalStorage: + WGPUChainedStruct chain + uint64_t totalPixelLocalStorageSize + size_t storageAttachmentCount + const WGPURenderPassStorageAttachment* storageAttachments + + cdef struct WGPUSharedTextureMemoryDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + + cdef struct WGPUSharedTextureMemoryEndAccessState: + WGPUChainedStruct* nextInChain + WGPUBool initialized + size_t fenceCount + const WGPUSharedFence* fences + size_t signaledValueCount + const uint64_t* signaledValues + + cdef struct WGPUSharedTextureMemoryProperties: + WGPUChainedStruct* nextInChain + WGPUTextureUsage usage + WGPUExtent3D size + WGPUTextureFormat format + + cdef struct WGPUTextureViewDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + WGPUTextureFormat format + WGPUTextureViewDimension dimension + uint32_t baseMipLevel + uint32_t mipLevelCount + uint32_t baseArrayLayer + uint32_t arrayLayerCount + WGPUTextureAspect aspect + WGPUTextureUsage usage + + cdef struct WGPUVertexState: + WGPUChainedStruct* nextInChain + WGPUShaderModule module + WGPUStringView entryPoint + size_t constantCount + const WGPUConstantEntry* constants + size_t bufferCount + const WGPUVertexBufferLayout* buffers + + cdef struct WGPUFragmentState: + WGPUChainedStruct* nextInChain + WGPUShaderModule module + WGPUStringView entryPoint + size_t constantCount + const WGPUConstantEntry* constants + size_t targetCount + const WGPUColorTargetState* targets + + cdef struct WGPURenderPassDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + size_t colorAttachmentCount + const WGPURenderPassColorAttachment* colorAttachments + const WGPURenderPassDepthStencilAttachment* depthStencilAttachment + WGPUQuerySet occlusionQuerySet + const WGPUPassTimestampWrites* timestampWrites + + cdef struct WGPURenderPipelineDescriptor: + WGPUChainedStruct* nextInChain + WGPUStringView label + WGPUPipelineLayout layout + WGPUVertexState vertex + WGPUPrimitiveState primitive + const WGPUDepthStencilState* depthStencil + WGPUMultisampleState multisample + const WGPUFragmentState* fragment + + # %% Struct initializers (C compound literals with Dawn's defaults) + + const WGPUStringView WGPU_STRING_VIEW_INIT + const WGPUBufferMapCallbackInfo WGPU_BUFFER_MAP_CALLBACK_INFO_INIT + const WGPUCompilationInfoCallbackInfo WGPU_COMPILATION_INFO_CALLBACK_INFO_INIT + const WGPUCreateComputePipelineAsyncCallbackInfo WGPU_CREATE_COMPUTE_PIPELINE_ASYNC_CALLBACK_INFO_INIT + const WGPUCreateRenderPipelineAsyncCallbackInfo WGPU_CREATE_RENDER_PIPELINE_ASYNC_CALLBACK_INFO_INIT + const WGPUDawnLoadCacheDataCallbackInfo WGPU_DAWN_LOAD_CACHE_DATA_CALLBACK_INFO_INIT + const WGPUDawnStoreCacheDataCallbackInfo WGPU_DAWN_STORE_CACHE_DATA_CALLBACK_INFO_INIT + const WGPUDeviceLostCallbackInfo WGPU_DEVICE_LOST_CALLBACK_INFO_INIT + const WGPUDisposeCallbackInfo WGPU_DISPOSE_CALLBACK_INFO_INIT + const WGPULoggingCallbackInfo WGPU_LOGGING_CALLBACK_INFO_INIT + const WGPUPopErrorScopeCallbackInfo WGPU_POP_ERROR_SCOPE_CALLBACK_INFO_INIT + const WGPUQueueWorkDoneCallbackInfo WGPU_QUEUE_WORK_DONE_CALLBACK_INFO_INIT + const WGPURequestAdapterCallbackInfo WGPU_REQUEST_ADAPTER_CALLBACK_INFO_INIT + const WGPURequestDeviceCallbackInfo WGPU_REQUEST_DEVICE_CALLBACK_INFO_INIT + const WGPUUncapturedErrorCallbackInfo WGPU_UNCAPTURED_ERROR_CALLBACK_INFO_INIT + const WGPUAdapterPropertiesD3D WGPU_ADAPTER_PROPERTIES_D3D_INIT + const WGPUAdapterPropertiesDrm WGPU_ADAPTER_PROPERTIES_DRM_INIT + const WGPUAdapterPropertiesVk WGPU_ADAPTER_PROPERTIES_VK_INIT + const WGPUAdapterPropertiesWGPU WGPU_ADAPTER_PROPERTIES_WGPU_INIT + const WGPUBindingResource WGPU_BINDING_RESOURCE_INIT + const WGPUBlendComponent WGPU_BLEND_COMPONENT_INIT + const WGPUBufferBindingLayout WGPU_BUFFER_BINDING_LAYOUT_INIT + const WGPUBufferHostMappedPointer WGPU_BUFFER_HOST_MAPPED_POINTER_INIT + const WGPUColor WGPU_COLOR_INIT + const WGPUColorSpaceDawn WGPU_COLOR_SPACE_DAWN_INIT + const WGPUColorTargetStateExpandResolveTextureDawn WGPU_COLOR_TARGET_STATE_EXPAND_RESOLVE_TEXTURE_DAWN_INIT + const WGPUCommandBufferDescriptor WGPU_COMMAND_BUFFER_DESCRIPTOR_INIT + const WGPUCompatibilityModeLimits WGPU_COMPATIBILITY_MODE_LIMITS_INIT + const WGPUConstantEntry WGPU_CONSTANT_ENTRY_INIT + const WGPUCopyTextureForBrowserOptions WGPU_COPY_TEXTURE_FOR_BROWSER_OPTIONS_INIT + const WGPUDawnAdapterPropertiesPowerPreference WGPU_DAWN_ADAPTER_PROPERTIES_POWER_PREFERENCE_INIT + const WGPUDawnBufferDescriptorErrorInfoFromWireClient WGPU_DAWN_BUFFER_DESCRIPTOR_ERROR_INFO_FROM_WIRE_CLIENT_INIT + const WGPUDawnCacheDeviceDescriptor WGPU_DAWN_CACHE_DEVICE_DESCRIPTOR_INIT + const WGPUDawnCompilationMessageUtf16 WGPU_DAWN_COMPILATION_MESSAGE_UTF16_INIT + const WGPUDawnConsumeAdapterDescriptor WGPU_DAWN_CONSUME_ADAPTER_DESCRIPTOR_INIT + const WGPUDawnDeviceAllocatorControl WGPU_DAWN_DEVICE_ALLOCATOR_CONTROL_INIT + const WGPUDawnDrmFormatProperties WGPU_DAWN_DRM_FORMAT_PROPERTIES_INIT + const WGPUDawnEncoderInternalUsageDescriptor WGPU_DAWN_ENCODER_INTERNAL_USAGE_DESCRIPTOR_INIT + const WGPUDawnFakeBufferOOMForTesting WGPU_DAWN_FAKE_BUFFER_OOM_FOR_TESTING_INIT + const WGPUDawnFakeDeviceInitializeErrorForTesting WGPU_DAWN_FAKE_DEVICE_INITIALIZE_ERROR_FOR_TESTING_INIT + const WGPUDawnHostMappedPointerLimits WGPU_DAWN_HOST_MAPPED_POINTER_LIMITS_INIT + const WGPUDawnInjectedInvalidSType WGPU_DAWN_INJECTED_INVALID_S_TYPE_INIT + const WGPUDawnRenderPassSampleCount WGPU_DAWN_RENDER_PASS_SAMPLE_COUNT_INIT + const WGPUDawnShaderModuleSPIRVOptionsDescriptor WGPU_DAWN_SHADER_MODULE_SPIRV_OPTIONS_DESCRIPTOR_INIT + const WGPUDawnShaderSourceSPIRV WGPU_DAWN_SHADER_SOURCE_SPIRV_INIT + const WGPUDawnTexelCopyBufferRowAlignmentLimits WGPU_DAWN_TEXEL_COPY_BUFFER_ROW_ALIGNMENT_LIMITS_INIT + const WGPUDawnTextureInternalUsageDescriptor WGPU_DAWN_TEXTURE_INTERNAL_USAGE_DESCRIPTOR_INIT + const WGPUDawnTogglesDescriptor WGPU_DAWN_TOGGLES_DESCRIPTOR_INIT + const WGPUDawnWGSLBlocklist WGPU_DAWN_WGSL_BLOCKLIST_INIT + const WGPUDawnWireWGSLControl WGPU_DAWN_WIRE_WGSL_CONTROL_INIT + const WGPUEmscriptenSurfaceSourceCanvasHTMLSelector WGPU_EMSCRIPTEN_SURFACE_SOURCE_CANVAS_HTML_SELECTOR_INIT + const WGPUExtent2D WGPU_EXTENT_2D_INIT + const WGPUExtent3D WGPU_EXTENT_3D_INIT + const WGPUExternalTextureBindingEntry WGPU_EXTERNAL_TEXTURE_BINDING_ENTRY_INIT + const WGPUExternalTextureBindingLayout WGPU_EXTERNAL_TEXTURE_BINDING_LAYOUT_INIT + const WGPUFuture WGPU_FUTURE_INIT + const WGPUInstanceLimits WGPU_INSTANCE_LIMITS_INIT + const WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER WGPU_INTERNAL_HAVE_EMDAWNWEBGPU_HEADER_INIT + const WGPUMemoryHeapInfo WGPU_MEMORY_HEAP_INFO_INIT + const WGPUMultisampleState WGPU_MULTISAMPLE_STATE_INIT + const WGPUOrigin2D WGPU_ORIGIN_2D_INIT + const WGPUOrigin3D WGPU_ORIGIN_3D_INIT + const WGPUPassTimestampWrites WGPU_PASS_TIMESTAMP_WRITES_INIT + const WGPUPipelineLayoutResourceTable WGPU_PIPELINE_LAYOUT_RESOURCE_TABLE_INIT + const WGPUPipelineLayoutStorageAttachment WGPU_PIPELINE_LAYOUT_STORAGE_ATTACHMENT_INIT + const WGPUPrimitiveState WGPU_PRIMITIVE_STATE_INIT + const WGPUQuerySetDescriptor WGPU_QUERY_SET_DESCRIPTOR_INIT + const WGPUQueueDescriptor WGPU_QUEUE_DESCRIPTOR_INIT + const WGPURenderBundleDescriptor WGPU_RENDER_BUNDLE_DESCRIPTOR_INIT + const WGPURenderBundleEncoderResourceTable WGPU_RENDER_BUNDLE_ENCODER_RESOURCE_TABLE_INIT + const WGPURenderPassDepthStencilAttachment WGPU_RENDER_PASS_DEPTH_STENCIL_ATTACHMENT_INIT + const WGPURenderPassDescriptorResolveRect WGPU_RENDER_PASS_DESCRIPTOR_RESOLVE_RECT_INIT + const WGPURenderPassMaxDrawCount WGPU_RENDER_PASS_MAX_DRAW_COUNT_INIT + const WGPURequestAdapterWebGPUBackendOptions WGPU_REQUEST_ADAPTER_WEBGPU_BACKEND_OPTIONS_INIT + const WGPURequestAdapterWebXROptions WGPU_REQUEST_ADAPTER_WEBXR_OPTIONS_INIT + const WGPUResourceTableDescriptor WGPU_RESOURCE_TABLE_DESCRIPTOR_INIT + const WGPUSamplerBindingLayout WGPU_SAMPLER_BINDING_LAYOUT_INIT + const WGPUShaderModuleCompilationOptions WGPU_SHADER_MODULE_COMPILATION_OPTIONS_INIT + const WGPUShaderSourceSPIRV WGPU_SHADER_SOURCE_SPIRV_INIT + const WGPUShaderSourceWGSL WGPU_SHADER_SOURCE_WGSL_INIT + const WGPUSharedBufferMemoryBeginAccessDescriptor WGPU_SHARED_BUFFER_MEMORY_BEGIN_ACCESS_DESCRIPTOR_INIT + const WGPUSharedBufferMemoryEndAccessState WGPU_SHARED_BUFFER_MEMORY_END_ACCESS_STATE_INIT + const WGPUSharedBufferMemoryFromWindowsHandleDescriptor WGPU_SHARED_BUFFER_MEMORY_FROM_WINDOWS_HANDLE_DESCRIPTOR_INIT + const WGPUSharedBufferMemoryHostPointerDescriptor WGPU_SHARED_BUFFER_MEMORY_HOST_POINTER_DESCRIPTOR_INIT + const WGPUSharedBufferMemoryProperties WGPU_SHARED_BUFFER_MEMORY_PROPERTIES_INIT + const WGPUSharedFenceDXGISharedHandleDescriptor WGPU_SHARED_FENCE_DXGI_SHARED_HANDLE_DESCRIPTOR_INIT + const WGPUSharedFenceDXGISharedHandleExportInfo WGPU_SHARED_FENCE_DXGI_SHARED_HANDLE_EXPORT_INFO_INIT + const WGPUSharedFenceEGLSyncDescriptor WGPU_SHARED_FENCE_EGL_SYNC_DESCRIPTOR_INIT + const WGPUSharedFenceEGLSyncExportInfo WGPU_SHARED_FENCE_EGL_SYNC_EXPORT_INFO_INIT + const WGPUSharedFenceMTLSharedEventDescriptor WGPU_SHARED_FENCE_MTL_SHARED_EVENT_DESCRIPTOR_INIT + const WGPUSharedFenceMTLSharedEventExportInfo WGPU_SHARED_FENCE_MTL_SHARED_EVENT_EXPORT_INFO_INIT + const WGPUSharedFenceSyncFDDescriptor WGPU_SHARED_FENCE_SYNC_FD_DESCRIPTOR_INIT + const WGPUSharedFenceSyncFDExportInfo WGPU_SHARED_FENCE_SYNC_FD_EXPORT_INFO_INIT + const WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor WGPU_SHARED_FENCE_VK_SEMAPHORE_OPAQUE_FD_DESCRIPTOR_INIT + const WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo WGPU_SHARED_FENCE_VK_SEMAPHORE_OPAQUE_FD_EXPORT_INFO_INIT + const WGPUSharedFenceVkSemaphoreZirconHandleDescriptor WGPU_SHARED_FENCE_VK_SEMAPHORE_ZIRCON_HANDLE_DESCRIPTOR_INIT + const WGPUSharedFenceVkSemaphoreZirconHandleExportInfo WGPU_SHARED_FENCE_VK_SEMAPHORE_ZIRCON_HANDLE_EXPORT_INFO_INIT + const WGPUSharedTextureMemoryAHardwareBufferDescriptor WGPU_SHARED_TEXTURE_MEMORY_A_HARDWARE_BUFFER_DESCRIPTOR_INIT + const WGPUSharedTextureMemoryD3D11BeginState WGPU_SHARED_TEXTURE_MEMORY_D3D11_BEGIN_STATE_INIT + const WGPUSharedTextureMemoryD3DSwapchainBeginState WGPU_SHARED_TEXTURE_MEMORY_D3D_SWAPCHAIN_BEGIN_STATE_INIT + const WGPUSharedTextureMemoryDmaBufPlane WGPU_SHARED_TEXTURE_MEMORY_DMA_BUF_PLANE_INIT + const WGPUSharedTextureMemoryDXGISharedHandleDescriptor WGPU_SHARED_TEXTURE_MEMORY_DXGI_SHARED_HANDLE_DESCRIPTOR_INIT + const WGPUSharedTextureMemoryEGLImageDescriptor WGPU_SHARED_TEXTURE_MEMORY_EGL_IMAGE_DESCRIPTOR_INIT + const WGPUSharedTextureMemoryIOSurfaceDescriptor WGPU_SHARED_TEXTURE_MEMORY_IO_SURFACE_DESCRIPTOR_INIT + const WGPUSharedTextureMemoryOpaqueFDDescriptor WGPU_SHARED_TEXTURE_MEMORY_OPAQUE_FD_DESCRIPTOR_INIT + const WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor WGPU_SHARED_TEXTURE_MEMORY_VK_DEDICATED_ALLOCATION_DESCRIPTOR_INIT + const WGPUSharedTextureMemoryVkImageLayoutBeginState WGPU_SHARED_TEXTURE_MEMORY_VK_IMAGE_LAYOUT_BEGIN_STATE_INIT + const WGPUSharedTextureMemoryVkImageLayoutEndState WGPU_SHARED_TEXTURE_MEMORY_VK_IMAGE_LAYOUT_END_STATE_INIT + const WGPUSharedTextureMemoryZirconHandleDescriptor WGPU_SHARED_TEXTURE_MEMORY_ZIRCON_HANDLE_DESCRIPTOR_INIT + const WGPUStaticSamplerBindingLayout WGPU_STATIC_SAMPLER_BINDING_LAYOUT_INIT + const WGPUStencilFaceState WGPU_STENCIL_FACE_STATE_INIT + const WGPUStorageTextureBindingLayout WGPU_STORAGE_TEXTURE_BINDING_LAYOUT_INIT + const WGPUSubgroupMatrixConfig WGPU_SUBGROUP_MATRIX_CONFIG_INIT + const WGPUSupportedFeatures WGPU_SUPPORTED_FEATURES_INIT + const WGPUSupportedInstanceFeatures WGPU_SUPPORTED_INSTANCE_FEATURES_INIT + const WGPUSupportedWGSLLanguageFeatures WGPU_SUPPORTED_WGSL_LANGUAGE_FEATURES_INIT + const WGPUSurfaceCapabilities WGPU_SURFACE_CAPABILITIES_INIT + const WGPUSurfaceColorManagement WGPU_SURFACE_COLOR_MANAGEMENT_INIT + const WGPUSurfaceConfiguration WGPU_SURFACE_CONFIGURATION_INIT + const WGPUSurfaceDescriptorFromWindowsCoreWindow WGPU_SURFACE_DESCRIPTOR_FROM_WINDOWS_CORE_WINDOW_INIT + const WGPUSurfaceDescriptorFromWindowsUWPSwapChainPanel WGPU_SURFACE_DESCRIPTOR_FROM_WINDOWS_UWP_SWAP_CHAIN_PANEL_INIT + const WGPUSurfaceDescriptorFromWindowsWinUISwapChainPanel WGPU_SURFACE_DESCRIPTOR_FROM_WINDOWS_WINUI_SWAP_CHAIN_PANEL_INIT + const WGPUSurfaceSourceAndroidNativeWindow WGPU_SURFACE_SOURCE_ANDROID_NATIVE_WINDOW_INIT + const WGPUSurfaceSourceMetalLayer WGPU_SURFACE_SOURCE_METAL_LAYER_INIT + const WGPUSurfaceSourceWaylandSurface WGPU_SURFACE_SOURCE_WAYLAND_SURFACE_INIT + const WGPUSurfaceSourceWindowsHWND WGPU_SURFACE_SOURCE_WINDOWS_HWND_INIT + const WGPUSurfaceSourceXCBWindow WGPU_SURFACE_SOURCE_XCB_WINDOW_INIT + const WGPUSurfaceSourceXlibWindow WGPU_SURFACE_SOURCE_XLIB_WINDOW_INIT + const WGPUSurfaceTexture WGPU_SURFACE_TEXTURE_INIT + const WGPUTexelBufferBindingEntry WGPU_TEXEL_BUFFER_BINDING_ENTRY_INIT + const WGPUTexelBufferBindingLayout WGPU_TEXEL_BUFFER_BINDING_LAYOUT_INIT + const WGPUTexelBufferViewDescriptor WGPU_TEXEL_BUFFER_VIEW_DESCRIPTOR_INIT + const WGPUTexelCopyBufferLayout WGPU_TEXEL_COPY_BUFFER_LAYOUT_INIT + const WGPUTextureBindingLayout WGPU_TEXTURE_BINDING_LAYOUT_INIT + const WGPUTextureBindingViewDimension WGPU_TEXTURE_BINDING_VIEW_DIMENSION_INIT + const WGPUTextureComponentSwizzle WGPU_TEXTURE_COMPONENT_SWIZZLE_INIT + const WGPUVertexAttribute WGPU_VERTEX_ATTRIBUTE_INIT + const WGPUYCbCrVkDescriptor WGPU_Y_CB_CR_VK_DESCRIPTOR_INIT + const WGPUAdapterPropertiesMemoryHeaps WGPU_ADAPTER_PROPERTIES_MEMORY_HEAPS_INIT + const WGPUAdapterPropertiesSubgroupMatrixConfigs WGPU_ADAPTER_PROPERTIES_SUBGROUP_MATRIX_CONFIGS_INIT + const WGPUAHardwareBufferProperties WGPU_A_HARDWARE_BUFFER_PROPERTIES_INIT + const WGPUBindGroupEntry WGPU_BIND_GROUP_ENTRY_INIT + const WGPUBindGroupLayoutEntry WGPU_BIND_GROUP_LAYOUT_ENTRY_INIT + const WGPUBlendState WGPU_BLEND_STATE_INIT + const WGPUBufferDescriptor WGPU_BUFFER_DESCRIPTOR_INIT + const WGPUCommandEncoderDescriptor WGPU_COMMAND_ENCODER_DESCRIPTOR_INIT + const WGPUCompilationMessage WGPU_COMPILATION_MESSAGE_INIT + const WGPUComputePassDescriptor WGPU_COMPUTE_PASS_DESCRIPTOR_INIT + const WGPUComputeState WGPU_COMPUTE_STATE_INIT + const WGPUDawnDrmFormatCapabilities WGPU_DAWN_DRM_FORMAT_CAPABILITIES_INIT + const WGPUDepthStencilState WGPU_DEPTH_STENCIL_STATE_INIT + const WGPUExternalTextureDescriptor WGPU_EXTERNAL_TEXTURE_DESCRIPTOR_INIT + const WGPUFutureWaitInfo WGPU_FUTURE_WAIT_INFO_INIT + const WGPUImageCopyExternalTexture WGPU_IMAGE_COPY_EXTERNAL_TEXTURE_INIT + const WGPUInstanceDescriptor WGPU_INSTANCE_DESCRIPTOR_INIT + const WGPULimits WGPU_LIMITS_INIT + const WGPUPipelineLayoutPixelLocalStorage WGPU_PIPELINE_LAYOUT_PIXEL_LOCAL_STORAGE_INIT + const WGPURenderBundleEncoderDescriptor WGPU_RENDER_BUNDLE_ENCODER_DESCRIPTOR_INIT + const WGPURenderPassColorAttachment WGPU_RENDER_PASS_COLOR_ATTACHMENT_INIT + const WGPURenderPassRenderAreaRect WGPU_RENDER_PASS_RENDER_AREA_RECT_INIT + const WGPURenderPassStorageAttachment WGPU_RENDER_PASS_STORAGE_ATTACHMENT_INIT + const WGPURequestAdapterOptions WGPU_REQUEST_ADAPTER_OPTIONS_INIT + const WGPUSamplerDescriptor WGPU_SAMPLER_DESCRIPTOR_INIT + const WGPUShaderModuleDescriptor WGPU_SHADER_MODULE_DESCRIPTOR_INIT + const WGPUSharedBufferMemoryDescriptor WGPU_SHARED_BUFFER_MEMORY_DESCRIPTOR_INIT + const WGPUSharedFenceDescriptor WGPU_SHARED_FENCE_DESCRIPTOR_INIT + const WGPUSharedFenceExportInfo WGPU_SHARED_FENCE_EXPORT_INFO_INIT + const WGPUSharedTextureMemoryAHardwareBufferProperties WGPU_SHARED_TEXTURE_MEMORY_A_HARDWARE_BUFFER_PROPERTIES_INIT + const WGPUSharedTextureMemoryBeginAccessDescriptor WGPU_SHARED_TEXTURE_MEMORY_BEGIN_ACCESS_DESCRIPTOR_INIT + const WGPUSharedTextureMemoryDmaBufDescriptor WGPU_SHARED_TEXTURE_MEMORY_DMA_BUF_DESCRIPTOR_INIT + const WGPUSharedTextureMemoryMetalEndAccessState WGPU_SHARED_TEXTURE_MEMORY_METAL_END_ACCESS_STATE_INIT + const WGPUSurfaceDescriptor WGPU_SURFACE_DESCRIPTOR_INIT + const WGPUTexelCopyBufferInfo WGPU_TEXEL_COPY_BUFFER_INFO_INIT + const WGPUTexelCopyTextureInfo WGPU_TEXEL_COPY_TEXTURE_INFO_INIT + const WGPUTextureComponentSwizzleDescriptor WGPU_TEXTURE_COMPONENT_SWIZZLE_DESCRIPTOR_INIT + const WGPUTextureDescriptor WGPU_TEXTURE_DESCRIPTOR_INIT + const WGPUVertexBufferLayout WGPU_VERTEX_BUFFER_LAYOUT_INIT + const WGPUAdapterInfo WGPU_ADAPTER_INFO_INIT + const WGPUBindGroupDescriptor WGPU_BIND_GROUP_DESCRIPTOR_INIT + const WGPUBindGroupLayoutDescriptor WGPU_BIND_GROUP_LAYOUT_DESCRIPTOR_INIT + const WGPUColorTargetState WGPU_COLOR_TARGET_STATE_INIT + const WGPUCompilationInfo WGPU_COMPILATION_INFO_INIT + const WGPUComputePipelineDescriptor WGPU_COMPUTE_PIPELINE_DESCRIPTOR_INIT + const WGPUDawnFormatCapabilities WGPU_DAWN_FORMAT_CAPABILITIES_INIT + const WGPUDeviceDescriptor WGPU_DEVICE_DESCRIPTOR_INIT + const WGPUPipelineLayoutDescriptor WGPU_PIPELINE_LAYOUT_DESCRIPTOR_INIT + const WGPURenderPassPixelLocalStorage WGPU_RENDER_PASS_PIXEL_LOCAL_STORAGE_INIT + const WGPUSharedTextureMemoryDescriptor WGPU_SHARED_TEXTURE_MEMORY_DESCRIPTOR_INIT + const WGPUSharedTextureMemoryEndAccessState WGPU_SHARED_TEXTURE_MEMORY_END_ACCESS_STATE_INIT + const WGPUSharedTextureMemoryProperties WGPU_SHARED_TEXTURE_MEMORY_PROPERTIES_INIT + const WGPUTextureViewDescriptor WGPU_TEXTURE_VIEW_DESCRIPTOR_INIT + const WGPUVertexState WGPU_VERTEX_STATE_INIT + const WGPUFragmentState WGPU_FRAGMENT_STATE_INIT + const WGPURenderPassDescriptor WGPU_RENDER_PASS_DESCRIPTOR_INIT + const WGPURenderPipelineDescriptor WGPU_RENDER_PIPELINE_DESCRIPTOR_INIT + + # %% Functions + + WGPUInstance wgpuCreateInstance(const WGPUInstanceDescriptor* descriptor) + void wgpuGetInstanceFeatures(WGPUSupportedInstanceFeatures* features) + WGPUStatus wgpuGetInstanceLimits(WGPUInstanceLimits* limits) + WGPUBool wgpuHasInstanceFeature(WGPUInstanceFeatureName feature) + WGPUProc wgpuGetProcAddress(WGPUStringView procName) + WGPUDevice wgpuAdapterCreateDevice(WGPUAdapter adapter, const WGPUDeviceDescriptor* descriptor) + void wgpuAdapterGetFeatures(WGPUAdapter adapter, WGPUSupportedFeatures* features) + WGPUStatus wgpuAdapterGetFormatCapabilities(WGPUAdapter adapter, WGPUTextureFormat format, WGPUDawnFormatCapabilities* capabilities) + WGPUStatus wgpuAdapterGetInfo(WGPUAdapter adapter, WGPUAdapterInfo* info) + WGPUInstance wgpuAdapterGetInstance(WGPUAdapter adapter) + WGPUStatus wgpuAdapterGetLimits(WGPUAdapter adapter, WGPULimits* limits) + WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) + WGPUFuture wgpuAdapterRequestDevice(WGPUAdapter adapter, const WGPUDeviceDescriptor* descriptor, WGPURequestDeviceCallbackInfo callbackInfo) + void wgpuAdapterAddRef(WGPUAdapter adapter) + void wgpuAdapterRelease(WGPUAdapter adapter) + void wgpuAdapterInfoFreeMembers(WGPUAdapterInfo adapterInfo) + void wgpuAdapterPropertiesMemoryHeapsFreeMembers(WGPUAdapterPropertiesMemoryHeaps adapterPropertiesMemoryHeaps) + void wgpuAdapterPropertiesSubgroupMatrixConfigsFreeMembers(WGPUAdapterPropertiesSubgroupMatrixConfigs adapterPropertiesSubgroupMatrixConfigs) + void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, WGPUStringView label) + void wgpuBindGroupAddRef(WGPUBindGroup bindGroup) + void wgpuBindGroupRelease(WGPUBindGroup bindGroup) + void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, WGPUStringView label) + void wgpuBindGroupLayoutAddRef(WGPUBindGroupLayout bindGroupLayout) + void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout) + WGPUTexelBufferView wgpuBufferCreateTexelView(WGPUBuffer buffer, const WGPUTexelBufferViewDescriptor* descriptor) + void wgpuBufferDestroy(WGPUBuffer buffer) + const void* wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size) + void* wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size) + WGPUBufferMapState wgpuBufferGetMapState(WGPUBuffer buffer) + uint64_t wgpuBufferGetSize(WGPUBuffer buffer) + WGPUBufferUsage wgpuBufferGetUsage(WGPUBuffer buffer) + WGPUFuture wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapMode mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) + WGPUStatus wgpuBufferReadMappedRange(WGPUBuffer buffer, size_t offset, void* data, size_t size) + void wgpuBufferSetLabel(WGPUBuffer buffer, WGPUStringView label) + void wgpuBufferUnmap(WGPUBuffer buffer) + WGPUStatus wgpuBufferWriteMappedRange(WGPUBuffer buffer, size_t offset, const void* data, size_t size) + void wgpuBufferAddRef(WGPUBuffer buffer) + void wgpuBufferRelease(WGPUBuffer buffer) + void wgpuCommandBufferSetLabel(WGPUCommandBuffer commandBuffer, WGPUStringView label) + void wgpuCommandBufferAddRef(WGPUCommandBuffer commandBuffer) + void wgpuCommandBufferRelease(WGPUCommandBuffer commandBuffer) + WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, const WGPUComputePassDescriptor* descriptor) + WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, const WGPURenderPassDescriptor* descriptor) + void wgpuCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) + void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) + void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, const WGPUTexelCopyBufferInfo* source, const WGPUTexelCopyTextureInfo* destination, const WGPUExtent3D* copySize) + void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, const WGPUTexelCopyTextureInfo* source, const WGPUTexelCopyBufferInfo* destination, const WGPUExtent3D* copySize) + void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, const WGPUTexelCopyTextureInfo* source, const WGPUTexelCopyTextureInfo* destination, const WGPUExtent3D* copySize) + WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, const WGPUCommandBufferDescriptor* descriptor) + void wgpuCommandEncoderInjectValidationError(WGPUCommandEncoder commandEncoder, WGPUStringView message) + void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, WGPUStringView markerLabel) + void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder) + void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, WGPUStringView groupLabel) + void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) + void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, WGPUStringView label) + void wgpuCommandEncoderWriteBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, const void* data, size_t size) + void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) + void wgpuCommandEncoderAddRef(WGPUCommandEncoder commandEncoder) + void wgpuCommandEncoderRelease(WGPUCommandEncoder commandEncoder) + void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) + void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) + void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) + void wgpuComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, WGPUStringView markerLabel) + void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder) + void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, WGPUStringView groupLabel) + void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t* dynamicOffsets) + void wgpuComputePassEncoderSetImmediates(WGPUComputePassEncoder computePassEncoder, uint32_t offset, const void* data, size_t size) + void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, WGPUStringView label) + void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) + void wgpuComputePassEncoderSetResourceTable(WGPUComputePassEncoder computePassEncoder, WGPUResourceTable table) + void wgpuComputePassEncoderWriteTimestamp(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) + void wgpuComputePassEncoderAddRef(WGPUComputePassEncoder computePassEncoder) + void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder) + WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex) + void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, WGPUStringView label) + void wgpuComputePipelineAddRef(WGPUComputePipeline computePipeline) + void wgpuComputePipelineRelease(WGPUComputePipeline computePipeline) + void wgpuDawnDrmFormatCapabilitiesFreeMembers(WGPUDawnDrmFormatCapabilities dawnDrmFormatCapabilities) + WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, const WGPUBindGroupDescriptor* descriptor) + WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, const WGPUBindGroupLayoutDescriptor* descriptor) + WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, const WGPUBufferDescriptor* descriptor) + WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, const WGPUCommandEncoderDescriptor* descriptor) + WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, const WGPUComputePipelineDescriptor* descriptor) + WGPUFuture wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, const WGPUComputePipelineDescriptor* descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) + WGPUBuffer wgpuDeviceCreateErrorBuffer(WGPUDevice device, const WGPUBufferDescriptor* descriptor) + WGPUComputePipeline wgpuDeviceCreateErrorComputePipeline(WGPUDevice device, WGPUStringView label) + WGPUExternalTexture wgpuDeviceCreateErrorExternalTexture(WGPUDevice device) + WGPURenderPipeline wgpuDeviceCreateErrorRenderPipeline(WGPUDevice device, WGPUStringView label) + WGPUShaderModule wgpuDeviceCreateErrorShaderModule(WGPUDevice device, const WGPUShaderModuleDescriptor* descriptor, WGPUStringView errorMessage) + WGPUTexture wgpuDeviceCreateErrorTexture(WGPUDevice device, const WGPUTextureDescriptor* descriptor) + WGPUExternalTexture wgpuDeviceCreateExternalTexture(WGPUDevice device, const WGPUExternalTextureDescriptor* externalTextureDescriptor) + WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, const WGPUPipelineLayoutDescriptor* descriptor) + WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, const WGPUQuerySetDescriptor* descriptor) + WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, const WGPURenderBundleEncoderDescriptor* descriptor) + WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, const WGPURenderPipelineDescriptor* descriptor) + WGPUFuture wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, const WGPURenderPipelineDescriptor* descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) + WGPUResourceTable wgpuDeviceCreateResourceTable(WGPUDevice device, const WGPUResourceTableDescriptor* descriptor) + WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, const WGPUSamplerDescriptor* descriptor) + WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, const WGPUShaderModuleDescriptor* descriptor) + WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, const WGPUTextureDescriptor* descriptor) + void wgpuDeviceDestroy(WGPUDevice device) + void wgpuDeviceForceLoss(WGPUDevice device, WGPUDeviceLostReason type, WGPUStringView message) + WGPUAdapter wgpuDeviceGetAdapter(WGPUDevice device) + WGPUStatus wgpuDeviceGetAdapterInfo(WGPUDevice device, WGPUAdapterInfo* adapterInfo) + WGPUStatus wgpuDeviceGetAHardwareBufferProperties(WGPUDevice device, void* handle, WGPUAHardwareBufferProperties* properties) + void wgpuDeviceGetFeatures(WGPUDevice device, WGPUSupportedFeatures* features) + WGPUStatus wgpuDeviceGetLimits(WGPUDevice device, WGPULimits* limits) + WGPUFuture wgpuDeviceGetLostFuture(WGPUDevice device) + WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) + WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) + WGPUSharedBufferMemory wgpuDeviceImportSharedBufferMemory(WGPUDevice device, const WGPUSharedBufferMemoryDescriptor* descriptor) + WGPUSharedFence wgpuDeviceImportSharedFence(WGPUDevice device, const WGPUSharedFenceDescriptor* descriptor) + WGPUSharedTextureMemory wgpuDeviceImportSharedTextureMemory(WGPUDevice device, const WGPUSharedTextureMemoryDescriptor* descriptor) + void wgpuDeviceInjectError(WGPUDevice device, WGPUErrorType type, WGPUStringView message) + WGPUFuture wgpuDevicePopErrorScope(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) + void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) + void wgpuDeviceSetLabel(WGPUDevice device, WGPUStringView label) + void wgpuDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallbackInfo callbackInfo) + void wgpuDeviceTick(WGPUDevice device) + void wgpuDeviceValidateTextureDescriptor(WGPUDevice device, const WGPUTextureDescriptor* descriptor) + void wgpuDeviceAddRef(WGPUDevice device) + void wgpuDeviceRelease(WGPUDevice device) + void wgpuExternalTextureDestroy(WGPUExternalTexture externalTexture) + void wgpuExternalTextureExpire(WGPUExternalTexture externalTexture) + void wgpuExternalTextureRefresh(WGPUExternalTexture externalTexture) + void wgpuExternalTextureSetLabel(WGPUExternalTexture externalTexture, WGPUStringView label) + void wgpuExternalTextureAddRef(WGPUExternalTexture externalTexture) + void wgpuExternalTextureRelease(WGPUExternalTexture externalTexture) + WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, const WGPUSurfaceDescriptor* descriptor) + void wgpuInstanceGetWGSLLanguageFeatures(WGPUInstance instance, WGPUSupportedWGSLLanguageFeatures* features) + WGPUBool wgpuInstanceHasWGSLLanguageFeature(WGPUInstance instance, WGPUWGSLLanguageFeatureName feature) + void wgpuInstanceProcessEvents(WGPUInstance instance) + WGPUFuture wgpuInstanceRequestAdapter(WGPUInstance instance, const WGPURequestAdapterOptions* options, WGPURequestAdapterCallbackInfo callbackInfo) + WGPUWaitStatus wgpuInstanceWaitAny(WGPUInstance instance, size_t futureCount, WGPUFutureWaitInfo* futures, uint64_t timeoutNS) + void wgpuInstanceAddRef(WGPUInstance instance) + void wgpuInstanceRelease(WGPUInstance instance) + void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, WGPUStringView label) + void wgpuPipelineLayoutAddRef(WGPUPipelineLayout pipelineLayout) + void wgpuPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout) + void wgpuQuerySetDestroy(WGPUQuerySet querySet) + uint32_t wgpuQuerySetGetCount(WGPUQuerySet querySet) + WGPUQueryType wgpuQuerySetGetType(WGPUQuerySet querySet) + void wgpuQuerySetSetLabel(WGPUQuerySet querySet, WGPUStringView label) + void wgpuQuerySetAddRef(WGPUQuerySet querySet) + void wgpuQuerySetRelease(WGPUQuerySet querySet) + void wgpuQueueCopyExternalTextureForBrowser(WGPUQueue queue, const WGPUImageCopyExternalTexture* source, const WGPUTexelCopyTextureInfo* destination, const WGPUExtent3D* copySize, const WGPUCopyTextureForBrowserOptions* options) + void wgpuQueueCopyTextureForBrowser(WGPUQueue queue, const WGPUTexelCopyTextureInfo* source, const WGPUTexelCopyTextureInfo* destination, const WGPUExtent3D* copySize, const WGPUCopyTextureForBrowserOptions* options) + WGPUFuture wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo) + void wgpuQueueSetLabel(WGPUQueue queue, WGPUStringView label) + void wgpuQueueSubmit(WGPUQueue queue, size_t commandCount, const WGPUCommandBuffer* commands) + void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, const void* data, size_t size) + void wgpuQueueWriteTexture(WGPUQueue queue, const WGPUTexelCopyTextureInfo* destination, const void* data, size_t dataSize, const WGPUTexelCopyBufferLayout* dataLayout, const WGPUExtent3D* writeSize) + void wgpuQueueAddRef(WGPUQueue queue) + void wgpuQueueRelease(WGPUQueue queue) + void wgpuRenderBundleSetLabel(WGPURenderBundle renderBundle, WGPUStringView label) + void wgpuRenderBundleAddRef(WGPURenderBundle renderBundle) + void wgpuRenderBundleRelease(WGPURenderBundle renderBundle) + void wgpuRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) + void wgpuRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) + void wgpuRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) + void wgpuRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) + WGPURenderBundle wgpuRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, const WGPURenderBundleDescriptor* descriptor) + void wgpuRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView markerLabel) + void wgpuRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder) + void wgpuRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView groupLabel) + void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t* dynamicOffsets) + void wgpuRenderBundleEncoderSetImmediates(WGPURenderBundleEncoder renderBundleEncoder, uint32_t offset, const void* data, size_t size) + void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) + void wgpuRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView label) + void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) + void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size) + void wgpuRenderBundleEncoderAddRef(WGPURenderBundleEncoder renderBundleEncoder) + void wgpuRenderBundleEncoderRelease(WGPURenderBundleEncoder renderBundleEncoder) + void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) + void wgpuRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) + void wgpuRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) + void wgpuRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) + void wgpuRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) + void wgpuRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder) + void wgpuRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder) + void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, const WGPURenderBundle* bundles) + void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, WGPUStringView markerLabel) + void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) + void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) + void wgpuRenderPassEncoderPixelLocalStorageBarrier(WGPURenderPassEncoder renderPassEncoder) + void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder) + void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, WGPUStringView groupLabel) + void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t* dynamicOffsets) + void wgpuRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, const WGPUColor* color) + void wgpuRenderPassEncoderSetImmediates(WGPURenderPassEncoder renderPassEncoder, uint32_t offset, const void* data, size_t size) + void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) + void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, WGPUStringView label) + void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) + void wgpuRenderPassEncoderSetResourceTable(WGPURenderPassEncoder renderPassEncoder, WGPUResourceTable table) + void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) + void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) + void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size) + void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) + void wgpuRenderPassEncoderWriteTimestamp(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) + void wgpuRenderPassEncoderAddRef(WGPURenderPassEncoder renderPassEncoder) + void wgpuRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder) + WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex) + void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, WGPUStringView label) + void wgpuRenderPipelineAddRef(WGPURenderPipeline renderPipeline) + void wgpuRenderPipelineRelease(WGPURenderPipeline renderPipeline) + void wgpuResourceTableDestroy(WGPUResourceTable resourceTable) + uint32_t wgpuResourceTableGetSize(WGPUResourceTable resourceTable) + uint32_t wgpuResourceTableInsert(WGPUResourceTable resourceTable, const WGPUBindingResource* resource) + WGPUStatus wgpuResourceTableRemove(WGPUResourceTable resourceTable, uint32_t slot) + void wgpuResourceTableSetLabel(WGPUResourceTable resourceTable, WGPUStringView label) + WGPUStatus wgpuResourceTableUpdate(WGPUResourceTable resourceTable, uint32_t slot, const WGPUBindingResource* resource) + void wgpuResourceTableAddRef(WGPUResourceTable resourceTable) + void wgpuResourceTableRelease(WGPUResourceTable resourceTable) + void wgpuSamplerSetLabel(WGPUSampler sampler, WGPUStringView label) + void wgpuSamplerAddRef(WGPUSampler sampler) + void wgpuSamplerRelease(WGPUSampler sampler) + WGPUFuture wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallbackInfo callbackInfo) + void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, WGPUStringView label) + void wgpuShaderModuleAddRef(WGPUShaderModule shaderModule) + void wgpuShaderModuleRelease(WGPUShaderModule shaderModule) + WGPUStatus wgpuSharedBufferMemoryBeginAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, const WGPUSharedBufferMemoryBeginAccessDescriptor* descriptor) + WGPUBuffer wgpuSharedBufferMemoryCreateBuffer(WGPUSharedBufferMemory sharedBufferMemory, const WGPUBufferDescriptor* descriptor) + WGPUStatus wgpuSharedBufferMemoryEndAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryEndAccessState* descriptor) + WGPUStatus wgpuSharedBufferMemoryGetProperties(WGPUSharedBufferMemory sharedBufferMemory, WGPUSharedBufferMemoryProperties* properties) + WGPUBool wgpuSharedBufferMemoryIsDeviceLost(WGPUSharedBufferMemory sharedBufferMemory) + void wgpuSharedBufferMemorySetLabel(WGPUSharedBufferMemory sharedBufferMemory, WGPUStringView label) + void wgpuSharedBufferMemoryAddRef(WGPUSharedBufferMemory sharedBufferMemory) + void wgpuSharedBufferMemoryRelease(WGPUSharedBufferMemory sharedBufferMemory) + void wgpuSharedBufferMemoryEndAccessStateFreeMembers(WGPUSharedBufferMemoryEndAccessState sharedBufferMemoryEndAccessState) + void wgpuSharedFenceExportInfo(WGPUSharedFence sharedFence, WGPUSharedFenceExportInfo* info) + void wgpuSharedFenceSetLabel(WGPUSharedFence sharedFence, WGPUStringView label) + void wgpuSharedFenceAddRef(WGPUSharedFence sharedFence) + void wgpuSharedFenceRelease(WGPUSharedFence sharedFence) + WGPUStatus wgpuSharedTextureMemoryBeginAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, const WGPUSharedTextureMemoryBeginAccessDescriptor* descriptor) + WGPUTexture wgpuSharedTextureMemoryCreateTexture(WGPUSharedTextureMemory sharedTextureMemory, const WGPUTextureDescriptor* descriptor) + WGPUStatus wgpuSharedTextureMemoryEndAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryEndAccessState* descriptor) + WGPUStatus wgpuSharedTextureMemoryGetProperties(WGPUSharedTextureMemory sharedTextureMemory, WGPUSharedTextureMemoryProperties* properties) + WGPUBool wgpuSharedTextureMemoryIsDeviceLost(WGPUSharedTextureMemory sharedTextureMemory) + void wgpuSharedTextureMemorySetLabel(WGPUSharedTextureMemory sharedTextureMemory, WGPUStringView label) + void wgpuSharedTextureMemoryAddRef(WGPUSharedTextureMemory sharedTextureMemory) + void wgpuSharedTextureMemoryRelease(WGPUSharedTextureMemory sharedTextureMemory) + void wgpuSharedTextureMemoryEndAccessStateFreeMembers(WGPUSharedTextureMemoryEndAccessState sharedTextureMemoryEndAccessState) + void wgpuSupportedFeaturesFreeMembers(WGPUSupportedFeatures supportedFeatures) + void wgpuSupportedInstanceFeaturesFreeMembers(WGPUSupportedInstanceFeatures supportedInstanceFeatures) + void wgpuSupportedWGSLLanguageFeaturesFreeMembers(WGPUSupportedWGSLLanguageFeatures supportedWGSLLanguageFeatures) + void wgpuSurfaceConfigure(WGPUSurface surface, const WGPUSurfaceConfiguration* config) + WGPUStatus wgpuSurfaceGetCapabilities(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities* capabilities) + void wgpuSurfaceGetCurrentTexture(WGPUSurface surface, WGPUSurfaceTexture* surfaceTexture) + WGPUStatus wgpuSurfacePresent(WGPUSurface surface) + void wgpuSurfaceSetLabel(WGPUSurface surface, WGPUStringView label) + void wgpuSurfaceUnconfigure(WGPUSurface surface) + void wgpuSurfaceAddRef(WGPUSurface surface) + void wgpuSurfaceRelease(WGPUSurface surface) + void wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities surfaceCapabilities) + void wgpuTexelBufferViewSetLabel(WGPUTexelBufferView texelBufferView, WGPUStringView label) + void wgpuTexelBufferViewAddRef(WGPUTexelBufferView texelBufferView) + void wgpuTexelBufferViewRelease(WGPUTexelBufferView texelBufferView) + WGPUTextureView wgpuTextureCreateErrorView(WGPUTexture texture, const WGPUTextureViewDescriptor* descriptor) + WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, const WGPUTextureViewDescriptor* descriptor) + void wgpuTextureDestroy(WGPUTexture texture) + uint32_t wgpuTextureGetDepthOrArrayLayers(WGPUTexture texture) + WGPUTextureDimension wgpuTextureGetDimension(WGPUTexture texture) + WGPUTextureFormat wgpuTextureGetFormat(WGPUTexture texture) + uint32_t wgpuTextureGetHeight(WGPUTexture texture) + uint32_t wgpuTextureGetMipLevelCount(WGPUTexture texture) + uint32_t wgpuTextureGetSampleCount(WGPUTexture texture) + WGPUTextureViewDimension wgpuTextureGetTextureBindingViewDimension(WGPUTexture texture) + WGPUTextureUsage wgpuTextureGetUsage(WGPUTexture texture) + uint32_t wgpuTextureGetWidth(WGPUTexture texture) + void wgpuTextureSetLabel(WGPUTexture texture, WGPUStringView label) + void wgpuTextureSetOwnershipForMemoryDump(WGPUTexture texture, uint64_t ownerGuid) + void wgpuTextureAddRef(WGPUTexture texture) + void wgpuTextureRelease(WGPUTexture texture) + void wgpuTextureViewSetLabel(WGPUTextureView textureView, WGPUStringView label) + void wgpuTextureViewAddRef(WGPUTextureView textureView) + void wgpuTextureViewRelease(WGPUTextureView textureView) + + +# %% Generated helpers + + +cdef inline dict limits_to_dict(const WGPULimits* c): + """Convert a WGPULimits struct to a dict with wgpu-py limit names.""" + return { + "max-texture-dimension-1d": c.maxTextureDimension1D, + "max-texture-dimension-2d": c.maxTextureDimension2D, + "max-texture-dimension-3d": c.maxTextureDimension3D, + "max-texture-array-layers": c.maxTextureArrayLayers, + "max-bind-groups": c.maxBindGroups, + "max-bind-groups-plus-vertex-buffers": c.maxBindGroupsPlusVertexBuffers, + "max-bindings-per-bind-group": c.maxBindingsPerBindGroup, + "max-dynamic-uniform-buffers-per-pipeline-layout": c.maxDynamicUniformBuffersPerPipelineLayout, + "max-dynamic-storage-buffers-per-pipeline-layout": c.maxDynamicStorageBuffersPerPipelineLayout, + "max-sampled-textures-per-shader-stage": c.maxSampledTexturesPerShaderStage, + "max-samplers-per-shader-stage": c.maxSamplersPerShaderStage, + "max-storage-buffers-per-shader-stage": c.maxStorageBuffersPerShaderStage, + "max-storage-textures-per-shader-stage": c.maxStorageTexturesPerShaderStage, + "max-uniform-buffers-per-shader-stage": c.maxUniformBuffersPerShaderStage, + "max-uniform-buffer-binding-size": c.maxUniformBufferBindingSize, + "max-storage-buffer-binding-size": c.maxStorageBufferBindingSize, + "min-uniform-buffer-offset-alignment": c.minUniformBufferOffsetAlignment, + "min-storage-buffer-offset-alignment": c.minStorageBufferOffsetAlignment, + "max-vertex-buffers": c.maxVertexBuffers, + "max-buffer-size": c.maxBufferSize, + "max-vertex-attributes": c.maxVertexAttributes, + "max-vertex-buffer-array-stride": c.maxVertexBufferArrayStride, + "max-inter-stage-shader-variables": c.maxInterStageShaderVariables, + "max-color-attachments": c.maxColorAttachments, + "max-color-attachment-bytes-per-sample": c.maxColorAttachmentBytesPerSample, + "max-compute-workgroup-storage-size": c.maxComputeWorkgroupStorageSize, + "max-compute-invocations-per-workgroup": c.maxComputeInvocationsPerWorkgroup, + "max-compute-workgroup-size-x": c.maxComputeWorkgroupSizeX, + "max-compute-workgroup-size-y": c.maxComputeWorkgroupSizeY, + "max-compute-workgroup-size-z": c.maxComputeWorkgroupSizeZ, + "max-compute-workgroups-per-dimension": c.maxComputeWorkgroupsPerDimension, + "max-immediate-size": c.maxImmediateSize, + } + + +cdef inline int dict_to_limits(dict d, WGPULimits* c) except -1: + """Set the fields of a WGPULimits struct from a dict with wgpu-py limit names.""" + cdef object v + v = d.get("max-texture-dimension-1d") + if v is not None: + c.maxTextureDimension1D = v + v = d.get("max-texture-dimension-2d") + if v is not None: + c.maxTextureDimension2D = v + v = d.get("max-texture-dimension-3d") + if v is not None: + c.maxTextureDimension3D = v + v = d.get("max-texture-array-layers") + if v is not None: + c.maxTextureArrayLayers = v + v = d.get("max-bind-groups") + if v is not None: + c.maxBindGroups = v + v = d.get("max-bind-groups-plus-vertex-buffers") + if v is not None: + c.maxBindGroupsPlusVertexBuffers = v + v = d.get("max-bindings-per-bind-group") + if v is not None: + c.maxBindingsPerBindGroup = v + v = d.get("max-dynamic-uniform-buffers-per-pipeline-layout") + if v is not None: + c.maxDynamicUniformBuffersPerPipelineLayout = v + v = d.get("max-dynamic-storage-buffers-per-pipeline-layout") + if v is not None: + c.maxDynamicStorageBuffersPerPipelineLayout = v + v = d.get("max-sampled-textures-per-shader-stage") + if v is not None: + c.maxSampledTexturesPerShaderStage = v + v = d.get("max-samplers-per-shader-stage") + if v is not None: + c.maxSamplersPerShaderStage = v + v = d.get("max-storage-buffers-per-shader-stage") + if v is not None: + c.maxStorageBuffersPerShaderStage = v + v = d.get("max-storage-textures-per-shader-stage") + if v is not None: + c.maxStorageTexturesPerShaderStage = v + v = d.get("max-uniform-buffers-per-shader-stage") + if v is not None: + c.maxUniformBuffersPerShaderStage = v + v = d.get("max-uniform-buffer-binding-size") + if v is not None: + c.maxUniformBufferBindingSize = v + v = d.get("max-storage-buffer-binding-size") + if v is not None: + c.maxStorageBufferBindingSize = v + v = d.get("min-uniform-buffer-offset-alignment") + if v is not None: + c.minUniformBufferOffsetAlignment = v + v = d.get("min-storage-buffer-offset-alignment") + if v is not None: + c.minStorageBufferOffsetAlignment = v + v = d.get("max-vertex-buffers") + if v is not None: + c.maxVertexBuffers = v + v = d.get("max-buffer-size") + if v is not None: + c.maxBufferSize = v + v = d.get("max-vertex-attributes") + if v is not None: + c.maxVertexAttributes = v + v = d.get("max-vertex-buffer-array-stride") + if v is not None: + c.maxVertexBufferArrayStride = v + v = d.get("max-inter-stage-shader-variables") + if v is not None: + c.maxInterStageShaderVariables = v + v = d.get("max-color-attachments") + if v is not None: + c.maxColorAttachments = v + v = d.get("max-color-attachment-bytes-per-sample") + if v is not None: + c.maxColorAttachmentBytesPerSample = v + v = d.get("max-compute-workgroup-storage-size") + if v is not None: + c.maxComputeWorkgroupStorageSize = v + v = d.get("max-compute-invocations-per-workgroup") + if v is not None: + c.maxComputeInvocationsPerWorkgroup = v + v = d.get("max-compute-workgroup-size-x") + if v is not None: + c.maxComputeWorkgroupSizeX = v + v = d.get("max-compute-workgroup-size-y") + if v is not None: + c.maxComputeWorkgroupSizeY = v + v = d.get("max-compute-workgroup-size-z") + if v is not None: + c.maxComputeWorkgroupSizeZ = v + v = d.get("max-compute-workgroups-per-dimension") + if v is not None: + c.maxComputeWorkgroupsPerDimension = v + v = d.get("max-immediate-size") + if v is not None: + c.maxImmediateSize = v + return 0 diff --git a/wgpu/resources/codegen_report.md b/wgpu/resources/codegen_report.md index 92d2a09b1..df3b4832a 100644 --- a/wgpu/resources/codegen_report.md +++ b/wgpu/resources/codegen_report.md @@ -4,6 +4,8 @@ * The webgpu.idl defines 5 flags, 34 enums, 60 structs * webgpu.h/wgpu.h define 228 functions * webgpu.h/wgpu.h define 8 flags, 70 enums, 115 structs +* Dawn webgpu.h define 276 functions +* Dawn webgpu.h define 6 flags, 65 enums, 197 structs ## Updating API * Wrote 5 flags to flags.py * Wrote 34 enums to enums.py @@ -34,3 +36,12 @@ * Validated 154 C function calls * Not using 85 C functions * Validated 96 C structs +## Validating backends/dawn +* Enum PipelineErrorReason missing in Dawn's webgpu.h +* Enum AutoLayoutMode missing in Dawn's webgpu.h +* Enum CanvasAlphaMode missing in Dawn's webgpu.h +* Enum CanvasToneMappingMode missing in Dawn's webgpu.h +* Wrote 268 enum mappings to dawn/_mappings.py +* Wrote _webgpu.pxd with 276 functions, 196 structs, 195 initializers +### Checking API for backends/dawn/_api.pyx +* Found 40 classes, 0 methods not implemented diff --git a/wgpu/resources/dawn_webgpu.h b/wgpu/resources/dawn_webgpu.h new file mode 100644 index 000000000..324d12d9b --- /dev/null +++ b/wgpu/resources/dawn_webgpu.h @@ -0,0 +1,5118 @@ +// BSD 3-Clause License +// +// Copyright (c) 2019, "WebGPU native" developers +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#ifdef __EMSCRIPTEN__ +#error "Do not include this header. Use the headers provided by Emdawnwebgpu instead." +#endif + +#ifndef WEBGPU_H_ +#define WEBGPU_H_ + +#if defined(WGPU_SHARED_LIBRARY) +# if defined(_WIN32) +# if defined(WGPU_IMPLEMENTATION) +# define WGPU_EXPORT __declspec(dllexport) +# else +# define WGPU_EXPORT __declspec(dllimport) +# endif +# else // defined(_WIN32) +# if defined(WGPU_IMPLEMENTATION) +# define WGPU_EXPORT __attribute__((visibility("default"))) +# else +# define WGPU_EXPORT +# endif +# endif // defined(_WIN32) +#else // defined(WGPU_SHARED_LIBRARY) +# define WGPU_EXPORT +#endif // defined(WGPU_SHARED_LIBRARY) + +#if !defined(WGPU_OBJECT_ATTRIBUTE) +#define WGPU_OBJECT_ATTRIBUTE +#endif +#if !defined(WGPU_ENUM_ATTRIBUTE) +#define WGPU_ENUM_ATTRIBUTE +#endif +#if !defined(WGPU_STRUCTURE_ATTRIBUTE) +#define WGPU_STRUCTURE_ATTRIBUTE +#endif +#if !defined(WGPU_FUNCTION_ATTRIBUTE) +#define WGPU_FUNCTION_ATTRIBUTE +#endif +#if !defined(WGPU_NULLABLE) +#define WGPU_NULLABLE +#endif + +#include +#include +#include + +#define _wgpu_COMMA , +#if defined(__cplusplus) +# define _wgpu_ENUM_ZERO_INIT(type) type(0) +# define _wgpu_STRUCT_ZERO_INIT {} +# if __cplusplus >= 201103L +# define _wgpu_MAKE_INIT_STRUCT(type, value) (type value) +# else +# define _wgpu_MAKE_INIT_STRUCT(type, value) value +# endif +#else +# define _wgpu_ENUM_ZERO_INIT(type) (type)0 +# define _wgpu_STRUCT_ZERO_INIT {0} +# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +# define _wgpu_MAKE_INIT_STRUCT(type, value) ((type) value) +# else +# define _wgpu_MAKE_INIT_STRUCT(type, value) value +# endif +#endif + +#define WGPU_TRUE (UINT32_C(1)) +#define WGPU_FALSE (UINT32_C(0)) +#define WGPU_ARRAY_LAYER_COUNT_UNDEFINED (UINT32_MAX) +#define WGPU_COPY_STRIDE_UNDEFINED (UINT32_MAX) +#define WGPU_DEPTH_CLEAR_VALUE_UNDEFINED (NAN) +#define WGPU_DEPTH_SLICE_UNDEFINED (UINT32_MAX) +#define WGPU_INVALID_BINDING (UINT32_MAX) +#define WGPU_LIMIT_U32_UNDEFINED (UINT32_MAX) +#define WGPU_LIMIT_U64_UNDEFINED (UINT64_MAX) +#define WGPU_MIP_LEVEL_COUNT_UNDEFINED (UINT32_MAX) +#define WGPU_QUERY_SET_INDEX_UNDEFINED (UINT32_MAX) +#define WGPU_STRLEN (SIZE_MAX) +#define WGPU_WHOLE_MAP_SIZE (SIZE_MAX) +#define WGPU_WHOLE_SIZE (UINT64_MAX) + +typedef struct WGPUStringView { + WGPU_NULLABLE char const * data; + size_t length; +} WGPUStringView WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_STRING_VIEW_INIT _wgpu_MAKE_INIT_STRUCT(WGPUStringView, { \ + /*.data=*/NULL _wgpu_COMMA \ + /*.length=*/WGPU_STRLEN _wgpu_COMMA \ +}) + +typedef uint64_t WGPUFlags; +typedef uint32_t WGPUBool; + +typedef struct WGPUAdapterImpl* WGPUAdapter WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUBindGroupImpl* WGPUBindGroup WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUBindGroupLayoutImpl* WGPUBindGroupLayout WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUBufferImpl* WGPUBuffer WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUCommandBufferImpl* WGPUCommandBuffer WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUCommandEncoderImpl* WGPUCommandEncoder WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUComputePassEncoderImpl* WGPUComputePassEncoder WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUComputePipelineImpl* WGPUComputePipeline WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUDeviceImpl* WGPUDevice WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUExternalTextureImpl* WGPUExternalTexture WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUInstanceImpl* WGPUInstance WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUPipelineLayoutImpl* WGPUPipelineLayout WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUQuerySetImpl* WGPUQuerySet WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUQueueImpl* WGPUQueue WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPURenderBundleImpl* WGPURenderBundle WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPURenderBundleEncoderImpl* WGPURenderBundleEncoder WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPURenderPassEncoderImpl* WGPURenderPassEncoder WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPURenderPipelineImpl* WGPURenderPipeline WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUResourceTableImpl* WGPUResourceTable WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSamplerImpl* WGPUSampler WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUShaderModuleImpl* WGPUShaderModule WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSharedBufferMemoryImpl* WGPUSharedBufferMemory WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSharedFenceImpl* WGPUSharedFence WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSharedTextureMemoryImpl* WGPUSharedTextureMemory WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUSurfaceImpl* WGPUSurface WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUTexelBufferViewImpl* WGPUTexelBufferView WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUTextureImpl* WGPUTexture WGPU_OBJECT_ATTRIBUTE; +typedef struct WGPUTextureViewImpl* WGPUTextureView WGPU_OBJECT_ATTRIBUTE; + +// Structure forward declarations +struct WGPUAdapterPropertiesD3D; +struct WGPUAdapterPropertiesDrm; +struct WGPUAdapterPropertiesVk; +struct WGPUAdapterPropertiesWGPU; +struct WGPUBindingResource; +struct WGPUBlendComponent; +struct WGPUBufferBindingLayout; +struct WGPUBufferHostMappedPointer; +struct WGPUColor; +struct WGPUColorSpaceDawn; +struct WGPUColorTargetStateExpandResolveTextureDawn; +struct WGPUCommandBufferDescriptor; +struct WGPUCompatibilityModeLimits; +struct WGPUConstantEntry; +struct WGPUCopyTextureForBrowserOptions; +struct WGPUDawnAdapterPropertiesPowerPreference; +struct WGPUDawnBufferDescriptorErrorInfoFromWireClient; +struct WGPUDawnCacheDeviceDescriptor; +struct WGPUDawnCompilationMessageUtf16; +struct WGPUDawnConsumeAdapterDescriptor; +struct WGPUDawnDeviceAllocatorControl; +struct WGPUDawnDrmFormatProperties; +struct WGPUDawnEncoderInternalUsageDescriptor; +struct WGPUDawnFakeBufferOOMForTesting; +struct WGPUDawnFakeDeviceInitializeErrorForTesting; +struct WGPUDawnHostMappedPointerLimits; +struct WGPUDawnInjectedInvalidSType; +struct WGPUDawnRenderPassSampleCount; +struct WGPUDawnShaderModuleSPIRVOptionsDescriptor; +struct WGPUDawnShaderSourceSPIRV; +struct WGPUDawnTexelCopyBufferRowAlignmentLimits; +struct WGPUDawnTextureInternalUsageDescriptor; +struct WGPUDawnTogglesDescriptor; +struct WGPUDawnWGSLBlocklist; +struct WGPUDawnWireWGSLControl; +struct WGPUEmscriptenSurfaceSourceCanvasHTMLSelector; +struct WGPUExtent2D; +struct WGPUExtent3D; +struct WGPUExternalTextureBindingEntry; +struct WGPUExternalTextureBindingLayout; +struct WGPUFuture; +struct WGPUInstanceLimits; +struct WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER; +struct WGPUMemoryHeapInfo; +struct WGPUMultisampleState; +struct WGPUOrigin2D; +struct WGPUOrigin3D; +struct WGPUPassTimestampWrites; +struct WGPUPipelineLayoutResourceTable; +struct WGPUPipelineLayoutStorageAttachment; +struct WGPUPrimitiveState; +struct WGPUQuerySetDescriptor; +struct WGPUQueueDescriptor; +struct WGPURenderBundleDescriptor; +struct WGPURenderBundleEncoderResourceTable; +struct WGPURenderPassDepthStencilAttachment; +struct WGPURenderPassDescriptorResolveRect; +struct WGPURenderPassMaxDrawCount; +struct WGPURequestAdapterWebGPUBackendOptions; +struct WGPURequestAdapterWebXROptions; +struct WGPUResourceTableDescriptor; +struct WGPUSamplerBindingLayout; +struct WGPUShaderModuleCompilationOptions; +struct WGPUShaderSourceSPIRV; +struct WGPUShaderSourceWGSL; +struct WGPUSharedBufferMemoryBeginAccessDescriptor; +struct WGPUSharedBufferMemoryEndAccessState; +struct WGPUSharedBufferMemoryFromWindowsHandleDescriptor; +struct WGPUSharedBufferMemoryHostPointerDescriptor; +struct WGPUSharedBufferMemoryProperties; +struct WGPUSharedFenceDXGISharedHandleDescriptor; +struct WGPUSharedFenceDXGISharedHandleExportInfo; +struct WGPUSharedFenceEGLSyncDescriptor; +struct WGPUSharedFenceEGLSyncExportInfo; +struct WGPUSharedFenceMTLSharedEventDescriptor; +struct WGPUSharedFenceMTLSharedEventExportInfo; +struct WGPUSharedFenceSyncFDDescriptor; +struct WGPUSharedFenceSyncFDExportInfo; +struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor; +struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo; +struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor; +struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo; +struct WGPUSharedTextureMemoryAHardwareBufferDescriptor; +struct WGPUSharedTextureMemoryD3D11BeginState; +struct WGPUSharedTextureMemoryD3DSwapchainBeginState; +struct WGPUSharedTextureMemoryDmaBufPlane; +struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor; +struct WGPUSharedTextureMemoryEGLImageDescriptor; +struct WGPUSharedTextureMemoryIOSurfaceDescriptor; +struct WGPUSharedTextureMemoryOpaqueFDDescriptor; +struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor; +struct WGPUSharedTextureMemoryVkImageLayoutBeginState; +struct WGPUSharedTextureMemoryVkImageLayoutEndState; +struct WGPUSharedTextureMemoryZirconHandleDescriptor; +struct WGPUStaticSamplerBindingLayout; +struct WGPUStencilFaceState; +struct WGPUStorageTextureBindingLayout; +struct WGPUSubgroupMatrixConfig; +struct WGPUSupportedFeatures; +struct WGPUSupportedInstanceFeatures; +struct WGPUSupportedWGSLLanguageFeatures; +struct WGPUSurfaceCapabilities; +struct WGPUSurfaceColorManagement; +struct WGPUSurfaceConfiguration; +struct WGPUSurfaceDescriptorFromWindowsCoreWindow; +struct WGPUSurfaceDescriptorFromWindowsUWPSwapChainPanel; +struct WGPUSurfaceDescriptorFromWindowsWinUISwapChainPanel; +struct WGPUSurfaceSourceAndroidNativeWindow; +struct WGPUSurfaceSourceMetalLayer; +struct WGPUSurfaceSourceWaylandSurface; +struct WGPUSurfaceSourceWindowsHWND; +struct WGPUSurfaceSourceXCBWindow; +struct WGPUSurfaceSourceXlibWindow; +struct WGPUSurfaceTexture; +struct WGPUTexelBufferBindingEntry; +struct WGPUTexelBufferBindingLayout; +struct WGPUTexelBufferViewDescriptor; +struct WGPUTexelCopyBufferLayout; +struct WGPUTextureBindingLayout; +struct WGPUTextureBindingViewDimension; +struct WGPUTextureComponentSwizzle; +struct WGPUVertexAttribute; +struct WGPUYCbCrVkDescriptor; +struct WGPUAdapterPropertiesMemoryHeaps; +struct WGPUAdapterPropertiesSubgroupMatrixConfigs; +struct WGPUAHardwareBufferProperties; +struct WGPUBindGroupEntry; +struct WGPUBindGroupLayoutEntry; +struct WGPUBlendState; +struct WGPUBufferDescriptor; +struct WGPUCommandEncoderDescriptor; +struct WGPUCompilationMessage; +struct WGPUComputePassDescriptor; +struct WGPUComputeState; +struct WGPUDawnDrmFormatCapabilities; +struct WGPUDepthStencilState; +struct WGPUExternalTextureDescriptor; +struct WGPUFutureWaitInfo; +struct WGPUImageCopyExternalTexture; +struct WGPUInstanceDescriptor; +struct WGPULimits; +struct WGPUPipelineLayoutPixelLocalStorage; +struct WGPURenderBundleEncoderDescriptor; +struct WGPURenderPassColorAttachment; +struct WGPURenderPassRenderAreaRect; +struct WGPURenderPassStorageAttachment; +struct WGPURequestAdapterOptions; +struct WGPUSamplerDescriptor; +struct WGPUShaderModuleDescriptor; +struct WGPUSharedBufferMemoryDescriptor; +struct WGPUSharedFenceDescriptor; +struct WGPUSharedFenceExportInfo; +struct WGPUSharedTextureMemoryAHardwareBufferProperties; +struct WGPUSharedTextureMemoryBeginAccessDescriptor; +struct WGPUSharedTextureMemoryDmaBufDescriptor; +struct WGPUSharedTextureMemoryMetalEndAccessState; +struct WGPUSurfaceDescriptor; +struct WGPUTexelCopyBufferInfo; +struct WGPUTexelCopyTextureInfo; +struct WGPUTextureComponentSwizzleDescriptor; +struct WGPUTextureDescriptor; +struct WGPUVertexBufferLayout; +struct WGPUAdapterInfo; +struct WGPUBindGroupDescriptor; +struct WGPUBindGroupLayoutDescriptor; +struct WGPUColorTargetState; +struct WGPUCompilationInfo; +struct WGPUComputePipelineDescriptor; +struct WGPUDawnFormatCapabilities; +struct WGPUDeviceDescriptor; +struct WGPUPipelineLayoutDescriptor; +struct WGPURenderPassPixelLocalStorage; +struct WGPUSharedTextureMemoryDescriptor; +struct WGPUSharedTextureMemoryEndAccessState; +struct WGPUSharedTextureMemoryProperties; +struct WGPUTextureViewDescriptor; +struct WGPUVertexState; +struct WGPUFragmentState; +struct WGPURenderPassDescriptor; +struct WGPURenderPipelineDescriptor; + +// Callback info structure forward declarations. +struct WGPUBufferMapCallbackInfo; +struct WGPUCompilationInfoCallbackInfo; +struct WGPUCreateComputePipelineAsyncCallbackInfo; +struct WGPUCreateRenderPipelineAsyncCallbackInfo; +struct WGPUDawnLoadCacheDataCallbackInfo; +struct WGPUDawnStoreCacheDataCallbackInfo; +struct WGPUDeviceLostCallbackInfo; +struct WGPUDisposeCallbackInfo; +struct WGPULoggingCallbackInfo; +struct WGPUPopErrorScopeCallbackInfo; +struct WGPUQueueWorkDoneCallbackInfo; +struct WGPURequestAdapterCallbackInfo; +struct WGPURequestDeviceCallbackInfo; +struct WGPUUncapturedErrorCallbackInfo; + +// NOLINTBEGIN(cppcoreguidelines-use-enum-class) + +typedef enum WGPUAdapterType { + WGPUAdapterType_DiscreteGPU = 0x00000001, + WGPUAdapterType_IntegratedGPU = 0x00000002, + WGPUAdapterType_CPU = 0x00000003, + WGPUAdapterType_Unknown = 0x00000004, + WGPUAdapterType_Force32 = 0x7FFFFFFF +} WGPUAdapterType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUAddressMode { + WGPUAddressMode_Undefined = 0x00000000, + WGPUAddressMode_ClampToEdge = 0x00000001, + WGPUAddressMode_Repeat = 0x00000002, + WGPUAddressMode_MirrorRepeat = 0x00000003, + WGPUAddressMode_Force32 = 0x7FFFFFFF +} WGPUAddressMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUAlphaMode { + WGPUAlphaMode_Opaque = 0x00000001, + WGPUAlphaMode_Premultiplied = 0x00000002, + WGPUAlphaMode_Unpremultiplied = 0x00000003, + WGPUAlphaMode_Force32 = 0x7FFFFFFF +} WGPUAlphaMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUBackendType { + WGPUBackendType_Undefined = 0x00000000, + WGPUBackendType_Null = 0x00000001, + WGPUBackendType_WebGPU = 0x00000002, + WGPUBackendType_D3D11 = 0x00000003, + WGPUBackendType_D3D12 = 0x00000004, + WGPUBackendType_Metal = 0x00000005, + WGPUBackendType_Vulkan = 0x00000006, + WGPUBackendType_OpenGL = 0x00000007, + WGPUBackendType_OpenGLES = 0x00000008, + WGPUBackendType_Force32 = 0x7FFFFFFF +} WGPUBackendType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUBlendFactor { + WGPUBlendFactor_Undefined = 0x00000000, + WGPUBlendFactor_Zero = 0x00000001, + WGPUBlendFactor_One = 0x00000002, + WGPUBlendFactor_Src = 0x00000003, + WGPUBlendFactor_OneMinusSrc = 0x00000004, + WGPUBlendFactor_SrcAlpha = 0x00000005, + WGPUBlendFactor_OneMinusSrcAlpha = 0x00000006, + WGPUBlendFactor_Dst = 0x00000007, + WGPUBlendFactor_OneMinusDst = 0x00000008, + WGPUBlendFactor_DstAlpha = 0x00000009, + WGPUBlendFactor_OneMinusDstAlpha = 0x0000000A, + WGPUBlendFactor_SrcAlphaSaturated = 0x0000000B, + WGPUBlendFactor_Constant = 0x0000000C, + WGPUBlendFactor_OneMinusConstant = 0x0000000D, + WGPUBlendFactor_Src1 = 0x0000000E, + WGPUBlendFactor_OneMinusSrc1 = 0x0000000F, + WGPUBlendFactor_Src1Alpha = 0x00000010, + WGPUBlendFactor_OneMinusSrc1Alpha = 0x00000011, + WGPUBlendFactor_Force32 = 0x7FFFFFFF +} WGPUBlendFactor WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUBlendOperation { + WGPUBlendOperation_Undefined = 0x00000000, + WGPUBlendOperation_Add = 0x00000001, + WGPUBlendOperation_Subtract = 0x00000002, + WGPUBlendOperation_ReverseSubtract = 0x00000003, + WGPUBlendOperation_Min = 0x00000004, + WGPUBlendOperation_Max = 0x00000005, + WGPUBlendOperation_Force32 = 0x7FFFFFFF +} WGPUBlendOperation WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUBufferBindingType { + WGPUBufferBindingType_BindingNotUsed = 0x00000000, + WGPUBufferBindingType_Undefined = 0x00000001, + WGPUBufferBindingType_Uniform = 0x00000002, + WGPUBufferBindingType_Storage = 0x00000003, + WGPUBufferBindingType_ReadOnlyStorage = 0x00000004, + WGPUBufferBindingType_Force32 = 0x7FFFFFFF +} WGPUBufferBindingType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUBufferMapState { + WGPUBufferMapState_Unmapped = 0x00000001, + WGPUBufferMapState_Pending = 0x00000002, + WGPUBufferMapState_Mapped = 0x00000003, + WGPUBufferMapState_Force32 = 0x7FFFFFFF +} WGPUBufferMapState WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCallbackMode { + WGPUCallbackMode_WaitAnyOnly = 0x00000001, + WGPUCallbackMode_AllowProcessEvents = 0x00000002, + WGPUCallbackMode_AllowSpontaneous = 0x00000003, + WGPUCallbackMode_Force32 = 0x7FFFFFFF +} WGPUCallbackMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCallbackStatus { + WGPUCallbackStatus_Success = 0x00000001, + WGPUCallbackStatus_Error = 0x00000002, + WGPUCallbackStatus_Force32 = 0x7FFFFFFF +} WGPUCallbackStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUColorSpacePrimariesDawn { + WGPUColorSpacePrimariesDawn_SRGB = 0x00000001, + WGPUColorSpacePrimariesDawn_Rec709 = 0x00000001, + WGPUColorSpacePrimariesDawn_Rec601 = 0x00000002, + WGPUColorSpacePrimariesDawn_Rec2020 = 0x00000003, + WGPUColorSpacePrimariesDawn_DisplayP3 = 0x00000004, + WGPUColorSpacePrimariesDawn_Force32 = 0x7FFFFFFF +} WGPUColorSpacePrimariesDawn WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUColorSpaceTransferDawn { + WGPUColorSpaceTransferDawn_Identity = 0x00000001, + WGPUColorSpaceTransferDawn_SRGB = 0x00000002, + WGPUColorSpaceTransferDawn_DisplayP3 = 0x00000003, + WGPUColorSpaceTransferDawn_SMPTE_170M = 0x00000004, + WGPUColorSpaceTransferDawn_HLG = 0x00000005, + WGPUColorSpaceTransferDawn_PQ = 0x00000006, + WGPUColorSpaceTransferDawn_BT_1886 = 0x00000007, + WGPUColorSpaceTransferDawn_Force32 = 0x7FFFFFFF +} WGPUColorSpaceTransferDawn WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUColorSpaceYCbCrMatrixDawn { + WGPUColorSpaceYCbCrMatrixDawn_Identity = 0x00000001, + WGPUColorSpaceYCbCrMatrixDawn_Rec601 = 0x00000002, + WGPUColorSpaceYCbCrMatrixDawn_Rec709 = 0x00000003, + WGPUColorSpaceYCbCrMatrixDawn_Rec2020 = 0x00000004, + WGPUColorSpaceYCbCrMatrixDawn_Force32 = 0x7FFFFFFF +} WGPUColorSpaceYCbCrMatrixDawn WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUColorSpaceYCbCrRangeDawn { + WGPUColorSpaceYCbCrRangeDawn_Identity = 0x00000001, + WGPUColorSpaceYCbCrRangeDawn_Narrow = 0x00000002, + WGPUColorSpaceYCbCrRangeDawn_Full = 0x00000003, + WGPUColorSpaceYCbCrRangeDawn_Force32 = 0x7FFFFFFF +} WGPUColorSpaceYCbCrRangeDawn WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCompareFunction { + WGPUCompareFunction_Undefined = 0x00000000, + WGPUCompareFunction_Never = 0x00000001, + WGPUCompareFunction_Less = 0x00000002, + WGPUCompareFunction_Equal = 0x00000003, + WGPUCompareFunction_LessEqual = 0x00000004, + WGPUCompareFunction_Greater = 0x00000005, + WGPUCompareFunction_NotEqual = 0x00000006, + WGPUCompareFunction_GreaterEqual = 0x00000007, + WGPUCompareFunction_Always = 0x00000008, + WGPUCompareFunction_Force32 = 0x7FFFFFFF +} WGPUCompareFunction WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCompilationInfoRequestStatus { + WGPUCompilationInfoRequestStatus_Success = 0x00000001, + WGPUCompilationInfoRequestStatus_CallbackCancelled = 0x00000002, + WGPUCompilationInfoRequestStatus_Force32 = 0x7FFFFFFF +} WGPUCompilationInfoRequestStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCompilationMessageType { + WGPUCompilationMessageType_Error = 0x00000001, + WGPUCompilationMessageType_Warning = 0x00000002, + WGPUCompilationMessageType_Info = 0x00000003, + WGPUCompilationMessageType_Force32 = 0x7FFFFFFF +} WGPUCompilationMessageType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUComponentSwizzle { + WGPUComponentSwizzle_Undefined = 0x00000000, + WGPUComponentSwizzle_Zero = 0x00000001, + WGPUComponentSwizzle_One = 0x00000002, + WGPUComponentSwizzle_R = 0x00000003, + WGPUComponentSwizzle_G = 0x00000004, + WGPUComponentSwizzle_B = 0x00000005, + WGPUComponentSwizzle_A = 0x00000006, + WGPUComponentSwizzle_Force32 = 0x7FFFFFFF +} WGPUComponentSwizzle WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCompositeAlphaMode { + WGPUCompositeAlphaMode_Auto = 0x00000000, + WGPUCompositeAlphaMode_Opaque = 0x00000001, + WGPUCompositeAlphaMode_Premultiplied = 0x00000002, + WGPUCompositeAlphaMode_Unpremultiplied = 0x00000003, + WGPUCompositeAlphaMode_Inherit = 0x00000004, + WGPUCompositeAlphaMode_Force32 = 0x7FFFFFFF +} WGPUCompositeAlphaMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCreatePipelineAsyncStatus { + WGPUCreatePipelineAsyncStatus_Success = 0x00000001, + WGPUCreatePipelineAsyncStatus_CallbackCancelled = 0x00000002, + WGPUCreatePipelineAsyncStatus_ValidationError = 0x00000003, + WGPUCreatePipelineAsyncStatus_InternalError = 0x00000004, + WGPUCreatePipelineAsyncStatus_Force32 = 0x7FFFFFFF +} WGPUCreatePipelineAsyncStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUCullMode { + WGPUCullMode_Undefined = 0x00000000, + WGPUCullMode_None = 0x00000001, + WGPUCullMode_Front = 0x00000002, + WGPUCullMode_Back = 0x00000003, + WGPUCullMode_Force32 = 0x7FFFFFFF +} WGPUCullMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUDeviceLostReason { + WGPUDeviceLostReason_Unknown = 0x00000001, + WGPUDeviceLostReason_Destroyed = 0x00000002, + WGPUDeviceLostReason_CallbackCancelled = 0x00000003, + WGPUDeviceLostReason_FailedCreation = 0x00000004, + WGPUDeviceLostReason_Force32 = 0x7FFFFFFF +} WGPUDeviceLostReason WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUErrorFilter { + WGPUErrorFilter_Validation = 0x00000001, + WGPUErrorFilter_OutOfMemory = 0x00000002, + WGPUErrorFilter_Internal = 0x00000003, + WGPUErrorFilter_Force32 = 0x7FFFFFFF +} WGPUErrorFilter WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUErrorType { + WGPUErrorType_NoError = 0x00000001, + WGPUErrorType_Validation = 0x00000002, + WGPUErrorType_OutOfMemory = 0x00000003, + WGPUErrorType_Internal = 0x00000004, + WGPUErrorType_Unknown = 0x00000005, + WGPUErrorType_Force32 = 0x7FFFFFFF +} WGPUErrorType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUExternalTextureRotation { + WGPUExternalTextureRotation_Rotate0Degrees = 0x00000001, + WGPUExternalTextureRotation_Rotate90Degrees = 0x00000002, + WGPUExternalTextureRotation_Rotate180Degrees = 0x00000003, + WGPUExternalTextureRotation_Rotate270Degrees = 0x00000004, + WGPUExternalTextureRotation_Force32 = 0x7FFFFFFF +} WGPUExternalTextureRotation WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUFeatureLevel { + WGPUFeatureLevel_Undefined = 0x00000000, + WGPUFeatureLevel_Compatibility = 0x00000001, + WGPUFeatureLevel_Core = 0x00000002, + WGPUFeatureLevel_Force32 = 0x7FFFFFFF +} WGPUFeatureLevel WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUFeatureName { + WGPUFeatureName_CoreFeaturesAndLimits = 0x00000001, + WGPUFeatureName_DepthClipControl = 0x00000002, + WGPUFeatureName_Depth32FloatStencil8 = 0x00000003, + WGPUFeatureName_TextureCompressionBC = 0x00000004, + WGPUFeatureName_TextureCompressionBCSliced3D = 0x00000005, + WGPUFeatureName_TextureCompressionETC2 = 0x00000006, + WGPUFeatureName_TextureCompressionASTC = 0x00000007, + WGPUFeatureName_TextureCompressionASTCSliced3D = 0x00000008, + WGPUFeatureName_TimestampQuery = 0x00000009, + WGPUFeatureName_IndirectFirstInstance = 0x0000000A, + WGPUFeatureName_ShaderF16 = 0x0000000B, + WGPUFeatureName_RG11B10UfloatRenderable = 0x0000000C, + WGPUFeatureName_BGRA8UnormStorage = 0x0000000D, + WGPUFeatureName_Float32Filterable = 0x0000000E, + WGPUFeatureName_Float32Blendable = 0x0000000F, + WGPUFeatureName_ClipDistances = 0x00000010, + WGPUFeatureName_DualSourceBlending = 0x00000011, + WGPUFeatureName_Subgroups = 0x00000012, + WGPUFeatureName_TextureFormatsTier1 = 0x00000013, + WGPUFeatureName_TextureFormatsTier2 = 0x00000014, + WGPUFeatureName_PrimitiveIndex = 0x00000015, + WGPUFeatureName_TextureComponentSwizzle = 0x00000016, + WGPUFeatureName_SubgroupSizeControl = 0x00000017, + WGPUFeatureName_TextureCompressionUnaligned = 0x00000018, + WGPUFeatureName_DawnInternalUsages = 0x00050000, + WGPUFeatureName_DawnMultiPlanarFormats = 0x00050001, + WGPUFeatureName_DawnNative = 0x00050002, + WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses = 0x00050003, + WGPUFeatureName_ImplicitDeviceSynchronization = 0x00050004, + WGPUFeatureName_TransientAttachments = 0x00050006, + WGPUFeatureName_MSAARenderToSingleSampled = 0x00050007, + WGPUFeatureName_D3D11MultithreadProtected = 0x00050008, + WGPUFeatureName_ANGLETextureSharing = 0x00050009, + WGPUFeatureName_PixelLocalStorageCoherent = 0x0005000A, + WGPUFeatureName_PixelLocalStorageNonCoherent = 0x0005000B, + WGPUFeatureName_Unorm16TextureFormats = 0x0005000C, + WGPUFeatureName_MultiPlanarFormatExtendedUsages = 0x0005000D, + WGPUFeatureName_MultiPlanarFormatP010 = 0x0005000E, + WGPUFeatureName_HostMappedPointer = 0x0005000F, + WGPUFeatureName_MultiPlanarRenderTargets = 0x00050010, + WGPUFeatureName_MultiPlanarFormatNv12a = 0x00050011, + WGPUFeatureName_FramebufferFetch = 0x00050012, + WGPUFeatureName_BufferMapExtendedUsages = 0x00050013, + WGPUFeatureName_AdapterPropertiesMemoryHeaps = 0x00050014, + WGPUFeatureName_AdapterPropertiesD3D = 0x00050015, + WGPUFeatureName_AdapterPropertiesVk = 0x00050016, + WGPUFeatureName_DawnFormatCapabilities = 0x00050017, + WGPUFeatureName_DawnDrmFormatCapabilities = 0x00050018, + WGPUFeatureName_MultiPlanarFormatNv16 = 0x00050019, + WGPUFeatureName_MultiPlanarFormatNv24 = 0x0005001A, + WGPUFeatureName_MultiPlanarFormatP210 = 0x0005001B, + WGPUFeatureName_MultiPlanarFormatP410 = 0x0005001C, + WGPUFeatureName_SharedTextureMemoryVkDedicatedAllocation = 0x0005001D, + WGPUFeatureName_SharedTextureMemoryAHardwareBuffer = 0x0005001E, + WGPUFeatureName_SharedTextureMemoryDmaBuf = 0x0005001F, + WGPUFeatureName_SharedTextureMemoryOpaqueFD = 0x00050020, + WGPUFeatureName_SharedTextureMemoryZirconHandle = 0x00050021, + WGPUFeatureName_SharedTextureMemoryDXGISharedHandle = 0x00050022, + WGPUFeatureName_SharedTextureMemoryD3D11Texture2D = 0x00050023, + WGPUFeatureName_SharedTextureMemoryIOSurface = 0x00050024, + WGPUFeatureName_SharedTextureMemoryEGLImage = 0x00050025, + WGPUFeatureName_SharedFenceVkSemaphoreOpaqueFD = 0x00050026, + WGPUFeatureName_SharedFenceSyncFD = 0x00050027, + WGPUFeatureName_SharedFenceVkSemaphoreZirconHandle = 0x00050028, + WGPUFeatureName_SharedFenceDXGISharedHandle = 0x00050029, + WGPUFeatureName_SharedFenceMTLSharedEvent = 0x0005002A, + WGPUFeatureName_SharedBufferMemoryD3D12Resource = 0x0005002B, + WGPUFeatureName_StaticSamplers = 0x0005002C, + WGPUFeatureName_YCbCrVulkanSamplers = 0x0005002D, + WGPUFeatureName_ShaderModuleCompilationOptions = 0x0005002E, + WGPUFeatureName_DawnLoadResolveTexture = 0x0005002F, + WGPUFeatureName_DawnPartialLoadResolveTexture = 0x00050030, + WGPUFeatureName_MultiDrawIndirect = 0x00050031, + WGPUFeatureName_DawnTexelCopyBufferRowAlignment = 0x00050032, + WGPUFeatureName_FlexibleTextureViews = 0x00050033, + WGPUFeatureName_ChromiumExperimentalSubgroupMatrix = 0x00050034, + WGPUFeatureName_SharedFenceEGLSync = 0x00050035, + WGPUFeatureName_DawnDeviceAllocatorControl = 0x00050036, + WGPUFeatureName_AdapterPropertiesWGPU = 0x00050037, + WGPUFeatureName_SharedBufferMemoryFromWindowsHandle = 0x00050038, + WGPUFeatureName_SharedTextureMemoryD3D12Resource = 0x00050039, + WGPUFeatureName_ChromiumExperimentalSamplingResourceTable = 0x0005003A, + WGPUFeatureName_AtomicVec2uMinMax = 0x0005003B, + WGPUFeatureName_Unorm16FormatsForExternalTexture = 0x0005003C, + WGPUFeatureName_OpaqueYCbCrAndroidForExternalTexture = 0x0005003D, + WGPUFeatureName_Unorm16Filterable = 0x0005003E, + WGPUFeatureName_RenderPassRenderArea = 0x0005003F, + WGPUFeatureName_AdapterPropertiesDrm = 0x00050040, + WGPUFeatureName_DawnAllowUndefinedLoadStoreOp = 0x00050041, + WGPUFeatureName_BufferMapWriteExtendedUsages = 0x00050042, + WGPUFeatureName_SharedBufferMemoryHostPointer = 0x00050043, + WGPUFeatureName_Force32 = 0x7FFFFFFF +} WGPUFeatureName WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUFilterMode { + WGPUFilterMode_Undefined = 0x00000000, + WGPUFilterMode_Nearest = 0x00000001, + WGPUFilterMode_Linear = 0x00000002, + WGPUFilterMode_Force32 = 0x7FFFFFFF +} WGPUFilterMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUFrontFace { + WGPUFrontFace_Undefined = 0x00000000, + WGPUFrontFace_CCW = 0x00000001, + WGPUFrontFace_CW = 0x00000002, + WGPUFrontFace_Force32 = 0x7FFFFFFF +} WGPUFrontFace WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUIndexFormat { + WGPUIndexFormat_Undefined = 0x00000000, + WGPUIndexFormat_Uint16 = 0x00000001, + WGPUIndexFormat_Uint32 = 0x00000002, + WGPUIndexFormat_Force32 = 0x7FFFFFFF +} WGPUIndexFormat WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUInstanceFeatureName { + WGPUInstanceFeatureName_TimedWaitAny = 0x00000001, + WGPUInstanceFeatureName_ShaderSourceSPIRV = 0x00000002, + WGPUInstanceFeatureName_MultipleDevicesPerAdapter = 0x00000003, + WGPUInstanceFeatureName_Force32 = 0x7FFFFFFF +} WGPUInstanceFeatureName WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPULoadOp { + WGPULoadOp_Undefined = 0x00000000, + WGPULoadOp_Load = 0x00000001, + WGPULoadOp_Clear = 0x00000002, + WGPULoadOp_ExpandResolveTexture = 0x00050003, + WGPULoadOp_Force32 = 0x7FFFFFFF +} WGPULoadOp WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPULoggingType { + WGPULoggingType_Verbose = 0x00000001, + WGPULoggingType_Info = 0x00000002, + WGPULoggingType_Warning = 0x00000003, + WGPULoggingType_Error = 0x00000004, + WGPULoggingType_Force32 = 0x7FFFFFFF +} WGPULoggingType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUMapAsyncStatus { + WGPUMapAsyncStatus_Success = 0x00000001, + WGPUMapAsyncStatus_CallbackCancelled = 0x00000002, + WGPUMapAsyncStatus_Error = 0x00000003, + WGPUMapAsyncStatus_Aborted = 0x00000004, + WGPUMapAsyncStatus_Force32 = 0x7FFFFFFF +} WGPUMapAsyncStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUMipmapFilterMode { + WGPUMipmapFilterMode_Undefined = 0x00000000, + WGPUMipmapFilterMode_Nearest = 0x00000001, + WGPUMipmapFilterMode_Linear = 0x00000002, + WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF +} WGPUMipmapFilterMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUOptionalBool { + WGPUOptionalBool_False = 0x00000000, + WGPUOptionalBool_True = 0x00000001, + WGPUOptionalBool_Undefined = 0x00000002, + WGPUOptionalBool_Force32 = 0x7FFFFFFF +} WGPUOptionalBool WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUPopErrorScopeStatus { + WGPUPopErrorScopeStatus_Success = 0x00000001, + WGPUPopErrorScopeStatus_CallbackCancelled = 0x00000002, + WGPUPopErrorScopeStatus_Error = 0x00000003, + WGPUPopErrorScopeStatus_Force32 = 0x7FFFFFFF +} WGPUPopErrorScopeStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUPowerPreference { + WGPUPowerPreference_Undefined = 0x00000000, + WGPUPowerPreference_LowPower = 0x00000001, + WGPUPowerPreference_HighPerformance = 0x00000002, + WGPUPowerPreference_Force32 = 0x7FFFFFFF +} WGPUPowerPreference WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUPredefinedColorSpace { + WGPUPredefinedColorSpace_SRGB = 0x00000001, + WGPUPredefinedColorSpace_DisplayP3 = 0x00000002, + WGPUPredefinedColorSpace_SRGBLinear = 0x00050003, + WGPUPredefinedColorSpace_DisplayP3Linear = 0x00050004, + WGPUPredefinedColorSpace_Rec2020Linear = 0x00050005, + WGPUPredefinedColorSpace_Force32 = 0x7FFFFFFF +} WGPUPredefinedColorSpace WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUPresentMode { + WGPUPresentMode_Undefined = 0x00000000, + WGPUPresentMode_Fifo = 0x00000001, + WGPUPresentMode_FifoRelaxed = 0x00000002, + WGPUPresentMode_Immediate = 0x00000003, + WGPUPresentMode_Mailbox = 0x00000004, + WGPUPresentMode_Force32 = 0x7FFFFFFF +} WGPUPresentMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUPrimitiveTopology { + WGPUPrimitiveTopology_Undefined = 0x00000000, + WGPUPrimitiveTopology_PointList = 0x00000001, + WGPUPrimitiveTopology_LineList = 0x00000002, + WGPUPrimitiveTopology_LineStrip = 0x00000003, + WGPUPrimitiveTopology_TriangleList = 0x00000004, + WGPUPrimitiveTopology_TriangleStrip = 0x00000005, + WGPUPrimitiveTopology_Force32 = 0x7FFFFFFF +} WGPUPrimitiveTopology WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUQueryType { + WGPUQueryType_Occlusion = 0x00000001, + WGPUQueryType_Timestamp = 0x00000002, + WGPUQueryType_Force32 = 0x7FFFFFFF +} WGPUQueryType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUQueueWorkDoneStatus { + WGPUQueueWorkDoneStatus_Success = 0x00000001, + WGPUQueueWorkDoneStatus_CallbackCancelled = 0x00000002, + WGPUQueueWorkDoneStatus_Error = 0x00000003, + WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF +} WGPUQueueWorkDoneStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPURequestAdapterStatus { + WGPURequestAdapterStatus_Success = 0x00000001, + WGPURequestAdapterStatus_CallbackCancelled = 0x00000002, + WGPURequestAdapterStatus_Unavailable = 0x00000003, + WGPURequestAdapterStatus_Error = 0x00000004, + WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF +} WGPURequestAdapterStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPURequestDeviceStatus { + WGPURequestDeviceStatus_Success = 0x00000001, + WGPURequestDeviceStatus_CallbackCancelled = 0x00000002, + WGPURequestDeviceStatus_Error = 0x00000003, + WGPURequestDeviceStatus_Force32 = 0x7FFFFFFF +} WGPURequestDeviceStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUSamplerBindingType { + WGPUSamplerBindingType_BindingNotUsed = 0x00000000, + WGPUSamplerBindingType_Undefined = 0x00000001, + WGPUSamplerBindingType_Filtering = 0x00000002, + WGPUSamplerBindingType_NonFiltering = 0x00000003, + WGPUSamplerBindingType_Comparison = 0x00000004, + WGPUSamplerBindingType_Force32 = 0x7FFFFFFF +} WGPUSamplerBindingType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUSharedFenceType { + WGPUSharedFenceType_VkSemaphoreOpaqueFD = 0x00000001, + WGPUSharedFenceType_SyncFD = 0x00000002, + WGPUSharedFenceType_VkSemaphoreZirconHandle = 0x00000003, + WGPUSharedFenceType_DXGISharedHandle = 0x00000004, + WGPUSharedFenceType_MTLSharedEvent = 0x00000005, + WGPUSharedFenceType_EGLSync = 0x00000006, + WGPUSharedFenceType_Force32 = 0x7FFFFFFF +} WGPUSharedFenceType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUStatus { + WGPUStatus_Success = 0x00000001, + WGPUStatus_Error = 0x00000002, + WGPUStatus_Force32 = 0x7FFFFFFF +} WGPUStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUStencilOperation { + WGPUStencilOperation_Undefined = 0x00000000, + WGPUStencilOperation_Keep = 0x00000001, + WGPUStencilOperation_Zero = 0x00000002, + WGPUStencilOperation_Replace = 0x00000003, + WGPUStencilOperation_Invert = 0x00000004, + WGPUStencilOperation_IncrementClamp = 0x00000005, + WGPUStencilOperation_DecrementClamp = 0x00000006, + WGPUStencilOperation_IncrementWrap = 0x00000007, + WGPUStencilOperation_DecrementWrap = 0x00000008, + WGPUStencilOperation_Force32 = 0x7FFFFFFF +} WGPUStencilOperation WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUStorageTextureAccess { + WGPUStorageTextureAccess_BindingNotUsed = 0x00000000, + WGPUStorageTextureAccess_Undefined = 0x00000001, + WGPUStorageTextureAccess_WriteOnly = 0x00000002, + WGPUStorageTextureAccess_ReadOnly = 0x00000003, + WGPUStorageTextureAccess_ReadWrite = 0x00000004, + WGPUStorageTextureAccess_Force32 = 0x7FFFFFFF +} WGPUStorageTextureAccess WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUStoreOp { + WGPUStoreOp_Undefined = 0x00000000, + WGPUStoreOp_Store = 0x00000001, + WGPUStoreOp_Discard = 0x00000002, + WGPUStoreOp_Force32 = 0x7FFFFFFF +} WGPUStoreOp WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUSType { + WGPUSType_ShaderSourceSPIRV = 0x00000001, + WGPUSType_ShaderSourceWGSL = 0x00000002, + WGPUSType_RenderPassMaxDrawCount = 0x00000003, + WGPUSType_SurfaceSourceMetalLayer = 0x00000004, + WGPUSType_SurfaceSourceWindowsHWND = 0x00000005, + WGPUSType_SurfaceSourceXlibWindow = 0x00000006, + WGPUSType_SurfaceSourceWaylandSurface = 0x00000007, + WGPUSType_SurfaceSourceAndroidNativeWindow = 0x00000008, + WGPUSType_SurfaceSourceXCBWindow = 0x00000009, + WGPUSType_SurfaceColorManagement = 0x0000000A, + WGPUSType_RequestAdapterWebXROptions = 0x0000000B, + WGPUSType_TextureComponentSwizzleDescriptor = 0x0000000C, + WGPUSType_ExternalTextureBindingLayout = 0x0000000D, + WGPUSType_ExternalTextureBindingEntry = 0x0000000E, + WGPUSType_CompatibilityModeLimits = 0x0000000F, + WGPUSType_TextureBindingViewDimension = 0x00000010, + WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector = 0x00040000, + WGPUSType_SurfaceDescriptorFromWindowsCoreWindow = 0x00050000, + WGPUSType_SurfaceDescriptorFromWindowsUWPSwapChainPanel = 0x00050003, + WGPUSType_DawnTextureInternalUsageDescriptor = 0x00050004, + WGPUSType_DawnEncoderInternalUsageDescriptor = 0x00050005, + WGPUSType_DawnInstanceDescriptor = 0x00050006, + WGPUSType_DawnCacheDeviceDescriptor = 0x00050007, + WGPUSType_DawnAdapterPropertiesPowerPreference = 0x00050008, + WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient = 0x00050009, + WGPUSType_DawnTogglesDescriptor = 0x0005000A, + WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor = 0x0005000B, + WGPUSType_RequestAdapterOptionsLUID = 0x0005000C, + WGPUSType_RequestAdapterOptionsGetGLProc = 0x0005000D, + WGPUSType_RequestAdapterOptionsD3D11Device = 0x0005000E, + WGPUSType_DawnRenderPassSampleCount = 0x0005000F, + WGPUSType_RenderPassPixelLocalStorage = 0x00050010, + WGPUSType_PipelineLayoutPixelLocalStorage = 0x00050011, + WGPUSType_BufferHostMappedPointer = 0x00050012, + WGPUSType_AdapterPropertiesMemoryHeaps = 0x00050013, + WGPUSType_AdapterPropertiesD3D = 0x00050014, + WGPUSType_AdapterPropertiesVk = 0x00050015, + WGPUSType_DawnWireWGSLControl = 0x00050016, + WGPUSType_DawnWGSLBlocklist = 0x00050017, + WGPUSType_DawnDrmFormatCapabilities = 0x00050018, + WGPUSType_ShaderModuleCompilationOptions = 0x00050019, + WGPUSType_ColorTargetStateExpandResolveTextureDawn = 0x0005001A, + WGPUSType_RenderPassRenderAreaRect = 0x0005001B, + WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor = 0x0005001C, + WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor = 0x0005001D, + WGPUSType_SharedTextureMemoryDmaBufDescriptor = 0x0005001E, + WGPUSType_SharedTextureMemoryOpaqueFDDescriptor = 0x0005001F, + WGPUSType_SharedTextureMemoryZirconHandleDescriptor = 0x00050020, + WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor = 0x00050021, + WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor = 0x00050022, + WGPUSType_SharedTextureMemoryIOSurfaceDescriptor = 0x00050023, + WGPUSType_SharedTextureMemoryEGLImageDescriptor = 0x00050024, + WGPUSType_SharedTextureMemoryInitializedBeginState = 0x00050025, + WGPUSType_SharedTextureMemoryInitializedEndState = 0x00050026, + WGPUSType_SharedTextureMemoryVkImageLayoutBeginState = 0x00050027, + WGPUSType_SharedTextureMemoryVkImageLayoutEndState = 0x00050028, + WGPUSType_SharedTextureMemoryD3DSwapchainBeginState = 0x00050029, + WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor = 0x0005002A, + WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo = 0x0005002B, + WGPUSType_SharedFenceSyncFDDescriptor = 0x0005002C, + WGPUSType_SharedFenceSyncFDExportInfo = 0x0005002D, + WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor = 0x0005002E, + WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo = 0x0005002F, + WGPUSType_SharedFenceDXGISharedHandleDescriptor = 0x00050030, + WGPUSType_SharedFenceDXGISharedHandleExportInfo = 0x00050031, + WGPUSType_SharedFenceMTLSharedEventDescriptor = 0x00050032, + WGPUSType_SharedFenceMTLSharedEventExportInfo = 0x00050033, + WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor = 0x00050034, + WGPUSType_StaticSamplerBindingLayout = 0x00050035, + WGPUSType_YCbCrVkDescriptor = 0x00050036, + WGPUSType_SharedTextureMemoryAHardwareBufferProperties = 0x00050037, + WGPUSType_AHardwareBufferProperties = 0x00050038, + WGPUSType_DawnTexelCopyBufferRowAlignmentLimits = 0x0005003A, + WGPUSType_AdapterPropertiesSubgroupMatrixConfigs = 0x0005003B, + WGPUSType_SharedFenceEGLSyncDescriptor = 0x0005003C, + WGPUSType_SharedFenceEGLSyncExportInfo = 0x0005003D, + WGPUSType_DawnInjectedInvalidSType = 0x0005003E, + WGPUSType_DawnCompilationMessageUtf16 = 0x0005003F, + WGPUSType_DawnFakeBufferOOMForTesting = 0x00050040, + WGPUSType_SurfaceDescriptorFromWindowsWinUISwapChainPanel = 0x00050041, + WGPUSType_DawnDeviceAllocatorControl = 0x00050042, + WGPUSType_DawnHostMappedPointerLimits = 0x00050043, + WGPUSType_RenderPassDescriptorResolveRect = 0x00050044, + WGPUSType_RequestAdapterWebGPUBackendOptions = 0x00050045, + WGPUSType_DawnFakeDeviceInitializeErrorForTesting = 0x00050046, + WGPUSType_SharedTextureMemoryD3D11BeginState = 0x00050047, + WGPUSType_DawnConsumeAdapterDescriptor = 0x00050048, + WGPUSType_TexelBufferBindingEntry = 0x00050049, + WGPUSType_TexelBufferBindingLayout = 0x0005004A, + WGPUSType_SharedTextureMemoryMetalEndAccessState = 0x0005004B, + WGPUSType_AdapterPropertiesWGPU = 0x0005004C, + WGPUSType_SharedBufferMemoryFromWindowsHandleDescriptor = 0x0005004D, + WGPUSType_SharedTextureMemoryD3D12ResourceDescriptor = 0x0005004E, + WGPUSType_RequestAdapterOptionsAngleVirtualizationGroup = 0x0005004F, + WGPUSType_PipelineLayoutResourceTable = 0x00050050, + WGPUSType_AdapterPropertiesDrm = 0x00050051, + WGPUSType_RenderBundleEncoderResourceTable = 0x00050052, + WGPUSType_DawnShaderSourceSPIRV = 0x00050053, + WGPUSType_SharedBufferMemoryHostPointerDescriptor = 0x00050054, + WGPUSType_Force32 = 0x7FFFFFFF +} WGPUSType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUSubgroupMatrixComponentType { + WGPUSubgroupMatrixComponentType_F32 = 0x00000001, + WGPUSubgroupMatrixComponentType_F16 = 0x00000002, + WGPUSubgroupMatrixComponentType_U32 = 0x00000003, + WGPUSubgroupMatrixComponentType_I32 = 0x00000004, + WGPUSubgroupMatrixComponentType_U8 = 0x00000005, + WGPUSubgroupMatrixComponentType_I8 = 0x00000006, + WGPUSubgroupMatrixComponentType_Force32 = 0x7FFFFFFF +} WGPUSubgroupMatrixComponentType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUSurfaceGetCurrentTextureStatus { + WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal = 0x00000001, + WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal = 0x00000002, + WGPUSurfaceGetCurrentTextureStatus_Timeout = 0x00000003, + WGPUSurfaceGetCurrentTextureStatus_Outdated = 0x00000004, + WGPUSurfaceGetCurrentTextureStatus_Lost = 0x00000005, + WGPUSurfaceGetCurrentTextureStatus_Error = 0x00000006, + WGPUSurfaceGetCurrentTextureStatus_Force32 = 0x7FFFFFFF +} WGPUSurfaceGetCurrentTextureStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUTexelBufferAccess { + WGPUTexelBufferAccess_Undefined = 0x00000000, + WGPUTexelBufferAccess_ReadOnly = 0x00000001, + WGPUTexelBufferAccess_ReadWrite = 0x00000002, + WGPUTexelBufferAccess_Force32 = 0x7FFFFFFF +} WGPUTexelBufferAccess WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUTextureAspect { + WGPUTextureAspect_Undefined = 0x00000000, + WGPUTextureAspect_All = 0x00000001, + WGPUTextureAspect_StencilOnly = 0x00000002, + WGPUTextureAspect_DepthOnly = 0x00000003, + WGPUTextureAspect_Plane0Only = 0x00050000, + WGPUTextureAspect_Plane1Only = 0x00050001, + WGPUTextureAspect_Plane2Only = 0x00050002, + WGPUTextureAspect_Force32 = 0x7FFFFFFF +} WGPUTextureAspect WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUTextureDimension { + WGPUTextureDimension_Undefined = 0x00000000, + WGPUTextureDimension_1D = 0x00000001, + WGPUTextureDimension_2D = 0x00000002, + WGPUTextureDimension_3D = 0x00000003, + WGPUTextureDimension_Force32 = 0x7FFFFFFF +} WGPUTextureDimension WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUTextureFormat { + WGPUTextureFormat_Undefined = 0x00000000, + WGPUTextureFormat_R8Unorm = 0x00000001, + WGPUTextureFormat_R8Snorm = 0x00000002, + WGPUTextureFormat_R8Uint = 0x00000003, + WGPUTextureFormat_R8Sint = 0x00000004, + WGPUTextureFormat_R16Unorm = 0x00000005, + WGPUTextureFormat_R16Snorm = 0x00000006, + WGPUTextureFormat_R16Uint = 0x00000007, + WGPUTextureFormat_R16Sint = 0x00000008, + WGPUTextureFormat_R16Float = 0x00000009, + WGPUTextureFormat_RG8Unorm = 0x0000000A, + WGPUTextureFormat_RG8Snorm = 0x0000000B, + WGPUTextureFormat_RG8Uint = 0x0000000C, + WGPUTextureFormat_RG8Sint = 0x0000000D, + WGPUTextureFormat_R32Float = 0x0000000E, + WGPUTextureFormat_R32Uint = 0x0000000F, + WGPUTextureFormat_R32Sint = 0x00000010, + WGPUTextureFormat_RG16Unorm = 0x00000011, + WGPUTextureFormat_RG16Snorm = 0x00000012, + WGPUTextureFormat_RG16Uint = 0x00000013, + WGPUTextureFormat_RG16Sint = 0x00000014, + WGPUTextureFormat_RG16Float = 0x00000015, + WGPUTextureFormat_RGBA8Unorm = 0x00000016, + WGPUTextureFormat_RGBA8UnormSrgb = 0x00000017, + WGPUTextureFormat_RGBA8Snorm = 0x00000018, + WGPUTextureFormat_RGBA8Uint = 0x00000019, + WGPUTextureFormat_RGBA8Sint = 0x0000001A, + WGPUTextureFormat_BGRA8Unorm = 0x0000001B, + WGPUTextureFormat_BGRA8UnormSrgb = 0x0000001C, + WGPUTextureFormat_RGB10A2Uint = 0x0000001D, + WGPUTextureFormat_RGB10A2Unorm = 0x0000001E, + WGPUTextureFormat_RG11B10Ufloat = 0x0000001F, + WGPUTextureFormat_RGB9E5Ufloat = 0x00000020, + WGPUTextureFormat_RG32Float = 0x00000021, + WGPUTextureFormat_RG32Uint = 0x00000022, + WGPUTextureFormat_RG32Sint = 0x00000023, + WGPUTextureFormat_RGBA16Unorm = 0x00000024, + WGPUTextureFormat_RGBA16Snorm = 0x00000025, + WGPUTextureFormat_RGBA16Uint = 0x00000026, + WGPUTextureFormat_RGBA16Sint = 0x00000027, + WGPUTextureFormat_RGBA16Float = 0x00000028, + WGPUTextureFormat_RGBA32Float = 0x00000029, + WGPUTextureFormat_RGBA32Uint = 0x0000002A, + WGPUTextureFormat_RGBA32Sint = 0x0000002B, + WGPUTextureFormat_Stencil8 = 0x0000002C, + WGPUTextureFormat_Depth16Unorm = 0x0000002D, + WGPUTextureFormat_Depth24Plus = 0x0000002E, + WGPUTextureFormat_Depth24PlusStencil8 = 0x0000002F, + WGPUTextureFormat_Depth32Float = 0x00000030, + WGPUTextureFormat_Depth32FloatStencil8 = 0x00000031, + WGPUTextureFormat_BC1RGBAUnorm = 0x00000032, + WGPUTextureFormat_BC1RGBAUnormSrgb = 0x00000033, + WGPUTextureFormat_BC2RGBAUnorm = 0x00000034, + WGPUTextureFormat_BC2RGBAUnormSrgb = 0x00000035, + WGPUTextureFormat_BC3RGBAUnorm = 0x00000036, + WGPUTextureFormat_BC3RGBAUnormSrgb = 0x00000037, + WGPUTextureFormat_BC4RUnorm = 0x00000038, + WGPUTextureFormat_BC4RSnorm = 0x00000039, + WGPUTextureFormat_BC5RGUnorm = 0x0000003A, + WGPUTextureFormat_BC5RGSnorm = 0x0000003B, + WGPUTextureFormat_BC6HRGBUfloat = 0x0000003C, + WGPUTextureFormat_BC6HRGBFloat = 0x0000003D, + WGPUTextureFormat_BC7RGBAUnorm = 0x0000003E, + WGPUTextureFormat_BC7RGBAUnormSrgb = 0x0000003F, + WGPUTextureFormat_ETC2RGB8Unorm = 0x00000040, + WGPUTextureFormat_ETC2RGB8UnormSrgb = 0x00000041, + WGPUTextureFormat_ETC2RGB8A1Unorm = 0x00000042, + WGPUTextureFormat_ETC2RGB8A1UnormSrgb = 0x00000043, + WGPUTextureFormat_ETC2RGBA8Unorm = 0x00000044, + WGPUTextureFormat_ETC2RGBA8UnormSrgb = 0x00000045, + WGPUTextureFormat_EACR11Unorm = 0x00000046, + WGPUTextureFormat_EACR11Snorm = 0x00000047, + WGPUTextureFormat_EACRG11Unorm = 0x00000048, + WGPUTextureFormat_EACRG11Snorm = 0x00000049, + WGPUTextureFormat_ASTC4x4Unorm = 0x0000004A, + WGPUTextureFormat_ASTC4x4UnormSrgb = 0x0000004B, + WGPUTextureFormat_ASTC5x4Unorm = 0x0000004C, + WGPUTextureFormat_ASTC5x4UnormSrgb = 0x0000004D, + WGPUTextureFormat_ASTC5x5Unorm = 0x0000004E, + WGPUTextureFormat_ASTC5x5UnormSrgb = 0x0000004F, + WGPUTextureFormat_ASTC6x5Unorm = 0x00000050, + WGPUTextureFormat_ASTC6x5UnormSrgb = 0x00000051, + WGPUTextureFormat_ASTC6x6Unorm = 0x00000052, + WGPUTextureFormat_ASTC6x6UnormSrgb = 0x00000053, + WGPUTextureFormat_ASTC8x5Unorm = 0x00000054, + WGPUTextureFormat_ASTC8x5UnormSrgb = 0x00000055, + WGPUTextureFormat_ASTC8x6Unorm = 0x00000056, + WGPUTextureFormat_ASTC8x6UnormSrgb = 0x00000057, + WGPUTextureFormat_ASTC8x8Unorm = 0x00000058, + WGPUTextureFormat_ASTC8x8UnormSrgb = 0x00000059, + WGPUTextureFormat_ASTC10x5Unorm = 0x0000005A, + WGPUTextureFormat_ASTC10x5UnormSrgb = 0x0000005B, + WGPUTextureFormat_ASTC10x6Unorm = 0x0000005C, + WGPUTextureFormat_ASTC10x6UnormSrgb = 0x0000005D, + WGPUTextureFormat_ASTC10x8Unorm = 0x0000005E, + WGPUTextureFormat_ASTC10x8UnormSrgb = 0x0000005F, + WGPUTextureFormat_ASTC10x10Unorm = 0x00000060, + WGPUTextureFormat_ASTC10x10UnormSrgb = 0x00000061, + WGPUTextureFormat_ASTC12x10Unorm = 0x00000062, + WGPUTextureFormat_ASTC12x10UnormSrgb = 0x00000063, + WGPUTextureFormat_ASTC12x12Unorm = 0x00000064, + WGPUTextureFormat_ASTC12x12UnormSrgb = 0x00000065, + WGPUTextureFormat_R8BG8Biplanar420Unorm = 0x00050000, + WGPUTextureFormat_R10X6BG10X6Biplanar420Unorm = 0x00050001, + WGPUTextureFormat_R8BG8A8Triplanar420Unorm = 0x00050002, + WGPUTextureFormat_R8BG8Biplanar422Unorm = 0x00050003, + WGPUTextureFormat_R8BG8Biplanar444Unorm = 0x00050004, + WGPUTextureFormat_R10X6BG10X6Biplanar422Unorm = 0x00050005, + WGPUTextureFormat_R10X6BG10X6Biplanar444Unorm = 0x00050006, + WGPUTextureFormat_OpaqueYCbCrAndroid = 0x00050007, + WGPUTextureFormat_Force32 = 0x7FFFFFFF +} WGPUTextureFormat WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUTextureSampleType { + WGPUTextureSampleType_BindingNotUsed = 0x00000000, + WGPUTextureSampleType_Undefined = 0x00000001, + WGPUTextureSampleType_Float = 0x00000002, + WGPUTextureSampleType_UnfilterableFloat = 0x00000003, + WGPUTextureSampleType_Depth = 0x00000004, + WGPUTextureSampleType_Sint = 0x00000005, + WGPUTextureSampleType_Uint = 0x00000006, + WGPUTextureSampleType_Force32 = 0x7FFFFFFF +} WGPUTextureSampleType WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUTextureViewDimension { + WGPUTextureViewDimension_Undefined = 0x00000000, + WGPUTextureViewDimension_1D = 0x00000001, + WGPUTextureViewDimension_2D = 0x00000002, + WGPUTextureViewDimension_2DArray = 0x00000003, + WGPUTextureViewDimension_Cube = 0x00000004, + WGPUTextureViewDimension_CubeArray = 0x00000005, + WGPUTextureViewDimension_3D = 0x00000006, + WGPUTextureViewDimension_Force32 = 0x7FFFFFFF +} WGPUTextureViewDimension WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUToneMappingMode { + WGPUToneMappingMode_Standard = 0x00000001, + WGPUToneMappingMode_Extended = 0x00000002, + WGPUToneMappingMode_Force32 = 0x7FFFFFFF +} WGPUToneMappingMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUVertexFormat { + WGPUVertexFormat_Uint8 = 0x00000001, + WGPUVertexFormat_Uint8x2 = 0x00000002, + WGPUVertexFormat_Uint8x4 = 0x00000003, + WGPUVertexFormat_Sint8 = 0x00000004, + WGPUVertexFormat_Sint8x2 = 0x00000005, + WGPUVertexFormat_Sint8x4 = 0x00000006, + WGPUVertexFormat_Unorm8 = 0x00000007, + WGPUVertexFormat_Unorm8x2 = 0x00000008, + WGPUVertexFormat_Unorm8x4 = 0x00000009, + WGPUVertexFormat_Snorm8 = 0x0000000A, + WGPUVertexFormat_Snorm8x2 = 0x0000000B, + WGPUVertexFormat_Snorm8x4 = 0x0000000C, + WGPUVertexFormat_Uint16 = 0x0000000D, + WGPUVertexFormat_Uint16x2 = 0x0000000E, + WGPUVertexFormat_Uint16x4 = 0x0000000F, + WGPUVertexFormat_Sint16 = 0x00000010, + WGPUVertexFormat_Sint16x2 = 0x00000011, + WGPUVertexFormat_Sint16x4 = 0x00000012, + WGPUVertexFormat_Unorm16 = 0x00000013, + WGPUVertexFormat_Unorm16x2 = 0x00000014, + WGPUVertexFormat_Unorm16x4 = 0x00000015, + WGPUVertexFormat_Snorm16 = 0x00000016, + WGPUVertexFormat_Snorm16x2 = 0x00000017, + WGPUVertexFormat_Snorm16x4 = 0x00000018, + WGPUVertexFormat_Float16 = 0x00000019, + WGPUVertexFormat_Float16x2 = 0x0000001A, + WGPUVertexFormat_Float16x4 = 0x0000001B, + WGPUVertexFormat_Float32 = 0x0000001C, + WGPUVertexFormat_Float32x2 = 0x0000001D, + WGPUVertexFormat_Float32x3 = 0x0000001E, + WGPUVertexFormat_Float32x4 = 0x0000001F, + WGPUVertexFormat_Uint32 = 0x00000020, + WGPUVertexFormat_Uint32x2 = 0x00000021, + WGPUVertexFormat_Uint32x3 = 0x00000022, + WGPUVertexFormat_Uint32x4 = 0x00000023, + WGPUVertexFormat_Sint32 = 0x00000024, + WGPUVertexFormat_Sint32x2 = 0x00000025, + WGPUVertexFormat_Sint32x3 = 0x00000026, + WGPUVertexFormat_Sint32x4 = 0x00000027, + WGPUVertexFormat_Unorm10_10_10_2 = 0x00000028, + WGPUVertexFormat_Unorm8x4BGRA = 0x00000029, + WGPUVertexFormat_Snorm10_10_10_2 = 0x0000002A, + WGPUVertexFormat_Force32 = 0x7FFFFFFF +} WGPUVertexFormat WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUVertexStepMode { + WGPUVertexStepMode_Undefined = 0x00000000, + WGPUVertexStepMode_Vertex = 0x00000001, + WGPUVertexStepMode_Instance = 0x00000002, + WGPUVertexStepMode_Force32 = 0x7FFFFFFF +} WGPUVertexStepMode WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUWaitStatus { + WGPUWaitStatus_Success = 0x00000001, + WGPUWaitStatus_TimedOut = 0x00000002, + WGPUWaitStatus_Error = 0x00000003, + WGPUWaitStatus_Force32 = 0x7FFFFFFF +} WGPUWaitStatus WGPU_ENUM_ATTRIBUTE; + +typedef enum WGPUWGSLLanguageFeatureName { + WGPUWGSLLanguageFeatureName_ReadonlyAndReadwriteStorageTextures = 0x00000001, + WGPUWGSLLanguageFeatureName_Packed4x8IntegerDotProduct = 0x00000002, + WGPUWGSLLanguageFeatureName_UnrestrictedPointerParameters = 0x00000003, + WGPUWGSLLanguageFeatureName_PointerCompositeAccess = 0x00000004, + WGPUWGSLLanguageFeatureName_UniformBufferStandardLayout = 0x00000005, + WGPUWGSLLanguageFeatureName_SubgroupId = 0x00000006, + WGPUWGSLLanguageFeatureName_TextureAndSamplerLet = 0x00000007, + WGPUWGSLLanguageFeatureName_SubgroupUniformity = 0x00000008, + WGPUWGSLLanguageFeatureName_TextureFormatsTier1 = 0x00000009, + WGPUWGSLLanguageFeatureName_LinearIndexing = 0x0000000A, + WGPUWGSLLanguageFeatureName_ImmediateAddressSpace = 0x0000000B, + WGPUWGSLLanguageFeatureName_BufferView = 0x0000000C, + WGPUWGSLLanguageFeatureName_SwizzleAssignment = 0x0000000D, + WGPUWGSLLanguageFeatureName_FragmentDepth = 0x0000000E, + WGPUWGSLLanguageFeatureName_ChromiumTestingUnimplemented = 0x00050000, + WGPUWGSLLanguageFeatureName_ChromiumTestingUnsafeExperimental = 0x00050001, + WGPUWGSLLanguageFeatureName_ChromiumTestingExperimental = 0x00050002, + WGPUWGSLLanguageFeatureName_ChromiumTestingShippedWithKillswitch = 0x00050003, + WGPUWGSLLanguageFeatureName_ChromiumTestingShipped = 0x00050004, + WGPUWGSLLanguageFeatureName_SizedBindingArray = 0x00050005, + WGPUWGSLLanguageFeatureName_TexelBuffers = 0x00050006, + WGPUWGSLLanguageFeatureName_ChromiumPrint = 0x00050007, + WGPUWGSLLanguageFeatureName_MultisampledArrayTextures = 0x00050008, + WGPUWGSLLanguageFeatureName_Force32 = 0x7FFFFFFF +} WGPUWGSLLanguageFeatureName WGPU_ENUM_ATTRIBUTE; + +// NOLINTEND(cppcoreguidelines-use-enum-class) + +typedef WGPUFlags WGPUBufferUsage; +static const WGPUBufferUsage WGPUBufferUsage_None = 0x0000000000000000; +static const WGPUBufferUsage WGPUBufferUsage_MapRead = 0x0000000000000001; +static const WGPUBufferUsage WGPUBufferUsage_MapWrite = 0x0000000000000002; +static const WGPUBufferUsage WGPUBufferUsage_CopySrc = 0x0000000000000004; +static const WGPUBufferUsage WGPUBufferUsage_CopyDst = 0x0000000000000008; +static const WGPUBufferUsage WGPUBufferUsage_Index = 0x0000000000000010; +static const WGPUBufferUsage WGPUBufferUsage_Vertex = 0x0000000000000020; +static const WGPUBufferUsage WGPUBufferUsage_Uniform = 0x0000000000000040; +static const WGPUBufferUsage WGPUBufferUsage_Storage = 0x0000000000000080; +static const WGPUBufferUsage WGPUBufferUsage_Indirect = 0x0000000000000100; +static const WGPUBufferUsage WGPUBufferUsage_QueryResolve = 0x0000000000000200; +static const WGPUBufferUsage WGPUBufferUsage_TexelBuffer = 0x0000000000000400; + +typedef WGPUFlags WGPUColorWriteMask; +static const WGPUColorWriteMask WGPUColorWriteMask_None = 0x0000000000000000; +static const WGPUColorWriteMask WGPUColorWriteMask_Red = 0x0000000000000001; +static const WGPUColorWriteMask WGPUColorWriteMask_Green = 0x0000000000000002; +static const WGPUColorWriteMask WGPUColorWriteMask_Blue = 0x0000000000000004; +static const WGPUColorWriteMask WGPUColorWriteMask_Alpha = 0x0000000000000008; +static const WGPUColorWriteMask WGPUColorWriteMask_All = 0x000000000000000F; + +typedef WGPUFlags WGPUHeapProperty; +static const WGPUHeapProperty WGPUHeapProperty_None = 0x0000000000000000; +static const WGPUHeapProperty WGPUHeapProperty_DeviceLocal = 0x0000000000000001; +static const WGPUHeapProperty WGPUHeapProperty_HostVisible = 0x0000000000000002; +static const WGPUHeapProperty WGPUHeapProperty_HostCoherent = 0x0000000000000004; +static const WGPUHeapProperty WGPUHeapProperty_HostUncached = 0x0000000000000008; +static const WGPUHeapProperty WGPUHeapProperty_HostCached = 0x0000000000000010; + +typedef WGPUFlags WGPUMapMode; +static const WGPUMapMode WGPUMapMode_None = 0x0000000000000000; +static const WGPUMapMode WGPUMapMode_Read = 0x0000000000000001; +static const WGPUMapMode WGPUMapMode_Write = 0x0000000000000002; + +typedef WGPUFlags WGPUShaderStage; +static const WGPUShaderStage WGPUShaderStage_None = 0x0000000000000000; +static const WGPUShaderStage WGPUShaderStage_Vertex = 0x0000000000000001; +static const WGPUShaderStage WGPUShaderStage_Fragment = 0x0000000000000002; +static const WGPUShaderStage WGPUShaderStage_Compute = 0x0000000000000004; + +typedef WGPUFlags WGPUTextureUsage; +static const WGPUTextureUsage WGPUTextureUsage_None = 0x0000000000000000; +static const WGPUTextureUsage WGPUTextureUsage_CopySrc = 0x0000000000000001; +static const WGPUTextureUsage WGPUTextureUsage_CopyDst = 0x0000000000000002; +static const WGPUTextureUsage WGPUTextureUsage_TextureBinding = 0x0000000000000004; +static const WGPUTextureUsage WGPUTextureUsage_StorageBinding = 0x0000000000000008; +static const WGPUTextureUsage WGPUTextureUsage_RenderAttachment = 0x0000000000000010; +static const WGPUTextureUsage WGPUTextureUsage_TransientAttachment = 0x0000000000000020; +static const WGPUTextureUsage WGPUTextureUsage_StorageAttachment = 0x0000000000000040; + +typedef void (*WGPUCallback)(void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef size_t (*WGPUDawnLoadCacheDataFunction)(void const * key, size_t keySize, void * value, size_t valueSize, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUDawnStoreCacheDataFunction)(void const * key, size_t keySize, void const * value, size_t valueSize, void * userdata) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProc)(void) WGPU_FUNCTION_ATTRIBUTE; + +// Callback function pointers +typedef void (*WGPUBufferMapCallback)(WGPUMapAsyncStatus status, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPUCompilationInfoCallback)(WGPUCompilationInfoRequestStatus status, struct WGPUCompilationInfo const * compilationInfo, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPUCreateComputePipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPUCreateRenderPipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef size_t (*WGPUDawnLoadCacheDataCallback)(size_t keySize, uint8_t const * key, size_t valueSize, uint8_t * value, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPUDawnStoreCacheDataCallback)(size_t keySize, uint8_t const * key, size_t valueSize, uint8_t const * value, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPUDeviceLostCallback)(WGPUDevice const * device, WGPUDeviceLostReason reason, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPUDisposeCallback)(WGPUCallbackStatus status, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPULoggingCallback)(WGPULoggingType type, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPUPopErrorScopeCallback)(WGPUPopErrorScopeStatus status, WGPUErrorType type, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPUQueueWorkDoneCallback)(WGPUQueueWorkDoneStatus status, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPUAdapter adapter, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef void (*WGPUUncapturedErrorCallback)(WGPUDevice const * device, WGPUErrorType type, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE; + +typedef struct WGPUChainedStruct { + struct WGPUChainedStruct * next; + WGPUSType sType; +} WGPUChainedStruct WGPU_STRUCTURE_ATTRIBUTE; + +typedef struct WGPUBufferMapCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUCallbackMode mode; + WGPUBufferMapCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUBufferMapCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BUFFER_MAP_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBufferMapCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUCompilationInfoCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUCallbackMode mode; + WGPUCompilationInfoCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUCompilationInfoCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COMPILATION_INFO_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCompilationInfoCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUCreateComputePipelineAsyncCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUCallbackMode mode; + WGPUCreateComputePipelineAsyncCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUCreateComputePipelineAsyncCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_CREATE_COMPUTE_PIPELINE_ASYNC_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCreateComputePipelineAsyncCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUCreateRenderPipelineAsyncCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUCallbackMode mode; + WGPUCreateRenderPipelineAsyncCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUCreateRenderPipelineAsyncCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_CREATE_RENDER_PIPELINE_ASYNC_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCreateRenderPipelineAsyncCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUDawnLoadCacheDataCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUDawnLoadCacheDataCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUDawnLoadCacheDataCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_LOAD_CACHE_DATA_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnLoadCacheDataCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUDawnStoreCacheDataCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUDawnStoreCacheDataCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUDawnStoreCacheDataCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_STORE_CACHE_DATA_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnStoreCacheDataCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUDeviceLostCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUCallbackMode mode; + WGPUDeviceLostCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUDeviceLostCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DEVICE_LOST_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDeviceLostCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUDisposeCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUCallbackMode mode; + WGPUDisposeCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUDisposeCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DISPOSE_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDisposeCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPULoggingCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPULoggingCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPULoggingCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_LOGGING_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPULoggingCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUPopErrorScopeCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUCallbackMode mode; + WGPUPopErrorScopeCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUPopErrorScopeCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_POP_ERROR_SCOPE_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPopErrorScopeCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUQueueWorkDoneCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUCallbackMode mode; + WGPUQueueWorkDoneCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUQueueWorkDoneCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_QUEUE_WORK_DONE_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUQueueWorkDoneCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPURequestAdapterCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUCallbackMode mode; + WGPURequestAdapterCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPURequestAdapterCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_REQUEST_ADAPTER_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestAdapterCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPURequestDeviceCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUCallbackMode mode; + WGPURequestDeviceCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPURequestDeviceCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_REQUEST_DEVICE_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestDeviceCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUUncapturedErrorCallbackInfo { + WGPUChainedStruct * nextInChain; + WGPUUncapturedErrorCallback callback; + WGPU_NULLABLE void* userdata1; + WGPU_NULLABLE void* userdata2; +} WGPUUncapturedErrorCallbackInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_UNCAPTURED_ERROR_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUUncapturedErrorCallbackInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.callback=*/NULL _wgpu_COMMA \ + /*.userdata1=*/NULL _wgpu_COMMA \ + /*.userdata2=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUAdapterInfo +typedef struct WGPUAdapterPropertiesD3D { + WGPUChainedStruct chain; + uint32_t shaderModel; + uint32_t adapterLUIDLowPart; + uint32_t adapterLUIDHighPart; +} WGPUAdapterPropertiesD3D WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_ADAPTER_PROPERTIES_D3D_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterPropertiesD3D, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_AdapterPropertiesD3D _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.shaderModel=*/0 _wgpu_COMMA \ + /*.adapterLUIDLowPart=*/0 _wgpu_COMMA \ + /*.adapterLUIDHighPart=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUAdapterInfo +typedef struct WGPUAdapterPropertiesDrm { + WGPUChainedStruct chain; + WGPUBool hasPrimary; + WGPUBool hasRender; + uint64_t primaryMajor; + uint64_t primaryMinor; + uint64_t renderMajor; + uint64_t renderMinor; +} WGPUAdapterPropertiesDrm WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_ADAPTER_PROPERTIES_DRM_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterPropertiesDrm, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_AdapterPropertiesDrm _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.hasPrimary=*/WGPU_FALSE _wgpu_COMMA \ + /*.hasRender=*/WGPU_FALSE _wgpu_COMMA \ + /*.primaryMajor=*/0 _wgpu_COMMA \ + /*.primaryMinor=*/0 _wgpu_COMMA \ + /*.renderMajor=*/0 _wgpu_COMMA \ + /*.renderMinor=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUAdapterInfo +typedef struct WGPUAdapterPropertiesVk { + WGPUChainedStruct chain; + uint32_t driverVersion; +} WGPUAdapterPropertiesVk WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_ADAPTER_PROPERTIES_VK_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterPropertiesVk, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_AdapterPropertiesVk _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.driverVersion=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUAdapterInfo +typedef struct WGPUAdapterPropertiesWGPU { + WGPUChainedStruct chain; + WGPUBackendType backendType; +} WGPUAdapterPropertiesWGPU WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_ADAPTER_PROPERTIES_WGPU_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterPropertiesWGPU, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_AdapterPropertiesWGPU _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.backendType=*/WGPUBackendType_Undefined _wgpu_COMMA \ +}) + +typedef struct WGPUBindingResource { + WGPUChainedStruct * nextInChain; + WGPU_NULLABLE WGPUBuffer buffer; + uint64_t offset; + uint64_t size; + WGPU_NULLABLE WGPUSampler sampler; + WGPU_NULLABLE WGPUTextureView textureView; +} WGPUBindingResource WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BINDING_RESOURCE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBindingResource, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.buffer=*/NULL _wgpu_COMMA \ + /*.offset=*/0 _wgpu_COMMA \ + /*.size=*/WGPU_WHOLE_SIZE _wgpu_COMMA \ + /*.sampler=*/NULL _wgpu_COMMA \ + /*.textureView=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUBlendComponent { + WGPUBlendOperation operation; + WGPUBlendFactor srcFactor; + WGPUBlendFactor dstFactor; +} WGPUBlendComponent WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BLEND_COMPONENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBlendComponent, { \ + /*.operation=*/WGPUBlendOperation_Undefined _wgpu_COMMA \ + /*.srcFactor=*/WGPUBlendFactor_Undefined _wgpu_COMMA \ + /*.dstFactor=*/WGPUBlendFactor_Undefined _wgpu_COMMA \ +}) + +typedef struct WGPUBufferBindingLayout { + WGPUChainedStruct * nextInChain; + WGPUBufferBindingType type; + WGPUBool hasDynamicOffset; + uint64_t minBindingSize; +} WGPUBufferBindingLayout WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BUFFER_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBufferBindingLayout, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.type=*/WGPUBufferBindingType_Undefined _wgpu_COMMA \ + /*.hasDynamicOffset=*/WGPU_FALSE _wgpu_COMMA \ + /*.minBindingSize=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUBufferDescriptor +typedef struct WGPUBufferHostMappedPointer { + WGPUChainedStruct chain; + void * pointer; + WGPUCallback disposeCallback; + void * userdata; +} WGPUBufferHostMappedPointer WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BUFFER_HOST_MAPPED_POINTER_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBufferHostMappedPointer, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_BufferHostMappedPointer _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.pointer=*/NULL _wgpu_COMMA \ + /*.disposeCallback=*/NULL _wgpu_COMMA \ + /*.userdata=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUColor { + double r; + double g; + double b; + double a; +} WGPUColor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COLOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUColor, { \ + /*.r=*/0. _wgpu_COMMA \ + /*.g=*/0. _wgpu_COMMA \ + /*.b=*/0. _wgpu_COMMA \ + /*.a=*/0. _wgpu_COMMA \ +}) + +typedef struct WGPUColorSpaceDawn { + WGPUChainedStruct * nextInChain; + WGPUColorSpacePrimariesDawn primaries; + WGPUColorSpaceTransferDawn transfer; + WGPUColorSpaceYCbCrRangeDawn yCbCrRange; + WGPUColorSpaceYCbCrMatrixDawn yCbCrMatrix; + float hdrReferenceWhiteLuminance; +} WGPUColorSpaceDawn WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COLOR_SPACE_DAWN_INIT _wgpu_MAKE_INIT_STRUCT(WGPUColorSpaceDawn, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.primaries=*/_wgpu_ENUM_ZERO_INIT(WGPUColorSpacePrimariesDawn) _wgpu_COMMA \ + /*.transfer=*/WGPUColorSpaceTransferDawn_Identity _wgpu_COMMA \ + /*.yCbCrRange=*/WGPUColorSpaceYCbCrRangeDawn_Identity _wgpu_COMMA \ + /*.yCbCrMatrix=*/WGPUColorSpaceYCbCrMatrixDawn_Identity _wgpu_COMMA \ + /*.hdrReferenceWhiteLuminance=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUColorTargetState +typedef struct WGPUColorTargetStateExpandResolveTextureDawn { + WGPUChainedStruct chain; + WGPUBool enabled; +} WGPUColorTargetStateExpandResolveTextureDawn WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COLOR_TARGET_STATE_EXPAND_RESOLVE_TEXTURE_DAWN_INIT _wgpu_MAKE_INIT_STRUCT(WGPUColorTargetStateExpandResolveTextureDawn, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_ColorTargetStateExpandResolveTextureDawn _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.enabled=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPUCommandBufferDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; +} WGPUCommandBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COMMAND_BUFFER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCommandBufferDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +// Can be chained in WGPULimits +typedef struct WGPUCompatibilityModeLimits { + WGPUChainedStruct chain; + uint32_t maxStorageBuffersInVertexStage; + uint32_t maxStorageTexturesInVertexStage; + uint32_t maxStorageBuffersInFragmentStage; + uint32_t maxStorageTexturesInFragmentStage; +} WGPUCompatibilityModeLimits WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COMPATIBILITY_MODE_LIMITS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCompatibilityModeLimits, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_CompatibilityModeLimits _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.maxStorageBuffersInVertexStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxStorageTexturesInVertexStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxStorageBuffersInFragmentStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxStorageTexturesInFragmentStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ +}) + +typedef struct WGPUConstantEntry { + WGPUChainedStruct * nextInChain; + WGPUStringView key; + double value; +} WGPUConstantEntry WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_CONSTANT_ENTRY_INIT _wgpu_MAKE_INIT_STRUCT(WGPUConstantEntry, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.key=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.value=*/0. _wgpu_COMMA \ +}) + +typedef struct WGPUCopyTextureForBrowserOptions { + WGPUChainedStruct * nextInChain; + WGPUBool flipY; + WGPUBool needsColorSpaceConversion; + WGPUAlphaMode srcAlphaMode; + WGPU_NULLABLE float const * srcTransferFunctionParameters; + WGPU_NULLABLE float const * conversionMatrix; + WGPU_NULLABLE float const * dstTransferFunctionParameters; + WGPUAlphaMode dstAlphaMode; + WGPUBool internalUsage; +} WGPUCopyTextureForBrowserOptions WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COPY_TEXTURE_FOR_BROWSER_OPTIONS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCopyTextureForBrowserOptions, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.flipY=*/WGPU_FALSE _wgpu_COMMA \ + /*.needsColorSpaceConversion=*/WGPU_FALSE _wgpu_COMMA \ + /*.srcAlphaMode=*/WGPUAlphaMode_Unpremultiplied _wgpu_COMMA \ + /*.srcTransferFunctionParameters=*/NULL _wgpu_COMMA \ + /*.conversionMatrix=*/NULL _wgpu_COMMA \ + /*.dstTransferFunctionParameters=*/NULL _wgpu_COMMA \ + /*.dstAlphaMode=*/WGPUAlphaMode_Unpremultiplied _wgpu_COMMA \ + /*.internalUsage=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUAdapterInfo +typedef struct WGPUDawnAdapterPropertiesPowerPreference { + WGPUChainedStruct chain; + WGPUPowerPreference powerPreference; +} WGPUDawnAdapterPropertiesPowerPreference WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_ADAPTER_PROPERTIES_POWER_PREFERENCE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnAdapterPropertiesPowerPreference, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnAdapterPropertiesPowerPreference _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.powerPreference=*/WGPUPowerPreference_Undefined _wgpu_COMMA \ +}) + +// Can be chained in WGPUBufferDescriptor +typedef struct WGPUDawnBufferDescriptorErrorInfoFromWireClient { + WGPUChainedStruct chain; + WGPUBool outOfMemory; +} WGPUDawnBufferDescriptorErrorInfoFromWireClient WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_BUFFER_DESCRIPTOR_ERROR_INFO_FROM_WIRE_CLIENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnBufferDescriptorErrorInfoFromWireClient, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.outOfMemory=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUDeviceDescriptor +typedef struct WGPUDawnCacheDeviceDescriptor { + WGPUChainedStruct chain; + WGPUStringView isolationKey; + WGPUDawnLoadCacheDataCallbackInfo dawnLoadCacheDataCallbackInfo; + WGPUDawnStoreCacheDataCallbackInfo dawnStoreCacheDataCallbackInfo; +} WGPUDawnCacheDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_CACHE_DEVICE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnCacheDeviceDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnCacheDeviceDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.isolationKey=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.dawnLoadCacheDataCallbackInfo=*/WGPU_DAWN_LOAD_CACHE_DATA_CALLBACK_INFO_INIT _wgpu_COMMA \ + /*.dawnStoreCacheDataCallbackInfo=*/WGPU_DAWN_STORE_CACHE_DATA_CALLBACK_INFO_INIT _wgpu_COMMA \ +}) + +// Can be chained in WGPUCompilationMessage +typedef struct WGPUDawnCompilationMessageUtf16 { + WGPUChainedStruct chain; + uint64_t linePos; + uint64_t offset; + uint64_t length; +} WGPUDawnCompilationMessageUtf16 WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_COMPILATION_MESSAGE_UTF16_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnCompilationMessageUtf16, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnCompilationMessageUtf16 _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.linePos=*/0 _wgpu_COMMA \ + /*.offset=*/0 _wgpu_COMMA \ + /*.length=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUDeviceDescriptor +typedef struct WGPUDawnConsumeAdapterDescriptor { + WGPUChainedStruct chain; + WGPUBool consumeAdapter; +} WGPUDawnConsumeAdapterDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_CONSUME_ADAPTER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnConsumeAdapterDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnConsumeAdapterDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.consumeAdapter=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUDeviceDescriptor +typedef struct WGPUDawnDeviceAllocatorControl { + WGPUChainedStruct chain; + size_t allocatorHeapBlockSize; +} WGPUDawnDeviceAllocatorControl WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_DEVICE_ALLOCATOR_CONTROL_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnDeviceAllocatorControl, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnDeviceAllocatorControl _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.allocatorHeapBlockSize=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUDawnDrmFormatProperties { + uint64_t modifier; + uint32_t modifierPlaneCount; +} WGPUDawnDrmFormatProperties WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_DRM_FORMAT_PROPERTIES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnDrmFormatProperties, { \ + /*.modifier=*/0 _wgpu_COMMA \ + /*.modifierPlaneCount=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUCommandEncoderDescriptor +typedef struct WGPUDawnEncoderInternalUsageDescriptor { + WGPUChainedStruct chain; + WGPUBool useInternalUsages; +} WGPUDawnEncoderInternalUsageDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_ENCODER_INTERNAL_USAGE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnEncoderInternalUsageDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnEncoderInternalUsageDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.useInternalUsages=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUBufferDescriptor +typedef struct WGPUDawnFakeBufferOOMForTesting { + WGPUChainedStruct chain; + WGPUBool fakeOOMAtWireClientMap; + WGPUBool fakeOOMAtNativeMap; + WGPUBool fakeOOMAtDevice; +} WGPUDawnFakeBufferOOMForTesting WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_FAKE_BUFFER_OOM_FOR_TESTING_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnFakeBufferOOMForTesting, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnFakeBufferOOMForTesting _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.fakeOOMAtWireClientMap=*/WGPU_FALSE _wgpu_COMMA \ + /*.fakeOOMAtNativeMap=*/WGPU_FALSE _wgpu_COMMA \ + /*.fakeOOMAtDevice=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUDeviceDescriptor +typedef struct WGPUDawnFakeDeviceInitializeErrorForTesting { + WGPUChainedStruct chain; +} WGPUDawnFakeDeviceInitializeErrorForTesting WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_FAKE_DEVICE_INITIALIZE_ERROR_FOR_TESTING_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnFakeDeviceInitializeErrorForTesting, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnFakeDeviceInitializeErrorForTesting _wgpu_COMMA \ + }) _wgpu_COMMA \ +}) + +// Can be chained in WGPULimits +typedef struct WGPUDawnHostMappedPointerLimits { + WGPUChainedStruct chain; + uint32_t hostMappedPointerAlignment; +} WGPUDawnHostMappedPointerLimits WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_HOST_MAPPED_POINTER_LIMITS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnHostMappedPointerLimits, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnHostMappedPointerLimits _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.hostMappedPointerAlignment=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ +}) + +typedef struct WGPUDawnInjectedInvalidSType { + WGPUChainedStruct chain; + WGPUSType invalidSType; +} WGPUDawnInjectedInvalidSType WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_INJECTED_INVALID_S_TYPE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnInjectedInvalidSType, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnInjectedInvalidSType _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.invalidSType=*/_wgpu_ENUM_ZERO_INIT(WGPUSType) _wgpu_COMMA \ +}) + +// Can be chained in WGPURenderPassDescriptor +typedef struct WGPUDawnRenderPassSampleCount { + WGPUChainedStruct chain; + uint32_t sampleCount; +} WGPUDawnRenderPassSampleCount WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_RENDER_PASS_SAMPLE_COUNT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnRenderPassSampleCount, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnRenderPassSampleCount _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.sampleCount=*/1 _wgpu_COMMA \ +}) + +// Can be chained in WGPUShaderModuleDescriptor +typedef struct WGPUDawnShaderModuleSPIRVOptionsDescriptor { + WGPUChainedStruct chain; + WGPUBool allowNonUniformDerivatives; +} WGPUDawnShaderModuleSPIRVOptionsDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_SHADER_MODULE_SPIRV_OPTIONS_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnShaderModuleSPIRVOptionsDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.allowNonUniformDerivatives=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUShaderModuleDescriptor +typedef struct WGPUDawnShaderSourceSPIRV { + WGPUChainedStruct chain; + size_t codeSize; + uint32_t const * code; +} WGPUDawnShaderSourceSPIRV WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_SHADER_SOURCE_SPIRV_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnShaderSourceSPIRV, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnShaderSourceSPIRV _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.codeSize=*/0 _wgpu_COMMA \ + /*.code=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPULimits +typedef struct WGPUDawnTexelCopyBufferRowAlignmentLimits { + WGPUChainedStruct chain; + uint32_t minTexelCopyBufferRowAlignment; +} WGPUDawnTexelCopyBufferRowAlignmentLimits WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_TEXEL_COPY_BUFFER_ROW_ALIGNMENT_LIMITS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnTexelCopyBufferRowAlignmentLimits, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnTexelCopyBufferRowAlignmentLimits _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.minTexelCopyBufferRowAlignment=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ +}) + +// Can be chained in WGPUTextureDescriptor +typedef struct WGPUDawnTextureInternalUsageDescriptor { + WGPUChainedStruct chain; + WGPUTextureUsage internalUsage; +} WGPUDawnTextureInternalUsageDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_TEXTURE_INTERNAL_USAGE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnTextureInternalUsageDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnTextureInternalUsageDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.internalUsage=*/WGPUTextureUsage_None _wgpu_COMMA \ +}) + +// Can be chained in WGPUInstanceDescriptor +// Can be chained in WGPURequestAdapterOptions +// Can be chained in WGPUDeviceDescriptor +typedef struct WGPUDawnTogglesDescriptor { + WGPUChainedStruct chain; + size_t enabledToggleCount; + const char* const * enabledToggles; + size_t disabledToggleCount; + const char* const * disabledToggles; +} WGPUDawnTogglesDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_TOGGLES_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnTogglesDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnTogglesDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.enabledToggleCount=*/0 _wgpu_COMMA \ + /*.enabledToggles=*/NULL _wgpu_COMMA \ + /*.disabledToggleCount=*/0 _wgpu_COMMA \ + /*.disabledToggles=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUInstanceDescriptor +typedef struct WGPUDawnWGSLBlocklist { + WGPUChainedStruct chain; + size_t blocklistedFeatureCount; + const char* const * blocklistedFeatures; +} WGPUDawnWGSLBlocklist WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_WGSL_BLOCKLIST_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnWGSLBlocklist, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnWGSLBlocklist _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.blocklistedFeatureCount=*/0 _wgpu_COMMA \ + /*.blocklistedFeatures=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUInstanceDescriptor +typedef struct WGPUDawnWireWGSLControl { + WGPUChainedStruct chain; + WGPUBool enableExperimental; + WGPUBool enableUnsafe; + WGPUBool enableTesting; +} WGPUDawnWireWGSLControl WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_WIRE_WGSL_CONTROL_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnWireWGSLControl, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnWireWGSLControl _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.enableExperimental=*/WGPU_FALSE _wgpu_COMMA \ + /*.enableUnsafe=*/WGPU_FALSE _wgpu_COMMA \ + /*.enableTesting=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUEmscriptenSurfaceSourceCanvasHTMLSelector { + WGPUChainedStruct chain; + WGPUStringView selector; +} WGPUEmscriptenSurfaceSourceCanvasHTMLSelector WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_EMSCRIPTEN_SURFACE_SOURCE_CANVAS_HTML_SELECTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUEmscriptenSurfaceSourceCanvasHTMLSelector, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.selector=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUExtent2D { + uint32_t width; + uint32_t height; +} WGPUExtent2D WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_EXTENT_2D_INIT _wgpu_MAKE_INIT_STRUCT(WGPUExtent2D, { \ + /*.width=*/0 _wgpu_COMMA \ + /*.height=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUExtent3D { + uint32_t width; + uint32_t height; + uint32_t depthOrArrayLayers; +} WGPUExtent3D WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_EXTENT_3D_INIT _wgpu_MAKE_INIT_STRUCT(WGPUExtent3D, { \ + /*.width=*/0 _wgpu_COMMA \ + /*.height=*/1 _wgpu_COMMA \ + /*.depthOrArrayLayers=*/1 _wgpu_COMMA \ +}) + +// Can be chained in WGPUBindGroupEntry +typedef struct WGPUExternalTextureBindingEntry { + WGPUChainedStruct chain; + WGPUExternalTexture externalTexture; +} WGPUExternalTextureBindingEntry WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_EXTERNAL_TEXTURE_BINDING_ENTRY_INIT _wgpu_MAKE_INIT_STRUCT(WGPUExternalTextureBindingEntry, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_ExternalTextureBindingEntry _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.externalTexture=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUBindGroupLayoutEntry +typedef struct WGPUExternalTextureBindingLayout { + WGPUChainedStruct chain; +} WGPUExternalTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_EXTERNAL_TEXTURE_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUExternalTextureBindingLayout, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_ExternalTextureBindingLayout _wgpu_COMMA \ + }) _wgpu_COMMA \ +}) + +typedef struct WGPUFuture { + uint64_t id; +} WGPUFuture WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_FUTURE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUFuture, { \ + /*.id=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUInstanceLimits { + WGPUChainedStruct * nextInChain; + size_t timedWaitAnyMaxCount; +} WGPUInstanceLimits WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_INSTANCE_LIMITS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUInstanceLimits, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.timedWaitAnyMaxCount=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER { + WGPUBool unused; +} WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_INTERNAL_HAVE_EMDAWNWEBGPU_HEADER_INIT _wgpu_MAKE_INIT_STRUCT(WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER, { \ + /*.unused=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPUMemoryHeapInfo { + WGPUHeapProperty properties; + uint64_t size; +} WGPUMemoryHeapInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_MEMORY_HEAP_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUMemoryHeapInfo, { \ + /*.properties=*/WGPUHeapProperty_None _wgpu_COMMA \ + /*.size=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUMultisampleState { + WGPUChainedStruct * nextInChain; + uint32_t count; + uint32_t mask; + WGPUBool alphaToCoverageEnabled; +} WGPUMultisampleState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_MULTISAMPLE_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUMultisampleState, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.count=*/1 _wgpu_COMMA \ + /*.mask=*/0xFFFFFFFF _wgpu_COMMA \ + /*.alphaToCoverageEnabled=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPUOrigin2D { + uint32_t x; + uint32_t y; +} WGPUOrigin2D WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_ORIGIN_2D_INIT _wgpu_MAKE_INIT_STRUCT(WGPUOrigin2D, { \ + /*.x=*/0 _wgpu_COMMA \ + /*.y=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUOrigin3D { + uint32_t x; + uint32_t y; + uint32_t z; +} WGPUOrigin3D WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_ORIGIN_3D_INIT _wgpu_MAKE_INIT_STRUCT(WGPUOrigin3D, { \ + /*.x=*/0 _wgpu_COMMA \ + /*.y=*/0 _wgpu_COMMA \ + /*.z=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUPassTimestampWrites { + WGPUChainedStruct * nextInChain; + WGPUQuerySet querySet; + uint32_t beginningOfPassWriteIndex; + uint32_t endOfPassWriteIndex; +} WGPUPassTimestampWrites WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_PASS_TIMESTAMP_WRITES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPassTimestampWrites, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.querySet=*/NULL _wgpu_COMMA \ + /*.beginningOfPassWriteIndex=*/WGPU_QUERY_SET_INDEX_UNDEFINED _wgpu_COMMA \ + /*.endOfPassWriteIndex=*/WGPU_QUERY_SET_INDEX_UNDEFINED _wgpu_COMMA \ +}) + +// Can be chained in WGPUPipelineLayoutDescriptor +typedef struct WGPUPipelineLayoutResourceTable { + WGPUChainedStruct chain; + WGPUBool usesResourceTable; +} WGPUPipelineLayoutResourceTable WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_PIPELINE_LAYOUT_RESOURCE_TABLE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPipelineLayoutResourceTable, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_PipelineLayoutResourceTable _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.usesResourceTable=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPUPipelineLayoutStorageAttachment { + WGPUChainedStruct * nextInChain; + uint64_t offset; + WGPUTextureFormat format; +} WGPUPipelineLayoutStorageAttachment WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_PIPELINE_LAYOUT_STORAGE_ATTACHMENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPipelineLayoutStorageAttachment, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.offset=*/0 _wgpu_COMMA \ + /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ +}) + +typedef struct WGPUPrimitiveState { + WGPUChainedStruct * nextInChain; + WGPUPrimitiveTopology topology; + WGPUIndexFormat stripIndexFormat; + WGPUFrontFace frontFace; + WGPUCullMode cullMode; + WGPUBool unclippedDepth; +} WGPUPrimitiveState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_PRIMITIVE_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPrimitiveState, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.topology=*/WGPUPrimitiveTopology_Undefined _wgpu_COMMA \ + /*.stripIndexFormat=*/WGPUIndexFormat_Undefined _wgpu_COMMA \ + /*.frontFace=*/WGPUFrontFace_Undefined _wgpu_COMMA \ + /*.cullMode=*/WGPUCullMode_Undefined _wgpu_COMMA \ + /*.unclippedDepth=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPUQuerySetDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPUQueryType type; + uint32_t count; +} WGPUQuerySetDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_QUERY_SET_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUQuerySetDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.type=*/_wgpu_ENUM_ZERO_INIT(WGPUQueryType) _wgpu_COMMA \ + /*.count=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUQueueDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; +} WGPUQueueDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_QUEUE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUQueueDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +typedef struct WGPURenderBundleDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; +} WGPURenderBundleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_BUNDLE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderBundleDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +// Can be chained in WGPURenderBundleEncoderDescriptor +typedef struct WGPURenderBundleEncoderResourceTable { + WGPUChainedStruct chain; + WGPUBool usesResourceTable; +} WGPURenderBundleEncoderResourceTable WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_BUNDLE_ENCODER_RESOURCE_TABLE_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderBundleEncoderResourceTable, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_RenderBundleEncoderResourceTable _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.usesResourceTable=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPURenderPassDepthStencilAttachment { + WGPUChainedStruct * nextInChain; + WGPUTextureView view; + WGPULoadOp depthLoadOp; + WGPUStoreOp depthStoreOp; + float depthClearValue; + WGPUBool depthReadOnly; + WGPULoadOp stencilLoadOp; + WGPUStoreOp stencilStoreOp; + uint32_t stencilClearValue; + WGPUBool stencilReadOnly; +} WGPURenderPassDepthStencilAttachment WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_PASS_DEPTH_STENCIL_ATTACHMENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassDepthStencilAttachment, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.view=*/NULL _wgpu_COMMA \ + /*.depthLoadOp=*/WGPULoadOp_Undefined _wgpu_COMMA \ + /*.depthStoreOp=*/WGPUStoreOp_Undefined _wgpu_COMMA \ + /*.depthClearValue=*/WGPU_DEPTH_CLEAR_VALUE_UNDEFINED _wgpu_COMMA \ + /*.depthReadOnly=*/WGPU_FALSE _wgpu_COMMA \ + /*.stencilLoadOp=*/WGPULoadOp_Undefined _wgpu_COMMA \ + /*.stencilStoreOp=*/WGPUStoreOp_Undefined _wgpu_COMMA \ + /*.stencilClearValue=*/0 _wgpu_COMMA \ + /*.stencilReadOnly=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPURenderPassDescriptor +typedef struct WGPURenderPassDescriptorResolveRect { + WGPUChainedStruct chain; + uint32_t colorOffsetX; + uint32_t colorOffsetY; + uint32_t resolveOffsetX; + uint32_t resolveOffsetY; + uint32_t width; + uint32_t height; +} WGPURenderPassDescriptorResolveRect WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_PASS_DESCRIPTOR_RESOLVE_RECT_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassDescriptorResolveRect, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_RenderPassDescriptorResolveRect _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.colorOffsetX=*/0 _wgpu_COMMA \ + /*.colorOffsetY=*/0 _wgpu_COMMA \ + /*.resolveOffsetX=*/0 _wgpu_COMMA \ + /*.resolveOffsetY=*/0 _wgpu_COMMA \ + /*.width=*/0 _wgpu_COMMA \ + /*.height=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPURenderPassDescriptor +typedef struct WGPURenderPassMaxDrawCount { + WGPUChainedStruct chain; + uint64_t maxDrawCount; +} WGPURenderPassMaxDrawCount WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_PASS_MAX_DRAW_COUNT_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassMaxDrawCount, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_RenderPassMaxDrawCount _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.maxDrawCount=*/50000000 _wgpu_COMMA \ +}) + +// Can be chained in WGPURequestAdapterOptions +typedef struct WGPURequestAdapterWebGPUBackendOptions { + WGPUChainedStruct chain; +} WGPURequestAdapterWebGPUBackendOptions WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_REQUEST_ADAPTER_WEBGPU_BACKEND_OPTIONS_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestAdapterWebGPUBackendOptions, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_RequestAdapterWebGPUBackendOptions _wgpu_COMMA \ + }) _wgpu_COMMA \ +}) + +// Can be chained in WGPURequestAdapterOptions +typedef struct WGPURequestAdapterWebXROptions { + WGPUChainedStruct chain; + WGPUBool xrCompatible; +} WGPURequestAdapterWebXROptions WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_REQUEST_ADAPTER_WEBXR_OPTIONS_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestAdapterWebXROptions, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_RequestAdapterWebXROptions _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.xrCompatible=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPUResourceTableDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + uint32_t size; +} WGPUResourceTableDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RESOURCE_TABLE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUResourceTableDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.size=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUSamplerBindingLayout { + WGPUChainedStruct * nextInChain; + WGPUSamplerBindingType type; +} WGPUSamplerBindingLayout WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SAMPLER_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSamplerBindingLayout, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.type=*/WGPUSamplerBindingType_Undefined _wgpu_COMMA \ +}) + +// Can be chained in WGPUShaderModuleDescriptor +typedef struct WGPUShaderModuleCompilationOptions { + WGPUChainedStruct chain; + WGPUBool strictMath; +} WGPUShaderModuleCompilationOptions WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHADER_MODULE_COMPILATION_OPTIONS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUShaderModuleCompilationOptions, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_ShaderModuleCompilationOptions _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.strictMath=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUShaderModuleDescriptor +typedef struct WGPUShaderSourceSPIRV { + WGPUChainedStruct chain; + uint32_t codeSize; + uint32_t const * code; +} WGPUShaderSourceSPIRV WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHADER_SOURCE_SPIRV_INIT _wgpu_MAKE_INIT_STRUCT(WGPUShaderSourceSPIRV, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_ShaderSourceSPIRV _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.codeSize=*/0 _wgpu_COMMA \ + /*.code=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUShaderModuleDescriptor +typedef struct WGPUShaderSourceWGSL { + WGPUChainedStruct chain; + WGPUStringView code; +} WGPUShaderSourceWGSL WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHADER_SOURCE_WGSL_INIT _wgpu_MAKE_INIT_STRUCT(WGPUShaderSourceWGSL, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_ShaderSourceWGSL _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.code=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUSharedBufferMemoryBeginAccessDescriptor { + WGPUChainedStruct * nextInChain; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const * fences; + size_t signaledValueCount; + uint64_t const * signaledValues; +} WGPUSharedBufferMemoryBeginAccessDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_BUFFER_MEMORY_BEGIN_ACCESS_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedBufferMemoryBeginAccessDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.initialized=*/WGPU_FALSE _wgpu_COMMA \ + /*.fenceCount=*/0 _wgpu_COMMA \ + /*.fences=*/NULL _wgpu_COMMA \ + /*.signaledValueCount=*/0 _wgpu_COMMA \ + /*.signaledValues=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUSharedBufferMemoryEndAccessState { + WGPUChainedStruct * nextInChain; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const * fences; + size_t signaledValueCount; + uint64_t const * signaledValues; +} WGPUSharedBufferMemoryEndAccessState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_BUFFER_MEMORY_END_ACCESS_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedBufferMemoryEndAccessState, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.initialized=*/WGPU_FALSE _wgpu_COMMA \ + /*.fenceCount=*/0 _wgpu_COMMA \ + /*.fences=*/NULL _wgpu_COMMA \ + /*.signaledValueCount=*/0 _wgpu_COMMA \ + /*.signaledValues=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedBufferMemoryDescriptor +typedef struct WGPUSharedBufferMemoryFromWindowsHandleDescriptor { + WGPUChainedStruct chain; + void * handle; + uint64_t size; +} WGPUSharedBufferMemoryFromWindowsHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_BUFFER_MEMORY_FROM_WINDOWS_HANDLE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedBufferMemoryFromWindowsHandleDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedBufferMemoryFromWindowsHandleDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/NULL _wgpu_COMMA \ + /*.size=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedBufferMemoryDescriptor +typedef struct WGPUSharedBufferMemoryHostPointerDescriptor { + WGPUChainedStruct chain; + void * pointer; + uint64_t size; + WGPUDisposeCallbackInfo disposeCallbackInfo; +} WGPUSharedBufferMemoryHostPointerDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_BUFFER_MEMORY_HOST_POINTER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedBufferMemoryHostPointerDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedBufferMemoryHostPointerDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.pointer=*/NULL _wgpu_COMMA \ + /*.size=*/0 _wgpu_COMMA \ + /*.disposeCallbackInfo=*/WGPU_DISPOSE_CALLBACK_INFO_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUSharedBufferMemoryProperties { + WGPUChainedStruct * nextInChain; + WGPUBufferUsage usage; + uint64_t size; +} WGPUSharedBufferMemoryProperties WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_BUFFER_MEMORY_PROPERTIES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedBufferMemoryProperties, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.usage=*/WGPUBufferUsage_None _wgpu_COMMA \ + /*.size=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceDXGISharedHandleDescriptor { + WGPUChainedStruct chain; + void * handle; +} WGPUSharedFenceDXGISharedHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_DXGI_SHARED_HANDLE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceDXGISharedHandleDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceDXGISharedHandleDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceDXGISharedHandleExportInfo { + WGPUChainedStruct chain; + void * handle; +} WGPUSharedFenceDXGISharedHandleExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_DXGI_SHARED_HANDLE_EXPORT_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceDXGISharedHandleExportInfo, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceDXGISharedHandleExportInfo _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceEGLSyncDescriptor { + WGPUChainedStruct chain; + void * sync; +} WGPUSharedFenceEGLSyncDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_EGL_SYNC_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceEGLSyncDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceEGLSyncDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.sync=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceEGLSyncExportInfo { + WGPUChainedStruct chain; + void * sync; +} WGPUSharedFenceEGLSyncExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_EGL_SYNC_EXPORT_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceEGLSyncExportInfo, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceEGLSyncExportInfo _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.sync=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceMTLSharedEventDescriptor { + WGPUChainedStruct chain; + void * sharedEvent; +} WGPUSharedFenceMTLSharedEventDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_MTL_SHARED_EVENT_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceMTLSharedEventDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceMTLSharedEventDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.sharedEvent=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceMTLSharedEventExportInfo { + WGPUChainedStruct chain; + void * sharedEvent; +} WGPUSharedFenceMTLSharedEventExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_MTL_SHARED_EVENT_EXPORT_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceMTLSharedEventExportInfo, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceMTLSharedEventExportInfo _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.sharedEvent=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceSyncFDDescriptor { + WGPUChainedStruct chain; + int handle; +} WGPUSharedFenceSyncFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_SYNC_FD_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceSyncFDDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceSyncFDDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceSyncFDExportInfo { + WGPUChainedStruct chain; + int handle; +} WGPUSharedFenceSyncFDExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_SYNC_FD_EXPORT_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceSyncFDExportInfo, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceSyncFDExportInfo _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor { + WGPUChainedStruct chain; + int handle; +} WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_VK_SEMAPHORE_OPAQUE_FD_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo { + WGPUChainedStruct chain; + int handle; +} WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_VK_SEMAPHORE_OPAQUE_FD_EXPORT_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceDescriptor +typedef struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor { + WGPUChainedStruct chain; + uint32_t handle; +} WGPUSharedFenceVkSemaphoreZirconHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_VK_SEMAPHORE_ZIRCON_HANDLE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceVkSemaphoreZirconHandleDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedFenceExportInfo +typedef struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo { + WGPUChainedStruct chain; + uint32_t handle; +} WGPUSharedFenceVkSemaphoreZirconHandleExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_VK_SEMAPHORE_ZIRCON_HANDLE_EXPORT_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceVkSemaphoreZirconHandleExportInfo, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryAHardwareBufferDescriptor { + WGPUChainedStruct chain; + void * handle; +} WGPUSharedTextureMemoryAHardwareBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_A_HARDWARE_BUFFER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryAHardwareBufferDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryBeginAccessDescriptor +typedef struct WGPUSharedTextureMemoryD3D11BeginState { + WGPUChainedStruct chain; + WGPUBool requiresEndAccessFence; +} WGPUSharedTextureMemoryD3D11BeginState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_D3D11_BEGIN_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryD3D11BeginState, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryD3D11BeginState _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.requiresEndAccessFence=*/WGPU_TRUE _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryBeginAccessDescriptor +typedef struct WGPUSharedTextureMemoryD3DSwapchainBeginState { + WGPUChainedStruct chain; + WGPUBool isSwapchain; +} WGPUSharedTextureMemoryD3DSwapchainBeginState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_D3D_SWAPCHAIN_BEGIN_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryD3DSwapchainBeginState, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryD3DSwapchainBeginState _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.isSwapchain=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPUSharedTextureMemoryDmaBufPlane { + int fd; + uint64_t offset; + uint32_t stride; +} WGPUSharedTextureMemoryDmaBufPlane WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_DMA_BUF_PLANE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryDmaBufPlane, { \ + /*.fd=*/0 _wgpu_COMMA \ + /*.offset=*/0 _wgpu_COMMA \ + /*.stride=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor { + WGPUChainedStruct chain; + void * handle; + WGPUBool useKeyedMutex; +} WGPUSharedTextureMemoryDXGISharedHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_DXGI_SHARED_HANDLE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryDXGISharedHandleDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.handle=*/NULL _wgpu_COMMA \ + /*.useKeyedMutex=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryEGLImageDescriptor { + WGPUChainedStruct chain; + void * image; +} WGPUSharedTextureMemoryEGLImageDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_EGL_IMAGE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryEGLImageDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryEGLImageDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.image=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryIOSurfaceDescriptor { + WGPUChainedStruct chain; + void * ioSurface; + WGPUBool allowStorageBinding; +} WGPUSharedTextureMemoryIOSurfaceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_IO_SURFACE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryIOSurfaceDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryIOSurfaceDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.ioSurface=*/NULL _wgpu_COMMA \ + /*.allowStorageBinding=*/WGPU_TRUE _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryOpaqueFDDescriptor { + WGPUChainedStruct chain; + void const * vkImageCreateInfo; + int memoryFD; + uint32_t memoryTypeIndex; + uint64_t allocationSize; + WGPUBool dedicatedAllocation; +} WGPUSharedTextureMemoryOpaqueFDDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_OPAQUE_FD_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryOpaqueFDDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryOpaqueFDDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.vkImageCreateInfo=*/NULL _wgpu_COMMA \ + /*.memoryFD=*/0 _wgpu_COMMA \ + /*.memoryTypeIndex=*/0 _wgpu_COMMA \ + /*.allocationSize=*/0 _wgpu_COMMA \ + /*.dedicatedAllocation=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor { + WGPUChainedStruct chain; + WGPUBool dedicatedAllocation; +} WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_VK_DEDICATED_ALLOCATION_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.dedicatedAllocation=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryBeginAccessDescriptor +typedef struct WGPUSharedTextureMemoryVkImageLayoutBeginState { + WGPUChainedStruct chain; + int32_t oldLayout; + int32_t newLayout; +} WGPUSharedTextureMemoryVkImageLayoutBeginState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_VK_IMAGE_LAYOUT_BEGIN_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryVkImageLayoutBeginState, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryVkImageLayoutBeginState _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.oldLayout=*/0 _wgpu_COMMA \ + /*.newLayout=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryEndAccessState +typedef struct WGPUSharedTextureMemoryVkImageLayoutEndState { + WGPUChainedStruct chain; + int32_t oldLayout; + int32_t newLayout; +} WGPUSharedTextureMemoryVkImageLayoutEndState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_VK_IMAGE_LAYOUT_END_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryVkImageLayoutEndState, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryVkImageLayoutEndState _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.oldLayout=*/0 _wgpu_COMMA \ + /*.newLayout=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryZirconHandleDescriptor { + WGPUChainedStruct chain; + uint32_t memoryFD; + uint64_t allocationSize; +} WGPUSharedTextureMemoryZirconHandleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_ZIRCON_HANDLE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryZirconHandleDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryZirconHandleDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.memoryFD=*/0 _wgpu_COMMA \ + /*.allocationSize=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUBindGroupLayoutEntry +typedef struct WGPUStaticSamplerBindingLayout { + WGPUChainedStruct chain; + WGPUSampler sampler; + uint32_t sampledTextureBinding; +} WGPUStaticSamplerBindingLayout WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_STATIC_SAMPLER_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUStaticSamplerBindingLayout, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_StaticSamplerBindingLayout _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.sampler=*/NULL _wgpu_COMMA \ + /*.sampledTextureBinding=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ +}) + +typedef struct WGPUStencilFaceState { + WGPUCompareFunction compare; + WGPUStencilOperation failOp; + WGPUStencilOperation depthFailOp; + WGPUStencilOperation passOp; +} WGPUStencilFaceState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_STENCIL_FACE_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUStencilFaceState, { \ + /*.compare=*/WGPUCompareFunction_Undefined _wgpu_COMMA \ + /*.failOp=*/WGPUStencilOperation_Undefined _wgpu_COMMA \ + /*.depthFailOp=*/WGPUStencilOperation_Undefined _wgpu_COMMA \ + /*.passOp=*/WGPUStencilOperation_Undefined _wgpu_COMMA \ +}) + +typedef struct WGPUStorageTextureBindingLayout { + WGPUChainedStruct * nextInChain; + WGPUStorageTextureAccess access; + WGPUTextureFormat format; + WGPUTextureViewDimension viewDimension; +} WGPUStorageTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_STORAGE_TEXTURE_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUStorageTextureBindingLayout, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.access=*/WGPUStorageTextureAccess_Undefined _wgpu_COMMA \ + /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ + /*.viewDimension=*/WGPUTextureViewDimension_Undefined _wgpu_COMMA \ +}) + +typedef struct WGPUSubgroupMatrixConfig { + WGPUSubgroupMatrixComponentType componentType; + WGPUSubgroupMatrixComponentType resultComponentType; + uint32_t M; + uint32_t N; + uint32_t K; + uint32_t minSubgroupSize; + uint32_t maxSubgroupSize; +} WGPUSubgroupMatrixConfig WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SUBGROUP_MATRIX_CONFIG_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSubgroupMatrixConfig, { \ + /*.componentType=*/_wgpu_ENUM_ZERO_INIT(WGPUSubgroupMatrixComponentType) _wgpu_COMMA \ + /*.resultComponentType=*/_wgpu_ENUM_ZERO_INIT(WGPUSubgroupMatrixComponentType) _wgpu_COMMA \ + /*.M=*/0 _wgpu_COMMA \ + /*.N=*/0 _wgpu_COMMA \ + /*.K=*/0 _wgpu_COMMA \ + /*.minSubgroupSize=*/0 _wgpu_COMMA \ + /*.maxSubgroupSize=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUSupportedFeatures { + size_t featureCount; + WGPUFeatureName const * features; +} WGPUSupportedFeatures WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SUPPORTED_FEATURES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSupportedFeatures, { \ + /*.featureCount=*/0 _wgpu_COMMA \ + /*.features=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUSupportedInstanceFeatures { + size_t featureCount; + WGPUInstanceFeatureName const * features; +} WGPUSupportedInstanceFeatures WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SUPPORTED_INSTANCE_FEATURES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSupportedInstanceFeatures, { \ + /*.featureCount=*/0 _wgpu_COMMA \ + /*.features=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUSupportedWGSLLanguageFeatures { + size_t featureCount; + WGPUWGSLLanguageFeatureName const * features; +} WGPUSupportedWGSLLanguageFeatures WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SUPPORTED_WGSL_LANGUAGE_FEATURES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSupportedWGSLLanguageFeatures, { \ + /*.featureCount=*/0 _wgpu_COMMA \ + /*.features=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUSurfaceCapabilities { + WGPUChainedStruct * nextInChain; + WGPUTextureUsage usages; + size_t formatCount; + WGPUTextureFormat const * formats; + size_t presentModeCount; + WGPUPresentMode const * presentModes; + size_t alphaModeCount; + WGPUCompositeAlphaMode const * alphaModes; +} WGPUSurfaceCapabilities WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_CAPABILITIES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceCapabilities, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.usages=*/WGPUTextureUsage_None _wgpu_COMMA \ + /*.formatCount=*/0 _wgpu_COMMA \ + /*.formats=*/NULL _wgpu_COMMA \ + /*.presentModeCount=*/0 _wgpu_COMMA \ + /*.presentModes=*/NULL _wgpu_COMMA \ + /*.alphaModeCount=*/0 _wgpu_COMMA \ + /*.alphaModes=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceColorManagement { + WGPUChainedStruct chain; + WGPUPredefinedColorSpace colorSpace; + WGPUToneMappingMode toneMappingMode; +} WGPUSurfaceColorManagement WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_COLOR_MANAGEMENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceColorManagement, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SurfaceColorManagement _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.colorSpace=*/_wgpu_ENUM_ZERO_INIT(WGPUPredefinedColorSpace) _wgpu_COMMA \ + /*.toneMappingMode=*/_wgpu_ENUM_ZERO_INIT(WGPUToneMappingMode) _wgpu_COMMA \ +}) + +typedef struct WGPUSurfaceConfiguration { + WGPUChainedStruct * nextInChain; + WGPUDevice device; + WGPUTextureFormat format; + WGPUTextureUsage usage; + uint32_t width; + uint32_t height; + size_t viewFormatCount; + WGPUTextureFormat const * viewFormats; + WGPUCompositeAlphaMode alphaMode; + WGPUPresentMode presentMode; +} WGPUSurfaceConfiguration WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_CONFIGURATION_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceConfiguration, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.device=*/NULL _wgpu_COMMA \ + /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ + /*.usage=*/WGPUTextureUsage_RenderAttachment _wgpu_COMMA \ + /*.width=*/0 _wgpu_COMMA \ + /*.height=*/0 _wgpu_COMMA \ + /*.viewFormatCount=*/0 _wgpu_COMMA \ + /*.viewFormats=*/NULL _wgpu_COMMA \ + /*.alphaMode=*/WGPUCompositeAlphaMode_Auto _wgpu_COMMA \ + /*.presentMode=*/WGPUPresentMode_Undefined _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceDescriptorFromWindowsCoreWindow { + WGPUChainedStruct chain; + void * coreWindow; +} WGPUSurfaceDescriptorFromWindowsCoreWindow WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_DESCRIPTOR_FROM_WINDOWS_CORE_WINDOW_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceDescriptorFromWindowsCoreWindow, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SurfaceDescriptorFromWindowsCoreWindow _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.coreWindow=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceDescriptorFromWindowsUWPSwapChainPanel { + WGPUChainedStruct chain; + void * swapChainPanel; +} WGPUSurfaceDescriptorFromWindowsUWPSwapChainPanel WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_DESCRIPTOR_FROM_WINDOWS_UWP_SWAP_CHAIN_PANEL_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceDescriptorFromWindowsUWPSwapChainPanel, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SurfaceDescriptorFromWindowsUWPSwapChainPanel _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.swapChainPanel=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceDescriptorFromWindowsWinUISwapChainPanel { + WGPUChainedStruct chain; + void * swapChainPanel; +} WGPUSurfaceDescriptorFromWindowsWinUISwapChainPanel WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_DESCRIPTOR_FROM_WINDOWS_WINUI_SWAP_CHAIN_PANEL_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceDescriptorFromWindowsWinUISwapChainPanel, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SurfaceDescriptorFromWindowsWinUISwapChainPanel _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.swapChainPanel=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceSourceAndroidNativeWindow { + WGPUChainedStruct chain; + void * window; +} WGPUSurfaceSourceAndroidNativeWindow WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_SOURCE_ANDROID_NATIVE_WINDOW_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceAndroidNativeWindow, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SurfaceSourceAndroidNativeWindow _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.window=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceSourceMetalLayer { + WGPUChainedStruct chain; + void * layer; +} WGPUSurfaceSourceMetalLayer WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_SOURCE_METAL_LAYER_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceMetalLayer, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SurfaceSourceMetalLayer _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.layer=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceSourceWaylandSurface { + WGPUChainedStruct chain; + void * display; + void * surface; +} WGPUSurfaceSourceWaylandSurface WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_SOURCE_WAYLAND_SURFACE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceWaylandSurface, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SurfaceSourceWaylandSurface _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.display=*/NULL _wgpu_COMMA \ + /*.surface=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceSourceWindowsHWND { + WGPUChainedStruct chain; + void * hinstance; + void * hwnd; +} WGPUSurfaceSourceWindowsHWND WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_SOURCE_WINDOWS_HWND_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceWindowsHWND, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SurfaceSourceWindowsHWND _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.hinstance=*/NULL _wgpu_COMMA \ + /*.hwnd=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceSourceXCBWindow { + WGPUChainedStruct chain; + void * connection; + uint32_t window; +} WGPUSurfaceSourceXCBWindow WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_SOURCE_XCB_WINDOW_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceXCBWindow, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SurfaceSourceXCBWindow _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.connection=*/NULL _wgpu_COMMA \ + /*.window=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSurfaceDescriptor +typedef struct WGPUSurfaceSourceXlibWindow { + WGPUChainedStruct chain; + void * display; + uint64_t window; +} WGPUSurfaceSourceXlibWindow WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_SOURCE_XLIB_WINDOW_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceXlibWindow, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SurfaceSourceXlibWindow _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.display=*/NULL _wgpu_COMMA \ + /*.window=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUSurfaceTexture { + WGPUChainedStruct * nextInChain; + WGPUTexture texture; + WGPUSurfaceGetCurrentTextureStatus status; +} WGPUSurfaceTexture WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_TEXTURE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceTexture, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.texture=*/NULL _wgpu_COMMA \ + /*.status=*/_wgpu_ENUM_ZERO_INIT(WGPUSurfaceGetCurrentTextureStatus) _wgpu_COMMA \ +}) + +// Can be chained in WGPUBindGroupEntry +typedef struct WGPUTexelBufferBindingEntry { + WGPUChainedStruct chain; + WGPUTexelBufferView texelBufferView; +} WGPUTexelBufferBindingEntry WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXEL_BUFFER_BINDING_ENTRY_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTexelBufferBindingEntry, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_TexelBufferBindingEntry _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.texelBufferView=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUBindGroupLayoutEntry +typedef struct WGPUTexelBufferBindingLayout { + WGPUChainedStruct chain; + WGPUTexelBufferAccess access; + WGPUTextureFormat format; +} WGPUTexelBufferBindingLayout WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXEL_BUFFER_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTexelBufferBindingLayout, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_TexelBufferBindingLayout _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.access=*/WGPUTexelBufferAccess_Undefined _wgpu_COMMA \ + /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ +}) + +typedef struct WGPUTexelBufferViewDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPUTextureFormat format; + uint64_t offset; + uint64_t size; +} WGPUTexelBufferViewDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXEL_BUFFER_VIEW_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTexelBufferViewDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ + /*.offset=*/0 _wgpu_COMMA \ + /*.size=*/WGPU_WHOLE_SIZE _wgpu_COMMA \ +}) + +typedef struct WGPUTexelCopyBufferLayout { + uint64_t offset; + uint32_t bytesPerRow; + uint32_t rowsPerImage; +} WGPUTexelCopyBufferLayout WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXEL_COPY_BUFFER_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTexelCopyBufferLayout, { \ + /*.offset=*/0 _wgpu_COMMA \ + /*.bytesPerRow=*/WGPU_COPY_STRIDE_UNDEFINED _wgpu_COMMA \ + /*.rowsPerImage=*/WGPU_COPY_STRIDE_UNDEFINED _wgpu_COMMA \ +}) + +typedef struct WGPUTextureBindingLayout { + WGPUChainedStruct * nextInChain; + WGPUTextureSampleType sampleType; + WGPUTextureViewDimension viewDimension; + WGPUBool multisampled; +} WGPUTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXTURE_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureBindingLayout, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.sampleType=*/WGPUTextureSampleType_Undefined _wgpu_COMMA \ + /*.viewDimension=*/WGPUTextureViewDimension_Undefined _wgpu_COMMA \ + /*.multisampled=*/WGPU_FALSE _wgpu_COMMA \ +}) + +// Can be chained in WGPUTextureDescriptor +typedef struct WGPUTextureBindingViewDimension { + WGPUChainedStruct chain; + WGPUTextureViewDimension textureBindingViewDimension; +} WGPUTextureBindingViewDimension WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXTURE_BINDING_VIEW_DIMENSION_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureBindingViewDimension, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_TextureBindingViewDimension _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.textureBindingViewDimension=*/WGPUTextureViewDimension_Undefined _wgpu_COMMA \ +}) + +typedef struct WGPUTextureComponentSwizzle { + WGPUComponentSwizzle r; + WGPUComponentSwizzle g; + WGPUComponentSwizzle b; + WGPUComponentSwizzle a; +} WGPUTextureComponentSwizzle WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXTURE_COMPONENT_SWIZZLE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureComponentSwizzle, { \ + /*.r=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \ + /*.g=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \ + /*.b=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \ + /*.a=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \ +}) + +typedef struct WGPUVertexAttribute { + WGPUChainedStruct * nextInChain; + WGPUVertexFormat format; + uint64_t offset; + uint32_t shaderLocation; +} WGPUVertexAttribute WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_VERTEX_ATTRIBUTE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUVertexAttribute, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.format=*/_wgpu_ENUM_ZERO_INIT(WGPUVertexFormat) _wgpu_COMMA \ + /*.offset=*/0 _wgpu_COMMA \ + /*.shaderLocation=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUSamplerDescriptor +// Can be chained in WGPUTextureViewDescriptor +typedef struct WGPUYCbCrVkDescriptor { + WGPUChainedStruct chain; + uint32_t vkFormat; + uint32_t vkYCbCrModel; + uint32_t vkYCbCrRange; + uint32_t vkComponentSwizzleRed; + uint32_t vkComponentSwizzleGreen; + uint32_t vkComponentSwizzleBlue; + uint32_t vkComponentSwizzleAlpha; + uint32_t vkXChromaOffset; + uint32_t vkYChromaOffset; + WGPUFilterMode vkChromaFilter; + WGPUBool forceExplicitReconstruction; + uint64_t externalFormat; +} WGPUYCbCrVkDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_Y_CB_CR_VK_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUYCbCrVkDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_YCbCrVkDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.vkFormat=*/0 _wgpu_COMMA \ + /*.vkYCbCrModel=*/0 _wgpu_COMMA \ + /*.vkYCbCrRange=*/0 _wgpu_COMMA \ + /*.vkComponentSwizzleRed=*/0 _wgpu_COMMA \ + /*.vkComponentSwizzleGreen=*/0 _wgpu_COMMA \ + /*.vkComponentSwizzleBlue=*/0 _wgpu_COMMA \ + /*.vkComponentSwizzleAlpha=*/0 _wgpu_COMMA \ + /*.vkXChromaOffset=*/0 _wgpu_COMMA \ + /*.vkYChromaOffset=*/0 _wgpu_COMMA \ + /*.vkChromaFilter=*/WGPUFilterMode_Undefined _wgpu_COMMA \ + /*.forceExplicitReconstruction=*/WGPU_FALSE _wgpu_COMMA \ + /*.externalFormat=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPUAdapterInfo +typedef struct WGPUAdapterPropertiesMemoryHeaps { + WGPUChainedStruct chain; + size_t heapCount; + WGPUMemoryHeapInfo const * heapInfo; +} WGPUAdapterPropertiesMemoryHeaps WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_ADAPTER_PROPERTIES_MEMORY_HEAPS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterPropertiesMemoryHeaps, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_AdapterPropertiesMemoryHeaps _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.heapCount=*/0 _wgpu_COMMA \ + /*.heapInfo=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUAdapterInfo +typedef struct WGPUAdapterPropertiesSubgroupMatrixConfigs { + WGPUChainedStruct chain; + size_t configCount; + WGPUSubgroupMatrixConfig const * configs; +} WGPUAdapterPropertiesSubgroupMatrixConfigs WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_ADAPTER_PROPERTIES_SUBGROUP_MATRIX_CONFIGS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterPropertiesSubgroupMatrixConfigs, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_AdapterPropertiesSubgroupMatrixConfigs _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.configCount=*/0 _wgpu_COMMA \ + /*.configs=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUAHardwareBufferProperties { + WGPUYCbCrVkDescriptor yCbCrInfo; +} WGPUAHardwareBufferProperties WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_A_HARDWARE_BUFFER_PROPERTIES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAHardwareBufferProperties, { \ + /*.yCbCrInfo=*/WGPU_Y_CB_CR_VK_DESCRIPTOR_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUBindGroupEntry { + WGPUChainedStruct * nextInChain; + uint32_t binding; + WGPU_NULLABLE WGPUBuffer buffer; + uint64_t offset; + uint64_t size; + WGPU_NULLABLE WGPUSampler sampler; + WGPU_NULLABLE WGPUTextureView textureView; +} WGPUBindGroupEntry WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BIND_GROUP_ENTRY_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBindGroupEntry, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.binding=*/0 _wgpu_COMMA \ + /*.buffer=*/NULL _wgpu_COMMA \ + /*.offset=*/0 _wgpu_COMMA \ + /*.size=*/WGPU_WHOLE_SIZE _wgpu_COMMA \ + /*.sampler=*/NULL _wgpu_COMMA \ + /*.textureView=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUBindGroupLayoutEntry { + WGPUChainedStruct * nextInChain; + uint32_t binding; + WGPUShaderStage visibility; + uint32_t bindingArraySize; + WGPUBufferBindingLayout buffer; + WGPUSamplerBindingLayout sampler; + WGPUTextureBindingLayout texture; + WGPUStorageTextureBindingLayout storageTexture; +} WGPUBindGroupLayoutEntry WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BIND_GROUP_LAYOUT_ENTRY_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBindGroupLayoutEntry, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.binding=*/0 _wgpu_COMMA \ + /*.visibility=*/WGPUShaderStage_None _wgpu_COMMA \ + /*.bindingArraySize=*/0 _wgpu_COMMA \ + /*.buffer=*/_wgpu_STRUCT_ZERO_INIT _wgpu_COMMA \ + /*.sampler=*/_wgpu_STRUCT_ZERO_INIT _wgpu_COMMA \ + /*.texture=*/_wgpu_STRUCT_ZERO_INIT _wgpu_COMMA \ + /*.storageTexture=*/_wgpu_STRUCT_ZERO_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUBlendState { + WGPUBlendComponent color; + WGPUBlendComponent alpha; +} WGPUBlendState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BLEND_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBlendState, { \ + /*.color=*/WGPU_BLEND_COMPONENT_INIT _wgpu_COMMA \ + /*.alpha=*/WGPU_BLEND_COMPONENT_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUBufferDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPUBufferUsage usage; + uint64_t size; + WGPUBool mappedAtCreation; +} WGPUBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BUFFER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBufferDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.usage=*/WGPUBufferUsage_None _wgpu_COMMA \ + /*.size=*/0 _wgpu_COMMA \ + /*.mappedAtCreation=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPUCommandEncoderDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; +} WGPUCommandEncoderDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COMMAND_ENCODER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCommandEncoderDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUCompilationMessage { + WGPUChainedStruct * nextInChain; + WGPUStringView message; + WGPUCompilationMessageType type; + uint64_t lineNum; + uint64_t linePos; + uint64_t offset; + uint64_t length; +} WGPUCompilationMessage WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COMPILATION_MESSAGE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCompilationMessage, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.message=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.type=*/_wgpu_ENUM_ZERO_INIT(WGPUCompilationMessageType) _wgpu_COMMA \ + /*.lineNum=*/0 _wgpu_COMMA \ + /*.linePos=*/0 _wgpu_COMMA \ + /*.offset=*/0 _wgpu_COMMA \ + /*.length=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUComputePassDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPU_NULLABLE WGPUPassTimestampWrites const * timestampWrites; +} WGPUComputePassDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COMPUTE_PASS_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUComputePassDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.timestampWrites=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUComputeState { + WGPUChainedStruct * nextInChain; + WGPUShaderModule module; + WGPUStringView entryPoint; + size_t constantCount; + WGPUConstantEntry const * constants; +} WGPUComputeState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COMPUTE_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUComputeState, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.module=*/NULL _wgpu_COMMA \ + /*.entryPoint=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.constantCount=*/0 _wgpu_COMMA \ + /*.constants=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUDawnFormatCapabilities +typedef struct WGPUDawnDrmFormatCapabilities { + WGPUChainedStruct chain; + size_t propertiesCount; + WGPUDawnDrmFormatProperties const * properties; +} WGPUDawnDrmFormatCapabilities WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_DRM_FORMAT_CAPABILITIES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnDrmFormatCapabilities, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_DawnDrmFormatCapabilities _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.propertiesCount=*/0 _wgpu_COMMA \ + /*.properties=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUDepthStencilState { + WGPUChainedStruct * nextInChain; + WGPUTextureFormat format; + WGPUOptionalBool depthWriteEnabled; + WGPUCompareFunction depthCompare; + WGPUStencilFaceState stencilFront; + WGPUStencilFaceState stencilBack; + uint32_t stencilReadMask; + uint32_t stencilWriteMask; + int32_t depthBias; + float depthBiasSlopeScale; + float depthBiasClamp; +} WGPUDepthStencilState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DEPTH_STENCIL_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDepthStencilState, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ + /*.depthWriteEnabled=*/WGPUOptionalBool_Undefined _wgpu_COMMA \ + /*.depthCompare=*/WGPUCompareFunction_Undefined _wgpu_COMMA \ + /*.stencilFront=*/WGPU_STENCIL_FACE_STATE_INIT _wgpu_COMMA \ + /*.stencilBack=*/WGPU_STENCIL_FACE_STATE_INIT _wgpu_COMMA \ + /*.stencilReadMask=*/0xFFFFFFFF _wgpu_COMMA \ + /*.stencilWriteMask=*/0xFFFFFFFF _wgpu_COMMA \ + /*.depthBias=*/0 _wgpu_COMMA \ + /*.depthBiasSlopeScale=*/0.f _wgpu_COMMA \ + /*.depthBiasClamp=*/0.f _wgpu_COMMA \ +}) + +typedef struct WGPUExternalTextureDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPUTextureView plane0; + WGPU_NULLABLE WGPUTextureView plane1; + WGPUOrigin2D cropOrigin; + WGPUExtent2D cropSize; + WGPUExtent2D apparentSize; + WGPUBool doYuvToRgbConversionOnly; + WGPU_NULLABLE float const * yuvToRgbConversionMatrix; + float const * srcTransferFunctionParameters; + float const * dstTransferFunctionParameters; + float const * gamutConversionMatrix; + WGPUBool mirrored; + WGPUExternalTextureRotation rotation; +} WGPUExternalTextureDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_EXTERNAL_TEXTURE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUExternalTextureDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.plane0=*/NULL _wgpu_COMMA \ + /*.plane1=*/NULL _wgpu_COMMA \ + /*.cropOrigin=*/WGPU_ORIGIN_2D_INIT _wgpu_COMMA \ + /*.cropSize=*/WGPU_EXTENT_2D_INIT _wgpu_COMMA \ + /*.apparentSize=*/WGPU_EXTENT_2D_INIT _wgpu_COMMA \ + /*.doYuvToRgbConversionOnly=*/WGPU_FALSE _wgpu_COMMA \ + /*.yuvToRgbConversionMatrix=*/NULL _wgpu_COMMA \ + /*.srcTransferFunctionParameters=*/NULL _wgpu_COMMA \ + /*.dstTransferFunctionParameters=*/NULL _wgpu_COMMA \ + /*.gamutConversionMatrix=*/NULL _wgpu_COMMA \ + /*.mirrored=*/WGPU_FALSE _wgpu_COMMA \ + /*.rotation=*/WGPUExternalTextureRotation_Rotate0Degrees _wgpu_COMMA \ +}) + +typedef struct WGPUFutureWaitInfo { + WGPUFuture future; + WGPUBool completed; +} WGPUFutureWaitInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_FUTURE_WAIT_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUFutureWaitInfo, { \ + /*.future=*/WGPU_FUTURE_INIT _wgpu_COMMA \ + /*.completed=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPUImageCopyExternalTexture { + WGPUChainedStruct * nextInChain; + WGPUExternalTexture externalTexture; + WGPUOrigin3D origin; + WGPUExtent2D naturalSize; +} WGPUImageCopyExternalTexture WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_IMAGE_COPY_EXTERNAL_TEXTURE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUImageCopyExternalTexture, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.externalTexture=*/NULL _wgpu_COMMA \ + /*.origin=*/WGPU_ORIGIN_3D_INIT _wgpu_COMMA \ + /*.naturalSize=*/WGPU_EXTENT_2D_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUInstanceDescriptor { + WGPUChainedStruct * nextInChain; + size_t requiredFeatureCount; + WGPUInstanceFeatureName const * requiredFeatures; + WGPU_NULLABLE WGPUInstanceLimits const * requiredLimits; +} WGPUInstanceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_INSTANCE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUInstanceDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.requiredFeatureCount=*/0 _wgpu_COMMA \ + /*.requiredFeatures=*/NULL _wgpu_COMMA \ + /*.requiredLimits=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPULimits { + WGPUChainedStruct * nextInChain; + uint32_t maxTextureDimension1D; + uint32_t maxTextureDimension2D; + uint32_t maxTextureDimension3D; + uint32_t maxTextureArrayLayers; + uint32_t maxBindGroups; + uint32_t maxBindGroupsPlusVertexBuffers; + uint32_t maxBindingsPerBindGroup; + uint32_t maxDynamicUniformBuffersPerPipelineLayout; + uint32_t maxDynamicStorageBuffersPerPipelineLayout; + uint32_t maxSampledTexturesPerShaderStage; + uint32_t maxSamplersPerShaderStage; + uint32_t maxStorageBuffersPerShaderStage; + uint32_t maxStorageTexturesPerShaderStage; + uint32_t maxUniformBuffersPerShaderStage; + uint64_t maxUniformBufferBindingSize; + uint64_t maxStorageBufferBindingSize; + uint32_t minUniformBufferOffsetAlignment; + uint32_t minStorageBufferOffsetAlignment; + uint32_t maxVertexBuffers; + uint64_t maxBufferSize; + uint32_t maxVertexAttributes; + uint32_t maxVertexBufferArrayStride; + uint32_t maxInterStageShaderVariables; + uint32_t maxColorAttachments; + uint32_t maxColorAttachmentBytesPerSample; + uint32_t maxComputeWorkgroupStorageSize; + uint32_t maxComputeInvocationsPerWorkgroup; + uint32_t maxComputeWorkgroupSizeX; + uint32_t maxComputeWorkgroupSizeY; + uint32_t maxComputeWorkgroupSizeZ; + uint32_t maxComputeWorkgroupsPerDimension; + uint32_t maxImmediateSize; +} WGPULimits WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_LIMITS_INIT _wgpu_MAKE_INIT_STRUCT(WGPULimits, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.maxTextureDimension1D=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxTextureDimension2D=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxTextureDimension3D=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxTextureArrayLayers=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxBindGroups=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxBindGroupsPlusVertexBuffers=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxBindingsPerBindGroup=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxDynamicUniformBuffersPerPipelineLayout=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxDynamicStorageBuffersPerPipelineLayout=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxSampledTexturesPerShaderStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxSamplersPerShaderStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxStorageBuffersPerShaderStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxStorageTexturesPerShaderStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxUniformBuffersPerShaderStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxUniformBufferBindingSize=*/WGPU_LIMIT_U64_UNDEFINED _wgpu_COMMA \ + /*.maxStorageBufferBindingSize=*/WGPU_LIMIT_U64_UNDEFINED _wgpu_COMMA \ + /*.minUniformBufferOffsetAlignment=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.minStorageBufferOffsetAlignment=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxVertexBuffers=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxBufferSize=*/WGPU_LIMIT_U64_UNDEFINED _wgpu_COMMA \ + /*.maxVertexAttributes=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxVertexBufferArrayStride=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxInterStageShaderVariables=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxColorAttachments=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxColorAttachmentBytesPerSample=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxComputeWorkgroupStorageSize=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxComputeInvocationsPerWorkgroup=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxComputeWorkgroupSizeX=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxComputeWorkgroupSizeY=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxComputeWorkgroupSizeZ=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxComputeWorkgroupsPerDimension=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ + /*.maxImmediateSize=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \ +}) + +// Can be chained in WGPUPipelineLayoutDescriptor +typedef struct WGPUPipelineLayoutPixelLocalStorage { + WGPUChainedStruct chain; + uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount; + WGPUPipelineLayoutStorageAttachment const * storageAttachments; +} WGPUPipelineLayoutPixelLocalStorage WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_PIPELINE_LAYOUT_PIXEL_LOCAL_STORAGE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPipelineLayoutPixelLocalStorage, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_PipelineLayoutPixelLocalStorage _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.totalPixelLocalStorageSize=*/0 _wgpu_COMMA \ + /*.storageAttachmentCount=*/0 _wgpu_COMMA \ + /*.storageAttachments=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPURenderBundleEncoderDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + size_t colorFormatCount; + WGPUTextureFormat const * colorFormats; + WGPUTextureFormat depthStencilFormat; + uint32_t sampleCount; + WGPUBool depthReadOnly; + WGPUBool stencilReadOnly; +} WGPURenderBundleEncoderDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_BUNDLE_ENCODER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderBundleEncoderDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.colorFormatCount=*/0 _wgpu_COMMA \ + /*.colorFormats=*/NULL _wgpu_COMMA \ + /*.depthStencilFormat=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ + /*.sampleCount=*/1 _wgpu_COMMA \ + /*.depthReadOnly=*/WGPU_FALSE _wgpu_COMMA \ + /*.stencilReadOnly=*/WGPU_FALSE _wgpu_COMMA \ +}) + +typedef struct WGPURenderPassColorAttachment { + WGPUChainedStruct * nextInChain; + WGPU_NULLABLE WGPUTextureView view; + uint32_t depthSlice; + WGPU_NULLABLE WGPUTextureView resolveTarget; + WGPULoadOp loadOp; + WGPUStoreOp storeOp; + WGPUColor clearValue; +} WGPURenderPassColorAttachment WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_PASS_COLOR_ATTACHMENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassColorAttachment, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.view=*/NULL _wgpu_COMMA \ + /*.depthSlice=*/WGPU_DEPTH_SLICE_UNDEFINED _wgpu_COMMA \ + /*.resolveTarget=*/NULL _wgpu_COMMA \ + /*.loadOp=*/WGPULoadOp_Undefined _wgpu_COMMA \ + /*.storeOp=*/WGPUStoreOp_Undefined _wgpu_COMMA \ + /*.clearValue=*/WGPU_COLOR_INIT _wgpu_COMMA \ +}) + +// Can be chained in WGPURenderPassDescriptor +typedef struct WGPURenderPassRenderAreaRect { + WGPUChainedStruct chain; + WGPUOrigin2D origin; + WGPUExtent2D size; +} WGPURenderPassRenderAreaRect WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_PASS_RENDER_AREA_RECT_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassRenderAreaRect, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_RenderPassRenderAreaRect _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.origin=*/WGPU_ORIGIN_2D_INIT _wgpu_COMMA \ + /*.size=*/WGPU_EXTENT_2D_INIT _wgpu_COMMA \ +}) + +typedef struct WGPURenderPassStorageAttachment { + WGPUChainedStruct * nextInChain; + uint64_t offset; + WGPUTextureView storage; + WGPULoadOp loadOp; + WGPUStoreOp storeOp; + WGPUColor clearValue; +} WGPURenderPassStorageAttachment WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_PASS_STORAGE_ATTACHMENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassStorageAttachment, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.offset=*/0 _wgpu_COMMA \ + /*.storage=*/NULL _wgpu_COMMA \ + /*.loadOp=*/WGPULoadOp_Undefined _wgpu_COMMA \ + /*.storeOp=*/WGPUStoreOp_Undefined _wgpu_COMMA \ + /*.clearValue=*/WGPU_COLOR_INIT _wgpu_COMMA \ +}) + +typedef struct WGPURequestAdapterOptions { + WGPUChainedStruct * nextInChain; + WGPUFeatureLevel featureLevel; + WGPUPowerPreference powerPreference; + WGPUBool forceFallbackAdapter; + WGPUBackendType backendType; + WGPU_NULLABLE WGPUSurface compatibleSurface; +} WGPURequestAdapterOptions WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_REQUEST_ADAPTER_OPTIONS_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestAdapterOptions, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.featureLevel=*/WGPUFeatureLevel_Undefined _wgpu_COMMA \ + /*.powerPreference=*/WGPUPowerPreference_Undefined _wgpu_COMMA \ + /*.forceFallbackAdapter=*/WGPU_FALSE _wgpu_COMMA \ + /*.backendType=*/WGPUBackendType_Undefined _wgpu_COMMA \ + /*.compatibleSurface=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUSamplerDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPUAddressMode addressModeU; + WGPUAddressMode addressModeV; + WGPUAddressMode addressModeW; + WGPUFilterMode magFilter; + WGPUFilterMode minFilter; + WGPUMipmapFilterMode mipmapFilter; + float lodMinClamp; + float lodMaxClamp; + WGPUCompareFunction compare; + uint16_t maxAnisotropy; +} WGPUSamplerDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SAMPLER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSamplerDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.addressModeU=*/WGPUAddressMode_Undefined _wgpu_COMMA \ + /*.addressModeV=*/WGPUAddressMode_Undefined _wgpu_COMMA \ + /*.addressModeW=*/WGPUAddressMode_Undefined _wgpu_COMMA \ + /*.magFilter=*/WGPUFilterMode_Undefined _wgpu_COMMA \ + /*.minFilter=*/WGPUFilterMode_Undefined _wgpu_COMMA \ + /*.mipmapFilter=*/WGPUMipmapFilterMode_Undefined _wgpu_COMMA \ + /*.lodMinClamp=*/0.f _wgpu_COMMA \ + /*.lodMaxClamp=*/32.f _wgpu_COMMA \ + /*.compare=*/WGPUCompareFunction_Undefined _wgpu_COMMA \ + /*.maxAnisotropy=*/1 _wgpu_COMMA \ +}) + +typedef struct WGPUShaderModuleDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; +} WGPUShaderModuleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHADER_MODULE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUShaderModuleDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUSharedBufferMemoryDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; +} WGPUSharedBufferMemoryDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_BUFFER_MEMORY_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedBufferMemoryDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUSharedFenceDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; +} WGPUSharedFenceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUSharedFenceExportInfo { + WGPUChainedStruct * nextInChain; + WGPUSharedFenceType type; +} WGPUSharedFenceExportInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_FENCE_EXPORT_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedFenceExportInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.type=*/_wgpu_ENUM_ZERO_INIT(WGPUSharedFenceType) _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryProperties +typedef struct WGPUSharedTextureMemoryAHardwareBufferProperties { + WGPUChainedStruct chain; + WGPUYCbCrVkDescriptor yCbCrInfo; +} WGPUSharedTextureMemoryAHardwareBufferProperties WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_A_HARDWARE_BUFFER_PROPERTIES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryAHardwareBufferProperties, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryAHardwareBufferProperties _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.yCbCrInfo=*/WGPU_Y_CB_CR_VK_DESCRIPTOR_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUSharedTextureMemoryBeginAccessDescriptor { + WGPUChainedStruct * nextInChain; + WGPUBool concurrentRead; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const * fences; + size_t signaledValueCount; + uint64_t const * signaledValues; +} WGPUSharedTextureMemoryBeginAccessDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_BEGIN_ACCESS_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryBeginAccessDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.concurrentRead=*/WGPU_FALSE _wgpu_COMMA \ + /*.initialized=*/WGPU_FALSE _wgpu_COMMA \ + /*.fenceCount=*/0 _wgpu_COMMA \ + /*.fences=*/NULL _wgpu_COMMA \ + /*.signaledValueCount=*/0 _wgpu_COMMA \ + /*.signaledValues=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryDescriptor +typedef struct WGPUSharedTextureMemoryDmaBufDescriptor { + WGPUChainedStruct chain; + WGPUExtent3D size; + uint32_t drmFormat; + uint64_t drmModifier; + size_t planeCount; + WGPUSharedTextureMemoryDmaBufPlane const * planes; +} WGPUSharedTextureMemoryDmaBufDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_DMA_BUF_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryDmaBufDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryDmaBufDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.size=*/WGPU_EXTENT_3D_INIT _wgpu_COMMA \ + /*.drmFormat=*/0 _wgpu_COMMA \ + /*.drmModifier=*/0 _wgpu_COMMA \ + /*.planeCount=*/0 _wgpu_COMMA \ + /*.planes=*/NULL _wgpu_COMMA \ +}) + +// Can be chained in WGPUSharedTextureMemoryEndAccessState +typedef struct WGPUSharedTextureMemoryMetalEndAccessState { + WGPUChainedStruct chain; + WGPUFuture commandsScheduledFuture; +} WGPUSharedTextureMemoryMetalEndAccessState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_METAL_END_ACCESS_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryMetalEndAccessState, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_SharedTextureMemoryMetalEndAccessState _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.commandsScheduledFuture=*/WGPU_FUTURE_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUSurfaceDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; +} WGPUSurfaceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SURFACE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUTexelCopyBufferInfo { + WGPUTexelCopyBufferLayout layout; + WGPUBuffer buffer; +} WGPUTexelCopyBufferInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXEL_COPY_BUFFER_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTexelCopyBufferInfo, { \ + /*.layout=*/WGPU_TEXEL_COPY_BUFFER_LAYOUT_INIT _wgpu_COMMA \ + /*.buffer=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUTexelCopyTextureInfo { + WGPUTexture texture; + uint32_t mipLevel; + WGPUOrigin3D origin; + WGPUTextureAspect aspect; +} WGPUTexelCopyTextureInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXEL_COPY_TEXTURE_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTexelCopyTextureInfo, { \ + /*.texture=*/NULL _wgpu_COMMA \ + /*.mipLevel=*/0 _wgpu_COMMA \ + /*.origin=*/WGPU_ORIGIN_3D_INIT _wgpu_COMMA \ + /*.aspect=*/WGPUTextureAspect_Undefined _wgpu_COMMA \ +}) + +// Can be chained in WGPUTextureViewDescriptor +typedef struct WGPUTextureComponentSwizzleDescriptor { + WGPUChainedStruct chain; + WGPUTextureComponentSwizzle swizzle; +} WGPUTextureComponentSwizzleDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXTURE_COMPONENT_SWIZZLE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureComponentSwizzleDescriptor, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_TextureComponentSwizzleDescriptor _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.swizzle=*/WGPU_TEXTURE_COMPONENT_SWIZZLE_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUTextureDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPUTextureUsage usage; + WGPUTextureDimension dimension; + WGPUExtent3D size; + WGPUTextureFormat format; + uint32_t mipLevelCount; + uint32_t sampleCount; + size_t viewFormatCount; + WGPUTextureFormat const * viewFormats; +} WGPUTextureDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXTURE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.usage=*/WGPUTextureUsage_None _wgpu_COMMA \ + /*.dimension=*/WGPUTextureDimension_Undefined _wgpu_COMMA \ + /*.size=*/WGPU_EXTENT_3D_INIT _wgpu_COMMA \ + /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ + /*.mipLevelCount=*/1 _wgpu_COMMA \ + /*.sampleCount=*/1 _wgpu_COMMA \ + /*.viewFormatCount=*/0 _wgpu_COMMA \ + /*.viewFormats=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUVertexBufferLayout { + WGPUChainedStruct * nextInChain; + WGPUVertexStepMode stepMode; + uint64_t arrayStride; + size_t attributeCount; + WGPUVertexAttribute const * attributes; +} WGPUVertexBufferLayout WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_VERTEX_BUFFER_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUVertexBufferLayout, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.stepMode=*/WGPUVertexStepMode_Undefined _wgpu_COMMA \ + /*.arrayStride=*/0 _wgpu_COMMA \ + /*.attributeCount=*/0 _wgpu_COMMA \ + /*.attributes=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUAdapterInfo { + WGPUChainedStruct * nextInChain; + WGPUStringView vendor; + WGPUStringView architecture; + WGPUStringView device; + WGPUStringView description; + WGPUBackendType backendType; + WGPUAdapterType adapterType; + uint32_t vendorID; + uint32_t deviceID; + uint32_t subgroupMinSize; + uint32_t subgroupMaxSize; +} WGPUAdapterInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_ADAPTER_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.vendor=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.architecture=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.device=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.description=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.backendType=*/WGPUBackendType_Undefined _wgpu_COMMA \ + /*.adapterType=*/_wgpu_ENUM_ZERO_INIT(WGPUAdapterType) _wgpu_COMMA \ + /*.vendorID=*/0 _wgpu_COMMA \ + /*.deviceID=*/0 _wgpu_COMMA \ + /*.subgroupMinSize=*/0 _wgpu_COMMA \ + /*.subgroupMaxSize=*/0 _wgpu_COMMA \ +}) + +typedef struct WGPUBindGroupDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPUBindGroupLayout layout; + size_t entryCount; + WGPUBindGroupEntry const * entries; +} WGPUBindGroupDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BIND_GROUP_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBindGroupDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.layout=*/NULL _wgpu_COMMA \ + /*.entryCount=*/0 _wgpu_COMMA \ + /*.entries=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUBindGroupLayoutDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + size_t entryCount; + WGPUBindGroupLayoutEntry const * entries; +} WGPUBindGroupLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_BIND_GROUP_LAYOUT_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBindGroupLayoutDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.entryCount=*/0 _wgpu_COMMA \ + /*.entries=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUColorTargetState { + WGPUChainedStruct * nextInChain; + WGPUTextureFormat format; + WGPU_NULLABLE WGPUBlendState const * blend; + WGPUColorWriteMask writeMask; +} WGPUColorTargetState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COLOR_TARGET_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUColorTargetState, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ + /*.blend=*/NULL _wgpu_COMMA \ + /*.writeMask=*/WGPUColorWriteMask_All _wgpu_COMMA \ +}) + +typedef struct WGPUCompilationInfo { + WGPUChainedStruct * nextInChain; + size_t messageCount; + WGPUCompilationMessage const * messages; +} WGPUCompilationInfo WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COMPILATION_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCompilationInfo, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.messageCount=*/0 _wgpu_COMMA \ + /*.messages=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUComputePipelineDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPU_NULLABLE WGPUPipelineLayout layout; + WGPUComputeState compute; +} WGPUComputePipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_COMPUTE_PIPELINE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUComputePipelineDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.layout=*/NULL _wgpu_COMMA \ + /*.compute=*/WGPU_COMPUTE_STATE_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUDawnFormatCapabilities { + WGPUChainedStruct * nextInChain; +} WGPUDawnFormatCapabilities WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DAWN_FORMAT_CAPABILITIES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnFormatCapabilities, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUDeviceDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + size_t requiredFeatureCount; + WGPUFeatureName const * requiredFeatures; + WGPU_NULLABLE WGPULimits const * requiredLimits; + WGPUQueueDescriptor defaultQueue; + WGPUDeviceLostCallbackInfo deviceLostCallbackInfo; + WGPUUncapturedErrorCallbackInfo uncapturedErrorCallbackInfo; +} WGPUDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_DEVICE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDeviceDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.requiredFeatureCount=*/0 _wgpu_COMMA \ + /*.requiredFeatures=*/NULL _wgpu_COMMA \ + /*.requiredLimits=*/NULL _wgpu_COMMA \ + /*.defaultQueue=*/WGPU_QUEUE_DESCRIPTOR_INIT _wgpu_COMMA \ + /*.deviceLostCallbackInfo=*/WGPU_DEVICE_LOST_CALLBACK_INFO_INIT _wgpu_COMMA \ + /*.uncapturedErrorCallbackInfo=*/WGPU_UNCAPTURED_ERROR_CALLBACK_INFO_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUPipelineLayoutDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + size_t bindGroupLayoutCount; + WGPUBindGroupLayout const * bindGroupLayouts; + uint32_t immediateSize; +} WGPUPipelineLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_PIPELINE_LAYOUT_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPipelineLayoutDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.bindGroupLayoutCount=*/0 _wgpu_COMMA \ + /*.bindGroupLayouts=*/NULL _wgpu_COMMA \ + /*.immediateSize=*/0 _wgpu_COMMA \ +}) + +// Can be chained in WGPURenderPassDescriptor +typedef struct WGPURenderPassPixelLocalStorage { + WGPUChainedStruct chain; + uint64_t totalPixelLocalStorageSize; + size_t storageAttachmentCount; + WGPURenderPassStorageAttachment const * storageAttachments; +} WGPURenderPassPixelLocalStorage WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_PASS_PIXEL_LOCAL_STORAGE_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassPixelLocalStorage, { \ + /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \ + /*.next=*/NULL _wgpu_COMMA \ + /*.sType=*/WGPUSType_RenderPassPixelLocalStorage _wgpu_COMMA \ + }) _wgpu_COMMA \ + /*.totalPixelLocalStorageSize=*/0 _wgpu_COMMA \ + /*.storageAttachmentCount=*/0 _wgpu_COMMA \ + /*.storageAttachments=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUSharedTextureMemoryDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; +} WGPUSharedTextureMemoryDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ +}) + +typedef struct WGPUSharedTextureMemoryEndAccessState { + WGPUChainedStruct * nextInChain; + WGPUBool initialized; + size_t fenceCount; + WGPUSharedFence const * fences; + size_t signaledValueCount; + uint64_t const * signaledValues; +} WGPUSharedTextureMemoryEndAccessState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_END_ACCESS_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryEndAccessState, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.initialized=*/WGPU_FALSE _wgpu_COMMA \ + /*.fenceCount=*/0 _wgpu_COMMA \ + /*.fences=*/NULL _wgpu_COMMA \ + /*.signaledValueCount=*/0 _wgpu_COMMA \ + /*.signaledValues=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUSharedTextureMemoryProperties { + WGPUChainedStruct * nextInChain; + WGPUTextureUsage usage; + WGPUExtent3D size; + WGPUTextureFormat format; +} WGPUSharedTextureMemoryProperties WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_SHARED_TEXTURE_MEMORY_PROPERTIES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSharedTextureMemoryProperties, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.usage=*/WGPUTextureUsage_None _wgpu_COMMA \ + /*.size=*/WGPU_EXTENT_3D_INIT _wgpu_COMMA \ + /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ +}) + +typedef struct WGPUTextureViewDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPUTextureFormat format; + WGPUTextureViewDimension dimension; + uint32_t baseMipLevel; + uint32_t mipLevelCount; + uint32_t baseArrayLayer; + uint32_t arrayLayerCount; + WGPUTextureAspect aspect; + WGPUTextureUsage usage; +} WGPUTextureViewDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_TEXTURE_VIEW_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureViewDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \ + /*.dimension=*/WGPUTextureViewDimension_Undefined _wgpu_COMMA \ + /*.baseMipLevel=*/0 _wgpu_COMMA \ + /*.mipLevelCount=*/WGPU_MIP_LEVEL_COUNT_UNDEFINED _wgpu_COMMA \ + /*.baseArrayLayer=*/0 _wgpu_COMMA \ + /*.arrayLayerCount=*/WGPU_ARRAY_LAYER_COUNT_UNDEFINED _wgpu_COMMA \ + /*.aspect=*/WGPUTextureAspect_Undefined _wgpu_COMMA \ + /*.usage=*/WGPUTextureUsage_None _wgpu_COMMA \ +}) + +typedef struct WGPUVertexState { + WGPUChainedStruct * nextInChain; + WGPUShaderModule module; + WGPUStringView entryPoint; + size_t constantCount; + WGPUConstantEntry const * constants; + size_t bufferCount; + WGPUVertexBufferLayout const * buffers; +} WGPUVertexState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_VERTEX_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUVertexState, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.module=*/NULL _wgpu_COMMA \ + /*.entryPoint=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.constantCount=*/0 _wgpu_COMMA \ + /*.constants=*/NULL _wgpu_COMMA \ + /*.bufferCount=*/0 _wgpu_COMMA \ + /*.buffers=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPUFragmentState { + WGPUChainedStruct * nextInChain; + WGPUShaderModule module; + WGPUStringView entryPoint; + size_t constantCount; + WGPUConstantEntry const * constants; + size_t targetCount; + WGPUColorTargetState const * targets; +} WGPUFragmentState WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_FRAGMENT_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUFragmentState, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.module=*/NULL _wgpu_COMMA \ + /*.entryPoint=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.constantCount=*/0 _wgpu_COMMA \ + /*.constants=*/NULL _wgpu_COMMA \ + /*.targetCount=*/0 _wgpu_COMMA \ + /*.targets=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPURenderPassDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + size_t colorAttachmentCount; + WGPURenderPassColorAttachment const * colorAttachments; + WGPU_NULLABLE WGPURenderPassDepthStencilAttachment const * depthStencilAttachment; + WGPU_NULLABLE WGPUQuerySet occlusionQuerySet; + WGPU_NULLABLE WGPUPassTimestampWrites const * timestampWrites; +} WGPURenderPassDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_PASS_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.colorAttachmentCount=*/0 _wgpu_COMMA \ + /*.colorAttachments=*/NULL _wgpu_COMMA \ + /*.depthStencilAttachment=*/NULL _wgpu_COMMA \ + /*.occlusionQuerySet=*/NULL _wgpu_COMMA \ + /*.timestampWrites=*/NULL _wgpu_COMMA \ +}) + +typedef struct WGPURenderPipelineDescriptor { + WGPUChainedStruct * nextInChain; + WGPUStringView label; + WGPU_NULLABLE WGPUPipelineLayout layout; + WGPUVertexState vertex; + WGPUPrimitiveState primitive; + WGPU_NULLABLE WGPUDepthStencilState const * depthStencil; + WGPUMultisampleState multisample; + WGPU_NULLABLE WGPUFragmentState const * fragment; +} WGPURenderPipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE; + +#define WGPU_RENDER_PIPELINE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPipelineDescriptor, { \ + /*.nextInChain=*/NULL _wgpu_COMMA \ + /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \ + /*.layout=*/NULL _wgpu_COMMA \ + /*.vertex=*/WGPU_VERTEX_STATE_INIT _wgpu_COMMA \ + /*.primitive=*/WGPU_PRIMITIVE_STATE_INIT _wgpu_COMMA \ + /*.depthStencil=*/NULL _wgpu_COMMA \ + /*.multisample=*/WGPU_MULTISAMPLE_STATE_INIT _wgpu_COMMA \ + /*.fragment=*/NULL _wgpu_COMMA \ +}) + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(WGPU_SKIP_PROCS) +// TODO(374150686): Remove these Emscripten specific declarations from the +// header once they are fully deprecated. +WGPU_EXPORT WGPUDevice emscripten_webgpu_get_device(void); +// Global procs +typedef WGPUInstance (*WGPUProcCreateInstance)(WGPU_NULLABLE WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcGetInstanceFeatures)(WGPUSupportedInstanceFeatures * features) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcGetInstanceLimits)(WGPUInstanceLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcHasInstanceFeature)(WGPUInstanceFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUStringView procName) WGPU_FUNCTION_ATTRIBUTE; + + +// Procs of Adapter +typedef WGPUDevice (*WGPUProcAdapterCreateDevice)(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcAdapterGetFeatures)(WGPUAdapter adapter, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcAdapterGetFormatCapabilities)(WGPUAdapter adapter, WGPUTextureFormat format, WGPUDawnFormatCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcAdapterGetInfo)(WGPUAdapter adapter, WGPUAdapterInfo * info) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUInstance (*WGPUProcAdapterGetInstance)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcAdapterGetLimits)(WGPUAdapter adapter, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcAdapterHasFeature)(WGPUAdapter adapter, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcAdapterRequestDevice)(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcAdapterAddRef)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcAdapterRelease)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of AdapterInfo +typedef void (*WGPUProcAdapterInfoFreeMembers)(WGPUAdapterInfo adapterInfo) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of AdapterPropertiesMemoryHeaps +typedef void (*WGPUProcAdapterPropertiesMemoryHeapsFreeMembers)(WGPUAdapterPropertiesMemoryHeaps adapterPropertiesMemoryHeaps) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of AdapterPropertiesSubgroupMatrixConfigs +typedef void (*WGPUProcAdapterPropertiesSubgroupMatrixConfigsFreeMembers)(WGPUAdapterPropertiesSubgroupMatrixConfigs adapterPropertiesSubgroupMatrixConfigs) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of BindGroup +typedef void (*WGPUProcBindGroupSetLabel)(WGPUBindGroup bindGroup, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcBindGroupAddRef)(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcBindGroupRelease)(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of BindGroupLayout +typedef void (*WGPUProcBindGroupLayoutSetLabel)(WGPUBindGroupLayout bindGroupLayout, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcBindGroupLayoutAddRef)(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcBindGroupLayoutRelease)(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Buffer +typedef WGPUTexelBufferView (*WGPUProcBufferCreateTexelView)(WGPUBuffer buffer, WGPUTexelBufferViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcBufferDestroy)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +typedef void const * (*WGPUProcBufferGetConstMappedRange)(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void * (*WGPUProcBufferGetMappedRange)(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBufferMapState (*WGPUProcBufferGetMapState)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +typedef uint64_t (*WGPUProcBufferGetSize)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBufferUsage (*WGPUProcBufferGetUsage)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcBufferMapAsync)(WGPUBuffer buffer, WGPUMapMode mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcBufferReadMappedRange)(WGPUBuffer buffer, size_t offset, void * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcBufferSetLabel)(WGPUBuffer buffer, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcBufferUnmap)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcBufferWriteMappedRange)(WGPUBuffer buffer, size_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcBufferAddRef)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcBufferRelease)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of CommandBuffer +typedef void (*WGPUProcCommandBufferSetLabel)(WGPUCommandBuffer commandBuffer, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandBufferAddRef)(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandBufferRelease)(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of CommandEncoder +typedef WGPUComputePassEncoder (*WGPUProcCommandEncoderBeginComputePass)(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUComputePassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPURenderPassEncoder (*WGPUProcCommandEncoderBeginRenderPass)(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderClearBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderCopyBufferToBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderCopyBufferToTexture)(WGPUCommandEncoder commandEncoder, WGPUTexelCopyBufferInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderCopyTextureToBuffer)(WGPUCommandEncoder commandEncoder, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyBufferInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderCopyTextureToTexture)(WGPUCommandEncoder commandEncoder, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUCommandBuffer (*WGPUProcCommandEncoderFinish)(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUCommandBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderInjectValidationError)(WGPUCommandEncoder commandEncoder, WGPUStringView message) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderInsertDebugMarker)(WGPUCommandEncoder commandEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderPopDebugGroup)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderPushDebugGroup)(WGPUCommandEncoder commandEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderResolveQuerySet)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderSetLabel)(WGPUCommandEncoder commandEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderWriteBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderWriteTimestamp)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderAddRef)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcCommandEncoderRelease)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of ComputePassEncoder +typedef void (*WGPUProcComputePassEncoderDispatchWorkgroups)(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderDispatchWorkgroupsIndirect)(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderEnd)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderInsertDebugMarker)(WGPUComputePassEncoder computePassEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderPopDebugGroup)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderPushDebugGroup)(WGPUComputePassEncoder computePassEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderSetBindGroup)(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderSetImmediates)(WGPUComputePassEncoder computePassEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderSetLabel)(WGPUComputePassEncoder computePassEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderSetPipeline)(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderSetResourceTable)(WGPUComputePassEncoder computePassEncoder, WGPU_NULLABLE WGPUResourceTable table) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderWriteTimestamp)(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderAddRef)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePassEncoderRelease)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of ComputePipeline +typedef WGPUBindGroupLayout (*WGPUProcComputePipelineGetBindGroupLayout)(WGPUComputePipeline computePipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePipelineSetLabel)(WGPUComputePipeline computePipeline, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePipelineAddRef)(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcComputePipelineRelease)(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of DawnDrmFormatCapabilities +typedef void (*WGPUProcDawnDrmFormatCapabilitiesFreeMembers)(WGPUDawnDrmFormatCapabilities dawnDrmFormatCapabilities) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Device +typedef WGPUBindGroup (*WGPUProcDeviceCreateBindGroup)(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBindGroupLayout (*WGPUProcDeviceCreateBindGroupLayout)(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPU_NULLABLE WGPUBuffer (*WGPUProcDeviceCreateBuffer)(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUCommandEncoder (*WGPUProcDeviceCreateCommandEncoder)(WGPUDevice device, WGPU_NULLABLE WGPUCommandEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUComputePipeline (*WGPUProcDeviceCreateComputePipeline)(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcDeviceCreateComputePipelineAsync)(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBuffer (*WGPUProcDeviceCreateErrorBuffer)(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUComputePipeline (*WGPUProcDeviceCreateErrorComputePipeline)(WGPUDevice device, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUExternalTexture (*WGPUProcDeviceCreateErrorExternalTexture)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPURenderPipeline (*WGPUProcDeviceCreateErrorRenderPipeline)(WGPUDevice device, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUShaderModule (*WGPUProcDeviceCreateErrorShaderModule)(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor, WGPUStringView errorMessage) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTexture (*WGPUProcDeviceCreateErrorTexture)(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUExternalTexture (*WGPUProcDeviceCreateExternalTexture)(WGPUDevice device, WGPUExternalTextureDescriptor const * externalTextureDescriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUPipelineLayout (*WGPUProcDeviceCreatePipelineLayout)(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUQuerySet (*WGPUProcDeviceCreateQuerySet)(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPURenderBundleEncoder (*WGPUProcDeviceCreateRenderBundleEncoder)(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPURenderPipeline (*WGPUProcDeviceCreateRenderPipeline)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcDeviceCreateRenderPipelineAsync)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUResourceTable (*WGPUProcDeviceCreateResourceTable)(WGPUDevice device, WGPUResourceTableDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSampler (*WGPUProcDeviceCreateSampler)(WGPUDevice device, WGPU_NULLABLE WGPUSamplerDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUShaderModule (*WGPUProcDeviceCreateShaderModule)(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTexture (*WGPUProcDeviceCreateTexture)(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceDestroy)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceForceLoss)(WGPUDevice device, WGPUDeviceLostReason type, WGPUStringView message) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUAdapter (*WGPUProcDeviceGetAdapter)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcDeviceGetAdapterInfo)(WGPUDevice device, WGPUAdapterInfo * adapterInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcDeviceGetAHardwareBufferProperties)(WGPUDevice device, void * handle, WGPUAHardwareBufferProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceGetFeatures)(WGPUDevice device, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcDeviceGetLostFuture)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcDeviceHasFeature)(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSharedBufferMemory (*WGPUProcDeviceImportSharedBufferMemory)(WGPUDevice device, WGPUSharedBufferMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSharedFence (*WGPUProcDeviceImportSharedFence)(WGPUDevice device, WGPUSharedFenceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUSharedTextureMemory (*WGPUProcDeviceImportSharedTextureMemory)(WGPUDevice device, WGPUSharedTextureMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceInjectError)(WGPUDevice device, WGPUErrorType type, WGPUStringView message) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcDevicePopErrorScope)(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDevicePushErrorScope)(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceSetLabel)(WGPUDevice device, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceSetLoggingCallback)(WGPUDevice device, WGPULoggingCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceTick)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceValidateTextureDescriptor)(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceAddRef)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcDeviceRelease)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of ExternalTexture +typedef void (*WGPUProcExternalTextureDestroy)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureExpire)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureRefresh)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureSetLabel)(WGPUExternalTexture externalTexture, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureAddRef)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcExternalTextureRelease)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Instance +typedef WGPUSurface (*WGPUProcInstanceCreateSurface)(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcInstanceGetWGSLLanguageFeatures)(WGPUInstance instance, WGPUSupportedWGSLLanguageFeatures * features) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcInstanceHasWGSLLanguageFeature)(WGPUInstance instance, WGPUWGSLLanguageFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcInstanceProcessEvents)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcInstanceRequestAdapter)(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUWaitStatus (*WGPUProcInstanceWaitAny)(WGPUInstance instance, size_t futureCount, WGPU_NULLABLE WGPUFutureWaitInfo * futures, uint64_t timeoutNS) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcInstanceAddRef)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcInstanceRelease)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of PipelineLayout +typedef void (*WGPUProcPipelineLayoutSetLabel)(WGPUPipelineLayout pipelineLayout, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcPipelineLayoutAddRef)(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcPipelineLayoutRelease)(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of QuerySet +typedef void (*WGPUProcQuerySetDestroy)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; +typedef uint32_t (*WGPUProcQuerySetGetCount)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUQueryType (*WGPUProcQuerySetGetType)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQuerySetSetLabel)(WGPUQuerySet querySet, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQuerySetAddRef)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQuerySetRelease)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Queue +typedef void (*WGPUProcQueueCopyExternalTextureForBrowser)(WGPUQueue queue, WGPUImageCopyExternalTexture const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueCopyTextureForBrowser)(WGPUQueue queue, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUFuture (*WGPUProcQueueOnSubmittedWorkDone)(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueSetLabel)(WGPUQueue queue, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueSubmit)(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueWriteBuffer)(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueWriteTexture)(WGPUQueue queue, WGPUTexelCopyTextureInfo const * destination, void const * data, size_t dataSize, WGPUTexelCopyBufferLayout const * dataLayout, WGPUExtent3D const * writeSize) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueAddRef)(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcQueueRelease)(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of RenderBundle +typedef void (*WGPUProcRenderBundleSetLabel)(WGPURenderBundle renderBundle, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleAddRef)(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleRelease)(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of RenderBundleEncoder +typedef void (*WGPUProcRenderBundleEncoderDraw)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderDrawIndexed)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderDrawIndexedIndirect)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderDrawIndirect)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPURenderBundle (*WGPUProcRenderBundleEncoderFinish)(WGPURenderBundleEncoder renderBundleEncoder, WGPU_NULLABLE WGPURenderBundleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderInsertDebugMarker)(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderPopDebugGroup)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderPushDebugGroup)(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderSetBindGroup)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderSetImmediates)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderSetIndexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderSetLabel)(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderSetPipeline)(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderSetVertexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderAddRef)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderBundleEncoderRelease)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of RenderPassEncoder +typedef void (*WGPUProcRenderPassEncoderBeginOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderDraw)(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderDrawIndexed)(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderDrawIndexedIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderDrawIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderEnd)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderEndOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderExecuteBundles)(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, WGPURenderBundle const * bundles) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderInsertDebugMarker)(WGPURenderPassEncoder renderPassEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderMultiDrawIndexedIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPU_NULLABLE WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderMultiDrawIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPU_NULLABLE WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderPixelLocalStorageBarrier)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderPopDebugGroup)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderPushDebugGroup)(WGPURenderPassEncoder renderPassEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetBindGroup)(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetBlendConstant)(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetImmediates)(WGPURenderPassEncoder renderPassEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetIndexBuffer)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetLabel)(WGPURenderPassEncoder renderPassEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetPipeline)(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetResourceTable)(WGPURenderPassEncoder renderPassEncoder, WGPUResourceTable table) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetScissorRect)(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetStencilReference)(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetVertexBuffer)(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderSetViewport)(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderWriteTimestamp)(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderAddRef)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPassEncoderRelease)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of RenderPipeline +typedef WGPUBindGroupLayout (*WGPUProcRenderPipelineGetBindGroupLayout)(WGPURenderPipeline renderPipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPipelineSetLabel)(WGPURenderPipeline renderPipeline, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPipelineAddRef)(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcRenderPipelineRelease)(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of ResourceTable +typedef void (*WGPUProcResourceTableDestroy)(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE; +typedef uint32_t (*WGPUProcResourceTableGetSize)(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE; +typedef uint32_t (*WGPUProcResourceTableInsert)(WGPUResourceTable resourceTable, WGPUBindingResource const * resource) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcResourceTableRemove)(WGPUResourceTable resourceTable, uint32_t slot) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcResourceTableSetLabel)(WGPUResourceTable resourceTable, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcResourceTableUpdate)(WGPUResourceTable resourceTable, uint32_t slot, WGPUBindingResource const * resource) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcResourceTableAddRef)(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcResourceTableRelease)(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Sampler +typedef void (*WGPUProcSamplerSetLabel)(WGPUSampler sampler, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSamplerAddRef)(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSamplerRelease)(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of ShaderModule +typedef WGPUFuture (*WGPUProcShaderModuleGetCompilationInfo)(WGPUShaderModule shaderModule, WGPUCompilationInfoCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcShaderModuleSetLabel)(WGPUShaderModule shaderModule, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcShaderModuleAddRef)(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcShaderModuleRelease)(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SharedBufferMemory +typedef WGPUStatus (*WGPUProcSharedBufferMemoryBeginAccess)(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBuffer (*WGPUProcSharedBufferMemoryCreateBuffer)(WGPUSharedBufferMemory sharedBufferMemory, WGPU_NULLABLE WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcSharedBufferMemoryEndAccess)(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcSharedBufferMemoryGetProperties)(WGPUSharedBufferMemory sharedBufferMemory, WGPUSharedBufferMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedBufferMemoryIsDeviceLost)(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemorySetLabel)(WGPUSharedBufferMemory sharedBufferMemory, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemoryAddRef)(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedBufferMemoryRelease)(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SharedBufferMemoryEndAccessState +typedef void (*WGPUProcSharedBufferMemoryEndAccessStateFreeMembers)(WGPUSharedBufferMemoryEndAccessState sharedBufferMemoryEndAccessState) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SharedFence +typedef void (*WGPUProcSharedFenceExportInfo)(WGPUSharedFence sharedFence, WGPUSharedFenceExportInfo * info) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedFenceSetLabel)(WGPUSharedFence sharedFence, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedFenceAddRef)(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedFenceRelease)(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SharedTextureMemory +typedef WGPUStatus (*WGPUProcSharedTextureMemoryBeginAccess)(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTexture (*WGPUProcSharedTextureMemoryCreateTexture)(WGPUSharedTextureMemory sharedTextureMemory, WGPU_NULLABLE WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcSharedTextureMemoryEndAccess)(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcSharedTextureMemoryGetProperties)(WGPUSharedTextureMemory sharedTextureMemory, WGPUSharedTextureMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUBool (*WGPUProcSharedTextureMemoryIsDeviceLost)(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemorySetLabel)(WGPUSharedTextureMemory sharedTextureMemory, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemoryAddRef)(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSharedTextureMemoryRelease)(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SharedTextureMemoryEndAccessState +typedef void (*WGPUProcSharedTextureMemoryEndAccessStateFreeMembers)(WGPUSharedTextureMemoryEndAccessState sharedTextureMemoryEndAccessState) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SupportedFeatures +typedef void (*WGPUProcSupportedFeaturesFreeMembers)(WGPUSupportedFeatures supportedFeatures) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SupportedInstanceFeatures +typedef void (*WGPUProcSupportedInstanceFeaturesFreeMembers)(WGPUSupportedInstanceFeatures supportedInstanceFeatures) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SupportedWGSLLanguageFeatures +typedef void (*WGPUProcSupportedWGSLLanguageFeaturesFreeMembers)(WGPUSupportedWGSLLanguageFeatures supportedWGSLLanguageFeatures) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Surface +typedef void (*WGPUProcSurfaceConfigure)(WGPUSurface surface, WGPUSurfaceConfiguration const * config) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcSurfaceGetCapabilities)(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceGetCurrentTexture)(WGPUSurface surface, WGPUSurfaceTexture * surfaceTexture) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUStatus (*WGPUProcSurfacePresent)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceSetLabel)(WGPUSurface surface, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceUnconfigure)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceAddRef)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of SurfaceCapabilities +typedef void (*WGPUProcSurfaceCapabilitiesFreeMembers)(WGPUSurfaceCapabilities surfaceCapabilities) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of TexelBufferView +typedef void (*WGPUProcTexelBufferViewSetLabel)(WGPUTexelBufferView texelBufferView, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTexelBufferViewAddRef)(WGPUTexelBufferView texelBufferView) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTexelBufferViewRelease)(WGPUTexelBufferView texelBufferView) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of Texture +typedef WGPUTextureView (*WGPUProcTextureCreateErrorView)(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTextureView (*WGPUProcTextureCreateView)(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTextureDestroy)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef uint32_t (*WGPUProcTextureGetDepthOrArrayLayers)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTextureDimension (*WGPUProcTextureGetDimension)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTextureFormat (*WGPUProcTextureGetFormat)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef uint32_t (*WGPUProcTextureGetHeight)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef uint32_t (*WGPUProcTextureGetMipLevelCount)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef uint32_t (*WGPUProcTextureGetSampleCount)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTextureViewDimension (*WGPUProcTextureGetTextureBindingViewDimension)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef WGPUTextureUsage (*WGPUProcTextureGetUsage)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef uint32_t (*WGPUProcTextureGetWidth)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTextureSetLabel)(WGPUTexture texture, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTextureSetOwnershipForMemoryDump)(WGPUTexture texture, uint64_t ownerGuid) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTextureAddRef)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTextureRelease)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; + +// Procs of TextureView +typedef void (*WGPUProcTextureViewSetLabel)(WGPUTextureView textureView, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTextureViewAddRef)(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; +typedef void (*WGPUProcTextureViewRelease)(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; + +#endif // !defined(WGPU_SKIP_PROCS) + +#if !defined(WGPU_SKIP_DECLARATIONS) +WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPU_NULLABLE WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuGetInstanceFeatures(WGPUSupportedInstanceFeatures * features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuGetInstanceLimits(WGPUInstanceLimits * limits) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuHasInstanceFeature(WGPUInstanceFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPUStringView procName) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Adapter +WGPU_EXPORT WGPUDevice wgpuAdapterCreateDevice(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuAdapterGetFeatures(WGPUAdapter adapter, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuAdapterGetFormatCapabilities(WGPUAdapter adapter, WGPUTextureFormat format, WGPUDawnFormatCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuAdapterGetInfo(WGPUAdapter adapter, WGPUAdapterInfo * info) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUInstance wgpuAdapterGetInstance(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuAdapterGetLimits(WGPUAdapter adapter, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuAdapterRequestDevice(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuAdapterAddRef(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuAdapterRelease(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of AdapterInfo +WGPU_EXPORT void wgpuAdapterInfoFreeMembers(WGPUAdapterInfo adapterInfo) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of AdapterPropertiesMemoryHeaps +WGPU_EXPORT void wgpuAdapterPropertiesMemoryHeapsFreeMembers(WGPUAdapterPropertiesMemoryHeaps adapterPropertiesMemoryHeaps) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of AdapterPropertiesSubgroupMatrixConfigs +WGPU_EXPORT void wgpuAdapterPropertiesSubgroupMatrixConfigsFreeMembers(WGPUAdapterPropertiesSubgroupMatrixConfigs adapterPropertiesSubgroupMatrixConfigs) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of BindGroup +WGPU_EXPORT void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuBindGroupAddRef(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuBindGroupRelease(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of BindGroupLayout +WGPU_EXPORT void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuBindGroupLayoutAddRef(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Buffer +WGPU_EXPORT WGPUTexelBufferView wgpuBufferCreateTexelView(WGPUBuffer buffer, WGPUTexelBufferViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuBufferDestroy(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void const * wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void * wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBufferMapState wgpuBufferGetMapState(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT uint64_t wgpuBufferGetSize(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBufferUsage wgpuBufferGetUsage(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapMode mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuBufferReadMappedRange(WGPUBuffer buffer, size_t offset, void * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuBufferSetLabel(WGPUBuffer buffer, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuBufferUnmap(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuBufferWriteMappedRange(WGPUBuffer buffer, size_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuBufferAddRef(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuBufferRelease(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of CommandBuffer +WGPU_EXPORT void wgpuCommandBufferSetLabel(WGPUCommandBuffer commandBuffer, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandBufferAddRef(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandBufferRelease(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of CommandEncoder +WGPU_EXPORT WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUComputePassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, WGPUTexelCopyBufferInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyBufferInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUCommandBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderInjectValidationError(WGPUCommandEncoder commandEncoder, WGPUStringView message) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderWriteBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderAddRef(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuCommandEncoderRelease(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of ComputePassEncoder +WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderSetImmediates(WGPUComputePassEncoder computePassEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderSetResourceTable(WGPUComputePassEncoder computePassEncoder, WGPU_NULLABLE WGPUResourceTable table) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderWriteTimestamp(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderAddRef(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of ComputePipeline +WGPU_EXPORT WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePipelineAddRef(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuComputePipelineRelease(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of DawnDrmFormatCapabilities +WGPU_EXPORT void wgpuDawnDrmFormatCapabilitiesFreeMembers(WGPUDawnDrmFormatCapabilities dawnDrmFormatCapabilities) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Device +WGPU_EXPORT WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPU_NULLABLE WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, WGPU_NULLABLE WGPUCommandEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBuffer wgpuDeviceCreateErrorBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUComputePipeline wgpuDeviceCreateErrorComputePipeline(WGPUDevice device, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateErrorExternalTexture(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPURenderPipeline wgpuDeviceCreateErrorRenderPipeline(WGPUDevice device, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateErrorShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor, WGPUStringView errorMessage) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTexture wgpuDeviceCreateErrorTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUExternalTexture wgpuDeviceCreateExternalTexture(WGPUDevice device, WGPUExternalTextureDescriptor const * externalTextureDescriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUResourceTable wgpuDeviceCreateResourceTable(WGPUDevice device, WGPUResourceTableDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, WGPU_NULLABLE WGPUSamplerDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceDestroy(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceForceLoss(WGPUDevice device, WGPUDeviceLostReason type, WGPUStringView message) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUAdapter wgpuDeviceGetAdapter(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuDeviceGetAdapterInfo(WGPUDevice device, WGPUAdapterInfo * adapterInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuDeviceGetAHardwareBufferProperties(WGPUDevice device, void * handle, WGPUAHardwareBufferProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceGetFeatures(WGPUDevice device, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuDeviceGetLimits(WGPUDevice device, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuDeviceGetLostFuture(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSharedBufferMemory wgpuDeviceImportSharedBufferMemory(WGPUDevice device, WGPUSharedBufferMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSharedFence wgpuDeviceImportSharedFence(WGPUDevice device, WGPUSharedFenceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUSharedTextureMemory wgpuDeviceImportSharedTextureMemory(WGPUDevice device, WGPUSharedTextureMemoryDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceInjectError(WGPUDevice device, WGPUErrorType type, WGPUStringView message) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuDevicePopErrorScope(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceSetLabel(WGPUDevice device, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceTick(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceValidateTextureDescriptor(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceAddRef(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuDeviceRelease(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of ExternalTexture +WGPU_EXPORT void wgpuExternalTextureDestroy(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureExpire(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureRefresh(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureSetLabel(WGPUExternalTexture externalTexture, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureAddRef(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuExternalTextureRelease(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Instance +WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuInstanceGetWGSLLanguageFeatures(WGPUInstance instance, WGPUSupportedWGSLLanguageFeatures * features) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuInstanceHasWGSLLanguageFeature(WGPUInstance instance, WGPUWGSLLanguageFeatureName feature) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuInstanceProcessEvents(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuInstanceRequestAdapter(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUWaitStatus wgpuInstanceWaitAny(WGPUInstance instance, size_t futureCount, WGPU_NULLABLE WGPUFutureWaitInfo * futures, uint64_t timeoutNS) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuInstanceAddRef(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuInstanceRelease(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of PipelineLayout +WGPU_EXPORT void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuPipelineLayoutAddRef(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of QuerySet +WGPU_EXPORT void wgpuQuerySetDestroy(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT uint32_t wgpuQuerySetGetCount(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUQueryType wgpuQuerySetGetType(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQuerySetSetLabel(WGPUQuerySet querySet, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQuerySetAddRef(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQuerySetRelease(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Queue +WGPU_EXPORT void wgpuQueueCopyExternalTextureForBrowser(WGPUQueue queue, WGPUImageCopyExternalTexture const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQueueCopyTextureForBrowser(WGPUQueue queue, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize, WGPUCopyTextureForBrowserOptions const * options) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUFuture wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQueueSetLabel(WGPUQueue queue, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQueueSubmit(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQueueWriteTexture(WGPUQueue queue, WGPUTexelCopyTextureInfo const * destination, void const * data, size_t dataSize, WGPUTexelCopyBufferLayout const * dataLayout, WGPUExtent3D const * writeSize) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQueueAddRef(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuQueueRelease(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of RenderBundle +WGPU_EXPORT void wgpuRenderBundleSetLabel(WGPURenderBundle renderBundle, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleAddRef(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleRelease(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of RenderBundleEncoder +WGPU_EXPORT void wgpuRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPURenderBundle wgpuRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, WGPU_NULLABLE WGPURenderBundleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderSetImmediates(WGPURenderBundleEncoder renderBundleEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderAddRef(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderBundleEncoderRelease(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of RenderPassEncoder +WGPU_EXPORT void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, WGPURenderBundle const * bundles) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPU_NULLABLE WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPU_NULLABLE WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderPixelLocalStorageBarrier(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetImmediates(WGPURenderPassEncoder renderPassEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetResourceTable(WGPURenderPassEncoder renderPassEncoder, WGPUResourceTable table) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderWriteTimestamp(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderAddRef(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of RenderPipeline +WGPU_EXPORT WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPipelineAddRef(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuRenderPipelineRelease(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of ResourceTable +WGPU_EXPORT void wgpuResourceTableDestroy(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT uint32_t wgpuResourceTableGetSize(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT uint32_t wgpuResourceTableInsert(WGPUResourceTable resourceTable, WGPUBindingResource const * resource) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuResourceTableRemove(WGPUResourceTable resourceTable, uint32_t slot) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuResourceTableSetLabel(WGPUResourceTable resourceTable, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuResourceTableUpdate(WGPUResourceTable resourceTable, uint32_t slot, WGPUBindingResource const * resource) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuResourceTableAddRef(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuResourceTableRelease(WGPUResourceTable resourceTable) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Sampler +WGPU_EXPORT void wgpuSamplerSetLabel(WGPUSampler sampler, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSamplerAddRef(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSamplerRelease(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of ShaderModule +WGPU_EXPORT WGPUFuture wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuShaderModuleAddRef(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuShaderModuleRelease(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SharedBufferMemory +WGPU_EXPORT WGPUStatus wgpuSharedBufferMemoryBeginAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBuffer wgpuSharedBufferMemoryCreateBuffer(WGPUSharedBufferMemory sharedBufferMemory, WGPU_NULLABLE WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuSharedBufferMemoryEndAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuSharedBufferMemoryGetProperties(WGPUSharedBufferMemory sharedBufferMemory, WGPUSharedBufferMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedBufferMemoryIsDeviceLost(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemorySetLabel(WGPUSharedBufferMemory sharedBufferMemory, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemoryAddRef(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedBufferMemoryRelease(WGPUSharedBufferMemory sharedBufferMemory) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SharedBufferMemoryEndAccessState +WGPU_EXPORT void wgpuSharedBufferMemoryEndAccessStateFreeMembers(WGPUSharedBufferMemoryEndAccessState sharedBufferMemoryEndAccessState) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SharedFence +WGPU_EXPORT void wgpuSharedFenceExportInfo(WGPUSharedFence sharedFence, WGPUSharedFenceExportInfo * info) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedFenceSetLabel(WGPUSharedFence sharedFence, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedFenceAddRef(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedFenceRelease(WGPUSharedFence sharedFence) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SharedTextureMemory +WGPU_EXPORT WGPUStatus wgpuSharedTextureMemoryBeginAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryBeginAccessDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTexture wgpuSharedTextureMemoryCreateTexture(WGPUSharedTextureMemory sharedTextureMemory, WGPU_NULLABLE WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuSharedTextureMemoryEndAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryEndAccessState * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuSharedTextureMemoryGetProperties(WGPUSharedTextureMemory sharedTextureMemory, WGPUSharedTextureMemoryProperties * properties) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUBool wgpuSharedTextureMemoryIsDeviceLost(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemorySetLabel(WGPUSharedTextureMemory sharedTextureMemory, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemoryAddRef(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSharedTextureMemoryRelease(WGPUSharedTextureMemory sharedTextureMemory) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SharedTextureMemoryEndAccessState +WGPU_EXPORT void wgpuSharedTextureMemoryEndAccessStateFreeMembers(WGPUSharedTextureMemoryEndAccessState sharedTextureMemoryEndAccessState) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SupportedFeatures +WGPU_EXPORT void wgpuSupportedFeaturesFreeMembers(WGPUSupportedFeatures supportedFeatures) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SupportedInstanceFeatures +WGPU_EXPORT void wgpuSupportedInstanceFeaturesFreeMembers(WGPUSupportedInstanceFeatures supportedInstanceFeatures) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SupportedWGSLLanguageFeatures +WGPU_EXPORT void wgpuSupportedWGSLLanguageFeaturesFreeMembers(WGPUSupportedWGSLLanguageFeatures supportedWGSLLanguageFeatures) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Surface +WGPU_EXPORT void wgpuSurfaceConfigure(WGPUSurface surface, WGPUSurfaceConfiguration const * config) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuSurfaceGetCapabilities(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSurfaceGetCurrentTexture(WGPUSurface surface, WGPUSurfaceTexture * surfaceTexture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUStatus wgpuSurfacePresent(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSurfaceSetLabel(WGPUSurface surface, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSurfaceUnconfigure(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSurfaceAddRef(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuSurfaceRelease(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of SurfaceCapabilities +WGPU_EXPORT void wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities surfaceCapabilities) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of TexelBufferView +WGPU_EXPORT void wgpuTexelBufferViewSetLabel(WGPUTexelBufferView texelBufferView, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuTexelBufferViewAddRef(WGPUTexelBufferView texelBufferView) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuTexelBufferViewRelease(WGPUTexelBufferView texelBufferView) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of Texture +WGPU_EXPORT WGPUTextureView wgpuTextureCreateErrorView(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuTextureDestroy(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT uint32_t wgpuTextureGetDepthOrArrayLayers(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTextureDimension wgpuTextureGetDimension(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTextureFormat wgpuTextureGetFormat(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT uint32_t wgpuTextureGetHeight(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT uint32_t wgpuTextureGetMipLevelCount(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT uint32_t wgpuTextureGetSampleCount(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTextureViewDimension wgpuTextureGetTextureBindingViewDimension(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT WGPUTextureUsage wgpuTextureGetUsage(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT uint32_t wgpuTextureGetWidth(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuTextureSetLabel(WGPUTexture texture, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuTextureSetOwnershipForMemoryDump(WGPUTexture texture, uint64_t ownerGuid) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuTextureAddRef(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuTextureRelease(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE; + +// Methods of TextureView +WGPU_EXPORT void wgpuTextureViewSetLabel(WGPUTextureView textureView, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuTextureViewAddRef(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; +WGPU_EXPORT void wgpuTextureViewRelease(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE; + +#endif // !defined(WGPU_SKIP_DECLARATIONS) + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // WEBGPU_H_ From 5c905100659e703e6eb83a6448147375b1df87b1 Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Wed, 30 Sep 2026 22:41:13 -0400 Subject: [PATCH 2/8] Add an experimental Dawn backend implemented in Cython
Claude's draft Add wgpu.backends.dawn, a backend based on Google's Dawn, alongside the wgpu-native backend. It implements the same public classes (from wgpu._classes), so user code and the test suite can select it. The backend is a single Cython module (_api.pyx) whose classes mirror the wgpu-native backend: regular Python classes that subclass the public API, but whose methods are compiled and call Dawn's webgpu.h directly. Each object stores its native pointer in a small extension type, so hot-path methods (draw, set_bind_group, ...) need no Python attribute lookups. Descriptors are filled as C structs on the stack (or in a small arena), using Dawn's WGPU_*_INIT initializers. Validation errors, which Dawn reports synchronously via the uncaptured-error callback, are raised as exceptions at the call site by checking a C flag after each call. Promises wrap Dawn futures: sync_wait() uses wgpuInstanceWaitAny with the GIL released, awaiting polls wgpuInstanceProcessEvents, and then() is driven by a pump that schedules process_events() on the event loop. The extension is optional: build it with tools/build_dawn.py against an installed Dawn (e.g. from conda). On CPython >= 3.12 it is built against the Stable ABI. Select it with `import wgpu.backends.dawn` or with WGPUPY_BACKEND=dawn; the auto backend now also respects an already registered backend, and registering a second, different backend raises. Not implemented yet: GLSL shaders, pipeline statistics queries, texture view swizzle, and canvas/surface presentation is untested. Resume this Claude session: ``` cd /home/mark/git/feedstock/staged-recipes claude --resume 2cab6db9-a6ea-4976-a0e6-f4153fe5a651 ```
Claude-Session: https://claude.ai/code/session_01QMLpZTQYYCu2K7EaWNnkEG --- .gitignore | 4 +- conftest.py | 8 + docs/backends.rst | 26 + pyproject.toml | 1 + tests/renderutils.py | 2 +- tests/test_dawn_backend.py | 345 ++++ tools/build_dawn.py | 152 ++ tools/hatch_build.py | 11 + wgpu/backends/__init__.py | 7 +- wgpu/backends/auto.py | 15 +- wgpu/backends/dawn/__init__.py | 35 + wgpu/backends/dawn/_api.pyx | 3434 ++++++++++++++++++++++++++++++++ 12 files changed, 4036 insertions(+), 4 deletions(-) create mode 100644 tests/test_dawn_backend.py create mode 100644 tools/build_dawn.py create mode 100644 wgpu/backends/dawn/__init__.py create mode 100644 wgpu/backends/dawn/_api.pyx diff --git a/.gitignore b/.gitignore index d8ea74d18..70be17124 100644 --- a/.gitignore +++ b/.gitignore @@ -125,4 +125,6 @@ venv.bak/ .mypy_cache/ # jetbrains idea -.idea/ \ No newline at end of file +.idea/ +# Generated by Cython for the Dawn backend +wgpu/backends/dawn/_api.c diff --git a/conftest.py b/conftest.py index 7bf61a198..a45a54ec4 100644 --- a/conftest.py +++ b/conftest.py @@ -1,9 +1,17 @@ """Global configuration for pytest""" +import os + import numpy as np import pytest +# Allow running the tests against a specific backend, e.g. WGPUPY_BACKEND=dawn. +# The backend must be loaded before any test module imports another backend. +if os.getenv("WGPUPY_BACKEND", "").strip(): + import wgpu.backends.auto # noqa: F401 + + def pytest_addoption(parser): parser.addoption( "--regenerate-screenshots", diff --git a/docs/backends.rst b/docs/backends.rst index 324a5b3b8..3c3806dcf 100644 --- a/docs/backends.rst +++ b/docs/backends.rst @@ -254,6 +254,32 @@ Use like the following before the instance is created, which happens during requ For additional usage examples look at `extras_dxc.py` and `extras_debug.py` in the examples directory. Limited documentation on instance extras can be found in `wgpu.h`. +The dawn backend (experimental) +------------------------------- + +.. code-block:: py + + import wgpu.backends.dawn + +This backend wraps `Dawn `__, the WebGPU +implementation used by Chromium, via its standard ``webgpu.h`` C API. It is +implemented as a compiled Cython extension module, which calls into Dawn +directly, minimizing the per-call overhead. + +This backend is optional and not (yet) included in the wheels. It must be built +against an installed Dawn. Dawn is being packaged for conda-forge +(`staged-recipes#35015 `__):: + + conda install -c conda-forge dawn cython setuptools c-compiler + python tools/build_dawn.py + +The backend can also be selected by setting the ``WGPUPY_BACKEND=dawn`` +environment variable. The Cython declarations of the C API (``_webgpu.pxd``) +and the enum mappings are generated by the codegen from Dawn's ``webgpu.h``. +Dawn-specific features are exposed with lowercase dashed names, e.g. +``"implicit-device-synchronization"``. + + The js_webgpu backend --------------------- diff --git a/pyproject.toml b/pyproject.toml index d2ac60729..c9698d36b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ dependencies = [ imgui = ["imgui-bundle>=1.92.0, <2"] # For devs / ci build = ["build", "hatchling", "requests", "twine"] +dawn = ["cython>=3.1", "setuptools"] # To build the Dawn backend (also needs Dawn itself) codegen = ["pytest", "numpy", "ruff"] lint = ["ruff", "pre-commit"] tests = [ diff --git a/tests/renderutils.py b/tests/renderutils.py index ea95da6d3..a09391b25 100644 --- a/tests/renderutils.py +++ b/tests/renderutils.py @@ -5,7 +5,7 @@ import ctypes import numpy as np -import wgpu.backends.wgpu_native +import wgpu def upload_to_texture(device, texture, data, nx, ny, nz): diff --git a/tests/test_dawn_backend.py b/tests/test_dawn_backend.py new file mode 100644 index 000000000..5d51d51bf --- /dev/null +++ b/tests/test_dawn_backend.py @@ -0,0 +1,345 @@ +"""Tests specific to the (optional) Dawn backend. + +These only run when the Dawn backend is selected, i.e. with +``WGPUPY_BACKEND=dawn``, because only one backend can be active per process. +Most of the generic tests in this directory also run against the Dawn backend +in that case. +""" + +import gc +import os +import asyncio + +import numpy as np +import pytest + +import wgpu + + +if os.getenv("WGPUPY_BACKEND", "").lower() != "dawn": + pytest.skip( + "Dawn backend not selected (WGPUPY_BACKEND=dawn)", allow_module_level=True + ) + +dawn = pytest.importorskip("wgpu.backends.dawn") + + +@pytest.fixture(scope="module") +def device(): + adapter = wgpu.gpu.request_adapter_sync() + return adapter.request_device_sync() + + +COMPUTE_SHADER = """ +@group(0) @binding(0) var data1: array; +@group(0) @binding(1) var data2: array; +@compute @workgroup_size(1) +fn main(@builtin(global_invocation_id) index: vec3) { + let i: u32 = index.x; + data2[i] = data1[i] * 2 + 1; +} +""" + +RENDER_SHADER = """ +struct VertexOutput { + @builtin(position) pos: vec4, + @location(0) color: vec4, +}; +@vertex +fn vs_main(@location(0) pos: vec2) -> VertexOutput { + var out: VertexOutput; + out.pos = vec4(pos, 0.0, 1.0); + out.color = vec4(1.0, 0.5, 0.0, 1.0); + return out; +} +@fragment +fn fs_main(in: VertexOutput) -> @location(0) vec4 { + return in.color; +} +""" + + +def test_backend_is_dawn(): + assert type(wgpu.gpu).__module__.startswith("wgpu.backends.dawn") + adapter = wgpu.gpu.request_adapter_sync() + assert isinstance(adapter, dawn.GPUAdapter) + info = adapter.info + assert isinstance(info["vendor"], str) + assert info["backend_type"] in ( + "Vulkan", + "Metal", + "D3D12", + "D3D11", + "OpenGL", + "OpenGLES", + "Null", + ) + assert adapter.limits["max-bind-groups"] >= 4 + assert "core-features-and-limits" in adapter.features or adapter.features + + +def test_request_device_with_features_and_limits(): + adapter = wgpu.gpu.request_adapter_sync() + features = [ + f for f in ("float32-filterable", "timestamp-query") if f in adapter.features + ] + device = adapter.request_device_sync( + required_features=features, + required_limits={ + "max_bind_groups": 4, + "max-storage-buffers-per-shader-stage": 8, + }, + ) + assert isinstance(device, dawn.GPUDevice) + for f in features: + assert f in device.features + assert device.limits["max-bind-groups"] == 4 + with pytest.raises(KeyError): + adapter.request_device_sync(required_features=["not-a-feature"]) + + +def test_buffer_upload_download(device): + data = np.arange(64, dtype=np.uint32) + buf = device.create_buffer_with_data( + data=data, usage=wgpu.BufferUsage.COPY_SRC | wgpu.BufferUsage.COPY_DST + ) + assert buf.size == data.nbytes + out = np.frombuffer(device.queue.read_buffer(buf), np.uint32) + assert np.all(out == data) + + # Partial write + device.queue.write_buffer(buf, 8, np.array([100, 101], np.uint32)) + out = np.frombuffer(device.queue.read_buffer(buf), np.uint32) + assert out[1] == 1 and out[2] == 100 and out[3] == 101 and out[4] == 4 + + +def test_buffer_map_read_write(device): + buf1 = device.create_buffer( + size=64, usage=wgpu.BufferUsage.MAP_WRITE | wgpu.BufferUsage.COPY_SRC + ) + buf2 = device.create_buffer( + size=64, usage=wgpu.BufferUsage.MAP_READ | wgpu.BufferUsage.COPY_DST + ) + data = np.arange(16, dtype=np.float32) + + buf1.map_sync("WRITE") + assert buf1.map_state == "mapped" + buf1.write_mapped(data) + buf1.unmap() + assert buf1.map_state == "unmapped" + + encoder = device.create_command_encoder() + encoder.copy_buffer_to_buffer(buf1, 0, buf2, 0, 64) + device.queue.submit([encoder.finish()]) + + buf2.map_sync("READ") + out1 = np.frombuffer(buf2.read_mapped(), np.float32) + out2 = np.frombuffer(buf2.read_mapped(copy=False), np.float32).copy() + buf2.unmap() + assert np.all(out1 == data) + assert np.all(out2 == data) + + +def test_compute(device): + n = 64 + data = np.arange(n, dtype=np.int32) + buf1 = device.create_buffer_with_data(data=data, usage=wgpu.BufferUsage.STORAGE) + buf2 = device.create_buffer( + size=data.nbytes, usage=wgpu.BufferUsage.STORAGE | wgpu.BufferUsage.COPY_SRC + ) + module = device.create_shader_module(code=COMPUTE_SHADER) + pipeline = device.create_compute_pipeline( + layout="auto", compute={"module": module, "entry_point": "main"} + ) + bind_group = device.create_bind_group( + layout=pipeline.get_bind_group_layout(0), + entries=[ + {"binding": 0, "resource": {"buffer": buf1}}, + { + "binding": 1, + "resource": {"buffer": buf2, "offset": 0, "size": buf2.size}, + }, + ], + ) + encoder = device.create_command_encoder() + cpass = encoder.begin_compute_pass() + cpass.set_pipeline(pipeline) + cpass.set_bind_group(0, bind_group) + cpass.dispatch_workgroups(n, 1, 1) + cpass.end() + device.queue.submit([encoder.finish()]) + out = np.frombuffer(device.queue.read_buffer(buf2), np.int32) + assert np.all(out == data * 2 + 1) + + +def _render_square(device, use_bundle=False, use_index=False): + size = 64 + fmt = "rgba8unorm" + texture = device.create_texture( + size=(size, size, 1), + format=fmt, + usage=wgpu.TextureUsage.RENDER_ATTACHMENT | wgpu.TextureUsage.COPY_SRC, + ) + # A square from -0.5 to 0.5 + vertices = np.array( + [[-0.5, -0.5], [0.5, -0.5], [-0.5, 0.5], [0.5, 0.5]], np.float32 + ) + vbo = device.create_buffer_with_data(data=vertices, usage=wgpu.BufferUsage.VERTEX) + indices = np.array([0, 1, 2, 2, 1, 3], np.uint32) + ibo = device.create_buffer_with_data(data=indices, usage=wgpu.BufferUsage.INDEX) + module = device.create_shader_module(code=RENDER_SHADER) + pipeline = device.create_render_pipeline( + layout=device.create_pipeline_layout(bind_group_layouts=[]), + vertex={ + "module": module, + "entry_point": "vs_main", + "buffers": [ + { + "array_stride": 8, + "attributes": [ + {"format": "float32x2", "offset": 0, "shader_location": 0} + ], + } + ], + }, + primitive={"topology": "triangle-list" if use_index else "triangle-strip"}, + fragment={ + "module": module, + "entry_point": "fs_main", + "targets": [{"format": fmt}], + }, + ) + + def record(enc): + enc.set_pipeline(pipeline) + enc.set_vertex_buffer(0, vbo) + if use_index: + enc.set_index_buffer(ibo, "uint32") + enc.draw_indexed(6) + else: + enc.draw(4) + + encoder = device.create_command_encoder() + rpass = encoder.begin_render_pass( + color_attachments=[ + { + "view": texture.create_view(), + "load_op": "clear", + "store_op": "store", + "clear_value": (0, 0, 0.5, 1), + } + ] + ) + if use_bundle: + bundle_encoder = device.create_render_bundle_encoder(color_formats=[fmt]) + record(bundle_encoder) + rpass.execute_bundles([bundle_encoder.finish()]) + else: + record(rpass) + rpass.end() + device.queue.submit([encoder.finish()]) + + data = device.queue.read_texture( + {"texture": texture}, {"bytes_per_row": size * 4}, (size, size, 1) + ) + return np.frombuffer(data, np.uint8).reshape(size, size, 4) + + +@pytest.mark.parametrize("use_bundle", [False, True]) +@pytest.mark.parametrize("use_index", [False, True]) +def test_render_to_texture(device, use_bundle, use_index): + im = _render_square(device, use_bundle, use_index) + # Center is orange, corners are the clear color + assert tuple(im[32, 32]) in ((255, 128, 0, 255), (255, 127, 0, 255)) + assert tuple(im[2, 2]) in ((0, 0, 128, 255), (0, 0, 127, 255)) + n_orange = np.sum(im[:, :, 1] > 100) + assert n_orange == 32 * 32 + + +def test_validation_error_raises_at_call_site(device): + with pytest.raises(wgpu.GPUValidationError) as err: + device.create_buffer( + size=64, usage=wgpu.BufferUsage.MAP_READ | wgpu.BufferUsage.STORAGE + ) + assert "MapRead" in str(err.value) + # And the next call is fine again + device.create_buffer(size=64, usage=wgpu.BufferUsage.MAP_READ) + + +def test_shader_error_raises(device): + with pytest.raises(wgpu.GPUValidationError) as err: + device.create_shader_module( + code="@compute @workgroup_size(1) fn main() { let x: f32 = 1u; }" + ) + assert "error" in str(err.value).lower() + + +def test_compilation_info(device): + module = device.create_shader_module(code=COMPUTE_SHADER) + info = module.get_compilation_info_sync() + assert isinstance(info, wgpu.GPUCompilationInfo) + assert isinstance(info.messages, list) + + +def test_error_scopes(device): + device.push_error_scope("validation") + device.create_buffer( + size=64, usage=wgpu.BufferUsage.MAP_READ | wgpu.BufferUsage.STORAGE + ) + error = device.pop_error_scope_async().sync_wait() + assert isinstance(error, wgpu.GPUValidationError) + device.push_error_scope("validation") + error = device.pop_error_scope_async().sync_wait() + assert error is None + + +def test_released_objects(device): + buf = device.create_buffer(size=64, usage=wgpu.BufferUsage.COPY_DST) + buf._release() + assert buf._internal is None + with pytest.raises(RuntimeError): + device.queue.write_buffer(buf, 0, b"0000") + # Lots of objects being created and garbage collected + for _ in range(100): + device.create_buffer(size=64, usage=wgpu.BufferUsage.COPY_DST) + gc.collect() + + +def test_async_await(device): + buf = device.create_buffer_with_data( + data=np.arange(16, dtype=np.uint32), usage=wgpu.BufferUsage.COPY_SRC + ) + buf2 = device.create_buffer( + size=buf.size, usage=wgpu.BufferUsage.MAP_READ | wgpu.BufferUsage.COPY_DST + ) + encoder = device.create_command_encoder() + encoder.copy_buffer_to_buffer(buf, 0, buf2, 0, buf.size) + device.queue.submit([encoder.finish()]) + + results = [] + + async def main(): + await device.queue.on_submitted_work_done_async() + await buf2.map_async("READ") + results.append(np.frombuffer(buf2.read_mapped(), np.uint32).copy()) + buf2.unmap() + # Using then() + event = asyncio.Event() + promise = device.queue.on_submitted_work_done_async() + promise.then(lambda _: event.set()) + await asyncio.wait_for(event.wait(), 5) + results.append("then") + + asyncio.run(main()) + assert np.all(results[0] == np.arange(16)) + assert results[1] == "then" + + +def test_device_lost_on_destroy(): + adapter = wgpu.gpu.request_adapter_sync() + device = adapter.request_device_sync() + promise = device._get_lost_async() + device.destroy() + dawn.process_events() + info = promise.sync_wait() + assert info.reason == "destroyed" diff --git a/tools/build_dawn.py b/tools/build_dawn.py new file mode 100644 index 000000000..ad77d1477 --- /dev/null +++ b/tools/build_dawn.py @@ -0,0 +1,152 @@ +""" +Build the Cython extension for the (optional) Dawn backend, in place. + +The Dawn backend lives in ``wgpu/backends/dawn``. Its C-API declarations +(``_webgpu.pxd``) are generated by the codegen from Dawn's ``webgpu.h``. This +script compiles ``_api.pyx`` against Dawn's headers and links it to +``libwebgpu_dawn``. Building is optional: wgpu-py works fine without it, and +the wgpu-native backend remains the default. + +Dawn is found via (in order): the ``--dawn-prefix`` argument, the +``DAWN_PREFIX`` env var, the ``CONDA_PREFIX`` env var, and ``sys.prefix``. The +prefix must contain ``include/webgpu/webgpu.h`` and the shared library in +``lib`` (``Library`` on Windows conda). Dawn can be installed from conda:: + + conda install -c conda-forge dawn + +On CPython >= 3.12 the extension is built against the Stable ABI (abi3), so +one binary works for all later Python versions. + +Usage:: + + python tools/build_dawn.py [--dawn-prefix PREFIX] [--debug] +""" + +import os +import sys +import argparse +import sysconfig + + +ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) +DAWN_DIR = os.path.join(ROOT, "wgpu", "backends", "dawn") + +# Use the Stable ABI (Limited API) where Cython supports it well. +LIMITED_API_MIN = (3, 12) + + +def find_dawn_prefix(prefix=None): + candidates = [ + prefix, + os.getenv("DAWN_PREFIX"), + os.getenv("CONDA_PREFIX"), + sys.prefix, + ] + for p in candidates: + if not p: + continue + for sub in ("", "Library"): + base = os.path.join(p, sub) + if os.path.isfile(os.path.join(base, "include", "webgpu", "webgpu.h")): + return base + raise RuntimeError( + "Could not find Dawn (include/webgpu/webgpu.h). Install it with " + "'conda install -c conda-forge dawn', or set DAWN_PREFIX." + ) + + +def get_extension(dawn_prefix, debug=False): + from setuptools import Extension + + include_dir = os.path.join(dawn_prefix, "include") + lib_dir = os.path.join(dawn_prefix, "lib") + define_macros = [] + extra_compile_args = [] + extra_link_args = [] + py_limited_api = sys.version_info[:2] >= LIMITED_API_MIN + if py_limited_api: + hexversion = "0x{:02X}{:02X}0000".format(*LIMITED_API_MIN) + define_macros.append(("Py_LIMITED_API", hexversion)) + define_macros.append(("CYTHON_LIMITED_API", "1")) + + if sys.platform.startswith("win"): + extra_compile_args += ["/Od"] if debug else ["/O2"] + lib_dir = os.path.join(dawn_prefix, "lib") + else: + extra_compile_args += ["-O0", "-g"] if debug else ["-O2"] + # Dawn's header has a few constructs that some compilers warn about + extra_compile_args += ["-Wno-unused-function", "-Wno-unreachable-code"] + if sys.platform.startswith("darwin"): + extra_link_args += [f"-Wl,-rpath,{lib_dir}"] + else: + extra_link_args += [f"-Wl,-rpath,{lib_dir}"] + + return Extension( + "wgpu.backends.dawn._api", + sources=[os.path.join(DAWN_DIR, "_api.pyx")], + include_dirs=[include_dir], + library_dirs=[lib_dir], + libraries=["webgpu_dawn"], + define_macros=define_macros, + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + py_limited_api=py_limited_api, + ) + + +def build(dawn_prefix=None, debug=False): + from Cython.Build import cythonize + from setuptools import Distribution + + dawn_prefix = find_dawn_prefix(dawn_prefix) + print(f"Building the Dawn backend against {dawn_prefix}") + + ext = get_extension(dawn_prefix, debug) + ext_modules = cythonize( + [ext], + compiler_directives={ + "language_level": 3, + "binding": True, + "annotation_typing": False, + "embedsignature": False, + "cdivision": True, + }, + include_path=[os.path.join(ROOT)], + quiet=False, + ) + + options = {"build_ext": {"inplace": True}} + if ext.py_limited_api: + options["bdist_wheel"] = {"py_limited_api": "cp{}{}".format(*LIMITED_API_MIN)} + dist = Distribution({"ext_modules": ext_modules, "script_name": "build_dawn.py"}) + dist.parse_config_files = lambda *a, **k: None + for cmd, opts in options.items(): + dist.get_option_dict(cmd).update( + {k: ("build_dawn", v) for k, v in opts.items()} + ) + cwd = os.getcwd() + os.chdir(ROOT) + try: + dist.run_command("build_ext") + finally: + os.chdir(cwd) + + built = [ + f + for f in os.listdir(DAWN_DIR) + if f.startswith("_api.") and f.endswith((".so", ".pyd")) + ] + print("Built:", ", ".join(built), "(stable ABI)" if ext.py_limited_api else "") + print("Python tag:", sysconfig.get_config_var("EXT_SUFFIX")) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__.strip().splitlines()[0]) + parser.add_argument( + "--dawn-prefix", default=None, help="The prefix where Dawn is installed." + ) + parser.add_argument( + "--debug", action="store_true", help="Build without optimizations." + ) + args = parser.parse_args() + build(args.dawn_prefix, args.debug) diff --git a/tools/hatch_build.py b/tools/hatch_build.py index 2483bccfb..fd9ac1972 100644 --- a/tools/hatch_build.py +++ b/tools/hatch_build.py @@ -70,6 +70,17 @@ def initialize(self, version, build_data): # Make sure that the download did not bump the wgpu-native version check_git_status() + # Optionally build the (experimental) Dawn backend. This requires Dawn, + # Cython and a C compiler, see tools/build_dawn.py. + if self.target_name == "wheel" and os.getenv( + "WGPU_PY_BUILD_DAWN", "" + ).lower() in ("1", "true"): + from build_dawn import build as build_dawn + + build_dawn() + build_data["pure_python"] = False + build_data["infer_tag"] = True + def is_git_repo(): return os.path.isdir(os.path.join(root_dir, ".git")) diff --git a/wgpu/backends/__init__.py b/wgpu/backends/__init__.py index b082f920b..47bc2ba1b 100644 --- a/wgpu/backends/__init__.py +++ b/wgpu/backends/__init__.py @@ -29,8 +29,13 @@ def _register_backend(gpu): ) # Only allow registering a backend once - if not isinstance(root_namespace["gpu"], _base_GPU): + current_gpu = root_namespace["gpu"] + if not isinstance(current_gpu, _base_GPU): raise RuntimeError("WGPU backend can only be set once.") + if type(current_gpu) is not _base_GPU and type(current_gpu) is not type(gpu): + raise RuntimeError( + f"WGPU backend can only be set once (already using {type(current_gpu).__module__})." + ) # Apply root_namespace["gpu"] = gpu diff --git a/wgpu/backends/auto.py b/wgpu/backends/auto.py index 30332bdd9..faf212de3 100644 --- a/wgpu/backends/auto.py +++ b/wgpu/backends/auto.py @@ -1,4 +1,5 @@ -# The auto/default/only backend is wgpu-native, but this may change in the future. +# The default backend is wgpu-native, but this may change in the future. +import os import sys @@ -7,6 +8,8 @@ def _load_backend(backend_name): if backend_name == "wgpu_native": from . import wgpu_native as module + elif backend_name == "dawn": + from . import dawn as module elif backend_name == "js_webgpu": from . import js_webgpu as module else: # no-cover @@ -18,6 +21,16 @@ def _load_backend(backend_name): def _auto_load_backend(): """Decide on the backend automatically.""" + # If a backend has already been loaded (e.g. by importing wgpu.backends.dawn), use that + current_gpu = sys.modules["wgpu"].gpu + if type(current_gpu).__module__ != "wgpu._classes": + return current_gpu + + # The WGPUPY_BACKEND env var can be used to select a backend, e.g. for testing + backend_name = os.getenv("WGPUPY_BACKEND", "").strip().lower().replace("-", "_") + if backend_name: + return _load_backend(backend_name) + if sys.platform == "emscripten": return _load_backend("js_webgpu") else: diff --git a/wgpu/backends/dawn/__init__.py b/wgpu/backends/dawn/__init__.py new file mode 100644 index 000000000..7d5f28cf4 --- /dev/null +++ b/wgpu/backends/dawn/__init__.py @@ -0,0 +1,35 @@ +""" +The Dawn backend (experimental). + +Dawn is the WebGPU implementation of Chromium. This backend wraps Dawn's +``webgpu.h`` C API using a compiled Cython extension module. It is optional: +it must be built against an installed Dawn (e.g. ``conda install -c conda-forge dawn``) +with ``python tools/build_dawn.py``. + +To use it, import it before anything else selects a backend:: + + import wgpu.backends.dawn + +or set the ``WGPUPY_BACKEND=dawn`` environment variable. +""" + +# ruff: noqa: F401, F403 + +try: + from . import _api +except ImportError as err: # no-cover + raise ImportError( + "The Dawn backend is not available: its extension module is not built " + "or Dawn (libwebgpu_dawn) cannot be loaded. Build it with " + "'python tools/build_dawn.py' (requires Dawn, Cython and a C compiler). " + f"Original error: {err}" + ) from err + +from ._api import * +from ._api import process_events, get_instance_address +from .. import _register_backend + + +# Instantiate and register this backend +gpu = GPU() # noqa: F405 +_register_backend(gpu) diff --git a/wgpu/backends/dawn/_api.pyx b/wgpu/backends/dawn/_api.pyx new file mode 100644 index 000000000..ccadafee6 --- /dev/null +++ b/wgpu/backends/dawn/_api.pyx @@ -0,0 +1,3434 @@ +# cython: language_level=3, binding=True, annotation_typing=False, embedsignature=False +# cython: cdivision=True +""" +WGPU backend implementation based on Dawn. + +Dawn (https://dawn.googlesource.com/dawn) is the WebGPU implementation used by +Chromium. It ships a shared library with the standard ``webgpu.h`` C API. + +This module is written in Cython: the classes below are regular Python classes +(subclassing the public API in ``wgpu._classes``), but their methods are +compiled to C and call into Dawn directly. The C declarations of the complete +API (``_webgpu.pxd``) are generated by the codegen from Dawn's ``webgpu.h``, +so every struct field and function used here is checked at compile time. + +Each object holds its native pointer in a small extension type (``_Handle``), +so that hot-path methods like ``draw()`` or ``set_bind_group()`` reach the C +pointer without any Python attribute lookups. + +The structure of this module deliberately mirrors that of the wgpu-native +backend (``backends/wgpu_native/_api.py``). +""" + +from libc.stdint cimport uint8_t, uint32_t, uint64_t, int32_t, uintptr_t +from libc.string cimport memset, memcpy, strlen +from cpython.mem cimport PyMem_Calloc, PyMem_Free +from cpython.ref cimport Py_INCREF, Py_DECREF +from cpython.buffer cimport PyObject_GetBuffer, PyBuffer_Release, PyBUF_ANY_CONTIGUOUS, PyBUF_SIMPLE + +from ._webgpu cimport * + +import os +import sys +import time +import logging +import threading + +from ..._coreutils import str_flag_to_int +from ..._async import get_backoff_time_generator, async_sleep +from ... import classes, flags, enums, structs +from ._mappings import enummap, enum_str2int, enum_int2str + + +cdef extern from "Python.h": + object PyMemoryView_FromMemory(char *mem, Py_ssize_t size, int flags) + object PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len) + int PyBUF_READ + int PyBUF_WRITE + + +logger = logging.getLogger("wgpu") + +# The API is pretty well defined +__all__ = classes.__all__.copy() + +# The 'optional' value is used as the default value for certain optional arguments +optional = None + + +# %% Helpers: handles, strings, memory + + +cdef class _Handle: + """Extension type that holds the native (Dawn) pointer of a GPU object. + + The public classes below inherit from this type *and* from the + corresponding class in ``wgpu.classes``. The pointer is exposed to Python + as ``_internal`` (an int, or None), for compatibility with the other backends. + """ + + cdef void* _ptr + cdef int _kind # a _KIND_X value to select the C function in mixins + + @property + def _internal(self): + if self._ptr == NULL: + return None + return self._ptr + + @_internal.setter + def _internal(self, value): + if value is None: + self._ptr = NULL + else: + self._ptr = value + + +# Kinds of objects, so the mixins can select the right C function without a dict lookup. +cdef enum: + _KIND_OTHER = 0 + _KIND_COMMAND_ENCODER = 1 + _KIND_COMPUTE_PASS = 2 + _KIND_RENDER_PASS = 3 + _KIND_RENDER_BUNDLE_ENCODER = 4 + + +cdef inline void* _ptr(object ob) except NULL: + """Get the native pointer of a GPU object, raising if it's released/destroyed.""" + cdef void* p = (<_Handle?>ob)._ptr + if p == NULL: + _raise_released(ob) + return p + + +cdef inline void* _self_ptr(object self) except NULL: + """Like _ptr(), but without the type check (for self).""" + cdef void* p = (<_Handle>self)._ptr + if p == NULL: + _raise_released(self) + return p + + +cdef inline void* _ptr_or_null(object ob) except? NULL: + if ob is None: + return NULL + return _ptr(ob) + + +cdef int _raise_released(object ob) except -1: + raise RuntimeError(f"The {type(ob).__name__} object has been released.") + + +cdef inline WGPUStringView _null_sv() noexcept: + cdef WGPUStringView v + v.data = NULL + v.length = WGPU_STRLEN + return v + + +cdef inline WGPUStringView _sv(bytes b) noexcept: + """Create a string view for the given bytes. The caller must keep b alive.""" + cdef WGPUStringView v + if b is None: + v.data = NULL + v.length = WGPU_STRLEN + else: + v.data = b + v.length = len(b) + return v + + +cdef inline bytes _encode(object s): + if s is None: + return None + return (s).encode() + + +cdef str _from_sv(WGPUStringView v): + if v.data == NULL: + return "" + if v.length == WGPU_STRLEN: + return (v.data).decode("utf-8", "ignore") + return v.data[: v.length].decode("utf-8", "ignore") + + +cdef class _Arena: + """Owns temporary C memory and Python objects (e.g. encoded strings) that + must stay alive while Dawn consumes a descriptor. Freed when the arena + goes out of scope (i.e. at the end of the calling function). + """ + + cdef void** _blocks + cdef size_t _n + cdef size_t _cap + cdef list _keep + + def __cinit__(self): + self._blocks = NULL + self._n = 0 + self._cap = 0 + self._keep = [] + + def __dealloc__(self): + cdef size_t i + for i in range(self._n): + PyMem_Free(self._blocks[i]) + PyMem_Free(self._blocks) + + cdef void* alloc(self, size_t nbytes) except NULL: + cdef void** new_blocks + cdef void* p + if self._n == self._cap: + self._cap = self._cap * 2 + 8 + new_blocks = PyMem_Calloc(self._cap, sizeof(void*)) + if new_blocks == NULL: + raise MemoryError() + if self._blocks != NULL: + memcpy(new_blocks, self._blocks, self._n * sizeof(void*)) + PyMem_Free(self._blocks) + self._blocks = new_blocks + p = PyMem_Calloc(1, nbytes if nbytes > 0 else 1) + if p == NULL: + raise MemoryError() + self._blocks[self._n] = p + self._n += 1 + return p + + cdef WGPUStringView sv(self, object s) except *: + cdef bytes b + if s is None: + return _null_sv() + b = (s).encode() + self._keep.append(b) + return _sv(b) + + +cdef class _Buffer: + """Acquire a contiguous buffer from an object that supports the buffer protocol.""" + + cdef Py_buffer view + cdef bint acquired + + def __cinit__(self, object data, bint writable=False): + cdef int flags = PyBUF_ANY_CONTIGUOUS + self.acquired = False + PyObject_GetBuffer(data, &self.view, flags) + self.acquired = True + + def __dealloc__(self): + if self.acquired: + PyBuffer_Release(&self.view) + + +cdef int _enum(str enum_name, object value) except? -1: + """Convert an enum string to its int value in Dawn.""" + try: + return enummap[enum_name + "." + value] + except KeyError: + raise ValueError(f"Invalid value for {enum_name}: {value!r}") from None + except TypeError: + raise TypeError(f"{enum_name} must be a str, not {type(value).__name__}") from None + + +def _tuple_from_tuple_or_dict(ob, fields, defaults=()): + """Given a tuple/list/dict, return a tuple. Also checks tuple size.""" + error_msg = "Expected tuple/key/dict with fields: {}" + required = len(fields) - len(defaults) + if isinstance(ob, (list, tuple)): + fields_len = len(fields) + ob_len = len(ob) + if ob_len == fields_len: + return tuple(ob) + elif required <= ob_len < fields_len: + defaults_needed = fields_len - ob_len + return tuple((*ob, *defaults[-defaults_needed:])) + else: + raise ValueError(error_msg.format(", ".join(fields))) + elif isinstance(ob, dict): + if any(key not in fields for key in ob): + raise ValueError("Unexpected key in {}".format(ob)) + try: + return tuple( + ( + ob.get(key, defaults[index - required]) + if index >= required + else ob[key] + ) + for index, key in enumerate(fields) + ) + except KeyError: + raise ValueError(error_msg.format(", ".join(fields))) from None + else: + raise TypeError(error_msg.format(", ".join(fields))) + + +def _tuple_from_extent3d(size): + return _tuple_from_tuple_or_dict( + size, ("width", "height", "depth_or_array_layers"), (1, 1) + ) + + +def _tuple_from_origin3d(destination): + fields = destination.get("origin", (0, 0, 0)) + return _tuple_from_tuple_or_dict(fields, "xyz", (0, 0, 0)) + + +def _tuple_from_color(rgba): + return _tuple_from_tuple_or_dict(rgba, "rgba") + + +def check_struct(struct_name, d): + """Check that all keys in the given dict exist in the corresponding struct.""" + struct_class = getattr(structs, struct_name) + if isinstance(d, struct_class): + pass + elif isinstance(d, dict): + valid_keys = set(struct_class.__annotations__.keys()) + invalid_keys = set(d.keys()).difference(valid_keys) + if invalid_keys: + raise ValueError(f"Invalid keys in {struct_name}: {invalid_keys}") + else: + raise TypeError(f"Expecting {struct_name} or dict, but got {d!r}") + + +def to_snake_case(name, separator="_"): + """Convert a name from camelCase to snake_case.""" + name2 = "" + for c in name: + c2 = c.lower() + if c2 != c and len(name2) > 0: + prev = name2[-1] + if c2 == "d" and prev in "123": + name2 = name2[:-1] + separator + prev + elif prev != separator: + name2 += separator + name2 += c2 + return name2 + + +# %% Error handling +# +# Dawn reports validation errors synchronously via the uncaptured-error +# callback, while the offending API call is running. The callback stores the +# error and sets a C flag; after each API call we check that flag (which costs +# virtually nothing) and raise the error as a Python exception at the call site. + + +cdef bint _error_pending = False +_pending_errors = [] +_error_message_counts = {} + + +cdef void _uncaptured_error_callback( + const WGPUDevice* device, + WGPUErrorType type, + WGPUStringView message, + void* userdata1, + void* userdata2, +) noexcept with gil: + global _error_pending + try: + error_type = enum_int2str["ErrorType"].get(type, "Unknown") + msg = _from_sv(message) + msg = "\n".join(line.rstrip() for line in msg.splitlines()) + _pending_errors.append((error_type, msg)) + _error_pending = True + except BaseException: # no-cover + pass + + +def _log_error(message): + """Log an error message, avoiding spamming the same message over and over.""" + h = hash("".join(c for c in message if not c.isdigit())) + count = _error_message_counts.get(h, 0) + 1 + _error_message_counts[h] = count + if count == 1: + logger.error(message) + elif count < 10: + logger.error(message.splitlines()[0] + f" ({count})") + elif count == 10: + logger.error(message.splitlines()[0] + " (hiding from now)") + + +cdef int _raise_pending_error() except -1: + global _error_pending + errors = list(_pending_errors) + _pending_errors.clear() + _error_pending = False + if not errors: + return 0 + for _, msg in errors[1:]: + _log_error(msg) + error_type, msg = errors[0] + cls = ERROR_TYPES.get(error_type, GPUError) + raise cls(msg) + + +cdef inline int _check() except -1: + """Raise a pending error (that occurred during the last API call).""" + if _error_pending: + _raise_pending_error() + return 0 + + +cdef void _log_pending_errors() noexcept: + """Log pending errors instead of raising them (e.g. in release methods).""" + global _error_pending + if _error_pending: + _error_pending = False + try: + errors = list(_pending_errors) + _pending_errors.clear() + for _, msg in errors: + _log_error(msg) + except BaseException: # no-cover + pass + + +cdef void _device_lost_callback( + const WGPUDevice* device, + WGPUDeviceLostReason reason, + WGPUStringView message, + void* userdata1, + void* userdata2, +) noexcept with gil: + # Note that this may be called from another thread. + try: + promise = _promise_from_userdata(userdata1) + reason_str = enum_int2str["DeviceLostReason"].get(reason, "unknown") + msg = _from_sv(message) + if reason not in ( + WGPUDeviceLostReason_Destroyed, # explicit destroy is not an error + WGPUDeviceLostReason_CallbackCancelled, # e.g. at shutdown + ): + _log_error(f"The WGPU device was lost ({reason_str}):\n{msg}") + promise._wgpu_set_input(GPUDeviceLostInfo(reason_str, msg)) + except BaseException: # no-cover + pass + + +cdef void _logging_callback( + WGPULoggingType type, WGPUStringView message, void* userdata1, void* userdata2 +) noexcept with gil: + try: + msg = _from_sv(message) + if type == WGPULoggingType_Error: + logger.error(msg) + elif type == WGPULoggingType_Warning: + logger.warning(msg) + elif type == WGPULoggingType_Info: + logger.info(msg) + else: + logger.debug(msg) + except BaseException: # no-cover + pass + + +# %% Instance and events + + +cdef WGPUInstance _instance = NULL + + +cdef WGPUInstance _get_instance() except NULL: + """Get the global Dawn instance.""" + global _instance + cdef WGPUInstanceDescriptor desc + cdef WGPUInstanceFeatureName features[2] + cdef size_t n = 0 + if _instance == NULL: + desc = WGPU_INSTANCE_DESCRIPTOR_INIT + # TimedWaitAny allows us to block on futures (sync_wait) + features[n] = WGPUInstanceFeatureName_TimedWaitAny + n += 1 + if wgpuHasInstanceFeature(WGPUInstanceFeatureName_ShaderSourceSPIRV): + features[n] = WGPUInstanceFeatureName_ShaderSourceSPIRV + n += 1 + desc.requiredFeatureCount = n + desc.requiredFeatures = features + _instance = wgpuCreateInstance(&desc) + if _instance == NULL: + raise RuntimeError("Could not create Dawn WebGPU instance.") + return _instance + + +def get_instance_address(): + """Get the address of the global WGPUInstance (for interop).""" + return _get_instance() + + +cdef int _wait_future(uint64_t future_id) except -1: + """Block until the future completes, with the GIL released.""" + cdef WGPUFutureWaitInfo info + cdef WGPUWaitStatus status + cdef WGPUInstance instance = _get_instance() + info.future.id = future_id + info.completed = False + while True: + with nogil: + status = wgpuInstanceWaitAny(instance, 1, &info, 100_000_000) # 0.1 s + if status == WGPUWaitStatus_Success or info.completed: + break + elif status == WGPUWaitStatus_TimedOut: + continue # allows KeyboardInterrupt to come through between waits + else: + raise RuntimeError(f"Waiting for future failed with status {status}") + _check() + return 0 + + +def process_events(): + """Process pending Dawn events, which may resolve pending GPUPromises. + + This is called automatically when awaiting a promise, and by the + event pump when callbacks (via ``promise.then()``) are used. + """ + wgpuInstanceProcessEvents(_get_instance()) + _check() + + +class _EventPump: + """Calls ``process_events()`` on the event loop's thread while promises are pending. + + Dawn objects are not thread-safe (unless the ImplicitDeviceSynchronization + feature is used), so we never call into Dawn from a background thread. + Instead, a lightweight thread periodically schedules a call to + ``process_events()`` in the event loop, using its ``call_soon_threadsafe()``. + """ + + def __init__(self): + self._lock = threading.Lock() + self._promises = set() + self._thread = None + + def add(self, promise): + if promise._call_soon_threadsafe is None: + return + with self._lock: + self._promises.add(promise) + if self._thread is None: + self._thread = threading.Thread(target=self._run, daemon=True) + self._thread.start() + + def _run(self): + sleep_gen = get_backoff_time_generator() + while True: + with self._lock: + self._promises = {p for p in self._promises if p._state == "pending"} + if not self._promises: + self._thread = None + return + call_soons = {p._call_soon_threadsafe for p in self._promises} + for call_soon in call_soons: + try: + call_soon(_process_events_safe) + except Exception: + pass # e.g. loop is closed + time.sleep(max(0.001, next(sleep_gen))) + + +def _process_events_safe(): + try: + process_events() + except Exception as err: + _log_error(str(err)) + + +_event_pump = _EventPump() + + +class GPUPromise(classes.GPUPromise): + """GPUPromise for Dawn futures. + + ``sync_wait()`` blocks on the future via ``wgpuInstanceWaitAny`` (with the + GIL released). Awaiting polls ``wgpuInstanceProcessEvents``. + """ + + _future_id = 0 + + def _set_future(self, uint64_t future_id): + self._future_id = future_id + _event_pump.add(self) + + def _sync_wait(self): + if self._future_id: + _wait_future(self._future_id) + if self._state == "pending": + # Should not happen, but avoid hanging forever + raise RuntimeError(f"Promise {self._title!r} did not resolve.") + + def __await__(self): + if self._state == "pending" and self._future_id: + + async def awaiter(): + sleep_gen = get_backoff_time_generator() + while self._state == "pending": + process_events() + if self._state != "pending": + break + await async_sleep(next(sleep_gen)) + return self._resolve() + + return (yield from awaiter().__await__()) + return (yield from super().__await__()) + + +cdef inline void* _promise_userdata(object promise): + """Get a pointer to pass as userdata. The callback must call _promise_from_userdata.""" + Py_INCREF(promise) + return promise + + +cdef inline object _promise_from_userdata(void* userdata): + promise = userdata + Py_DECREF(promise) # balance the incref in _promise_userdata + return promise + + +cdef void _request_adapter_callback( + WGPURequestAdapterStatus status, + WGPUAdapter adapter, + WGPUStringView message, + void* userdata1, + void* userdata2, +) noexcept with gil: + try: + promise = _promise_from_userdata(userdata1) + if status != WGPURequestAdapterStatus_Success or adapter == NULL: + msg = _from_sv(message) + promise._wgpu_set_error( + RuntimeError(f"Request adapter failed ({status}): {msg}") + ) + else: + promise._wgpu_set_input(adapter) + except BaseException as err: # no-cover + _log_error(f"Error in request_adapter callback: {err}") + + +cdef void _request_device_callback( + WGPURequestDeviceStatus status, + WGPUDevice device, + WGPUStringView message, + void* userdata1, + void* userdata2, +) noexcept with gil: + try: + promise = _promise_from_userdata(userdata1) + if status != WGPURequestDeviceStatus_Success or device == NULL: + msg = _from_sv(message) + promise._wgpu_set_error( + RuntimeError(f"Request device failed ({status}): {msg}") + ) + else: + promise._wgpu_set_input(device) + except BaseException as err: # no-cover + _log_error(f"Error in request_device callback: {err}") + + +cdef void _buffer_map_callback( + WGPUMapAsyncStatus status, + WGPUStringView message, + void* userdata1, + void* userdata2, +) noexcept with gil: + try: + promise = _promise_from_userdata(userdata1) + if status != WGPUMapAsyncStatus_Success: + msg = _from_sv(message) + promise._wgpu_set_error( + RuntimeError(f"Could not map buffer ({status} : {msg}).") + ) + else: + promise._wgpu_set_input(None) + except BaseException as err: # no-cover + _log_error(f"Error in buffer map callback: {err}") + + +cdef void _queue_work_done_callback( + WGPUQueueWorkDoneStatus status, + WGPUStringView message, + void* userdata1, + void* userdata2, +) noexcept with gil: + try: + promise = _promise_from_userdata(userdata1) + if status == WGPUQueueWorkDoneStatus_Success: + promise._wgpu_set_input(None) + else: + msg = _from_sv(message) + promise._wgpu_set_error( + RuntimeError(f"Queue work done status: {status} {msg}") + ) + except BaseException as err: # no-cover + _log_error(f"Error in queue work done callback: {err}") + + +cdef void _compilation_info_callback( + WGPUCompilationInfoRequestStatus status, + const WGPUCompilationInfo* info, + void* userdata1, + void* userdata2, +) noexcept with gil: + cdef size_t i + try: + promise = _promise_from_userdata(userdata1) + if status != WGPUCompilationInfoRequestStatus_Success or info == NULL: + promise._wgpu_set_error( + RuntimeError(f"Could not get compilation info ({status}).") + ) + return + messages = [] + type_map = enum_int2str["CompilationMessageType"] + for i in range(info.messageCount): + m = info.messages[i] + messages.append( + GPUCompilationMessage( + _from_sv(m.message), + type_map.get(m.type, "info"), + m.lineNum, + m.linePos, + m.offset, + m.length, + ) + ) + promise._wgpu_set_input(GPUCompilationInfo(messages)) + except BaseException as err: # no-cover + _log_error(f"Error in compilation info callback: {err}") + + +cdef void _create_compute_pipeline_callback( + WGPUCreatePipelineAsyncStatus status, + WGPUComputePipeline pipeline, + WGPUStringView message, + void* userdata1, + void* userdata2, +) noexcept with gil: + try: + promise = _promise_from_userdata(userdata1) + if status != WGPUCreatePipelineAsyncStatus_Success: + msg = _from_sv(message) + promise._wgpu_set_error( + GPUPipelineError(f"create_compute_pipeline failed ({status}): {msg}", {}) + ) + else: + promise._wgpu_set_input(pipeline) + except BaseException as err: # no-cover + _log_error(f"Error in create pipeline callback: {err}") + + +cdef void _create_render_pipeline_callback( + WGPUCreatePipelineAsyncStatus status, + WGPURenderPipeline pipeline, + WGPUStringView message, + void* userdata1, + void* userdata2, +) noexcept with gil: + try: + promise = _promise_from_userdata(userdata1) + if status != WGPUCreatePipelineAsyncStatus_Success: + msg = _from_sv(message) + promise._wgpu_set_error( + GPUPipelineError(f"create_render_pipeline failed ({status}): {msg}", {}) + ) + else: + promise._wgpu_set_input(pipeline) + except BaseException as err: # no-cover + _log_error(f"Error in create pipeline callback: {err}") + + +cdef void _pop_error_scope_callback( + WGPUPopErrorScopeStatus status, + WGPUErrorType type, + WGPUStringView message, + void* userdata1, + void* userdata2, +) noexcept with gil: + try: + promise = _promise_from_userdata(userdata1) + if status != WGPUPopErrorScopeStatus_Success: + msg = _from_sv(message) + promise._wgpu_set_error(RuntimeError(f"pop_error_scope failed: {msg}")) + elif type == WGPUErrorType_NoError: + promise._wgpu_set_input(None) + else: + error_type = enum_int2str["ErrorType"].get(type, "Unknown") + cls = ERROR_TYPES.get(error_type, GPUError) + promise._wgpu_set_input(cls(_from_sv(message))) + except BaseException as err: # no-cover + _log_error(f"Error in pop_error_scope callback: {err}") + + +# %% Limits and features + + +cdef dict _get_limits(void* ptr, bint is_device): + cdef WGPULimits c_limits = WGPU_LIMITS_INIT + cdef WGPUStatus status + if is_device: + status = wgpuDeviceGetLimits(ptr, &c_limits) + else: + status = wgpuAdapterGetLimits(ptr, &c_limits) + _check() + if status != WGPUStatus_Success: + raise RuntimeError("Error getting limits") + return dict(sorted(limits_to_dict(&c_limits).items())) + + +cdef set _get_features(void* ptr, bint is_device): + cdef WGPUSupportedFeatures c_features + cdef size_t i + memset(&c_features, 0, sizeof(c_features)) + if is_device: + wgpuDeviceGetFeatures(ptr, &c_features) + else: + wgpuAdapterGetFeatures(ptr, &c_features) + _check() + int2str = enum_int2str["FeatureName"] + features = set() + for i in range(c_features.featureCount): + name = int2str.get(c_features.features[i], None) + if name is not None: + features.add(name) + wgpuSupportedFeaturesFreeMembers(c_features) + return features + + +def _feature_name_to_int(f): + if not isinstance(f, str): + raise TypeError("Features must be given as str.") + f = f.replace("_", "-") + if f.lower() != f: + f = to_snake_case(f, "-") + i = enummap.get(f"FeatureName.{f}", None) + if i is None: + i = enum_str2int["FeatureName"].get(f, None) + if i is None: + raise KeyError(f"Unknown feature: '{f}'") + return i + + +# %% The API + + +cdef WGPUBackendType _get_forced_backend() except? WGPUBackendType_Undefined: + force_backend = os.getenv("WGPU_BACKEND_TYPE", "").strip() + if not force_backend: + return WGPUBackendType_Undefined + backends = enum_str2int["BackendType"] + # Be case-insensitive + lower_map = {k.lower(): v for k, v in backends.items()} + value = lower_map.get(force_backend.lower(), None) + if value is None: + logger.warning( + f"Invalid value for WGPU_BACKEND_TYPE: '{force_backend}'.\nValid values are: {list(backends.keys())}" + ) + return WGPUBackendType_Undefined + logger.warning(f"Forcing backend: {force_backend} ({value})") + return value + + +class GPU(classes.GPU): + def request_adapter_async( + self, + *, + feature_level: str = "core", + power_preference: enums.PowerPreferenceEnum | None = None, + force_fallback_adapter: bool = False, + canvas=None, + ) -> GPUPromise[GPUAdapter]: + """Create a `GPUAdapter`, the object that represents an abstract wgpu + implementation, from which one can request a `GPUDevice`. + + This is the implementation based on Dawn. + + Arguments: + feature_level (str): "core" or "compatibility". + power_preference (PowerPreference): "high-performance" or "low-power". + force_fallback_adapter (bool): whether to use a (probably CPU-based) + fallback adapter. + canvas : The canvas or context that the adapter should be able to render to. This can typically + be left to None. If given, it must be a ``GPUCanvasContext`` or ``RenderCanvas``. + """ + if adapter_name := os.getenv("WGPUPY_WGPU_ADAPTER_NAME"): + adapters = self._enumerate_adapters() + adapters = [a for a in adapters if adapter_name in a.summary] + if not adapters: + raise ValueError(f"Adapter with name '{adapter_name}' not found.") + promise = GPUPromise("adapter by name", None) + promise._wgpu_set_input(adapters[0]) + return promise + + cdef WGPUBackendType backend = _get_forced_backend() + return self._request_adapter( + feature_level, power_preference, force_fallback_adapter, canvas, backend + ) + + def _request_adapter( + self, feature_level, power_preference, force_fallback_adapter, canvas, int backend + ): + cdef WGPURequestAdapterOptions opts = WGPU_REQUEST_ADAPTER_OPTIONS_INIT + cdef WGPURequestAdapterCallbackInfo cb = WGPU_REQUEST_ADAPTER_CALLBACK_INFO_INIT + cdef WGPUFuture future + cdef WGPUInstance instance = _get_instance() + + if feature_level == "compatibility": + opts.featureLevel = WGPUFeatureLevel_Compatibility + elif feature_level in ("core", None): + opts.featureLevel = WGPUFeatureLevel_Core + else: + raise ValueError(f"Invalid feature_level: {feature_level!r}") + opts.powerPreference = _enum( + "PowerPreference", power_preference or "high-performance" + ) + opts.forceFallbackAdapter = bool(force_fallback_adapter) + opts.backendType = backend + + if canvas is not None: + surface_id = find_surface_id_from_canvas(canvas) + if surface_id: + opts.compatibleSurface = surface_id + + promise = GPUPromise("request_adapter", self._create_adapter) + cb.mode = WGPUCallbackMode_AllowProcessEvents + cb.callback = _request_adapter_callback + cb.userdata1 = _promise_userdata(promise) + future = wgpuInstanceRequestAdapter(instance, &opts, cb) + _check() + promise._set_future(future.id) + # Dawn resolves this (almost) immediately. Make it effectively sync, + # like the wgpu-native backend, so that sync and async code paths match. + _wait_future(future.id) + return promise + + def enumerate_adapters_async(self) -> GPUPromise[list[GPUAdapter]]: + """Get a list of adapter objects available on the current system. + This is the implementation based on Dawn. + """ + result = self._enumerate_adapters() + promise = GPUPromise("enumerate_adapters", None) + promise._wgpu_set_input(result) + return promise + + def _enumerate_adapters(self): + # The webgpu.h API has no way to enumerate adapters, so we request an + # adapter for each backend and power preference, and de-duplicate. + adapters = [] + seen = set() + backend_names = [ + "Vulkan", + "Metal", + "D3D12", + "D3D11", + "OpenGL", + "OpenGLES", + ] + for name in backend_names: + backend = enum_str2int["BackendType"].get(name) + if backend is None: + continue + for pref in ("high-performance", "low-power"): + try: + promise = self._request_adapter("core", pref, False, None, backend) + adapter = promise.sync_wait() + except Exception: + continue + key = (adapter.summary, adapter.info["backend_type"]) + if key not in seen: + seen.add(key) + adapters.append(adapter) + return adapters + + def _create_adapter(self, adapter_id): + cdef WGPUAdapter adapter = adapter_id + cdef WGPUAdapterInfo c_info = WGPU_ADAPTER_INFO_INIT + cdef WGPUStatus status = wgpuAdapterGetInfo(adapter, &c_info) + _check() + if status != WGPUStatus_Success: + raise RuntimeError("Error calling wgpuAdapterGetInfo") + + adapter_info_data = { + # Spec + "vendor": _from_sv(c_info.vendor), + "architecture": _from_sv(c_info.architecture), + "device": _from_sv(c_info.device), + "description": _from_sv(c_info.description), + "subgroup_min_size": c_info.subgroupMinSize, + "subgroup_max_size": c_info.subgroupMaxSize, + # Extra + "vendor_id": c_info.vendorID, + "device_id": c_info.deviceID, + "adapter_type": enum_int2str["AdapterType"].get( + c_info.adapterType, "unknown" + ), + "backend_type": enum_int2str["BackendType"].get( + c_info.backendType, "unknown" + ), + } + wgpuAdapterInfoFreeMembers(c_info) + adapter_info = GPUAdapterInfo(adapter_info_data) + + limits = _get_limits(adapter, False) + features = _get_features(adapter, False) + return GPUAdapter(adapter_id, features, limits, adapter_info) + + def get_canvas_context(self, present_info: dict) -> GPUCanvasContext: + """Get the GPUCanvasContext object for the appropriate backend. + + Note that the recommended way to get a context is to instead use the ``rendercanvas`` library. + """ + return GPUCanvasContext(present_info) + + @property + def wgsl_language_features(self): + """A set of strings representing the WGSL language extensions supported by all adapters.""" + cdef WGPUSupportedWGSLLanguageFeatures c_features + cdef size_t i + memset(&c_features, 0, sizeof(c_features)) + wgpuInstanceGetWGSLLanguageFeatures(_get_instance(), &c_features) + names = set() + for i in range(c_features.featureCount): + names.add(c_features.features[i]) + wgpuSupportedWGSLLanguageFeaturesFreeMembers(c_features) + return names + + +# Instantiate API entrypoint +gpu = GPU() + + +def find_surface_id_from_canvas(canvas_or_context): + """Try to get the surface_id from a RenderCanvas, rendercanvas context, or GPUCanvasContect.""" + ob = canvas_or_context + surface_id = None + if hasattr(ob, "get_context"): + ob = ob.get_context("wgpu") + for attr in ["_wgpu_context"]: + if hasattr(ob, attr): + ob = getattr(ob, attr) + if hasattr(ob, "_surface_id"): + surface_id = ob._surface_id + return surface_id + + +def get_surface_id_from_info(present_info): + """Get an id (address) representing the surface to render to. The way to + obtain this id differs per platform and GUI toolkit. + """ + cdef WGPUSurfaceDescriptor desc = WGPU_SURFACE_DESCRIPTOR_INIT + cdef WGPUSurfaceSourceXlibWindow xlib = WGPU_SURFACE_SOURCE_XLIB_WINDOW_INIT + cdef WGPUSurfaceSourceWaylandSurface wayland = WGPU_SURFACE_SOURCE_WAYLAND_SURFACE_INIT + cdef WGPUSurfaceSourceXCBWindow xcb = WGPU_SURFACE_SOURCE_XCB_WINDOW_INIT + cdef WGPUSurfaceSourceWindowsHWND hwnd = WGPU_SURFACE_SOURCE_WINDOWS_HWND_INIT + cdef WGPUSurfaceSourceMetalLayer metal = WGPU_SURFACE_SOURCE_METAL_LAYER_INIT + cdef WGPUSurface surface + + if sys.platform.startswith("win"): # no-cover + import ctypes + + hwnd.hinstance = ctypes.windll.kernel32.GetModuleHandleW(None) + hwnd.hwnd = int(present_info["window"]) + desc.nextInChain = &hwnd + elif sys.platform.startswith("darwin"): # no-cover + metal_layer = _get_metal_layer(present_info) + metal.layer = metal_layer + desc.nextInChain = &metal + elif sys.platform.startswith("linux"): # no-cover + platform = present_info.get("platform", "x11") + if platform == "x11": + xlib.display = present_info["display"] + xlib.window = int(present_info["window"]) + desc.nextInChain = &xlib + elif platform == "wayland": + wayland.display = present_info["display"] + wayland.surface = present_info["window"] + desc.nextInChain = &wayland + elif platform == "xcb": + xcb.connection = present_info["connection"] + xcb.window = int(present_info["window"]) + desc.nextInChain = &xcb + else: + raise RuntimeError(f"Unexpected Linux surface platform '{platform}'.") + else: # no-cover + raise RuntimeError("Cannot get surface id: unsupported platform.") + + surface = wgpuInstanceCreateSurface(_get_instance(), &desc) + _check() + if surface == NULL: + raise RuntimeError("Could not create surface.") + return surface + + +def _get_metal_layer(present_info): # no-cover + import ctypes + from rubicon.objc.api import ObjCInstance, ObjCClass + + window = ctypes.c_void_p(present_info["window"]) + cw = ObjCInstance(window) + try: + cv = cw.contentView + except AttributeError: + wx_view = ObjCInstance(window) + if not len(wx_view.subviews): + new_view = ObjCClass("NSView").alloc().initWithFrame(wx_view.bounds) + new_view.setAutoresizingMask(18) + wx_view.setAutoresizesSubviews(True) + wx_view.addSubview(new_view) + cv = wx_view.subviews[0] + if cv.layer and cv.layer.isKindOfClass(ObjCClass("CAMetalLayer")): + metal_layer = cv.layer + else: + metal_layer = ObjCClass("CAMetalLayer").layer() + cv.setLayer(metal_layer) + cv.setWantsLayer(True) + return metal_layer.ptr.value + + +class GPUCanvasContext(classes.GPUCanvasContext): + # The context must first be configured. Then a texture can be obtained, + # which can be written to, and then it can be presented. + + _surface_id = None + _wgpu_config = None + + def __init__(self, present_info: dict): + super().__init__(present_info) + self._surface_id = get_surface_id_from_info(present_info) + self._number_of_successive_unsuccesful_textures = 0 + + def _get_capabilities_screen(self, adapter): + cdef WGPUSurfaceCapabilities c_caps = WGPU_SURFACE_CAPABILITIES_INIT + cdef WGPUStatus status + cdef size_t i + surface_id = self._surface_id + assert surface_id + status = wgpuSurfaceGetCapabilities( + surface_id, _ptr(adapter), &c_caps + ) + _check() + if status != WGPUStatus_Success: + raise RuntimeError("Error calling wgpuSurfaceGetCapabilities") + + capabilities = {"usages": c_caps.usages} + formats = [] + for i in range(c_caps.formatCount): + str_val = enum_int2str["TextureFormat"].get(c_caps.formats[i]) + if str_val: + formats.append(str_val) + capabilities["formats"] = formats or [ + enums.TextureFormat.bgra8unorm_srgb, + enums.TextureFormat.bgra8unorm, + ] + alpha_modes = [] + for i in range(c_caps.alphaModeCount): + str_val = enum_int2str["CompositeAlphaMode"].get(c_caps.alphaModes[i]) + if str_val: + alpha_modes.append(str_val.lower()) + capabilities["alpha_modes"] = alpha_modes or [enums.CanvasAlphaMode.opaque] + present_modes = [] + for i in range(c_caps.presentModeCount): + str_val = enum_int2str["PresentMode"].get(c_caps.presentModes[i]) + if str_val: + present_modes.append(str_val.lower()) + capabilities["present_modes"] = present_modes or ["fifo"] + wgpuSurfaceCapabilitiesFreeMembers(c_caps) + return capabilities + + def _configure_screen( + self, + *, + device, + format, + usage, + view_formats, + color_space, + tone_mapping, + alpha_mode, + ): + capabilities = self._get_capabilities(device.adapter) + check_struct("CanvasToneMapping", tone_mapping) + + if self._present_info.get("vsync", True): + present_mode_pref = ["fifo", "mailbox"] + else: + present_mode_pref = ["immediate", "mailbox", "fifo"] + present_modes = [ + p for p in present_mode_pref if p in capabilities["present_modes"] + ] + present_mode = (present_modes or capabilities["present_modes"])[0] + + alpha_mode_map = { + "auto": WGPUCompositeAlphaMode_Auto, + "opaque": WGPUCompositeAlphaMode_Opaque, + "premultiplied": WGPUCompositeAlphaMode_Premultiplied, + "unpremultiplied": WGPUCompositeAlphaMode_Unpremultiplied, + "inherit": WGPUCompositeAlphaMode_Inherit, + } + present_mode_map = { + "fifo": WGPUPresentMode_Fifo, + "fiforelaxed": WGPUPresentMode_FifoRelaxed, + "immediate": WGPUPresentMode_Immediate, + "mailbox": WGPUPresentMode_Mailbox, + } + self._wgpu_config = { + "device": device, + "format": _enum("TextureFormat", format), + "usage": int(usage), + "view_formats": [_enum("TextureFormat", f) for f in view_formats], + "alpha_mode": alpha_mode_map[alpha_mode], + "present_mode": present_mode_map[present_mode], + "width": self._physical_size[0], + "height": self._physical_size[1], + } + self._configure_screen_real() + + def _configure_screen_real(self): + cdef WGPUSurfaceConfiguration config = WGPU_SURFACE_CONFIGURATION_INIT + cdef _Arena arena = _Arena() + cdef WGPUTextureFormat* view_formats + cdef size_t i + self._drop_texture() + c = self._wgpu_config + if self._surface_id and c["width"] > 0 and c["height"] > 0: + config.device = _ptr(c["device"]) + config.format = c["format"] + config.usage = c["usage"] + config.width = c["width"] + config.height = c["height"] + config.alphaMode = c["alpha_mode"] + config.presentMode = c["present_mode"] + n = len(c["view_formats"]) + view_formats = arena.alloc(n * sizeof(WGPUTextureFormat)) + for i in range(n): + view_formats[i] = c["view_formats"][i] + config.viewFormatCount = n + config.viewFormats = view_formats + wgpuSurfaceConfigure(self._surface_id, &config) + _check() + else: + c["width"] = 0 + + def _unconfigure_screen(self): + if self._surface_id: + wgpuSurfaceUnconfigure(self._surface_id) + _check() + self._wgpu_config = None + + def _create_texture_screen(self): + cdef WGPUSurfaceTexture surface_texture = WGPU_SURFACE_TEXTURE_INIT + cdef WGPUSurface surface + cdef WGPUTexture texture + if self._surface_id is None: + raise RuntimeError("Looks like the CanvasContext is already destroyed.") + if self._wgpu_config is None: + raise RuntimeError( + "Cannot get surface texture because the CanvasContext has not yet been configured." + ) + surface = self._surface_id + + if self._has_new_size: + self._has_new_size = False + new_size = self._physical_size + old_size = (self._wgpu_config["width"], self._wgpu_config["height"]) + if new_size[0] <= 0 or new_size[1] <= 0: + raise RuntimeError("Cannot get texture for a canvas with zero pixels.") + if new_size != old_size: + self._wgpu_config["width"] = new_size[0] + self._wgpu_config["height"] = new_size[1] + self._configure_screen_real() + + wgpuSurfaceGetCurrentTexture(surface, &surface_texture) + _check() + status = surface_texture.status + + if status == WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal: + self._number_of_successive_unsuccesful_textures = 0 + elif status in ( + WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal, + WGPUSurfaceGetCurrentTextureStatus_Outdated, + WGPUSurfaceGetCurrentTextureStatus_Lost, + ): + if surface_texture.texture != NULL: + wgpuTextureRelease(surface_texture.texture) + surface_texture.texture = NULL + self._configure_screen_real() + wgpuSurfaceGetCurrentTexture(surface, &surface_texture) + _check() + status = surface_texture.status + + if status != WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal: + status_str = enum_int2str["SurfaceGetCurrentTextureStatus"].get( + status, "Unknown" + ) + self._number_of_successive_unsuccesful_textures += 1 + n = self._number_of_successive_unsuccesful_textures + if (n % 100 == 0) or n in (5, 12, 25, 50): + logger.warning( + f"No succesful surface texture obtained for {n} frames: {status_str!r}" + ) + if status != WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal: + if surface_texture.texture != NULL: + wgpuTextureRelease(surface_texture.texture) + raise classes.DrawCancelled(f"{status_str} ({status})") + + texture = surface_texture.texture + if texture == NULL: + raise RuntimeError("Cannot get surface texture (no texture)") + + tex_info = { + "size": ( + wgpuTextureGetWidth(texture), + wgpuTextureGetHeight(texture), + wgpuTextureGetDepthOrArrayLayers(texture), + ), + "mip_level_count": wgpuTextureGetMipLevelCount(texture), + "sample_count": wgpuTextureGetSampleCount(texture), + "dimension": enum_int2str["TextureDimension"][wgpuTextureGetDimension(texture)], + "format": enum_int2str["TextureFormat"][wgpuTextureGetFormat(texture)], + "usage": wgpuTextureGetUsage(texture), + } + device = self._config["device"] + return GPUTexture("", texture, device, tex_info) + + def _present_screen(self): + cdef WGPUStatus status = wgpuSurfacePresent(self._surface_id) + _log_pending_errors() + if status != WGPUStatus_Success: + logger.warning("wgpuSurfacePresent failed") + + def _release(self): + self._drop_texture() + if self._surface_id is not None: + self._surface_id, surface_id = None, self._surface_id + if surface_id: + wgpuSurfaceRelease(surface_id) + + +class GPUObjectBase(classes.GPUObjectBase, _Handle): + _handle_kind = _KIND_OTHER + + def __init__(self, label, internal, device, *args): + super().__init__(label, internal, device, *args) + (<_Handle>self)._kind = self._handle_kind + + def _release(self): + cdef void* p = (<_Handle>self)._ptr + if p != NULL: + (<_Handle>self)._ptr = NULL + self._release_ptr(p) + _log_pending_errors() + + def _release_ptr(self, ptr): + raise NotImplementedError() + + +class GPUAdapterInfo(classes.GPUAdapterInfo): + pass + + +class GPUAdapter(classes.GPUAdapter, _Handle): + def request_device_async( + self, + *, + label: str = "", + required_features=(), + required_limits=None, + default_queue=None, + ) -> GPUPromise[GPUDevice]: + required_limits = {} if required_limits is None else required_limits + if default_queue: + check_struct("QueueDescriptor", default_queue) + return self._request_device_async( + label, required_features, required_limits, default_queue + ) + + def _request_device_async(self, label, required_features, required_limits, default_queue): + cdef WGPUDeviceDescriptor desc = WGPU_DEVICE_DESCRIPTOR_INIT + cdef WGPULimits c_limits = WGPU_LIMITS_INIT + cdef WGPURequestDeviceCallbackInfo cb = WGPU_REQUEST_DEVICE_CALLBACK_INFO_INIT + cdef WGPUFeatureName* c_features + cdef _Arena arena = _Arena() + cdef WGPUFuture future + cdef size_t i + + # ---- Features + assert isinstance(required_features, (tuple, list, set)) + feature_ints = sorted({_feature_name_to_int(f) for f in required_features}) + c_features = arena.alloc( + len(feature_ints) * sizeof(WGPUFeatureName) + ) + for i in range(len(feature_ints)): + c_features[i] = feature_ints[i] + + # ---- Limits: like the wgpu-native backend, default to the adapter's limits + def canonicalize_limit_name(name): + if name in self._limits: + return name + if "_" in name: + alt_name = name.replace("_", "-") + if alt_name in self._limits: + return alt_name + alt_name = to_snake_case(name, "-") + if alt_name in self._limits: + return alt_name + raise KeyError(f"Unknown limit name '{name}'") + + limits = dict(self._limits) + if required_limits: + assert isinstance(required_limits, dict) + for key, value in required_limits.items(): + key = canonicalize_limit_name(key) + if value is not None: + limits[key] = value + dict_to_limits(limits, &c_limits) + + # ---- Descriptor + desc.label = arena.sv(label) + desc.requiredFeatureCount = len(feature_ints) + desc.requiredFeatures = c_features + desc.requiredLimits = &c_limits + desc.defaultQueue.label = arena.sv("default_queue") + lost_promise = GPUPromise("device.lost", None) + desc.deviceLostCallbackInfo.mode = WGPUCallbackMode_AllowSpontaneous + desc.deviceLostCallbackInfo.callback = _device_lost_callback + desc.deviceLostCallbackInfo.userdata1 = _promise_userdata(lost_promise) + desc.uncapturedErrorCallbackInfo.callback = _uncaptured_error_callback + + def handler(device_id): + device = self._create_device(label, device_id) + device._lost_promise = lost_promise + return device + + promise = GPUPromise("request_device", handler) + cb.mode = WGPUCallbackMode_AllowProcessEvents + cb.callback = _request_device_callback + cb.userdata1 = _promise_userdata(promise) + future = wgpuAdapterRequestDevice(_self_ptr(self), &desc, cb) + _check() + promise._set_future(future.id) + _wait_future(future.id) + return promise + + def _create_device(self, label, device_id): + cdef WGPUDevice device = device_id + cdef WGPULoggingCallbackInfo log_cb = WGPU_LOGGING_CALLBACK_INFO_INIT + log_cb.callback = _logging_callback + wgpuDeviceSetLoggingCallback(device, log_cb) + limits = _get_limits(device, True) + features = _get_features(device, True) + queue_id = wgpuDeviceGetQueue(device) + queue = GPUQueue("", queue_id, None) + return GPUDevice(label, device_id, self, features, limits, queue) + + def _release(self): + cdef void* p = (<_Handle>self)._ptr + if p != NULL: + (<_Handle>self)._ptr = NULL + wgpuAdapterRelease(p) + + +class GPUDevice(classes.GPUDevice, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuDeviceRelease(ptr) + + def _poll(self, block=False): + # Internal function, for compatibility with the wgpu-native backend + if (<_Handle>self)._ptr != NULL: + wgpuDeviceTick((<_Handle>self)._ptr) + process_events() + if block: + self.queue.on_submitted_work_done_sync() + + def _poll_wait(self): + self._poll(True) + + def _get_lost_async(self) -> GPUPromise[GPUDeviceLostInfo]: + return self._lost_promise + + def create_buffer( + self, + *, + label: str = "", + size: int, + usage: flags.BufferUsageFlags, + mapped_at_creation: bool = False, + ) -> GPUBuffer: + return self._create_buffer(label, int(size), usage, bool(mapped_at_creation)) + + def _create_buffer(self, label, uint64_t size, usage, bint mapped_at_creation): + cdef WGPUBufferDescriptor desc = WGPU_BUFFER_DESCRIPTOR_INIT + cdef WGPUBuffer buffer + if isinstance(usage, str): + usage = str_flag_to_int(flags.BufferUsage, usage) + label_b = _encode(label) + desc.label = _sv(label_b) + desc.size = size + desc.usage = int(usage) + desc.mappedAtCreation = mapped_at_creation + buffer = wgpuDeviceCreateBuffer(_self_ptr(self), &desc) + _check() + map_state = ( + enums.BufferMapState.mapped + if mapped_at_creation + else enums.BufferMapState.unmapped + ) + return GPUBuffer(label, buffer, self, size, int(usage), map_state) + + def create_texture( + self, + *, + label: str = "", + size, + mip_level_count: int = 1, + sample_count: int = 1, + dimension: enums.TextureDimensionEnum = "2d", + format: enums.TextureFormatEnum, + usage: flags.TextureUsageFlags, + view_formats=(), + texture_binding_view_dimension=None, + ) -> GPUTexture: + cdef WGPUTextureDescriptor desc = WGPU_TEXTURE_DESCRIPTOR_INIT + cdef WGPUTextureBindingViewDimension view_dim_desc = WGPU_TEXTURE_BINDING_VIEW_DIMENSION_INIT + cdef _Arena arena = _Arena() + cdef WGPUTextureFormat* c_view_formats + cdef WGPUTexture texture + cdef size_t i + + if isinstance(usage, str): + usage = str_flag_to_int(flags.TextureUsage, usage) + usage = int(usage) + size = _tuple_from_extent3d(size) + if not isinstance(dimension, str): + raise TypeError( + f"Texture dimension must be a str, not {dimension.__class__.__name__}" + ) + mip_level_count = int(mip_level_count or 1) + sample_count = int(sample_count or 1) + + n = len(view_formats) + c_view_formats = arena.alloc(n * sizeof(WGPUTextureFormat)) + for i in range(n): + c_view_formats[i] = _enum("TextureFormat", view_formats[i]) + + desc.label = arena.sv(label) + desc.usage = usage + desc.dimension = _enum("TextureDimension", dimension) + desc.size.width = size[0] + desc.size.height = size[1] + desc.size.depthOrArrayLayers = size[2] + desc.format = _enum("TextureFormat", format) + desc.mipLevelCount = mip_level_count + desc.sampleCount = sample_count + desc.viewFormatCount = n + desc.viewFormats = c_view_formats + if texture_binding_view_dimension is not None: + view_dim_desc.textureBindingViewDimension = _enum( + "TextureViewDimension", texture_binding_view_dimension + ) + desc.nextInChain = &view_dim_desc + + texture = wgpuDeviceCreateTexture(_self_ptr(self), &desc) + _check() + tex_info = { + "size": size, + "mip_level_count": mip_level_count, + "sample_count": sample_count, + "dimension": dimension, + "format": format, + "usage": usage, + "texture_binding_view_dimension": texture_binding_view_dimension, + } + return GPUTexture(label, texture, self, tex_info) + + def create_sampler( + self, + *, + label: str = "", + address_mode_u: enums.AddressModeEnum = "clamp-to-edge", + address_mode_v: enums.AddressModeEnum = "clamp-to-edge", + address_mode_w: enums.AddressModeEnum = "clamp-to-edge", + mag_filter: enums.FilterModeEnum = "nearest", + min_filter: enums.FilterModeEnum = "nearest", + mipmap_filter: enums.MipmapFilterModeEnum = "nearest", + lod_min_clamp: float = 0, + lod_max_clamp: float = 32, + compare: enums.CompareFunctionEnum | None = None, + max_anisotropy: int = 1, + ) -> GPUSampler: + cdef WGPUSamplerDescriptor desc = WGPU_SAMPLER_DESCRIPTOR_INIT + cdef WGPUSampler sampler + label_b = _encode(label) + desc.label = _sv(label_b) + desc.addressModeU = _enum("AddressMode", address_mode_u) + desc.addressModeV = _enum("AddressMode", address_mode_v) + desc.addressModeW = _enum("AddressMode", address_mode_w) + desc.magFilter = _enum("FilterMode", mag_filter) + desc.minFilter = _enum("FilterMode", min_filter) + desc.mipmapFilter = _enum("MipmapFilterMode", mipmap_filter) + desc.lodMinClamp = lod_min_clamp + desc.lodMaxClamp = lod_max_clamp + if compare is not None: + desc.compare = _enum("CompareFunction", compare) + desc.maxAnisotropy = max_anisotropy + sampler = wgpuDeviceCreateSampler(_self_ptr(self), &desc) + _check() + return GPUSampler(label, sampler, self) + + def create_bind_group_layout(self, *, label: str = "", entries) -> GPUBindGroupLayout: + cdef WGPUBindGroupLayoutDescriptor desc = WGPU_BIND_GROUP_LAYOUT_DESCRIPTOR_INIT + cdef _Arena arena = _Arena() + cdef WGPUBindGroupLayoutEntry* c_entries + cdef WGPUBindGroupLayoutEntry* c_entry + cdef WGPUBindGroupLayout layout + cdef size_t i + cdef size_t n = len(entries) + + c_entries = arena.alloc(n * sizeof(WGPUBindGroupLayoutEntry)) + for i in range(n): + entry = entries[i] + check_struct("BindGroupLayoutEntry", entry) + c_entry = &c_entries[i] + c_entry[0] = WGPU_BIND_GROUP_LAYOUT_ENTRY_INIT + buffer = entry.get("buffer") + sampler = entry.get("sampler") + texture = entry.get("texture") + storage_texture = entry.get("storage_texture") + if buffer is not None: # Note, it might be an empty dictionary + info = buffer + check_struct("BufferBindingLayout", info) + min_binding_size = info.get("min_binding_size", None) + if min_binding_size is None: + min_binding_size = 0 + c_entry.buffer.type = _enum( + "BufferBindingType", info.get("type", "uniform") + ) + c_entry.buffer.hasDynamicOffset = bool(info.get("has_dynamic_offset", False)) + c_entry.buffer.minBindingSize = min_binding_size + elif sampler is not None: + info = sampler + check_struct("SamplerBindingLayout", info) + c_entry.sampler.type = _enum( + "SamplerBindingType", info.get("type", "filtering") + ) + elif texture is not None: + info = texture + check_struct("TextureBindingLayout", info) + view_dimension = info.get("view_dimension", "2d") + if not isinstance(view_dimension, str): + raise TypeError( + f"Texture view dimension must be a str, not {view_dimension.__class__.__name__}" + ) + c_entry.texture.sampleType = _enum( + "TextureSampleType", info.get("sample_type", "float") + ) + c_entry.texture.viewDimension = _enum( + "TextureViewDimension", view_dimension + ) + c_entry.texture.multisampled = bool(info.get("multisampled", False)) + elif storage_texture is not None: + info = storage_texture + check_struct("StorageTextureBindingLayout", info) + view_dimension = info.get("view_dimension", "2d") + if not isinstance(view_dimension, str): + raise TypeError( + f"Texture view dimension must be a str, not {view_dimension.__class__.__name__}" + ) + c_entry.storageTexture.access = _enum( + "StorageTextureAccess", info.get("access", "write-only") + ) + c_entry.storageTexture.format = _enum( + "TextureFormat", info["format"] + ) + c_entry.storageTexture.viewDimension = _enum( + "TextureViewDimension", view_dimension + ) + else: + raise ValueError( + "Bind group layout entry did not contain field 'buffer', 'sampler', 'texture', nor 'storage_texture'" + ) + visibility = entry["visibility"] + if isinstance(visibility, str): + visibility = str_flag_to_int(flags.ShaderStage, visibility) + c_entry.binding = int(entry["binding"]) + c_entry.visibility = int(visibility) + + desc.label = arena.sv(label) + desc.entryCount = n + desc.entries = c_entries + layout = wgpuDeviceCreateBindGroupLayout(_self_ptr(self), &desc) + _check() + return GPUBindGroupLayout(label, layout, self) + + def create_bind_group(self, *, label: str = "", layout, entries) -> GPUBindGroup: + cdef WGPUBindGroupDescriptor desc = WGPU_BIND_GROUP_DESCRIPTOR_INIT + cdef _Arena arena = _Arena() + cdef WGPUBindGroupEntry* c_entries + cdef WGPUBindGroupEntry* c_entry + cdef WGPUBindGroup bind_group + cdef size_t i + cdef size_t n = len(entries) + + c_entries = arena.alloc(n * sizeof(WGPUBindGroupEntry)) + for i in range(n): + entry = entries[i] + check_struct("BindGroupEntry", entry) + c_entry = &c_entries[i] + c_entry[0] = WGPU_BIND_GROUP_ENTRY_INIT + c_entry.binding = int(entry["binding"]) + resource = entry["resource"] + if isinstance(resource, GPUBuffer): + c_entry.buffer = _ptr(resource) + c_entry.offset = 0 + c_entry.size = resource.size + elif isinstance(resource, GPUSampler): + c_entry.sampler = _ptr(resource) + elif isinstance(resource, GPUTextureView): + c_entry.textureView = _ptr(resource) + elif isinstance(resource, (structs.BufferBinding, dict)): + c_entry.buffer = _ptr(resource["buffer"]) + c_entry.offset = resource.get("offset", 0) + size = resource.get("size", None) + c_entry.size = WGPU_WHOLE_SIZE if size is None else size + else: + raise TypeError(f"Unexpected resource type {type(resource)}") + + desc.label = arena.sv(label) + desc.layout = _ptr(layout) + desc.entryCount = n + desc.entries = c_entries + bind_group = wgpuDeviceCreateBindGroup(_self_ptr(self), &desc) + _check() + return GPUBindGroup(label, bind_group, self) + + def create_pipeline_layout( + self, *, label: str = "", bind_group_layouts, immediate_size: int = 0 + ) -> GPUPipelineLayout: + cdef WGPUPipelineLayoutDescriptor desc = WGPU_PIPELINE_LAYOUT_DESCRIPTOR_INIT + cdef _Arena arena = _Arena() + cdef WGPUBindGroupLayout* c_layouts + cdef WGPUPipelineLayout layout + cdef size_t i + cdef size_t n = len(bind_group_layouts) + c_layouts = arena.alloc(n * sizeof(WGPUBindGroupLayout)) + for i in range(n): + c_layouts[i] = _ptr(bind_group_layouts[i]) + desc.label = arena.sv(label) + desc.bindGroupLayoutCount = n + desc.bindGroupLayouts = c_layouts + desc.immediateSize = immediate_size + layout = wgpuDeviceCreatePipelineLayout(_self_ptr(self), &desc) + _check() + return GPUPipelineLayout(label, layout, self) + + def create_shader_module( + self, *, label: str = "", code, compilation_hints=() + ) -> GPUShaderModule: + cdef WGPUShaderModuleDescriptor desc = WGPU_SHADER_MODULE_DESCRIPTOR_INIT + cdef WGPUShaderSourceWGSL wgsl = WGPU_SHADER_SOURCE_WGSL_INIT + cdef WGPUShaderSourceSPIRV spirv = WGPU_SHADER_SOURCE_SPIRV_INIT + cdef _Arena arena = _Arena() + cdef WGPUShaderModule module + cdef uint32_t* spirv_code + + if isinstance(code, str): + looks_like_wgsl = any(x in code for x in ("@compute", "@vertex", "@fragment")) + looks_like_glsl = code.lstrip().startswith("#version ") + if looks_like_glsl and not looks_like_wgsl: + raise ValueError("GLSL shaders are not supported by the Dawn backend.") + wgsl.code = arena.sv(code) + desc.nextInChain = &wgsl + elif isinstance(code, bytes): + data = code + if data[:4] != b"\x03\x02#\x07": + raise ValueError("Given shader data does not look like a SpirV module") + spirv_code = arena.alloc(len(data)) + memcpy(spirv_code, data, len(data)) + spirv.codeSize = len(data) // 4 + spirv.code = spirv_code + desc.nextInChain = &spirv + else: + raise TypeError("Shader code must be str for WGSL, or bytes for SpirV.") + + desc.label = arena.sv(label) + module = wgpuDeviceCreateShaderModule(_self_ptr(self), &desc) + _check() + if module == NULL: + raise RuntimeError("Shader module creation failed") + return GPUShaderModule(label, module, self) + + def create_compute_pipeline( + self, *, label: str = "", layout, compute + ) -> GPUComputePipeline: + cdef WGPUComputePipelineDescriptor desc = WGPU_COMPUTE_PIPELINE_DESCRIPTOR_INIT + cdef _Arena arena = _Arena() + cdef WGPUComputePipeline pipeline + _fill_compute_pipeline_descriptor(&desc, arena, label, layout, compute) + pipeline = wgpuDeviceCreateComputePipeline(_self_ptr(self), &desc) + _check() + return GPUComputePipeline(label, pipeline, self) + + def create_compute_pipeline_async( + self, *, label: str = "", layout, compute + ) -> GPUPromise[GPUComputePipeline]: + cdef WGPUComputePipelineDescriptor desc = WGPU_COMPUTE_PIPELINE_DESCRIPTOR_INIT + cdef WGPUCreateComputePipelineAsyncCallbackInfo cb = WGPU_CREATE_COMPUTE_PIPELINE_ASYNC_CALLBACK_INFO_INIT + cdef _Arena arena = _Arena() + cdef WGPUFuture future + _fill_compute_pipeline_descriptor(&desc, arena, label, layout, compute) + + def handler(pipeline_id): + return GPUComputePipeline(label, pipeline_id, self) + + promise = GPUPromise("create_compute_pipeline", handler) + cb.mode = WGPUCallbackMode_AllowProcessEvents + cb.callback = _create_compute_pipeline_callback + cb.userdata1 = _promise_userdata(promise) + future = wgpuDeviceCreateComputePipelineAsync(_self_ptr(self), &desc, cb) + _check() + promise._set_future(future.id) + return promise + + def create_render_pipeline( + self, + *, + label: str = "", + layout, + vertex, + primitive=None, + depth_stencil=None, + multisample=None, + fragment=None, + ) -> GPURenderPipeline: + cdef WGPURenderPipelineDescriptor desc = WGPU_RENDER_PIPELINE_DESCRIPTOR_INIT + cdef _Arena arena = _Arena() + cdef WGPURenderPipeline pipeline + _fill_render_pipeline_descriptor( + &desc, arena, label, layout, vertex, primitive, depth_stencil, multisample, fragment + ) + pipeline = wgpuDeviceCreateRenderPipeline(_self_ptr(self), &desc) + _check() + return GPURenderPipeline(label, pipeline, self) + + def create_render_pipeline_async( + self, + *, + label: str = "", + layout, + vertex, + primitive=None, + depth_stencil=None, + multisample=None, + fragment=None, + ) -> GPUPromise[GPURenderPipeline]: + cdef WGPURenderPipelineDescriptor desc = WGPU_RENDER_PIPELINE_DESCRIPTOR_INIT + cdef WGPUCreateRenderPipelineAsyncCallbackInfo cb = WGPU_CREATE_RENDER_PIPELINE_ASYNC_CALLBACK_INFO_INIT + cdef _Arena arena = _Arena() + cdef WGPUFuture future + _fill_render_pipeline_descriptor( + &desc, arena, label, layout, vertex, primitive, depth_stencil, multisample, fragment + ) + + def handler(pipeline_id): + return GPURenderPipeline(label, pipeline_id, self) + + promise = GPUPromise("create_render_pipeline", handler) + cb.mode = WGPUCallbackMode_AllowProcessEvents + cb.callback = _create_render_pipeline_callback + cb.userdata1 = _promise_userdata(promise) + future = wgpuDeviceCreateRenderPipelineAsync(_self_ptr(self), &desc, cb) + _check() + promise._set_future(future.id) + return promise + + def create_command_encoder(self, *, label: str = "") -> GPUCommandEncoder: + cdef WGPUCommandEncoderDescriptor desc = WGPU_COMMAND_ENCODER_DESCRIPTOR_INIT + cdef WGPUCommandEncoder encoder + cdef bytes label_b + if label: + label_b = _encode(label) + desc.label = _sv(label_b) + encoder = wgpuDeviceCreateCommandEncoder(_self_ptr(self), &desc) + _check() + return GPUCommandEncoder(label, encoder, self) + + def create_render_bundle_encoder( + self, + *, + label: str = "", + color_formats, + depth_stencil_format=None, + sample_count: int = 1, + depth_read_only: bool = False, + stencil_read_only: bool = False, + ) -> GPURenderBundleEncoder: + cdef WGPURenderBundleEncoderDescriptor desc = WGPU_RENDER_BUNDLE_ENCODER_DESCRIPTOR_INIT + cdef _Arena arena = _Arena() + cdef WGPUTextureFormat* c_formats + cdef WGPURenderBundleEncoder encoder + cdef size_t i + cdef size_t n = len(color_formats or ()) + c_formats = arena.alloc(n * sizeof(WGPUTextureFormat)) + for i in range(n): + c_formats[i] = _enum("TextureFormat", color_formats[i]) + desc.label = arena.sv(label) + desc.colorFormatCount = n + desc.colorFormats = c_formats + if depth_stencil_format: + desc.depthStencilFormat = _enum("TextureFormat", depth_stencil_format) + desc.sampleCount = sample_count + desc.depthReadOnly = bool(depth_read_only) + desc.stencilReadOnly = bool(stencil_read_only) + encoder = wgpuDeviceCreateRenderBundleEncoder(_self_ptr(self), &desc) + _check() + return GPURenderBundleEncoder(label, encoder, self) + + def create_query_set(self, *, label: str = "", type: enums.QueryTypeEnum, count: int) -> GPUQuerySet: + cdef WGPUQuerySetDescriptor desc = WGPU_QUERY_SET_DESCRIPTOR_INIT + cdef WGPUQuerySet query_set + label_b = _encode(label) + desc.label = _sv(label_b) + desc.type = _enum("QueryType", type) + desc.count = count + query_set = wgpuDeviceCreateQuerySet(_self_ptr(self), &desc) + _check() + return GPUQuerySet(label, query_set, self, type, count) + + def push_error_scope(self, filter: enums.ErrorFilterEnum) -> None: + wgpuDevicePushErrorScope( + _self_ptr(self), _enum("ErrorFilter", filter) + ) + _check() + + def pop_error_scope_async(self) -> GPUPromise[GPUError]: + cdef WGPUPopErrorScopeCallbackInfo cb = WGPU_POP_ERROR_SCOPE_CALLBACK_INFO_INIT + cdef WGPUFuture future + promise = GPUPromise("pop_error_scope", None) + cb.mode = WGPUCallbackMode_AllowProcessEvents + cb.callback = _pop_error_scope_callback + cb.userdata1 = _promise_userdata(promise) + future = wgpuDevicePopErrorScope(_self_ptr(self), cb) + _check() + promise._set_future(future.id) + return promise + + def destroy(self) -> None: + # Note: destroy puts the object in a destroyed state; the handle remains valid. + if (<_Handle>self)._ptr != NULL: + wgpuDeviceDestroy((<_Handle>self)._ptr) + _check() + + def _release(self): + if self._queue is not None: + queue, self._queue = self._queue, None + queue._release() + super()._release() + + +cdef int _fill_programmable_stage( + _Arena arena, dict_or_struct, WGPUShaderModule* module, WGPUStringView* entry_point, + size_t* constant_count, const WGPUConstantEntry** constants +) except -1: + cdef WGPUConstantEntry* c_constants + cdef size_t i + stage = dict_or_struct + module[0] = _ptr(stage["module"]) + entry_point[0] = arena.sv(stage.get("entry_point")) + consts = stage.get("constants") or {} + c_constants = arena.alloc(len(consts) * sizeof(WGPUConstantEntry)) + for i, (key, value) in enumerate(consts.items()): + assert isinstance(key, (str, int)) + assert isinstance(value, (int, float, bool)) + c_constants[i] = WGPU_CONSTANT_ENTRY_INIT + c_constants[i].key = arena.sv(str(key)) + c_constants[i].value = float(value) + constant_count[0] = len(consts) + constants[0] = c_constants + return 0 + + +cdef int _fill_compute_pipeline_descriptor( + WGPUComputePipelineDescriptor* desc, _Arena arena, label, layout, compute +) except -1: + check_struct("ProgrammableStage", compute) + desc.label = arena.sv(label) + if isinstance(layout, GPUPipelineLayout): + desc.layout = _ptr(layout) + elif layout == enums.AutoLayoutMode.auto: + desc.layout = NULL + else: + raise TypeError( + "create_compute_pipeline() 'layout' arg must be a GPUPipelineLayout or 'auto'" + ) + _fill_programmable_stage( + arena, + compute, + &desc.compute.module, + &desc.compute.entryPoint, + &desc.compute.constantCount, + &desc.compute.constants, + ) + return 0 + + +cdef int _fill_render_pipeline_descriptor( + WGPURenderPipelineDescriptor* desc, + _Arena arena, + label, + layout, + vertex, + primitive, + depth_stencil, + multisample, + fragment, +) except -1: + cdef WGPUVertexBufferLayout* c_buffers + cdef WGPUVertexAttribute* c_attributes + cdef WGPUDepthStencilState* c_ds + cdef WGPUFragmentState* c_fragment + cdef WGPUColorTargetState* c_targets + cdef WGPUBlendState* c_blend + cdef WGPUStencilFaceState* c_face + cdef WGPUBlendComponent* c_comp + cdef size_t i, j + + primitive = primitive or {} + multisample = multisample or {} + depth_stencil = depth_stencil or {} + check_struct("VertexState", vertex) + check_struct("DepthStencilState", depth_stencil) + check_struct("MultisampleState", multisample) + check_struct("PrimitiveState", primitive) + + desc.label = arena.sv(label) + if isinstance(layout, GPUPipelineLayout): + desc.layout = _ptr(layout) + elif layout == enums.AutoLayoutMode.auto: + desc.layout = NULL + else: + raise TypeError( + "create_render_pipeline() 'layout' arg must be a GPUPipelineLayout or 'auto'" + ) + + # Vertex state + _fill_programmable_stage( + arena, + vertex, + &desc.vertex.module, + &desc.vertex.entryPoint, + &desc.vertex.constantCount, + &desc.vertex.constants, + ) + buffers = vertex.get("buffers", ()) + c_buffers = arena.alloc(len(buffers) * sizeof(WGPUVertexBufferLayout)) + for i in range(len(buffers)): + buffer_des = buffers[i] + c_buffers[i] = WGPU_VERTEX_BUFFER_LAYOUT_INIT + attributes = buffer_des["attributes"] + c_attributes = arena.alloc(len(attributes) * sizeof(WGPUVertexAttribute)) + for j in range(len(attributes)): + attribute = attributes[j] + c_attributes[j] = WGPU_VERTEX_ATTRIBUTE_INIT + c_attributes[j].format = _enum("VertexFormat", attribute["format"]) + c_attributes[j].offset = attribute["offset"] + c_attributes[j].shaderLocation = attribute["shader_location"] + c_buffers[i].arrayStride = buffer_des["array_stride"] + c_buffers[i].stepMode = _enum( + "VertexStepMode", buffer_des.get("step_mode", "vertex") + ) + c_buffers[i].attributeCount = len(attributes) + c_buffers[i].attributes = c_attributes + desc.vertex.bufferCount = len(buffers) + desc.vertex.buffers = c_buffers + + # Primitive state + desc.primitive.topology = _enum( + "PrimitiveTopology", primitive.get("topology", "triangle-list") + ) + strip_index_format = primitive.get("strip_index_format", None) + if strip_index_format: + desc.primitive.stripIndexFormat = _enum("IndexFormat", strip_index_format) + desc.primitive.frontFace = _enum("FrontFace", primitive.get("front_face", "ccw")) + desc.primitive.cullMode = _enum("CullMode", primitive.get("cull_mode", "none")) + desc.primitive.unclippedDepth = bool(primitive.get("unclipped_depth", False)) + + # Depth stencil state + if depth_stencil: + if depth_stencil.get("format", None) is None: + raise ValueError("depth_stencil needs format") + c_ds = arena.alloc(sizeof(WGPUDepthStencilState)) + c_ds[0] = WGPU_DEPTH_STENCIL_STATE_INIT + c_ds.format = _enum("TextureFormat", depth_stencil["format"]) + c_ds.depthWriteEnabled = ( + WGPUOptionalBool_True + if depth_stencil.get("depth_write_enabled", False) + else WGPUOptionalBool_False + ) + c_ds.depthCompare = _enum( + "CompareFunction", depth_stencil.get("depth_compare", "always") + ) + for face_key in ("stencil_front", "stencil_back"): + face = depth_stencil.get(face_key, {}) + check_struct("StencilFaceState", face) + c_face = ( + &c_ds.stencilFront if face_key == "stencil_front" else &c_ds.stencilBack + ) + c_face.compare = _enum("CompareFunction", face.get("compare", "always")) + c_face.failOp = _enum("StencilOperation", face.get("fail_op", "keep")) + c_face.depthFailOp = _enum( + "StencilOperation", face.get("depth_fail_op", "keep") + ) + c_face.passOp = _enum("StencilOperation", face.get("pass_op", "keep")) + c_ds.stencilReadMask = depth_stencil.get("stencil_read_mask", 0xFFFFFFFF) + c_ds.stencilWriteMask = depth_stencil.get("stencil_write_mask", 0xFFFFFFFF) + c_ds.depthBias = depth_stencil.get("depth_bias", 0) + c_ds.depthBiasSlopeScale = depth_stencil.get("depth_bias_slope_scale", 0) + c_ds.depthBiasClamp = depth_stencil.get("depth_bias_clamp", 0) + desc.depthStencil = c_ds + + # Multisample state + desc.multisample.count = multisample.get("count", 1) + desc.multisample.mask = multisample.get("mask", 0xFFFFFFFF) + desc.multisample.alphaToCoverageEnabled = bool( + multisample.get("alpha_to_coverage_enabled", False) + ) + + # Fragment state + if fragment is not None: + check_struct("FragmentState", fragment) + c_fragment = arena.alloc(sizeof(WGPUFragmentState)) + c_fragment[0] = WGPU_FRAGMENT_STATE_INIT + _fill_programmable_stage( + arena, + fragment, + &c_fragment.module, + &c_fragment.entryPoint, + &c_fragment.constantCount, + &c_fragment.constants, + ) + targets = fragment["targets"] + c_targets = arena.alloc(len(targets) * sizeof(WGPUColorTargetState)) + for i in range(len(targets)): + target = targets[i] + c_targets[i] = WGPU_COLOR_TARGET_STATE_INIT + c_targets[i].format = _enum("TextureFormat", target["format"]) + c_targets[i].writeMask = target.get("write_mask", 0xF) + blend = target.get("blend", None) + if blend: + c_blend = arena.alloc(sizeof(WGPUBlendState)) + c_blend[0] = WGPU_BLEND_STATE_INIT + for comp_key in ("color", "alpha"): + comp = blend[comp_key] + c_comp = &c_blend.color if comp_key == "color" else &c_blend.alpha + c_comp.srcFactor = _enum("BlendFactor", comp.get("src_factor", "one")) + c_comp.dstFactor = _enum("BlendFactor", comp.get("dst_factor", "zero")) + c_comp.operation = _enum( + "BlendOperation", comp.get("operation", "add") + ) + c_targets[i].blend = c_blend + c_fragment.targetCount = len(targets) + c_fragment.targets = c_targets + desc.fragment = c_fragment + return 0 + + +class GPUBuffer(classes.GPUBuffer, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuBufferRelease(ptr) + + def __init__(self, label, internal, device, size, usage, map_state): + super().__init__(label, internal, device, size, usage, map_state) + self._mapped_status = 0, 0, 0 + self._mapped_memoryviews = [] + if self._map_state == enums.BufferMapState.mapped: + self._mapped_status = 0, self.size, flags.MapMode.WRITE + + def _check_range(self, offset, size): + if offset is None: + offset = 0 + if self._mapped_status[2] != 0: + offset = self._mapped_status[0] + else: + offset = int(offset) + if size is None: + size = self.size - offset + if self._mapped_status[2] != 0: + size = self._mapped_status[1] - offset + else: + size = int(size) + if offset < 0: + raise ValueError("Mapped offset must not be smaller than zero.") + if offset % 8: + raise ValueError("Mapped offset must be a multiple of 8.") + if size < 1: + raise ValueError("Mapped size must be larger than zero.") + if size % 4: + raise ValueError("Mapped size must be a multiple of 4.") + if offset + size > self.size: + raise ValueError("Mapped range must not extend beyond total buffer size.") + return offset, size + + def map_async(self, mode: flags.MapModeFlags, offset: int = 0, size: int | None = None) -> GPUPromise[None]: + cdef WGPUBufferMapCallbackInfo cb = WGPU_BUFFER_MAP_CALLBACK_INFO_INIT + cdef WGPUFuture future + + if isinstance(mode, str): + if mode == "READ_NOSYNC": # for compatibility with the wgpu-native backend + mode = "READ" + mode = str_flag_to_int(flags.MapMode, mode) + map_mode = int(mode) + offset, size = self._check_range(offset, size) + + if self._map_state != enums.BufferMapState.unmapped: + promise = GPUPromise("buffer.map", None) + promise._wgpu_set_error( + RuntimeError( + f"Can only map a buffer if its currently unmapped, not {self._map_state!r}" + ) + ) + return promise + + def handler(_): + self._map_state = enums.BufferMapState.mapped + self._mapped_status = offset, offset + size, map_mode + self._mapped_memoryviews = [] + + promise = GPUPromise("buffer.map", handler) + cb.mode = WGPUCallbackMode_AllowProcessEvents + cb.callback = _buffer_map_callback + cb.userdata1 = _promise_userdata(promise) + self._map_state = enums.BufferMapState.pending + future = wgpuBufferMapAsync( + _self_ptr(self), map_mode, offset, size, cb + ) + try: + _check() + except Exception: + self._map_state = enums.BufferMapState.unmapped + raise + promise._set_future(future.id) + return promise + + def unmap(self) -> None: + if self._map_state != enums.BufferMapState.mapped: + raise RuntimeError("Can only unmap a buffer if its currently mapped.") + self._release_memoryviews() + wgpuBufferUnmap(_self_ptr(self)) + _check() + self._map_state = enums.BufferMapState.unmapped + self._mapped_status = 0, 0, 0 + + def _release_memoryviews(self): + for m in self._mapped_memoryviews: + try: + m.release() + except Exception: # no-cover + pass + self._mapped_memoryviews = [] + + def read_mapped(self, buffer_offset: int | None = None, size: int | None = None, *, copy: bool = True): + cdef const void* ptr + if self._map_state != enums.BufferMapState.mapped: + raise RuntimeError("Can only read from a buffer if its mapped.") + elif not (self._mapped_status[2] & flags.MapMode.READ): + raise RuntimeError("Can only read from a buffer if its mapped in read mode.") + offset, size = self._check_range(buffer_offset, size) + if offset < self._mapped_status[0] or (offset + size) > self._mapped_status[1]: + raise ValueError( + "The range for buffer reading is not contained in the currently mapped range." + ) + ptr = wgpuBufferGetConstMappedRange(_self_ptr(self), offset, size) + _check() + if ptr == NULL: + raise RuntimeError("Could not get mapped range.") + if copy: + return memoryview(PyByteArray_FromStringAndSize(ptr, size)).cast("B") + else: + data = PyMemoryView_FromMemory(ptr, size, PyBUF_READ) + self._mapped_memoryviews.append(data) + return data + + def write_mapped(self, data, buffer_offset: int | None = None) -> None: + cdef void* ptr + cdef _Buffer buf + if self._map_state != enums.BufferMapState.mapped: + raise RuntimeError("Can only write to a buffer if its mapped.") + elif not (self._mapped_status[2] & flags.MapMode.WRITE): + raise RuntimeError("Can only write from a buffer if its mapped in write mode.") + buf = _Buffer(data) + nbytes = buf.view.len + size = (nbytes + 3) & ~3 + offset, size = self._check_range(buffer_offset, size) + if offset < self._mapped_status[0] or (offset + size) > self._mapped_status[1]: + raise ValueError( + "The range for buffer writing is not contained in the currently mapped range." + ) + ptr = wgpuBufferGetMappedRange(_self_ptr(self), offset, size) + _check() + if ptr == NULL: + raise RuntimeError("Could not get mapped range.") + memcpy(ptr, buf.view.buf, nbytes) + + def _experimental_get_mapped_range(self, buffer_offset=None, size=None): + """Undocumented and experimental. Returns a writable memoryview on the + mapped memory. Using it after the buffer unmaps may segfault. + """ + cdef void* ptr + if self._map_state != enums.BufferMapState.mapped: + raise RuntimeError("Can only write to a buffer if its mapped.") + offset, size = self._check_range(buffer_offset, size) + ptr = wgpuBufferGetMappedRange(_self_ptr(self), offset, size) + _check() + if ptr == NULL: + raise RuntimeError("Could not get mapped range.") + return PyMemoryView_FromMemory(ptr, size, PyBUF_WRITE) + + def destroy(self) -> None: + self._release_memoryviews() + if (<_Handle>self)._ptr != NULL: + wgpuBufferDestroy((<_Handle>self)._ptr) + _check() + + def _release(self): + self._release_memoryviews() + super()._release() + + +class GPUTexture(classes.GPUTexture, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuTextureRelease(ptr) + + def create_view( + self, + *, + label: str = "", + format=None, + dimension=None, + usage=0, + aspect="all", + base_mip_level: int = 0, + mip_level_count=None, + base_array_layer: int = 0, + array_layer_count=None, + swizzle: str = "rgba", + ) -> GPUTextureView: + cdef WGPUTextureViewDescriptor desc = WGPU_TEXTURE_VIEW_DESCRIPTOR_INIT + cdef WGPUTextureView view + if not format: + format = self._tex_info["format"] + if not dimension: + dimension = self._tex_info["dimension"] + elif not isinstance(dimension, str): + raise TypeError( + f"Texture view dimension must be a str, not {dimension.__class__.__name__}" + ) + if not aspect: + aspect = "all" + if not mip_level_count: + mip_level_count = self._tex_info["mip_level_count"] - base_mip_level + if not array_layer_count: + if dimension in ("1d", "2d", "3d"): + array_layer_count = 1 + elif dimension == "cube": + array_layer_count = 6 + elif dimension in ("2d-array", "cube-array"): + array_layer_count = self._tex_info["size"][2] - base_array_layer + if swizzle not in (None, "", "rgba"): + raise NotImplementedError("Texture view swizzle is not yet supported by the Dawn backend.") + if isinstance(usage, str): + usage = str_flag_to_int(flags.TextureUsage, usage) + + label_b = _encode(label) + desc.label = _sv(label_b) + desc.format = _enum("TextureFormat", format) + desc.dimension = _enum("TextureViewDimension", dimension) + desc.aspect = _enum("TextureAspect", aspect) + desc.baseMipLevel = base_mip_level + desc.mipLevelCount = mip_level_count + desc.baseArrayLayer = base_array_layer + desc.arrayLayerCount = array_layer_count + desc.usage = int(usage or 0) + view = wgpuTextureCreateView(_self_ptr(self), &desc) + _check() + return GPUTextureView(label, view, self._device, self, self.size) + + def destroy(self) -> None: + if (<_Handle>self)._ptr != NULL: + wgpuTextureDestroy((<_Handle>self)._ptr) + _check() + + +class GPUTextureView(classes.GPUTextureView, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuTextureViewRelease(ptr) + + +class GPUSampler(classes.GPUSampler, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuSamplerRelease(ptr) + + +class GPUBindGroupLayout(classes.GPUBindGroupLayout, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuBindGroupLayoutRelease(ptr) + + +class GPUBindGroup(classes.GPUBindGroup, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuBindGroupRelease(ptr) + + +class GPUPipelineLayout(classes.GPUPipelineLayout, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuPipelineLayoutRelease(ptr) + + +class GPUShaderModule(classes.GPUShaderModule, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuShaderModuleRelease(ptr) + + def get_compilation_info_async(self) -> GPUPromise[GPUCompilationInfo]: + cdef WGPUCompilationInfoCallbackInfo cb = WGPU_COMPILATION_INFO_CALLBACK_INFO_INIT + cdef WGPUFuture future + promise = GPUPromise("get_compilation_info", None) + cb.mode = WGPUCallbackMode_AllowProcessEvents + cb.callback = _compilation_info_callback + cb.userdata1 = _promise_userdata(promise) + future = wgpuShaderModuleGetCompilationInfo(_self_ptr(self), cb) + _check() + promise._set_future(future.id) + return promise + + +class GPUPipelineBase(classes.GPUPipelineBase): + def get_bind_group_layout(self, index: int) -> GPUBindGroupLayout: + cdef void* p = _self_ptr(self) + cdef WGPUBindGroupLayout layout + if isinstance(self, GPUComputePipeline): + layout = wgpuComputePipelineGetBindGroupLayout(p, index) + else: + layout = wgpuRenderPipelineGetBindGroupLayout(p, index) + _check() + return GPUBindGroupLayout("", layout, self._device) + + +class GPUComputePipeline(classes.GPUComputePipeline, GPUPipelineBase, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuComputePipelineRelease(ptr) + + +class GPURenderPipeline(classes.GPURenderPipeline, GPUPipelineBase, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuRenderPipelineRelease(ptr) + + +class GPUCommandBuffer(classes.GPUCommandBuffer, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuCommandBufferRelease(ptr) + + +class GPUCommandsMixin(classes.GPUCommandsMixin): + pass + + +# The mixins below are shared by several encoder classes. They select the C +# function using the C-level ``_kind`` field, so no Python lookups are needed. + + +class GPUBindingCommandsMixin(classes.GPUBindingCommandsMixin): + def set_bind_group( + self, + uint32_t index, + bind_group, + dynamic_offsets_data=(), + dynamic_offsets_data_start=None, + dynamic_offsets_data_length=None, + ) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = h._ptr + cdef WGPUBindGroup bg = _ptr_or_null(bind_group) + cdef uint32_t offsets_stack[16] + cdef uint32_t* offsets = offsets_stack + cdef size_t n = 0 + cdef size_t i + cdef _Arena arena + if p == NULL: + _raise_released(self) + if dynamic_offsets_data: + if ( + dynamic_offsets_data_start is not None + or dynamic_offsets_data_length is not None + ): + if dynamic_offsets_data_start is None or dynamic_offsets_data_length is None: + raise ValueError( + "Dynamic offsets start and length must be both set or both None." + ) + if dynamic_offsets_data_start < 0: + raise ValueError("Dynamic offsets start must be non-negative.") + if dynamic_offsets_data_length < 0: + raise ValueError("Dynamic offsets length must be non-negative.") + dynamic_offsets_data = dynamic_offsets_data[ + dynamic_offsets_data_start : dynamic_offsets_data_start + + dynamic_offsets_data_length + ] + n = len(dynamic_offsets_data) + if n > 16: + arena = _Arena() + offsets = arena.alloc(n * sizeof(uint32_t)) + for i in range(n): + offsets[i] = dynamic_offsets_data[i] + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderSetBindGroup(p, index, bg, n, offsets) + elif h._kind == _KIND_COMPUTE_PASS: + wgpuComputePassEncoderSetBindGroup(p, index, bg, n, offsets) + else: + wgpuRenderBundleEncoderSetBindGroup(p, index, bg, n, offsets) + + def _begin_pipeline_statistics_query(self, query_set, query_index): + raise RuntimeError("Pipeline statistics queries are not supported by Dawn.") + + def _end_pipeline_statistics_query(self): + raise RuntimeError("Pipeline statistics queries are not supported by Dawn.") + + def set_immediates(self, range_offset, data, data_offset=0, data_size=None) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = _self_ptr(self) + cdef _Buffer buf = _Buffer(data) + cdef Py_ssize_t nbytes = buf.view.len + cdef Py_ssize_t offset = int(data_offset) + cdef Py_ssize_t size = nbytes - offset if data_size is None else int(data_size) + if not (0 <= offset < nbytes): + raise ValueError("Invalid data_offset") + if not (0 <= size <= nbytes): + raise ValueError("Invalid data_size") + if size + offset > nbytes: + raise ValueError("data_size + data_offset is too large") + cdef const char* c_data = buf.view.buf + offset + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderSetImmediates(p, range_offset, c_data, size) + elif h._kind == _KIND_COMPUTE_PASS: + wgpuComputePassEncoderSetImmediates(p, range_offset, c_data, size) + else: + wgpuRenderBundleEncoderSetImmediates(p, range_offset, c_data, size) + + +class GPUDebugCommandsMixin(classes.GPUDebugCommandsMixin): + def push_debug_group(self, group_label: str) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = _self_ptr(self) + label_b = _encode(group_label) + cdef WGPUStringView label = _sv(label_b) + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderPushDebugGroup(p, label) + elif h._kind == _KIND_COMPUTE_PASS: + wgpuComputePassEncoderPushDebugGroup(p, label) + elif h._kind == _KIND_COMMAND_ENCODER: + wgpuCommandEncoderPushDebugGroup(p, label) + else: + wgpuRenderBundleEncoderPushDebugGroup(p, label) + _check() + + def pop_debug_group(self) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = _self_ptr(self) + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderPopDebugGroup(p) + elif h._kind == _KIND_COMPUTE_PASS: + wgpuComputePassEncoderPopDebugGroup(p) + elif h._kind == _KIND_COMMAND_ENCODER: + wgpuCommandEncoderPopDebugGroup(p) + else: + wgpuRenderBundleEncoderPopDebugGroup(p) + _check() + + def insert_debug_marker(self, marker_label: str) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = _self_ptr(self) + label_b = _encode(marker_label) + cdef WGPUStringView label = _sv(label_b) + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderInsertDebugMarker(p, label) + elif h._kind == _KIND_COMPUTE_PASS: + wgpuComputePassEncoderInsertDebugMarker(p, label) + elif h._kind == _KIND_COMMAND_ENCODER: + wgpuCommandEncoderInsertDebugMarker(p, label) + else: + wgpuRenderBundleEncoderInsertDebugMarker(p, label) + _check() + + def _write_timestamp(self, query_set, query_index): + cdef _Handle h = <_Handle>self + cdef void* p = _self_ptr(self) + cdef WGPUQuerySet qs = _ptr(query_set) + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderWriteTimestamp(p, qs, query_index) + elif h._kind == _KIND_COMPUTE_PASS: + wgpuComputePassEncoderWriteTimestamp(p, qs, query_index) + elif h._kind == _KIND_COMMAND_ENCODER: + wgpuCommandEncoderWriteTimestamp(p, qs, query_index) + else: + raise RuntimeError(f"{type(self).__name__} does not implement write_timestamp") + _check() + + +class GPURenderCommandsMixin(classes.GPURenderCommandsMixin): + def set_pipeline(self, pipeline) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = h._ptr + cdef void* pipe = _ptr(pipeline) + if p == NULL: + _raise_released(self) + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderSetPipeline(p, pipe) + else: + wgpuRenderBundleEncoderSetPipeline(p, pipe) + + def set_index_buffer(self, buffer, index_format, uint64_t offset=0, size=None) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = _self_ptr(self) + cdef WGPUBuffer buf = _ptr(buffer) + cdef uint64_t c_size = size if size else WGPU_WHOLE_SIZE + cdef WGPUIndexFormat fmt + if index_format == "uint32": + fmt = WGPUIndexFormat_Uint32 + elif index_format == "uint16": + fmt = WGPUIndexFormat_Uint16 + else: + fmt = _enum("IndexFormat", index_format) + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderSetIndexBuffer(p, buf, fmt, offset, c_size) + else: + wgpuRenderBundleEncoderSetIndexBuffer(p, buf, fmt, offset, c_size) + + def set_vertex_buffer(self, uint32_t slot, buffer, uint64_t offset=0, size=None) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = _self_ptr(self) + cdef WGPUBuffer buf = _ptr_or_null(buffer) + cdef uint64_t c_size = size if size else WGPU_WHOLE_SIZE + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderSetVertexBuffer(p, slot, buf, offset, c_size) + else: + wgpuRenderBundleEncoderSetVertexBuffer(p, slot, buf, offset, c_size) + + def draw( + self, + uint32_t vertex_count, + uint32_t instance_count=1, + uint32_t first_vertex=0, + uint32_t first_instance=0, + ) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = h._ptr + if p == NULL: + _raise_released(self) + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderDraw( + p, vertex_count, instance_count, first_vertex, first_instance + ) + else: + wgpuRenderBundleEncoderDraw( + p, vertex_count, instance_count, first_vertex, first_instance + ) + + def draw_indirect(self, indirect_buffer, uint64_t indirect_offset) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = _self_ptr(self) + cdef WGPUBuffer buf = _ptr(indirect_buffer) + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderDrawIndirect(p, buf, indirect_offset) + else: + wgpuRenderBundleEncoderDrawIndirect(p, buf, indirect_offset) + + def draw_indexed( + self, + uint32_t index_count, + uint32_t instance_count=1, + uint32_t first_index=0, + int32_t base_vertex=0, + uint32_t first_instance=0, + ) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = h._ptr + if p == NULL: + _raise_released(self) + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderDrawIndexed( + p, index_count, instance_count, first_index, base_vertex, first_instance + ) + else: + wgpuRenderBundleEncoderDrawIndexed( + p, index_count, instance_count, first_index, base_vertex, first_instance + ) + + def draw_indexed_indirect(self, indirect_buffer, uint64_t indirect_offset) -> None: + cdef _Handle h = <_Handle>self + cdef void* p = _self_ptr(self) + cdef WGPUBuffer buf = _ptr(indirect_buffer) + if h._kind == _KIND_RENDER_PASS: + wgpuRenderPassEncoderDrawIndexedIndirect(p, buf, indirect_offset) + else: + wgpuRenderBundleEncoderDrawIndexedIndirect(p, buf, indirect_offset) + + +cdef int _fill_timestamp_writes(WGPUPassTimestampWrites* tw, timestamp_writes) except -1: + tw[0] = WGPU_PASS_TIMESTAMP_WRITES_INIT + tw.querySet = _ptr(timestamp_writes["query_set"]) + tw.beginningOfPassWriteIndex = timestamp_writes.get( + "beginning_of_pass_write_index", WGPU_QUERY_SET_INDEX_UNDEFINED + ) + tw.endOfPassWriteIndex = timestamp_writes.get( + "end_of_pass_write_index", WGPU_QUERY_SET_INDEX_UNDEFINED + ) + return 0 + + +cdef int _fill_texel_copy_texture_info(WGPUTexelCopyTextureInfo* info, d) except -1: + info[0] = WGPU_TEXEL_COPY_TEXTURE_INFO_INIT + texture = d["texture"] + if isinstance(texture, GPUTextureView): + raise ValueError("copy texture must be a texture, not a view") + info.texture = _ptr(texture) + info.mipLevel = int(d.get("mip_level", 0)) + ori = _tuple_from_origin3d(d) + info.origin.x = ori[0] + info.origin.y = ori[1] + info.origin.z = ori[2] + info.aspect = _enum("TextureAspect", d.get("aspect", "all")) + return 0 + + +cdef int _fill_extent(WGPUExtent3D* extent, size) except -1: + size = _tuple_from_extent3d(size) + extent.width = size[0] + extent.height = size[1] + extent.depthOrArrayLayers = size[2] + return 0 + + +class GPUCommandEncoder( + classes.GPUCommandEncoder, GPUCommandsMixin, GPUDebugCommandsMixin, GPUObjectBase +): + _handle_kind = _KIND_COMMAND_ENCODER + + def _release_ptr(self, ptr): + wgpuCommandEncoderRelease(ptr) + + def begin_compute_pass(self, *, label: str = "", timestamp_writes=None) -> GPUComputePassEncoder: + cdef WGPUComputePassDescriptor desc = WGPU_COMPUTE_PASS_DESCRIPTOR_INIT + cdef WGPUPassTimestampWrites tw + cdef WGPUComputePassEncoder encoder + cdef bytes label_b + if label: + label_b = _encode(label) + desc.label = _sv(label_b) + if timestamp_writes is not None: + check_struct("ComputePassTimestampWrites", timestamp_writes) + _fill_timestamp_writes(&tw, timestamp_writes) + desc.timestampWrites = &tw + encoder = wgpuCommandEncoderBeginComputePass(_self_ptr(self), &desc) + _check() + return GPUComputePassEncoder(label, encoder, self._device) + + def begin_render_pass( + self, + *, + label: str = "", + color_attachments, + depth_stencil_attachment=None, + occlusion_query_set=None, + timestamp_writes=None, + max_draw_count: int = 50000000, + ) -> GPURenderPassEncoder: + cdef WGPURenderPassDescriptor desc = WGPU_RENDER_PASS_DESCRIPTOR_INIT + cdef WGPURenderPassMaxDrawCount max_draw = WGPU_RENDER_PASS_MAX_DRAW_COUNT_INIT + cdef WGPUPassTimestampWrites tw + cdef WGPURenderPassColorAttachment color_stack[8] + cdef WGPURenderPassColorAttachment* c_colors = color_stack + cdef WGPURenderPassColorAttachment* c_color + cdef WGPURenderPassDepthStencilAttachment c_ds = WGPU_RENDER_PASS_DEPTH_STENCIL_ATTACHMENT_INIT + cdef WGPURenderPassEncoder encoder + cdef _Arena arena + cdef size_t i + cdef size_t n = len(color_attachments) + cdef bytes label_b + + if label: + label_b = _encode(label) + desc.label = _sv(label_b) + if timestamp_writes is not None: + check_struct("RenderPassTimestampWrites", timestamp_writes) + _fill_timestamp_writes(&tw, timestamp_writes) + desc.timestampWrites = &tw + + if n > 8: + arena = _Arena() + c_colors = arena.alloc(n * sizeof(WGPURenderPassColorAttachment)) + for i in range(n): + color_attachment = color_attachments[i] + c_color = &c_colors[i] + c_color[0] = WGPU_RENDER_PASS_COLOR_ATTACHMENT_INIT + if color_attachment is None: + continue # sparse attachments: view stays NULL + check_struct("RenderPassColorAttachment", color_attachment) + texture_view = color_attachment["view"] + if not isinstance(texture_view, GPUTextureView): + raise TypeError("Color attachment view must be a GPUTextureView.") + c_color.view = _ptr(texture_view) + c_color.resolveTarget = _ptr_or_null( + color_attachment.get("resolve_target", None) + ) + depth_slice = color_attachment.get("depth_slice", None) + if depth_slice is not None: + c_color.depthSlice = depth_slice + c_color.loadOp = _enum("LoadOp", color_attachment["load_op"]) + c_color.storeOp = _enum("StoreOp", color_attachment["store_op"]) + clear_value = color_attachment.get("clear_value", (0, 0, 0, 0)) + if isinstance(clear_value, dict): + check_struct("Color", clear_value) + clear_value = _tuple_from_color(clear_value) + c_color.clearValue.r = clear_value[0] + c_color.clearValue.g = clear_value[1] + c_color.clearValue.b = clear_value[2] + c_color.clearValue.a = clear_value[3] + desc.colorAttachmentCount = n + desc.colorAttachments = c_colors + + if depth_stencil_attachment is not None: + check_struct("RenderPassDepthStencilAttachment", depth_stencil_attachment) + self._fill_depth_stencil_attachment(depth_stencil_attachment, &c_ds) + desc.depthStencilAttachment = &c_ds + + if occlusion_query_set is not None: + desc.occlusionQuerySet = _ptr(occlusion_query_set) + + if max_draw_count != 50000000: + max_draw.maxDrawCount = max_draw_count + desc.nextInChain = &max_draw + + encoder = wgpuCommandEncoderBeginRenderPass(_self_ptr(self), &desc) + _check() + return GPURenderPassEncoder(label, encoder, self._device) + + def _fill_depth_stencil_attachment(self, ds_attachment, uintptr_t address): + cdef WGPURenderPassDepthStencilAttachment* c_ds = address + view = ds_attachment["view"] + c_ds.view = _ptr(view) + texture_format = view.texture.format + depth_keys_okay = stencil_keys_okay = False + if "depth" in texture_format: + depth_read_only = ds_attachment.get("depth_read_only", False) + c_ds.depthReadOnly = bool(depth_read_only) + if not depth_read_only: + depth_keys_okay = True + depth_load_op = ds_attachment["depth_load_op"] + c_ds.depthLoadOp = _enum("LoadOp", depth_load_op) + c_ds.depthStoreOp = _enum("StoreOp", ds_attachment["depth_store_op"]) + if depth_load_op == "clear": + c_ds.depthClearValue = float(ds_attachment["depth_clear_value"]) + if "stencil" in texture_format: + stencil_read_only = ds_attachment.get("stencil_read_only", False) + c_ds.stencilReadOnly = bool(stencil_read_only) + if not stencil_read_only: + stencil_keys_okay = True + c_ds.stencilLoadOp = _enum("LoadOp", ds_attachment["stencil_load_op"]) + c_ds.stencilStoreOp = _enum("StoreOp", ds_attachment["stencil_store_op"]) + c_ds.stencilClearValue = int(ds_attachment.get("stencil_clear_value", 0)) + unexpected_keys = [ + *(("depth_load_op", "depth_store_op") if not depth_keys_okay else ()), + *(("stencil_load_op", "stencil_store_op") if not stencil_keys_okay else ()), + ] + for key in unexpected_keys: + if ds_attachment.get(key) is not None: + if not getattr(self._device, f"warned_about_{key}", False): + logger.warning(f"Unexpected key {key} in depth_stencil_attachment") + setattr(self._device, f"warned_about_{key}", True) + + def clear_buffer(self, buffer, offset: int = 0, size: int | None = None) -> None: + offset = int(offset) + if offset % 4 != 0: + raise ValueError("offset must be a multiple of 4") + if size is not None: + size = int(size) + if size <= 0: + raise ValueError("size must be > 0") + if size % 4 != 0: + raise ValueError("size must be a multiple of 4") + if offset + size > buffer.size: + raise ValueError("buffer size out of range") + else: + size = WGPU_WHOLE_SIZE + if offset > buffer.size: + raise ValueError("offset is too large") + wgpuCommandEncoderClearBuffer( + _self_ptr(self), _ptr(buffer), offset, size + ) + _check() + + def copy_buffer_to_buffer( + self, source, source_offset, destination, destination_offset, size=None + ) -> None: + if source_offset % 4 != 0: + raise ValueError("source_offset must be a multiple of 4") + if destination_offset % 4 != 0: + raise ValueError("destination_offset must be a multiple of 4") + if size is None: + size = WGPU_WHOLE_SIZE + elif size % 4 != 0: + raise ValueError("size must be a multiple of 4") + if not isinstance(source, GPUBuffer): + raise TypeError("copy_buffer_to_buffer() source must be a GPUBuffer.") + if not isinstance(destination, GPUBuffer): + raise TypeError("copy_buffer_to_buffer() destination must be a GPUBuffer.") + wgpuCommandEncoderCopyBufferToBuffer( + _self_ptr(self), + _ptr(source), + int(source_offset), + _ptr(destination), + int(destination_offset), + int(size), + ) + _check() + + def copy_buffer_to_texture(self, source, destination, copy_size) -> None: + cdef WGPUTexelCopyBufferInfo c_source = WGPU_TEXEL_COPY_BUFFER_INFO_INIT + cdef WGPUTexelCopyTextureInfo c_destination + cdef WGPUExtent3D c_size + check_struct("TexelCopyBufferInfo", source) + check_struct("TexelCopyTextureInfo", destination) + row_alignment = 256 + bytes_per_row = int(source["bytes_per_row"]) + if (bytes_per_row % row_alignment) != 0: + raise ValueError( + f"bytes_per_row ({bytes_per_row}) must be a multiple of {row_alignment}" + ) + size = _tuple_from_extent3d(copy_size) + c_source.layout.offset = int(source.get("offset", 0)) + c_source.layout.bytesPerRow = bytes_per_row + c_source.layout.rowsPerImage = int(source.get("rows_per_image", size[1])) + c_source.buffer = _ptr(source["buffer"]) + _fill_texel_copy_texture_info(&c_destination, destination) + _fill_extent(&c_size, size) + wgpuCommandEncoderCopyBufferToTexture( + _self_ptr(self), &c_source, &c_destination, &c_size + ) + _check() + + def copy_texture_to_buffer(self, source, destination, copy_size) -> None: + cdef WGPUTexelCopyTextureInfo c_source + cdef WGPUTexelCopyBufferInfo c_destination = WGPU_TEXEL_COPY_BUFFER_INFO_INIT + cdef WGPUExtent3D c_size + check_struct("TexelCopyTextureInfo", source) + check_struct("TexelCopyBufferInfo", destination) + row_alignment = 256 + bytes_per_row = int(destination["bytes_per_row"]) + if (bytes_per_row % row_alignment) != 0: + raise ValueError( + f"bytes_per_row must ({bytes_per_row}) be a multiple of {row_alignment}" + ) + size = _tuple_from_extent3d(copy_size) + _fill_texel_copy_texture_info(&c_source, source) + c_destination.layout.offset = int(destination.get("offset", 0)) + c_destination.layout.bytesPerRow = bytes_per_row + c_destination.layout.rowsPerImage = int(destination.get("rows_per_image", size[1])) + c_destination.buffer = _ptr(destination["buffer"]) + _fill_extent(&c_size, size) + wgpuCommandEncoderCopyTextureToBuffer( + _self_ptr(self), &c_source, &c_destination, &c_size + ) + _check() + + def copy_texture_to_texture(self, source, destination, copy_size) -> None: + cdef WGPUTexelCopyTextureInfo c_source + cdef WGPUTexelCopyTextureInfo c_destination + cdef WGPUExtent3D c_size + check_struct("TexelCopyTextureInfo", source) + check_struct("TexelCopyTextureInfo", destination) + _fill_texel_copy_texture_info(&c_source, source) + _fill_texel_copy_texture_info(&c_destination, destination) + _fill_extent(&c_size, copy_size) + wgpuCommandEncoderCopyTextureToTexture( + _self_ptr(self), &c_source, &c_destination, &c_size + ) + _check() + + def finish(self, *, label: str = "") -> GPUCommandBuffer: + cdef WGPUCommandBufferDescriptor desc = WGPU_COMMAND_BUFFER_DESCRIPTOR_INIT + cdef WGPUCommandBuffer command_buffer + cdef bytes label_b + if label: + label_b = _encode(label) + desc.label = _sv(label_b) + command_buffer = wgpuCommandEncoderFinish(_self_ptr(self), &desc) + _check() + return GPUCommandBuffer(label, command_buffer, self._device) + + def resolve_query_set( + self, query_set, first_query, query_count, destination, destination_offset + ) -> None: + wgpuCommandEncoderResolveQuerySet( + _self_ptr(self), + _ptr(query_set), + int(first_query), + int(query_count), + _ptr(destination), + int(destination_offset), + ) + _check() + + +class GPUComputePassEncoder( + classes.GPUComputePassEncoder, + GPUCommandsMixin, + GPUDebugCommandsMixin, + GPUBindingCommandsMixin, + GPUObjectBase, +): + _handle_kind = _KIND_COMPUTE_PASS + + def _release_ptr(self, ptr): + wgpuComputePassEncoderRelease(ptr) + + def set_pipeline(self, pipeline) -> None: + cdef void* p = (<_Handle>self)._ptr + cdef void* pipe = _ptr(pipeline) + if p == NULL: + _raise_released(self) + wgpuComputePassEncoderSetPipeline(p, pipe) + + def dispatch_workgroups( + self, + uint32_t workgroup_count_x, + uint32_t workgroup_count_y=1, + uint32_t workgroup_count_z=1, + ) -> None: + cdef void* p = (<_Handle>self)._ptr + if p == NULL: + _raise_released(self) + wgpuComputePassEncoderDispatchWorkgroups( + p, workgroup_count_x, workgroup_count_y, workgroup_count_z + ) + + def dispatch_workgroups_indirect(self, indirect_buffer, uint64_t indirect_offset) -> None: + wgpuComputePassEncoderDispatchWorkgroupsIndirect( + _self_ptr(self), + _ptr(indirect_buffer), + indirect_offset, + ) + + def end(self) -> None: + wgpuComputePassEncoderEnd(_self_ptr(self)) + _check() + + +class GPURenderPassEncoder( + classes.GPURenderPassEncoder, + GPUCommandsMixin, + GPUDebugCommandsMixin, + GPUBindingCommandsMixin, + GPURenderCommandsMixin, + GPUObjectBase, +): + _handle_kind = _KIND_RENDER_PASS + + def _release_ptr(self, ptr): + wgpuRenderPassEncoderRelease(ptr) + + def set_viewport( + self, float x, float y, float width, float height, float min_depth, float max_depth + ) -> None: + wgpuRenderPassEncoderSetViewport( + _self_ptr(self), x, y, width, height, min_depth, max_depth + ) + + def set_scissor_rect(self, uint32_t x, uint32_t y, uint32_t width, uint32_t height) -> None: + wgpuRenderPassEncoderSetScissorRect( + _self_ptr(self), x, y, width, height + ) + + def set_blend_constant(self, color) -> None: + cdef WGPUColor c_color + if isinstance(color, dict): + check_struct("Color", color) + color = _tuple_from_color(color) + c_color.r = color[0] + c_color.g = color[1] + c_color.b = color[2] + c_color.a = color[3] + wgpuRenderPassEncoderSetBlendConstant(_self_ptr(self), &c_color) + + def set_stencil_reference(self, uint32_t reference) -> None: + wgpuRenderPassEncoderSetStencilReference(_self_ptr(self), reference) + + def end(self) -> None: + wgpuRenderPassEncoderEnd(_self_ptr(self)) + _check() + + def execute_bundles(self, bundles) -> None: + cdef _Arena arena = _Arena() + cdef size_t i + cdef size_t n = len(bundles) + cdef WGPURenderBundle* c_bundles = arena.alloc(n * sizeof(WGPURenderBundle)) + for i in range(n): + c_bundles[i] = _ptr(bundles[i]) + wgpuRenderPassEncoderExecuteBundles(_self_ptr(self), n, c_bundles) + + def begin_occlusion_query(self, uint32_t query_index) -> None: + wgpuRenderPassEncoderBeginOcclusionQuery(_self_ptr(self), query_index) + + def end_occlusion_query(self) -> None: + wgpuRenderPassEncoderEndOcclusionQuery(_self_ptr(self)) + + def _multi_draw_indirect(self, buffer, uint64_t offset, uint32_t count): + wgpuRenderPassEncoderMultiDrawIndirect( + _self_ptr(self), _ptr(buffer), offset, count, NULL, 0 + ) + + def _multi_draw_indexed_indirect(self, buffer, uint64_t offset, uint32_t count): + wgpuRenderPassEncoderMultiDrawIndexedIndirect( + _self_ptr(self), _ptr(buffer), offset, count, NULL, 0 + ) + + def _multi_draw_indirect_count( + self, buffer, uint64_t offset, count_buffer, uint64_t count_buffer_offset, uint32_t max_count + ): + wgpuRenderPassEncoderMultiDrawIndirect( + _self_ptr(self), + _ptr(buffer), + offset, + max_count, + _ptr(count_buffer), + count_buffer_offset, + ) + + def _multi_draw_indexed_indirect_count( + self, buffer, uint64_t offset, count_buffer, uint64_t count_buffer_offset, uint32_t max_count + ): + wgpuRenderPassEncoderMultiDrawIndexedIndirect( + _self_ptr(self), + _ptr(buffer), + offset, + max_count, + _ptr(count_buffer), + count_buffer_offset, + ) + + +class GPURenderBundleEncoder( + classes.GPURenderBundleEncoder, + GPUCommandsMixin, + GPUDebugCommandsMixin, + GPUBindingCommandsMixin, + GPURenderCommandsMixin, + GPUObjectBase, +): + _handle_kind = _KIND_RENDER_BUNDLE_ENCODER + + def _release_ptr(self, ptr): + wgpuRenderBundleEncoderRelease(ptr) + + def finish(self, *, label: str = "") -> GPURenderBundle: + cdef WGPURenderBundleDescriptor desc = WGPU_RENDER_BUNDLE_DESCRIPTOR_INIT + cdef WGPURenderBundle bundle + label_b = _encode(label) + desc.label = _sv(label_b) + bundle = wgpuRenderBundleEncoderFinish(_self_ptr(self), &desc) + _check() + return GPURenderBundle(label, bundle, self._device) + + +class GPUQueue(classes.GPUQueue, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuQueueRelease(ptr) + + def submit(self, command_buffers) -> None: + cdef WGPUCommandBuffer stack[16] + cdef WGPUCommandBuffer* c_buffers = stack + cdef _Arena arena + cdef size_t i + cdef size_t n = len(command_buffers) + cdef void* q = (<_Handle>self)._ptr + if q == NULL: + _raise_released(self) + if n > 16: + arena = _Arena() + c_buffers = arena.alloc(n * sizeof(WGPUCommandBuffer)) + for i in range(n): + c_buffers[i] = _ptr(command_buffers[i]) + wgpuQueueSubmit(q, n, c_buffers) + _check() + + def write_buffer(self, buffer, buffer_offset, data, data_offset=0, size=None) -> None: + cdef _Buffer buf = _Buffer(data) + cdef Py_ssize_t nbytes = buf.view.len + cdef uint64_t c_buffer_offset = buffer_offset + cdef Py_ssize_t c_data_offset = data_offset + cdef Py_ssize_t data_length + cdef uint64_t buffer_size = buffer.size + if not size: + data_length = nbytes - c_data_offset + else: + data_length = size + if not (c_buffer_offset < buffer_size): + raise ValueError("Invalid buffer_offset") + if not (0 <= c_data_offset < nbytes): + raise ValueError("Invalid data_offset") + if not (0 <= data_length <= (nbytes - c_data_offset)): + raise ValueError("Invalid data_length") + if not (data_length <= buffer_size - c_buffer_offset): + raise ValueError("Invalid data_length") + # This call copies the data, so it's ok if the data is released afterwards. + wgpuQueueWriteBuffer( + _self_ptr(self), + _ptr(buffer), + c_buffer_offset, + buf.view.buf + c_data_offset, + data_length, + ) + _check() + + def read_buffer(self, buffer, buffer_offset: int = 0, size: int | None = None): + if not size: + data_length = buffer.size - buffer_offset + else: + data_length = int(size) + if not (0 <= buffer_offset < buffer.size): + raise ValueError("Invalid buffer_offset") + if not (data_length <= buffer.size - buffer_offset): + raise ValueError("Invalid data_length") + + device = buffer._device + tmp_usage = flags.BufferUsage.COPY_DST | flags.BufferUsage.MAP_READ + tmp_buffer = device._create_buffer("", data_length, tmp_usage, False) + + encoder = device.create_command_encoder() + encoder.copy_buffer_to_buffer(buffer, buffer_offset, tmp_buffer, 0, data_length) + self.submit([encoder.finish()]) + + tmp_buffer.map_async("READ").sync_wait() + data = tmp_buffer.read_mapped() + tmp_buffer.destroy() + return data + + def write_texture(self, destination, data, data_layout, size) -> None: + cdef WGPUTexelCopyTextureInfo c_destination + cdef WGPUTexelCopyBufferLayout c_layout = WGPU_TEXEL_COPY_BUFFER_LAYOUT_INIT + cdef WGPUExtent3D c_size + cdef _Buffer buf + check_struct("TexelCopyTextureInfo", destination) + check_struct("TexelCopyBufferLayout", data_layout) + _fill_texel_copy_texture_info(&c_destination, destination) + buf = _Buffer(data) + size = _tuple_from_extent3d(size) + _fill_extent(&c_size, size) + c_layout.offset = data_layout.get("offset", 0) + c_layout.bytesPerRow = data_layout["bytes_per_row"] + c_layout.rowsPerImage = data_layout.get("rows_per_image", size[1]) + wgpuQueueWriteTexture( + _self_ptr(self), + &c_destination, + buf.view.buf, + buf.view.len, + &c_layout, + &c_size, + ) + _check() + + _shared_copy_buffer = None, 0 + + def read_texture(self, source, data_layout, size): + device = source["texture"]._device + + ori_offset = data_layout.get("offset", 0) + ori_stride = data_layout["bytes_per_row"] + extra_stride = (256 - ori_stride % 256) % 256 + full_stride = ori_stride + extra_stride + + size = _tuple_from_extent3d(size) + data_length = full_stride * size[1] * size[2] + + is_present_texture = source["texture"].label == "present" + copy_buffer = None + if is_present_texture: + copy_buffer, time_since_size_ok = self._shared_copy_buffer + if copy_buffer is None: + pass + elif copy_buffer.size < data_length: + copy_buffer = None + elif copy_buffer.size < data_length * 4: + self._shared_copy_buffer = copy_buffer, time.time() + elif time.time() - time_since_size_ok > 5.0: + copy_buffer = None + if copy_buffer is None: + buffer_size = data_length + buffer_size += (4096 - buffer_size % 4096) % 4096 + buf_usage = flags.BufferUsage.COPY_DST | flags.BufferUsage.MAP_READ + copy_buffer = device._create_buffer("copy-buffer", buffer_size, buf_usage, False) + if is_present_texture: + self._shared_copy_buffer = copy_buffer, time.time() + + destination = { + "buffer": copy_buffer, + "offset": 0, + "bytes_per_row": full_stride, + "rows_per_image": data_layout.get("rows_per_image", size[1]), + } + + encoder = device.create_command_encoder() + encoder.copy_texture_to_buffer(source, destination, size) + self.submit([encoder.finish()]) + + promise = copy_buffer.map_async("READ", 0, data_length) + if copy_buffer.map_state == "pending": + promise.sync_wait() + mapped_data = copy_buffer.read_mapped(copy=False) + + data_length2 = ori_stride * size[1] * size[2] + ori_offset + if extra_stride or ori_offset: + data = memoryview(bytearray(data_length2)).cast(mapped_data.format) + i_start = ori_offset + for i in range(size[1] * size[2]): + row = mapped_data[i * full_stride : i * full_stride + ori_stride] + data[i_start : i_start + ori_stride] = row + i_start += ori_stride + else: + data = memoryview(bytearray(mapped_data)).cast(mapped_data.format) + + copy_buffer.unmap() + return data + + def on_submitted_work_done_async(self) -> GPUPromise[None]: + cdef WGPUQueueWorkDoneCallbackInfo cb = WGPU_QUEUE_WORK_DONE_CALLBACK_INFO_INIT + cdef WGPUFuture future + promise = GPUPromise("on_submitted_work_done", None) + cb.mode = WGPUCallbackMode_AllowProcessEvents + cb.callback = _queue_work_done_callback + cb.userdata1 = _promise_userdata(promise) + future = wgpuQueueOnSubmittedWorkDone(_self_ptr(self), cb) + _check() + promise._set_future(future.id) + return promise + + +class GPURenderBundle(classes.GPURenderBundle, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuRenderBundleRelease(ptr) + + +class GPUQuerySet(classes.GPUQuerySet, GPUObjectBase): + def _release_ptr(self, ptr): + wgpuQuerySetRelease(ptr) + + def destroy(self) -> None: + if (<_Handle>self)._ptr != NULL: + wgpuQuerySetDestroy((<_Handle>self)._ptr) + _check() + + +# %% Subclasses that don't need anything else + + +class GPUCompilationMessage(classes.GPUCompilationMessage): + def __init__(self, message, type, line_num, line_pos, offset, length): + self._message = message + self._type = type + self._line_num = line_num + self._line_pos = line_pos + self._offset = offset + self._length = length + + @property + def message(self): + return self._message + + @property + def type(self): + return self._type + + @property + def line_num(self): + return self._line_num + + @property + def line_pos(self): + return self._line_pos + + @property + def offset(self): + return self._offset + + @property + def length(self): + return self._length + + +class GPUCompilationInfo(classes.GPUCompilationInfo): + def __init__(self, messages): + self._messages = list(messages) + + @property + def messages(self): + return self._messages + + +class GPUDeviceLostInfo(classes.GPUDeviceLostInfo): + pass + + +class GPUError(classes.GPUError): + pass + + +class GPUOutOfMemoryError(classes.GPUOutOfMemoryError, GPUError): + pass + + +class GPUValidationError(classes.GPUValidationError, GPUError): + pass + + +class GPUPipelineError(classes.GPUPipelineError): + pass + + +class GPUInternalError(classes.GPUInternalError, GPUError): + pass + + +class DrawCancelled(classes.DrawCancelled): + pass + + +ERROR_TYPES = { + "": GPUError, + "OutOfMemory": GPUOutOfMemoryError, + "Validation": GPUValidationError, + "Internal": GPUInternalError, + "Unknown": GPUError, +} + + +# %% + + +def _copy_docstrings(): + base_classes = GPUObjectBase, GPUCanvasContext, GPUAdapter + for ob in list(globals().values()): + if not (isinstance(ob, type) and issubclass(ob, base_classes)): + continue + elif ob.__module__ != __name__: + continue # no-cover + base_cls = ob.mro()[1] + try: + ob.__doc__ = base_cls.__doc__ + except (AttributeError, TypeError): # no-cover + pass + for name, attr in list(ob.__dict__.items()): + if name.startswith("_") or not hasattr(attr, "__doc__"): + continue + base_attr = getattr(base_cls, name, None) + if base_attr is not None: + try: + attr.__doc__ = base_attr.__doc__ + except (AttributeError, TypeError): # no-cover + pass + + +_copy_docstrings() From 7ebd4b00f7d6197a0194f5c91e875ceef7a86734 Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Wed, 30 Sep 2026 22:41:21 -0400 Subject: [PATCH 3/8] Add Dawn CI workflow and call-overhead benchmarks
Claude's draft * .github/workflows/dawn.yml: separate from the main CI. Installs Dawn, Cython and a C compiler with micromamba (channels mark.harfouche, then conda-forge), builds the Dawn backend, and runs the Dawn tests plus the generic tests that apply, on lavapipe. Also reports on the full test suite and runs the API benchmark (informational). Runs on pushes to main/dawn and on PRs. * tools/binding_benchmark: micro-benchmark comparing cffi ABI, cffi API, Cython (full and Limited API), nanobind and pybind11 for calling the same Dawn functions, plus the class layout used by the backend. * tools/bench_backends.py: per-call overhead through the public wgpu-py API, for the wgpu-native and Dawn backends. Resume this Claude session: ``` cd /home/mark/git/feedstock/staged-recipes claude --resume 2cab6db9-a6ea-4976-a0e6-f4153fe5a651 ```
Claude-Session: https://claude.ai/code/session_01QMLpZTQYYCu2K7EaWNnkEG --- .github/workflows/dawn.yml | 127 +++++++++++ tools/bench_backends.py | 226 ++++++++++++++++++++ tools/binding_benchmark/.gitignore | 5 + tools/binding_benchmark/CMakeLists.txt | 12 ++ tools/binding_benchmark/_bench_cls.pyx | 34 +++ tools/binding_benchmark/_bench_cython.pyx | 112 ++++++++++ tools/binding_benchmark/_bench_nanobind.cpp | 8 + tools/binding_benchmark/_bench_pybind11.cpp | 8 + tools/binding_benchmark/bench.py | 209 ++++++++++++++++++ tools/binding_benchmark/bench_cls.py | 42 ++++ tools/binding_benchmark/bench_cxx_body.inc | 28 +++ tools/binding_benchmark/build.py | 113 ++++++++++ tools/binding_benchmark/common.py | 126 +++++++++++ 13 files changed, 1050 insertions(+) create mode 100644 .github/workflows/dawn.yml create mode 100644 tools/bench_backends.py create mode 100644 tools/binding_benchmark/.gitignore create mode 100644 tools/binding_benchmark/CMakeLists.txt create mode 100644 tools/binding_benchmark/_bench_cls.pyx create mode 100644 tools/binding_benchmark/_bench_cython.pyx create mode 100644 tools/binding_benchmark/_bench_nanobind.cpp create mode 100644 tools/binding_benchmark/_bench_pybind11.cpp create mode 100644 tools/binding_benchmark/bench.py create mode 100644 tools/binding_benchmark/bench_cls.py create mode 100644 tools/binding_benchmark/bench_cxx_body.inc create mode 100644 tools/binding_benchmark/build.py create mode 100644 tools/binding_benchmark/common.py diff --git a/.github/workflows/dawn.yml b/.github/workflows/dawn.yml new file mode 100644 index 000000000..ed0b78a8a --- /dev/null +++ b/.github/workflows/dawn.yml @@ -0,0 +1,127 @@ +name: Dawn backend + +# CI for the (optional, experimental) Dawn backend. This is separate from the +# main CI, so that it does not affect the wgpu-native jobs. Dawn, Cython and +# the compilers are obtained from conda. + +on: + workflow_dispatch: + push: + branches: + - main + - dawn + pull_request: + branches: + - main + +jobs: + test-dawn: + name: Dawn ${{ matrix.os }} py${{ matrix.python-version }} + timeout-minutes: 30 + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + python-version: '3.12' + - os: ubuntu-latest + python-version: '3.14' + defaults: + run: + shell: bash -el {0} + steps: + - uses: actions/checkout@v4 + + - name: Install lavapipe (software Vulkan driver) + run: | + sudo apt-get update -y -qq + sudo apt install -y mesa-vulkan-drivers + + - name: Install Dawn and build tools with conda + uses: mamba-org/setup-micromamba@v2 + with: + environment-name: wgpu-dawn + condarc: | + channel_priority: strict + channels: + - mark.harfouche + - conda-forge + create-args: >- + python=${{ matrix.python-version }} + dawn + cython>=3.1 + setuptools + c-compiler + cffi + numpy + pytest + psutil + anyio + trio + rendercanvas + imageio + pypng + cache-environment: false + + - name: Show versions + run: | + micromamba list | grep -E "dawn|cython|python |vulkan" + ls /usr/share/vulkan/icd.d/ + + - name: Build the Dawn backend + run: | + python tools/build_dawn.py + ls -la wgpu/backends/dawn/ + + - name: Test the Dawn backend + env: + WGPUPY_BACKEND: dawn + PYTHONPATH: ${{ github.workspace }} + run: | + # Use lavapipe as the Vulkan driver + export VK_ICD_FILENAMES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -1) + python -c "import wgpu; print(wgpu.utils.get_default_device().adapter.summary)" + # Dawn-specific tests, plus the generic tests that also apply to Dawn. + pytest -v tests/test_dawn_backend.py tests/test_api.py tests/test_async.py \ + tests/test_canvas.py tests/test_not_finite.py tests/test_util_compute.py \ + tests/test_util_core.py tests/test_wgpu_native_buffer.py \ + tests/test_wgpu_native_compute_tex.py tests/test_wgpu_native_render.py \ + tests/test_wgpu_native_render_tex.py tests/test_wgpu_native_texture.py \ + tests/test_wgpu_occlusion_query.py \ + --deselect tests/test_wgpu_native_buffer.py::test_buffer_init1 + + - name: Report on the full test suite (informational) + continue-on-error: true + env: + WGPUPY_BACKEND: dawn + PYTHONPATH: ${{ github.workspace }} + run: | + export VK_ICD_FILENAMES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -1) + pytest tests -q -rfE --continue-on-collection-errors || true + + - name: Benchmark the per-call overhead (informational) + continue-on-error: true + env: + WGPUPY_BACKEND: dawn + PYTHONPATH: ${{ github.workspace }} + run: | + export VK_ICD_FILENAMES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -1) + python tools/bench_backends.py + + codegen-dawn: + name: Dawn codegen up to date + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -U -e .[codegen] + - name: Test codegen (includes the Dawn pxd and mappings) + run: | + pytest -v codegen diff --git a/tools/bench_backends.py b/tools/bench_backends.py new file mode 100644 index 000000000..3a0aa288a --- /dev/null +++ b/tools/bench_backends.py @@ -0,0 +1,226 @@ +""" +Benchmark the per-call overhead of the wgpu-py API for a given backend. + +This measures the cost of common calls *through the public wgpu-py API* +(i.e. including all Python-side logic of the backend), using cheap calls so +that the Python -> native overhead dominates. Run it once per backend:: + + WGPUPY_BACKEND=wgpu_native python tools/bench_backends.py + WGPUPY_BACKEND=dawn python tools/bench_backends.py + +Or run ``python tools/bench_backends.py --all`` to run all available backends +in subprocesses and print a markdown table. +""" + +import os +import sys +import json +import time +import subprocess + + +REPEAT = 5 + + +def best_ns(func, n): + times = [] + for _ in range(REPEAT): + t0 = time.perf_counter() + func(n) + times.append(time.perf_counter() - t0) + return min(times) / n * 1e9 + + +def run_benchmarks(): + import numpy as np + import wgpu + + device = wgpu.utils.get_default_device() + adapter_summary = device.adapter.summary + + shader = device.create_shader_module( + code=""" + @group(0) @binding(0) var u: vec4; + @vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4 { + return vec4(f32(i % 2u), f32(i / 2u), 0.0, 1.0) * u.x; + } + @fragment fn fs_main() -> @location(0) vec4 { return u; } + @group(0) @binding(1) var data: array; + @compute @workgroup_size(1) fn cs_main() { data[0] = data[0] + 1u; } + """ + ) + ubuf = device.create_buffer( + size=256, usage=wgpu.BufferUsage.UNIFORM | wgpu.BufferUsage.COPY_DST + ) + sbuf = device.create_buffer( + size=256, usage=wgpu.BufferUsage.STORAGE | wgpu.BufferUsage.COPY_DST + ) + bgl = device.create_bind_group_layout( + entries=[ + { + "binding": 0, + "visibility": wgpu.ShaderStage.VERTEX + | wgpu.ShaderStage.FRAGMENT + | wgpu.ShaderStage.COMPUTE, + "buffer": {"type": "uniform"}, + }, + { + "binding": 1, + "visibility": wgpu.ShaderStage.COMPUTE, + "buffer": {"type": "storage"}, + }, + ] + ) + layout = device.create_pipeline_layout(bind_group_layouts=[bgl]) + bind_group = device.create_bind_group( + layout=bgl, + entries=[ + {"binding": 0, "resource": {"buffer": ubuf}}, + {"binding": 1, "resource": {"buffer": sbuf}}, + ], + ) + render_pipeline = device.create_render_pipeline( + layout=layout, + vertex={"module": shader, "entry_point": "vs_main"}, + fragment={ + "module": shader, + "entry_point": "fs_main", + "targets": [{"format": "rgba8unorm"}], + }, + ) + compute_pipeline = device.create_compute_pipeline( + layout=layout, compute={"module": shader, "entry_point": "cs_main"} + ) + texture = device.create_texture( + size=(64, 64, 1), + format="rgba8unorm", + usage=wgpu.TextureUsage.RENDER_ATTACHMENT, + ) + view = texture.create_view() + color_attachments = [ + { + "view": view, + "load_op": "clear", + "store_op": "store", + "clear_value": (0, 0, 0, 1), + } + ] + data64 = np.zeros(16, np.float32) + + results = {} + + # Recording calls inside a pass. We start a new pass for each run, and + # record many calls into it (not submitted). + def in_render_pass(body): + def run(n): + encoder = device.create_command_encoder() + rp = encoder.begin_render_pass(color_attachments=color_attachments) + rp.set_pipeline(render_pipeline) + rp.set_bind_group(0, bind_group) + body(rp, n) + rp.end() + encoder.finish() + + return run + + def draw(rp, n): + f = rp.draw + for _ in range(n): + f(3) + + def set_bind_group(rp, n): + f = rp.set_bind_group + for _ in range(n): + f(0, bind_group) + + def set_viewport(rp, n): + f = rp.set_viewport + for _ in range(n): + f(0, 0, 64, 64, 0, 1) + + def dispatch(n): + encoder = device.create_command_encoder() + cp = encoder.begin_compute_pass() + cp.set_pipeline(compute_pipeline) + cp.set_bind_group(0, bind_group) + f = cp.dispatch_workgroups + for _ in range(n): + f(1) + cp.end() + encoder.finish() + + def write_buffer(n): + f = device.queue.write_buffer + for _ in range(n): + f(ubuf, 0, data64) + device.queue.submit([]) + + def frame(n): + queue = device.queue + for i in range(n): + encoder = device.create_command_encoder() + rp = encoder.begin_render_pass(color_attachments=color_attachments) + rp.set_pipeline(render_pipeline) + rp.set_bind_group(0, bind_group) + for _ in range(10): + rp.draw(3) + rp.end() + queue.submit([encoder.finish()]) + if i % 100 == 99: + queue.on_submitted_work_done_sync() + queue.on_submitted_work_done_sync() + + def create_bind_group(n): + entries = [ + {"binding": 0, "resource": {"buffer": ubuf}}, + {"binding": 1, "resource": {"buffer": sbuf}}, + ] + for _ in range(n): + device.create_bind_group(layout=bgl, entries=entries) + + results["render_pass.draw(3)"] = best_ns(in_render_pass(draw), 100_000) + results["render_pass.set_bind_group(0, bg)"] = best_ns( + in_render_pass(set_bind_group), 100_000 + ) + results["render_pass.set_viewport(...)"] = best_ns( + in_render_pass(set_viewport), 100_000 + ) + results["compute_pass.dispatch_workgroups(1)"] = best_ns(dispatch, 100_000) + results["queue.write_buffer(64 bytes)"] = best_ns(write_buffer, 20_000) + results["device.create_bind_group(2 entries)"] = best_ns(create_bind_group, 5_000) + results["frame: encoder+pass+10 draws+submit"] = best_ns(frame, 2_000) + + return {"adapter": adapter_summary, "results": results} + + +def main(): + if "--all" not in sys.argv: + out = run_benchmarks() + print(json.dumps(out)) + return + + all_results = {} + for backend in ("wgpu_native", "dawn"): + env = dict(os.environ, WGPUPY_BACKEND=backend) + p = subprocess.run( + [sys.executable, __file__], env=env, capture_output=True, text=True + ) + lines = [line for line in p.stdout.splitlines() if line.startswith("{")] + if p.returncode or not lines: + print(f"Backend {backend} failed:\n{p.stderr[-2000:]}") + continue + all_results[backend] = json.loads(lines[-1]) + + backends = list(all_results) + print("| call (ns per call, lower is better) | " + " | ".join(backends) + " |") + print("|---|" + "---:|" * len(backends)) + keys = next(iter(all_results.values()))["results"].keys() if backends else [] + for key in keys: + vals = " | ".join(f"{all_results[b]['results'][key]:,.0f}" for b in backends) + print(f"| {key} | {vals} |") + for b in backends: + print(f"* {b}: {all_results[b]['adapter']}") + + +if __name__ == "__main__": + main() diff --git a/tools/binding_benchmark/.gitignore b/tools/binding_benchmark/.gitignore new file mode 100644 index 000000000..811acc6ce --- /dev/null +++ b/tools/binding_benchmark/.gitignore @@ -0,0 +1,5 @@ +*.c +*.o +*_ltd.pyx +dawn_clean.h +build/ diff --git a/tools/binding_benchmark/CMakeLists.txt b/tools/binding_benchmark/CMakeLists.txt new file mode 100644 index 000000000..064788d0a --- /dev/null +++ b/tools/binding_benchmark/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.18) +project(bench LANGUAGES C CXX) +set(CMAKE_BUILD_TYPE Release) +find_package(Python 3.12 COMPONENTS Interpreter Development.Module Development.SABIModule REQUIRED) +find_package(Dawn CONFIG REQUIRED) +execute_process(COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_ROOT) +find_package(nanobind CONFIG REQUIRED) +nanobind_add_module(_bench_nanobind STABLE_ABI NB_STATIC _bench_nanobind.cpp) +target_link_libraries(_bench_nanobind PRIVATE dawn::webgpu_dawn) +find_package(pybind11 CONFIG REQUIRED) +pybind11_add_module(_bench_pybind11 _bench_pybind11.cpp) +target_link_libraries(_bench_pybind11 PRIVATE dawn::webgpu_dawn) diff --git a/tools/binding_benchmark/_bench_cls.pyx b/tools/binding_benchmark/_bench_cls.pyx new file mode 100644 index 000000000..b4ac0b314 --- /dev/null +++ b/tools/binding_benchmark/_bench_cls.pyx @@ -0,0 +1,34 @@ +# cython: language_level=3 +from libc.stdint cimport uint64_t, uintptr_t +cdef extern from "webgpu/webgpu.h": + ctypedef void* WGPUBuffer + uint64_t wgpuBufferGetSize(WGPUBuffer) + +class PyBase: # stands in for wgpu._classes.GPUBuffer (pure Python) + def get_size(self): + raise NotImplementedError() + +# (a) regular Python class compiled by Cython, handle stored as Python int +class BufA(PyBase): + def __init__(self, addr): + self._internal = addr + def get_size(self): + return wgpuBufferGetSize(self._internal) + +# (b) extension base type holding the C pointer, combined with the Python API class +cdef class _HandleBase: + cdef void* _ptr + def get_size(self): + return wgpuBufferGetSize(self._ptr) + +class BufB(_HandleBase, PyBase): + def __init__(self, addr): + (<_HandleBase>self)._ptr = addr + +# (c) Python class compiled by Cython, multiple inheritance with the extension base, +# method body reaches the C pointer via an unchecked cast. +class BufC(PyBase, _HandleBase): + def __init__(self, addr): + (<_HandleBase>self)._ptr = addr + def get_size(self): + return wgpuBufferGetSize((<_HandleBase>self)._ptr) diff --git a/tools/binding_benchmark/_bench_cython.pyx b/tools/binding_benchmark/_bench_cython.pyx new file mode 100644 index 000000000..386a06e5b --- /dev/null +++ b/tools/binding_benchmark/_bench_cython.pyx @@ -0,0 +1,112 @@ +# cython: language_level=3, boundscheck=False, wraparound=False +from libc.stdint cimport uint32_t, uint64_t, uintptr_t +from libc.stdlib cimport malloc, free + +cdef extern from "webgpu/webgpu.h": + ctypedef void* WGPUBuffer + ctypedef void* WGPUDevice + ctypedef void* WGPUQueue + ctypedef void* WGPUCommandEncoder + ctypedef void* WGPUComputePassEncoder + ctypedef void* WGPUComputePipeline + ctypedef void* WGPUBindGroup + ctypedef void* WGPUCommandBuffer + ctypedef struct WGPUCommandEncoderDescriptor + ctypedef struct WGPUComputePassDescriptor + ctypedef struct WGPUCommandBufferDescriptor + uint64_t wgpuBufferGetSize(WGPUBuffer) + WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice, const WGPUCommandEncoderDescriptor*) + WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder, const WGPUComputePassDescriptor*) + void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder, WGPUComputePipeline) + void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder, uint32_t, WGPUBindGroup, size_t, const uint32_t*) + void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder, uint32_t, uint32_t, uint32_t) + void wgpuComputePassEncoderEnd(WGPUComputePassEncoder) + void wgpuComputePassEncoderRelease(WGPUComputePassEncoder) + WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder, const WGPUCommandBufferDescriptor*) + void wgpuCommandEncoderRelease(WGPUCommandEncoder) + void wgpuCommandBufferRelease(WGPUCommandBuffer) + void wgpuQueueSubmit(WGPUQueue, size_t, const WGPUCommandBuffer*) + +cdef class Handle: + cdef void* ptr + def get_size(self): + return wgpuBufferGetSize(self.ptr) + def dispatch_workgroups(self, uint32_t x, uint32_t y=1, uint32_t z=1): + wgpuComputePassEncoderDispatchWorkgroups(self.ptr, x, y, z) + @staticmethod + def from_address(uintptr_t a): + cdef Handle h = Handle.__new__(Handle) + h.ptr = a + return h + +cdef inline Handle _wrap(void* p): + cdef Handle h = Handle.__new__(Handle) + h.ptr = p + return h + +def buffer_get_size(Handle b): + return wgpuBufferGetSize(b.ptr) + +def device_create_command_encoder(Handle d): + return _wrap(wgpuDeviceCreateCommandEncoder(d.ptr, NULL)) + +def command_encoder_begin_compute_pass(Handle e): + return _wrap(wgpuCommandEncoderBeginComputePass(e.ptr, NULL)) + +def compute_pass_set_pipeline(Handle p, Handle pipe): + wgpuComputePassEncoderSetPipeline(p.ptr, pipe.ptr) + +def compute_pass_set_bind_group(Handle p, uint32_t index, Handle bg): + wgpuComputePassEncoderSetBindGroup(p.ptr, index, bg.ptr, 0, NULL) + +def compute_pass_dispatch(Handle p, uint32_t x, uint32_t y, uint32_t z): + wgpuComputePassEncoderDispatchWorkgroups(p.ptr, x, y, z) + +def compute_pass_end(Handle p): + wgpuComputePassEncoderEnd(p.ptr) + +def compute_pass_release(Handle p): + wgpuComputePassEncoderRelease(p.ptr) + +def command_encoder_finish(Handle e): + return _wrap(wgpuCommandEncoderFinish(e.ptr, NULL)) + +def command_encoder_release(Handle e): + wgpuCommandEncoderRelease(e.ptr) + +def command_buffer_release(Handle c): + wgpuCommandBufferRelease(c.ptr) + +def queue_submit(Handle q, list cbs): + cdef size_t n = len(cbs) + cdef WGPUCommandBuffer arr[16] + cdef size_t i + for i in range(n): + arr[i] = (cbs[i]).ptr + wgpuQueueSubmit(q.ptr, n, arr) + +def c_encode_loop(Handle device, Handle queue, Handle pipe, Handle bg, int n): + """Same encode/submit sequence entirely in C (the floor).""" + cdef int i + cdef void* e + cdef void* p + cdef void* cb + for i in range(n): + e = wgpuDeviceCreateCommandEncoder(device.ptr, NULL) + p = wgpuCommandEncoderBeginComputePass(e, NULL) + wgpuComputePassEncoderSetPipeline(p, pipe.ptr) + wgpuComputePassEncoderSetBindGroup(p, 0, bg.ptr, 0, NULL) + wgpuComputePassEncoderDispatchWorkgroups(p, 1, 1, 1) + wgpuComputePassEncoderEnd(p) + wgpuComputePassEncoderRelease(p) + cb = wgpuCommandEncoderFinish(e, NULL) + wgpuQueueSubmit(queue.ptr, 1, &cb) + wgpuCommandBufferRelease(cb) + wgpuCommandEncoderRelease(e) + +def c_get_size_loop(Handle b, int n): + cdef int i + cdef uint64_t s = 0 + for i in range(n): + s += wgpuBufferGetSize(b.ptr) + return s diff --git a/tools/binding_benchmark/_bench_nanobind.cpp b/tools/binding_benchmark/_bench_nanobind.cpp new file mode 100644 index 000000000..a876d345d --- /dev/null +++ b/tools/binding_benchmark/_bench_nanobind.cpp @@ -0,0 +1,8 @@ +#include +#include +namespace nb = nanobind; +#define MODTYPE nb::module_ +#define MODTYPE_ARG nb::arg +#define CLASS nb::class_ +#include "bench_cxx_body.inc" +NB_MODULE(_bench_nanobind, m) { define_all(m); } diff --git a/tools/binding_benchmark/_bench_pybind11.cpp b/tools/binding_benchmark/_bench_pybind11.cpp new file mode 100644 index 000000000..bb07fae72 --- /dev/null +++ b/tools/binding_benchmark/_bench_pybind11.cpp @@ -0,0 +1,8 @@ +#include +#include +namespace py = pybind11; +#define MODTYPE py::module_ +#define MODTYPE_ARG py::arg +#define CLASS py::class_ +#include "bench_cxx_body.inc" +PYBIND11_MODULE(_bench_pybind11, m) { define_all(m); } diff --git a/tools/binding_benchmark/bench.py b/tools/binding_benchmark/bench.py new file mode 100644 index 000000000..76cc91276 --- /dev/null +++ b/tools/binding_benchmark/bench.py @@ -0,0 +1,209 @@ +"""Micro-benchmark: per-call overhead of different Python bindings to Dawn. + +Run ``build.py`` first. Use ``BENCH_BACKEND=null`` to use Dawn's Null backend, +so that only CPU-side costs are measured. +""" + +import time +import os +import platform +import common +from common import lib as abi_lib, ffi as abi_ffi, addr + +S = common.setup() +N1 = int(os.environ.get("N1", 1_000_000)) +N2 = int(os.environ.get("N2", 20_000)) +REPEAT = 7 + + +def best(fn, n): + ts = [] + for _ in range(REPEAT): + t0 = time.perf_counter() + fn(n) + ts.append(time.perf_counter() - t0) + return min(ts) / n * 1e9 # ns per iteration + + +def tick(): + abi_lib.wgpuDeviceTick(S["device"]) + + +results = {} + + +class PyWrapper: + """Mimics wgpu-py: a Python class whose method calls a binding function.""" + + __slots__ = ["_internal"] + _fn = None + + def __init__(self, internal): + self._internal = internal + + def get_size(self): + return type(self)._fn(self._internal) + + +def pywrap_bench(fn, handle): + cls = type("W", (PyWrapper,), {"_fn": staticmethod(fn)}) + w = cls(handle) + + def run(n): + for _ in range(n): + w.get_size() + + return best(run, N1) + + +# ---- cffi variants +def make_cffi(name, ffi, lib): + def h(key): + return ffi.cast( + abi_ffi.typeof(S[key]).cname + if False + else "WGPU" + + { + "buffer": "Buffer", + "device": "Device", + "queue": "Queue", + "pipeline": "ComputePipeline", + "bindgroup": "BindGroup", + }[key], + addr(S[key]), + ) + + buf, dev, q, pipe, bg = ( + h("buffer"), + h("device"), + h("queue"), + h("pipeline"), + h("bindgroup"), + ) + + def get_size(n): + f = lib.wgpuBufferGetSize + for _ in range(n): + f(buf) + + def get_size_attr(n): + for _ in range(n): + lib.wgpuBufferGetSize(buf) + + def encode(n): + for i in range(n): + e = lib.wgpuDeviceCreateCommandEncoder(dev, ffi.NULL) + p = lib.wgpuCommandEncoderBeginComputePass(e, ffi.NULL) + lib.wgpuComputePassEncoderSetPipeline(p, pipe) + lib.wgpuComputePassEncoderSetBindGroup(p, 0, bg, 0, ffi.NULL) + lib.wgpuComputePassEncoderDispatchWorkgroups(p, 1, 1, 1) + lib.wgpuComputePassEncoderEnd(p) + lib.wgpuComputePassEncoderRelease(p) + cb = lib.wgpuCommandEncoderFinish(e, ffi.NULL) + cbs = ffi.new("WGPUCommandBuffer[]", [cb]) + lib.wgpuQueueSubmit(q, 1, cbs) + lib.wgpuCommandBufferRelease(cb) + lib.wgpuCommandEncoderRelease(e) + if i % 1000 == 999: + tick() + + pw = pywrap_bench(lib.wgpuBufferGetSize, buf) + results[name] = dict( + get_size=best(get_size, N1), + get_size_attr=best(get_size_attr, N1), + method=pw, + pywrap=pw, + encode=best(encode, N2), + ) + + +make_cffi("cffi ABI (dlopen)", abi_ffi, abi_lib) +import _bench_cffi_api # noqa: E402 + +make_cffi("cffi API (out-of-line, abi3)", _bench_cffi_api.ffi, _bench_cffi_api.lib) + + +# ---- compiled-wrapper variants (cython / nanobind / pybind11) +def make_compiled(name, m): + wrap = m.Handle.from_address + buf, dev, q, pipe, bg = ( + wrap(addr(S[k])) for k in ("buffer", "device", "queue", "pipeline", "bindgroup") + ) + + def get_size(n): + f = m.buffer_get_size + for _ in range(n): + f(buf) + + def get_size_attr(n): + for _ in range(n): + m.buffer_get_size(buf) + + def encode(n): + for i in range(n): + e = m.device_create_command_encoder(dev) + p = m.command_encoder_begin_compute_pass(e) + m.compute_pass_set_pipeline(p, pipe) + m.compute_pass_set_bind_group(p, 0, bg) + m.compute_pass_dispatch(p, 1, 1, 1) + m.compute_pass_end(p) + m.compute_pass_release(p) + cb = m.command_encoder_finish(e) + m.queue_submit(q, [cb]) + m.command_buffer_release(cb) + m.command_encoder_release(e) + if i % 1000 == 999: + tick() + + def meth(n): + for _ in range(n): + buf.get_size() + + r = dict( + get_size=best(get_size, N1), + get_size_attr=best(get_size_attr, N1), + method=best(meth, N1), + pywrap=pywrap_bench(m.buffer_get_size, buf), + encode=best(encode, N2), + ) + if hasattr(m, "c_encode_loop"): + + def c_enc(n): + for _ in range(n // 1000): + m.c_encode_loop(dev, q, pipe, bg, 1000) + tick() + + def c_size(n): + m.c_get_size_loop(buf, n) + + results["pure C (floor)"] = dict( + get_size=best(c_size, N1), + get_size_attr=float("nan"), + method=float("nan"), + pywrap=float("nan"), + encode=best(c_enc, N2), + ) + results[name] = r + + +import _bench_cython # noqa: E402 +import _bench_cython_ltd # noqa: E402 +import _bench_nanobind # noqa: E402 +import _bench_pybind11 # noqa: E402 + +make_compiled("Cython 3 (full CPython API)", _bench_cython) +make_compiled("Cython 3 (Limited API, abi3)", _bench_cython_ltd) +make_compiled("nanobind (stable ABI)", _bench_nanobind) +make_compiled("pybind11", _bench_pybind11) + +print( + f"Python {platform.python_version()}, backend={os.environ.get('BENCH_BACKEND', 'vulkan')}, N1={N1}, N2={N2}, best of {REPEAT}" +) +print( + "| binding | GetSize, bound func (ns) | GetSize, mod.attr (ns) | buffer.get_size() method (ns) | Python wrapper class (ns) | encode+submit, 11 calls (us) |" +) +print("|---|---:|---:|---:|---:|---:|") +for k, v in results.items(): + print( + f"| {k} | {v['get_size']:.1f} | {v['get_size_attr']:.1f} | {v['method']:.1f} | {v['pywrap']:.1f} | {v['encode'] / 1000:.2f} |" + ) diff --git a/tools/binding_benchmark/bench_cls.py b/tools/binding_benchmark/bench_cls.py new file mode 100644 index 000000000..a7f63590d --- /dev/null +++ b/tools/binding_benchmark/bench_cls.py @@ -0,0 +1,42 @@ +"""Micro-benchmark: how to structure compiled wgpu-py classes on top of Cython. + +* BufA: a regular Python class compiled by Cython; the handle is a Python int attribute. +* BufB: a cdef (extension) base class that holds the pointer; method defined on it. +* BufC: a Python class (as in wgpu-py) that inherits from the public Python API class + *and* the extension base class; the compiled method reaches the C pointer directly. + This is the design used by the Dawn backend. +""" + +import time + +import common +import _bench_cls +import _bench_cls_ltd + + +def best(f, n=1_000_000): + times = [] + for _ in range(7): + t0 = time.perf_counter() + f(n) + times.append(time.perf_counter() - t0) + return min(times) / n * 1e9 + + +def main(): + setup = common.setup() + address = common.addr(setup["buffer"]) + for mod in (_bench_cls, _bench_cls_ltd): + for cls in (mod.BufA, mod.BufB, mod.BufC): + b = cls(address) + assert b.get_size() == 1024 + + def run(n, b=b): + for _ in range(n): + b.get_size() + + print(f"{mod.__name__:16} {cls.__name__}: {best(run):.1f} ns") + + +if __name__ == "__main__": + main() diff --git a/tools/binding_benchmark/bench_cxx_body.inc b/tools/binding_benchmark/bench_cxx_body.inc new file mode 100644 index 000000000..530fbe1de --- /dev/null +++ b/tools/binding_benchmark/bench_cxx_body.inc @@ -0,0 +1,28 @@ +// shared between nanobind and pybind11 variants; expects NS and MOD macros +#include +#include +#include +struct Handle { void* ptr; }; +static Handle wrap(void* p) { return Handle{p}; } +#define H(x) ((decltype(x.ptr))x.ptr) +static void define_all(MODTYPE& m) { + CLASS(m, "Handle") + .def_static("from_address", [](uintptr_t a) { return Handle{(void*)a}; }) + .def("get_size", [](const Handle& b) { return wgpuBufferGetSize((WGPUBuffer)b.ptr); }) + .def("dispatch_workgroups", [](const Handle& p, uint32_t x, uint32_t y, uint32_t z) { wgpuComputePassEncoderDispatchWorkgroups((WGPUComputePassEncoder)p.ptr, x, y, z); }, MODTYPE_ARG("x"), MODTYPE_ARG("y")=1, MODTYPE_ARG("z")=1); + m.def("buffer_get_size", [](const Handle& b) { return wgpuBufferGetSize((WGPUBuffer)b.ptr); }); + m.def("device_create_command_encoder", [](const Handle& d) { return wrap(wgpuDeviceCreateCommandEncoder((WGPUDevice)d.ptr, nullptr)); }); + m.def("command_encoder_begin_compute_pass", [](const Handle& e) { return wrap(wgpuCommandEncoderBeginComputePass((WGPUCommandEncoder)e.ptr, nullptr)); }); + m.def("compute_pass_set_pipeline", [](const Handle& p, const Handle& pipe) { wgpuComputePassEncoderSetPipeline((WGPUComputePassEncoder)p.ptr, (WGPUComputePipeline)pipe.ptr); }); + m.def("compute_pass_set_bind_group", [](const Handle& p, uint32_t i, const Handle& bg) { wgpuComputePassEncoderSetBindGroup((WGPUComputePassEncoder)p.ptr, i, (WGPUBindGroup)bg.ptr, 0, nullptr); }); + m.def("compute_pass_dispatch", [](const Handle& p, uint32_t x, uint32_t y, uint32_t z) { wgpuComputePassEncoderDispatchWorkgroups((WGPUComputePassEncoder)p.ptr, x, y, z); }); + m.def("compute_pass_end", [](const Handle& p) { wgpuComputePassEncoderEnd((WGPUComputePassEncoder)p.ptr); }); + m.def("compute_pass_release", [](const Handle& p) { wgpuComputePassEncoderRelease((WGPUComputePassEncoder)p.ptr); }); + m.def("command_encoder_finish", [](const Handle& e) { return wrap(wgpuCommandEncoderFinish((WGPUCommandEncoder)e.ptr, nullptr)); }); + m.def("command_encoder_release", [](const Handle& e) { wgpuCommandEncoderRelease((WGPUCommandEncoder)e.ptr); }); + m.def("command_buffer_release", [](const Handle& c) { wgpuCommandBufferRelease((WGPUCommandBuffer)c.ptr); }); + m.def("queue_submit", [](const Handle& q, const std::vector& cbs) { + WGPUCommandBuffer arr[16]; size_t n = cbs.size(); + for (size_t i = 0; i < n; i++) arr[i] = (WGPUCommandBuffer)cbs[i]->ptr; + wgpuQueueSubmit((WGPUQueue)q.ptr, n, arr); }); +} diff --git a/tools/binding_benchmark/build.py b/tools/binding_benchmark/build.py new file mode 100644 index 000000000..787e32e8f --- /dev/null +++ b/tools/binding_benchmark/build.py @@ -0,0 +1,113 @@ +""" +Build the binding variants for the Python -> Dawn call-overhead micro-benchmark. + +This benchmark compares binding strategies for the *same* tiny slice of Dawn's +webgpu.h (wgpuBufferGetSize, and an encode+submit sequence of 11 calls): + +* cffi ABI mode (dlopen; what the wgpu-native backend uses) +* cffi API / out-of-line mode (compiled, abi3) +* Cython 3 (full C-API, and Limited API / abi3) +* nanobind (stable ABI) +* pybind11 + +Requirements (conda): dawn cffi cython nanobind pybind11 cmake ninja c-compiler cxx-compiler + +Usage:: + + python tools/binding_benchmark/build.py + BENCH_BACKEND=null python tools/binding_benchmark/bench.py + BENCH_BACKEND=null python tools/binding_benchmark/bench_cls.py +""" + +import os +import sys +import sysconfig +import subprocess + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.abspath(os.path.join(HERE, "..", "..")) +PREFIX = os.environ.get("CONDA_PREFIX", sys.prefix) + + +def run(*cmd): + print(" ".join(cmd)) + subprocess.check_call(cmd, cwd=HERE) + + +def write_clean_header(): + sys.path.insert(0, ROOT) + from codegen.hparser import _get_wgpu_header + + source = _get_wgpu_header( + os.path.join(PREFIX, "include", "dawn", "webgpu.h"), output_filename=None + ) + source = "\n".join( + line + for line in source.splitlines() + if "emscripten_webgpu_get_device" not in line + ) + with open(os.path.join(HERE, "dawn_clean.h"), "w") as f: + f.write(source) + + +def build_cffi_api(): + from cffi import FFI + + ffi = FFI() + with open(os.path.join(HERE, "dawn_clean.h")) as f: + ffi.cdef(f.read()) + ffi.set_source( + "_bench_cffi_api", + "#include ", + include_dirs=[PREFIX + "/include"], + library_dirs=[PREFIX + "/lib"], + runtime_library_dirs=[PREFIX + "/lib"], + libraries=["webgpu_dawn"], + extra_compile_args=["-O2", "-w"], + py_limited_api=True, + ) + ffi.compile(tmpdir=HERE, verbose=False) + + +def build_cython(name, limited): + cc = os.environ.get("CC", "cc") + include = sysconfig.get_paths()["include"] + suffix = ".abi3.so" if limited else sysconfig.get_config_var("EXT_SUFFIX") + flags = ["-DPy_LIMITED_API=0x030C0000", "-DCYTHON_LIMITED_API=1"] if limited else [] + run(sys.executable, "-m", "cython", "-3", f"{name}.pyx", "-o", f"{name}.c") + run( + cc, "-O2", "-shared", "-fPIC", *flags, f"-I{include}", f"-I{PREFIX}/include", + f"{name}.c", "-o", f"{name}{suffix}", f"-L{PREFIX}/lib", + f"-Wl,-rpath,{PREFIX}/lib", "-lwebgpu_dawn", + ) # fmt: skip + + +def build_cython_variants(): + for base in ("_bench_cython", "_bench_cls"): + with open(os.path.join(HERE, base + ".pyx")) as f: + src = f.read() + with open(os.path.join(HERE, base + "_ltd.pyx"), "w") as f: + f.write(src.replace(base, base + "_ltd")) + build_cython(base, False) + build_cython(base + "_ltd", True) + + +def build_cmake(): + import pybind11 + + run( + "cmake", "-S", ".", "-B", "build", "-G", "Ninja", + f"-DCMAKE_PREFIX_PATH={PREFIX}", f"-DPython_EXECUTABLE={sys.executable}", + f"-Dpybind11_DIR={pybind11.get_cmake_dir()}", + ) # fmt: skip + run("cmake", "--build", "build") + for fname in os.listdir(os.path.join(HERE, "build")): + if fname.endswith(".so"): + os.replace(os.path.join(HERE, "build", fname), os.path.join(HERE, fname)) + + +if __name__ == "__main__": + write_clean_header() + build_cffi_api() + build_cython_variants() + build_cmake() diff --git a/tools/binding_benchmark/common.py b/tools/binding_benchmark/common.py new file mode 100644 index 000000000..c84a0b58b --- /dev/null +++ b/tools/binding_benchmark/common.py @@ -0,0 +1,126 @@ +"""Create a Dawn device + buffer + compute pipeline via cffi ABI mode, for benchmarks.""" + +import os +import sys + +from cffi import FFI + +HERE = os.path.dirname(os.path.abspath(__file__)) +PREFIX = os.environ.get("CONDA_PREFIX", sys.prefix) +LIB = os.path.join(PREFIX, "lib", "libwebgpu_dawn.so") + +ffi = FFI() +ffi.cdef(open(os.path.join(HERE, "dawn_clean.h")).read()) +lib = ffi.dlopen(LIB) + + +def sv(s): + b = s.encode() + keep = ffi.new("char[]", b) + v = ffi.new("WGPUStringView *") + v.data = keep + v.length = len(b) + return v[0], keep + + +def setup(): + feats = ffi.new( + "WGPUInstanceFeatureName[1]", [lib.WGPUInstanceFeatureName_TimedWaitAny] + ) + idesc = ffi.new("WGPUInstanceDescriptor *") + idesc.requiredFeatureCount = 1 + idesc.requiredFeatures = feats + instance = lib.wgpuCreateInstance(idesc) + assert instance != ffi.NULL + result = {} + + @ffi.callback( + "void(WGPURequestAdapterStatus, WGPUAdapter, WGPUStringView, void*, void*)" + ) + def on_adapter(status, adapter, msg, u1, u2): + result["adapter"] = adapter + result["msg"] = ffi.string(msg.data, msg.length) if msg.data else b"" + + opts = ffi.new("WGPURequestAdapterOptions *") + backend = os.environ.get("BENCH_BACKEND", "vulkan") + opts.backendType = { + "vulkan": lib.WGPUBackendType_Vulkan, + "null": lib.WGPUBackendType_Null, + }[backend] + cbi = ffi.new("WGPURequestAdapterCallbackInfo *") + cbi.mode = lib.WGPUCallbackMode_WaitAnyOnly + cbi.callback = on_adapter + fut = lib.wgpuInstanceRequestAdapter(instance, opts, cbi[0]) + wi = ffi.new("WGPUFutureWaitInfo[1]") + wi[0].future = fut + lib.wgpuInstanceWaitAny(instance, 1, wi, 10**10) + adapter = result["adapter"] + assert adapter != ffi.NULL, result + + @ffi.callback( + "void(WGPURequestDeviceStatus, WGPUDevice, WGPUStringView, void*, void*)" + ) + def on_device(status, device, msg, u1, u2): + result["device"] = device + + @ffi.callback( + "void(WGPUDevice const *, WGPUErrorType, WGPUStringView, void*, void*)" + ) + def on_error(dev, typ, msg, u1, u2): + print("ERROR", typ, ffi.string(msg.data, msg.length)) + + ddesc = ffi.new("WGPUDeviceDescriptor *") + ddesc.uncapturedErrorCallbackInfo.callback = on_error + dcbi = ffi.new("WGPURequestDeviceCallbackInfo *") + dcbi.mode = lib.WGPUCallbackMode_WaitAnyOnly + dcbi.callback = on_device + wi[0].future = lib.wgpuAdapterRequestDevice(adapter, ddesc, dcbi[0]) + lib.wgpuInstanceWaitAny(instance, 1, wi, 10**10) + device = result["device"] + queue = lib.wgpuDeviceGetQueue(device) + + bdesc = ffi.new("WGPUBufferDescriptor *") + bdesc.size = 1024 + bdesc.usage = lib.WGPUBufferUsage_Storage | lib.WGPUBufferUsage_CopySrc + buffer = lib.wgpuDeviceCreateBuffer(device, bdesc) + + code = b"@group(0) @binding(0) var data: array;\n@compute @workgroup_size(1) fn main(@builtin(global_invocation_id) i: vec3) { data[i.x] = data[i.x] + 1u; }" + wgsl = ffi.new("WGPUShaderSourceWGSL *") + wgsl.chain.sType = lib.WGPUSType_ShaderSourceWGSL + keep_code = ffi.new("char[]", code) + wgsl.code.data = keep_code + wgsl.code.length = len(code) + smdesc = ffi.new("WGPUShaderModuleDescriptor *") + smdesc.nextInChain = ffi.cast("WGPUChainedStruct *", wgsl) + sm = lib.wgpuDeviceCreateShaderModule(device, smdesc) + cpdesc = ffi.new("WGPUComputePipelineDescriptor *") + cpdesc.compute.module = sm + ep, keep_ep = sv("main") + cpdesc.compute.entryPoint = ep + pipeline = lib.wgpuDeviceCreateComputePipeline(device, cpdesc) + bgl = lib.wgpuComputePipelineGetBindGroupLayout(pipeline, 0) + entry = ffi.new("WGPUBindGroupEntry[1]") + entry[0].binding = 0 + entry[0].buffer = buffer + entry[0].offset = 0 + entry[0].size = 1024 + bgdesc = ffi.new("WGPUBindGroupDescriptor *") + bgdesc.layout = bgl + bgdesc.entryCount = 1 + bgdesc.entries = entry + bindgroup = lib.wgpuDeviceCreateBindGroup(device, bgdesc) + keep = [on_adapter, on_device, on_error, feats, idesc, wgsl, keep_code, keep_ep] + return dict( + instance=instance, + adapter=adapter, + device=device, + queue=queue, + buffer=buffer, + pipeline=pipeline, + bindgroup=bindgroup, + _keep=keep, + ) + + +def addr(cdata): + return int(ffi.cast("uintptr_t", cdata)) From 80b2b37f1e21d260327bf6c07a512b007a6ec287 Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Thu, 1 Oct 2026 00:06:22 -0400 Subject: [PATCH 4/8] Run the Cython Dawn backend in Pyodide via Emdawnwebgpu
Claude's draft The same _api.pyx now also compiles for Pyodide, against Emdawnwebgpu (Dawn's webgpu.h on top of the browser's WebGPU), so one backend runs natively and in the browser. Adapted from the cffi-based work in #840. Codegen: * Vendor Emdawnwebgpu's webgpu.h (same Dawn release, v20260929.200159) as wgpu/resources/emdawn_webgpu.h. It is a subset of Dawn's native header. * The main block of _webgpu.pxd is now generated from it, so it is valid for both targets. The few native-only declarations that the backend uses (logging callback, wgpuDeviceTick, native surface sources) are listed in NATIVE_ONLY and declared in a separate block, from the generated dawn_native_only.h. That header includes webgpu.h natively, and with Emscripten defines them (copied from Dawn's header) with no-op functions. * The codegen checks that the common declarations and enum values are the same in both headers. Build (tools/build_dawn.py): when cross-compiling for Emscripten (e.g. with `pyodide build`), download the pinned Emdawnwebgpu package (sha256-checked), generate the JS glue with gen_emdawn_glue.py (from #840: link a throw-away program with --use-port=emdawnwebgpu, extract the expanded JS library), and compile Emdawnwebgpu's webgpu.cpp plus emdawn_glue.cpp into the extension. At import, the extension evals the glue in Pyodide's module scope and puts its functions in wasmImports. The glue generator also fixes a bug in Emdawnwebgpu's wgpuBufferGetMappedRange (uninitialized memory instead of the buffer contents). The hatch hook builds it with WGPU_PY_BUILD_DAWN=1 and adds Cython/setuptools as build dependencies; a Pyodide wheel is built with `WGPU_PY_BUILD_NOARCH=1 WGPU_PY_BUILD_DAWN=1 pyodide build --exports pyinit`. Backend (_api.pyx), with _IS_EMSCRIPTEN: * Callbacks use AllowSpontaneous, so the JS event loop calls them. Natively the model is unchanged (AllowProcessEvents, TimedWaitAny for sync waits, an event pump for then()). * sync_wait() suspends with JSPI (pyodide.ffi.run_sync) and waits for the promise's async event; awaiting is plain asyncio. * request_adapter/request_device do not block in the browser. * Validation errors are still raised at the call site when reported during the call (Dawn in Node.js does that); otherwise (Chrome) they are logged from the event loop instead of being raised by a later, unrelated call. * Surfaces are elements (CSS selector); the browser presents. * Mapped ranges: copying is done with wgpuBufferRead/WriteMappedRange natively. In the browser, the whole mapped range is fetched once, because Emdawnwebgpu copies each accessed range and the browser does not allow overlapping ranges. * enumerate_adapters returns the browser's adapter. In Pyodide, the Dawn backend is selected automatically if it is built. tools/dawn_pyodide has runners for Node.js (webgpu npm package) and headless Chrome, and example scripts that also run natively. In headless Chrome, the tests that expect a validation error to be raised by the failing call do not pass, because the browser reports it later. Resume this Claude session: ``` cd /home/mark/git/feedstock/staged-recipes claude --resume 2cab6db9-a6ea-4976-a0e6-f4153fe5a651 ```
Claude-Session: https://claude.ai/code/session_01QMLpZTQYYCu2K7EaWNnkEG --- .gitignore | 6 +- codegen/__init__.py | 1 + codegen/dawn_patcher.py | 277 ++- codegen/files.py | 1 + codegen/hparser.py | 29 +- docs/backends.rst | 15 +- tests/test_dawn_backend.py | 5 + tools/build_dawn.py | 220 +- tools/dawn_pyodide/compute_async.py | 61 + tools/dawn_pyodide/compute_sync.py | 32 + tools/dawn_pyodide/package.json | 11 + tools/dawn_pyodide/run_chrome.mjs | 53 + tools/dawn_pyodide/run_node.mjs | 50 + tools/dawn_pyodide/runner.html | 51 + tools/dawn_pyodide/triangle.py | 95 + tools/gen_emdawn_glue.py | 137 ++ tools/hatch_build.py | 55 +- wgpu/backends/auto.py | 4 + wgpu/backends/dawn/__init__.py | 3 + wgpu/backends/dawn/_api.pyx | 272 ++- wgpu/backends/dawn/_webgpu.pxd | 1265 ++--------- wgpu/backends/dawn/dawn_native_only.h | 83 + wgpu/backends/dawn/emdawn_glue.cpp | 54 + wgpu/backends/dawn/emdawn_glue.h | 19 + wgpu/resources/codegen_report.md | 4 +- wgpu/resources/emdawn_webgpu.h | 2950 +++++++++++++++++++++++++ 26 files changed, 4482 insertions(+), 1271 deletions(-) create mode 100644 tools/dawn_pyodide/compute_async.py create mode 100644 tools/dawn_pyodide/compute_sync.py create mode 100644 tools/dawn_pyodide/package.json create mode 100644 tools/dawn_pyodide/run_chrome.mjs create mode 100644 tools/dawn_pyodide/run_node.mjs create mode 100644 tools/dawn_pyodide/runner.html create mode 100644 tools/dawn_pyodide/triangle.py create mode 100644 tools/gen_emdawn_glue.py create mode 100644 wgpu/backends/dawn/dawn_native_only.h create mode 100644 wgpu/backends/dawn/emdawn_glue.cpp create mode 100644 wgpu/backends/dawn/emdawn_glue.h create mode 100644 wgpu/resources/emdawn_webgpu.h diff --git a/.gitignore b/.gitignore index 70be17124..7cb1a6168 100644 --- a/.gitignore +++ b/.gitignore @@ -126,5 +126,9 @@ venv.bak/ # jetbrains idea .idea/ -# Generated by Cython for the Dawn backend +# Generated when building the Dawn backend wgpu/backends/dawn/_api.c +wgpu/backends/dawn/emdawn_glue.js + +tools/dawn_pyodide/node_modules +tools/dawn_pyodide/package-lock.json diff --git a/codegen/__init__.py b/codegen/__init__.py index b8b84d4b2..09dcd7dd0 100644 --- a/codegen/__init__.py +++ b/codegen/__init__.py @@ -27,6 +27,7 @@ def prepare(): idlparser.get_idl_parser(allow_cache=False) hparser.get_h_parser(allow_cache=False) hparser.get_dawn_h_parser(allow_cache=False) + hparser.get_dawn_h_parser(emdawn=True, allow_cache=False) def update_api(): diff --git a/codegen/dawn_patcher.py b/codegen/dawn_patcher.py index ec7fb4956..12f347e95 100644 --- a/codegen/dawn_patcher.py +++ b/codegen/dawn_patcher.py @@ -1,14 +1,21 @@ """ Codegen for the Dawn backend. -Dawn's ``webgpu.h`` (vendored as ``wgpu/resources/dawn_webgpu.h``) is the single -source of truth for the Dawn backend. From it we generate: +The Dawn backend is generated from two vendored headers of the same Dawn release: +Dawn's native ``webgpu.h`` (``wgpu/resources/dawn_webgpu.h``) and the ``webgpu.h`` +of Emdawnwebgpu (``wgpu/resources/emdawn_webgpu.h``), which implements webgpu.h +on top of the browser's WebGPU and is used in Pyodide. The latter is a subset of +the former. From them we generate: * ``backends/dawn/_webgpu.pxd``: the complete Cython declaration of the C API (handles, enums, flags, structs, callbacks, functions, constants and the ``WGPU_*_INIT`` struct initializers). This file is fully generated; the Cython compiler checks every field/function used by ``backends/dawn/_api.pyx`` - against it, and the C compiler checks it against the real header. + against it, and the C compiler checks it against the real header. Its main + block comes from Emdawnwebgpu's header, so it is valid for both targets. A + few native-only declarations (``NATIVE_ONLY``) are declared separately. +* ``backends/dawn/dawn_native_only.h``: provides the native-only declarations + when compiling for Emscripten, so that one ``_api.pyx`` works for both. * ``backends/dawn/_mappings.py``: dicts to map WebGPU enum strings to the integer values that Dawn uses (and back). @@ -40,10 +47,37 @@ "uintptr_t", ] +# Declarations that the Dawn backend uses from Dawn's native webgpu.h, but that +# Emdawnwebgpu's webgpu.h (used in Pyodide) does not have. These are declared in +# a separate block of the pxd, which takes them from dawn_native_only.h. Natively +# that header simply includes webgpu.h; with Emscripten it provides the types +# and inert stand-ins for the functions, so that _api.pyx compiles for both +# targets. The backend must not call them in the browser. +NATIVE_ONLY = [ + # Dawn's logging callback, to forward Dawn's warnings to Python's logger + "WGPULoggingType", + "WGPULoggingCallback", + "WGPULoggingCallbackInfo", + "wgpuDeviceSetLoggingCallback", + # Let the device do its (deferred) work + "wgpuDeviceTick", + # Surfaces for native windows + "WGPUSurfaceSourceXlibWindow", + "WGPUSurfaceSourceWaylandSurface", + "WGPUSurfaceSourceXCBWindow", + "WGPUSurfaceSourceMetalLayer", + "WGPUSurfaceSourceWindowsHWND", +] + PXD_PREAMBLE = """ # Cython declarations of Dawn's webgpu.h, for the Dawn backend. # -# THIS CODE IS AUTOGENERATED BY THE CODEGEN FROM wgpu/resources/dawn_webgpu.h - DO NOT EDIT +# THIS CODE IS AUTOGENERATED BY THE CODEGEN - DO NOT EDIT +# +# The main block is generated from wgpu/resources/emdawn_webgpu.h, the +# webgpu.h of Emdawnwebgpu (Dawn on top of the browser's WebGPU, for Pyodide). +# It is a subset of Dawn's native webgpu.h (wgpu/resources/dawn_webgpu.h) of +# the same release, so everything in it is available on both targets. from libc.stdint cimport int8_t, int16_t, int32_t, int64_t from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t @@ -52,6 +86,45 @@ cdef extern from "webgpu/webgpu.h" nogil: """.lstrip() +PXD_NATIVE_ONLY_PREAMBLE = """ + +# %% Native-only declarations +# +# Parts of Dawn's native webgpu.h that Emdawnwebgpu does not have (see NATIVE_ONLY +# in codegen/dawn_patcher.py). Natively, dawn_native_only.h simply includes +# webgpu.h; with Emscripten it defines inert stand-ins. Do not use these in the +# browser (i.e. when sys.platform == "emscripten"). + + +cdef extern from "dawn_native_only.h" nogil: +""" + +NATIVE_ONLY_H_TEMPLATE = """ +// Native-only parts of Dawn's webgpu.h that the Dawn backend uses. +// +// THIS CODE IS AUTOGENERATED BY THE CODEGEN FROM wgpu/resources/dawn_webgpu.h - DO NOT EDIT +// +// The Dawn backend is compiled against Dawn's native webgpu.h, or against +// Emdawnwebgpu's webgpu.h for Pyodide. The latter lacks a few things that the +// backend uses natively (see NATIVE_ONLY in codegen/dawn_patcher.py). With +// Emscripten, this header provides them (copied from Dawn's native header), with +// functions that do nothing, so that the same _api.pyx compiles for both. The +// backend does not call these in the browser. + +#ifndef WGPU_PY_DAWN_NATIVE_ONLY_H_ +#define WGPU_PY_DAWN_NATIVE_ONLY_H_ + +#include + +#ifdef __EMSCRIPTEN__ + +{body} + +#endif // __EMSCRIPTEN__ + +#endif // WGPU_PY_DAWN_NATIVE_ONLY_H_ +""".lstrip() + def _render_type(node, name=""): """Render a pycparser type node as Cython-compatible C declaration.""" @@ -104,13 +177,11 @@ def _tidy(s): return s -def get_dawn_pxd_code(): - """Generate the Cython pxd for Dawn's webgpu.h.""" - - hp = get_dawn_h_parser() - raw_header = read_file("resources", "dawn_webgpu.h") +def _parse_header(hp): + """Parse the (cleaned) source of a HParser with pycparser. - # Prepare a source that pycparser can digest + Returns the AST and a dict of the simple macros (constants). + """ lines = [] macros = {} for line in hp.source.splitlines(): @@ -124,7 +195,19 @@ def get_dawn_pxd_code(): lines.append(line) fake_typedefs = "\n".join(f"typedef int {t};" for t in STDINT_TYPES) source = fake_typedefs + "\n" + "\n".join(lines) - ast = c_parser.CParser().parse(source, "dawn_webgpu.h") + ast = c_parser.CParser().parse(source, hp.name) + return ast, macros + + +def _get_pxd_sections(ast, macros, raw_header, names=None): + """Get the pxd lines for the declarations in the AST, grouped in sections. + + If ``names`` is given, only the declarations with these names are included + (and no constants). + """ + + def include(name): + return names is None or name in names # The struct initializer macros (C compound literals) are very useful to # get Dawn's defaults for a struct. @@ -140,6 +223,7 @@ def get_dawn_pxd_code(): struct_lines = [] func_lines = [] seen_structs = set() + found = set() for node in ast.ext: if isinstance(node, c_ast.Typedef): @@ -149,6 +233,9 @@ def get_dawn_pxd_code(): continue if name.startswith("WGPUProc") and name != "WGPUProc": continue # The proc-table typedefs are not needed + if not include(name): + continue + found.add(name) if isinstance(t, c_ast.TypeDecl) and isinstance(t.type, c_ast.Enum): enum = t.type enum_lines.append(f" ctypedef enum {name}:") @@ -197,45 +284,59 @@ def get_dawn_pxd_code(): elif isinstance(node, c_ast.Decl): t = node.type if isinstance(t, c_ast.FuncDecl): - func_lines.append(" " + _tidy(_render_type(t, node.name))) + if include(node.name): + found.add(node.name) + func_lines.append(" " + _tidy(_render_type(t, node.name))) elif isinstance(t, c_ast.Struct): if t.decls is None: - struct_names.append(t.name) # forward declaration + if include(t.name): + struct_names.append(t.name) # forward declaration else: # no-cover raise TypeError(f"Unexpected struct declaration {t.name}") elif isinstance(t, c_ast.TypeDecl) and "static" in node.storage: # static const WGPUBufferUsage WGPUBufferUsage_MapRead = 0x01; - flag_lines.append(" " + _tidy(_render_type(t, node.name))) + if include(node.name): + flag_lines.append(" " + _tidy(_render_type(t, node.name))) else: # no-cover raise TypeError(f"Unexpected declaration {node.name}: {t}") else: # no-cover raise TypeError(f"Unexpected node {node}") + if names is not None: + missing = set(names) - found + if missing: # no-cover + raise RuntimeError(f"Not found in Dawn's webgpu.h: {sorted(missing)}") + # Constants from macros const_lines = [] - for key, val in macros.items(): - try: - ival = int(val, 0) - except ValueError: - continue - if key == "WGPU_STRLEN": - ctype = "size_t" - elif ival > 0xFFFFFFFF: - ctype = "uint64_t" - else: - ctype = "uint32_t" - const_lines.append(f" const {ctype} {key}") - const_lines.append(" const WGPUBool WGPU_TRUE") - const_lines.append(" const WGPUBool WGPU_FALSE") - - init_lines = [f" const {sname} {mname}" for mname, sname in init_macros] + if names is None: + for key, val in macros.items(): + try: + ival = int(val, 0) + except ValueError: + continue + if key == "WGPU_STRLEN": + ctype = "size_t" + elif ival > 0xFFFFFFFF: + ctype = "uint64_t" + else: + ctype = "uint32_t" + const_lines.append(f" const {ctype} {key}") + const_lines.append(" const WGPUBool WGPU_TRUE") + const_lines.append(" const WGPUBool WGPU_FALSE") + + init_lines = [ + f" const {sname} {mname}" + for mname, sname in init_macros + if sname in seen_structs + ] # Make sure that every struct has a forward declaration, so that order does not matter forward = [ f" cdef struct {name}" for name in sorted(set(struct_names) | seen_structs) ] - sections = [ + return [ ("Basic types and opaque handles", handle_lines), ("Constants", const_lines), ("Enums", enum_lines), @@ -247,19 +348,123 @@ def get_dawn_pxd_code(): ("Functions", func_lines), ] - code = PXD_PREAMBLE + +def _sections_to_code(sections): + code = "" for title, section_lines in sections: + if not section_lines: + continue code += f"\n # %% {title}\n\n" code += "\n".join(section_lines).rstrip() + "\n" + return code - code += "\n\n" + _get_limits_helpers(hp) +def _compare_common_declarations(sections_emdawn, ast_native, macros, raw_native): + """Check that the declarations in Emdawnwebgpu's header are the same natively.""" + sections_native = dict(_get_pxd_sections(ast_native, macros, raw_native)) + count = 0 + for title, lines in sections_emdawn: + native_lines = set(sections_native[title]) + for line in lines: + if line.strip() and line not in native_lines: + print( + f"Emdawnwebgpu's webgpu.h differs from Dawn's here: {line.strip()}" + ) + count += 1 + return count + + +def get_dawn_pxd_code(): + """Generate the Cython pxd for Dawn's webgpu.h (for native and Emscripten).""" + + hp_emdawn = get_dawn_h_parser(emdawn=True) + hp_native = get_dawn_h_parser() + raw_emdawn = read_file("resources", "emdawn_webgpu.h") + raw_native = read_file("resources", "dawn_webgpu.h") + + # The common part: Emdawnwebgpu's webgpu.h + ast_emdawn, macros_emdawn = _parse_header(hp_emdawn) + sections = _get_pxd_sections(ast_emdawn, macros_emdawn, raw_emdawn) + + # Check it against the native header + ast_native, macros_native = _parse_header(hp_native) + _compare_common_declarations(sections, ast_native, macros_native, raw_native) + for name, fields in hp_emdawn.enums.items(): + for key, val in fields.items(): + if hp_native.enums.get(name, {}).get(key) != val: # no-cover + print(f"Enum value {name}.{key} differs between Emdawnwebgpu and Dawn") + for name in NATIVE_ONLY: + if name in hp_emdawn.source: # no-cover + raise RuntimeError( + f"{name} is in Emdawnwebgpu's webgpu.h; remove it from NATIVE_ONLY." + ) + + # The native-only part + native_sections = _get_pxd_sections( + ast_native, macros_native, raw_native, names=NATIVE_ONLY + ) + + code = PXD_PREAMBLE + code += _sections_to_code(sections) + code += PXD_NATIVE_ONLY_PREAMBLE + code += _sections_to_code(native_sections) + code += "\n\n" + _get_limits_helpers(hp_emdawn) + + nfuncs = len(dict(sections)["Functions"]) + nfuncs_native = len(dict(native_sections)["Functions"]) + nstructs = len(dict(sections)["Struct forward declarations"]) print( - f"Wrote _webgpu.pxd with {len(func_lines)} functions, {len(seen_structs)} structs, {len(init_lines)} initializers" + f"Wrote _webgpu.pxd with {nfuncs} + {nfuncs_native} (native-only) functions, {nstructs} structs" ) return code +def get_dawn_native_only_header(): + """Generate dawn_native_only.h: the NATIVE_ONLY parts of Dawn's webgpu.h, for Emscripten.""" + + # Copy definitions verbatim (macros with line continuations become one line) + raw = read_file("resources", "dawn_webgpu.h") + + pieces = [] # (position, code) + for name in NATIVE_ONLY: + if name.startswith("wgpu"): + # A function: define it as a function that does nothing + m = re.search( + rf"^WGPU_EXPORT (\w+) {name}\((.*?)\) WGPU_FUNCTION_ATTRIBUTE;$", + raw, + re.M, + ) + if not m or m.group(1) != "void": # no-cover + raise RuntimeError(f"Cannot create a stand-in for {name}.") + args = [a.strip() for a in m.group(2).split(",") if a.strip()] + body = " ".join(f"(void){a.split()[-1]};" for a in args) + code = f"static inline void {name}({m.group(2)}) {{ {body} }}" + pieces.append((m.start(), code)) + continue + patterns = [ + rf"^typedef (?:struct|enum) {name} \{{.*?^\}} {name} WGPU_\w+_ATTRIBUTE;$", + rf"^typedef [^;]*\(\*{name}\)\([^;]*\) WGPU_FUNCTION_ATTRIBUTE;$", + ] + for pattern in patterns: + m = re.search(pattern, raw, re.M | re.S) + if m: + pieces.append((m.start(), m.group(0))) + break + else: # no-cover + raise RuntimeError(f"Could not find the definition of {name}.") + # The struct initializer macro + m = re.search( + rf"^#define \w+_INIT _wgpu_MAKE_INIT_STRUCT\({name}, \{{.*\}}\)$", + raw, + re.M, + ) + if m: + pieces.append((m.start(), m.group(0))) + + body = "\n\n".join(code for _, code in sorted(pieces)) + return NATIVE_ONLY_H_TEMPLATE.replace("{body}", body) + + def _get_limits_helpers(hp): """Generate inline helpers to convert WGPULimits from/to a dict.""" fields = [key for key in hp.structs["WGPULimits"] if key != "nextInChain"] @@ -291,8 +496,8 @@ def _get_limits_helpers(hp): def write_dawn_pxd(): - code = get_dawn_pxd_code() - file_cache.write("backends/dawn/_webgpu.pxd", code) + file_cache.write("backends/dawn/_webgpu.pxd", get_dawn_pxd_code()) + file_cache.write("backends/dawn/dawn_native_only.h", get_dawn_native_only_header()) def to_dashed_name(name): diff --git a/codegen/files.py b/codegen/files.py index a1f418bba..b5fb1f594 100644 --- a/codegen/files.py +++ b/codegen/files.py @@ -38,6 +38,7 @@ class FileCache: "backends/dawn/_api.pyx", "backends/dawn/_mappings.py", "backends/dawn/_webgpu.pxd", + "backends/dawn/dawn_native_only.h", "resources/codegen_report.md", ] diff --git a/codegen/hparser.py b/codegen/hparser.py index 4072a1ac4..0ef197bc6 100644 --- a/codegen/hparser.py +++ b/codegen/hparser.py @@ -109,29 +109,34 @@ def get_h_parser(*, allow_cache=True): return hp -_dawn_parser = None +_dawn_parsers = {} -def get_dawn_h_parser(*, allow_cache=True): - """Get the global HParser object for Dawn's webgpu.h.""" +def get_dawn_h_parser(*, emdawn=False, allow_cache=True): + """Get the HParser object for Dawn's webgpu.h. - global _dawn_parser - if _dawn_parser and allow_cache: - return _dawn_parser + With ``emdawn=False`` this is Dawn's native header (``dawn_webgpu.h``), + with ``emdawn=True`` it is the header of Emdawnwebgpu (``emdawn_webgpu.h``), + Dawn's implementation of webgpu.h on top of the browser's WebGPU, which is + used in Pyodide. The latter is a subset of the former. + """ - source = _get_wgpu_header( - get_header_filename("dawn_webgpu.h"), output_filename=None - ) - # Dawn's header declares this unconditionally, but libwebgpu_dawn does not export it. + if allow_cache and emdawn in _dawn_parsers: + return _dawn_parsers[emdawn] + + filename = "emdawn_webgpu.h" if emdawn else "dawn_webgpu.h" + source = _get_wgpu_header(get_header_filename(filename), output_filename=None) + # Dawn's header declares this unconditionally, but libwebgpu_dawn does not + # export it, and in Emdawnwebgpu it is deprecated. source = "\n".join( line for line in source.splitlines() if "emscripten_webgpu_get_device" not in line ) - hp = HParser(source, "Dawn webgpu.h") + hp = HParser(source, "Emdawnwebgpu webgpu.h" if emdawn else "Dawn webgpu.h") hp.parse() - _dawn_parser = hp + _dawn_parsers[emdawn] = hp return hp diff --git a/docs/backends.rst b/docs/backends.rst index 3c3806dcf..e89a83698 100644 --- a/docs/backends.rst +++ b/docs/backends.rst @@ -270,7 +270,7 @@ This backend is optional and not (yet) included in the wheels. It must be built against an installed Dawn. Dawn is being packaged for conda-forge (`staged-recipes#35015 `__):: - conda install -c conda-forge dawn cython setuptools c-compiler + conda install -c conda-forge dawn cython setuptools c-compiler cxx-compiler python tools/build_dawn.py The backend can also be selected by setting the ``WGPUPY_BACKEND=dawn`` @@ -279,6 +279,19 @@ and the enum mappings are generated by the codegen from Dawn's ``webgpu.h``. Dawn-specific features are exposed with lowercase dashed names, e.g. ``"implicit-device-synchronization"``. +The same extension module can be built for `Pyodide `__, +where it uses Emdawnwebgpu (Dawn's ``webgpu.h`` on top of the browser's +WebGPU). In Pyodide, it is selected automatically if it is installed:: + + # With Pyodide's cross-build environment and Emscripten activated + WGPU_PY_BUILD_NOARCH=1 WGPU_PY_BUILD_DAWN=1 pyodide build --exports pyinit + +Differences in the browser: the sync API (e.g. ``request_adapter_sync()``) +needs JSPI, i.e. code that is run with ``pyodide.runPythonAsync()``, and +validation errors are reported asynchronously, so they are logged rather than +raised by the call that caused them. See ``tools/dawn_pyodide`` for test +runners and examples. + The js_webgpu backend --------------------- diff --git a/tests/test_dawn_backend.py b/tests/test_dawn_backend.py index 5d51d51bf..f748fb952 100644 --- a/tests/test_dawn_backend.py +++ b/tests/test_dawn_backend.py @@ -8,6 +8,7 @@ import gc import os +import sys import asyncio import numpy as np @@ -73,6 +74,7 @@ def test_backend_is_dawn(): "OpenGL", "OpenGLES", "Null", + "WebGPU", # Emdawnwebgpu, in Pyodide ) assert adapter.limits["max-bind-groups"] >= 4 assert "core-features-and-limits" in adapter.features or adapter.features @@ -305,6 +307,9 @@ def test_released_objects(device): gc.collect() +@pytest.mark.skipif( + sys.platform == "emscripten", reason="asyncio.run() is not possible in Pyodide" +) def test_async_await(device): buf = device.create_buffer_with_data( data=np.arange(16, dtype=np.uint32), usage=wgpu.BufferUsage.COPY_SRC diff --git a/tools/build_dawn.py b/tools/build_dawn.py index ad77d1477..d622a8523 100644 --- a/tools/build_dawn.py +++ b/tools/build_dawn.py @@ -3,37 +3,78 @@ The Dawn backend lives in ``wgpu/backends/dawn``. Its C-API declarations (``_webgpu.pxd``) are generated by the codegen from Dawn's ``webgpu.h``. This -script compiles ``_api.pyx`` against Dawn's headers and links it to -``libwebgpu_dawn``. Building is optional: wgpu-py works fine without it, and -the wgpu-native backend remains the default. +script compiles ``_api.pyx`` for one of two targets: -Dawn is found via (in order): the ``--dawn-prefix`` argument, the -``DAWN_PREFIX`` env var, the ``CONDA_PREFIX`` env var, and ``sys.prefix``. The -prefix must contain ``include/webgpu/webgpu.h`` and the shared library in -``lib`` (``Library`` on Windows conda). Dawn can be installed from conda:: +* Native: against an installed Dawn, linking to ``libwebgpu_dawn``. Dawn is + found via (in order): the ``--dawn-prefix`` argument, the ``DAWN_PREFIX`` + env var, the ``CONDA_PREFIX`` env var, and ``sys.prefix``. The prefix must + contain ``include/webgpu/webgpu.h`` and the shared library in ``lib`` + (``Library`` on Windows conda). Dawn can be installed from conda:: - conda install -c conda-forge dawn + conda install -c conda-forge dawn -On CPython >= 3.12 the extension is built against the Stable ABI (abi3), so -one binary works for all later Python versions. + On CPython >= 3.12 the extension is built against the Stable ABI (abi3), so + one binary works for all later Python versions. + +* Pyodide (when cross-compiling for Emscripten, e.g. with ``pyodide build``): + against Emdawnwebgpu, Dawn's implementation of ``webgpu.h`` on top of the + browser's WebGPU. Its C++ part is compiled into the extension, and its JS + part is turned into ``emdawn_glue.js``, which the extension installs into + Pyodide at import time (see ``gen_emdawn_glue.py``). The pinned Emdawnwebgpu + release is downloaded, unless ``EMDAWNWEBGPU_PKG`` points to an extracted + ``emdawnwebgpu_pkg`` directory. ``emcc`` must be on the PATH. + +Building is optional: wgpu-py works fine without it, and the wgpu-native +backend remains the default. To include the extension in a wheel, set +``WGPU_PY_BUILD_DAWN=1`` when building the wheel (see ``hatch_build.py``). Usage:: python tools/build_dawn.py [--dawn-prefix PREFIX] [--debug] """ +import io import os import sys +import hashlib import argparse import sysconfig +import subprocess +import urllib.request +import zipfile ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) DAWN_DIR = os.path.join(ROOT, "wgpu", "backends", "dawn") +BUILD_DIR = os.path.join(ROOT, "build", "dawn") # Use the Stable ABI (Limited API) where Cython supports it well. LIMITED_API_MIN = (3, 12) +# The Emdawnwebgpu release for Pyodide builds. Keep this in sync with the +# vendored headers (wgpu/resources/dawn_webgpu.h and emdawn_webgpu.h), which +# are from the same Dawn release. +DAWN_TAG = "v20260929.200159" +EMDAWN_ZIP_SHA256 = "d697687e82b7377fc63f162fff0ef1cc5f025828aa4ff6ec4ac52566c949fe5f" +EMDAWN_URL = ( + f"https://github.com/google/dawn/releases/download/{DAWN_TAG}/" + f"emdawnwebgpu_pkg-{DAWN_TAG}.zip" +) + +CYTHON_DIRECTIVES = { + "language_level": 3, + "binding": True, + "annotation_typing": False, + "embedsignature": False, + "cdivision": True, +} + + +def is_emscripten(): + """Whether we are (cross-)compiling for Emscripten / Pyodide.""" + plat = os.getenv("_PYTHON_HOST_PLATFORM", "") or sysconfig.get_platform() + return plat.startswith(("emscripten", "pyodide")) + def find_dawn_prefix(prefix=None): candidates = [ @@ -55,7 +96,23 @@ def find_dawn_prefix(prefix=None): ) -def get_extension(dawn_prefix, debug=False): +def get_emdawnwebgpu_pkg(): + """Get the path to the (pinned) emdawnwebgpu_pkg, downloading it if needed.""" + pkg = os.getenv("EMDAWNWEBGPU_PKG") + if pkg: + return pkg + pkg = os.path.join(BUILD_DIR, "emdawnwebgpu_pkg") + if not os.path.isfile(os.path.join(pkg, "VERSION.txt")): + print(f"Downloading {EMDAWN_URL}") + data = urllib.request.urlopen(EMDAWN_URL).read() + digest = hashlib.sha256(data).hexdigest() + if digest != EMDAWN_ZIP_SHA256: + raise RuntimeError(f"Unexpected sha256 {digest} for {EMDAWN_URL}") + zipfile.ZipFile(io.BytesIO(data)).extractall(BUILD_DIR) + return pkg + + +def get_native_extension(dawn_prefix, debug=False): from setuptools import Extension include_dir = os.path.join(dawn_prefix, "include") @@ -71,20 +128,16 @@ def get_extension(dawn_prefix, debug=False): if sys.platform.startswith("win"): extra_compile_args += ["/Od"] if debug else ["/O2"] - lib_dir = os.path.join(dawn_prefix, "lib") else: extra_compile_args += ["-O0", "-g"] if debug else ["-O2"] # Dawn's header has a few constructs that some compilers warn about extra_compile_args += ["-Wno-unused-function", "-Wno-unreachable-code"] - if sys.platform.startswith("darwin"): - extra_link_args += [f"-Wl,-rpath,{lib_dir}"] - else: - extra_link_args += [f"-Wl,-rpath,{lib_dir}"] + extra_link_args += [f"-Wl,-rpath,{lib_dir}"] - return Extension( + ext = Extension( "wgpu.backends.dawn._api", sources=[os.path.join(DAWN_DIR, "_api.pyx")], - include_dirs=[include_dir], + include_dirs=[include_dir, DAWN_DIR], library_dirs=[lib_dir], libraries=["webgpu_dawn"], define_macros=define_macros, @@ -92,33 +145,115 @@ def get_extension(dawn_prefix, debug=False): extra_link_args=extra_link_args, py_limited_api=py_limited_api, ) + ext.cpp_sources = [] + ext.cpp_args = [] + return ext + + +def get_emscripten_extension(debug=False): + from setuptools import Extension + + pkg = get_emdawnwebgpu_pkg() + gen_dir = os.path.join(BUILD_DIR, "emdawn_gen") + os.makedirs(gen_dir, exist_ok=True) + + # Generate the JS glue (shipped next to the extension) and the list of C++ + # functions that it calls into. + subprocess.check_call( + [ + sys.executable, + os.path.join(ROOT, "tools", "gen_emdawn_glue.py"), + pkg, + os.path.join(DAWN_DIR, "emdawn_glue.js"), + os.path.join(gen_dir, "emdawn_cpp_funcs.h"), + os.getenv("EMCC", "emcc"), + ] + ) + + opt = ["-O0", "-g"] if debug else ["-O2"] + ext = Extension( + "wgpu.backends.dawn._api", + sources=[os.path.join(DAWN_DIR, "_api.pyx")], + include_dirs=[ + os.path.join(pkg, "webgpu", "include"), + os.path.join(pkg, "webgpu", "src"), + DAWN_DIR, + gen_dir, + ], + extra_compile_args=[*opt, "-Wno-unused-function"], + ) + # Compiled separately as C++ (see BuildExt), and linked into the extension: + # Emdawnwebgpu's webgpu.cpp, and the code that installs the JS glue. + ext.cpp_sources = [os.path.join(DAWN_DIR, "emdawn_glue.cpp")] + ext.cpp_args = [*opt, "-std=c++20", "-DNDEBUG"] + return ext + + +def get_build_ext_class(): + from setuptools.command.build_ext import build_ext + + class BuildExt(build_ext): + """build_ext that can also compile C++ sources into a C extension.""" + + def build_extension(self, ext): + cpp_sources = getattr(ext, "cpp_sources", []) + if cpp_sources: + objects = self.compiler.compile( + cpp_sources, + output_dir=self.build_temp, + macros=ext.define_macros, + include_dirs=ext.include_dirs, + extra_postargs=ext.cpp_args, + debug=self.debug, + ) + ext.extra_objects = list(ext.extra_objects or []) + objects + # Link with the C++ compiler (set here, so that Cython still generates C) + ext.language = "c++" + super().build_extension(ext) + + return BuildExt def build(dawn_prefix=None, debug=False): + """Build the extension in place. Returns the paths of the built files.""" from Cython.Build import cythonize from setuptools import Distribution - dawn_prefix = find_dawn_prefix(dawn_prefix) - print(f"Building the Dawn backend against {dawn_prefix}") + if is_emscripten(): + print("Building the Dawn backend for Emscripten (Pyodide), with Emdawnwebgpu") + ext = get_emscripten_extension(debug) + else: + dawn_prefix = find_dawn_prefix(dawn_prefix) + print(f"Building the Dawn backend against {dawn_prefix}") + ext = get_native_extension(dawn_prefix, debug) - ext = get_extension(dawn_prefix, debug) ext_modules = cythonize( [ext], - compiler_directives={ - "language_level": 3, - "binding": True, - "annotation_typing": False, - "embedsignature": False, - "cdivision": True, - }, - include_path=[os.path.join(ROOT)], + compiler_directives=CYTHON_DIRECTIVES, + include_path=[ROOT], quiet=False, ) + for e in ext_modules: # cythonize() creates new Extension objects + e.cpp_sources = ext.cpp_sources + e.cpp_args = ext.cpp_args + e.depends = ( + list(e.depends or []) + + ext.cpp_sources + + [ + os.path.join(DAWN_DIR, f) + for f in os.listdir(DAWN_DIR) + if f.endswith(".h") + ] + ) options = {"build_ext": {"inplace": True}} - if ext.py_limited_api: - options["bdist_wheel"] = {"py_limited_api": "cp{}{}".format(*LIMITED_API_MIN)} - dist = Distribution({"ext_modules": ext_modules, "script_name": "build_dawn.py"}) + dist = Distribution( + { + "ext_modules": ext_modules, + "script_name": "build_dawn.py", + "cmdclass": {"build_ext": get_build_ext_class()}, + } + ) dist.parse_config_files = lambda *a, **k: None for cmd, opts in options.items(): dist.get_option_dict(cmd).update( @@ -131,13 +266,20 @@ def build(dawn_prefix=None, debug=False): finally: os.chdir(cwd) - built = [ - f - for f in os.listdir(DAWN_DIR) - if f.startswith("_api.") and f.endswith((".so", ".pyd")) - ] - print("Built:", ", ".join(built), "(stable ABI)" if ext.py_limited_api else "") - print("Python tag:", sysconfig.get_config_var("EXT_SUFFIX")) + # The built extension (the one for this target) and the files that go with it + suffix = sysconfig.get_config_var("EXT_SUFFIX") + if ext.py_limited_api: + suffix = ".pyd" if sys.platform.startswith("win") else ".abi3.so" + built = [os.path.join(DAWN_DIR, "_api" + suffix)] + if is_emscripten(): + built.append(os.path.join(DAWN_DIR, "emdawn_glue.js")) + for path in built: + if not os.path.isfile(path): # no-cover + raise RuntimeError(f"Expected {path} to be built.") + print("Built:", ", ".join(os.path.basename(f) for f in built)) + if ext.py_limited_api: + print("(using the Stable ABI)") + return built if __name__ == "__main__": diff --git a/tools/dawn_pyodide/compute_async.py b/tools/dawn_pyodide/compute_async.py new file mode 100644 index 000000000..4591a8079 --- /dev/null +++ b/tools/dawn_pyodide/compute_async.py @@ -0,0 +1,61 @@ +# Compute shader round trip through the public wgpu API, async. +# Runs natively (WGPUPY_BACKEND=dawn python compute_async.py) and in Pyodide. +import sys +import struct +import asyncio +import wgpu + +SHADER = """ +@group(0) @binding(0) var a: array; +@group(0) @binding(1) var b: array; +@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) id: vec3) { + b[id.x] = a[id.x] * 2.0 + 1.0; +} +""" + + +async def main(): + adapter = await wgpu.gpu.request_adapter_async(power_preference="high-performance") + print("wgpu backend:", type(wgpu.gpu).__module__) + print("adapter info:", dict(adapter.info)) + device = await adapter.request_device_async() + n = 1024 + data = struct.pack(f"{n}f", *range(n)) + buf_a = device.create_buffer_with_data(data=data, usage=wgpu.BufferUsage.STORAGE) + buf_b = device.create_buffer( + size=n * 4, usage=wgpu.BufferUsage.STORAGE | wgpu.BufferUsage.COPY_SRC + ) + readback = device.create_buffer( + size=n * 4, usage=wgpu.BufferUsage.MAP_READ | wgpu.BufferUsage.COPY_DST + ) + module = device.create_shader_module(code=SHADER) + pipeline = device.create_compute_pipeline( + layout="auto", compute={"module": module, "entry_point": "main"} + ) + bind_group = device.create_bind_group( + layout=pipeline.get_bind_group_layout(0), + entries=[ + {"binding": 0, "resource": {"buffer": buf_a}}, + {"binding": 1, "resource": {"buffer": buf_b}}, + ], + ) + encoder = device.create_command_encoder() + cpass = encoder.begin_compute_pass() + cpass.set_pipeline(pipeline) + cpass.set_bind_group(0, bind_group) + cpass.dispatch_workgroups(n // 64) + cpass.end() + encoder.copy_buffer_to_buffer(buf_b, 0, readback, 0, n * 4) + device.queue.submit([encoder.finish()]) + await readback.map_async(wgpu.MapMode.READ) + out = readback.read_mapped().cast("f") + readback.unmap() + expected = [i * 2.0 + 1 for i in range(n)] + assert list(out) == expected, list(out[:8]) + print("result[:4] =", list(out[:4]), "result[-1] =", out[-1]) + await device.queue.on_submitted_work_done_async() + print("COMPUTE ASYNC OK") + + +if sys.platform != "emscripten": + asyncio.run(main()) diff --git a/tools/dawn_pyodide/compute_sync.py b/tools/dawn_pyodide/compute_sync.py new file mode 100644 index 000000000..41dc30a22 --- /dev/null +++ b/tools/dawn_pyodide/compute_sync.py @@ -0,0 +1,32 @@ +# The sync API. Natively the backend polls; in Pyodide it suspends the Python +# stack with JSPI (pyodide.ffi.run_sync), so this needs e.g. runPythonAsync(). +import struct +import wgpu +from wgpu.utils.compute import compute_with_buffers + +SHADER = """ +@group(0) @binding(0) var a: array; +@group(0) @binding(1) var b: array; +@compute @workgroup_size(1) fn main(@builtin(global_invocation_id) id: vec3) { + b[id.x] = a[id.x] * a[id.x]; +} +""" + +adapter = wgpu.gpu.request_adapter_sync(power_preference="high-performance") +print( + "sync adapter:", + adapter.info["vendor"], + adapter.info["architecture"], + adapter.info["backend_type"], +) +device = adapter.request_device_sync() +n = 20 +data = struct.pack(f"{n}i", *range(n)) +out = compute_with_buffers({0: data}, {1: (n, "i")}, SHADER, n=n) +result = list(out[1]) +assert result == [i * i for i in range(n)], result +print("compute_with_buffers:", result[:6], "...") +buf = device.create_buffer_with_data(data=data, usage=wgpu.BufferUsage.COPY_SRC) +back = device.queue.read_buffer(buf).cast("i") +assert list(back) == list(range(n)) +print("COMPUTE SYNC OK") diff --git a/tools/dawn_pyodide/package.json b/tools/dawn_pyodide/package.json new file mode 100644 index 000000000..82a90d50c --- /dev/null +++ b/tools/dawn_pyodide/package.json @@ -0,0 +1,11 @@ +{ + "name": "wgpu-py-dawn-pyodide", + "private": true, + "type": "module", + "description": "Run wgpu-py with the Dawn backend in Pyodide: in Node (webgpu npm = Dawn) and in headless Chrome. See .github/workflows/dawn.yml", + "dependencies": { + "pyodide": "314.0.7", + "webgpu": "0.6.1", + "puppeteer-core": "^24.0.0" + } +} diff --git a/tools/dawn_pyodide/run_chrome.mjs b/tools/dawn_pyodide/run_chrome.mjs new file mode 100644 index 000000000..3da1debd8 --- /dev/null +++ b/tools/dawn_pyodide/run_chrome.mjs @@ -0,0 +1,53 @@ +// Serve a directory and open a page in headless Chrome with WebGPU enabled. +// Echoes the page console; exits 0 when the page prints "ALL OK", 1 on "FAIL" or timeout. +// +// node run_chrome.mjs [timeout_s] +// +// Env: CHROME_PATH (default: /usr/bin/google-chrome), CHROME_FLAGS (extra flags, +// e.g. "--use-angle=vulkan --ignore-gpu-blocklist" for a hardware GPU locally), +// SCREENSHOT (path to save a screenshot of the page at the end). +import puppeteer from 'puppeteer-core'; +import http from 'node:http'; +import fs from 'node:fs'; +import path from 'node:path'; + +const [dir, page, timeout = '300'] = process.argv.slice(2); +const types = { + '.html': 'text/html', '.js': 'text/javascript', '.mjs': 'text/javascript', + '.wasm': 'application/wasm', '.json': 'application/json', '.py': 'text/plain', + '.zip': 'application/zip', '.whl': 'application/zip', +}; +const server = http.createServer((req, res) => { + const p = path.join(dir, decodeURIComponent(new URL(req.url, 'http://x').pathname)); + fs.readFile(p, (err, data) => { + if (err) { res.writeHead(404); res.end(); return; } + res.writeHead(200, { 'Content-Type': types[path.extname(p)] || 'application/octet-stream' }); + res.end(data); + }); +}).listen(0); + +const browser = await puppeteer.launch({ + executablePath: process.env.CHROME_PATH || '/usr/bin/google-chrome', + headless: true, + args: ['--enable-unsafe-webgpu', '--enable-features=Vulkan', '--no-sandbox', + ...(process.env.CHROME_FLAGS || '').split(' ').filter(Boolean)], +}); +const tab = await browser.newPage(); +let done = false; +async function finish(code) { + if (done) return; + done = true; + if (process.env.SCREENSHOT) await tab.screenshot({ path: process.env.SCREENSHOT }).catch(() => {}); + await browser.close(); + server.close(); + process.exit(code); +} +tab.on('console', (m) => { + const t = m.text(); + console.log(t); + if (t.includes('ALL OK')) finish(0); + else if (t.startsWith('FAIL: ')) finish(1); +}); +tab.on('pageerror', (e) => { console.log('pageerror: ' + e.message); finish(1); }); +setTimeout(() => { console.log('FAIL: timeout'); finish(1); }, Number(timeout) * 1000); +await tab.goto(`http://localhost:${server.address().port}/${page}`); diff --git a/tools/dawn_pyodide/run_node.mjs b/tools/dawn_pyodide/run_node.mjs new file mode 100644 index 000000000..72dea56fd --- /dev/null +++ b/tools/dawn_pyodide/run_node.mjs @@ -0,0 +1,50 @@ +// Run Python with wgpu-py's Dawn backend in Pyodide under Node.js, with +// navigator.gpu provided by the `webgpu` npm package (Dawn's Node.js bindings). +// +// node run_node.mjs script.py +// node run_node.mjs --pytest [pytest args...] +// +// The wheels are the wgpu wheel built for Pyodide (with the Dawn backend, see +// tools/build_dawn.py), and optionally more. Exits with a non-zero code if the +// script raises or pytest fails. +import { loadPyodide } from 'pyodide'; +import { create, globals } from 'webgpu'; +import fs from 'node:fs'; +import path from 'node:path'; + +Object.assign(globalThis, globals); +Object.defineProperty(globalThis.navigator, 'gpu', { value: create([]), configurable: true }); + +const [wheels, ...rest] = process.argv.slice(2); +const py = await loadPyodide(); +await py.loadPackage(rest[0] === '--pytest' ? ['cffi', 'numpy', 'pytest'] : ['cffi', 'numpy']); +const sitePackages = py.runPython('import site; site.getsitepackages()[0]'); +for (const w of wheels.split(',').filter(Boolean)) { + py.unpackArchive(new Uint8Array(fs.readFileSync(w)), 'wheel', { extractDir: sitePackages }); +} + +let exitCode = 0; +try { + if (rest[0] === '--pytest') { + const [, testsDir, ...args] = rest; + py.FS.mkdirTree('/work/tests'); + py.FS.mount(py.FS.filesystems.NODEFS, { root: path.resolve(testsDir) }, '/work/tests'); + py.globals.set('pytest_args', py.toPy(args)); + // runPythonAsync runs with JSPI, so the sync wgpu API works (via pyodide.ffi.run_sync) + exitCode = Number(await py.runPythonAsync(` +import os, sys, pytest +os.environ["WGPUPY_BACKEND"] = "dawn" +os.chdir("/work") +sys.path.insert(0, "/work/tests") +int(pytest.main(["-v", "-p", "no:cacheprovider", *pytest_args])) +`)); + } else { + const script = rest[0]; + await py.runPythonAsync('import wgpu.backends.dawn\n' + fs.readFileSync(script, 'utf8') + + '\nimport inspect\nif inspect.iscoroutinefunction(globals().get("main")):\n await main()\n'); + } +} catch (e) { + console.log(String(e)); + exitCode = 1; +} +process.exit(exitCode); diff --git a/tools/dawn_pyodide/runner.html b/tools/dawn_pyodide/runner.html new file mode 100644 index 000000000..91805b392 --- /dev/null +++ b/tools/dawn_pyodide/runner.html @@ -0,0 +1,51 @@ + + +wgpu-py Dawn backend in Pyodide + + +

+
+
+
diff --git a/tools/dawn_pyodide/triangle.py b/tools/dawn_pyodide/triangle.py
new file mode 100644
index 000000000..85bb1175d
--- /dev/null
+++ b/tools/dawn_pyodide/triangle.py
@@ -0,0 +1,95 @@
+# Render a triangle to an offscreen texture and check its pixels, and (in the
+# browser) to an HTML  via Emdawnwebgpu's canvas surface.
+import sys
+
+import wgpu
+
+SHADER = """
+struct VOut { @builtin(position) pos: vec4, @location(0) color: vec4 };
+@vertex fn vs_main(@builtin(vertex_index) i: u32) -> VOut {
+    var p = array, 3>(vec2(0.0, 0.6), vec2(-0.6, -0.6), vec2(0.6, -0.6));
+    var c = array, 3>(vec3(1.0, 0.2, 0.2), vec3(0.2, 1.0, 0.2), vec3(0.2, 0.4, 1.0));
+    var out: VOut;
+    out.pos = vec4(p[i], 0.0, 1.0);
+    out.color = vec4(c[i], 1.0);
+    return out;
+}
+@fragment fn fs_main(in: VOut) -> @location(0) vec4 { return in.color; }
+"""
+
+
+def make_pipeline(device, fmt):
+    module = device.create_shader_module(code=SHADER)
+    return device.create_render_pipeline(
+        layout="auto",
+        vertex={"module": module, "entry_point": "vs_main"},
+        fragment={
+            "module": module,
+            "entry_point": "fs_main",
+            "targets": [{"format": fmt}],
+        },
+        primitive={"topology": "triangle-list"},
+    )
+
+
+def draw(device, pipeline, view):
+    encoder = device.create_command_encoder()
+    rpass = encoder.begin_render_pass(
+        color_attachments=[
+            {
+                "view": view,
+                "clear_value": (0.1, 0.1, 0.12, 1),
+                "load_op": "clear",
+                "store_op": "store",
+            }
+        ]
+    )
+    rpass.set_pipeline(pipeline)
+    rpass.draw(3)
+    rpass.end()
+    device.queue.submit([encoder.finish()])
+
+
+async def render_offscreen_and_check(device, size=64):
+    fmt = "rgba8unorm"
+    tex = device.create_texture(
+        size=(size, size, 1),
+        format=fmt,
+        usage=wgpu.TextureUsage.RENDER_ATTACHMENT | wgpu.TextureUsage.COPY_SRC,
+    )
+    draw(device, make_pipeline(device, fmt), tex.create_view())
+    # read_texture() is a sync call; in Pyodide it suspends via JSPI
+    data = device.queue.read_texture(
+        {"texture": tex}, {"bytes_per_row": size * 4}, (size, size, 1)
+    )
+    data = bytes(data)
+    center = data[
+        (size // 2 * size + size // 2) * 4 : (size // 2 * size + size // 2) * 4 + 4
+    ]
+    corner = data[0:4]
+    print("offscreen center pixel", tuple(center), "corner pixel", tuple(corner))
+    assert center[3] == 255 and sum(center[:3]) > 200, center  # inside the triangle
+    assert tuple(corner) == (26, 26, 31, 255), corner  # clear color
+    print("TRIANGLE OFFSCREEN OK")
+
+
+async def main(canvas=None):
+    adapter = await wgpu.gpu.request_adapter_async(power_preference="high-performance")
+    device = await adapter.request_device_async()
+    await render_offscreen_and_check(device)
+    if canvas is not None:
+        context = wgpu.gpu.get_canvas_context({"window": canvas, "platform": "browser"})
+        context.set_physical_size(canvas.width, canvas.height)
+        fmt = context.get_preferred_format(adapter)
+        context.configure(device=device, format=fmt)
+        pipeline = make_pipeline(device, fmt)
+        draw(device, pipeline, context.get_current_texture().create_view())
+        context.present()
+        print(f"TRIANGLE CANVAS OK (format {fmt})")
+    return device
+
+
+if __name__ == "__main__" and sys.platform != "emscripten":
+    import asyncio
+
+    asyncio.run(main())
diff --git a/tools/gen_emdawn_glue.py b/tools/gen_emdawn_glue.py
new file mode 100644
index 000000000..467a02854
--- /dev/null
+++ b/tools/gen_emdawn_glue.py
@@ -0,0 +1,137 @@
+"""Turn Emdawnwebgpu's JS library into code that can be injected into Pyodide.
+
+Used by tools/build_dawn.py when building the Dawn backend for Pyodide.
+
+Emdawnwebgpu = webgpu.cpp (C++, compiled into our side module) + library_webgpu*.js
+(an Emscripten JS library, which normally must be linked into the *main* module).
+Pyodide extensions are side modules, which cannot carry JS libraries. So we:
+
+1. Link a throw-away program with ``--use-port=emdawnwebgpu`` that references every
+   function in webgpu.h, using the same Emscripten and the same relevant settings
+   as Pyodide's main module. Emscripten's jsifier then expands all macros.
+2. Cut out the "JS library code" section of the generated JS.
+3. Wrap it in a function expression that takes the C++ functions it calls back
+   into (emwgpuCreate*, emwgpuOn*, ...) and returns the JS functions that the
+   side module imports (wgpu*, emwgpu*).
+
+The result is evaluated at runtime (via an EM_JS function in the side module, so
+it sees Pyodide's module scope: HEAPU32, _malloc, wasmImports, ...), and its
+functions are put in ``wasmImports`` so that the side module's lazy import stubs
+resolve to them. See wgpu/backends/dawn/emdawn_glue.cpp.
+
+The output depends on the Emscripten version (that of Pyodide) and on the
+Emdawnwebgpu release, so it is regenerated with every build.
+
+Usage::
+
+    python gen_emdawn_glue.py    [emcc]
+"""
+
+import os
+import re
+import subprocess
+import sys
+import tempfile
+
+
+def main(pkg_dir, out_js, out_names_h, emcc="emcc"):
+    port_file = os.path.join(pkg_dir, "emdawnwebgpu.port.py")
+    header = os.path.join(pkg_dir, "webgpu", "include", "webgpu", "webgpu.h")
+    src = open(header).read()
+    funcs = sorted(
+        set(
+            re.findall(
+                r"^WGPU_EXPORT[^;]*?\b((?:wgpu|emscripten_webgpu_)\w+)\s*\(", src, re.M
+            )
+        )
+    )
+    with tempfile.TemporaryDirectory() as tmp:
+        refs_c = os.path.join(tmp, "refs.c")
+        with open(refs_c, "w") as f:
+            f.write("#include \nvoid* volatile refs[] = {\n")
+            for n in funcs:
+                f.write(f"  (void*)&{n},\n")
+            f.write("};\nint main(void) { return refs[0] == 0; }\n")
+        out = os.path.join(tmp, "lib.js")
+        port = f"--use-port={port_file}:cpp_bindings=false"
+        subprocess.check_call([emcc, "-c", refs_c, "-o", refs_c + ".o", port])
+        subprocess.check_call(
+            [
+                emcc[:-2] + "++",
+                refs_c + ".o",
+                "-o",
+                out,
+                port,
+                "-O0",
+                "-sASSERTIONS=0",
+                # Match Pyodide's main module: >2GB addressing, growable memory
+                "-sALLOW_MEMORY_GROWTH",
+                "-sMAXIMUM_MEMORY=4GB",
+                "-sERROR_ON_UNDEFINED_SYMBOLS=0",
+            ]
+        )
+        js = open(out).read()
+
+    lib = js.split("// Begin JS library code\n", 1)[1].split(
+        "// End JS library code\n", 1
+    )[0]
+    lib = patch_library(lib)
+
+    # Functions the JS calls in the wasm (implemented in webgpu.cpp)
+    m = re.search(r"^var (_main, [^;]*);", js, re.M)
+    wasm_exports = [s.strip() for s in m.group(1).split(",")]
+    cpp_funcs = [s[1:] for s in wasm_exports if re.match(r"_(emwgpu|wgpu)\w+$", s)]
+
+    # Functions the wasm imports from JS (implemented in library_webgpu.js)
+    m = re.search(r"^var wasmImports = \{(.*?)^\};", js, re.M | re.S)
+    imports = re.findall(r"(\w+): (\w+)", m.group(1))
+    js_funcs = [
+        (k, v)
+        for k, v in imports
+        if re.match(r"(emwgpu|wgpu|emscripten_webgpu_)\w+$", k)
+    ]
+
+    with open(out_js, "w") as f:
+        f.write("// Generated by gen_emdawn_glue.py from Emdawnwebgpu; do not edit.\n")
+        f.write("(function (cpp) {\n")
+        for n in cpp_funcs:
+            f.write(f"var _{n} = cpp['{n}'];\n")
+        f.write(lib)
+        f.write("return {\n")
+        for k, v in js_funcs:
+            f.write(f"  '{k}': {v},\n")
+        f.write("};\n})\n")
+
+    with open(out_names_h, "w") as f:
+        f.write("// Generated by gen_emdawn_glue.py; do not edit.\n")
+        f.write("#define EMDAWN_CPP_FUNCS(X) \\\n")
+        f.write(" \\\n".join(f"  X({n})" for n in cpp_funcs))
+        f.write("\n")
+    print(f"{len(js_funcs)} JS functions, {len(cpp_funcs)} C++ callbacks -> {out_js}")
+
+
+# Fixes to Emdawnwebgpu's JS code: (description, old, new)
+PATCHES = [
+    (
+        # wgpuBufferGetMappedRange() returns a copy of the mapped range in the wasm
+        # heap, which is written back on unmap. It is meant to be zero-filled, but
+        # fill() is given a size instead of an end index, so it is uninitialized
+        # memory. Fill it with the actual contents (like getMappedRange() in JS
+        # and native Dawn), so that what is not written to is preserved.
+        "GetMappedRange: initialize with the buffer contents",
+        "HEAPU8.fill(0, data, mapped.byteLength);",
+        "HEAPU8.set(new Uint8Array(mapped), data);",
+    ),
+]
+
+
+def patch_library(lib):
+    for description, old, new in PATCHES:
+        if lib.count(old) != 1:
+            raise RuntimeError(f"Cannot apply patch to Emdawnwebgpu: {description}")
+        lib = lib.replace(old, new)
+    return lib
+
+
+if __name__ == "__main__":
+    main(*sys.argv[1:])
diff --git a/tools/hatch_build.py b/tools/hatch_build.py
index fd9ac1972..fe7f79654 100644
--- a/tools/hatch_build.py
+++ b/tools/hatch_build.py
@@ -25,6 +25,7 @@
 
 import os
 import sys
+import sysconfig
 from subprocess import run, PIPE
 
 from hatchling.builders.hooks.plugin.interface import BuildHookInterface
@@ -70,16 +71,54 @@ def initialize(self, version, build_data):
             # Make sure that the download did not bump the wgpu-native version
             check_git_status()
 
-        # Optionally build the (experimental) Dawn backend. This requires Dawn,
-        # Cython and a C compiler, see tools/build_dawn.py.
-        if self.target_name == "wheel" and os.getenv(
-            "WGPU_PY_BUILD_DAWN", ""
-        ).lower() in ("1", "true"):
-            from build_dawn import build as build_dawn
+        # Optionally build the (experimental) Dawn backend. This requires Dawn
+        # (or Emscripten, for Pyodide), Cython and a C compiler, see tools/build_dawn.py.
+        if self.target_name == "wheel" and build_dawn_enabled():
+            import build_dawn
 
-            build_dawn()
+            if build_dawn.is_emscripten():
+                check_no_native_binaries()
+            built = build_dawn.build()
             build_data["pure_python"] = False
-            build_data["infer_tag"] = True
+            for path in built:
+                if path.endswith((".so", ".dll", ".dylib")):
+                    continue  # already included as artifacts, see pyproject.toml
+                rel = os.path.relpath(path, root_dir).replace(os.sep, "/")
+                build_data["force_include"][path] = rel
+            if build_dawn.is_emscripten():
+                # Pyodide (pyodide build) retags the platform of the wheel
+                v = "cp{}{}".format(*sys.version_info[:2])
+                plat = sysconfig.get_platform().replace("-", "_").replace(".", "_")
+                build_data["tag"] = f"{v}-{v}-{plat}"
+            else:
+                build_data["infer_tag"] = True
+
+    def dependencies(self):
+        # Extra build dependencies, see https://hatch.pypa.io/latest/plugins/build-hook/reference/
+        if self.target_name == "wheel" and build_dawn_enabled():
+            return ["cython>=3.1", "setuptools>=64"]
+        return []
+
+
+def check_no_native_binaries():
+    """Binaries in the source tree end up in the wheel; avoid that for Pyodide wheels."""
+    found = []
+    for dirpath, _, filenames in os.walk(os.path.join(root_dir, "wgpu")):
+        for fname in filenames:
+            if (
+                fname.endswith((".so", ".dll", ".dylib", ".pyd"))
+                and "emscripten" not in fname
+            ):
+                found.append(os.path.relpath(os.path.join(dirpath, fname), root_dir))
+    if found:
+        raise RuntimeError(
+            "Building a Pyodide wheel, but the source tree has native binaries, "
+            f"which would be included in the wheel: {found}. Remove them first."
+        )
+
+
+def build_dawn_enabled():
+    return os.getenv("WGPU_PY_BUILD_DAWN", "").lower() in ("1", "true")
 
 
 def is_git_repo():
diff --git a/wgpu/backends/auto.py b/wgpu/backends/auto.py
index faf212de3..133482fac 100644
--- a/wgpu/backends/auto.py
+++ b/wgpu/backends/auto.py
@@ -1,6 +1,7 @@
 # The default backend is wgpu-native, but this may change in the future.
 import os
 import sys
+import importlib.util
 
 
 def _load_backend(backend_name):
@@ -32,6 +33,9 @@ def _auto_load_backend():
         return _load_backend(backend_name)
 
     if sys.platform == "emscripten":
+        # In Pyodide, prefer the Dawn backend if its extension module is built
+        if importlib.util.find_spec("wgpu.backends.dawn._api") is not None:
+            return _load_backend("dawn")
         return _load_backend("js_webgpu")
     else:
         return _load_backend("wgpu_native")
diff --git a/wgpu/backends/dawn/__init__.py b/wgpu/backends/dawn/__init__.py
index 7d5f28cf4..9cd69d584 100644
--- a/wgpu/backends/dawn/__init__.py
+++ b/wgpu/backends/dawn/__init__.py
@@ -6,6 +6,9 @@
 it must be built against an installed Dawn (e.g. ``conda install -c conda-forge dawn``)
 with ``python tools/build_dawn.py``.
 
+It can also be built for Pyodide (see ``tools/build_dawn.py``), where it is
+the default backend if installed.
+
 To use it, import it before anything else selects a backend::
 
     import wgpu.backends.dawn
diff --git a/wgpu/backends/dawn/_api.pyx b/wgpu/backends/dawn/_api.pyx
index ccadafee6..5b89539f9 100644
--- a/wgpu/backends/dawn/_api.pyx
+++ b/wgpu/backends/dawn/_api.pyx
@@ -18,6 +18,20 @@ pointer without any Python attribute lookups.
 
 The structure of this module deliberately mirrors that of the wgpu-native
 backend (``backends/wgpu_native/_api.py``).
+
+The same module also runs in Pyodide (``sys.platform == "emscripten"``). It is
+then compiled against Emdawnwebgpu, Dawn's implementation of ``webgpu.h`` on top
+of the browser's WebGPU (see ``tools/build_dawn.py``). The differences are
+small, and marked with ``_IS_EMSCRIPTEN``:
+
+* Callbacks are called by the browser's event loop (``AllowSpontaneous``)
+  instead of by ``wgpuInstanceProcessEvents()``.
+* The browser cannot block, so ``sync_wait()`` suspends the Python stack with
+  JSPI (``pyodide.ffi.run_sync``), which requires that the code is run via
+  e.g. ``pyodide.runPythonAsync()``. Awaiting works everywhere.
+* Validation errors arrive asynchronously, so they are logged instead of
+  raised at the call site.
+* The surface is a ```` element, and the browser presents it.
 """
 
 from libc.stdint cimport uint8_t, uint32_t, uint64_t, int32_t, uintptr_t
@@ -35,7 +49,7 @@ import logging
 import threading
 
 from ..._coreutils import str_flag_to_int
-from ..._async import get_backoff_time_generator, async_sleep
+from ..._async import get_backoff_time_generator, async_sleep, AsyncEvent
 from ... import classes, flags, enums, structs
 from ._mappings import enummap, enum_str2int, enum_int2str
 
@@ -46,9 +60,29 @@ cdef extern from "Python.h":
     int PyBUF_READ
     int PyBUF_WRITE
 
+cdef extern from "emdawn_glue.h":
+    int wgpu_dawn_install(const char* code)
+
 
 logger = logging.getLogger("wgpu")
 
+# Running in Pyodide, with Emdawnwebgpu
+cdef bint _IS_EMSCRIPTEN = sys.platform == "emscripten"
+IS_EMSCRIPTEN = _IS_EMSCRIPTEN
+
+# Natively, callbacks are called when we call wgpuInstanceProcessEvents(), so
+# that they always run in a thread we control. In the browser, they are called
+# from the JS event loop when the corresponding JS promise resolves.
+cdef WGPUCallbackMode _CALLBACK_MODE = (
+    WGPUCallbackMode_AllowSpontaneous if _IS_EMSCRIPTEN else WGPUCallbackMode_AllowProcessEvents
+)
+
+if _IS_EMSCRIPTEN:
+    # Install Emdawnwebgpu's JS code into the Pyodide runtime (see emdawn_glue.cpp)
+    with open(os.path.join(os.path.dirname(__file__), "emdawn_glue.js"), "rb") as _f:
+        wgpu_dawn_install(_f.read())
+    del _f
+
 # The API is pretty well defined
 __all__ = classes.__all__.copy()
 
@@ -312,6 +346,12 @@ def to_snake_case(name, separator="_"):
 # callback, while the offending API call is running. The callback stores the
 # error and sets a C flag; after each API call we check that flag (which costs
 # virtually nothing) and raise the error as a Python exception at the call site.
+#
+# In Pyodide, the same holds if the WebGPU implementation reports the error
+# during the call (as Dawn in Node.js does). In the browser, errors are reported
+# asynchronously (via the uncapturederror event), after the call that caused
+# them has returned. Therefore we also schedule a call (on the event loop) to
+# log errors that have not been raised by then.
 
 
 cdef bint _error_pending = False
@@ -333,10 +373,30 @@ cdef void _uncaptured_error_callback(
         msg = "\n".join(line.rstrip() for line in msg.splitlines())
         _pending_errors.append((error_type, msg))
         _error_pending = True
+        if _IS_EMSCRIPTEN:
+            _schedule_log_pending_errors()
     except BaseException:  # no-cover
         pass
 
 
+_log_scheduled = False
+
+
+def _schedule_log_pending_errors():
+    global _log_scheduled
+    if not _log_scheduled:
+        import asyncio
+
+        _log_scheduled = True
+        asyncio.get_event_loop().call_soon(_log_pending_errors_soon)
+
+
+def _log_pending_errors_soon():
+    global _log_scheduled
+    _log_scheduled = False
+    _log_pending_errors()
+
+
 def _log_error(message):
     """Log an error message, avoiding spamming the same message over and over."""
     h = hash("".join(c for c in message if not c.isdigit()))
@@ -438,9 +498,10 @@ cdef WGPUInstance _get_instance() except NULL:
     cdef size_t n = 0
     if _instance == NULL:
         desc = WGPU_INSTANCE_DESCRIPTOR_INIT
-        # TimedWaitAny allows us to block on futures (sync_wait)
-        features[n] = WGPUInstanceFeatureName_TimedWaitAny
-        n += 1
+        # TimedWaitAny allows us to block on futures (sync_wait). Not in the browser.
+        if not _IS_EMSCRIPTEN:
+            features[n] = WGPUInstanceFeatureName_TimedWaitAny
+            n += 1
         if wgpuHasInstanceFeature(WGPUInstanceFeatureName_ShaderSourceSPIRV):
             features[n] = WGPUInstanceFeatureName_ShaderSourceSPIRV
             n += 1
@@ -458,7 +519,7 @@ def get_instance_address():
 
 
 cdef int _wait_future(uint64_t future_id) except -1:
-    """Block until the future completes, with the GIL released."""
+    """Block until the future completes, with the GIL released. Native only."""
     cdef WGPUFutureWaitInfo info
     cdef WGPUWaitStatus status
     cdef WGPUInstance instance = _get_instance()
@@ -481,7 +542,8 @@ def process_events():
     """Process pending Dawn events, which may resolve pending GPUPromises.
 
     This is called automatically when awaiting a promise, and by the
-    event pump when callbacks (via ``promise.then()``) are used.
+    event pump when callbacks (via ``promise.then()``) are used. In the browser
+    this is not needed, because callbacks are called by the JS event loop.
     """
     wgpuInstanceProcessEvents(_get_instance())
     _check()
@@ -540,25 +602,55 @@ _event_pump = _EventPump()
 class GPUPromise(classes.GPUPromise):
     """GPUPromise for Dawn futures.
 
-    ``sync_wait()`` blocks on the future via ``wgpuInstanceWaitAny`` (with the
-    GIL released). Awaiting polls ``wgpuInstanceProcessEvents``.
+    Natively, ``sync_wait()`` blocks on the future via ``wgpuInstanceWaitAny``
+    (with the GIL released), and awaiting polls ``wgpuInstanceProcessEvents``.
+
+    In the browser, the callbacks are called by the JS event loop, so awaiting is
+    plain asyncio. A sync wait must let the JS event loop run while the Python
+    stack is suspended, which Pyodide supports via JSPI (``pyodide.ffi.run_sync``)
+    when the code is run with e.g. ``pyodide.runPythonAsync()``.
     """
 
     _future_id = 0
 
     def _set_future(self, uint64_t future_id):
         self._future_id = future_id
-        _event_pump.add(self)
+        if not _IS_EMSCRIPTEN:
+            _event_pump.add(self)
 
     def _sync_wait(self):
-        if self._future_id:
+        if _IS_EMSCRIPTEN:
+            from pyodide.ffi import run_sync, can_run_sync
+
+            if not can_run_sync():
+                raise RuntimeError(
+                    "Cannot sync-wait for a GPUPromise in Pyodide here: this needs "
+                    "JSPI support and code that is run via e.g. pyodide.runPythonAsync(). "
+                    "Use the async API (await) instead."
+                )
+            run_sync(self._wait_web())
+        elif self._future_id:
             _wait_future(self._future_id)
         if self._state == "pending":
             # Should not happen, but avoid hanging forever
             raise RuntimeError(f"Promise {self._title!r} did not resolve.")
 
+    async def _wait_web(self):
+        # The callback is called from the JS event loop, and (via call_soon)
+        # sets the async event. Without a loop, poll the state instead.
+        if self._call_soon_threadsafe is not None:
+            with self._lock:
+                if self._async_event is None:
+                    self._async_event = AsyncEvent()
+                    if self._state != "pending":
+                        self._async_event.set()
+            await self._async_event.wait()
+        else:
+            while self._state == "pending":
+                await async_sleep(0.001)
+
     def __await__(self):
-        if self._state == "pending" and self._future_id:
+        if self._state == "pending" and self._future_id and not _IS_EMSCRIPTEN:
 
             async def awaiter():
                 sleep_gen = get_backoff_time_generator()
@@ -849,7 +941,8 @@ class GPU(classes.GPU):
             canvas : The canvas or context that the adapter should be able to render to. This can typically
                 be left to None. If given, it must be a ``GPUCanvasContext`` or ``RenderCanvas``.
         """
-        if adapter_name := os.getenv("WGPUPY_WGPU_ADAPTER_NAME"):
+        adapter_name = os.getenv("WGPUPY_WGPU_ADAPTER_NAME")
+        if adapter_name and not _IS_EMSCRIPTEN:
             adapters = self._enumerate_adapters()
             adapters = [a for a in adapters if adapter_name in a.summary]
             if not adapters:
@@ -889,21 +982,29 @@ class GPU(classes.GPU):
                 opts.compatibleSurface = surface_id
 
         promise = GPUPromise("request_adapter", self._create_adapter)
-        cb.mode = WGPUCallbackMode_AllowProcessEvents
+        cb.mode = _CALLBACK_MODE
         cb.callback = _request_adapter_callback
         cb.userdata1 = _promise_userdata(promise)
         future = wgpuInstanceRequestAdapter(instance, &opts, cb)
         _check()
         promise._set_future(future.id)
-        # Dawn resolves this (almost) immediately. Make it effectively sync,
-        # like the wgpu-native backend, so that sync and async code paths match.
-        _wait_future(future.id)
+        if not _IS_EMSCRIPTEN:
+            # Dawn resolves this (almost) immediately. Make it effectively sync,
+            # like the wgpu-native backend, so that sync and async code paths match.
+            # In the browser it resolves via the JS event loop.
+            _wait_future(future.id)
         return promise
 
     def enumerate_adapters_async(self) -> GPUPromise[list[GPUAdapter]]:
         """Get a list of adapter objects available on the current system.
         This is the implementation based on Dawn.
+
+        In the browser, it returns the one adapter that the browser provides.
         """
+        if _IS_EMSCRIPTEN:
+            return self.request_adapter_async().then(
+                lambda adapter: [adapter], title="enumerate_adapters"
+            )
         result = self._enumerate_adapters()
         promise = GPUPromise("enumerate_adapters", None)
         promise._wgpu_set_input(result)
@@ -1010,6 +1111,9 @@ def find_surface_id_from_canvas(canvas_or_context):
     return surface_id
 
 
+_canvas_count = 0
+
+
 def get_surface_id_from_info(present_info):
     """Get an id (address) representing the surface to render to. The way to
     obtain this id differs per platform and GUI toolkit.
@@ -1020,9 +1124,20 @@ def get_surface_id_from_info(present_info):
     cdef WGPUSurfaceSourceXCBWindow xcb = WGPU_SURFACE_SOURCE_XCB_WINDOW_INIT
     cdef WGPUSurfaceSourceWindowsHWND hwnd = WGPU_SURFACE_SOURCE_WINDOWS_HWND_INIT
     cdef WGPUSurfaceSourceMetalLayer metal = WGPU_SURFACE_SOURCE_METAL_LAYER_INIT
+    cdef WGPUEmscriptenSurfaceSourceCanvasHTMLSelector html_canvas = WGPU_EMSCRIPTEN_SURFACE_SOURCE_CANVAS_HTML_SELECTOR_INIT
     cdef WGPUSurface surface
 
-    if sys.platform.startswith("win"):  # no-cover
+    if _IS_EMSCRIPTEN:
+        # Emdawnwebgpu identifies the  element by a CSS selector
+        global _canvas_count
+        canvas = present_info["window"]
+        if not canvas.id:
+            _canvas_count += 1
+            canvas.id = f"wgpu-dawn-canvas-{_canvas_count}"
+        selector = f"#{canvas.id}".encode()
+        html_canvas.selector = _sv(selector)
+        desc.nextInChain = &html_canvas
+    elif sys.platform.startswith("win"):  # no-cover
         import ctypes
 
         hwnd.hinstance = ctypes.windll.kernel32.GetModuleHandleW(None)
@@ -1109,6 +1224,14 @@ class GPUCanvasContext(classes.GPUCanvasContext):
             raise RuntimeError("Error calling wgpuSurfaceGetCapabilities")
 
         capabilities = {"usages": c_caps.usages}
+        if not c_caps.usages and _IS_EMSCRIPTEN:
+            # Emdawnwebgpu does not report usages; a canvas supports these
+            capabilities["usages"] = (
+                flags.TextureUsage.RENDER_ATTACHMENT
+                | flags.TextureUsage.COPY_SRC
+                | flags.TextureUsage.COPY_DST
+                | flags.TextureUsage.TEXTURE_BINDING
+            )
         formats = []
         for i in range(c_caps.formatCount):
             str_val = enum_int2str["TextureFormat"].get(c_caps.formats[i])
@@ -1290,7 +1413,12 @@ class GPUCanvasContext(classes.GPUCanvasContext):
         return GPUTexture("", texture, device, tex_info)
 
     def _present_screen(self):
-        cdef WGPUStatus status = wgpuSurfacePresent(self._surface_id)
+        cdef WGPUStatus status
+        if _IS_EMSCRIPTEN:
+            # The browser presents the canvas when control returns to the event loop
+            _log_pending_errors()
+            return
+        status = wgpuSurfacePresent(self._surface_id)
         _log_pending_errors()
         if status != WGPUStatus_Success:
             logger.warning("wgpuSurfacePresent failed")
@@ -1399,20 +1527,22 @@ class GPUAdapter(classes.GPUAdapter, _Handle):
             return device
 
         promise = GPUPromise("request_device", handler)
-        cb.mode = WGPUCallbackMode_AllowProcessEvents
+        cb.mode = _CALLBACK_MODE
         cb.callback = _request_device_callback
         cb.userdata1 = _promise_userdata(promise)
         future = wgpuAdapterRequestDevice(_self_ptr(self), &desc, cb)
         _check()
         promise._set_future(future.id)
-        _wait_future(future.id)
+        if not _IS_EMSCRIPTEN:
+            _wait_future(future.id)  # see _request_adapter()
         return promise
 
     def _create_device(self, label, device_id):
         cdef WGPUDevice device = device_id
         cdef WGPULoggingCallbackInfo log_cb = WGPU_LOGGING_CALLBACK_INFO_INIT
-        log_cb.callback = _logging_callback
-        wgpuDeviceSetLoggingCallback(device, log_cb)
+        if not _IS_EMSCRIPTEN:  # The browser logs to the JS console
+            log_cb.callback = _logging_callback
+            wgpuDeviceSetLoggingCallback(device, log_cb)
         limits = _get_limits(device, True)
         features = _get_features(device, True)
         queue_id = wgpuDeviceGetQueue(device)
@@ -1433,8 +1563,9 @@ class GPUDevice(classes.GPUDevice, GPUObjectBase):
     def _poll(self, block=False):
         # Internal function, for compatibility with the wgpu-native backend
         if (<_Handle>self)._ptr != NULL:
-            wgpuDeviceTick((<_Handle>self)._ptr)
-            process_events()
+            if not _IS_EMSCRIPTEN:  # in the browser, the event loop does this
+                wgpuDeviceTick((<_Handle>self)._ptr)
+                process_events()
             if block:
                 self.queue.on_submitted_work_done_sync()
 
@@ -1779,7 +1910,7 @@ class GPUDevice(classes.GPUDevice, GPUObjectBase):
             return GPUComputePipeline(label, pipeline_id, self)
 
         promise = GPUPromise("create_compute_pipeline", handler)
-        cb.mode = WGPUCallbackMode_AllowProcessEvents
+        cb.mode = _CALLBACK_MODE
         cb.callback = _create_compute_pipeline_callback
         cb.userdata1 = _promise_userdata(promise)
         future = wgpuDeviceCreateComputePipelineAsync(_self_ptr(self), &desc, cb)
@@ -1831,7 +1962,7 @@ class GPUDevice(classes.GPUDevice, GPUObjectBase):
             return GPURenderPipeline(label, pipeline_id, self)
 
         promise = GPUPromise("create_render_pipeline", handler)
-        cb.mode = WGPUCallbackMode_AllowProcessEvents
+        cb.mode = _CALLBACK_MODE
         cb.callback = _create_render_pipeline_callback
         cb.userdata1 = _promise_userdata(promise)
         future = wgpuDeviceCreateRenderPipelineAsync(_self_ptr(self), &desc, cb)
@@ -1902,7 +2033,7 @@ class GPUDevice(classes.GPUDevice, GPUObjectBase):
         cdef WGPUPopErrorScopeCallbackInfo cb = WGPU_POP_ERROR_SCOPE_CALLBACK_INFO_INIT
         cdef WGPUFuture future
         promise = GPUPromise("pop_error_scope", None)
-        cb.mode = WGPUCallbackMode_AllowProcessEvents
+        cb.mode = _CALLBACK_MODE
         cb.callback = _pop_error_scope_callback
         cb.userdata1 = _promise_userdata(promise)
         future = wgpuDevicePopErrorScope(_self_ptr(self), cb)
@@ -2131,6 +2262,9 @@ cdef int _fill_render_pipeline_descriptor(
 
 
 class GPUBuffer(classes.GPUBuffer, GPUObjectBase):
+    # In Pyodide: the address of the copy of the mapped range in the wasm heap
+    _web_mapped_ptr = 0
+
     def _release_ptr(self, ptr):
         wgpuBufferRelease(ptr)
 
@@ -2190,9 +2324,10 @@ class GPUBuffer(classes.GPUBuffer, GPUObjectBase):
             self._map_state = enums.BufferMapState.mapped
             self._mapped_status = offset, offset + size, map_mode
             self._mapped_memoryviews = []
+            self._web_mapped_ptr = 0
 
         promise = GPUPromise("buffer.map", handler)
-        cb.mode = WGPUCallbackMode_AllowProcessEvents
+        cb.mode = _CALLBACK_MODE
         cb.callback = _buffer_map_callback
         cb.userdata1 = _promise_userdata(promise)
         self._map_state = enums.BufferMapState.pending
@@ -2215,6 +2350,7 @@ class GPUBuffer(classes.GPUBuffer, GPUObjectBase):
         _check()
         self._map_state = enums.BufferMapState.unmapped
         self._mapped_status = 0, 0, 0
+        self._web_mapped_ptr = 0  # freed by Emdawnwebgpu on unmap
 
     def _release_memoryviews(self):
         for m in self._mapped_memoryviews:
@@ -2224,8 +2360,33 @@ class GPUBuffer(classes.GPUBuffer, GPUObjectBase):
                 pass
         self._mapped_memoryviews = []
 
+    def _get_web_mapped_ptr(self, offset):
+        """Get the address (in the wasm heap) for the given offset in the mapped range.
+
+        Emdawnwebgpu copies a mapped range between the JS ArrayBuffer and the
+        wasm heap each time it is accessed (and back on unmap, when writing),
+        and the browser does not allow overlapping ranges. So we obtain the
+        whole mapped range once, on first access.
+        """
+        cdef void* ptr
+        if not self._web_mapped_ptr:
+            start, end, mode = self._mapped_status
+            if mode & flags.MapMode.WRITE:
+                ptr = wgpuBufferGetMappedRange(_self_ptr(self), start, end - start)
+            else:
+                ptr = wgpuBufferGetConstMappedRange(
+                    _self_ptr(self), start, end - start
+                )
+            _check()
+            if ptr == NULL:
+                raise RuntimeError("Could not get mapped range.")
+            self._web_mapped_ptr = ptr
+        return self._web_mapped_ptr + offset - self._mapped_status[0]
+
     def read_mapped(self, buffer_offset: int | None = None, size: int | None = None, *, copy: bool = True):
         cdef const void* ptr
+        cdef WGPUStatus status
+        cdef char* dst
         if self._map_state != enums.BufferMapState.mapped:
             raise RuntimeError("Can only read from a buffer if its mapped.")
         elif not (self._mapped_status[2] & flags.MapMode.READ):
@@ -2235,20 +2396,34 @@ class GPUBuffer(classes.GPUBuffer, GPUObjectBase):
             raise ValueError(
                 "The range for buffer reading is not contained in the currently mapped range."
             )
+        if _IS_EMSCRIPTEN:
+            ptr = self._get_web_mapped_ptr(offset)
+            if copy:
+                return memoryview(PyByteArray_FromStringAndSize(ptr, size)).cast("B")
+            data = PyMemoryView_FromMemory(ptr, size, PyBUF_READ)
+            self._mapped_memoryviews.append(data)
+            return data
+        if copy:
+            # Copy into a new bytearray (a single copy)
+            data = PyByteArray_FromStringAndSize(NULL, size)
+            dst = data
+            status = wgpuBufferReadMappedRange(_self_ptr(self), offset, dst, size)
+            _check()
+            if status != WGPUStatus_Success:
+                raise RuntimeError("Could not read mapped buffer.")
+            return memoryview(data).cast("B")
         ptr = wgpuBufferGetConstMappedRange(_self_ptr(self), offset, size)
         _check()
         if ptr == NULL:
             raise RuntimeError("Could not get mapped range.")
-        if copy:
-            return memoryview(PyByteArray_FromStringAndSize(ptr, size)).cast("B")
-        else:
-            data = PyMemoryView_FromMemory(ptr, size, PyBUF_READ)
-            self._mapped_memoryviews.append(data)
-            return data
+        data = PyMemoryView_FromMemory(ptr, size, PyBUF_READ)
+        self._mapped_memoryviews.append(data)
+        return data
 
     def write_mapped(self, data, buffer_offset: int | None = None) -> None:
         cdef void* ptr
         cdef _Buffer buf
+        cdef WGPUStatus status
         if self._map_state != enums.BufferMapState.mapped:
             raise RuntimeError("Can only write to a buffer if its mapped.")
         elif not (self._mapped_status[2] & flags.MapMode.WRITE):
@@ -2261,6 +2436,20 @@ class GPUBuffer(classes.GPUBuffer, GPUObjectBase):
             raise ValueError(
                 "The range for buffer writing is not contained in the currently mapped range."
             )
+        if _IS_EMSCRIPTEN:
+            ptr = self._get_web_mapped_ptr(offset)
+            memcpy(ptr, buf.view.buf, nbytes)
+            return
+        if nbytes == size:
+            # A single copy
+            status = wgpuBufferWriteMappedRange(
+                _self_ptr(self), offset, buf.view.buf, size
+            )
+            _check()
+            if status != WGPUStatus_Success:
+                raise RuntimeError("Could not write mapped buffer.")
+            return
+        # Unaligned size: write into the (aligned) mapped range
         ptr = wgpuBufferGetMappedRange(_self_ptr(self), offset, size)
         _check()
         if ptr == NULL:
@@ -2275,10 +2464,13 @@ class GPUBuffer(classes.GPUBuffer, GPUObjectBase):
         if self._map_state != enums.BufferMapState.mapped:
             raise RuntimeError("Can only write to a buffer if its mapped.")
         offset, size = self._check_range(buffer_offset, size)
-        ptr = wgpuBufferGetMappedRange(_self_ptr(self), offset, size)
-        _check()
-        if ptr == NULL:
-            raise RuntimeError("Could not get mapped range.")
+        if _IS_EMSCRIPTEN:
+            ptr = self._get_web_mapped_ptr(offset)
+        else:
+            ptr = wgpuBufferGetMappedRange(_self_ptr(self), offset, size)
+            _check()
+            if ptr == NULL:
+                raise RuntimeError("Could not get mapped range.")
         return PyMemoryView_FromMemory(ptr, size, PyBUF_WRITE)
 
     def destroy(self) -> None:
@@ -2389,7 +2581,7 @@ class GPUShaderModule(classes.GPUShaderModule, GPUObjectBase):
         cdef WGPUCompilationInfoCallbackInfo cb = WGPU_COMPILATION_INFO_CALLBACK_INFO_INIT
         cdef WGPUFuture future
         promise = GPUPromise("get_compilation_info", None)
-        cb.mode = WGPUCallbackMode_AllowProcessEvents
+        cb.mode = _CALLBACK_MODE
         cb.callback = _compilation_info_callback
         cb.userdata1 = _promise_userdata(promise)
         future = wgpuShaderModuleGetCompilationInfo(_self_ptr(self), cb)
@@ -3298,7 +3490,7 @@ class GPUQueue(classes.GPUQueue, GPUObjectBase):
         cdef WGPUQueueWorkDoneCallbackInfo cb = WGPU_QUEUE_WORK_DONE_CALLBACK_INFO_INIT
         cdef WGPUFuture future
         promise = GPUPromise("on_submitted_work_done", None)
-        cb.mode = WGPUCallbackMode_AllowProcessEvents
+        cb.mode = _CALLBACK_MODE
         cb.callback = _queue_work_done_callback
         cb.userdata1 = _promise_userdata(promise)
         future = wgpuQueueOnSubmittedWorkDone(_self_ptr(self), cb)
diff --git a/wgpu/backends/dawn/_webgpu.pxd b/wgpu/backends/dawn/_webgpu.pxd
index 8f1022b92..0a916f016 100644
--- a/wgpu/backends/dawn/_webgpu.pxd
+++ b/wgpu/backends/dawn/_webgpu.pxd
@@ -1,6 +1,11 @@
 # Cython declarations of Dawn's webgpu.h, for the Dawn backend.
 #
-# THIS CODE IS AUTOGENERATED BY THE CODEGEN FROM wgpu/resources/dawn_webgpu.h - DO NOT EDIT
+# THIS CODE IS AUTOGENERATED BY THE CODEGEN - DO NOT EDIT
+#
+# The main block is generated from wgpu/resources/emdawn_webgpu.h, the
+# webgpu.h of Emdawnwebgpu (Dawn on top of the browser's WebGPU, for Pyodide).
+# It is a subset of Dawn's native webgpu.h (wgpu/resources/dawn_webgpu.h) of
+# the same release, so everything in it is available on both targets.
 
 from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
 from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
@@ -48,22 +53,12 @@ cdef extern from "webgpu/webgpu.h" nogil:
     ctypedef WGPURenderPassEncoderImpl* WGPURenderPassEncoder
     cdef struct WGPURenderPipelineImpl
     ctypedef WGPURenderPipelineImpl* WGPURenderPipeline
-    cdef struct WGPUResourceTableImpl
-    ctypedef WGPUResourceTableImpl* WGPUResourceTable
     cdef struct WGPUSamplerImpl
     ctypedef WGPUSamplerImpl* WGPUSampler
     cdef struct WGPUShaderModuleImpl
     ctypedef WGPUShaderModuleImpl* WGPUShaderModule
-    cdef struct WGPUSharedBufferMemoryImpl
-    ctypedef WGPUSharedBufferMemoryImpl* WGPUSharedBufferMemory
-    cdef struct WGPUSharedFenceImpl
-    ctypedef WGPUSharedFenceImpl* WGPUSharedFence
-    cdef struct WGPUSharedTextureMemoryImpl
-    ctypedef WGPUSharedTextureMemoryImpl* WGPUSharedTextureMemory
     cdef struct WGPUSurfaceImpl
     ctypedef WGPUSurfaceImpl* WGPUSurface
-    cdef struct WGPUTexelBufferViewImpl
-    ctypedef WGPUTexelBufferViewImpl* WGPUTexelBufferView
     cdef struct WGPUTextureImpl
     ctypedef WGPUTextureImpl* WGPUTexture
     cdef struct WGPUTextureViewImpl
@@ -74,7 +69,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     const uint32_t WGPU_ARRAY_LAYER_COUNT_UNDEFINED
     const uint32_t WGPU_COPY_STRIDE_UNDEFINED
     const uint32_t WGPU_DEPTH_SLICE_UNDEFINED
-    const uint32_t WGPU_INVALID_BINDING
     const uint32_t WGPU_LIMIT_U32_UNDEFINED
     const uint64_t WGPU_LIMIT_U64_UNDEFINED
     const uint32_t WGPU_MIP_LEVEL_COUNT_UNDEFINED
@@ -99,11 +93,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUAddressMode_Repeat
         WGPUAddressMode_MirrorRepeat
 
-    ctypedef enum WGPUAlphaMode:
-        WGPUAlphaMode_Opaque
-        WGPUAlphaMode_Premultiplied
-        WGPUAlphaMode_Unpremultiplied
-
     ctypedef enum WGPUBackendType:
         WGPUBackendType_Undefined
         WGPUBackendType_Null
@@ -160,37 +149,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUCallbackMode_AllowProcessEvents
         WGPUCallbackMode_AllowSpontaneous
 
-    ctypedef enum WGPUCallbackStatus:
-        WGPUCallbackStatus_Success
-        WGPUCallbackStatus_Error
-
-    ctypedef enum WGPUColorSpacePrimariesDawn:
-        WGPUColorSpacePrimariesDawn_SRGB
-        WGPUColorSpacePrimariesDawn_Rec709
-        WGPUColorSpacePrimariesDawn_Rec601
-        WGPUColorSpacePrimariesDawn_Rec2020
-        WGPUColorSpacePrimariesDawn_DisplayP3
-
-    ctypedef enum WGPUColorSpaceTransferDawn:
-        WGPUColorSpaceTransferDawn_Identity
-        WGPUColorSpaceTransferDawn_SRGB
-        WGPUColorSpaceTransferDawn_DisplayP3
-        WGPUColorSpaceTransferDawn_SMPTE_170M
-        WGPUColorSpaceTransferDawn_HLG
-        WGPUColorSpaceTransferDawn_PQ
-        WGPUColorSpaceTransferDawn_BT_1886
-
-    ctypedef enum WGPUColorSpaceYCbCrMatrixDawn:
-        WGPUColorSpaceYCbCrMatrixDawn_Identity
-        WGPUColorSpaceYCbCrMatrixDawn_Rec601
-        WGPUColorSpaceYCbCrMatrixDawn_Rec709
-        WGPUColorSpaceYCbCrMatrixDawn_Rec2020
-
-    ctypedef enum WGPUColorSpaceYCbCrRangeDawn:
-        WGPUColorSpaceYCbCrRangeDawn_Identity
-        WGPUColorSpaceYCbCrRangeDawn_Narrow
-        WGPUColorSpaceYCbCrRangeDawn_Full
-
     ctypedef enum WGPUCompareFunction:
         WGPUCompareFunction_Undefined
         WGPUCompareFunction_Never
@@ -257,12 +215,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUErrorType_Internal
         WGPUErrorType_Unknown
 
-    ctypedef enum WGPUExternalTextureRotation:
-        WGPUExternalTextureRotation_Rotate0Degrees
-        WGPUExternalTextureRotation_Rotate90Degrees
-        WGPUExternalTextureRotation_Rotate180Degrees
-        WGPUExternalTextureRotation_Rotate270Degrees
-
     ctypedef enum WGPUFeatureLevel:
         WGPUFeatureLevel_Undefined
         WGPUFeatureLevel_Compatibility
@@ -293,73 +245,9 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUFeatureName_TextureComponentSwizzle
         WGPUFeatureName_SubgroupSizeControl
         WGPUFeatureName_TextureCompressionUnaligned
-        WGPUFeatureName_DawnInternalUsages
-        WGPUFeatureName_DawnMultiPlanarFormats
-        WGPUFeatureName_DawnNative
-        WGPUFeatureName_ChromiumExperimentalTimestampQueryInsidePasses
-        WGPUFeatureName_ImplicitDeviceSynchronization
-        WGPUFeatureName_TransientAttachments
-        WGPUFeatureName_MSAARenderToSingleSampled
-        WGPUFeatureName_D3D11MultithreadProtected
-        WGPUFeatureName_ANGLETextureSharing
-        WGPUFeatureName_PixelLocalStorageCoherent
-        WGPUFeatureName_PixelLocalStorageNonCoherent
         WGPUFeatureName_Unorm16TextureFormats
-        WGPUFeatureName_MultiPlanarFormatExtendedUsages
-        WGPUFeatureName_MultiPlanarFormatP010
-        WGPUFeatureName_HostMappedPointer
-        WGPUFeatureName_MultiPlanarRenderTargets
-        WGPUFeatureName_MultiPlanarFormatNv12a
-        WGPUFeatureName_FramebufferFetch
-        WGPUFeatureName_BufferMapExtendedUsages
-        WGPUFeatureName_AdapterPropertiesMemoryHeaps
-        WGPUFeatureName_AdapterPropertiesD3D
-        WGPUFeatureName_AdapterPropertiesVk
-        WGPUFeatureName_DawnFormatCapabilities
-        WGPUFeatureName_DawnDrmFormatCapabilities
-        WGPUFeatureName_MultiPlanarFormatNv16
-        WGPUFeatureName_MultiPlanarFormatNv24
-        WGPUFeatureName_MultiPlanarFormatP210
-        WGPUFeatureName_MultiPlanarFormatP410
-        WGPUFeatureName_SharedTextureMemoryVkDedicatedAllocation
-        WGPUFeatureName_SharedTextureMemoryAHardwareBuffer
-        WGPUFeatureName_SharedTextureMemoryDmaBuf
-        WGPUFeatureName_SharedTextureMemoryOpaqueFD
-        WGPUFeatureName_SharedTextureMemoryZirconHandle
-        WGPUFeatureName_SharedTextureMemoryDXGISharedHandle
-        WGPUFeatureName_SharedTextureMemoryD3D11Texture2D
-        WGPUFeatureName_SharedTextureMemoryIOSurface
-        WGPUFeatureName_SharedTextureMemoryEGLImage
-        WGPUFeatureName_SharedFenceVkSemaphoreOpaqueFD
-        WGPUFeatureName_SharedFenceSyncFD
-        WGPUFeatureName_SharedFenceVkSemaphoreZirconHandle
-        WGPUFeatureName_SharedFenceDXGISharedHandle
-        WGPUFeatureName_SharedFenceMTLSharedEvent
-        WGPUFeatureName_SharedBufferMemoryD3D12Resource
-        WGPUFeatureName_StaticSamplers
-        WGPUFeatureName_YCbCrVulkanSamplers
-        WGPUFeatureName_ShaderModuleCompilationOptions
-        WGPUFeatureName_DawnLoadResolveTexture
-        WGPUFeatureName_DawnPartialLoadResolveTexture
         WGPUFeatureName_MultiDrawIndirect
-        WGPUFeatureName_DawnTexelCopyBufferRowAlignment
-        WGPUFeatureName_FlexibleTextureViews
         WGPUFeatureName_ChromiumExperimentalSubgroupMatrix
-        WGPUFeatureName_SharedFenceEGLSync
-        WGPUFeatureName_DawnDeviceAllocatorControl
-        WGPUFeatureName_AdapterPropertiesWGPU
-        WGPUFeatureName_SharedBufferMemoryFromWindowsHandle
-        WGPUFeatureName_SharedTextureMemoryD3D12Resource
-        WGPUFeatureName_ChromiumExperimentalSamplingResourceTable
-        WGPUFeatureName_AtomicVec2uMinMax
-        WGPUFeatureName_Unorm16FormatsForExternalTexture
-        WGPUFeatureName_OpaqueYCbCrAndroidForExternalTexture
-        WGPUFeatureName_Unorm16Filterable
-        WGPUFeatureName_RenderPassRenderArea
-        WGPUFeatureName_AdapterPropertiesDrm
-        WGPUFeatureName_DawnAllowUndefinedLoadStoreOp
-        WGPUFeatureName_BufferMapWriteExtendedUsages
-        WGPUFeatureName_SharedBufferMemoryHostPointer
 
     ctypedef enum WGPUFilterMode:
         WGPUFilterMode_Undefined
@@ -385,13 +273,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPULoadOp_Undefined
         WGPULoadOp_Load
         WGPULoadOp_Clear
-        WGPULoadOp_ExpandResolveTexture
-
-    ctypedef enum WGPULoggingType:
-        WGPULoggingType_Verbose
-        WGPULoggingType_Info
-        WGPULoggingType_Warning
-        WGPULoggingType_Error
 
     ctypedef enum WGPUMapAsyncStatus:
         WGPUMapAsyncStatus_Success
@@ -422,9 +303,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     ctypedef enum WGPUPredefinedColorSpace:
         WGPUPredefinedColorSpace_SRGB
         WGPUPredefinedColorSpace_DisplayP3
-        WGPUPredefinedColorSpace_SRGBLinear
-        WGPUPredefinedColorSpace_DisplayP3Linear
-        WGPUPredefinedColorSpace_Rec2020Linear
 
     ctypedef enum WGPUPresentMode:
         WGPUPresentMode_Undefined
@@ -468,14 +346,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUSamplerBindingType_NonFiltering
         WGPUSamplerBindingType_Comparison
 
-    ctypedef enum WGPUSharedFenceType:
-        WGPUSharedFenceType_VkSemaphoreOpaqueFD
-        WGPUSharedFenceType_SyncFD
-        WGPUSharedFenceType_VkSemaphoreZirconHandle
-        WGPUSharedFenceType_DXGISharedHandle
-        WGPUSharedFenceType_MTLSharedEvent
-        WGPUSharedFenceType_EGLSync
-
     ctypedef enum WGPUStatus:
         WGPUStatus_Success
         WGPUStatus_Error
@@ -521,88 +391,8 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUSType_CompatibilityModeLimits
         WGPUSType_TextureBindingViewDimension
         WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector
-        WGPUSType_SurfaceDescriptorFromWindowsCoreWindow
-        WGPUSType_SurfaceDescriptorFromWindowsUWPSwapChainPanel
-        WGPUSType_DawnTextureInternalUsageDescriptor
-        WGPUSType_DawnEncoderInternalUsageDescriptor
-        WGPUSType_DawnInstanceDescriptor
-        WGPUSType_DawnCacheDeviceDescriptor
-        WGPUSType_DawnAdapterPropertiesPowerPreference
-        WGPUSType_DawnBufferDescriptorErrorInfoFromWireClient
-        WGPUSType_DawnTogglesDescriptor
-        WGPUSType_DawnShaderModuleSPIRVOptionsDescriptor
-        WGPUSType_RequestAdapterOptionsLUID
-        WGPUSType_RequestAdapterOptionsGetGLProc
-        WGPUSType_RequestAdapterOptionsD3D11Device
-        WGPUSType_DawnRenderPassSampleCount
-        WGPUSType_RenderPassPixelLocalStorage
-        WGPUSType_PipelineLayoutPixelLocalStorage
-        WGPUSType_BufferHostMappedPointer
-        WGPUSType_AdapterPropertiesMemoryHeaps
-        WGPUSType_AdapterPropertiesD3D
-        WGPUSType_AdapterPropertiesVk
-        WGPUSType_DawnWireWGSLControl
-        WGPUSType_DawnWGSLBlocklist
-        WGPUSType_DawnDrmFormatCapabilities
-        WGPUSType_ShaderModuleCompilationOptions
-        WGPUSType_ColorTargetStateExpandResolveTextureDawn
-        WGPUSType_RenderPassRenderAreaRect
-        WGPUSType_SharedTextureMemoryVkDedicatedAllocationDescriptor
-        WGPUSType_SharedTextureMemoryAHardwareBufferDescriptor
-        WGPUSType_SharedTextureMemoryDmaBufDescriptor
-        WGPUSType_SharedTextureMemoryOpaqueFDDescriptor
-        WGPUSType_SharedTextureMemoryZirconHandleDescriptor
-        WGPUSType_SharedTextureMemoryDXGISharedHandleDescriptor
-        WGPUSType_SharedTextureMemoryD3D11Texture2DDescriptor
-        WGPUSType_SharedTextureMemoryIOSurfaceDescriptor
-        WGPUSType_SharedTextureMemoryEGLImageDescriptor
-        WGPUSType_SharedTextureMemoryInitializedBeginState
-        WGPUSType_SharedTextureMemoryInitializedEndState
-        WGPUSType_SharedTextureMemoryVkImageLayoutBeginState
-        WGPUSType_SharedTextureMemoryVkImageLayoutEndState
-        WGPUSType_SharedTextureMemoryD3DSwapchainBeginState
-        WGPUSType_SharedFenceVkSemaphoreOpaqueFDDescriptor
-        WGPUSType_SharedFenceVkSemaphoreOpaqueFDExportInfo
-        WGPUSType_SharedFenceSyncFDDescriptor
-        WGPUSType_SharedFenceSyncFDExportInfo
-        WGPUSType_SharedFenceVkSemaphoreZirconHandleDescriptor
-        WGPUSType_SharedFenceVkSemaphoreZirconHandleExportInfo
-        WGPUSType_SharedFenceDXGISharedHandleDescriptor
-        WGPUSType_SharedFenceDXGISharedHandleExportInfo
-        WGPUSType_SharedFenceMTLSharedEventDescriptor
-        WGPUSType_SharedFenceMTLSharedEventExportInfo
-        WGPUSType_SharedBufferMemoryD3D12ResourceDescriptor
-        WGPUSType_StaticSamplerBindingLayout
-        WGPUSType_YCbCrVkDescriptor
-        WGPUSType_SharedTextureMemoryAHardwareBufferProperties
-        WGPUSType_AHardwareBufferProperties
-        WGPUSType_DawnTexelCopyBufferRowAlignmentLimits
         WGPUSType_AdapterPropertiesSubgroupMatrixConfigs
-        WGPUSType_SharedFenceEGLSyncDescriptor
-        WGPUSType_SharedFenceEGLSyncExportInfo
-        WGPUSType_DawnInjectedInvalidSType
         WGPUSType_DawnCompilationMessageUtf16
-        WGPUSType_DawnFakeBufferOOMForTesting
-        WGPUSType_SurfaceDescriptorFromWindowsWinUISwapChainPanel
-        WGPUSType_DawnDeviceAllocatorControl
-        WGPUSType_DawnHostMappedPointerLimits
-        WGPUSType_RenderPassDescriptorResolveRect
-        WGPUSType_RequestAdapterWebGPUBackendOptions
-        WGPUSType_DawnFakeDeviceInitializeErrorForTesting
-        WGPUSType_SharedTextureMemoryD3D11BeginState
-        WGPUSType_DawnConsumeAdapterDescriptor
-        WGPUSType_TexelBufferBindingEntry
-        WGPUSType_TexelBufferBindingLayout
-        WGPUSType_SharedTextureMemoryMetalEndAccessState
-        WGPUSType_AdapterPropertiesWGPU
-        WGPUSType_SharedBufferMemoryFromWindowsHandleDescriptor
-        WGPUSType_SharedTextureMemoryD3D12ResourceDescriptor
-        WGPUSType_RequestAdapterOptionsAngleVirtualizationGroup
-        WGPUSType_PipelineLayoutResourceTable
-        WGPUSType_AdapterPropertiesDrm
-        WGPUSType_RenderBundleEncoderResourceTable
-        WGPUSType_DawnShaderSourceSPIRV
-        WGPUSType_SharedBufferMemoryHostPointerDescriptor
 
     ctypedef enum WGPUSubgroupMatrixComponentType:
         WGPUSubgroupMatrixComponentType_F32
@@ -620,19 +410,11 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUSurfaceGetCurrentTextureStatus_Lost
         WGPUSurfaceGetCurrentTextureStatus_Error
 
-    ctypedef enum WGPUTexelBufferAccess:
-        WGPUTexelBufferAccess_Undefined
-        WGPUTexelBufferAccess_ReadOnly
-        WGPUTexelBufferAccess_ReadWrite
-
     ctypedef enum WGPUTextureAspect:
         WGPUTextureAspect_Undefined
         WGPUTextureAspect_All
         WGPUTextureAspect_StencilOnly
         WGPUTextureAspect_DepthOnly
-        WGPUTextureAspect_Plane0Only
-        WGPUTextureAspect_Plane1Only
-        WGPUTextureAspect_Plane2Only
 
     ctypedef enum WGPUTextureDimension:
         WGPUTextureDimension_Undefined
@@ -743,14 +525,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUTextureFormat_ASTC12x10UnormSrgb
         WGPUTextureFormat_ASTC12x12Unorm
         WGPUTextureFormat_ASTC12x12UnormSrgb
-        WGPUTextureFormat_R8BG8Biplanar420Unorm
-        WGPUTextureFormat_R10X6BG10X6Biplanar420Unorm
-        WGPUTextureFormat_R8BG8A8Triplanar420Unorm
-        WGPUTextureFormat_R8BG8Biplanar422Unorm
-        WGPUTextureFormat_R8BG8Biplanar444Unorm
-        WGPUTextureFormat_R10X6BG10X6Biplanar422Unorm
-        WGPUTextureFormat_R10X6BG10X6Biplanar444Unorm
-        WGPUTextureFormat_OpaqueYCbCrAndroid
 
     ctypedef enum WGPUTextureSampleType:
         WGPUTextureSampleType_BindingNotUsed
@@ -843,15 +617,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUWGSLLanguageFeatureName_BufferView
         WGPUWGSLLanguageFeatureName_SwizzleAssignment
         WGPUWGSLLanguageFeatureName_FragmentDepth
-        WGPUWGSLLanguageFeatureName_ChromiumTestingUnimplemented
-        WGPUWGSLLanguageFeatureName_ChromiumTestingUnsafeExperimental
-        WGPUWGSLLanguageFeatureName_ChromiumTestingExperimental
-        WGPUWGSLLanguageFeatureName_ChromiumTestingShippedWithKillswitch
-        WGPUWGSLLanguageFeatureName_ChromiumTestingShipped
-        WGPUWGSLLanguageFeatureName_SizedBindingArray
-        WGPUWGSLLanguageFeatureName_TexelBuffers
-        WGPUWGSLLanguageFeatureName_ChromiumPrint
-        WGPUWGSLLanguageFeatureName_MultisampledArrayTextures
 
     # %% Flags
 
@@ -867,7 +632,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     const WGPUBufferUsage WGPUBufferUsage_Storage
     const WGPUBufferUsage WGPUBufferUsage_Indirect
     const WGPUBufferUsage WGPUBufferUsage_QueryResolve
-    const WGPUBufferUsage WGPUBufferUsage_TexelBuffer
     ctypedef WGPUFlags WGPUColorWriteMask
     const WGPUColorWriteMask WGPUColorWriteMask_None
     const WGPUColorWriteMask WGPUColorWriteMask_Red
@@ -875,13 +639,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     const WGPUColorWriteMask WGPUColorWriteMask_Blue
     const WGPUColorWriteMask WGPUColorWriteMask_Alpha
     const WGPUColorWriteMask WGPUColorWriteMask_All
-    ctypedef WGPUFlags WGPUHeapProperty
-    const WGPUHeapProperty WGPUHeapProperty_None
-    const WGPUHeapProperty WGPUHeapProperty_DeviceLocal
-    const WGPUHeapProperty WGPUHeapProperty_HostVisible
-    const WGPUHeapProperty WGPUHeapProperty_HostCoherent
-    const WGPUHeapProperty WGPUHeapProperty_HostUncached
-    const WGPUHeapProperty WGPUHeapProperty_HostCached
     ctypedef WGPUFlags WGPUMapMode
     const WGPUMapMode WGPUMapMode_None
     const WGPUMapMode WGPUMapMode_Read
@@ -899,34 +656,23 @@ cdef extern from "webgpu/webgpu.h" nogil:
     const WGPUTextureUsage WGPUTextureUsage_StorageBinding
     const WGPUTextureUsage WGPUTextureUsage_RenderAttachment
     const WGPUTextureUsage WGPUTextureUsage_TransientAttachment
-    const WGPUTextureUsage WGPUTextureUsage_StorageAttachment
 
     # %% Struct forward declarations
 
-    cdef struct WGPUAHardwareBufferProperties
     cdef struct WGPUAdapterInfo
-    cdef struct WGPUAdapterPropertiesD3D
-    cdef struct WGPUAdapterPropertiesDrm
-    cdef struct WGPUAdapterPropertiesMemoryHeaps
     cdef struct WGPUAdapterPropertiesSubgroupMatrixConfigs
-    cdef struct WGPUAdapterPropertiesVk
-    cdef struct WGPUAdapterPropertiesWGPU
     cdef struct WGPUBindGroupDescriptor
     cdef struct WGPUBindGroupEntry
     cdef struct WGPUBindGroupLayoutDescriptor
     cdef struct WGPUBindGroupLayoutEntry
-    cdef struct WGPUBindingResource
     cdef struct WGPUBlendComponent
     cdef struct WGPUBlendState
     cdef struct WGPUBufferBindingLayout
     cdef struct WGPUBufferDescriptor
-    cdef struct WGPUBufferHostMappedPointer
     cdef struct WGPUBufferMapCallbackInfo
     cdef struct WGPUChainedStruct
     cdef struct WGPUColor
-    cdef struct WGPUColorSpaceDawn
     cdef struct WGPUColorTargetState
-    cdef struct WGPUColorTargetStateExpandResolveTextureDawn
     cdef struct WGPUCommandBufferDescriptor
     cdef struct WGPUCommandEncoderDescriptor
     cdef struct WGPUCompatibilityModeLimits
@@ -937,61 +683,27 @@ cdef extern from "webgpu/webgpu.h" nogil:
     cdef struct WGPUComputePipelineDescriptor
     cdef struct WGPUComputeState
     cdef struct WGPUConstantEntry
-    cdef struct WGPUCopyTextureForBrowserOptions
     cdef struct WGPUCreateComputePipelineAsyncCallbackInfo
     cdef struct WGPUCreateRenderPipelineAsyncCallbackInfo
-    cdef struct WGPUDawnAdapterPropertiesPowerPreference
-    cdef struct WGPUDawnBufferDescriptorErrorInfoFromWireClient
-    cdef struct WGPUDawnCacheDeviceDescriptor
     cdef struct WGPUDawnCompilationMessageUtf16
-    cdef struct WGPUDawnConsumeAdapterDescriptor
-    cdef struct WGPUDawnDeviceAllocatorControl
-    cdef struct WGPUDawnDrmFormatCapabilities
-    cdef struct WGPUDawnDrmFormatProperties
-    cdef struct WGPUDawnEncoderInternalUsageDescriptor
-    cdef struct WGPUDawnFakeBufferOOMForTesting
-    cdef struct WGPUDawnFakeDeviceInitializeErrorForTesting
-    cdef struct WGPUDawnFormatCapabilities
-    cdef struct WGPUDawnHostMappedPointerLimits
-    cdef struct WGPUDawnInjectedInvalidSType
-    cdef struct WGPUDawnLoadCacheDataCallbackInfo
-    cdef struct WGPUDawnRenderPassSampleCount
-    cdef struct WGPUDawnShaderModuleSPIRVOptionsDescriptor
-    cdef struct WGPUDawnShaderSourceSPIRV
-    cdef struct WGPUDawnStoreCacheDataCallbackInfo
-    cdef struct WGPUDawnTexelCopyBufferRowAlignmentLimits
-    cdef struct WGPUDawnTextureInternalUsageDescriptor
-    cdef struct WGPUDawnTogglesDescriptor
-    cdef struct WGPUDawnWGSLBlocklist
-    cdef struct WGPUDawnWireWGSLControl
     cdef struct WGPUDepthStencilState
     cdef struct WGPUDeviceDescriptor
     cdef struct WGPUDeviceLostCallbackInfo
-    cdef struct WGPUDisposeCallbackInfo
     cdef struct WGPUEmscriptenSurfaceSourceCanvasHTMLSelector
-    cdef struct WGPUExtent2D
     cdef struct WGPUExtent3D
     cdef struct WGPUExternalTextureBindingEntry
     cdef struct WGPUExternalTextureBindingLayout
-    cdef struct WGPUExternalTextureDescriptor
     cdef struct WGPUFragmentState
     cdef struct WGPUFuture
     cdef struct WGPUFutureWaitInfo
     cdef struct WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER
-    cdef struct WGPUImageCopyExternalTexture
     cdef struct WGPUInstanceDescriptor
     cdef struct WGPUInstanceLimits
     cdef struct WGPULimits
-    cdef struct WGPULoggingCallbackInfo
-    cdef struct WGPUMemoryHeapInfo
     cdef struct WGPUMultisampleState
-    cdef struct WGPUOrigin2D
     cdef struct WGPUOrigin3D
     cdef struct WGPUPassTimestampWrites
     cdef struct WGPUPipelineLayoutDescriptor
-    cdef struct WGPUPipelineLayoutPixelLocalStorage
-    cdef struct WGPUPipelineLayoutResourceTable
-    cdef struct WGPUPipelineLayoutStorageAttachment
     cdef struct WGPUPopErrorScopeCallbackInfo
     cdef struct WGPUPrimitiveState
     cdef struct WGPUQuerySetDescriptor
@@ -999,68 +711,20 @@ cdef extern from "webgpu/webgpu.h" nogil:
     cdef struct WGPUQueueWorkDoneCallbackInfo
     cdef struct WGPURenderBundleDescriptor
     cdef struct WGPURenderBundleEncoderDescriptor
-    cdef struct WGPURenderBundleEncoderResourceTable
     cdef struct WGPURenderPassColorAttachment
     cdef struct WGPURenderPassDepthStencilAttachment
     cdef struct WGPURenderPassDescriptor
-    cdef struct WGPURenderPassDescriptorResolveRect
     cdef struct WGPURenderPassMaxDrawCount
-    cdef struct WGPURenderPassPixelLocalStorage
-    cdef struct WGPURenderPassRenderAreaRect
-    cdef struct WGPURenderPassStorageAttachment
     cdef struct WGPURenderPipelineDescriptor
     cdef struct WGPURequestAdapterCallbackInfo
     cdef struct WGPURequestAdapterOptions
-    cdef struct WGPURequestAdapterWebGPUBackendOptions
     cdef struct WGPURequestAdapterWebXROptions
     cdef struct WGPURequestDeviceCallbackInfo
-    cdef struct WGPUResourceTableDescriptor
     cdef struct WGPUSamplerBindingLayout
     cdef struct WGPUSamplerDescriptor
-    cdef struct WGPUShaderModuleCompilationOptions
     cdef struct WGPUShaderModuleDescriptor
     cdef struct WGPUShaderSourceSPIRV
     cdef struct WGPUShaderSourceWGSL
-    cdef struct WGPUSharedBufferMemoryBeginAccessDescriptor
-    cdef struct WGPUSharedBufferMemoryDescriptor
-    cdef struct WGPUSharedBufferMemoryEndAccessState
-    cdef struct WGPUSharedBufferMemoryFromWindowsHandleDescriptor
-    cdef struct WGPUSharedBufferMemoryHostPointerDescriptor
-    cdef struct WGPUSharedBufferMemoryProperties
-    cdef struct WGPUSharedFenceDXGISharedHandleDescriptor
-    cdef struct WGPUSharedFenceDXGISharedHandleExportInfo
-    cdef struct WGPUSharedFenceDescriptor
-    cdef struct WGPUSharedFenceEGLSyncDescriptor
-    cdef struct WGPUSharedFenceEGLSyncExportInfo
-    cdef struct WGPUSharedFenceExportInfo
-    cdef struct WGPUSharedFenceMTLSharedEventDescriptor
-    cdef struct WGPUSharedFenceMTLSharedEventExportInfo
-    cdef struct WGPUSharedFenceSyncFDDescriptor
-    cdef struct WGPUSharedFenceSyncFDExportInfo
-    cdef struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor
-    cdef struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo
-    cdef struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor
-    cdef struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo
-    cdef struct WGPUSharedTextureMemoryAHardwareBufferDescriptor
-    cdef struct WGPUSharedTextureMemoryAHardwareBufferProperties
-    cdef struct WGPUSharedTextureMemoryBeginAccessDescriptor
-    cdef struct WGPUSharedTextureMemoryD3D11BeginState
-    cdef struct WGPUSharedTextureMemoryD3DSwapchainBeginState
-    cdef struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor
-    cdef struct WGPUSharedTextureMemoryDescriptor
-    cdef struct WGPUSharedTextureMemoryDmaBufDescriptor
-    cdef struct WGPUSharedTextureMemoryDmaBufPlane
-    cdef struct WGPUSharedTextureMemoryEGLImageDescriptor
-    cdef struct WGPUSharedTextureMemoryEndAccessState
-    cdef struct WGPUSharedTextureMemoryIOSurfaceDescriptor
-    cdef struct WGPUSharedTextureMemoryMetalEndAccessState
-    cdef struct WGPUSharedTextureMemoryOpaqueFDDescriptor
-    cdef struct WGPUSharedTextureMemoryProperties
-    cdef struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor
-    cdef struct WGPUSharedTextureMemoryVkImageLayoutBeginState
-    cdef struct WGPUSharedTextureMemoryVkImageLayoutEndState
-    cdef struct WGPUSharedTextureMemoryZirconHandleDescriptor
-    cdef struct WGPUStaticSamplerBindingLayout
     cdef struct WGPUStencilFaceState
     cdef struct WGPUStorageTextureBindingLayout
     cdef struct WGPUStringView
@@ -1072,19 +736,7 @@ cdef extern from "webgpu/webgpu.h" nogil:
     cdef struct WGPUSurfaceColorManagement
     cdef struct WGPUSurfaceConfiguration
     cdef struct WGPUSurfaceDescriptor
-    cdef struct WGPUSurfaceDescriptorFromWindowsCoreWindow
-    cdef struct WGPUSurfaceDescriptorFromWindowsUWPSwapChainPanel
-    cdef struct WGPUSurfaceDescriptorFromWindowsWinUISwapChainPanel
-    cdef struct WGPUSurfaceSourceAndroidNativeWindow
-    cdef struct WGPUSurfaceSourceMetalLayer
-    cdef struct WGPUSurfaceSourceWaylandSurface
-    cdef struct WGPUSurfaceSourceWindowsHWND
-    cdef struct WGPUSurfaceSourceXCBWindow
-    cdef struct WGPUSurfaceSourceXlibWindow
     cdef struct WGPUSurfaceTexture
-    cdef struct WGPUTexelBufferBindingEntry
-    cdef struct WGPUTexelBufferBindingLayout
-    cdef struct WGPUTexelBufferViewDescriptor
     cdef struct WGPUTexelCopyBufferInfo
     cdef struct WGPUTexelCopyBufferLayout
     cdef struct WGPUTexelCopyTextureInfo
@@ -1098,23 +750,15 @@ cdef extern from "webgpu/webgpu.h" nogil:
     cdef struct WGPUVertexAttribute
     cdef struct WGPUVertexBufferLayout
     cdef struct WGPUVertexState
-    cdef struct WGPUYCbCrVkDescriptor
 
     # %% Callbacks
 
-    ctypedef void (*WGPUCallback)(void* userdata) noexcept
-    ctypedef size_t (*WGPUDawnLoadCacheDataFunction)(const void* key, size_t keySize, void* value, size_t valueSize, void* userdata) noexcept
-    ctypedef void (*WGPUDawnStoreCacheDataFunction)(const void* key, size_t keySize, const void* value, size_t valueSize, void* userdata) noexcept
     ctypedef void (*WGPUProc)() noexcept
     ctypedef void (*WGPUBufferMapCallback)(WGPUMapAsyncStatus status, WGPUStringView message, void* userdata1, void* userdata2) noexcept
     ctypedef void (*WGPUCompilationInfoCallback)(WGPUCompilationInfoRequestStatus status, const WGPUCompilationInfo* compilationInfo, void* userdata1, void* userdata2) noexcept
     ctypedef void (*WGPUCreateComputePipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, WGPUStringView message, void* userdata1, void* userdata2) noexcept
     ctypedef void (*WGPUCreateRenderPipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, WGPUStringView message, void* userdata1, void* userdata2) noexcept
-    ctypedef size_t (*WGPUDawnLoadCacheDataCallback)(size_t keySize, const uint8_t* key, size_t valueSize, uint8_t* value, void* userdata1, void* userdata2) noexcept
-    ctypedef void (*WGPUDawnStoreCacheDataCallback)(size_t keySize, const uint8_t* key, size_t valueSize, const uint8_t* value, void* userdata1, void* userdata2) noexcept
     ctypedef void (*WGPUDeviceLostCallback)(const WGPUDevice* device, WGPUDeviceLostReason reason, WGPUStringView message, void* userdata1, void* userdata2) noexcept
-    ctypedef void (*WGPUDisposeCallback)(WGPUCallbackStatus status, void* userdata1, void* userdata2) noexcept
-    ctypedef void (*WGPULoggingCallback)(WGPULoggingType type, WGPUStringView message, void* userdata1, void* userdata2) noexcept
     ctypedef void (*WGPUPopErrorScopeCallback)(WGPUPopErrorScopeStatus status, WGPUErrorType type, WGPUStringView message, void* userdata1, void* userdata2) noexcept
     ctypedef void (*WGPUQueueWorkDoneCallback)(WGPUQueueWorkDoneStatus status, WGPUStringView message, void* userdata1, void* userdata2) noexcept
     ctypedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPUAdapter adapter, WGPUStringView message, void* userdata1, void* userdata2) noexcept
@@ -1159,18 +803,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         void* userdata1
         void* userdata2
 
-    cdef struct WGPUDawnLoadCacheDataCallbackInfo:
-        WGPUChainedStruct* nextInChain
-        WGPUDawnLoadCacheDataCallback callback
-        void* userdata1
-        void* userdata2
-
-    cdef struct WGPUDawnStoreCacheDataCallbackInfo:
-        WGPUChainedStruct* nextInChain
-        WGPUDawnStoreCacheDataCallback callback
-        void* userdata1
-        void* userdata2
-
     cdef struct WGPUDeviceLostCallbackInfo:
         WGPUChainedStruct* nextInChain
         WGPUCallbackMode mode
@@ -1178,19 +810,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         void* userdata1
         void* userdata2
 
-    cdef struct WGPUDisposeCallbackInfo:
-        WGPUChainedStruct* nextInChain
-        WGPUCallbackMode mode
-        WGPUDisposeCallback callback
-        void* userdata1
-        void* userdata2
-
-    cdef struct WGPULoggingCallbackInfo:
-        WGPUChainedStruct* nextInChain
-        WGPULoggingCallback callback
-        void* userdata1
-        void* userdata2
-
     cdef struct WGPUPopErrorScopeCallbackInfo:
         WGPUChainedStruct* nextInChain
         WGPUCallbackMode mode
@@ -1225,37 +844,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         void* userdata1
         void* userdata2
 
-    cdef struct WGPUAdapterPropertiesD3D:
-        WGPUChainedStruct chain
-        uint32_t shaderModel
-        uint32_t adapterLUIDLowPart
-        uint32_t adapterLUIDHighPart
-
-    cdef struct WGPUAdapterPropertiesDrm:
-        WGPUChainedStruct chain
-        WGPUBool hasPrimary
-        WGPUBool hasRender
-        uint64_t primaryMajor
-        uint64_t primaryMinor
-        uint64_t renderMajor
-        uint64_t renderMinor
-
-    cdef struct WGPUAdapterPropertiesVk:
-        WGPUChainedStruct chain
-        uint32_t driverVersion
-
-    cdef struct WGPUAdapterPropertiesWGPU:
-        WGPUChainedStruct chain
-        WGPUBackendType backendType
-
-    cdef struct WGPUBindingResource:
-        WGPUChainedStruct* nextInChain
-        WGPUBuffer buffer
-        uint64_t offset
-        uint64_t size
-        WGPUSampler sampler
-        WGPUTextureView textureView
-
     cdef struct WGPUBlendComponent:
         WGPUBlendOperation operation
         WGPUBlendFactor srcFactor
@@ -1267,11 +855,12 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUBool hasDynamicOffset
         uint64_t minBindingSize
 
-    cdef struct WGPUBufferHostMappedPointer:
-        WGPUChainedStruct chain
-        void* pointer
-        WGPUCallback disposeCallback
-        void* userdata
+    cdef struct WGPUBufferDescriptor:
+        WGPUChainedStruct* nextInChain
+        WGPUStringView label
+        WGPUBufferUsage usage
+        uint64_t size
+        WGPUBool mappedAtCreation
 
     cdef struct WGPUColor:
         double r
@@ -1279,19 +868,11 @@ cdef extern from "webgpu/webgpu.h" nogil:
         double b
         double a
 
-    cdef struct WGPUColorSpaceDawn:
+    cdef struct WGPUCommandBufferDescriptor:
         WGPUChainedStruct* nextInChain
-        WGPUColorSpacePrimariesDawn primaries
-        WGPUColorSpaceTransferDawn transfer
-        WGPUColorSpaceYCbCrRangeDawn yCbCrRange
-        WGPUColorSpaceYCbCrMatrixDawn yCbCrMatrix
-        float hdrReferenceWhiteLuminance
-
-    cdef struct WGPUColorTargetStateExpandResolveTextureDawn:
-        WGPUChainedStruct chain
-        WGPUBool enabled
+        WGPUStringView label
 
-    cdef struct WGPUCommandBufferDescriptor:
+    cdef struct WGPUCommandEncoderDescriptor:
         WGPUChainedStruct* nextInChain
         WGPUStringView label
 
@@ -1307,117 +888,16 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUStringView key
         double value
 
-    cdef struct WGPUCopyTextureForBrowserOptions:
-        WGPUChainedStruct* nextInChain
-        WGPUBool flipY
-        WGPUBool needsColorSpaceConversion
-        WGPUAlphaMode srcAlphaMode
-        const float* srcTransferFunctionParameters
-        const float* conversionMatrix
-        const float* dstTransferFunctionParameters
-        WGPUAlphaMode dstAlphaMode
-        WGPUBool internalUsage
-
-    cdef struct WGPUDawnAdapterPropertiesPowerPreference:
-        WGPUChainedStruct chain
-        WGPUPowerPreference powerPreference
-
-    cdef struct WGPUDawnBufferDescriptorErrorInfoFromWireClient:
-        WGPUChainedStruct chain
-        WGPUBool outOfMemory
-
-    cdef struct WGPUDawnCacheDeviceDescriptor:
-        WGPUChainedStruct chain
-        WGPUStringView isolationKey
-        WGPUDawnLoadCacheDataCallbackInfo dawnLoadCacheDataCallbackInfo
-        WGPUDawnStoreCacheDataCallbackInfo dawnStoreCacheDataCallbackInfo
-
     cdef struct WGPUDawnCompilationMessageUtf16:
         WGPUChainedStruct chain
         uint64_t linePos
         uint64_t offset
         uint64_t length
 
-    cdef struct WGPUDawnConsumeAdapterDescriptor:
-        WGPUChainedStruct chain
-        WGPUBool consumeAdapter
-
-    cdef struct WGPUDawnDeviceAllocatorControl:
-        WGPUChainedStruct chain
-        size_t allocatorHeapBlockSize
-
-    cdef struct WGPUDawnDrmFormatProperties:
-        uint64_t modifier
-        uint32_t modifierPlaneCount
-
-    cdef struct WGPUDawnEncoderInternalUsageDescriptor:
-        WGPUChainedStruct chain
-        WGPUBool useInternalUsages
-
-    cdef struct WGPUDawnFakeBufferOOMForTesting:
-        WGPUChainedStruct chain
-        WGPUBool fakeOOMAtWireClientMap
-        WGPUBool fakeOOMAtNativeMap
-        WGPUBool fakeOOMAtDevice
-
-    cdef struct WGPUDawnFakeDeviceInitializeErrorForTesting:
-        WGPUChainedStruct chain
-
-    cdef struct WGPUDawnHostMappedPointerLimits:
-        WGPUChainedStruct chain
-        uint32_t hostMappedPointerAlignment
-
-    cdef struct WGPUDawnInjectedInvalidSType:
-        WGPUChainedStruct chain
-        WGPUSType invalidSType
-
-    cdef struct WGPUDawnRenderPassSampleCount:
-        WGPUChainedStruct chain
-        uint32_t sampleCount
-
-    cdef struct WGPUDawnShaderModuleSPIRVOptionsDescriptor:
-        WGPUChainedStruct chain
-        WGPUBool allowNonUniformDerivatives
-
-    cdef struct WGPUDawnShaderSourceSPIRV:
-        WGPUChainedStruct chain
-        size_t codeSize
-        const uint32_t* code
-
-    cdef struct WGPUDawnTexelCopyBufferRowAlignmentLimits:
-        WGPUChainedStruct chain
-        uint32_t minTexelCopyBufferRowAlignment
-
-    cdef struct WGPUDawnTextureInternalUsageDescriptor:
-        WGPUChainedStruct chain
-        WGPUTextureUsage internalUsage
-
-    cdef struct WGPUDawnTogglesDescriptor:
-        WGPUChainedStruct chain
-        size_t enabledToggleCount
-        const char** enabledToggles
-        size_t disabledToggleCount
-        const char** disabledToggles
-
-    cdef struct WGPUDawnWGSLBlocklist:
-        WGPUChainedStruct chain
-        size_t blocklistedFeatureCount
-        const char** blocklistedFeatures
-
-    cdef struct WGPUDawnWireWGSLControl:
-        WGPUChainedStruct chain
-        WGPUBool enableExperimental
-        WGPUBool enableUnsafe
-        WGPUBool enableTesting
-
     cdef struct WGPUEmscriptenSurfaceSourceCanvasHTMLSelector:
         WGPUChainedStruct chain
         WGPUStringView selector
 
-    cdef struct WGPUExtent2D:
-        uint32_t width
-        uint32_t height
-
     cdef struct WGPUExtent3D:
         uint32_t width
         uint32_t height
@@ -1440,20 +920,12 @@ cdef extern from "webgpu/webgpu.h" nogil:
     cdef struct WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER:
         WGPUBool unused
 
-    cdef struct WGPUMemoryHeapInfo:
-        WGPUHeapProperty properties
-        uint64_t size
-
     cdef struct WGPUMultisampleState:
         WGPUChainedStruct* nextInChain
         uint32_t count
         uint32_t mask
         WGPUBool alphaToCoverageEnabled
 
-    cdef struct WGPUOrigin2D:
-        uint32_t x
-        uint32_t y
-
     cdef struct WGPUOrigin3D:
         uint32_t x
         uint32_t y
@@ -1465,14 +937,12 @@ cdef extern from "webgpu/webgpu.h" nogil:
         uint32_t beginningOfPassWriteIndex
         uint32_t endOfPassWriteIndex
 
-    cdef struct WGPUPipelineLayoutResourceTable:
-        WGPUChainedStruct chain
-        WGPUBool usesResourceTable
-
-    cdef struct WGPUPipelineLayoutStorageAttachment:
+    cdef struct WGPUPipelineLayoutDescriptor:
         WGPUChainedStruct* nextInChain
-        uint64_t offset
-        WGPUTextureFormat format
+        WGPUStringView label
+        size_t bindGroupLayoutCount
+        const WGPUBindGroupLayout* bindGroupLayouts
+        uint32_t immediateSize
 
     cdef struct WGPUPrimitiveState:
         WGPUChainedStruct* nextInChain
@@ -1496,9 +966,15 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUChainedStruct* nextInChain
         WGPUStringView label
 
-    cdef struct WGPURenderBundleEncoderResourceTable:
-        WGPUChainedStruct chain
-        WGPUBool usesResourceTable
+    cdef struct WGPURenderBundleEncoderDescriptor:
+        WGPUChainedStruct* nextInChain
+        WGPUStringView label
+        size_t colorFormatCount
+        const WGPUTextureFormat* colorFormats
+        WGPUTextureFormat depthStencilFormat
+        uint32_t sampleCount
+        WGPUBool depthReadOnly
+        WGPUBool stencilReadOnly
 
     cdef struct WGPURenderPassDepthStencilAttachment:
         WGPUChainedStruct* nextInChain
@@ -1512,38 +988,31 @@ cdef extern from "webgpu/webgpu.h" nogil:
         uint32_t stencilClearValue
         WGPUBool stencilReadOnly
 
-    cdef struct WGPURenderPassDescriptorResolveRect:
-        WGPUChainedStruct chain
-        uint32_t colorOffsetX
-        uint32_t colorOffsetY
-        uint32_t resolveOffsetX
-        uint32_t resolveOffsetY
-        uint32_t width
-        uint32_t height
-
     cdef struct WGPURenderPassMaxDrawCount:
         WGPUChainedStruct chain
         uint64_t maxDrawCount
 
-    cdef struct WGPURequestAdapterWebGPUBackendOptions:
-        WGPUChainedStruct chain
-
     cdef struct WGPURequestAdapterWebXROptions:
         WGPUChainedStruct chain
         WGPUBool xrCompatible
 
-    cdef struct WGPUResourceTableDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-        uint32_t size
-
     cdef struct WGPUSamplerBindingLayout:
         WGPUChainedStruct* nextInChain
         WGPUSamplerBindingType type
 
-    cdef struct WGPUShaderModuleCompilationOptions:
-        WGPUChainedStruct chain
-        WGPUBool strictMath
+    cdef struct WGPUSamplerDescriptor:
+        WGPUChainedStruct* nextInChain
+        WGPUStringView label
+        WGPUAddressMode addressModeU
+        WGPUAddressMode addressModeV
+        WGPUAddressMode addressModeW
+        WGPUFilterMode magFilter
+        WGPUFilterMode minFilter
+        WGPUMipmapFilterMode mipmapFilter
+        float lodMinClamp
+        float lodMaxClamp
+        WGPUCompareFunction compare
+        uint16_t maxAnisotropy
 
     cdef struct WGPUShaderSourceSPIRV:
         WGPUChainedStruct chain
@@ -1554,149 +1023,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUChainedStruct chain
         WGPUStringView code
 
-    cdef struct WGPUSharedBufferMemoryBeginAccessDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUBool initialized
-        size_t fenceCount
-        const WGPUSharedFence* fences
-        size_t signaledValueCount
-        const uint64_t* signaledValues
-
-    cdef struct WGPUSharedBufferMemoryEndAccessState:
-        WGPUChainedStruct* nextInChain
-        WGPUBool initialized
-        size_t fenceCount
-        const WGPUSharedFence* fences
-        size_t signaledValueCount
-        const uint64_t* signaledValues
-
-    cdef struct WGPUSharedBufferMemoryFromWindowsHandleDescriptor:
-        WGPUChainedStruct chain
-        void* handle
-        uint64_t size
-
-    cdef struct WGPUSharedBufferMemoryHostPointerDescriptor:
-        WGPUChainedStruct chain
-        void* pointer
-        uint64_t size
-        WGPUDisposeCallbackInfo disposeCallbackInfo
-
-    cdef struct WGPUSharedBufferMemoryProperties:
-        WGPUChainedStruct* nextInChain
-        WGPUBufferUsage usage
-        uint64_t size
-
-    cdef struct WGPUSharedFenceDXGISharedHandleDescriptor:
-        WGPUChainedStruct chain
-        void* handle
-
-    cdef struct WGPUSharedFenceDXGISharedHandleExportInfo:
-        WGPUChainedStruct chain
-        void* handle
-
-    cdef struct WGPUSharedFenceEGLSyncDescriptor:
-        WGPUChainedStruct chain
-        void* sync
-
-    cdef struct WGPUSharedFenceEGLSyncExportInfo:
-        WGPUChainedStruct chain
-        void* sync
-
-    cdef struct WGPUSharedFenceMTLSharedEventDescriptor:
-        WGPUChainedStruct chain
-        void* sharedEvent
-
-    cdef struct WGPUSharedFenceMTLSharedEventExportInfo:
-        WGPUChainedStruct chain
-        void* sharedEvent
-
-    cdef struct WGPUSharedFenceSyncFDDescriptor:
-        WGPUChainedStruct chain
-        int handle
-
-    cdef struct WGPUSharedFenceSyncFDExportInfo:
-        WGPUChainedStruct chain
-        int handle
-
-    cdef struct WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor:
-        WGPUChainedStruct chain
-        int handle
-
-    cdef struct WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo:
-        WGPUChainedStruct chain
-        int handle
-
-    cdef struct WGPUSharedFenceVkSemaphoreZirconHandleDescriptor:
-        WGPUChainedStruct chain
-        uint32_t handle
-
-    cdef struct WGPUSharedFenceVkSemaphoreZirconHandleExportInfo:
-        WGPUChainedStruct chain
-        uint32_t handle
-
-    cdef struct WGPUSharedTextureMemoryAHardwareBufferDescriptor:
-        WGPUChainedStruct chain
-        void* handle
-
-    cdef struct WGPUSharedTextureMemoryD3D11BeginState:
-        WGPUChainedStruct chain
-        WGPUBool requiresEndAccessFence
-
-    cdef struct WGPUSharedTextureMemoryD3DSwapchainBeginState:
-        WGPUChainedStruct chain
-        WGPUBool isSwapchain
-
-    cdef struct WGPUSharedTextureMemoryDmaBufPlane:
-        int fd
-        uint64_t offset
-        uint32_t stride
-
-    cdef struct WGPUSharedTextureMemoryDXGISharedHandleDescriptor:
-        WGPUChainedStruct chain
-        void* handle
-        WGPUBool useKeyedMutex
-
-    cdef struct WGPUSharedTextureMemoryEGLImageDescriptor:
-        WGPUChainedStruct chain
-        void* image
-
-    cdef struct WGPUSharedTextureMemoryIOSurfaceDescriptor:
-        WGPUChainedStruct chain
-        void* ioSurface
-        WGPUBool allowStorageBinding
-
-    cdef struct WGPUSharedTextureMemoryOpaqueFDDescriptor:
-        WGPUChainedStruct chain
-        const void* vkImageCreateInfo
-        int memoryFD
-        uint32_t memoryTypeIndex
-        uint64_t allocationSize
-        WGPUBool dedicatedAllocation
-
-    cdef struct WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor:
-        WGPUChainedStruct chain
-        WGPUBool dedicatedAllocation
-
-    cdef struct WGPUSharedTextureMemoryVkImageLayoutBeginState:
-        WGPUChainedStruct chain
-        int32_t oldLayout
-        int32_t newLayout
-
-    cdef struct WGPUSharedTextureMemoryVkImageLayoutEndState:
-        WGPUChainedStruct chain
-        int32_t oldLayout
-        int32_t newLayout
-
-    cdef struct WGPUSharedTextureMemoryZirconHandleDescriptor:
-        WGPUChainedStruct chain
-        uint32_t memoryFD
-        uint64_t allocationSize
-
-    cdef struct WGPUStaticSamplerBindingLayout:
-        WGPUChainedStruct chain
-        WGPUSampler sampler
-        uint32_t sampledTextureBinding
-
     cdef struct WGPUStencilFaceState:
         WGPUCompareFunction compare
         WGPUStencilOperation failOp
@@ -1757,67 +1083,11 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUCompositeAlphaMode alphaMode
         WGPUPresentMode presentMode
 
-    cdef struct WGPUSurfaceDescriptorFromWindowsCoreWindow:
-        WGPUChainedStruct chain
-        void* coreWindow
-
-    cdef struct WGPUSurfaceDescriptorFromWindowsUWPSwapChainPanel:
-        WGPUChainedStruct chain
-        void* swapChainPanel
-
-    cdef struct WGPUSurfaceDescriptorFromWindowsWinUISwapChainPanel:
-        WGPUChainedStruct chain
-        void* swapChainPanel
-
-    cdef struct WGPUSurfaceSourceAndroidNativeWindow:
-        WGPUChainedStruct chain
-        void* window
-
-    cdef struct WGPUSurfaceSourceMetalLayer:
-        WGPUChainedStruct chain
-        void* layer
-
-    cdef struct WGPUSurfaceSourceWaylandSurface:
-        WGPUChainedStruct chain
-        void* display
-        void* surface
-
-    cdef struct WGPUSurfaceSourceWindowsHWND:
-        WGPUChainedStruct chain
-        void* hinstance
-        void* hwnd
-
-    cdef struct WGPUSurfaceSourceXCBWindow:
-        WGPUChainedStruct chain
-        void* connection
-        uint32_t window
-
-    cdef struct WGPUSurfaceSourceXlibWindow:
-        WGPUChainedStruct chain
-        void* display
-        uint64_t window
-
     cdef struct WGPUSurfaceTexture:
         WGPUChainedStruct* nextInChain
         WGPUTexture texture
         WGPUSurfaceGetCurrentTextureStatus status
 
-    cdef struct WGPUTexelBufferBindingEntry:
-        WGPUChainedStruct chain
-        WGPUTexelBufferView texelBufferView
-
-    cdef struct WGPUTexelBufferBindingLayout:
-        WGPUChainedStruct chain
-        WGPUTexelBufferAccess access
-        WGPUTextureFormat format
-
-    cdef struct WGPUTexelBufferViewDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-        WGPUTextureFormat format
-        uint64_t offset
-        uint64_t size
-
     cdef struct WGPUTexelCopyBufferLayout:
         uint64_t offset
         uint32_t bytesPerRow
@@ -1845,34 +1115,11 @@ cdef extern from "webgpu/webgpu.h" nogil:
         uint64_t offset
         uint32_t shaderLocation
 
-    cdef struct WGPUYCbCrVkDescriptor:
-        WGPUChainedStruct chain
-        uint32_t vkFormat
-        uint32_t vkYCbCrModel
-        uint32_t vkYCbCrRange
-        uint32_t vkComponentSwizzleRed
-        uint32_t vkComponentSwizzleGreen
-        uint32_t vkComponentSwizzleBlue
-        uint32_t vkComponentSwizzleAlpha
-        uint32_t vkXChromaOffset
-        uint32_t vkYChromaOffset
-        WGPUFilterMode vkChromaFilter
-        WGPUBool forceExplicitReconstruction
-        uint64_t externalFormat
-
-    cdef struct WGPUAdapterPropertiesMemoryHeaps:
-        WGPUChainedStruct chain
-        size_t heapCount
-        const WGPUMemoryHeapInfo* heapInfo
-
     cdef struct WGPUAdapterPropertiesSubgroupMatrixConfigs:
         WGPUChainedStruct chain
         size_t configCount
         const WGPUSubgroupMatrixConfig* configs
 
-    cdef struct WGPUAHardwareBufferProperties:
-        WGPUYCbCrVkDescriptor yCbCrInfo
-
     cdef struct WGPUBindGroupEntry:
         WGPUChainedStruct* nextInChain
         uint32_t binding
@@ -1896,17 +1143,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUBlendComponent color
         WGPUBlendComponent alpha
 
-    cdef struct WGPUBufferDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-        WGPUBufferUsage usage
-        uint64_t size
-        WGPUBool mappedAtCreation
-
-    cdef struct WGPUCommandEncoderDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-
     cdef struct WGPUCompilationMessage:
         WGPUChainedStruct* nextInChain
         WGPUStringView message
@@ -1928,11 +1164,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         size_t constantCount
         const WGPUConstantEntry* constants
 
-    cdef struct WGPUDawnDrmFormatCapabilities:
-        WGPUChainedStruct chain
-        size_t propertiesCount
-        const WGPUDawnDrmFormatProperties* properties
-
     cdef struct WGPUDepthStencilState:
         WGPUChainedStruct* nextInChain
         WGPUTextureFormat format
@@ -1946,32 +1177,10 @@ cdef extern from "webgpu/webgpu.h" nogil:
         float depthBiasSlopeScale
         float depthBiasClamp
 
-    cdef struct WGPUExternalTextureDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-        WGPUTextureView plane0
-        WGPUTextureView plane1
-        WGPUOrigin2D cropOrigin
-        WGPUExtent2D cropSize
-        WGPUExtent2D apparentSize
-        WGPUBool doYuvToRgbConversionOnly
-        const float* yuvToRgbConversionMatrix
-        const float* srcTransferFunctionParameters
-        const float* dstTransferFunctionParameters
-        const float* gamutConversionMatrix
-        WGPUBool mirrored
-        WGPUExternalTextureRotation rotation
-
     cdef struct WGPUFutureWaitInfo:
         WGPUFuture future
         WGPUBool completed
 
-    cdef struct WGPUImageCopyExternalTexture:
-        WGPUChainedStruct* nextInChain
-        WGPUExternalTexture externalTexture
-        WGPUOrigin3D origin
-        WGPUExtent2D naturalSize
-
     cdef struct WGPUInstanceDescriptor:
         WGPUChainedStruct* nextInChain
         size_t requiredFeatureCount
@@ -2013,22 +1222,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         uint32_t maxComputeWorkgroupsPerDimension
         uint32_t maxImmediateSize
 
-    cdef struct WGPUPipelineLayoutPixelLocalStorage:
-        WGPUChainedStruct chain
-        uint64_t totalPixelLocalStorageSize
-        size_t storageAttachmentCount
-        const WGPUPipelineLayoutStorageAttachment* storageAttachments
-
-    cdef struct WGPURenderBundleEncoderDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-        size_t colorFormatCount
-        const WGPUTextureFormat* colorFormats
-        WGPUTextureFormat depthStencilFormat
-        uint32_t sampleCount
-        WGPUBool depthReadOnly
-        WGPUBool stencilReadOnly
-
     cdef struct WGPURenderPassColorAttachment:
         WGPUChainedStruct* nextInChain
         WGPUTextureView view
@@ -2038,19 +1231,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUStoreOp storeOp
         WGPUColor clearValue
 
-    cdef struct WGPURenderPassRenderAreaRect:
-        WGPUChainedStruct chain
-        WGPUOrigin2D origin
-        WGPUExtent2D size
-
-    cdef struct WGPURenderPassStorageAttachment:
-        WGPUChainedStruct* nextInChain
-        uint64_t offset
-        WGPUTextureView storage
-        WGPULoadOp loadOp
-        WGPUStoreOp storeOp
-        WGPUColor clearValue
-
     cdef struct WGPURequestAdapterOptions:
         WGPUChainedStruct* nextInChain
         WGPUFeatureLevel featureLevel
@@ -2059,61 +1239,10 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUBackendType backendType
         WGPUSurface compatibleSurface
 
-    cdef struct WGPUSamplerDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-        WGPUAddressMode addressModeU
-        WGPUAddressMode addressModeV
-        WGPUAddressMode addressModeW
-        WGPUFilterMode magFilter
-        WGPUFilterMode minFilter
-        WGPUMipmapFilterMode mipmapFilter
-        float lodMinClamp
-        float lodMaxClamp
-        WGPUCompareFunction compare
-        uint16_t maxAnisotropy
-
     cdef struct WGPUShaderModuleDescriptor:
         WGPUChainedStruct* nextInChain
         WGPUStringView label
 
-    cdef struct WGPUSharedBufferMemoryDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-
-    cdef struct WGPUSharedFenceDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-
-    cdef struct WGPUSharedFenceExportInfo:
-        WGPUChainedStruct* nextInChain
-        WGPUSharedFenceType type
-
-    cdef struct WGPUSharedTextureMemoryAHardwareBufferProperties:
-        WGPUChainedStruct chain
-        WGPUYCbCrVkDescriptor yCbCrInfo
-
-    cdef struct WGPUSharedTextureMemoryBeginAccessDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUBool concurrentRead
-        WGPUBool initialized
-        size_t fenceCount
-        const WGPUSharedFence* fences
-        size_t signaledValueCount
-        const uint64_t* signaledValues
-
-    cdef struct WGPUSharedTextureMemoryDmaBufDescriptor:
-        WGPUChainedStruct chain
-        WGPUExtent3D size
-        uint32_t drmFormat
-        uint64_t drmModifier
-        size_t planeCount
-        const WGPUSharedTextureMemoryDmaBufPlane* planes
-
-    cdef struct WGPUSharedTextureMemoryMetalEndAccessState:
-        WGPUChainedStruct chain
-        WGPUFuture commandsScheduledFuture
-
     cdef struct WGPUSurfaceDescriptor:
         WGPUChainedStruct* nextInChain
         WGPUStringView label
@@ -2194,9 +1323,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUPipelineLayout layout
         WGPUComputeState compute
 
-    cdef struct WGPUDawnFormatCapabilities:
-        WGPUChainedStruct* nextInChain
-
     cdef struct WGPUDeviceDescriptor:
         WGPUChainedStruct* nextInChain
         WGPUStringView label
@@ -2207,36 +1333,14 @@ cdef extern from "webgpu/webgpu.h" nogil:
         WGPUDeviceLostCallbackInfo deviceLostCallbackInfo
         WGPUUncapturedErrorCallbackInfo uncapturedErrorCallbackInfo
 
-    cdef struct WGPUPipelineLayoutDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-        size_t bindGroupLayoutCount
-        const WGPUBindGroupLayout* bindGroupLayouts
-        uint32_t immediateSize
-
-    cdef struct WGPURenderPassPixelLocalStorage:
-        WGPUChainedStruct chain
-        uint64_t totalPixelLocalStorageSize
-        size_t storageAttachmentCount
-        const WGPURenderPassStorageAttachment* storageAttachments
-
-    cdef struct WGPUSharedTextureMemoryDescriptor:
+    cdef struct WGPURenderPassDescriptor:
         WGPUChainedStruct* nextInChain
         WGPUStringView label
-
-    cdef struct WGPUSharedTextureMemoryEndAccessState:
-        WGPUChainedStruct* nextInChain
-        WGPUBool initialized
-        size_t fenceCount
-        const WGPUSharedFence* fences
-        size_t signaledValueCount
-        const uint64_t* signaledValues
-
-    cdef struct WGPUSharedTextureMemoryProperties:
-        WGPUChainedStruct* nextInChain
-        WGPUTextureUsage usage
-        WGPUExtent3D size
-        WGPUTextureFormat format
+        size_t colorAttachmentCount
+        const WGPURenderPassColorAttachment* colorAttachments
+        const WGPURenderPassDepthStencilAttachment* depthStencilAttachment
+        WGPUQuerySet occlusionQuerySet
+        const WGPUPassTimestampWrites* timestampWrites
 
     cdef struct WGPUTextureViewDescriptor:
         WGPUChainedStruct* nextInChain
@@ -2268,15 +1372,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
         size_t targetCount
         const WGPUColorTargetState* targets
 
-    cdef struct WGPURenderPassDescriptor:
-        WGPUChainedStruct* nextInChain
-        WGPUStringView label
-        size_t colorAttachmentCount
-        const WGPURenderPassColorAttachment* colorAttachments
-        const WGPURenderPassDepthStencilAttachment* depthStencilAttachment
-        WGPUQuerySet occlusionQuerySet
-        const WGPUPassTimestampWrites* timestampWrites
-
     cdef struct WGPURenderPipelineDescriptor:
         WGPUChainedStruct* nextInChain
         WGPUStringView label
@@ -2294,111 +1389,44 @@ cdef extern from "webgpu/webgpu.h" nogil:
     const WGPUCompilationInfoCallbackInfo WGPU_COMPILATION_INFO_CALLBACK_INFO_INIT
     const WGPUCreateComputePipelineAsyncCallbackInfo WGPU_CREATE_COMPUTE_PIPELINE_ASYNC_CALLBACK_INFO_INIT
     const WGPUCreateRenderPipelineAsyncCallbackInfo WGPU_CREATE_RENDER_PIPELINE_ASYNC_CALLBACK_INFO_INIT
-    const WGPUDawnLoadCacheDataCallbackInfo WGPU_DAWN_LOAD_CACHE_DATA_CALLBACK_INFO_INIT
-    const WGPUDawnStoreCacheDataCallbackInfo WGPU_DAWN_STORE_CACHE_DATA_CALLBACK_INFO_INIT
     const WGPUDeviceLostCallbackInfo WGPU_DEVICE_LOST_CALLBACK_INFO_INIT
-    const WGPUDisposeCallbackInfo WGPU_DISPOSE_CALLBACK_INFO_INIT
-    const WGPULoggingCallbackInfo WGPU_LOGGING_CALLBACK_INFO_INIT
     const WGPUPopErrorScopeCallbackInfo WGPU_POP_ERROR_SCOPE_CALLBACK_INFO_INIT
     const WGPUQueueWorkDoneCallbackInfo WGPU_QUEUE_WORK_DONE_CALLBACK_INFO_INIT
     const WGPURequestAdapterCallbackInfo WGPU_REQUEST_ADAPTER_CALLBACK_INFO_INIT
     const WGPURequestDeviceCallbackInfo WGPU_REQUEST_DEVICE_CALLBACK_INFO_INIT
     const WGPUUncapturedErrorCallbackInfo WGPU_UNCAPTURED_ERROR_CALLBACK_INFO_INIT
-    const WGPUAdapterPropertiesD3D WGPU_ADAPTER_PROPERTIES_D3D_INIT
-    const WGPUAdapterPropertiesDrm WGPU_ADAPTER_PROPERTIES_DRM_INIT
-    const WGPUAdapterPropertiesVk WGPU_ADAPTER_PROPERTIES_VK_INIT
-    const WGPUAdapterPropertiesWGPU WGPU_ADAPTER_PROPERTIES_WGPU_INIT
-    const WGPUBindingResource WGPU_BINDING_RESOURCE_INIT
     const WGPUBlendComponent WGPU_BLEND_COMPONENT_INIT
     const WGPUBufferBindingLayout WGPU_BUFFER_BINDING_LAYOUT_INIT
-    const WGPUBufferHostMappedPointer WGPU_BUFFER_HOST_MAPPED_POINTER_INIT
+    const WGPUBufferDescriptor WGPU_BUFFER_DESCRIPTOR_INIT
     const WGPUColor WGPU_COLOR_INIT
-    const WGPUColorSpaceDawn WGPU_COLOR_SPACE_DAWN_INIT
-    const WGPUColorTargetStateExpandResolveTextureDawn WGPU_COLOR_TARGET_STATE_EXPAND_RESOLVE_TEXTURE_DAWN_INIT
     const WGPUCommandBufferDescriptor WGPU_COMMAND_BUFFER_DESCRIPTOR_INIT
+    const WGPUCommandEncoderDescriptor WGPU_COMMAND_ENCODER_DESCRIPTOR_INIT
     const WGPUCompatibilityModeLimits WGPU_COMPATIBILITY_MODE_LIMITS_INIT
     const WGPUConstantEntry WGPU_CONSTANT_ENTRY_INIT
-    const WGPUCopyTextureForBrowserOptions WGPU_COPY_TEXTURE_FOR_BROWSER_OPTIONS_INIT
-    const WGPUDawnAdapterPropertiesPowerPreference WGPU_DAWN_ADAPTER_PROPERTIES_POWER_PREFERENCE_INIT
-    const WGPUDawnBufferDescriptorErrorInfoFromWireClient WGPU_DAWN_BUFFER_DESCRIPTOR_ERROR_INFO_FROM_WIRE_CLIENT_INIT
-    const WGPUDawnCacheDeviceDescriptor WGPU_DAWN_CACHE_DEVICE_DESCRIPTOR_INIT
     const WGPUDawnCompilationMessageUtf16 WGPU_DAWN_COMPILATION_MESSAGE_UTF16_INIT
-    const WGPUDawnConsumeAdapterDescriptor WGPU_DAWN_CONSUME_ADAPTER_DESCRIPTOR_INIT
-    const WGPUDawnDeviceAllocatorControl WGPU_DAWN_DEVICE_ALLOCATOR_CONTROL_INIT
-    const WGPUDawnDrmFormatProperties WGPU_DAWN_DRM_FORMAT_PROPERTIES_INIT
-    const WGPUDawnEncoderInternalUsageDescriptor WGPU_DAWN_ENCODER_INTERNAL_USAGE_DESCRIPTOR_INIT
-    const WGPUDawnFakeBufferOOMForTesting WGPU_DAWN_FAKE_BUFFER_OOM_FOR_TESTING_INIT
-    const WGPUDawnFakeDeviceInitializeErrorForTesting WGPU_DAWN_FAKE_DEVICE_INITIALIZE_ERROR_FOR_TESTING_INIT
-    const WGPUDawnHostMappedPointerLimits WGPU_DAWN_HOST_MAPPED_POINTER_LIMITS_INIT
-    const WGPUDawnInjectedInvalidSType WGPU_DAWN_INJECTED_INVALID_S_TYPE_INIT
-    const WGPUDawnRenderPassSampleCount WGPU_DAWN_RENDER_PASS_SAMPLE_COUNT_INIT
-    const WGPUDawnShaderModuleSPIRVOptionsDescriptor WGPU_DAWN_SHADER_MODULE_SPIRV_OPTIONS_DESCRIPTOR_INIT
-    const WGPUDawnShaderSourceSPIRV WGPU_DAWN_SHADER_SOURCE_SPIRV_INIT
-    const WGPUDawnTexelCopyBufferRowAlignmentLimits WGPU_DAWN_TEXEL_COPY_BUFFER_ROW_ALIGNMENT_LIMITS_INIT
-    const WGPUDawnTextureInternalUsageDescriptor WGPU_DAWN_TEXTURE_INTERNAL_USAGE_DESCRIPTOR_INIT
-    const WGPUDawnTogglesDescriptor WGPU_DAWN_TOGGLES_DESCRIPTOR_INIT
-    const WGPUDawnWGSLBlocklist WGPU_DAWN_WGSL_BLOCKLIST_INIT
-    const WGPUDawnWireWGSLControl WGPU_DAWN_WIRE_WGSL_CONTROL_INIT
     const WGPUEmscriptenSurfaceSourceCanvasHTMLSelector WGPU_EMSCRIPTEN_SURFACE_SOURCE_CANVAS_HTML_SELECTOR_INIT
-    const WGPUExtent2D WGPU_EXTENT_2D_INIT
     const WGPUExtent3D WGPU_EXTENT_3D_INIT
     const WGPUExternalTextureBindingEntry WGPU_EXTERNAL_TEXTURE_BINDING_ENTRY_INIT
     const WGPUExternalTextureBindingLayout WGPU_EXTERNAL_TEXTURE_BINDING_LAYOUT_INIT
     const WGPUFuture WGPU_FUTURE_INIT
     const WGPUInstanceLimits WGPU_INSTANCE_LIMITS_INIT
     const WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER WGPU_INTERNAL_HAVE_EMDAWNWEBGPU_HEADER_INIT
-    const WGPUMemoryHeapInfo WGPU_MEMORY_HEAP_INFO_INIT
     const WGPUMultisampleState WGPU_MULTISAMPLE_STATE_INIT
-    const WGPUOrigin2D WGPU_ORIGIN_2D_INIT
     const WGPUOrigin3D WGPU_ORIGIN_3D_INIT
     const WGPUPassTimestampWrites WGPU_PASS_TIMESTAMP_WRITES_INIT
-    const WGPUPipelineLayoutResourceTable WGPU_PIPELINE_LAYOUT_RESOURCE_TABLE_INIT
-    const WGPUPipelineLayoutStorageAttachment WGPU_PIPELINE_LAYOUT_STORAGE_ATTACHMENT_INIT
+    const WGPUPipelineLayoutDescriptor WGPU_PIPELINE_LAYOUT_DESCRIPTOR_INIT
     const WGPUPrimitiveState WGPU_PRIMITIVE_STATE_INIT
     const WGPUQuerySetDescriptor WGPU_QUERY_SET_DESCRIPTOR_INIT
     const WGPUQueueDescriptor WGPU_QUEUE_DESCRIPTOR_INIT
     const WGPURenderBundleDescriptor WGPU_RENDER_BUNDLE_DESCRIPTOR_INIT
-    const WGPURenderBundleEncoderResourceTable WGPU_RENDER_BUNDLE_ENCODER_RESOURCE_TABLE_INIT
+    const WGPURenderBundleEncoderDescriptor WGPU_RENDER_BUNDLE_ENCODER_DESCRIPTOR_INIT
     const WGPURenderPassDepthStencilAttachment WGPU_RENDER_PASS_DEPTH_STENCIL_ATTACHMENT_INIT
-    const WGPURenderPassDescriptorResolveRect WGPU_RENDER_PASS_DESCRIPTOR_RESOLVE_RECT_INIT
     const WGPURenderPassMaxDrawCount WGPU_RENDER_PASS_MAX_DRAW_COUNT_INIT
-    const WGPURequestAdapterWebGPUBackendOptions WGPU_REQUEST_ADAPTER_WEBGPU_BACKEND_OPTIONS_INIT
     const WGPURequestAdapterWebXROptions WGPU_REQUEST_ADAPTER_WEBXR_OPTIONS_INIT
-    const WGPUResourceTableDescriptor WGPU_RESOURCE_TABLE_DESCRIPTOR_INIT
     const WGPUSamplerBindingLayout WGPU_SAMPLER_BINDING_LAYOUT_INIT
-    const WGPUShaderModuleCompilationOptions WGPU_SHADER_MODULE_COMPILATION_OPTIONS_INIT
+    const WGPUSamplerDescriptor WGPU_SAMPLER_DESCRIPTOR_INIT
     const WGPUShaderSourceSPIRV WGPU_SHADER_SOURCE_SPIRV_INIT
     const WGPUShaderSourceWGSL WGPU_SHADER_SOURCE_WGSL_INIT
-    const WGPUSharedBufferMemoryBeginAccessDescriptor WGPU_SHARED_BUFFER_MEMORY_BEGIN_ACCESS_DESCRIPTOR_INIT
-    const WGPUSharedBufferMemoryEndAccessState WGPU_SHARED_BUFFER_MEMORY_END_ACCESS_STATE_INIT
-    const WGPUSharedBufferMemoryFromWindowsHandleDescriptor WGPU_SHARED_BUFFER_MEMORY_FROM_WINDOWS_HANDLE_DESCRIPTOR_INIT
-    const WGPUSharedBufferMemoryHostPointerDescriptor WGPU_SHARED_BUFFER_MEMORY_HOST_POINTER_DESCRIPTOR_INIT
-    const WGPUSharedBufferMemoryProperties WGPU_SHARED_BUFFER_MEMORY_PROPERTIES_INIT
-    const WGPUSharedFenceDXGISharedHandleDescriptor WGPU_SHARED_FENCE_DXGI_SHARED_HANDLE_DESCRIPTOR_INIT
-    const WGPUSharedFenceDXGISharedHandleExportInfo WGPU_SHARED_FENCE_DXGI_SHARED_HANDLE_EXPORT_INFO_INIT
-    const WGPUSharedFenceEGLSyncDescriptor WGPU_SHARED_FENCE_EGL_SYNC_DESCRIPTOR_INIT
-    const WGPUSharedFenceEGLSyncExportInfo WGPU_SHARED_FENCE_EGL_SYNC_EXPORT_INFO_INIT
-    const WGPUSharedFenceMTLSharedEventDescriptor WGPU_SHARED_FENCE_MTL_SHARED_EVENT_DESCRIPTOR_INIT
-    const WGPUSharedFenceMTLSharedEventExportInfo WGPU_SHARED_FENCE_MTL_SHARED_EVENT_EXPORT_INFO_INIT
-    const WGPUSharedFenceSyncFDDescriptor WGPU_SHARED_FENCE_SYNC_FD_DESCRIPTOR_INIT
-    const WGPUSharedFenceSyncFDExportInfo WGPU_SHARED_FENCE_SYNC_FD_EXPORT_INFO_INIT
-    const WGPUSharedFenceVkSemaphoreOpaqueFDDescriptor WGPU_SHARED_FENCE_VK_SEMAPHORE_OPAQUE_FD_DESCRIPTOR_INIT
-    const WGPUSharedFenceVkSemaphoreOpaqueFDExportInfo WGPU_SHARED_FENCE_VK_SEMAPHORE_OPAQUE_FD_EXPORT_INFO_INIT
-    const WGPUSharedFenceVkSemaphoreZirconHandleDescriptor WGPU_SHARED_FENCE_VK_SEMAPHORE_ZIRCON_HANDLE_DESCRIPTOR_INIT
-    const WGPUSharedFenceVkSemaphoreZirconHandleExportInfo WGPU_SHARED_FENCE_VK_SEMAPHORE_ZIRCON_HANDLE_EXPORT_INFO_INIT
-    const WGPUSharedTextureMemoryAHardwareBufferDescriptor WGPU_SHARED_TEXTURE_MEMORY_A_HARDWARE_BUFFER_DESCRIPTOR_INIT
-    const WGPUSharedTextureMemoryD3D11BeginState WGPU_SHARED_TEXTURE_MEMORY_D3D11_BEGIN_STATE_INIT
-    const WGPUSharedTextureMemoryD3DSwapchainBeginState WGPU_SHARED_TEXTURE_MEMORY_D3D_SWAPCHAIN_BEGIN_STATE_INIT
-    const WGPUSharedTextureMemoryDmaBufPlane WGPU_SHARED_TEXTURE_MEMORY_DMA_BUF_PLANE_INIT
-    const WGPUSharedTextureMemoryDXGISharedHandleDescriptor WGPU_SHARED_TEXTURE_MEMORY_DXGI_SHARED_HANDLE_DESCRIPTOR_INIT
-    const WGPUSharedTextureMemoryEGLImageDescriptor WGPU_SHARED_TEXTURE_MEMORY_EGL_IMAGE_DESCRIPTOR_INIT
-    const WGPUSharedTextureMemoryIOSurfaceDescriptor WGPU_SHARED_TEXTURE_MEMORY_IO_SURFACE_DESCRIPTOR_INIT
-    const WGPUSharedTextureMemoryOpaqueFDDescriptor WGPU_SHARED_TEXTURE_MEMORY_OPAQUE_FD_DESCRIPTOR_INIT
-    const WGPUSharedTextureMemoryVkDedicatedAllocationDescriptor WGPU_SHARED_TEXTURE_MEMORY_VK_DEDICATED_ALLOCATION_DESCRIPTOR_INIT
-    const WGPUSharedTextureMemoryVkImageLayoutBeginState WGPU_SHARED_TEXTURE_MEMORY_VK_IMAGE_LAYOUT_BEGIN_STATE_INIT
-    const WGPUSharedTextureMemoryVkImageLayoutEndState WGPU_SHARED_TEXTURE_MEMORY_VK_IMAGE_LAYOUT_END_STATE_INIT
-    const WGPUSharedTextureMemoryZirconHandleDescriptor WGPU_SHARED_TEXTURE_MEMORY_ZIRCON_HANDLE_DESCRIPTOR_INIT
-    const WGPUStaticSamplerBindingLayout WGPU_STATIC_SAMPLER_BINDING_LAYOUT_INIT
     const WGPUStencilFaceState WGPU_STENCIL_FACE_STATE_INIT
     const WGPUStorageTextureBindingLayout WGPU_STORAGE_TEXTURE_BINDING_LAYOUT_INIT
     const WGPUSubgroupMatrixConfig WGPU_SUBGROUP_MATRIX_CONFIG_INIT
@@ -2408,58 +1436,26 @@ cdef extern from "webgpu/webgpu.h" nogil:
     const WGPUSurfaceCapabilities WGPU_SURFACE_CAPABILITIES_INIT
     const WGPUSurfaceColorManagement WGPU_SURFACE_COLOR_MANAGEMENT_INIT
     const WGPUSurfaceConfiguration WGPU_SURFACE_CONFIGURATION_INIT
-    const WGPUSurfaceDescriptorFromWindowsCoreWindow WGPU_SURFACE_DESCRIPTOR_FROM_WINDOWS_CORE_WINDOW_INIT
-    const WGPUSurfaceDescriptorFromWindowsUWPSwapChainPanel WGPU_SURFACE_DESCRIPTOR_FROM_WINDOWS_UWP_SWAP_CHAIN_PANEL_INIT
-    const WGPUSurfaceDescriptorFromWindowsWinUISwapChainPanel WGPU_SURFACE_DESCRIPTOR_FROM_WINDOWS_WINUI_SWAP_CHAIN_PANEL_INIT
-    const WGPUSurfaceSourceAndroidNativeWindow WGPU_SURFACE_SOURCE_ANDROID_NATIVE_WINDOW_INIT
-    const WGPUSurfaceSourceMetalLayer WGPU_SURFACE_SOURCE_METAL_LAYER_INIT
-    const WGPUSurfaceSourceWaylandSurface WGPU_SURFACE_SOURCE_WAYLAND_SURFACE_INIT
-    const WGPUSurfaceSourceWindowsHWND WGPU_SURFACE_SOURCE_WINDOWS_HWND_INIT
-    const WGPUSurfaceSourceXCBWindow WGPU_SURFACE_SOURCE_XCB_WINDOW_INIT
-    const WGPUSurfaceSourceXlibWindow WGPU_SURFACE_SOURCE_XLIB_WINDOW_INIT
     const WGPUSurfaceTexture WGPU_SURFACE_TEXTURE_INIT
-    const WGPUTexelBufferBindingEntry WGPU_TEXEL_BUFFER_BINDING_ENTRY_INIT
-    const WGPUTexelBufferBindingLayout WGPU_TEXEL_BUFFER_BINDING_LAYOUT_INIT
-    const WGPUTexelBufferViewDescriptor WGPU_TEXEL_BUFFER_VIEW_DESCRIPTOR_INIT
     const WGPUTexelCopyBufferLayout WGPU_TEXEL_COPY_BUFFER_LAYOUT_INIT
     const WGPUTextureBindingLayout WGPU_TEXTURE_BINDING_LAYOUT_INIT
     const WGPUTextureBindingViewDimension WGPU_TEXTURE_BINDING_VIEW_DIMENSION_INIT
     const WGPUTextureComponentSwizzle WGPU_TEXTURE_COMPONENT_SWIZZLE_INIT
     const WGPUVertexAttribute WGPU_VERTEX_ATTRIBUTE_INIT
-    const WGPUYCbCrVkDescriptor WGPU_Y_CB_CR_VK_DESCRIPTOR_INIT
-    const WGPUAdapterPropertiesMemoryHeaps WGPU_ADAPTER_PROPERTIES_MEMORY_HEAPS_INIT
     const WGPUAdapterPropertiesSubgroupMatrixConfigs WGPU_ADAPTER_PROPERTIES_SUBGROUP_MATRIX_CONFIGS_INIT
-    const WGPUAHardwareBufferProperties WGPU_A_HARDWARE_BUFFER_PROPERTIES_INIT
     const WGPUBindGroupEntry WGPU_BIND_GROUP_ENTRY_INIT
     const WGPUBindGroupLayoutEntry WGPU_BIND_GROUP_LAYOUT_ENTRY_INIT
     const WGPUBlendState WGPU_BLEND_STATE_INIT
-    const WGPUBufferDescriptor WGPU_BUFFER_DESCRIPTOR_INIT
-    const WGPUCommandEncoderDescriptor WGPU_COMMAND_ENCODER_DESCRIPTOR_INIT
     const WGPUCompilationMessage WGPU_COMPILATION_MESSAGE_INIT
     const WGPUComputePassDescriptor WGPU_COMPUTE_PASS_DESCRIPTOR_INIT
     const WGPUComputeState WGPU_COMPUTE_STATE_INIT
-    const WGPUDawnDrmFormatCapabilities WGPU_DAWN_DRM_FORMAT_CAPABILITIES_INIT
     const WGPUDepthStencilState WGPU_DEPTH_STENCIL_STATE_INIT
-    const WGPUExternalTextureDescriptor WGPU_EXTERNAL_TEXTURE_DESCRIPTOR_INIT
     const WGPUFutureWaitInfo WGPU_FUTURE_WAIT_INFO_INIT
-    const WGPUImageCopyExternalTexture WGPU_IMAGE_COPY_EXTERNAL_TEXTURE_INIT
     const WGPUInstanceDescriptor WGPU_INSTANCE_DESCRIPTOR_INIT
     const WGPULimits WGPU_LIMITS_INIT
-    const WGPUPipelineLayoutPixelLocalStorage WGPU_PIPELINE_LAYOUT_PIXEL_LOCAL_STORAGE_INIT
-    const WGPURenderBundleEncoderDescriptor WGPU_RENDER_BUNDLE_ENCODER_DESCRIPTOR_INIT
     const WGPURenderPassColorAttachment WGPU_RENDER_PASS_COLOR_ATTACHMENT_INIT
-    const WGPURenderPassRenderAreaRect WGPU_RENDER_PASS_RENDER_AREA_RECT_INIT
-    const WGPURenderPassStorageAttachment WGPU_RENDER_PASS_STORAGE_ATTACHMENT_INIT
     const WGPURequestAdapterOptions WGPU_REQUEST_ADAPTER_OPTIONS_INIT
-    const WGPUSamplerDescriptor WGPU_SAMPLER_DESCRIPTOR_INIT
     const WGPUShaderModuleDescriptor WGPU_SHADER_MODULE_DESCRIPTOR_INIT
-    const WGPUSharedBufferMemoryDescriptor WGPU_SHARED_BUFFER_MEMORY_DESCRIPTOR_INIT
-    const WGPUSharedFenceDescriptor WGPU_SHARED_FENCE_DESCRIPTOR_INIT
-    const WGPUSharedFenceExportInfo WGPU_SHARED_FENCE_EXPORT_INFO_INIT
-    const WGPUSharedTextureMemoryAHardwareBufferProperties WGPU_SHARED_TEXTURE_MEMORY_A_HARDWARE_BUFFER_PROPERTIES_INIT
-    const WGPUSharedTextureMemoryBeginAccessDescriptor WGPU_SHARED_TEXTURE_MEMORY_BEGIN_ACCESS_DESCRIPTOR_INIT
-    const WGPUSharedTextureMemoryDmaBufDescriptor WGPU_SHARED_TEXTURE_MEMORY_DMA_BUF_DESCRIPTOR_INIT
-    const WGPUSharedTextureMemoryMetalEndAccessState WGPU_SHARED_TEXTURE_MEMORY_METAL_END_ACCESS_STATE_INIT
     const WGPUSurfaceDescriptor WGPU_SURFACE_DESCRIPTOR_INIT
     const WGPUTexelCopyBufferInfo WGPU_TEXEL_COPY_BUFFER_INFO_INIT
     const WGPUTexelCopyTextureInfo WGPU_TEXEL_COPY_TEXTURE_INFO_INIT
@@ -2472,17 +1468,11 @@ cdef extern from "webgpu/webgpu.h" nogil:
     const WGPUColorTargetState WGPU_COLOR_TARGET_STATE_INIT
     const WGPUCompilationInfo WGPU_COMPILATION_INFO_INIT
     const WGPUComputePipelineDescriptor WGPU_COMPUTE_PIPELINE_DESCRIPTOR_INIT
-    const WGPUDawnFormatCapabilities WGPU_DAWN_FORMAT_CAPABILITIES_INIT
     const WGPUDeviceDescriptor WGPU_DEVICE_DESCRIPTOR_INIT
-    const WGPUPipelineLayoutDescriptor WGPU_PIPELINE_LAYOUT_DESCRIPTOR_INIT
-    const WGPURenderPassPixelLocalStorage WGPU_RENDER_PASS_PIXEL_LOCAL_STORAGE_INIT
-    const WGPUSharedTextureMemoryDescriptor WGPU_SHARED_TEXTURE_MEMORY_DESCRIPTOR_INIT
-    const WGPUSharedTextureMemoryEndAccessState WGPU_SHARED_TEXTURE_MEMORY_END_ACCESS_STATE_INIT
-    const WGPUSharedTextureMemoryProperties WGPU_SHARED_TEXTURE_MEMORY_PROPERTIES_INIT
+    const WGPURenderPassDescriptor WGPU_RENDER_PASS_DESCRIPTOR_INIT
     const WGPUTextureViewDescriptor WGPU_TEXTURE_VIEW_DESCRIPTOR_INIT
     const WGPUVertexState WGPU_VERTEX_STATE_INIT
     const WGPUFragmentState WGPU_FRAGMENT_STATE_INIT
-    const WGPURenderPassDescriptor WGPU_RENDER_PASS_DESCRIPTOR_INIT
     const WGPURenderPipelineDescriptor WGPU_RENDER_PIPELINE_DESCRIPTOR_INIT
 
     # %% Functions
@@ -2492,18 +1482,14 @@ cdef extern from "webgpu/webgpu.h" nogil:
     WGPUStatus wgpuGetInstanceLimits(WGPUInstanceLimits* limits)
     WGPUBool wgpuHasInstanceFeature(WGPUInstanceFeatureName feature)
     WGPUProc wgpuGetProcAddress(WGPUStringView procName)
-    WGPUDevice wgpuAdapterCreateDevice(WGPUAdapter adapter, const WGPUDeviceDescriptor* descriptor)
     void wgpuAdapterGetFeatures(WGPUAdapter adapter, WGPUSupportedFeatures* features)
-    WGPUStatus wgpuAdapterGetFormatCapabilities(WGPUAdapter adapter, WGPUTextureFormat format, WGPUDawnFormatCapabilities* capabilities)
     WGPUStatus wgpuAdapterGetInfo(WGPUAdapter adapter, WGPUAdapterInfo* info)
-    WGPUInstance wgpuAdapterGetInstance(WGPUAdapter adapter)
     WGPUStatus wgpuAdapterGetLimits(WGPUAdapter adapter, WGPULimits* limits)
     WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature)
     WGPUFuture wgpuAdapterRequestDevice(WGPUAdapter adapter, const WGPUDeviceDescriptor* descriptor, WGPURequestDeviceCallbackInfo callbackInfo)
     void wgpuAdapterAddRef(WGPUAdapter adapter)
     void wgpuAdapterRelease(WGPUAdapter adapter)
     void wgpuAdapterInfoFreeMembers(WGPUAdapterInfo adapterInfo)
-    void wgpuAdapterPropertiesMemoryHeapsFreeMembers(WGPUAdapterPropertiesMemoryHeaps adapterPropertiesMemoryHeaps)
     void wgpuAdapterPropertiesSubgroupMatrixConfigsFreeMembers(WGPUAdapterPropertiesSubgroupMatrixConfigs adapterPropertiesSubgroupMatrixConfigs)
     void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, WGPUStringView label)
     void wgpuBindGroupAddRef(WGPUBindGroup bindGroup)
@@ -2511,7 +1497,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, WGPUStringView label)
     void wgpuBindGroupLayoutAddRef(WGPUBindGroupLayout bindGroupLayout)
     void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout)
-    WGPUTexelBufferView wgpuBufferCreateTexelView(WGPUBuffer buffer, const WGPUTexelBufferViewDescriptor* descriptor)
     void wgpuBufferDestroy(WGPUBuffer buffer)
     const void* wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size)
     void* wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size)
@@ -2536,13 +1521,11 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, const WGPUTexelCopyTextureInfo* source, const WGPUTexelCopyBufferInfo* destination, const WGPUExtent3D* copySize)
     void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, const WGPUTexelCopyTextureInfo* source, const WGPUTexelCopyTextureInfo* destination, const WGPUExtent3D* copySize)
     WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, const WGPUCommandBufferDescriptor* descriptor)
-    void wgpuCommandEncoderInjectValidationError(WGPUCommandEncoder commandEncoder, WGPUStringView message)
     void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, WGPUStringView markerLabel)
     void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder)
     void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, WGPUStringView groupLabel)
     void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset)
     void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, WGPUStringView label)
-    void wgpuCommandEncoderWriteBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t bufferOffset, const void* data, size_t size)
     void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex)
     void wgpuCommandEncoderAddRef(WGPUCommandEncoder commandEncoder)
     void wgpuCommandEncoderRelease(WGPUCommandEncoder commandEncoder)
@@ -2556,7 +1539,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuComputePassEncoderSetImmediates(WGPUComputePassEncoder computePassEncoder, uint32_t offset, const void* data, size_t size)
     void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, WGPUStringView label)
     void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline)
-    void wgpuComputePassEncoderSetResourceTable(WGPUComputePassEncoder computePassEncoder, WGPUResourceTable table)
     void wgpuComputePassEncoderWriteTimestamp(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex)
     void wgpuComputePassEncoderAddRef(WGPUComputePassEncoder computePassEncoder)
     void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder)
@@ -2564,54 +1546,32 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, WGPUStringView label)
     void wgpuComputePipelineAddRef(WGPUComputePipeline computePipeline)
     void wgpuComputePipelineRelease(WGPUComputePipeline computePipeline)
-    void wgpuDawnDrmFormatCapabilitiesFreeMembers(WGPUDawnDrmFormatCapabilities dawnDrmFormatCapabilities)
     WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, const WGPUBindGroupDescriptor* descriptor)
     WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, const WGPUBindGroupLayoutDescriptor* descriptor)
     WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, const WGPUBufferDescriptor* descriptor)
     WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, const WGPUCommandEncoderDescriptor* descriptor)
     WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, const WGPUComputePipelineDescriptor* descriptor)
     WGPUFuture wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, const WGPUComputePipelineDescriptor* descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo)
-    WGPUBuffer wgpuDeviceCreateErrorBuffer(WGPUDevice device, const WGPUBufferDescriptor* descriptor)
-    WGPUComputePipeline wgpuDeviceCreateErrorComputePipeline(WGPUDevice device, WGPUStringView label)
-    WGPUExternalTexture wgpuDeviceCreateErrorExternalTexture(WGPUDevice device)
-    WGPURenderPipeline wgpuDeviceCreateErrorRenderPipeline(WGPUDevice device, WGPUStringView label)
-    WGPUShaderModule wgpuDeviceCreateErrorShaderModule(WGPUDevice device, const WGPUShaderModuleDescriptor* descriptor, WGPUStringView errorMessage)
-    WGPUTexture wgpuDeviceCreateErrorTexture(WGPUDevice device, const WGPUTextureDescriptor* descriptor)
-    WGPUExternalTexture wgpuDeviceCreateExternalTexture(WGPUDevice device, const WGPUExternalTextureDescriptor* externalTextureDescriptor)
     WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, const WGPUPipelineLayoutDescriptor* descriptor)
     WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, const WGPUQuerySetDescriptor* descriptor)
     WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, const WGPURenderBundleEncoderDescriptor* descriptor)
     WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, const WGPURenderPipelineDescriptor* descriptor)
     WGPUFuture wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, const WGPURenderPipelineDescriptor* descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo)
-    WGPUResourceTable wgpuDeviceCreateResourceTable(WGPUDevice device, const WGPUResourceTableDescriptor* descriptor)
     WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, const WGPUSamplerDescriptor* descriptor)
     WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, const WGPUShaderModuleDescriptor* descriptor)
     WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, const WGPUTextureDescriptor* descriptor)
     void wgpuDeviceDestroy(WGPUDevice device)
-    void wgpuDeviceForceLoss(WGPUDevice device, WGPUDeviceLostReason type, WGPUStringView message)
-    WGPUAdapter wgpuDeviceGetAdapter(WGPUDevice device)
     WGPUStatus wgpuDeviceGetAdapterInfo(WGPUDevice device, WGPUAdapterInfo* adapterInfo)
-    WGPUStatus wgpuDeviceGetAHardwareBufferProperties(WGPUDevice device, void* handle, WGPUAHardwareBufferProperties* properties)
     void wgpuDeviceGetFeatures(WGPUDevice device, WGPUSupportedFeatures* features)
     WGPUStatus wgpuDeviceGetLimits(WGPUDevice device, WGPULimits* limits)
     WGPUFuture wgpuDeviceGetLostFuture(WGPUDevice device)
     WGPUQueue wgpuDeviceGetQueue(WGPUDevice device)
     WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature)
-    WGPUSharedBufferMemory wgpuDeviceImportSharedBufferMemory(WGPUDevice device, const WGPUSharedBufferMemoryDescriptor* descriptor)
-    WGPUSharedFence wgpuDeviceImportSharedFence(WGPUDevice device, const WGPUSharedFenceDescriptor* descriptor)
-    WGPUSharedTextureMemory wgpuDeviceImportSharedTextureMemory(WGPUDevice device, const WGPUSharedTextureMemoryDescriptor* descriptor)
-    void wgpuDeviceInjectError(WGPUDevice device, WGPUErrorType type, WGPUStringView message)
     WGPUFuture wgpuDevicePopErrorScope(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo)
     void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter)
     void wgpuDeviceSetLabel(WGPUDevice device, WGPUStringView label)
-    void wgpuDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallbackInfo callbackInfo)
-    void wgpuDeviceTick(WGPUDevice device)
-    void wgpuDeviceValidateTextureDescriptor(WGPUDevice device, const WGPUTextureDescriptor* descriptor)
     void wgpuDeviceAddRef(WGPUDevice device)
     void wgpuDeviceRelease(WGPUDevice device)
-    void wgpuExternalTextureDestroy(WGPUExternalTexture externalTexture)
-    void wgpuExternalTextureExpire(WGPUExternalTexture externalTexture)
-    void wgpuExternalTextureRefresh(WGPUExternalTexture externalTexture)
     void wgpuExternalTextureSetLabel(WGPUExternalTexture externalTexture, WGPUStringView label)
     void wgpuExternalTextureAddRef(WGPUExternalTexture externalTexture)
     void wgpuExternalTextureRelease(WGPUExternalTexture externalTexture)
@@ -2632,8 +1592,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuQuerySetSetLabel(WGPUQuerySet querySet, WGPUStringView label)
     void wgpuQuerySetAddRef(WGPUQuerySet querySet)
     void wgpuQuerySetRelease(WGPUQuerySet querySet)
-    void wgpuQueueCopyExternalTextureForBrowser(WGPUQueue queue, const WGPUImageCopyExternalTexture* source, const WGPUTexelCopyTextureInfo* destination, const WGPUExtent3D* copySize, const WGPUCopyTextureForBrowserOptions* options)
-    void wgpuQueueCopyTextureForBrowser(WGPUQueue queue, const WGPUTexelCopyTextureInfo* source, const WGPUTexelCopyTextureInfo* destination, const WGPUExtent3D* copySize, const WGPUCopyTextureForBrowserOptions* options)
     WGPUFuture wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo)
     void wgpuQueueSetLabel(WGPUQueue queue, WGPUStringView label)
     void wgpuQueueSubmit(WGPUQueue queue, size_t commandCount, const WGPUCommandBuffer* commands)
@@ -2671,7 +1629,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, WGPUStringView markerLabel)
     void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset)
     void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset)
-    void wgpuRenderPassEncoderPixelLocalStorageBarrier(WGPURenderPassEncoder renderPassEncoder)
     void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder)
     void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, WGPUStringView groupLabel)
     void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPUBindGroup group, size_t dynamicOffsetCount, const uint32_t* dynamicOffsets)
@@ -2680,7 +1637,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size)
     void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, WGPUStringView label)
     void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline)
-    void wgpuRenderPassEncoderSetResourceTable(WGPURenderPassEncoder renderPassEncoder, WGPUResourceTable table)
     void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
     void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference)
     void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size)
@@ -2692,14 +1648,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, WGPUStringView label)
     void wgpuRenderPipelineAddRef(WGPURenderPipeline renderPipeline)
     void wgpuRenderPipelineRelease(WGPURenderPipeline renderPipeline)
-    void wgpuResourceTableDestroy(WGPUResourceTable resourceTable)
-    uint32_t wgpuResourceTableGetSize(WGPUResourceTable resourceTable)
-    uint32_t wgpuResourceTableInsert(WGPUResourceTable resourceTable, const WGPUBindingResource* resource)
-    WGPUStatus wgpuResourceTableRemove(WGPUResourceTable resourceTable, uint32_t slot)
-    void wgpuResourceTableSetLabel(WGPUResourceTable resourceTable, WGPUStringView label)
-    WGPUStatus wgpuResourceTableUpdate(WGPUResourceTable resourceTable, uint32_t slot, const WGPUBindingResource* resource)
-    void wgpuResourceTableAddRef(WGPUResourceTable resourceTable)
-    void wgpuResourceTableRelease(WGPUResourceTable resourceTable)
     void wgpuSamplerSetLabel(WGPUSampler sampler, WGPUStringView label)
     void wgpuSamplerAddRef(WGPUSampler sampler)
     void wgpuSamplerRelease(WGPUSampler sampler)
@@ -2707,28 +1655,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, WGPUStringView label)
     void wgpuShaderModuleAddRef(WGPUShaderModule shaderModule)
     void wgpuShaderModuleRelease(WGPUShaderModule shaderModule)
-    WGPUStatus wgpuSharedBufferMemoryBeginAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, const WGPUSharedBufferMemoryBeginAccessDescriptor* descriptor)
-    WGPUBuffer wgpuSharedBufferMemoryCreateBuffer(WGPUSharedBufferMemory sharedBufferMemory, const WGPUBufferDescriptor* descriptor)
-    WGPUStatus wgpuSharedBufferMemoryEndAccess(WGPUSharedBufferMemory sharedBufferMemory, WGPUBuffer buffer, WGPUSharedBufferMemoryEndAccessState* descriptor)
-    WGPUStatus wgpuSharedBufferMemoryGetProperties(WGPUSharedBufferMemory sharedBufferMemory, WGPUSharedBufferMemoryProperties* properties)
-    WGPUBool wgpuSharedBufferMemoryIsDeviceLost(WGPUSharedBufferMemory sharedBufferMemory)
-    void wgpuSharedBufferMemorySetLabel(WGPUSharedBufferMemory sharedBufferMemory, WGPUStringView label)
-    void wgpuSharedBufferMemoryAddRef(WGPUSharedBufferMemory sharedBufferMemory)
-    void wgpuSharedBufferMemoryRelease(WGPUSharedBufferMemory sharedBufferMemory)
-    void wgpuSharedBufferMemoryEndAccessStateFreeMembers(WGPUSharedBufferMemoryEndAccessState sharedBufferMemoryEndAccessState)
-    void wgpuSharedFenceExportInfo(WGPUSharedFence sharedFence, WGPUSharedFenceExportInfo* info)
-    void wgpuSharedFenceSetLabel(WGPUSharedFence sharedFence, WGPUStringView label)
-    void wgpuSharedFenceAddRef(WGPUSharedFence sharedFence)
-    void wgpuSharedFenceRelease(WGPUSharedFence sharedFence)
-    WGPUStatus wgpuSharedTextureMemoryBeginAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, const WGPUSharedTextureMemoryBeginAccessDescriptor* descriptor)
-    WGPUTexture wgpuSharedTextureMemoryCreateTexture(WGPUSharedTextureMemory sharedTextureMemory, const WGPUTextureDescriptor* descriptor)
-    WGPUStatus wgpuSharedTextureMemoryEndAccess(WGPUSharedTextureMemory sharedTextureMemory, WGPUTexture texture, WGPUSharedTextureMemoryEndAccessState* descriptor)
-    WGPUStatus wgpuSharedTextureMemoryGetProperties(WGPUSharedTextureMemory sharedTextureMemory, WGPUSharedTextureMemoryProperties* properties)
-    WGPUBool wgpuSharedTextureMemoryIsDeviceLost(WGPUSharedTextureMemory sharedTextureMemory)
-    void wgpuSharedTextureMemorySetLabel(WGPUSharedTextureMemory sharedTextureMemory, WGPUStringView label)
-    void wgpuSharedTextureMemoryAddRef(WGPUSharedTextureMemory sharedTextureMemory)
-    void wgpuSharedTextureMemoryRelease(WGPUSharedTextureMemory sharedTextureMemory)
-    void wgpuSharedTextureMemoryEndAccessStateFreeMembers(WGPUSharedTextureMemoryEndAccessState sharedTextureMemoryEndAccessState)
     void wgpuSupportedFeaturesFreeMembers(WGPUSupportedFeatures supportedFeatures)
     void wgpuSupportedInstanceFeaturesFreeMembers(WGPUSupportedInstanceFeatures supportedInstanceFeatures)
     void wgpuSupportedWGSLLanguageFeaturesFreeMembers(WGPUSupportedWGSLLanguageFeatures supportedWGSLLanguageFeatures)
@@ -2741,10 +1667,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuSurfaceAddRef(WGPUSurface surface)
     void wgpuSurfaceRelease(WGPUSurface surface)
     void wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities surfaceCapabilities)
-    void wgpuTexelBufferViewSetLabel(WGPUTexelBufferView texelBufferView, WGPUStringView label)
-    void wgpuTexelBufferViewAddRef(WGPUTexelBufferView texelBufferView)
-    void wgpuTexelBufferViewRelease(WGPUTexelBufferView texelBufferView)
-    WGPUTextureView wgpuTextureCreateErrorView(WGPUTexture texture, const WGPUTextureViewDescriptor* descriptor)
     WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, const WGPUTextureViewDescriptor* descriptor)
     void wgpuTextureDestroy(WGPUTexture texture)
     uint32_t wgpuTextureGetDepthOrArrayLayers(WGPUTexture texture)
@@ -2757,7 +1679,6 @@ cdef extern from "webgpu/webgpu.h" nogil:
     WGPUTextureUsage wgpuTextureGetUsage(WGPUTexture texture)
     uint32_t wgpuTextureGetWidth(WGPUTexture texture)
     void wgpuTextureSetLabel(WGPUTexture texture, WGPUStringView label)
-    void wgpuTextureSetOwnershipForMemoryDump(WGPUTexture texture, uint64_t ownerGuid)
     void wgpuTextureAddRef(WGPUTexture texture)
     void wgpuTextureRelease(WGPUTexture texture)
     void wgpuTextureViewSetLabel(WGPUTextureView textureView, WGPUStringView label)
@@ -2765,6 +1686,84 @@ cdef extern from "webgpu/webgpu.h" nogil:
     void wgpuTextureViewRelease(WGPUTextureView textureView)
 
 
+# %% Native-only declarations
+#
+# Parts of Dawn's native webgpu.h that Emdawnwebgpu does not have (see NATIVE_ONLY
+# in codegen/dawn_patcher.py). Natively, dawn_native_only.h simply includes
+# webgpu.h; with Emscripten it defines inert stand-ins. Do not use these in the
+# browser (i.e. when sys.platform == "emscripten").
+
+
+cdef extern from "dawn_native_only.h" nogil:
+
+    # %% Enums
+
+    ctypedef enum WGPULoggingType:
+        WGPULoggingType_Verbose
+        WGPULoggingType_Info
+        WGPULoggingType_Warning
+        WGPULoggingType_Error
+
+    # %% Struct forward declarations
+
+    cdef struct WGPULoggingCallbackInfo
+    cdef struct WGPUSurfaceSourceMetalLayer
+    cdef struct WGPUSurfaceSourceWaylandSurface
+    cdef struct WGPUSurfaceSourceWindowsHWND
+    cdef struct WGPUSurfaceSourceXCBWindow
+    cdef struct WGPUSurfaceSourceXlibWindow
+
+    # %% Callbacks
+
+    ctypedef void (*WGPULoggingCallback)(WGPULoggingType type, WGPUStringView message, void* userdata1, void* userdata2) noexcept
+
+    # %% Structs
+
+    cdef struct WGPULoggingCallbackInfo:
+        WGPUChainedStruct* nextInChain
+        WGPULoggingCallback callback
+        void* userdata1
+        void* userdata2
+
+    cdef struct WGPUSurfaceSourceMetalLayer:
+        WGPUChainedStruct chain
+        void* layer
+
+    cdef struct WGPUSurfaceSourceWaylandSurface:
+        WGPUChainedStruct chain
+        void* display
+        void* surface
+
+    cdef struct WGPUSurfaceSourceWindowsHWND:
+        WGPUChainedStruct chain
+        void* hinstance
+        void* hwnd
+
+    cdef struct WGPUSurfaceSourceXCBWindow:
+        WGPUChainedStruct chain
+        void* connection
+        uint32_t window
+
+    cdef struct WGPUSurfaceSourceXlibWindow:
+        WGPUChainedStruct chain
+        void* display
+        uint64_t window
+
+    # %% Struct initializers (C compound literals with Dawn's defaults)
+
+    const WGPULoggingCallbackInfo WGPU_LOGGING_CALLBACK_INFO_INIT
+    const WGPUSurfaceSourceMetalLayer WGPU_SURFACE_SOURCE_METAL_LAYER_INIT
+    const WGPUSurfaceSourceWaylandSurface WGPU_SURFACE_SOURCE_WAYLAND_SURFACE_INIT
+    const WGPUSurfaceSourceWindowsHWND WGPU_SURFACE_SOURCE_WINDOWS_HWND_INIT
+    const WGPUSurfaceSourceXCBWindow WGPU_SURFACE_SOURCE_XCB_WINDOW_INIT
+    const WGPUSurfaceSourceXlibWindow WGPU_SURFACE_SOURCE_XLIB_WINDOW_INIT
+
+    # %% Functions
+
+    void wgpuDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallbackInfo callbackInfo)
+    void wgpuDeviceTick(WGPUDevice device)
+
+
 # %% Generated helpers
 
 
diff --git a/wgpu/backends/dawn/dawn_native_only.h b/wgpu/backends/dawn/dawn_native_only.h
new file mode 100644
index 000000000..6a2307b80
--- /dev/null
+++ b/wgpu/backends/dawn/dawn_native_only.h
@@ -0,0 +1,83 @@
+// Native-only parts of Dawn's webgpu.h that the Dawn backend uses.
+//
+// THIS CODE IS AUTOGENERATED BY THE CODEGEN FROM wgpu/resources/dawn_webgpu.h - DO NOT EDIT
+//
+// The Dawn backend is compiled against Dawn's native webgpu.h, or against
+// Emdawnwebgpu's webgpu.h for Pyodide. The latter lacks a few things that the
+// backend uses natively (see NATIVE_ONLY in codegen/dawn_patcher.py). With
+// Emscripten, this header provides them (copied from Dawn's native header), with
+// functions that do nothing, so that the same _api.pyx compiles for both. The
+// backend does not call these in the browser.
+
+#ifndef WGPU_PY_DAWN_NATIVE_ONLY_H_
+#define WGPU_PY_DAWN_NATIVE_ONLY_H_
+
+#include 
+
+#ifdef __EMSCRIPTEN__
+
+typedef enum WGPULoggingType {
+    WGPULoggingType_Verbose = 0x00000001,
+    WGPULoggingType_Info = 0x00000002,
+    WGPULoggingType_Warning = 0x00000003,
+    WGPULoggingType_Error = 0x00000004,
+    WGPULoggingType_Force32 = 0x7FFFFFFF
+} WGPULoggingType WGPU_ENUM_ATTRIBUTE;
+
+typedef void (*WGPULoggingCallback)(WGPULoggingType type, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef struct WGPULoggingCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPULoggingCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPULoggingCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_LOGGING_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPULoggingCallbackInfo, {     /*.nextInChain=*/NULL _wgpu_COMMA     /*.callback=*/NULL _wgpu_COMMA     /*.userdata1=*/NULL _wgpu_COMMA     /*.userdata2=*/NULL _wgpu_COMMA })
+
+typedef struct WGPUSurfaceSourceMetalLayer {
+    WGPUChainedStruct chain;
+    void * layer;
+} WGPUSurfaceSourceMetalLayer WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SURFACE_SOURCE_METAL_LAYER_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceMetalLayer, {     /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, {         /*.next=*/NULL _wgpu_COMMA         /*.sType=*/WGPUSType_SurfaceSourceMetalLayer _wgpu_COMMA     }) _wgpu_COMMA     /*.layer=*/NULL _wgpu_COMMA })
+
+typedef struct WGPUSurfaceSourceWaylandSurface {
+    WGPUChainedStruct chain;
+    void * display;
+    void * surface;
+} WGPUSurfaceSourceWaylandSurface WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SURFACE_SOURCE_WAYLAND_SURFACE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceWaylandSurface, {     /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, {         /*.next=*/NULL _wgpu_COMMA         /*.sType=*/WGPUSType_SurfaceSourceWaylandSurface _wgpu_COMMA     }) _wgpu_COMMA     /*.display=*/NULL _wgpu_COMMA     /*.surface=*/NULL _wgpu_COMMA })
+
+typedef struct WGPUSurfaceSourceWindowsHWND {
+    WGPUChainedStruct chain;
+    void * hinstance;
+    void * hwnd;
+} WGPUSurfaceSourceWindowsHWND WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SURFACE_SOURCE_WINDOWS_HWND_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceWindowsHWND, {     /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, {         /*.next=*/NULL _wgpu_COMMA         /*.sType=*/WGPUSType_SurfaceSourceWindowsHWND _wgpu_COMMA     }) _wgpu_COMMA     /*.hinstance=*/NULL _wgpu_COMMA     /*.hwnd=*/NULL _wgpu_COMMA })
+
+typedef struct WGPUSurfaceSourceXCBWindow {
+    WGPUChainedStruct chain;
+    void * connection;
+    uint32_t window;
+} WGPUSurfaceSourceXCBWindow WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SURFACE_SOURCE_XCB_WINDOW_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceXCBWindow, {     /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, {         /*.next=*/NULL _wgpu_COMMA         /*.sType=*/WGPUSType_SurfaceSourceXCBWindow _wgpu_COMMA     }) _wgpu_COMMA     /*.connection=*/NULL _wgpu_COMMA     /*.window=*/0 _wgpu_COMMA })
+
+typedef struct WGPUSurfaceSourceXlibWindow {
+    WGPUChainedStruct chain;
+    void * display;
+    uint64_t window;
+} WGPUSurfaceSourceXlibWindow WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SURFACE_SOURCE_XLIB_WINDOW_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceSourceXlibWindow, {     /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, {         /*.next=*/NULL _wgpu_COMMA         /*.sType=*/WGPUSType_SurfaceSourceXlibWindow _wgpu_COMMA     }) _wgpu_COMMA     /*.display=*/NULL _wgpu_COMMA     /*.window=*/0 _wgpu_COMMA })
+
+static inline void wgpuDeviceSetLoggingCallback(WGPUDevice device, WGPULoggingCallbackInfo callbackInfo) { (void)device; (void)callbackInfo; }
+
+static inline void wgpuDeviceTick(WGPUDevice device) { (void)device; }
+
+#endif  // __EMSCRIPTEN__
+
+#endif  // WGPU_PY_DAWN_NATIVE_ONLY_H_
diff --git a/wgpu/backends/dawn/emdawn_glue.cpp b/wgpu/backends/dawn/emdawn_glue.cpp
new file mode 100644
index 000000000..46d281b71
--- /dev/null
+++ b/wgpu/backends/dawn/emdawn_glue.cpp
@@ -0,0 +1,54 @@
+// Emdawnwebgpu inside a Pyodide extension (an Emscripten *side module*).
+//
+// Only compiled when building the Dawn backend for Pyodide (tools/build_dawn.py).
+//
+// Emdawnwebgpu has a C++ half (webgpu.cpp, compiled right here) and a JS half
+// (library_webgpu*.js). Side modules cannot carry Emscripten JS libraries, so
+// tools/gen_emdawn_glue.py pre-processes the JS half into emdawn_glue.js. At
+// import time, _api.pyx passes that code to wgpu_dawn_install(), which
+// evaluates it inside Pyodide's module scope (EM_JS bodies are eval'ed there by
+// Emscripten's dynamic linker) and registers its functions in wasmImports.
+// This side module's imports of wgpu*/emwgpu* functions are lazy stubs that
+// resolve through wasmImports on first call, so they then bind to the glue.
+
+#include "webgpu.cpp"  // from emdawnwebgpu_pkg/webgpu/src
+
+#include 
+
+#include "emdawn_cpp_funcs.h"  // generated: the C++ functions the JS calls into
+#include "emdawn_glue.h"
+
+// clang-format off
+EM_JS(int, wgpu_dawn_install_js, (const char* code, const char* names, void* const* fptrs), {
+  var factory = eval(UTF8ToString(code));
+  var nameList = UTF8ToString(names).split(',').filter((s) => s);
+  var cpp = {};
+  for (var i = 0; i < nameList.length; i++) {
+    cpp[nameList[i]] = getWasmTableEntry(HEAPU32[(fptrs >>> 2) + i]);
+  }
+  var lib = factory(cpp);
+  var n = 0;
+  for (var key in lib) {
+    var existing = wasmImports[key];
+    if (!existing || existing.stub) {
+      wasmImports[key] = lib[key];
+      n++;
+    }
+  }
+  return n;
+});
+// clang-format on
+
+extern "C" int wgpu_dawn_install(const char* code) {
+    static void* const fptrs[] = {
+#define X(n) reinterpret_cast(&n),
+        EMDAWN_CPP_FUNCS(X)
+#undef X
+    };
+    static const char names[] =
+#define X(n) #n ","
+        EMDAWN_CPP_FUNCS(X)
+#undef X
+        ;
+    return wgpu_dawn_install_js(code, names, fptrs);
+}
diff --git a/wgpu/backends/dawn/emdawn_glue.h b/wgpu/backends/dawn/emdawn_glue.h
new file mode 100644
index 000000000..50635906c
--- /dev/null
+++ b/wgpu/backends/dawn/emdawn_glue.h
@@ -0,0 +1,19 @@
+// Install Emdawnwebgpu's JS glue into the Pyodide runtime (see emdawn_glue.cpp).
+// Natively, there is nothing to install.
+
+#ifndef WGPU_PY_DAWN_EMDAWN_GLUE_H_
+#define WGPU_PY_DAWN_EMDAWN_GLUE_H_
+
+#ifdef __EMSCRIPTEN__
+#ifdef __cplusplus
+extern "C"
+#endif
+int wgpu_dawn_install(const char* code);
+#else
+static inline int wgpu_dawn_install(const char* code) {
+    (void)code;
+    return 0;
+}
+#endif
+
+#endif  // WGPU_PY_DAWN_EMDAWN_GLUE_H_
diff --git a/wgpu/resources/codegen_report.md b/wgpu/resources/codegen_report.md
index df3b4832a..b4496c4ae 100644
--- a/wgpu/resources/codegen_report.md
+++ b/wgpu/resources/codegen_report.md
@@ -6,6 +6,8 @@
 * webgpu.h/wgpu.h define 8 flags, 70 enums, 115 structs
 * Dawn webgpu.h define 276 functions
 * Dawn webgpu.h define 6 flags, 65 enums, 197 structs
+* Emdawnwebgpu webgpu.h define 207 functions
+* Emdawnwebgpu webgpu.h define 5 flags, 55 enums, 92 structs
 ## Updating API
 * Wrote 5 flags to flags.py
 * Wrote 34 enums to enums.py
@@ -42,6 +44,6 @@
 * Enum CanvasAlphaMode missing in Dawn's webgpu.h
 * Enum CanvasToneMappingMode missing in Dawn's webgpu.h
 * Wrote 268 enum mappings to dawn/_mappings.py
-* Wrote _webgpu.pxd with 276 functions, 196 structs, 195 initializers
+* Wrote _webgpu.pxd with 207 + 2 (native-only) functions, 91 structs
 ### Checking API for backends/dawn/_api.pyx
 * Found 40 classes, 0 methods not implemented
diff --git a/wgpu/resources/emdawn_webgpu.h b/wgpu/resources/emdawn_webgpu.h
new file mode 100644
index 000000000..67b2a899f
--- /dev/null
+++ b/wgpu/resources/emdawn_webgpu.h
@@ -0,0 +1,2950 @@
+// BSD 3-Clause License
+//
+// Copyright (c) 2019, "WebGPU native" developers
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+//    contributors may be used to endorse or promote products derived from
+//    this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef WEBGPU_H_
+#define WEBGPU_H_
+
+#if defined(WGPU_SHARED_LIBRARY)
+#    if defined(_WIN32)
+#        if defined(WGPU_IMPLEMENTATION)
+#            define WGPU_EXPORT __declspec(dllexport)
+#        else
+#            define WGPU_EXPORT __declspec(dllimport)
+#        endif
+#    else  // defined(_WIN32)
+#        if defined(WGPU_IMPLEMENTATION)
+#            define WGPU_EXPORT __attribute__((visibility("default")))
+#        else
+#            define WGPU_EXPORT
+#        endif
+#    endif  // defined(_WIN32)
+#else       // defined(WGPU_SHARED_LIBRARY)
+#    define WGPU_EXPORT
+#endif  // defined(WGPU_SHARED_LIBRARY)
+
+#if !defined(WGPU_OBJECT_ATTRIBUTE)
+#define WGPU_OBJECT_ATTRIBUTE
+#endif
+#if !defined(WGPU_ENUM_ATTRIBUTE)
+#define WGPU_ENUM_ATTRIBUTE
+#endif
+#if !defined(WGPU_STRUCTURE_ATTRIBUTE)
+#define WGPU_STRUCTURE_ATTRIBUTE
+#endif
+#if !defined(WGPU_FUNCTION_ATTRIBUTE)
+#define WGPU_FUNCTION_ATTRIBUTE
+#endif
+#if !defined(WGPU_NULLABLE)
+#define WGPU_NULLABLE
+#endif
+
+#include 
+#include 
+#include 
+
+#define _wgpu_COMMA ,
+#if defined(__cplusplus)
+#  define _wgpu_ENUM_ZERO_INIT(type) type(0)
+#  define _wgpu_STRUCT_ZERO_INIT {}
+#  if __cplusplus >= 201103L
+#    define _wgpu_MAKE_INIT_STRUCT(type, value) (type value)
+#  else
+#    define _wgpu_MAKE_INIT_STRUCT(type, value) value
+#  endif
+#else
+#  define _wgpu_ENUM_ZERO_INIT(type) (type)0
+#  define _wgpu_STRUCT_ZERO_INIT {0}
+#  if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#    define _wgpu_MAKE_INIT_STRUCT(type, value) ((type) value)
+#  else
+#    define _wgpu_MAKE_INIT_STRUCT(type, value) value
+#  endif
+#endif
+
+#define WGPU_TRUE (UINT32_C(1))
+#define WGPU_FALSE (UINT32_C(0))
+#define WGPU_ARRAY_LAYER_COUNT_UNDEFINED (UINT32_MAX)
+#define WGPU_COPY_STRIDE_UNDEFINED (UINT32_MAX)
+#define WGPU_DEPTH_CLEAR_VALUE_UNDEFINED (NAN)
+#define WGPU_DEPTH_SLICE_UNDEFINED (UINT32_MAX)
+#define WGPU_LIMIT_U32_UNDEFINED (UINT32_MAX)
+#define WGPU_LIMIT_U64_UNDEFINED (UINT64_MAX)
+#define WGPU_MIP_LEVEL_COUNT_UNDEFINED (UINT32_MAX)
+#define WGPU_QUERY_SET_INDEX_UNDEFINED (UINT32_MAX)
+#define WGPU_STRLEN (SIZE_MAX)
+#define WGPU_WHOLE_MAP_SIZE (SIZE_MAX)
+#define WGPU_WHOLE_SIZE (UINT64_MAX)
+
+typedef struct WGPUStringView {
+    WGPU_NULLABLE char const * data;
+    size_t length;
+} WGPUStringView WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_STRING_VIEW_INIT _wgpu_MAKE_INIT_STRUCT(WGPUStringView, { \
+    /*.data=*/NULL _wgpu_COMMA \
+    /*.length=*/WGPU_STRLEN _wgpu_COMMA \
+})
+
+typedef uint64_t WGPUFlags;
+typedef uint32_t WGPUBool;
+
+typedef struct WGPUAdapterImpl* WGPUAdapter WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUBindGroupImpl* WGPUBindGroup WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUBindGroupLayoutImpl* WGPUBindGroupLayout WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUBufferImpl* WGPUBuffer WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUCommandBufferImpl* WGPUCommandBuffer WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUCommandEncoderImpl* WGPUCommandEncoder WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUComputePassEncoderImpl* WGPUComputePassEncoder WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUComputePipelineImpl* WGPUComputePipeline WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUDeviceImpl* WGPUDevice WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUExternalTextureImpl* WGPUExternalTexture WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUInstanceImpl* WGPUInstance WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUPipelineLayoutImpl* WGPUPipelineLayout WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUQuerySetImpl* WGPUQuerySet WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUQueueImpl* WGPUQueue WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPURenderBundleImpl* WGPURenderBundle WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPURenderBundleEncoderImpl* WGPURenderBundleEncoder WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPURenderPassEncoderImpl* WGPURenderPassEncoder WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPURenderPipelineImpl* WGPURenderPipeline WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUSamplerImpl* WGPUSampler WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUShaderModuleImpl* WGPUShaderModule WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUSurfaceImpl* WGPUSurface WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUTextureImpl* WGPUTexture WGPU_OBJECT_ATTRIBUTE;
+typedef struct WGPUTextureViewImpl* WGPUTextureView WGPU_OBJECT_ATTRIBUTE;
+
+// Structure forward declarations
+struct WGPUBlendComponent;
+struct WGPUBufferBindingLayout;
+struct WGPUBufferDescriptor;
+struct WGPUColor;
+struct WGPUCommandBufferDescriptor;
+struct WGPUCommandEncoderDescriptor;
+struct WGPUCompatibilityModeLimits;
+struct WGPUConstantEntry;
+struct WGPUDawnCompilationMessageUtf16;
+struct WGPUEmscriptenSurfaceSourceCanvasHTMLSelector;
+struct WGPUExtent3D;
+struct WGPUExternalTextureBindingEntry;
+struct WGPUExternalTextureBindingLayout;
+struct WGPUFuture;
+struct WGPUInstanceLimits;
+struct WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER;
+struct WGPUMultisampleState;
+struct WGPUOrigin3D;
+struct WGPUPassTimestampWrites;
+struct WGPUPipelineLayoutDescriptor;
+struct WGPUPrimitiveState;
+struct WGPUQuerySetDescriptor;
+struct WGPUQueueDescriptor;
+struct WGPURenderBundleDescriptor;
+struct WGPURenderBundleEncoderDescriptor;
+struct WGPURenderPassDepthStencilAttachment;
+struct WGPURenderPassMaxDrawCount;
+struct WGPURequestAdapterWebXROptions;
+struct WGPUSamplerBindingLayout;
+struct WGPUSamplerDescriptor;
+struct WGPUShaderSourceSPIRV;
+struct WGPUShaderSourceWGSL;
+struct WGPUStencilFaceState;
+struct WGPUStorageTextureBindingLayout;
+struct WGPUSubgroupMatrixConfig;
+struct WGPUSupportedFeatures;
+struct WGPUSupportedInstanceFeatures;
+struct WGPUSupportedWGSLLanguageFeatures;
+struct WGPUSurfaceCapabilities;
+struct WGPUSurfaceColorManagement;
+struct WGPUSurfaceConfiguration;
+struct WGPUSurfaceTexture;
+struct WGPUTexelCopyBufferLayout;
+struct WGPUTextureBindingLayout;
+struct WGPUTextureBindingViewDimension;
+struct WGPUTextureComponentSwizzle;
+struct WGPUVertexAttribute;
+struct WGPUAdapterPropertiesSubgroupMatrixConfigs;
+struct WGPUBindGroupEntry;
+struct WGPUBindGroupLayoutEntry;
+struct WGPUBlendState;
+struct WGPUCompilationMessage;
+struct WGPUComputePassDescriptor;
+struct WGPUComputeState;
+struct WGPUDepthStencilState;
+struct WGPUFutureWaitInfo;
+struct WGPUInstanceDescriptor;
+struct WGPULimits;
+struct WGPURenderPassColorAttachment;
+struct WGPURequestAdapterOptions;
+struct WGPUShaderModuleDescriptor;
+struct WGPUSurfaceDescriptor;
+struct WGPUTexelCopyBufferInfo;
+struct WGPUTexelCopyTextureInfo;
+struct WGPUTextureComponentSwizzleDescriptor;
+struct WGPUTextureDescriptor;
+struct WGPUVertexBufferLayout;
+struct WGPUAdapterInfo;
+struct WGPUBindGroupDescriptor;
+struct WGPUBindGroupLayoutDescriptor;
+struct WGPUColorTargetState;
+struct WGPUCompilationInfo;
+struct WGPUComputePipelineDescriptor;
+struct WGPUDeviceDescriptor;
+struct WGPURenderPassDescriptor;
+struct WGPUTextureViewDescriptor;
+struct WGPUVertexState;
+struct WGPUFragmentState;
+struct WGPURenderPipelineDescriptor;
+
+// Callback info structure forward declarations.
+struct WGPUBufferMapCallbackInfo;
+struct WGPUCompilationInfoCallbackInfo;
+struct WGPUCreateComputePipelineAsyncCallbackInfo;
+struct WGPUCreateRenderPipelineAsyncCallbackInfo;
+struct WGPUDeviceLostCallbackInfo;
+struct WGPUPopErrorScopeCallbackInfo;
+struct WGPUQueueWorkDoneCallbackInfo;
+struct WGPURequestAdapterCallbackInfo;
+struct WGPURequestDeviceCallbackInfo;
+struct WGPUUncapturedErrorCallbackInfo;
+
+// NOLINTBEGIN(cppcoreguidelines-use-enum-class)
+
+typedef enum WGPUAdapterType {
+    WGPUAdapterType_DiscreteGPU = 0x00000001,
+    WGPUAdapterType_IntegratedGPU = 0x00000002,
+    WGPUAdapterType_CPU = 0x00000003,
+    WGPUAdapterType_Unknown = 0x00000004,
+    WGPUAdapterType_Force32 = 0x7FFFFFFF
+} WGPUAdapterType WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUAddressMode {
+    WGPUAddressMode_Undefined = 0x00000000,
+    WGPUAddressMode_ClampToEdge = 0x00000001,
+    WGPUAddressMode_Repeat = 0x00000002,
+    WGPUAddressMode_MirrorRepeat = 0x00000003,
+    WGPUAddressMode_Force32 = 0x7FFFFFFF
+} WGPUAddressMode WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUBackendType {
+    WGPUBackendType_Undefined = 0x00000000,
+    WGPUBackendType_Null = 0x00000001,
+    WGPUBackendType_WebGPU = 0x00000002,
+    WGPUBackendType_D3D11 = 0x00000003,
+    WGPUBackendType_D3D12 = 0x00000004,
+    WGPUBackendType_Metal = 0x00000005,
+    WGPUBackendType_Vulkan = 0x00000006,
+    WGPUBackendType_OpenGL = 0x00000007,
+    WGPUBackendType_OpenGLES = 0x00000008,
+    WGPUBackendType_Force32 = 0x7FFFFFFF
+} WGPUBackendType WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUBlendFactor {
+    WGPUBlendFactor_Undefined = 0x00000000,
+    WGPUBlendFactor_Zero = 0x00000001,
+    WGPUBlendFactor_One = 0x00000002,
+    WGPUBlendFactor_Src = 0x00000003,
+    WGPUBlendFactor_OneMinusSrc = 0x00000004,
+    WGPUBlendFactor_SrcAlpha = 0x00000005,
+    WGPUBlendFactor_OneMinusSrcAlpha = 0x00000006,
+    WGPUBlendFactor_Dst = 0x00000007,
+    WGPUBlendFactor_OneMinusDst = 0x00000008,
+    WGPUBlendFactor_DstAlpha = 0x00000009,
+    WGPUBlendFactor_OneMinusDstAlpha = 0x0000000A,
+    WGPUBlendFactor_SrcAlphaSaturated = 0x0000000B,
+    WGPUBlendFactor_Constant = 0x0000000C,
+    WGPUBlendFactor_OneMinusConstant = 0x0000000D,
+    WGPUBlendFactor_Src1 = 0x0000000E,
+    WGPUBlendFactor_OneMinusSrc1 = 0x0000000F,
+    WGPUBlendFactor_Src1Alpha = 0x00000010,
+    WGPUBlendFactor_OneMinusSrc1Alpha = 0x00000011,
+    WGPUBlendFactor_Force32 = 0x7FFFFFFF
+} WGPUBlendFactor WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUBlendOperation {
+    WGPUBlendOperation_Undefined = 0x00000000,
+    WGPUBlendOperation_Add = 0x00000001,
+    WGPUBlendOperation_Subtract = 0x00000002,
+    WGPUBlendOperation_ReverseSubtract = 0x00000003,
+    WGPUBlendOperation_Min = 0x00000004,
+    WGPUBlendOperation_Max = 0x00000005,
+    WGPUBlendOperation_Force32 = 0x7FFFFFFF
+} WGPUBlendOperation WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUBufferBindingType {
+    WGPUBufferBindingType_BindingNotUsed = 0x00000000,
+    WGPUBufferBindingType_Undefined = 0x00000001,
+    WGPUBufferBindingType_Uniform = 0x00000002,
+    WGPUBufferBindingType_Storage = 0x00000003,
+    WGPUBufferBindingType_ReadOnlyStorage = 0x00000004,
+    WGPUBufferBindingType_Force32 = 0x7FFFFFFF
+} WGPUBufferBindingType WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUBufferMapState {
+    WGPUBufferMapState_Unmapped = 0x00000001,
+    WGPUBufferMapState_Pending = 0x00000002,
+    WGPUBufferMapState_Mapped = 0x00000003,
+    WGPUBufferMapState_Force32 = 0x7FFFFFFF
+} WGPUBufferMapState WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUCallbackMode {
+    WGPUCallbackMode_WaitAnyOnly = 0x00000001,
+    WGPUCallbackMode_AllowProcessEvents = 0x00000002,
+    WGPUCallbackMode_AllowSpontaneous = 0x00000003,
+    WGPUCallbackMode_Force32 = 0x7FFFFFFF
+} WGPUCallbackMode WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUCompareFunction {
+    WGPUCompareFunction_Undefined = 0x00000000,
+    WGPUCompareFunction_Never = 0x00000001,
+    WGPUCompareFunction_Less = 0x00000002,
+    WGPUCompareFunction_Equal = 0x00000003,
+    WGPUCompareFunction_LessEqual = 0x00000004,
+    WGPUCompareFunction_Greater = 0x00000005,
+    WGPUCompareFunction_NotEqual = 0x00000006,
+    WGPUCompareFunction_GreaterEqual = 0x00000007,
+    WGPUCompareFunction_Always = 0x00000008,
+    WGPUCompareFunction_Force32 = 0x7FFFFFFF
+} WGPUCompareFunction WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUCompilationInfoRequestStatus {
+    WGPUCompilationInfoRequestStatus_Success = 0x00000001,
+    WGPUCompilationInfoRequestStatus_CallbackCancelled = 0x00000002,
+    WGPUCompilationInfoRequestStatus_Force32 = 0x7FFFFFFF
+} WGPUCompilationInfoRequestStatus WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUCompilationMessageType {
+    WGPUCompilationMessageType_Error = 0x00000001,
+    WGPUCompilationMessageType_Warning = 0x00000002,
+    WGPUCompilationMessageType_Info = 0x00000003,
+    WGPUCompilationMessageType_Force32 = 0x7FFFFFFF
+} WGPUCompilationMessageType WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUComponentSwizzle {
+    WGPUComponentSwizzle_Undefined = 0x00000000,
+    WGPUComponentSwizzle_Zero = 0x00000001,
+    WGPUComponentSwizzle_One = 0x00000002,
+    WGPUComponentSwizzle_R = 0x00000003,
+    WGPUComponentSwizzle_G = 0x00000004,
+    WGPUComponentSwizzle_B = 0x00000005,
+    WGPUComponentSwizzle_A = 0x00000006,
+    WGPUComponentSwizzle_Force32 = 0x7FFFFFFF
+} WGPUComponentSwizzle WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUCompositeAlphaMode {
+    WGPUCompositeAlphaMode_Auto = 0x00000000,
+    WGPUCompositeAlphaMode_Opaque = 0x00000001,
+    WGPUCompositeAlphaMode_Premultiplied = 0x00000002,
+    WGPUCompositeAlphaMode_Unpremultiplied = 0x00000003,
+    WGPUCompositeAlphaMode_Inherit = 0x00000004,
+    WGPUCompositeAlphaMode_Force32 = 0x7FFFFFFF
+} WGPUCompositeAlphaMode WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUCreatePipelineAsyncStatus {
+    WGPUCreatePipelineAsyncStatus_Success = 0x00000001,
+    WGPUCreatePipelineAsyncStatus_CallbackCancelled = 0x00000002,
+    WGPUCreatePipelineAsyncStatus_ValidationError = 0x00000003,
+    WGPUCreatePipelineAsyncStatus_InternalError = 0x00000004,
+    WGPUCreatePipelineAsyncStatus_Force32 = 0x7FFFFFFF
+} WGPUCreatePipelineAsyncStatus WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUCullMode {
+    WGPUCullMode_Undefined = 0x00000000,
+    WGPUCullMode_None = 0x00000001,
+    WGPUCullMode_Front = 0x00000002,
+    WGPUCullMode_Back = 0x00000003,
+    WGPUCullMode_Force32 = 0x7FFFFFFF
+} WGPUCullMode WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUDeviceLostReason {
+    WGPUDeviceLostReason_Unknown = 0x00000001,
+    WGPUDeviceLostReason_Destroyed = 0x00000002,
+    WGPUDeviceLostReason_CallbackCancelled = 0x00000003,
+    WGPUDeviceLostReason_FailedCreation = 0x00000004,
+    WGPUDeviceLostReason_Force32 = 0x7FFFFFFF
+} WGPUDeviceLostReason WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUErrorFilter {
+    WGPUErrorFilter_Validation = 0x00000001,
+    WGPUErrorFilter_OutOfMemory = 0x00000002,
+    WGPUErrorFilter_Internal = 0x00000003,
+    WGPUErrorFilter_Force32 = 0x7FFFFFFF
+} WGPUErrorFilter WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUErrorType {
+    WGPUErrorType_NoError = 0x00000001,
+    WGPUErrorType_Validation = 0x00000002,
+    WGPUErrorType_OutOfMemory = 0x00000003,
+    WGPUErrorType_Internal = 0x00000004,
+    WGPUErrorType_Unknown = 0x00000005,
+    WGPUErrorType_Force32 = 0x7FFFFFFF
+} WGPUErrorType WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUFeatureLevel {
+    WGPUFeatureLevel_Undefined = 0x00000000,
+    WGPUFeatureLevel_Compatibility = 0x00000001,
+    WGPUFeatureLevel_Core = 0x00000002,
+    WGPUFeatureLevel_Force32 = 0x7FFFFFFF
+} WGPUFeatureLevel WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUFeatureName {
+    WGPUFeatureName_CoreFeaturesAndLimits = 0x00000001,
+    WGPUFeatureName_DepthClipControl = 0x00000002,
+    WGPUFeatureName_Depth32FloatStencil8 = 0x00000003,
+    WGPUFeatureName_TextureCompressionBC = 0x00000004,
+    WGPUFeatureName_TextureCompressionBCSliced3D = 0x00000005,
+    WGPUFeatureName_TextureCompressionETC2 = 0x00000006,
+    WGPUFeatureName_TextureCompressionASTC = 0x00000007,
+    WGPUFeatureName_TextureCompressionASTCSliced3D = 0x00000008,
+    WGPUFeatureName_TimestampQuery = 0x00000009,
+    WGPUFeatureName_IndirectFirstInstance = 0x0000000A,
+    WGPUFeatureName_ShaderF16 = 0x0000000B,
+    WGPUFeatureName_RG11B10UfloatRenderable = 0x0000000C,
+    WGPUFeatureName_BGRA8UnormStorage = 0x0000000D,
+    WGPUFeatureName_Float32Filterable = 0x0000000E,
+    WGPUFeatureName_Float32Blendable = 0x0000000F,
+    WGPUFeatureName_ClipDistances = 0x00000010,
+    WGPUFeatureName_DualSourceBlending = 0x00000011,
+    WGPUFeatureName_Subgroups = 0x00000012,
+    WGPUFeatureName_TextureFormatsTier1 = 0x00000013,
+    WGPUFeatureName_TextureFormatsTier2 = 0x00000014,
+    WGPUFeatureName_PrimitiveIndex = 0x00000015,
+    WGPUFeatureName_TextureComponentSwizzle = 0x00000016,
+    WGPUFeatureName_SubgroupSizeControl = 0x00000017,
+    WGPUFeatureName_TextureCompressionUnaligned = 0x00000018,
+    WGPUFeatureName_Unorm16TextureFormats = 0x0005000C,
+    WGPUFeatureName_MultiDrawIndirect = 0x00050031,
+    WGPUFeatureName_ChromiumExperimentalSubgroupMatrix = 0x00050034,
+    WGPUFeatureName_Force32 = 0x7FFFFFFF
+} WGPUFeatureName WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUFilterMode {
+    WGPUFilterMode_Undefined = 0x00000000,
+    WGPUFilterMode_Nearest = 0x00000001,
+    WGPUFilterMode_Linear = 0x00000002,
+    WGPUFilterMode_Force32 = 0x7FFFFFFF
+} WGPUFilterMode WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUFrontFace {
+    WGPUFrontFace_Undefined = 0x00000000,
+    WGPUFrontFace_CCW = 0x00000001,
+    WGPUFrontFace_CW = 0x00000002,
+    WGPUFrontFace_Force32 = 0x7FFFFFFF
+} WGPUFrontFace WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUIndexFormat {
+    WGPUIndexFormat_Undefined = 0x00000000,
+    WGPUIndexFormat_Uint16 = 0x00000001,
+    WGPUIndexFormat_Uint32 = 0x00000002,
+    WGPUIndexFormat_Force32 = 0x7FFFFFFF
+} WGPUIndexFormat WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUInstanceFeatureName {
+    WGPUInstanceFeatureName_TimedWaitAny = 0x00000001,
+    WGPUInstanceFeatureName_ShaderSourceSPIRV = 0x00000002,
+    WGPUInstanceFeatureName_MultipleDevicesPerAdapter = 0x00000003,
+    WGPUInstanceFeatureName_Force32 = 0x7FFFFFFF
+} WGPUInstanceFeatureName WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPULoadOp {
+    WGPULoadOp_Undefined = 0x00000000,
+    WGPULoadOp_Load = 0x00000001,
+    WGPULoadOp_Clear = 0x00000002,
+    WGPULoadOp_Force32 = 0x7FFFFFFF
+} WGPULoadOp WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUMapAsyncStatus {
+    WGPUMapAsyncStatus_Success = 0x00000001,
+    WGPUMapAsyncStatus_CallbackCancelled = 0x00000002,
+    WGPUMapAsyncStatus_Error = 0x00000003,
+    WGPUMapAsyncStatus_Aborted = 0x00000004,
+    WGPUMapAsyncStatus_Force32 = 0x7FFFFFFF
+} WGPUMapAsyncStatus WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUMipmapFilterMode {
+    WGPUMipmapFilterMode_Undefined = 0x00000000,
+    WGPUMipmapFilterMode_Nearest = 0x00000001,
+    WGPUMipmapFilterMode_Linear = 0x00000002,
+    WGPUMipmapFilterMode_Force32 = 0x7FFFFFFF
+} WGPUMipmapFilterMode WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUOptionalBool {
+    WGPUOptionalBool_False = 0x00000000,
+    WGPUOptionalBool_True = 0x00000001,
+    WGPUOptionalBool_Undefined = 0x00000002,
+    WGPUOptionalBool_Force32 = 0x7FFFFFFF
+} WGPUOptionalBool WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUPopErrorScopeStatus {
+    WGPUPopErrorScopeStatus_Success = 0x00000001,
+    WGPUPopErrorScopeStatus_CallbackCancelled = 0x00000002,
+    WGPUPopErrorScopeStatus_Error = 0x00000003,
+    WGPUPopErrorScopeStatus_Force32 = 0x7FFFFFFF
+} WGPUPopErrorScopeStatus WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUPowerPreference {
+    WGPUPowerPreference_Undefined = 0x00000000,
+    WGPUPowerPreference_LowPower = 0x00000001,
+    WGPUPowerPreference_HighPerformance = 0x00000002,
+    WGPUPowerPreference_Force32 = 0x7FFFFFFF
+} WGPUPowerPreference WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUPredefinedColorSpace {
+    WGPUPredefinedColorSpace_SRGB = 0x00000001,
+    WGPUPredefinedColorSpace_DisplayP3 = 0x00000002,
+    WGPUPredefinedColorSpace_Force32 = 0x7FFFFFFF
+} WGPUPredefinedColorSpace WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUPresentMode {
+    WGPUPresentMode_Undefined = 0x00000000,
+    WGPUPresentMode_Fifo = 0x00000001,
+    WGPUPresentMode_FifoRelaxed = 0x00000002,
+    WGPUPresentMode_Immediate = 0x00000003,
+    WGPUPresentMode_Mailbox = 0x00000004,
+    WGPUPresentMode_Force32 = 0x7FFFFFFF
+} WGPUPresentMode WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUPrimitiveTopology {
+    WGPUPrimitiveTopology_Undefined = 0x00000000,
+    WGPUPrimitiveTopology_PointList = 0x00000001,
+    WGPUPrimitiveTopology_LineList = 0x00000002,
+    WGPUPrimitiveTopology_LineStrip = 0x00000003,
+    WGPUPrimitiveTopology_TriangleList = 0x00000004,
+    WGPUPrimitiveTopology_TriangleStrip = 0x00000005,
+    WGPUPrimitiveTopology_Force32 = 0x7FFFFFFF
+} WGPUPrimitiveTopology WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUQueryType {
+    WGPUQueryType_Occlusion = 0x00000001,
+    WGPUQueryType_Timestamp = 0x00000002,
+    WGPUQueryType_Force32 = 0x7FFFFFFF
+} WGPUQueryType WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUQueueWorkDoneStatus {
+    WGPUQueueWorkDoneStatus_Success = 0x00000001,
+    WGPUQueueWorkDoneStatus_CallbackCancelled = 0x00000002,
+    WGPUQueueWorkDoneStatus_Error = 0x00000003,
+    WGPUQueueWorkDoneStatus_Force32 = 0x7FFFFFFF
+} WGPUQueueWorkDoneStatus WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPURequestAdapterStatus {
+    WGPURequestAdapterStatus_Success = 0x00000001,
+    WGPURequestAdapterStatus_CallbackCancelled = 0x00000002,
+    WGPURequestAdapterStatus_Unavailable = 0x00000003,
+    WGPURequestAdapterStatus_Error = 0x00000004,
+    WGPURequestAdapterStatus_Force32 = 0x7FFFFFFF
+} WGPURequestAdapterStatus WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPURequestDeviceStatus {
+    WGPURequestDeviceStatus_Success = 0x00000001,
+    WGPURequestDeviceStatus_CallbackCancelled = 0x00000002,
+    WGPURequestDeviceStatus_Error = 0x00000003,
+    WGPURequestDeviceStatus_Force32 = 0x7FFFFFFF
+} WGPURequestDeviceStatus WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUSamplerBindingType {
+    WGPUSamplerBindingType_BindingNotUsed = 0x00000000,
+    WGPUSamplerBindingType_Undefined = 0x00000001,
+    WGPUSamplerBindingType_Filtering = 0x00000002,
+    WGPUSamplerBindingType_NonFiltering = 0x00000003,
+    WGPUSamplerBindingType_Comparison = 0x00000004,
+    WGPUSamplerBindingType_Force32 = 0x7FFFFFFF
+} WGPUSamplerBindingType WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUStatus {
+    WGPUStatus_Success = 0x00000001,
+    WGPUStatus_Error = 0x00000002,
+    WGPUStatus_Force32 = 0x7FFFFFFF
+} WGPUStatus WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUStencilOperation {
+    WGPUStencilOperation_Undefined = 0x00000000,
+    WGPUStencilOperation_Keep = 0x00000001,
+    WGPUStencilOperation_Zero = 0x00000002,
+    WGPUStencilOperation_Replace = 0x00000003,
+    WGPUStencilOperation_Invert = 0x00000004,
+    WGPUStencilOperation_IncrementClamp = 0x00000005,
+    WGPUStencilOperation_DecrementClamp = 0x00000006,
+    WGPUStencilOperation_IncrementWrap = 0x00000007,
+    WGPUStencilOperation_DecrementWrap = 0x00000008,
+    WGPUStencilOperation_Force32 = 0x7FFFFFFF
+} WGPUStencilOperation WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUStorageTextureAccess {
+    WGPUStorageTextureAccess_BindingNotUsed = 0x00000000,
+    WGPUStorageTextureAccess_Undefined = 0x00000001,
+    WGPUStorageTextureAccess_WriteOnly = 0x00000002,
+    WGPUStorageTextureAccess_ReadOnly = 0x00000003,
+    WGPUStorageTextureAccess_ReadWrite = 0x00000004,
+    WGPUStorageTextureAccess_Force32 = 0x7FFFFFFF
+} WGPUStorageTextureAccess WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUStoreOp {
+    WGPUStoreOp_Undefined = 0x00000000,
+    WGPUStoreOp_Store = 0x00000001,
+    WGPUStoreOp_Discard = 0x00000002,
+    WGPUStoreOp_Force32 = 0x7FFFFFFF
+} WGPUStoreOp WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUSType {
+    WGPUSType_ShaderSourceSPIRV = 0x00000001,
+    WGPUSType_ShaderSourceWGSL = 0x00000002,
+    WGPUSType_RenderPassMaxDrawCount = 0x00000003,
+    WGPUSType_SurfaceSourceMetalLayer = 0x00000004,
+    WGPUSType_SurfaceSourceWindowsHWND = 0x00000005,
+    WGPUSType_SurfaceSourceXlibWindow = 0x00000006,
+    WGPUSType_SurfaceSourceWaylandSurface = 0x00000007,
+    WGPUSType_SurfaceSourceAndroidNativeWindow = 0x00000008,
+    WGPUSType_SurfaceSourceXCBWindow = 0x00000009,
+    WGPUSType_SurfaceColorManagement = 0x0000000A,
+    WGPUSType_RequestAdapterWebXROptions = 0x0000000B,
+    WGPUSType_TextureComponentSwizzleDescriptor = 0x0000000C,
+    WGPUSType_ExternalTextureBindingLayout = 0x0000000D,
+    WGPUSType_ExternalTextureBindingEntry = 0x0000000E,
+    WGPUSType_CompatibilityModeLimits = 0x0000000F,
+    WGPUSType_TextureBindingViewDimension = 0x00000010,
+    WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector = 0x00040000,
+    WGPUSType_AdapterPropertiesSubgroupMatrixConfigs = 0x0005003B,
+    WGPUSType_DawnCompilationMessageUtf16 = 0x0005003F,
+    WGPUSType_Force32 = 0x7FFFFFFF
+} WGPUSType WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUSubgroupMatrixComponentType {
+    WGPUSubgroupMatrixComponentType_F32 = 0x00000001,
+    WGPUSubgroupMatrixComponentType_F16 = 0x00000002,
+    WGPUSubgroupMatrixComponentType_U32 = 0x00000003,
+    WGPUSubgroupMatrixComponentType_I32 = 0x00000004,
+    WGPUSubgroupMatrixComponentType_U8 = 0x00000005,
+    WGPUSubgroupMatrixComponentType_I8 = 0x00000006,
+    WGPUSubgroupMatrixComponentType_Force32 = 0x7FFFFFFF
+} WGPUSubgroupMatrixComponentType WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUSurfaceGetCurrentTextureStatus {
+    WGPUSurfaceGetCurrentTextureStatus_SuccessOptimal = 0x00000001,
+    WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal = 0x00000002,
+    WGPUSurfaceGetCurrentTextureStatus_Timeout = 0x00000003,
+    WGPUSurfaceGetCurrentTextureStatus_Outdated = 0x00000004,
+    WGPUSurfaceGetCurrentTextureStatus_Lost = 0x00000005,
+    WGPUSurfaceGetCurrentTextureStatus_Error = 0x00000006,
+    WGPUSurfaceGetCurrentTextureStatus_Force32 = 0x7FFFFFFF
+} WGPUSurfaceGetCurrentTextureStatus WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUTextureAspect {
+    WGPUTextureAspect_Undefined = 0x00000000,
+    WGPUTextureAspect_All = 0x00000001,
+    WGPUTextureAspect_StencilOnly = 0x00000002,
+    WGPUTextureAspect_DepthOnly = 0x00000003,
+    WGPUTextureAspect_Force32 = 0x7FFFFFFF
+} WGPUTextureAspect WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUTextureDimension {
+    WGPUTextureDimension_Undefined = 0x00000000,
+    WGPUTextureDimension_1D = 0x00000001,
+    WGPUTextureDimension_2D = 0x00000002,
+    WGPUTextureDimension_3D = 0x00000003,
+    WGPUTextureDimension_Force32 = 0x7FFFFFFF
+} WGPUTextureDimension WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUTextureFormat {
+    WGPUTextureFormat_Undefined = 0x00000000,
+    WGPUTextureFormat_R8Unorm = 0x00000001,
+    WGPUTextureFormat_R8Snorm = 0x00000002,
+    WGPUTextureFormat_R8Uint = 0x00000003,
+    WGPUTextureFormat_R8Sint = 0x00000004,
+    WGPUTextureFormat_R16Unorm = 0x00000005,
+    WGPUTextureFormat_R16Snorm = 0x00000006,
+    WGPUTextureFormat_R16Uint = 0x00000007,
+    WGPUTextureFormat_R16Sint = 0x00000008,
+    WGPUTextureFormat_R16Float = 0x00000009,
+    WGPUTextureFormat_RG8Unorm = 0x0000000A,
+    WGPUTextureFormat_RG8Snorm = 0x0000000B,
+    WGPUTextureFormat_RG8Uint = 0x0000000C,
+    WGPUTextureFormat_RG8Sint = 0x0000000D,
+    WGPUTextureFormat_R32Float = 0x0000000E,
+    WGPUTextureFormat_R32Uint = 0x0000000F,
+    WGPUTextureFormat_R32Sint = 0x00000010,
+    WGPUTextureFormat_RG16Unorm = 0x00000011,
+    WGPUTextureFormat_RG16Snorm = 0x00000012,
+    WGPUTextureFormat_RG16Uint = 0x00000013,
+    WGPUTextureFormat_RG16Sint = 0x00000014,
+    WGPUTextureFormat_RG16Float = 0x00000015,
+    WGPUTextureFormat_RGBA8Unorm = 0x00000016,
+    WGPUTextureFormat_RGBA8UnormSrgb = 0x00000017,
+    WGPUTextureFormat_RGBA8Snorm = 0x00000018,
+    WGPUTextureFormat_RGBA8Uint = 0x00000019,
+    WGPUTextureFormat_RGBA8Sint = 0x0000001A,
+    WGPUTextureFormat_BGRA8Unorm = 0x0000001B,
+    WGPUTextureFormat_BGRA8UnormSrgb = 0x0000001C,
+    WGPUTextureFormat_RGB10A2Uint = 0x0000001D,
+    WGPUTextureFormat_RGB10A2Unorm = 0x0000001E,
+    WGPUTextureFormat_RG11B10Ufloat = 0x0000001F,
+    WGPUTextureFormat_RGB9E5Ufloat = 0x00000020,
+    WGPUTextureFormat_RG32Float = 0x00000021,
+    WGPUTextureFormat_RG32Uint = 0x00000022,
+    WGPUTextureFormat_RG32Sint = 0x00000023,
+    WGPUTextureFormat_RGBA16Unorm = 0x00000024,
+    WGPUTextureFormat_RGBA16Snorm = 0x00000025,
+    WGPUTextureFormat_RGBA16Uint = 0x00000026,
+    WGPUTextureFormat_RGBA16Sint = 0x00000027,
+    WGPUTextureFormat_RGBA16Float = 0x00000028,
+    WGPUTextureFormat_RGBA32Float = 0x00000029,
+    WGPUTextureFormat_RGBA32Uint = 0x0000002A,
+    WGPUTextureFormat_RGBA32Sint = 0x0000002B,
+    WGPUTextureFormat_Stencil8 = 0x0000002C,
+    WGPUTextureFormat_Depth16Unorm = 0x0000002D,
+    WGPUTextureFormat_Depth24Plus = 0x0000002E,
+    WGPUTextureFormat_Depth24PlusStencil8 = 0x0000002F,
+    WGPUTextureFormat_Depth32Float = 0x00000030,
+    WGPUTextureFormat_Depth32FloatStencil8 = 0x00000031,
+    WGPUTextureFormat_BC1RGBAUnorm = 0x00000032,
+    WGPUTextureFormat_BC1RGBAUnormSrgb = 0x00000033,
+    WGPUTextureFormat_BC2RGBAUnorm = 0x00000034,
+    WGPUTextureFormat_BC2RGBAUnormSrgb = 0x00000035,
+    WGPUTextureFormat_BC3RGBAUnorm = 0x00000036,
+    WGPUTextureFormat_BC3RGBAUnormSrgb = 0x00000037,
+    WGPUTextureFormat_BC4RUnorm = 0x00000038,
+    WGPUTextureFormat_BC4RSnorm = 0x00000039,
+    WGPUTextureFormat_BC5RGUnorm = 0x0000003A,
+    WGPUTextureFormat_BC5RGSnorm = 0x0000003B,
+    WGPUTextureFormat_BC6HRGBUfloat = 0x0000003C,
+    WGPUTextureFormat_BC6HRGBFloat = 0x0000003D,
+    WGPUTextureFormat_BC7RGBAUnorm = 0x0000003E,
+    WGPUTextureFormat_BC7RGBAUnormSrgb = 0x0000003F,
+    WGPUTextureFormat_ETC2RGB8Unorm = 0x00000040,
+    WGPUTextureFormat_ETC2RGB8UnormSrgb = 0x00000041,
+    WGPUTextureFormat_ETC2RGB8A1Unorm = 0x00000042,
+    WGPUTextureFormat_ETC2RGB8A1UnormSrgb = 0x00000043,
+    WGPUTextureFormat_ETC2RGBA8Unorm = 0x00000044,
+    WGPUTextureFormat_ETC2RGBA8UnormSrgb = 0x00000045,
+    WGPUTextureFormat_EACR11Unorm = 0x00000046,
+    WGPUTextureFormat_EACR11Snorm = 0x00000047,
+    WGPUTextureFormat_EACRG11Unorm = 0x00000048,
+    WGPUTextureFormat_EACRG11Snorm = 0x00000049,
+    WGPUTextureFormat_ASTC4x4Unorm = 0x0000004A,
+    WGPUTextureFormat_ASTC4x4UnormSrgb = 0x0000004B,
+    WGPUTextureFormat_ASTC5x4Unorm = 0x0000004C,
+    WGPUTextureFormat_ASTC5x4UnormSrgb = 0x0000004D,
+    WGPUTextureFormat_ASTC5x5Unorm = 0x0000004E,
+    WGPUTextureFormat_ASTC5x5UnormSrgb = 0x0000004F,
+    WGPUTextureFormat_ASTC6x5Unorm = 0x00000050,
+    WGPUTextureFormat_ASTC6x5UnormSrgb = 0x00000051,
+    WGPUTextureFormat_ASTC6x6Unorm = 0x00000052,
+    WGPUTextureFormat_ASTC6x6UnormSrgb = 0x00000053,
+    WGPUTextureFormat_ASTC8x5Unorm = 0x00000054,
+    WGPUTextureFormat_ASTC8x5UnormSrgb = 0x00000055,
+    WGPUTextureFormat_ASTC8x6Unorm = 0x00000056,
+    WGPUTextureFormat_ASTC8x6UnormSrgb = 0x00000057,
+    WGPUTextureFormat_ASTC8x8Unorm = 0x00000058,
+    WGPUTextureFormat_ASTC8x8UnormSrgb = 0x00000059,
+    WGPUTextureFormat_ASTC10x5Unorm = 0x0000005A,
+    WGPUTextureFormat_ASTC10x5UnormSrgb = 0x0000005B,
+    WGPUTextureFormat_ASTC10x6Unorm = 0x0000005C,
+    WGPUTextureFormat_ASTC10x6UnormSrgb = 0x0000005D,
+    WGPUTextureFormat_ASTC10x8Unorm = 0x0000005E,
+    WGPUTextureFormat_ASTC10x8UnormSrgb = 0x0000005F,
+    WGPUTextureFormat_ASTC10x10Unorm = 0x00000060,
+    WGPUTextureFormat_ASTC10x10UnormSrgb = 0x00000061,
+    WGPUTextureFormat_ASTC12x10Unorm = 0x00000062,
+    WGPUTextureFormat_ASTC12x10UnormSrgb = 0x00000063,
+    WGPUTextureFormat_ASTC12x12Unorm = 0x00000064,
+    WGPUTextureFormat_ASTC12x12UnormSrgb = 0x00000065,
+    WGPUTextureFormat_Force32 = 0x7FFFFFFF
+} WGPUTextureFormat WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUTextureSampleType {
+    WGPUTextureSampleType_BindingNotUsed = 0x00000000,
+    WGPUTextureSampleType_Undefined = 0x00000001,
+    WGPUTextureSampleType_Float = 0x00000002,
+    WGPUTextureSampleType_UnfilterableFloat = 0x00000003,
+    WGPUTextureSampleType_Depth = 0x00000004,
+    WGPUTextureSampleType_Sint = 0x00000005,
+    WGPUTextureSampleType_Uint = 0x00000006,
+    WGPUTextureSampleType_Force32 = 0x7FFFFFFF
+} WGPUTextureSampleType WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUTextureViewDimension {
+    WGPUTextureViewDimension_Undefined = 0x00000000,
+    WGPUTextureViewDimension_1D = 0x00000001,
+    WGPUTextureViewDimension_2D = 0x00000002,
+    WGPUTextureViewDimension_2DArray = 0x00000003,
+    WGPUTextureViewDimension_Cube = 0x00000004,
+    WGPUTextureViewDimension_CubeArray = 0x00000005,
+    WGPUTextureViewDimension_3D = 0x00000006,
+    WGPUTextureViewDimension_Force32 = 0x7FFFFFFF
+} WGPUTextureViewDimension WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUToneMappingMode {
+    WGPUToneMappingMode_Standard = 0x00000001,
+    WGPUToneMappingMode_Extended = 0x00000002,
+    WGPUToneMappingMode_Force32 = 0x7FFFFFFF
+} WGPUToneMappingMode WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUVertexFormat {
+    WGPUVertexFormat_Uint8 = 0x00000001,
+    WGPUVertexFormat_Uint8x2 = 0x00000002,
+    WGPUVertexFormat_Uint8x4 = 0x00000003,
+    WGPUVertexFormat_Sint8 = 0x00000004,
+    WGPUVertexFormat_Sint8x2 = 0x00000005,
+    WGPUVertexFormat_Sint8x4 = 0x00000006,
+    WGPUVertexFormat_Unorm8 = 0x00000007,
+    WGPUVertexFormat_Unorm8x2 = 0x00000008,
+    WGPUVertexFormat_Unorm8x4 = 0x00000009,
+    WGPUVertexFormat_Snorm8 = 0x0000000A,
+    WGPUVertexFormat_Snorm8x2 = 0x0000000B,
+    WGPUVertexFormat_Snorm8x4 = 0x0000000C,
+    WGPUVertexFormat_Uint16 = 0x0000000D,
+    WGPUVertexFormat_Uint16x2 = 0x0000000E,
+    WGPUVertexFormat_Uint16x4 = 0x0000000F,
+    WGPUVertexFormat_Sint16 = 0x00000010,
+    WGPUVertexFormat_Sint16x2 = 0x00000011,
+    WGPUVertexFormat_Sint16x4 = 0x00000012,
+    WGPUVertexFormat_Unorm16 = 0x00000013,
+    WGPUVertexFormat_Unorm16x2 = 0x00000014,
+    WGPUVertexFormat_Unorm16x4 = 0x00000015,
+    WGPUVertexFormat_Snorm16 = 0x00000016,
+    WGPUVertexFormat_Snorm16x2 = 0x00000017,
+    WGPUVertexFormat_Snorm16x4 = 0x00000018,
+    WGPUVertexFormat_Float16 = 0x00000019,
+    WGPUVertexFormat_Float16x2 = 0x0000001A,
+    WGPUVertexFormat_Float16x4 = 0x0000001B,
+    WGPUVertexFormat_Float32 = 0x0000001C,
+    WGPUVertexFormat_Float32x2 = 0x0000001D,
+    WGPUVertexFormat_Float32x3 = 0x0000001E,
+    WGPUVertexFormat_Float32x4 = 0x0000001F,
+    WGPUVertexFormat_Uint32 = 0x00000020,
+    WGPUVertexFormat_Uint32x2 = 0x00000021,
+    WGPUVertexFormat_Uint32x3 = 0x00000022,
+    WGPUVertexFormat_Uint32x4 = 0x00000023,
+    WGPUVertexFormat_Sint32 = 0x00000024,
+    WGPUVertexFormat_Sint32x2 = 0x00000025,
+    WGPUVertexFormat_Sint32x3 = 0x00000026,
+    WGPUVertexFormat_Sint32x4 = 0x00000027,
+    WGPUVertexFormat_Unorm10_10_10_2 = 0x00000028,
+    WGPUVertexFormat_Unorm8x4BGRA = 0x00000029,
+    WGPUVertexFormat_Snorm10_10_10_2 = 0x0000002A,
+    WGPUVertexFormat_Force32 = 0x7FFFFFFF
+} WGPUVertexFormat WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUVertexStepMode {
+    WGPUVertexStepMode_Undefined = 0x00000000,
+    WGPUVertexStepMode_Vertex = 0x00000001,
+    WGPUVertexStepMode_Instance = 0x00000002,
+    WGPUVertexStepMode_Force32 = 0x7FFFFFFF
+} WGPUVertexStepMode WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUWaitStatus {
+    WGPUWaitStatus_Success = 0x00000001,
+    WGPUWaitStatus_TimedOut = 0x00000002,
+    WGPUWaitStatus_Error = 0x00000003,
+    WGPUWaitStatus_Force32 = 0x7FFFFFFF
+} WGPUWaitStatus WGPU_ENUM_ATTRIBUTE;
+
+typedef enum WGPUWGSLLanguageFeatureName {
+    WGPUWGSLLanguageFeatureName_ReadonlyAndReadwriteStorageTextures = 0x00000001,
+    WGPUWGSLLanguageFeatureName_Packed4x8IntegerDotProduct = 0x00000002,
+    WGPUWGSLLanguageFeatureName_UnrestrictedPointerParameters = 0x00000003,
+    WGPUWGSLLanguageFeatureName_PointerCompositeAccess = 0x00000004,
+    WGPUWGSLLanguageFeatureName_UniformBufferStandardLayout = 0x00000005,
+    WGPUWGSLLanguageFeatureName_SubgroupId = 0x00000006,
+    WGPUWGSLLanguageFeatureName_TextureAndSamplerLet = 0x00000007,
+    WGPUWGSLLanguageFeatureName_SubgroupUniformity = 0x00000008,
+    WGPUWGSLLanguageFeatureName_TextureFormatsTier1 = 0x00000009,
+    WGPUWGSLLanguageFeatureName_LinearIndexing = 0x0000000A,
+    WGPUWGSLLanguageFeatureName_ImmediateAddressSpace = 0x0000000B,
+    WGPUWGSLLanguageFeatureName_BufferView = 0x0000000C,
+    WGPUWGSLLanguageFeatureName_SwizzleAssignment = 0x0000000D,
+    WGPUWGSLLanguageFeatureName_FragmentDepth = 0x0000000E,
+    WGPUWGSLLanguageFeatureName_Force32 = 0x7FFFFFFF
+} WGPUWGSLLanguageFeatureName WGPU_ENUM_ATTRIBUTE;
+
+// NOLINTEND(cppcoreguidelines-use-enum-class)
+
+typedef WGPUFlags WGPUBufferUsage;
+static const WGPUBufferUsage WGPUBufferUsage_None = 0x0000000000000000;
+static const WGPUBufferUsage WGPUBufferUsage_MapRead = 0x0000000000000001;
+static const WGPUBufferUsage WGPUBufferUsage_MapWrite = 0x0000000000000002;
+static const WGPUBufferUsage WGPUBufferUsage_CopySrc = 0x0000000000000004;
+static const WGPUBufferUsage WGPUBufferUsage_CopyDst = 0x0000000000000008;
+static const WGPUBufferUsage WGPUBufferUsage_Index = 0x0000000000000010;
+static const WGPUBufferUsage WGPUBufferUsage_Vertex = 0x0000000000000020;
+static const WGPUBufferUsage WGPUBufferUsage_Uniform = 0x0000000000000040;
+static const WGPUBufferUsage WGPUBufferUsage_Storage = 0x0000000000000080;
+static const WGPUBufferUsage WGPUBufferUsage_Indirect = 0x0000000000000100;
+static const WGPUBufferUsage WGPUBufferUsage_QueryResolve = 0x0000000000000200;
+
+typedef WGPUFlags WGPUColorWriteMask;
+static const WGPUColorWriteMask WGPUColorWriteMask_None = 0x0000000000000000;
+static const WGPUColorWriteMask WGPUColorWriteMask_Red = 0x0000000000000001;
+static const WGPUColorWriteMask WGPUColorWriteMask_Green = 0x0000000000000002;
+static const WGPUColorWriteMask WGPUColorWriteMask_Blue = 0x0000000000000004;
+static const WGPUColorWriteMask WGPUColorWriteMask_Alpha = 0x0000000000000008;
+static const WGPUColorWriteMask WGPUColorWriteMask_All = 0x000000000000000F;
+
+typedef WGPUFlags WGPUMapMode;
+static const WGPUMapMode WGPUMapMode_None = 0x0000000000000000;
+static const WGPUMapMode WGPUMapMode_Read = 0x0000000000000001;
+static const WGPUMapMode WGPUMapMode_Write = 0x0000000000000002;
+
+typedef WGPUFlags WGPUShaderStage;
+static const WGPUShaderStage WGPUShaderStage_None = 0x0000000000000000;
+static const WGPUShaderStage WGPUShaderStage_Vertex = 0x0000000000000001;
+static const WGPUShaderStage WGPUShaderStage_Fragment = 0x0000000000000002;
+static const WGPUShaderStage WGPUShaderStage_Compute = 0x0000000000000004;
+
+typedef WGPUFlags WGPUTextureUsage;
+static const WGPUTextureUsage WGPUTextureUsage_None = 0x0000000000000000;
+static const WGPUTextureUsage WGPUTextureUsage_CopySrc = 0x0000000000000001;
+static const WGPUTextureUsage WGPUTextureUsage_CopyDst = 0x0000000000000002;
+static const WGPUTextureUsage WGPUTextureUsage_TextureBinding = 0x0000000000000004;
+static const WGPUTextureUsage WGPUTextureUsage_StorageBinding = 0x0000000000000008;
+static const WGPUTextureUsage WGPUTextureUsage_RenderAttachment = 0x0000000000000010;
+static const WGPUTextureUsage WGPUTextureUsage_TransientAttachment = 0x0000000000000020;
+
+typedef void (*WGPUProc)(void) WGPU_FUNCTION_ATTRIBUTE;
+
+// Callback function pointers
+typedef void (*WGPUBufferMapCallback)(WGPUMapAsyncStatus status, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef void (*WGPUCompilationInfoCallback)(WGPUCompilationInfoRequestStatus status, struct WGPUCompilationInfo const * compilationInfo, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef void (*WGPUCreateComputePipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline pipeline, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef void (*WGPUCreateRenderPipelineAsyncCallback)(WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline pipeline, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef void (*WGPUDeviceLostCallback)(WGPUDevice const * device, WGPUDeviceLostReason reason, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef void (*WGPUPopErrorScopeCallback)(WGPUPopErrorScopeStatus status, WGPUErrorType type, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef void (*WGPUQueueWorkDoneCallback)(WGPUQueueWorkDoneStatus status, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef void (*WGPURequestAdapterCallback)(WGPURequestAdapterStatus status, WGPUAdapter adapter, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef void (*WGPURequestDeviceCallback)(WGPURequestDeviceStatus status, WGPUDevice device, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef void (*WGPUUncapturedErrorCallback)(WGPUDevice const * device, WGPUErrorType type, WGPUStringView message, WGPU_NULLABLE void* userdata1, WGPU_NULLABLE void* userdata2) WGPU_FUNCTION_ATTRIBUTE;
+
+typedef struct WGPUChainedStruct {
+    struct WGPUChainedStruct * next;
+    WGPUSType sType;
+} WGPUChainedStruct WGPU_STRUCTURE_ATTRIBUTE;
+
+typedef struct WGPUBufferMapCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUCallbackMode mode;
+    WGPUBufferMapCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPUBufferMapCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_BUFFER_MAP_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBufferMapCallbackInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
+    /*.callback=*/NULL _wgpu_COMMA \
+    /*.userdata1=*/NULL _wgpu_COMMA \
+    /*.userdata2=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUCompilationInfoCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUCallbackMode mode;
+    WGPUCompilationInfoCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPUCompilationInfoCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COMPILATION_INFO_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCompilationInfoCallbackInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
+    /*.callback=*/NULL _wgpu_COMMA \
+    /*.userdata1=*/NULL _wgpu_COMMA \
+    /*.userdata2=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUCreateComputePipelineAsyncCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUCallbackMode mode;
+    WGPUCreateComputePipelineAsyncCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPUCreateComputePipelineAsyncCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_CREATE_COMPUTE_PIPELINE_ASYNC_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCreateComputePipelineAsyncCallbackInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
+    /*.callback=*/NULL _wgpu_COMMA \
+    /*.userdata1=*/NULL _wgpu_COMMA \
+    /*.userdata2=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUCreateRenderPipelineAsyncCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUCallbackMode mode;
+    WGPUCreateRenderPipelineAsyncCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPUCreateRenderPipelineAsyncCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_CREATE_RENDER_PIPELINE_ASYNC_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCreateRenderPipelineAsyncCallbackInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
+    /*.callback=*/NULL _wgpu_COMMA \
+    /*.userdata1=*/NULL _wgpu_COMMA \
+    /*.userdata2=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUDeviceLostCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUCallbackMode mode;
+    WGPUDeviceLostCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPUDeviceLostCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_DEVICE_LOST_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDeviceLostCallbackInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
+    /*.callback=*/NULL _wgpu_COMMA \
+    /*.userdata1=*/NULL _wgpu_COMMA \
+    /*.userdata2=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUPopErrorScopeCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUCallbackMode mode;
+    WGPUPopErrorScopeCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPUPopErrorScopeCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_POP_ERROR_SCOPE_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPopErrorScopeCallbackInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
+    /*.callback=*/NULL _wgpu_COMMA \
+    /*.userdata1=*/NULL _wgpu_COMMA \
+    /*.userdata2=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUQueueWorkDoneCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUCallbackMode mode;
+    WGPUQueueWorkDoneCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPUQueueWorkDoneCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_QUEUE_WORK_DONE_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUQueueWorkDoneCallbackInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
+    /*.callback=*/NULL _wgpu_COMMA \
+    /*.userdata1=*/NULL _wgpu_COMMA \
+    /*.userdata2=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPURequestAdapterCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUCallbackMode mode;
+    WGPURequestAdapterCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPURequestAdapterCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_REQUEST_ADAPTER_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestAdapterCallbackInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
+    /*.callback=*/NULL _wgpu_COMMA \
+    /*.userdata1=*/NULL _wgpu_COMMA \
+    /*.userdata2=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPURequestDeviceCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUCallbackMode mode;
+    WGPURequestDeviceCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPURequestDeviceCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_REQUEST_DEVICE_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestDeviceCallbackInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
+    /*.callback=*/NULL _wgpu_COMMA \
+    /*.userdata1=*/NULL _wgpu_COMMA \
+    /*.userdata2=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUUncapturedErrorCallbackInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUUncapturedErrorCallback callback;
+    WGPU_NULLABLE void* userdata1;
+    WGPU_NULLABLE void* userdata2;
+} WGPUUncapturedErrorCallbackInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_UNCAPTURED_ERROR_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUUncapturedErrorCallbackInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.callback=*/NULL _wgpu_COMMA \
+    /*.userdata1=*/NULL _wgpu_COMMA \
+    /*.userdata2=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUBlendComponent {
+    WGPUBlendOperation operation;
+    WGPUBlendFactor srcFactor;
+    WGPUBlendFactor dstFactor;
+} WGPUBlendComponent WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_BLEND_COMPONENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBlendComponent, { \
+    /*.operation=*/WGPUBlendOperation_Undefined _wgpu_COMMA \
+    /*.srcFactor=*/WGPUBlendFactor_Undefined _wgpu_COMMA \
+    /*.dstFactor=*/WGPUBlendFactor_Undefined _wgpu_COMMA \
+})
+
+typedef struct WGPUBufferBindingLayout {
+    WGPUChainedStruct * nextInChain;
+    WGPUBufferBindingType type;
+    WGPUBool hasDynamicOffset;
+    uint64_t minBindingSize;
+} WGPUBufferBindingLayout WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_BUFFER_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBufferBindingLayout, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.type=*/WGPUBufferBindingType_Undefined _wgpu_COMMA \
+    /*.hasDynamicOffset=*/WGPU_FALSE _wgpu_COMMA \
+    /*.minBindingSize=*/0 _wgpu_COMMA \
+})
+
+typedef struct WGPUBufferDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    WGPUBufferUsage usage;
+    uint64_t size;
+    WGPUBool mappedAtCreation;
+} WGPUBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_BUFFER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBufferDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.usage=*/WGPUBufferUsage_None _wgpu_COMMA \
+    /*.size=*/0 _wgpu_COMMA \
+    /*.mappedAtCreation=*/WGPU_FALSE _wgpu_COMMA \
+})
+
+typedef struct WGPUColor {
+    double r;
+    double g;
+    double b;
+    double a;
+} WGPUColor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COLOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUColor, { \
+    /*.r=*/0. _wgpu_COMMA \
+    /*.g=*/0. _wgpu_COMMA \
+    /*.b=*/0. _wgpu_COMMA \
+    /*.a=*/0. _wgpu_COMMA \
+})
+
+typedef struct WGPUCommandBufferDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+} WGPUCommandBufferDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COMMAND_BUFFER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCommandBufferDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPUCommandEncoderDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+} WGPUCommandEncoderDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COMMAND_ENCODER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCommandEncoderDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+})
+
+// Can be chained in WGPULimits
+typedef struct WGPUCompatibilityModeLimits {
+    WGPUChainedStruct chain;
+    uint32_t maxStorageBuffersInVertexStage;
+    uint32_t maxStorageTexturesInVertexStage;
+    uint32_t maxStorageBuffersInFragmentStage;
+    uint32_t maxStorageTexturesInFragmentStage;
+} WGPUCompatibilityModeLimits WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COMPATIBILITY_MODE_LIMITS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCompatibilityModeLimits, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_CompatibilityModeLimits _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.maxStorageBuffersInVertexStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxStorageTexturesInVertexStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxStorageBuffersInFragmentStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxStorageTexturesInFragmentStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+})
+
+typedef struct WGPUConstantEntry {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView key;
+    double value;
+} WGPUConstantEntry WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_CONSTANT_ENTRY_INIT _wgpu_MAKE_INIT_STRUCT(WGPUConstantEntry, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.key=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.value=*/0. _wgpu_COMMA \
+})
+
+// Can be chained in WGPUCompilationMessage
+typedef struct WGPUDawnCompilationMessageUtf16 {
+    WGPUChainedStruct chain;
+    uint64_t linePos;
+    uint64_t offset;
+    uint64_t length;
+} WGPUDawnCompilationMessageUtf16 WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_DAWN_COMPILATION_MESSAGE_UTF16_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDawnCompilationMessageUtf16, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_DawnCompilationMessageUtf16 _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.linePos=*/0 _wgpu_COMMA \
+    /*.offset=*/0 _wgpu_COMMA \
+    /*.length=*/0 _wgpu_COMMA \
+})
+
+// Can be chained in WGPUSurfaceDescriptor
+typedef struct WGPUEmscriptenSurfaceSourceCanvasHTMLSelector {
+    WGPUChainedStruct chain;
+    WGPUStringView selector;
+} WGPUEmscriptenSurfaceSourceCanvasHTMLSelector WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_EMSCRIPTEN_SURFACE_SOURCE_CANVAS_HTML_SELECTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUEmscriptenSurfaceSourceCanvasHTMLSelector, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_EmscriptenSurfaceSourceCanvasHTMLSelector _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.selector=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPUExtent3D {
+    uint32_t width;
+    uint32_t height;
+    uint32_t depthOrArrayLayers;
+} WGPUExtent3D WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_EXTENT_3D_INIT _wgpu_MAKE_INIT_STRUCT(WGPUExtent3D, { \
+    /*.width=*/0 _wgpu_COMMA \
+    /*.height=*/1 _wgpu_COMMA \
+    /*.depthOrArrayLayers=*/1 _wgpu_COMMA \
+})
+
+// Can be chained in WGPUBindGroupEntry
+typedef struct WGPUExternalTextureBindingEntry {
+    WGPUChainedStruct chain;
+    WGPUExternalTexture externalTexture;
+} WGPUExternalTextureBindingEntry WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_EXTERNAL_TEXTURE_BINDING_ENTRY_INIT _wgpu_MAKE_INIT_STRUCT(WGPUExternalTextureBindingEntry, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_ExternalTextureBindingEntry _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.externalTexture=*/NULL _wgpu_COMMA \
+})
+
+// Can be chained in WGPUBindGroupLayoutEntry
+typedef struct WGPUExternalTextureBindingLayout {
+    WGPUChainedStruct chain;
+} WGPUExternalTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_EXTERNAL_TEXTURE_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUExternalTextureBindingLayout, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_ExternalTextureBindingLayout _wgpu_COMMA \
+    }) _wgpu_COMMA \
+})
+
+typedef struct WGPUFuture {
+    uint64_t id;
+} WGPUFuture WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_FUTURE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUFuture, { \
+    /*.id=*/0 _wgpu_COMMA \
+})
+
+typedef struct WGPUInstanceLimits {
+    WGPUChainedStruct * nextInChain;
+    size_t timedWaitAnyMaxCount;
+} WGPUInstanceLimits WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_INSTANCE_LIMITS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUInstanceLimits, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.timedWaitAnyMaxCount=*/0 _wgpu_COMMA \
+})
+
+typedef struct WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER {
+    WGPUBool unused;
+} WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_INTERNAL_HAVE_EMDAWNWEBGPU_HEADER_INIT _wgpu_MAKE_INIT_STRUCT(WGPUINTERNAL_HAVE_EMDAWNWEBGPU_HEADER, { \
+    /*.unused=*/WGPU_FALSE _wgpu_COMMA \
+})
+
+typedef struct WGPUMultisampleState {
+    WGPUChainedStruct * nextInChain;
+    uint32_t count;
+    uint32_t mask;
+    WGPUBool alphaToCoverageEnabled;
+} WGPUMultisampleState WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_MULTISAMPLE_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUMultisampleState, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.count=*/1 _wgpu_COMMA \
+    /*.mask=*/0xFFFFFFFF _wgpu_COMMA \
+    /*.alphaToCoverageEnabled=*/WGPU_FALSE _wgpu_COMMA \
+})
+
+typedef struct WGPUOrigin3D {
+    uint32_t x;
+    uint32_t y;
+    uint32_t z;
+} WGPUOrigin3D WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_ORIGIN_3D_INIT _wgpu_MAKE_INIT_STRUCT(WGPUOrigin3D, { \
+    /*.x=*/0 _wgpu_COMMA \
+    /*.y=*/0 _wgpu_COMMA \
+    /*.z=*/0 _wgpu_COMMA \
+})
+
+typedef struct WGPUPassTimestampWrites {
+    WGPUChainedStruct * nextInChain;
+    WGPUQuerySet querySet;
+    uint32_t beginningOfPassWriteIndex;
+    uint32_t endOfPassWriteIndex;
+} WGPUPassTimestampWrites WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_PASS_TIMESTAMP_WRITES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPassTimestampWrites, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.querySet=*/NULL _wgpu_COMMA \
+    /*.beginningOfPassWriteIndex=*/WGPU_QUERY_SET_INDEX_UNDEFINED _wgpu_COMMA \
+    /*.endOfPassWriteIndex=*/WGPU_QUERY_SET_INDEX_UNDEFINED _wgpu_COMMA \
+})
+
+typedef struct WGPUPipelineLayoutDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    size_t bindGroupLayoutCount;
+    WGPUBindGroupLayout const * bindGroupLayouts;
+    uint32_t immediateSize;
+} WGPUPipelineLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_PIPELINE_LAYOUT_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPipelineLayoutDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.bindGroupLayoutCount=*/0 _wgpu_COMMA \
+    /*.bindGroupLayouts=*/NULL _wgpu_COMMA \
+    /*.immediateSize=*/0 _wgpu_COMMA \
+})
+
+typedef struct WGPUPrimitiveState {
+    WGPUChainedStruct * nextInChain;
+    WGPUPrimitiveTopology topology;
+    WGPUIndexFormat stripIndexFormat;
+    WGPUFrontFace frontFace;
+    WGPUCullMode cullMode;
+    WGPUBool unclippedDepth;
+} WGPUPrimitiveState WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_PRIMITIVE_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPrimitiveState, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.topology=*/WGPUPrimitiveTopology_Undefined _wgpu_COMMA \
+    /*.stripIndexFormat=*/WGPUIndexFormat_Undefined _wgpu_COMMA \
+    /*.frontFace=*/WGPUFrontFace_Undefined _wgpu_COMMA \
+    /*.cullMode=*/WGPUCullMode_Undefined _wgpu_COMMA \
+    /*.unclippedDepth=*/WGPU_FALSE _wgpu_COMMA \
+})
+
+typedef struct WGPUQuerySetDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    WGPUQueryType type;
+    uint32_t count;
+} WGPUQuerySetDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_QUERY_SET_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUQuerySetDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.type=*/_wgpu_ENUM_ZERO_INIT(WGPUQueryType) _wgpu_COMMA \
+    /*.count=*/0 _wgpu_COMMA \
+})
+
+typedef struct WGPUQueueDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+} WGPUQueueDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_QUEUE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUQueueDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPURenderBundleDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+} WGPURenderBundleDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_RENDER_BUNDLE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderBundleDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPURenderBundleEncoderDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    size_t colorFormatCount;
+    WGPUTextureFormat const * colorFormats;
+    WGPUTextureFormat depthStencilFormat;
+    uint32_t sampleCount;
+    WGPUBool depthReadOnly;
+    WGPUBool stencilReadOnly;
+} WGPURenderBundleEncoderDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_RENDER_BUNDLE_ENCODER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderBundleEncoderDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.colorFormatCount=*/0 _wgpu_COMMA \
+    /*.colorFormats=*/NULL _wgpu_COMMA \
+    /*.depthStencilFormat=*/WGPUTextureFormat_Undefined _wgpu_COMMA \
+    /*.sampleCount=*/1 _wgpu_COMMA \
+    /*.depthReadOnly=*/WGPU_FALSE _wgpu_COMMA \
+    /*.stencilReadOnly=*/WGPU_FALSE _wgpu_COMMA \
+})
+
+typedef struct WGPURenderPassDepthStencilAttachment {
+    WGPUChainedStruct * nextInChain;
+    WGPUTextureView view;
+    WGPULoadOp depthLoadOp;
+    WGPUStoreOp depthStoreOp;
+    float depthClearValue;
+    WGPUBool depthReadOnly;
+    WGPULoadOp stencilLoadOp;
+    WGPUStoreOp stencilStoreOp;
+    uint32_t stencilClearValue;
+    WGPUBool stencilReadOnly;
+} WGPURenderPassDepthStencilAttachment WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_RENDER_PASS_DEPTH_STENCIL_ATTACHMENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassDepthStencilAttachment, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.view=*/NULL _wgpu_COMMA \
+    /*.depthLoadOp=*/WGPULoadOp_Undefined _wgpu_COMMA \
+    /*.depthStoreOp=*/WGPUStoreOp_Undefined _wgpu_COMMA \
+    /*.depthClearValue=*/WGPU_DEPTH_CLEAR_VALUE_UNDEFINED _wgpu_COMMA \
+    /*.depthReadOnly=*/WGPU_FALSE _wgpu_COMMA \
+    /*.stencilLoadOp=*/WGPULoadOp_Undefined _wgpu_COMMA \
+    /*.stencilStoreOp=*/WGPUStoreOp_Undefined _wgpu_COMMA \
+    /*.stencilClearValue=*/0 _wgpu_COMMA \
+    /*.stencilReadOnly=*/WGPU_FALSE _wgpu_COMMA \
+})
+
+// Can be chained in WGPURenderPassDescriptor
+typedef struct WGPURenderPassMaxDrawCount {
+    WGPUChainedStruct chain;
+    uint64_t maxDrawCount;
+} WGPURenderPassMaxDrawCount WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_RENDER_PASS_MAX_DRAW_COUNT_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassMaxDrawCount, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_RenderPassMaxDrawCount _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.maxDrawCount=*/50000000 _wgpu_COMMA \
+})
+
+// Can be chained in WGPURequestAdapterOptions
+typedef struct WGPURequestAdapterWebXROptions {
+    WGPUChainedStruct chain;
+    WGPUBool xrCompatible;
+} WGPURequestAdapterWebXROptions WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_REQUEST_ADAPTER_WEBXR_OPTIONS_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestAdapterWebXROptions, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_RequestAdapterWebXROptions _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.xrCompatible=*/WGPU_FALSE _wgpu_COMMA \
+})
+
+typedef struct WGPUSamplerBindingLayout {
+    WGPUChainedStruct * nextInChain;
+    WGPUSamplerBindingType type;
+} WGPUSamplerBindingLayout WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SAMPLER_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSamplerBindingLayout, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.type=*/WGPUSamplerBindingType_Undefined _wgpu_COMMA \
+})
+
+typedef struct WGPUSamplerDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    WGPUAddressMode addressModeU;
+    WGPUAddressMode addressModeV;
+    WGPUAddressMode addressModeW;
+    WGPUFilterMode magFilter;
+    WGPUFilterMode minFilter;
+    WGPUMipmapFilterMode mipmapFilter;
+    float lodMinClamp;
+    float lodMaxClamp;
+    WGPUCompareFunction compare;
+    uint16_t maxAnisotropy;
+} WGPUSamplerDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SAMPLER_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSamplerDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.addressModeU=*/WGPUAddressMode_Undefined _wgpu_COMMA \
+    /*.addressModeV=*/WGPUAddressMode_Undefined _wgpu_COMMA \
+    /*.addressModeW=*/WGPUAddressMode_Undefined _wgpu_COMMA \
+    /*.magFilter=*/WGPUFilterMode_Undefined _wgpu_COMMA \
+    /*.minFilter=*/WGPUFilterMode_Undefined _wgpu_COMMA \
+    /*.mipmapFilter=*/WGPUMipmapFilterMode_Undefined _wgpu_COMMA \
+    /*.lodMinClamp=*/0.f _wgpu_COMMA \
+    /*.lodMaxClamp=*/32.f _wgpu_COMMA \
+    /*.compare=*/WGPUCompareFunction_Undefined _wgpu_COMMA \
+    /*.maxAnisotropy=*/1 _wgpu_COMMA \
+})
+
+// Can be chained in WGPUShaderModuleDescriptor
+typedef struct WGPUShaderSourceSPIRV {
+    WGPUChainedStruct chain;
+    uint32_t codeSize;
+    uint32_t const * code;
+} WGPUShaderSourceSPIRV WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SHADER_SOURCE_SPIRV_INIT _wgpu_MAKE_INIT_STRUCT(WGPUShaderSourceSPIRV, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_ShaderSourceSPIRV _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.codeSize=*/0 _wgpu_COMMA \
+    /*.code=*/NULL _wgpu_COMMA \
+})
+
+// Can be chained in WGPUShaderModuleDescriptor
+typedef struct WGPUShaderSourceWGSL {
+    WGPUChainedStruct chain;
+    WGPUStringView code;
+} WGPUShaderSourceWGSL WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SHADER_SOURCE_WGSL_INIT _wgpu_MAKE_INIT_STRUCT(WGPUShaderSourceWGSL, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_ShaderSourceWGSL _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.code=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPUStencilFaceState {
+    WGPUCompareFunction compare;
+    WGPUStencilOperation failOp;
+    WGPUStencilOperation depthFailOp;
+    WGPUStencilOperation passOp;
+} WGPUStencilFaceState WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_STENCIL_FACE_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUStencilFaceState, { \
+    /*.compare=*/WGPUCompareFunction_Undefined _wgpu_COMMA \
+    /*.failOp=*/WGPUStencilOperation_Undefined _wgpu_COMMA \
+    /*.depthFailOp=*/WGPUStencilOperation_Undefined _wgpu_COMMA \
+    /*.passOp=*/WGPUStencilOperation_Undefined _wgpu_COMMA \
+})
+
+typedef struct WGPUStorageTextureBindingLayout {
+    WGPUChainedStruct * nextInChain;
+    WGPUStorageTextureAccess access;
+    WGPUTextureFormat format;
+    WGPUTextureViewDimension viewDimension;
+} WGPUStorageTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_STORAGE_TEXTURE_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUStorageTextureBindingLayout, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.access=*/WGPUStorageTextureAccess_Undefined _wgpu_COMMA \
+    /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \
+    /*.viewDimension=*/WGPUTextureViewDimension_Undefined _wgpu_COMMA \
+})
+
+typedef struct WGPUSubgroupMatrixConfig {
+    WGPUSubgroupMatrixComponentType componentType;
+    WGPUSubgroupMatrixComponentType resultComponentType;
+    uint32_t M;
+    uint32_t N;
+    uint32_t K;
+    uint32_t minSubgroupSize;
+    uint32_t maxSubgroupSize;
+} WGPUSubgroupMatrixConfig WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SUBGROUP_MATRIX_CONFIG_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSubgroupMatrixConfig, { \
+    /*.componentType=*/_wgpu_ENUM_ZERO_INIT(WGPUSubgroupMatrixComponentType) _wgpu_COMMA \
+    /*.resultComponentType=*/_wgpu_ENUM_ZERO_INIT(WGPUSubgroupMatrixComponentType) _wgpu_COMMA \
+    /*.M=*/0 _wgpu_COMMA \
+    /*.N=*/0 _wgpu_COMMA \
+    /*.K=*/0 _wgpu_COMMA \
+    /*.minSubgroupSize=*/0 _wgpu_COMMA \
+    /*.maxSubgroupSize=*/0 _wgpu_COMMA \
+})
+
+typedef struct WGPUSupportedFeatures {
+    size_t featureCount;
+    WGPUFeatureName const * features;
+} WGPUSupportedFeatures WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SUPPORTED_FEATURES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSupportedFeatures, { \
+    /*.featureCount=*/0 _wgpu_COMMA \
+    /*.features=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUSupportedInstanceFeatures {
+    size_t featureCount;
+    WGPUInstanceFeatureName const * features;
+} WGPUSupportedInstanceFeatures WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SUPPORTED_INSTANCE_FEATURES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSupportedInstanceFeatures, { \
+    /*.featureCount=*/0 _wgpu_COMMA \
+    /*.features=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUSupportedWGSLLanguageFeatures {
+    size_t featureCount;
+    WGPUWGSLLanguageFeatureName const * features;
+} WGPUSupportedWGSLLanguageFeatures WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SUPPORTED_WGSL_LANGUAGE_FEATURES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSupportedWGSLLanguageFeatures, { \
+    /*.featureCount=*/0 _wgpu_COMMA \
+    /*.features=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUSurfaceCapabilities {
+    WGPUChainedStruct * nextInChain;
+    WGPUTextureUsage usages;
+    size_t formatCount;
+    WGPUTextureFormat const * formats;
+    size_t presentModeCount;
+    WGPUPresentMode const * presentModes;
+    size_t alphaModeCount;
+    WGPUCompositeAlphaMode const * alphaModes;
+} WGPUSurfaceCapabilities WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SURFACE_CAPABILITIES_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceCapabilities, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.usages=*/WGPUTextureUsage_None _wgpu_COMMA \
+    /*.formatCount=*/0 _wgpu_COMMA \
+    /*.formats=*/NULL _wgpu_COMMA \
+    /*.presentModeCount=*/0 _wgpu_COMMA \
+    /*.presentModes=*/NULL _wgpu_COMMA \
+    /*.alphaModeCount=*/0 _wgpu_COMMA \
+    /*.alphaModes=*/NULL _wgpu_COMMA \
+})
+
+// Can be chained in WGPUSurfaceDescriptor
+typedef struct WGPUSurfaceColorManagement {
+    WGPUChainedStruct chain;
+    WGPUPredefinedColorSpace colorSpace;
+    WGPUToneMappingMode toneMappingMode;
+} WGPUSurfaceColorManagement WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SURFACE_COLOR_MANAGEMENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceColorManagement, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_SurfaceColorManagement _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.colorSpace=*/_wgpu_ENUM_ZERO_INIT(WGPUPredefinedColorSpace) _wgpu_COMMA \
+    /*.toneMappingMode=*/_wgpu_ENUM_ZERO_INIT(WGPUToneMappingMode) _wgpu_COMMA \
+})
+
+typedef struct WGPUSurfaceConfiguration {
+    WGPUChainedStruct * nextInChain;
+    WGPUDevice device;
+    WGPUTextureFormat format;
+    WGPUTextureUsage usage;
+    uint32_t width;
+    uint32_t height;
+    size_t viewFormatCount;
+    WGPUTextureFormat const * viewFormats;
+    WGPUCompositeAlphaMode alphaMode;
+    WGPUPresentMode presentMode;
+} WGPUSurfaceConfiguration WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SURFACE_CONFIGURATION_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceConfiguration, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.device=*/NULL _wgpu_COMMA \
+    /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \
+    /*.usage=*/WGPUTextureUsage_RenderAttachment _wgpu_COMMA \
+    /*.width=*/0 _wgpu_COMMA \
+    /*.height=*/0 _wgpu_COMMA \
+    /*.viewFormatCount=*/0 _wgpu_COMMA \
+    /*.viewFormats=*/NULL _wgpu_COMMA \
+    /*.alphaMode=*/WGPUCompositeAlphaMode_Auto _wgpu_COMMA \
+    /*.presentMode=*/WGPUPresentMode_Undefined _wgpu_COMMA \
+})
+
+typedef struct WGPUSurfaceTexture {
+    WGPUChainedStruct * nextInChain;
+    WGPUTexture texture;
+    WGPUSurfaceGetCurrentTextureStatus status;
+} WGPUSurfaceTexture WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SURFACE_TEXTURE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceTexture, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.texture=*/NULL _wgpu_COMMA \
+    /*.status=*/_wgpu_ENUM_ZERO_INIT(WGPUSurfaceGetCurrentTextureStatus) _wgpu_COMMA \
+})
+
+typedef struct WGPUTexelCopyBufferLayout {
+    uint64_t offset;
+    uint32_t bytesPerRow;
+    uint32_t rowsPerImage;
+} WGPUTexelCopyBufferLayout WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_TEXEL_COPY_BUFFER_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTexelCopyBufferLayout, { \
+    /*.offset=*/0 _wgpu_COMMA \
+    /*.bytesPerRow=*/WGPU_COPY_STRIDE_UNDEFINED _wgpu_COMMA \
+    /*.rowsPerImage=*/WGPU_COPY_STRIDE_UNDEFINED _wgpu_COMMA \
+})
+
+typedef struct WGPUTextureBindingLayout {
+    WGPUChainedStruct * nextInChain;
+    WGPUTextureSampleType sampleType;
+    WGPUTextureViewDimension viewDimension;
+    WGPUBool multisampled;
+} WGPUTextureBindingLayout WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_TEXTURE_BINDING_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureBindingLayout, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.sampleType=*/WGPUTextureSampleType_Undefined _wgpu_COMMA \
+    /*.viewDimension=*/WGPUTextureViewDimension_Undefined _wgpu_COMMA \
+    /*.multisampled=*/WGPU_FALSE _wgpu_COMMA \
+})
+
+// Can be chained in WGPUTextureDescriptor
+typedef struct WGPUTextureBindingViewDimension {
+    WGPUChainedStruct chain;
+    WGPUTextureViewDimension textureBindingViewDimension;
+} WGPUTextureBindingViewDimension WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_TEXTURE_BINDING_VIEW_DIMENSION_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureBindingViewDimension, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_TextureBindingViewDimension _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.textureBindingViewDimension=*/WGPUTextureViewDimension_Undefined _wgpu_COMMA \
+})
+
+typedef struct WGPUTextureComponentSwizzle {
+    WGPUComponentSwizzle r;
+    WGPUComponentSwizzle g;
+    WGPUComponentSwizzle b;
+    WGPUComponentSwizzle a;
+} WGPUTextureComponentSwizzle WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_TEXTURE_COMPONENT_SWIZZLE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureComponentSwizzle, { \
+    /*.r=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \
+    /*.g=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \
+    /*.b=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \
+    /*.a=*/WGPUComponentSwizzle_Undefined _wgpu_COMMA \
+})
+
+typedef struct WGPUVertexAttribute {
+    WGPUChainedStruct * nextInChain;
+    WGPUVertexFormat format;
+    uint64_t offset;
+    uint32_t shaderLocation;
+} WGPUVertexAttribute WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_VERTEX_ATTRIBUTE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUVertexAttribute, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.format=*/_wgpu_ENUM_ZERO_INIT(WGPUVertexFormat) _wgpu_COMMA \
+    /*.offset=*/0 _wgpu_COMMA \
+    /*.shaderLocation=*/0 _wgpu_COMMA \
+})
+
+// Can be chained in WGPUAdapterInfo
+typedef struct WGPUAdapterPropertiesSubgroupMatrixConfigs {
+    WGPUChainedStruct chain;
+    size_t configCount;
+    WGPUSubgroupMatrixConfig const * configs;
+} WGPUAdapterPropertiesSubgroupMatrixConfigs WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_ADAPTER_PROPERTIES_SUBGROUP_MATRIX_CONFIGS_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterPropertiesSubgroupMatrixConfigs, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_AdapterPropertiesSubgroupMatrixConfigs _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.configCount=*/0 _wgpu_COMMA \
+    /*.configs=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUBindGroupEntry {
+    WGPUChainedStruct * nextInChain;
+    uint32_t binding;
+    WGPU_NULLABLE WGPUBuffer buffer;
+    uint64_t offset;
+    uint64_t size;
+    WGPU_NULLABLE WGPUSampler sampler;
+    WGPU_NULLABLE WGPUTextureView textureView;
+} WGPUBindGroupEntry WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_BIND_GROUP_ENTRY_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBindGroupEntry, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.binding=*/0 _wgpu_COMMA \
+    /*.buffer=*/NULL _wgpu_COMMA \
+    /*.offset=*/0 _wgpu_COMMA \
+    /*.size=*/WGPU_WHOLE_SIZE _wgpu_COMMA \
+    /*.sampler=*/NULL _wgpu_COMMA \
+    /*.textureView=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUBindGroupLayoutEntry {
+    WGPUChainedStruct * nextInChain;
+    uint32_t binding;
+    WGPUShaderStage visibility;
+    uint32_t bindingArraySize;
+    WGPUBufferBindingLayout buffer;
+    WGPUSamplerBindingLayout sampler;
+    WGPUTextureBindingLayout texture;
+    WGPUStorageTextureBindingLayout storageTexture;
+} WGPUBindGroupLayoutEntry WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_BIND_GROUP_LAYOUT_ENTRY_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBindGroupLayoutEntry, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.binding=*/0 _wgpu_COMMA \
+    /*.visibility=*/WGPUShaderStage_None _wgpu_COMMA \
+    /*.bindingArraySize=*/0 _wgpu_COMMA \
+    /*.buffer=*/_wgpu_STRUCT_ZERO_INIT _wgpu_COMMA \
+    /*.sampler=*/_wgpu_STRUCT_ZERO_INIT _wgpu_COMMA \
+    /*.texture=*/_wgpu_STRUCT_ZERO_INIT _wgpu_COMMA \
+    /*.storageTexture=*/_wgpu_STRUCT_ZERO_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPUBlendState {
+    WGPUBlendComponent color;
+    WGPUBlendComponent alpha;
+} WGPUBlendState WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_BLEND_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBlendState, { \
+    /*.color=*/WGPU_BLEND_COMPONENT_INIT _wgpu_COMMA \
+    /*.alpha=*/WGPU_BLEND_COMPONENT_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPUCompilationMessage {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView message;
+    WGPUCompilationMessageType type;
+    uint64_t lineNum;
+    uint64_t linePos;
+    uint64_t offset;
+    uint64_t length;
+} WGPUCompilationMessage WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COMPILATION_MESSAGE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCompilationMessage, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.message=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.type=*/_wgpu_ENUM_ZERO_INIT(WGPUCompilationMessageType) _wgpu_COMMA \
+    /*.lineNum=*/0 _wgpu_COMMA \
+    /*.linePos=*/0 _wgpu_COMMA \
+    /*.offset=*/0 _wgpu_COMMA \
+    /*.length=*/0 _wgpu_COMMA \
+})
+
+typedef struct WGPUComputePassDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    WGPU_NULLABLE WGPUPassTimestampWrites const * timestampWrites;
+} WGPUComputePassDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COMPUTE_PASS_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUComputePassDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.timestampWrites=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUComputeState {
+    WGPUChainedStruct * nextInChain;
+    WGPUShaderModule module;
+    WGPUStringView entryPoint;
+    size_t constantCount;
+    WGPUConstantEntry const * constants;
+} WGPUComputeState WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COMPUTE_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUComputeState, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.module=*/NULL _wgpu_COMMA \
+    /*.entryPoint=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.constantCount=*/0 _wgpu_COMMA \
+    /*.constants=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUDepthStencilState {
+    WGPUChainedStruct * nextInChain;
+    WGPUTextureFormat format;
+    WGPUOptionalBool depthWriteEnabled;
+    WGPUCompareFunction depthCompare;
+    WGPUStencilFaceState stencilFront;
+    WGPUStencilFaceState stencilBack;
+    uint32_t stencilReadMask;
+    uint32_t stencilWriteMask;
+    int32_t depthBias;
+    float depthBiasSlopeScale;
+    float depthBiasClamp;
+} WGPUDepthStencilState WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_DEPTH_STENCIL_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDepthStencilState, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \
+    /*.depthWriteEnabled=*/WGPUOptionalBool_Undefined _wgpu_COMMA \
+    /*.depthCompare=*/WGPUCompareFunction_Undefined _wgpu_COMMA \
+    /*.stencilFront=*/WGPU_STENCIL_FACE_STATE_INIT _wgpu_COMMA \
+    /*.stencilBack=*/WGPU_STENCIL_FACE_STATE_INIT _wgpu_COMMA \
+    /*.stencilReadMask=*/0xFFFFFFFF _wgpu_COMMA \
+    /*.stencilWriteMask=*/0xFFFFFFFF _wgpu_COMMA \
+    /*.depthBias=*/0 _wgpu_COMMA \
+    /*.depthBiasSlopeScale=*/0.f _wgpu_COMMA \
+    /*.depthBiasClamp=*/0.f _wgpu_COMMA \
+})
+
+typedef struct WGPUFutureWaitInfo {
+    WGPUFuture future;
+    WGPUBool completed;
+} WGPUFutureWaitInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_FUTURE_WAIT_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUFutureWaitInfo, { \
+    /*.future=*/WGPU_FUTURE_INIT _wgpu_COMMA \
+    /*.completed=*/WGPU_FALSE _wgpu_COMMA \
+})
+
+typedef struct WGPUInstanceDescriptor {
+    WGPUChainedStruct * nextInChain;
+    size_t requiredFeatureCount;
+    WGPUInstanceFeatureName const * requiredFeatures;
+    WGPU_NULLABLE WGPUInstanceLimits const * requiredLimits;
+} WGPUInstanceDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_INSTANCE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUInstanceDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.requiredFeatureCount=*/0 _wgpu_COMMA \
+    /*.requiredFeatures=*/NULL _wgpu_COMMA \
+    /*.requiredLimits=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPULimits {
+    WGPUChainedStruct * nextInChain;
+    uint32_t maxTextureDimension1D;
+    uint32_t maxTextureDimension2D;
+    uint32_t maxTextureDimension3D;
+    uint32_t maxTextureArrayLayers;
+    uint32_t maxBindGroups;
+    uint32_t maxBindGroupsPlusVertexBuffers;
+    uint32_t maxBindingsPerBindGroup;
+    uint32_t maxDynamicUniformBuffersPerPipelineLayout;
+    uint32_t maxDynamicStorageBuffersPerPipelineLayout;
+    uint32_t maxSampledTexturesPerShaderStage;
+    uint32_t maxSamplersPerShaderStage;
+    uint32_t maxStorageBuffersPerShaderStage;
+    uint32_t maxStorageTexturesPerShaderStage;
+    uint32_t maxUniformBuffersPerShaderStage;
+    uint64_t maxUniformBufferBindingSize;
+    uint64_t maxStorageBufferBindingSize;
+    uint32_t minUniformBufferOffsetAlignment;
+    uint32_t minStorageBufferOffsetAlignment;
+    uint32_t maxVertexBuffers;
+    uint64_t maxBufferSize;
+    uint32_t maxVertexAttributes;
+    uint32_t maxVertexBufferArrayStride;
+    uint32_t maxInterStageShaderVariables;
+    uint32_t maxColorAttachments;
+    uint32_t maxColorAttachmentBytesPerSample;
+    uint32_t maxComputeWorkgroupStorageSize;
+    uint32_t maxComputeInvocationsPerWorkgroup;
+    uint32_t maxComputeWorkgroupSizeX;
+    uint32_t maxComputeWorkgroupSizeY;
+    uint32_t maxComputeWorkgroupSizeZ;
+    uint32_t maxComputeWorkgroupsPerDimension;
+    uint32_t maxImmediateSize;
+} WGPULimits WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_LIMITS_INIT _wgpu_MAKE_INIT_STRUCT(WGPULimits, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.maxTextureDimension1D=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxTextureDimension2D=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxTextureDimension3D=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxTextureArrayLayers=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxBindGroups=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxBindGroupsPlusVertexBuffers=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxBindingsPerBindGroup=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxDynamicUniformBuffersPerPipelineLayout=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxDynamicStorageBuffersPerPipelineLayout=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxSampledTexturesPerShaderStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxSamplersPerShaderStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxStorageBuffersPerShaderStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxStorageTexturesPerShaderStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxUniformBuffersPerShaderStage=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxUniformBufferBindingSize=*/WGPU_LIMIT_U64_UNDEFINED _wgpu_COMMA \
+    /*.maxStorageBufferBindingSize=*/WGPU_LIMIT_U64_UNDEFINED _wgpu_COMMA \
+    /*.minUniformBufferOffsetAlignment=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.minStorageBufferOffsetAlignment=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxVertexBuffers=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxBufferSize=*/WGPU_LIMIT_U64_UNDEFINED _wgpu_COMMA \
+    /*.maxVertexAttributes=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxVertexBufferArrayStride=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxInterStageShaderVariables=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxColorAttachments=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxColorAttachmentBytesPerSample=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxComputeWorkgroupStorageSize=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxComputeInvocationsPerWorkgroup=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxComputeWorkgroupSizeX=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxComputeWorkgroupSizeY=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxComputeWorkgroupSizeZ=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxComputeWorkgroupsPerDimension=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+    /*.maxImmediateSize=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
+})
+
+typedef struct WGPURenderPassColorAttachment {
+    WGPUChainedStruct * nextInChain;
+    WGPU_NULLABLE WGPUTextureView view;
+    uint32_t depthSlice;
+    WGPU_NULLABLE WGPUTextureView resolveTarget;
+    WGPULoadOp loadOp;
+    WGPUStoreOp storeOp;
+    WGPUColor clearValue;
+} WGPURenderPassColorAttachment WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_RENDER_PASS_COLOR_ATTACHMENT_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassColorAttachment, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.view=*/NULL _wgpu_COMMA \
+    /*.depthSlice=*/WGPU_DEPTH_SLICE_UNDEFINED _wgpu_COMMA \
+    /*.resolveTarget=*/NULL _wgpu_COMMA \
+    /*.loadOp=*/WGPULoadOp_Undefined _wgpu_COMMA \
+    /*.storeOp=*/WGPUStoreOp_Undefined _wgpu_COMMA \
+    /*.clearValue=*/WGPU_COLOR_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPURequestAdapterOptions {
+    WGPUChainedStruct * nextInChain;
+    WGPUFeatureLevel featureLevel;
+    WGPUPowerPreference powerPreference;
+    WGPUBool forceFallbackAdapter;
+    WGPUBackendType backendType;
+    WGPU_NULLABLE WGPUSurface compatibleSurface;
+} WGPURequestAdapterOptions WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_REQUEST_ADAPTER_OPTIONS_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestAdapterOptions, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.featureLevel=*/WGPUFeatureLevel_Undefined _wgpu_COMMA \
+    /*.powerPreference=*/WGPUPowerPreference_Undefined _wgpu_COMMA \
+    /*.forceFallbackAdapter=*/WGPU_FALSE _wgpu_COMMA \
+    /*.backendType=*/WGPUBackendType_Undefined _wgpu_COMMA \
+    /*.compatibleSurface=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUShaderModuleDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+} WGPUShaderModuleDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SHADER_MODULE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUShaderModuleDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPUSurfaceDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+} WGPUSurfaceDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_SURFACE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUSurfaceDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPUTexelCopyBufferInfo {
+    WGPUTexelCopyBufferLayout layout;
+    WGPUBuffer buffer;
+} WGPUTexelCopyBufferInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_TEXEL_COPY_BUFFER_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTexelCopyBufferInfo, { \
+    /*.layout=*/WGPU_TEXEL_COPY_BUFFER_LAYOUT_INIT _wgpu_COMMA \
+    /*.buffer=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUTexelCopyTextureInfo {
+    WGPUTexture texture;
+    uint32_t mipLevel;
+    WGPUOrigin3D origin;
+    WGPUTextureAspect aspect;
+} WGPUTexelCopyTextureInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_TEXEL_COPY_TEXTURE_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTexelCopyTextureInfo, { \
+    /*.texture=*/NULL _wgpu_COMMA \
+    /*.mipLevel=*/0 _wgpu_COMMA \
+    /*.origin=*/WGPU_ORIGIN_3D_INIT _wgpu_COMMA \
+    /*.aspect=*/WGPUTextureAspect_Undefined _wgpu_COMMA \
+})
+
+// Can be chained in WGPUTextureViewDescriptor
+typedef struct WGPUTextureComponentSwizzleDescriptor {
+    WGPUChainedStruct chain;
+    WGPUTextureComponentSwizzle swizzle;
+} WGPUTextureComponentSwizzleDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_TEXTURE_COMPONENT_SWIZZLE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureComponentSwizzleDescriptor, { \
+    /*.chain=*/_wgpu_MAKE_INIT_STRUCT(WGPUChainedStruct, { \
+        /*.next=*/NULL _wgpu_COMMA \
+        /*.sType=*/WGPUSType_TextureComponentSwizzleDescriptor _wgpu_COMMA \
+    }) _wgpu_COMMA \
+    /*.swizzle=*/WGPU_TEXTURE_COMPONENT_SWIZZLE_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPUTextureDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    WGPUTextureUsage usage;
+    WGPUTextureDimension dimension;
+    WGPUExtent3D size;
+    WGPUTextureFormat format;
+    uint32_t mipLevelCount;
+    uint32_t sampleCount;
+    size_t viewFormatCount;
+    WGPUTextureFormat const * viewFormats;
+} WGPUTextureDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_TEXTURE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.usage=*/WGPUTextureUsage_None _wgpu_COMMA \
+    /*.dimension=*/WGPUTextureDimension_Undefined _wgpu_COMMA \
+    /*.size=*/WGPU_EXTENT_3D_INIT _wgpu_COMMA \
+    /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \
+    /*.mipLevelCount=*/1 _wgpu_COMMA \
+    /*.sampleCount=*/1 _wgpu_COMMA \
+    /*.viewFormatCount=*/0 _wgpu_COMMA \
+    /*.viewFormats=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUVertexBufferLayout {
+    WGPUChainedStruct * nextInChain;
+    WGPUVertexStepMode stepMode;
+    uint64_t arrayStride;
+    size_t attributeCount;
+    WGPUVertexAttribute const * attributes;
+} WGPUVertexBufferLayout WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_VERTEX_BUFFER_LAYOUT_INIT _wgpu_MAKE_INIT_STRUCT(WGPUVertexBufferLayout, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.stepMode=*/WGPUVertexStepMode_Undefined _wgpu_COMMA \
+    /*.arrayStride=*/0 _wgpu_COMMA \
+    /*.attributeCount=*/0 _wgpu_COMMA \
+    /*.attributes=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUAdapterInfo {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView vendor;
+    WGPUStringView architecture;
+    WGPUStringView device;
+    WGPUStringView description;
+    WGPUBackendType backendType;
+    WGPUAdapterType adapterType;
+    uint32_t vendorID;
+    uint32_t deviceID;
+    uint32_t subgroupMinSize;
+    uint32_t subgroupMaxSize;
+} WGPUAdapterInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_ADAPTER_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUAdapterInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.vendor=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.architecture=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.device=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.description=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.backendType=*/WGPUBackendType_Undefined _wgpu_COMMA \
+    /*.adapterType=*/_wgpu_ENUM_ZERO_INIT(WGPUAdapterType) _wgpu_COMMA \
+    /*.vendorID=*/0 _wgpu_COMMA \
+    /*.deviceID=*/0 _wgpu_COMMA \
+    /*.subgroupMinSize=*/0 _wgpu_COMMA \
+    /*.subgroupMaxSize=*/0 _wgpu_COMMA \
+})
+
+typedef struct WGPUBindGroupDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    WGPUBindGroupLayout layout;
+    size_t entryCount;
+    WGPUBindGroupEntry const * entries;
+} WGPUBindGroupDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_BIND_GROUP_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBindGroupDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.layout=*/NULL _wgpu_COMMA \
+    /*.entryCount=*/0 _wgpu_COMMA \
+    /*.entries=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUBindGroupLayoutDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    size_t entryCount;
+    WGPUBindGroupLayoutEntry const * entries;
+} WGPUBindGroupLayoutDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_BIND_GROUP_LAYOUT_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBindGroupLayoutDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.entryCount=*/0 _wgpu_COMMA \
+    /*.entries=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUColorTargetState {
+    WGPUChainedStruct * nextInChain;
+    WGPUTextureFormat format;
+    WGPU_NULLABLE WGPUBlendState const * blend;
+    WGPUColorWriteMask writeMask;
+} WGPUColorTargetState WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COLOR_TARGET_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUColorTargetState, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \
+    /*.blend=*/NULL _wgpu_COMMA \
+    /*.writeMask=*/WGPUColorWriteMask_All _wgpu_COMMA \
+})
+
+typedef struct WGPUCompilationInfo {
+    WGPUChainedStruct * nextInChain;
+    size_t messageCount;
+    WGPUCompilationMessage const * messages;
+} WGPUCompilationInfo WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COMPILATION_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCompilationInfo, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.messageCount=*/0 _wgpu_COMMA \
+    /*.messages=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUComputePipelineDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    WGPU_NULLABLE WGPUPipelineLayout layout;
+    WGPUComputeState compute;
+} WGPUComputePipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_COMPUTE_PIPELINE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUComputePipelineDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.layout=*/NULL _wgpu_COMMA \
+    /*.compute=*/WGPU_COMPUTE_STATE_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPUDeviceDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    size_t requiredFeatureCount;
+    WGPUFeatureName const * requiredFeatures;
+    WGPU_NULLABLE WGPULimits const * requiredLimits;
+    WGPUQueueDescriptor defaultQueue;
+    WGPUDeviceLostCallbackInfo deviceLostCallbackInfo;
+    WGPUUncapturedErrorCallbackInfo uncapturedErrorCallbackInfo;
+} WGPUDeviceDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_DEVICE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDeviceDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.requiredFeatureCount=*/0 _wgpu_COMMA \
+    /*.requiredFeatures=*/NULL _wgpu_COMMA \
+    /*.requiredLimits=*/NULL _wgpu_COMMA \
+    /*.defaultQueue=*/WGPU_QUEUE_DESCRIPTOR_INIT _wgpu_COMMA \
+    /*.deviceLostCallbackInfo=*/WGPU_DEVICE_LOST_CALLBACK_INFO_INIT _wgpu_COMMA \
+    /*.uncapturedErrorCallbackInfo=*/WGPU_UNCAPTURED_ERROR_CALLBACK_INFO_INIT _wgpu_COMMA \
+})
+
+typedef struct WGPURenderPassDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    size_t colorAttachmentCount;
+    WGPURenderPassColorAttachment const * colorAttachments;
+    WGPU_NULLABLE WGPURenderPassDepthStencilAttachment const * depthStencilAttachment;
+    WGPU_NULLABLE WGPUQuerySet occlusionQuerySet;
+    WGPU_NULLABLE WGPUPassTimestampWrites const * timestampWrites;
+} WGPURenderPassDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_RENDER_PASS_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPassDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.colorAttachmentCount=*/0 _wgpu_COMMA \
+    /*.colorAttachments=*/NULL _wgpu_COMMA \
+    /*.depthStencilAttachment=*/NULL _wgpu_COMMA \
+    /*.occlusionQuerySet=*/NULL _wgpu_COMMA \
+    /*.timestampWrites=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUTextureViewDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    WGPUTextureFormat format;
+    WGPUTextureViewDimension dimension;
+    uint32_t baseMipLevel;
+    uint32_t mipLevelCount;
+    uint32_t baseArrayLayer;
+    uint32_t arrayLayerCount;
+    WGPUTextureAspect aspect;
+    WGPUTextureUsage usage;
+} WGPUTextureViewDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_TEXTURE_VIEW_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPUTextureViewDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.format=*/WGPUTextureFormat_Undefined _wgpu_COMMA \
+    /*.dimension=*/WGPUTextureViewDimension_Undefined _wgpu_COMMA \
+    /*.baseMipLevel=*/0 _wgpu_COMMA \
+    /*.mipLevelCount=*/WGPU_MIP_LEVEL_COUNT_UNDEFINED _wgpu_COMMA \
+    /*.baseArrayLayer=*/0 _wgpu_COMMA \
+    /*.arrayLayerCount=*/WGPU_ARRAY_LAYER_COUNT_UNDEFINED _wgpu_COMMA \
+    /*.aspect=*/WGPUTextureAspect_Undefined _wgpu_COMMA \
+    /*.usage=*/WGPUTextureUsage_None _wgpu_COMMA \
+})
+
+typedef struct WGPUVertexState {
+    WGPUChainedStruct * nextInChain;
+    WGPUShaderModule module;
+    WGPUStringView entryPoint;
+    size_t constantCount;
+    WGPUConstantEntry const * constants;
+    size_t bufferCount;
+    WGPUVertexBufferLayout const * buffers;
+} WGPUVertexState WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_VERTEX_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUVertexState, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.module=*/NULL _wgpu_COMMA \
+    /*.entryPoint=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.constantCount=*/0 _wgpu_COMMA \
+    /*.constants=*/NULL _wgpu_COMMA \
+    /*.bufferCount=*/0 _wgpu_COMMA \
+    /*.buffers=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPUFragmentState {
+    WGPUChainedStruct * nextInChain;
+    WGPUShaderModule module;
+    WGPUStringView entryPoint;
+    size_t constantCount;
+    WGPUConstantEntry const * constants;
+    size_t targetCount;
+    WGPUColorTargetState const * targets;
+} WGPUFragmentState WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_FRAGMENT_STATE_INIT _wgpu_MAKE_INIT_STRUCT(WGPUFragmentState, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.module=*/NULL _wgpu_COMMA \
+    /*.entryPoint=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.constantCount=*/0 _wgpu_COMMA \
+    /*.constants=*/NULL _wgpu_COMMA \
+    /*.targetCount=*/0 _wgpu_COMMA \
+    /*.targets=*/NULL _wgpu_COMMA \
+})
+
+typedef struct WGPURenderPipelineDescriptor {
+    WGPUChainedStruct * nextInChain;
+    WGPUStringView label;
+    WGPU_NULLABLE WGPUPipelineLayout layout;
+    WGPUVertexState vertex;
+    WGPUPrimitiveState primitive;
+    WGPU_NULLABLE WGPUDepthStencilState const * depthStencil;
+    WGPUMultisampleState multisample;
+    WGPU_NULLABLE WGPUFragmentState const * fragment;
+} WGPURenderPipelineDescriptor WGPU_STRUCTURE_ATTRIBUTE;
+
+#define WGPU_RENDER_PIPELINE_DESCRIPTOR_INIT _wgpu_MAKE_INIT_STRUCT(WGPURenderPipelineDescriptor, { \
+    /*.nextInChain=*/NULL _wgpu_COMMA \
+    /*.label=*/WGPU_STRING_VIEW_INIT _wgpu_COMMA \
+    /*.layout=*/NULL _wgpu_COMMA \
+    /*.vertex=*/WGPU_VERTEX_STATE_INIT _wgpu_COMMA \
+    /*.primitive=*/WGPU_PRIMITIVE_STATE_INIT _wgpu_COMMA \
+    /*.depthStencil=*/NULL _wgpu_COMMA \
+    /*.multisample=*/WGPU_MULTISAMPLE_STATE_INIT _wgpu_COMMA \
+    /*.fragment=*/NULL _wgpu_COMMA \
+})
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(WGPU_SKIP_PROCS)
+// TODO(374150686): Remove these Emscripten specific declarations from the
+// header once they are fully deprecated.
+WGPU_EXPORT WGPUDevice emscripten_webgpu_get_device(void);
+// Global procs
+typedef WGPUInstance (*WGPUProcCreateInstance)(WGPU_NULLABLE WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcGetInstanceFeatures)(WGPUSupportedInstanceFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUStatus (*WGPUProcGetInstanceLimits)(WGPUInstanceLimits * limits) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUBool (*WGPUProcHasInstanceFeature)(WGPUInstanceFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUProc (*WGPUProcGetProcAddress)(WGPUStringView procName) WGPU_FUNCTION_ATTRIBUTE;
+
+
+// Procs of Adapter
+typedef void (*WGPUProcAdapterGetFeatures)(WGPUAdapter adapter, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUStatus (*WGPUProcAdapterGetInfo)(WGPUAdapter adapter, WGPUAdapterInfo * info) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUStatus (*WGPUProcAdapterGetLimits)(WGPUAdapter adapter, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUBool (*WGPUProcAdapterHasFeature)(WGPUAdapter adapter, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUFuture (*WGPUProcAdapterRequestDevice)(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcAdapterAddRef)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcAdapterRelease)(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of AdapterInfo
+typedef void (*WGPUProcAdapterInfoFreeMembers)(WGPUAdapterInfo adapterInfo) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of AdapterPropertiesSubgroupMatrixConfigs
+typedef void (*WGPUProcAdapterPropertiesSubgroupMatrixConfigsFreeMembers)(WGPUAdapterPropertiesSubgroupMatrixConfigs adapterPropertiesSubgroupMatrixConfigs) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of BindGroup
+typedef void (*WGPUProcBindGroupSetLabel)(WGPUBindGroup bindGroup, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcBindGroupAddRef)(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcBindGroupRelease)(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of BindGroupLayout
+typedef void (*WGPUProcBindGroupLayoutSetLabel)(WGPUBindGroupLayout bindGroupLayout, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcBindGroupLayoutAddRef)(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcBindGroupLayoutRelease)(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of Buffer
+typedef void (*WGPUProcBufferDestroy)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+typedef void const * (*WGPUProcBufferGetConstMappedRange)(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void * (*WGPUProcBufferGetMappedRange)(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUBufferMapState (*WGPUProcBufferGetMapState)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+typedef uint64_t (*WGPUProcBufferGetSize)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUBufferUsage (*WGPUProcBufferGetUsage)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUFuture (*WGPUProcBufferMapAsync)(WGPUBuffer buffer, WGPUMapMode mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUStatus (*WGPUProcBufferReadMappedRange)(WGPUBuffer buffer, size_t offset, void * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcBufferSetLabel)(WGPUBuffer buffer, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcBufferUnmap)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUStatus (*WGPUProcBufferWriteMappedRange)(WGPUBuffer buffer, size_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcBufferAddRef)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcBufferRelease)(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of CommandBuffer
+typedef void (*WGPUProcCommandBufferSetLabel)(WGPUCommandBuffer commandBuffer, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandBufferAddRef)(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandBufferRelease)(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of CommandEncoder
+typedef WGPUComputePassEncoder (*WGPUProcCommandEncoderBeginComputePass)(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUComputePassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPURenderPassEncoder (*WGPUProcCommandEncoderBeginRenderPass)(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderClearBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderCopyBufferToBuffer)(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderCopyBufferToTexture)(WGPUCommandEncoder commandEncoder, WGPUTexelCopyBufferInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderCopyTextureToBuffer)(WGPUCommandEncoder commandEncoder, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyBufferInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderCopyTextureToTexture)(WGPUCommandEncoder commandEncoder, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUCommandBuffer (*WGPUProcCommandEncoderFinish)(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUCommandBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderInsertDebugMarker)(WGPUCommandEncoder commandEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderPopDebugGroup)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderPushDebugGroup)(WGPUCommandEncoder commandEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderResolveQuerySet)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderSetLabel)(WGPUCommandEncoder commandEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderWriteTimestamp)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderAddRef)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcCommandEncoderRelease)(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of ComputePassEncoder
+typedef void (*WGPUProcComputePassEncoderDispatchWorkgroups)(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderDispatchWorkgroupsIndirect)(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderEnd)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderInsertDebugMarker)(WGPUComputePassEncoder computePassEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderPopDebugGroup)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderPushDebugGroup)(WGPUComputePassEncoder computePassEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderSetBindGroup)(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderSetImmediates)(WGPUComputePassEncoder computePassEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderSetLabel)(WGPUComputePassEncoder computePassEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderSetPipeline)(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderWriteTimestamp)(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderAddRef)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePassEncoderRelease)(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of ComputePipeline
+typedef WGPUBindGroupLayout (*WGPUProcComputePipelineGetBindGroupLayout)(WGPUComputePipeline computePipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePipelineSetLabel)(WGPUComputePipeline computePipeline, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePipelineAddRef)(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcComputePipelineRelease)(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of Device
+typedef WGPUBindGroup (*WGPUProcDeviceCreateBindGroup)(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUBindGroupLayout (*WGPUProcDeviceCreateBindGroupLayout)(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPU_NULLABLE WGPUBuffer (*WGPUProcDeviceCreateBuffer)(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUCommandEncoder (*WGPUProcDeviceCreateCommandEncoder)(WGPUDevice device, WGPU_NULLABLE WGPUCommandEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUComputePipeline (*WGPUProcDeviceCreateComputePipeline)(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUFuture (*WGPUProcDeviceCreateComputePipelineAsync)(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUPipelineLayout (*WGPUProcDeviceCreatePipelineLayout)(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUQuerySet (*WGPUProcDeviceCreateQuerySet)(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPURenderBundleEncoder (*WGPUProcDeviceCreateRenderBundleEncoder)(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPURenderPipeline (*WGPUProcDeviceCreateRenderPipeline)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUFuture (*WGPUProcDeviceCreateRenderPipelineAsync)(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUSampler (*WGPUProcDeviceCreateSampler)(WGPUDevice device, WGPU_NULLABLE WGPUSamplerDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUShaderModule (*WGPUProcDeviceCreateShaderModule)(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUTexture (*WGPUProcDeviceCreateTexture)(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcDeviceDestroy)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUStatus (*WGPUProcDeviceGetAdapterInfo)(WGPUDevice device, WGPUAdapterInfo * adapterInfo) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcDeviceGetFeatures)(WGPUDevice device, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUStatus (*WGPUProcDeviceGetLimits)(WGPUDevice device, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUFuture (*WGPUProcDeviceGetLostFuture)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUQueue (*WGPUProcDeviceGetQueue)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUBool (*WGPUProcDeviceHasFeature)(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUFuture (*WGPUProcDevicePopErrorScope)(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcDevicePushErrorScope)(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcDeviceSetLabel)(WGPUDevice device, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcDeviceAddRef)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcDeviceRelease)(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of ExternalTexture
+typedef void (*WGPUProcExternalTextureSetLabel)(WGPUExternalTexture externalTexture, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcExternalTextureAddRef)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcExternalTextureRelease)(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of Instance
+typedef WGPUSurface (*WGPUProcInstanceCreateSurface)(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcInstanceGetWGSLLanguageFeatures)(WGPUInstance instance, WGPUSupportedWGSLLanguageFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUBool (*WGPUProcInstanceHasWGSLLanguageFeature)(WGPUInstance instance, WGPUWGSLLanguageFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcInstanceProcessEvents)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUFuture (*WGPUProcInstanceRequestAdapter)(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUWaitStatus (*WGPUProcInstanceWaitAny)(WGPUInstance instance, size_t futureCount, WGPU_NULLABLE WGPUFutureWaitInfo * futures, uint64_t timeoutNS) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcInstanceAddRef)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcInstanceRelease)(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of PipelineLayout
+typedef void (*WGPUProcPipelineLayoutSetLabel)(WGPUPipelineLayout pipelineLayout, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcPipelineLayoutAddRef)(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcPipelineLayoutRelease)(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of QuerySet
+typedef void (*WGPUProcQuerySetDestroy)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
+typedef uint32_t (*WGPUProcQuerySetGetCount)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUQueryType (*WGPUProcQuerySetGetType)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcQuerySetSetLabel)(WGPUQuerySet querySet, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcQuerySetAddRef)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcQuerySetRelease)(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of Queue
+typedef WGPUFuture (*WGPUProcQueueOnSubmittedWorkDone)(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcQueueSetLabel)(WGPUQueue queue, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcQueueSubmit)(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcQueueWriteBuffer)(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcQueueWriteTexture)(WGPUQueue queue, WGPUTexelCopyTextureInfo const * destination, void const * data, size_t dataSize, WGPUTexelCopyBufferLayout const * dataLayout, WGPUExtent3D const * writeSize) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcQueueAddRef)(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcQueueRelease)(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of RenderBundle
+typedef void (*WGPUProcRenderBundleSetLabel)(WGPURenderBundle renderBundle, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleAddRef)(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleRelease)(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of RenderBundleEncoder
+typedef void (*WGPUProcRenderBundleEncoderDraw)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderDrawIndexed)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderDrawIndexedIndirect)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderDrawIndirect)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPURenderBundle (*WGPUProcRenderBundleEncoderFinish)(WGPURenderBundleEncoder renderBundleEncoder, WGPU_NULLABLE WGPURenderBundleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderInsertDebugMarker)(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderPopDebugGroup)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderPushDebugGroup)(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderSetBindGroup)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderSetImmediates)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderSetIndexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderSetLabel)(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderSetPipeline)(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderSetVertexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderAddRef)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderBundleEncoderRelease)(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of RenderPassEncoder
+typedef void (*WGPUProcRenderPassEncoderBeginOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderDraw)(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderDrawIndexed)(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderDrawIndexedIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderDrawIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderEnd)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderEndOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderExecuteBundles)(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, WGPURenderBundle const * bundles) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderInsertDebugMarker)(WGPURenderPassEncoder renderPassEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderMultiDrawIndexedIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPU_NULLABLE WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderMultiDrawIndirect)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPU_NULLABLE WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderPopDebugGroup)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderPushDebugGroup)(WGPURenderPassEncoder renderPassEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderSetBindGroup)(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderSetBlendConstant)(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderSetImmediates)(WGPURenderPassEncoder renderPassEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderSetIndexBuffer)(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderSetLabel)(WGPURenderPassEncoder renderPassEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderSetPipeline)(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderSetScissorRect)(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderSetStencilReference)(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderSetVertexBuffer)(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderSetViewport)(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderWriteTimestamp)(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderAddRef)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPassEncoderRelease)(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of RenderPipeline
+typedef WGPUBindGroupLayout (*WGPUProcRenderPipelineGetBindGroupLayout)(WGPURenderPipeline renderPipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPipelineSetLabel)(WGPURenderPipeline renderPipeline, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPipelineAddRef)(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcRenderPipelineRelease)(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of Sampler
+typedef void (*WGPUProcSamplerSetLabel)(WGPUSampler sampler, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcSamplerAddRef)(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcSamplerRelease)(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of ShaderModule
+typedef WGPUFuture (*WGPUProcShaderModuleGetCompilationInfo)(WGPUShaderModule shaderModule, WGPUCompilationInfoCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcShaderModuleSetLabel)(WGPUShaderModule shaderModule, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcShaderModuleAddRef)(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcShaderModuleRelease)(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of SupportedFeatures
+typedef void (*WGPUProcSupportedFeaturesFreeMembers)(WGPUSupportedFeatures supportedFeatures) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of SupportedInstanceFeatures
+typedef void (*WGPUProcSupportedInstanceFeaturesFreeMembers)(WGPUSupportedInstanceFeatures supportedInstanceFeatures) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of SupportedWGSLLanguageFeatures
+typedef void (*WGPUProcSupportedWGSLLanguageFeaturesFreeMembers)(WGPUSupportedWGSLLanguageFeatures supportedWGSLLanguageFeatures) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of Surface
+typedef void (*WGPUProcSurfaceConfigure)(WGPUSurface surface, WGPUSurfaceConfiguration const * config) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUStatus (*WGPUProcSurfaceGetCapabilities)(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcSurfaceGetCurrentTexture)(WGPUSurface surface, WGPUSurfaceTexture * surfaceTexture) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUStatus (*WGPUProcSurfacePresent)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcSurfaceSetLabel)(WGPUSurface surface, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcSurfaceUnconfigure)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcSurfaceAddRef)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of SurfaceCapabilities
+typedef void (*WGPUProcSurfaceCapabilitiesFreeMembers)(WGPUSurfaceCapabilities surfaceCapabilities) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of Texture
+typedef WGPUTextureView (*WGPUProcTextureCreateView)(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcTextureDestroy)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef uint32_t (*WGPUProcTextureGetDepthOrArrayLayers)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUTextureDimension (*WGPUProcTextureGetDimension)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUTextureFormat (*WGPUProcTextureGetFormat)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef uint32_t (*WGPUProcTextureGetHeight)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef uint32_t (*WGPUProcTextureGetMipLevelCount)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef uint32_t (*WGPUProcTextureGetSampleCount)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUTextureViewDimension (*WGPUProcTextureGetTextureBindingViewDimension)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef WGPUTextureUsage (*WGPUProcTextureGetUsage)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef uint32_t (*WGPUProcTextureGetWidth)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcTextureSetLabel)(WGPUTexture texture, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcTextureAddRef)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcTextureRelease)(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+
+// Procs of TextureView
+typedef void (*WGPUProcTextureViewSetLabel)(WGPUTextureView textureView, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcTextureViewAddRef)(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE;
+typedef void (*WGPUProcTextureViewRelease)(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE;
+
+#endif  // !defined(WGPU_SKIP_PROCS)
+
+#if !defined(WGPU_SKIP_DECLARATIONS)
+WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPU_NULLABLE WGPUInstanceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuGetInstanceFeatures(WGPUSupportedInstanceFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUStatus wgpuGetInstanceLimits(WGPUInstanceLimits * limits) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUBool wgpuHasInstanceFeature(WGPUInstanceFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUProc wgpuGetProcAddress(WGPUStringView procName) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of Adapter
+WGPU_EXPORT void wgpuAdapterGetFeatures(WGPUAdapter adapter, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUStatus wgpuAdapterGetInfo(WGPUAdapter adapter, WGPUAdapterInfo * info) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUStatus wgpuAdapterGetLimits(WGPUAdapter adapter, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUBool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUFuture wgpuAdapterRequestDevice(WGPUAdapter adapter, WGPU_NULLABLE WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuAdapterAddRef(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuAdapterRelease(WGPUAdapter adapter) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of AdapterInfo
+WGPU_EXPORT void wgpuAdapterInfoFreeMembers(WGPUAdapterInfo adapterInfo) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of AdapterPropertiesSubgroupMatrixConfigs
+WGPU_EXPORT void wgpuAdapterPropertiesSubgroupMatrixConfigsFreeMembers(WGPUAdapterPropertiesSubgroupMatrixConfigs adapterPropertiesSubgroupMatrixConfigs) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of BindGroup
+WGPU_EXPORT void wgpuBindGroupSetLabel(WGPUBindGroup bindGroup, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuBindGroupAddRef(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuBindGroupRelease(WGPUBindGroup bindGroup) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of BindGroupLayout
+WGPU_EXPORT void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuBindGroupLayoutAddRef(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of Buffer
+WGPU_EXPORT void wgpuBufferDestroy(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void const * wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void * wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUBufferMapState wgpuBufferGetMapState(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT uint64_t wgpuBufferGetSize(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUBufferUsage wgpuBufferGetUsage(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUFuture wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapMode mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUStatus wgpuBufferReadMappedRange(WGPUBuffer buffer, size_t offset, void * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuBufferSetLabel(WGPUBuffer buffer, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuBufferUnmap(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUStatus wgpuBufferWriteMappedRange(WGPUBuffer buffer, size_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuBufferAddRef(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuBufferRelease(WGPUBuffer buffer) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of CommandBuffer
+WGPU_EXPORT void wgpuCommandBufferSetLabel(WGPUCommandBuffer commandBuffer, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandBufferAddRef(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandBufferRelease(WGPUCommandBuffer commandBuffer) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of CommandEncoder
+WGPU_EXPORT WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUComputePassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPURenderPassEncoder wgpuCommandEncoderBeginRenderPass(WGPUCommandEncoder commandEncoder, WGPURenderPassDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderClearBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderCopyBufferToBuffer(WGPUCommandEncoder commandEncoder, WGPUBuffer source, uint64_t sourceOffset, WGPUBuffer destination, uint64_t destinationOffset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderCopyBufferToTexture(WGPUCommandEncoder commandEncoder, WGPUTexelCopyBufferInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderCopyTextureToBuffer(WGPUCommandEncoder commandEncoder, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyBufferInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderCopyTextureToTexture(WGPUCommandEncoder commandEncoder, WGPUTexelCopyTextureInfo const * source, WGPUTexelCopyTextureInfo const * destination, WGPUExtent3D const * copySize) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, WGPU_NULLABLE WGPUCommandBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderInsertDebugMarker(WGPUCommandEncoder commandEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderSetLabel(WGPUCommandEncoder commandEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderAddRef(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuCommandEncoderRelease(WGPUCommandEncoder commandEncoder) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of ComputePassEncoder
+WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroups(WGPUComputePassEncoder computePassEncoder, uint32_t workgroupCountX, uint32_t workgroupCountY, uint32_t workgroupCountZ) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderDispatchWorkgroupsIndirect(WGPUComputePassEncoder computePassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderEnd(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderInsertDebugMarker(WGPUComputePassEncoder computePassEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderSetImmediates(WGPUComputePassEncoder computePassEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderSetLabel(WGPUComputePassEncoder computePassEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderWriteTimestamp(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderAddRef(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePassEncoderRelease(WGPUComputePassEncoder computePassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of ComputePipeline
+WGPU_EXPORT WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePipelineAddRef(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuComputePipelineRelease(WGPUComputePipeline computePipeline) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of Device
+WGPU_EXPORT WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPU_NULLABLE WGPUBuffer wgpuDeviceCreateBuffer(WGPUDevice device, WGPUBufferDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUCommandEncoder wgpuDeviceCreateCommandEncoder(WGPUDevice device, WGPU_NULLABLE WGPUCommandEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUComputePipeline wgpuDeviceCreateComputePipeline(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUFuture wgpuDeviceCreateComputePipelineAsync(WGPUDevice device, WGPUComputePipelineDescriptor const * descriptor, WGPUCreateComputePipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPURenderBundleEncoder wgpuDeviceCreateRenderBundleEncoder(WGPUDevice device, WGPURenderBundleEncoderDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPURenderPipeline wgpuDeviceCreateRenderPipeline(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUFuture wgpuDeviceCreateRenderPipelineAsync(WGPUDevice device, WGPURenderPipelineDescriptor const * descriptor, WGPUCreateRenderPipelineAsyncCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUSampler wgpuDeviceCreateSampler(WGPUDevice device, WGPU_NULLABLE WGPUSamplerDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUShaderModule wgpuDeviceCreateShaderModule(WGPUDevice device, WGPUShaderModuleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUTexture wgpuDeviceCreateTexture(WGPUDevice device, WGPUTextureDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuDeviceDestroy(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUStatus wgpuDeviceGetAdapterInfo(WGPUDevice device, WGPUAdapterInfo * adapterInfo) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuDeviceGetFeatures(WGPUDevice device, WGPUSupportedFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUStatus wgpuDeviceGetLimits(WGPUDevice device, WGPULimits * limits) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUFuture wgpuDeviceGetLostFuture(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUQueue wgpuDeviceGetQueue(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUBool wgpuDeviceHasFeature(WGPUDevice device, WGPUFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUFuture wgpuDevicePopErrorScope(WGPUDevice device, WGPUPopErrorScopeCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuDeviceSetLabel(WGPUDevice device, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuDeviceAddRef(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuDeviceRelease(WGPUDevice device) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of ExternalTexture
+WGPU_EXPORT void wgpuExternalTextureSetLabel(WGPUExternalTexture externalTexture, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuExternalTextureAddRef(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuExternalTextureRelease(WGPUExternalTexture externalTexture) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of Instance
+WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuInstanceGetWGSLLanguageFeatures(WGPUInstance instance, WGPUSupportedWGSLLanguageFeatures * features) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUBool wgpuInstanceHasWGSLLanguageFeature(WGPUInstance instance, WGPUWGSLLanguageFeatureName feature) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuInstanceProcessEvents(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUFuture wgpuInstanceRequestAdapter(WGPUInstance instance, WGPU_NULLABLE WGPURequestAdapterOptions const * options, WGPURequestAdapterCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUWaitStatus wgpuInstanceWaitAny(WGPUInstance instance, size_t futureCount, WGPU_NULLABLE WGPUFutureWaitInfo * futures, uint64_t timeoutNS) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuInstanceAddRef(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuInstanceRelease(WGPUInstance instance) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of PipelineLayout
+WGPU_EXPORT void wgpuPipelineLayoutSetLabel(WGPUPipelineLayout pipelineLayout, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuPipelineLayoutAddRef(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of QuerySet
+WGPU_EXPORT void wgpuQuerySetDestroy(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT uint32_t wgpuQuerySetGetCount(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUQueryType wgpuQuerySetGetType(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuQuerySetSetLabel(WGPUQuerySet querySet, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuQuerySetAddRef(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuQuerySetRelease(WGPUQuerySet querySet) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of Queue
+WGPU_EXPORT WGPUFuture wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, WGPUQueueWorkDoneCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuQueueSetLabel(WGPUQueue queue, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuQueueSubmit(WGPUQueue queue, size_t commandCount, WGPUCommandBuffer const * commands) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuQueueWriteTexture(WGPUQueue queue, WGPUTexelCopyTextureInfo const * destination, void const * data, size_t dataSize, WGPUTexelCopyBufferLayout const * dataLayout, WGPUExtent3D const * writeSize) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuQueueAddRef(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuQueueRelease(WGPUQueue queue) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of RenderBundle
+WGPU_EXPORT void wgpuRenderBundleSetLabel(WGPURenderBundle renderBundle, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleAddRef(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleRelease(WGPURenderBundle renderBundle) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of RenderBundleEncoder
+WGPU_EXPORT void wgpuRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndexed(WGPURenderBundleEncoder renderBundleEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndexedIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderDrawIndirect(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPURenderBundle wgpuRenderBundleEncoderFinish(WGPURenderBundleEncoder renderBundleEncoder, WGPU_NULLABLE WGPURenderBundleDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderInsertDebugMarker(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderPopDebugGroup(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderPushDebugGroup(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder renderBundleEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderSetImmediates(WGPURenderBundleEncoder renderBundleEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderSetLabel(WGPURenderBundleEncoder renderBundleEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderAddRef(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderBundleEncoderRelease(WGPURenderBundleEncoder renderBundleEncoder) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of RenderPassEncoder
+WGPU_EXPORT void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderDraw(WGPURenderPassEncoder renderPassEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderDrawIndexed(WGPURenderPassEncoder renderPassEncoder, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t baseVertex, uint32_t firstInstance) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderEnd(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderEndOcclusionQuery(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderExecuteBundles(WGPURenderPassEncoder renderPassEncoder, size_t bundleCount, WGPURenderBundle const * bundles) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderInsertDebugMarker(WGPURenderPassEncoder renderPassEncoder, WGPUStringView markerLabel) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPU_NULLABLE WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer indirectBuffer, uint64_t indirectOffset, uint32_t maxDrawCount, WGPU_NULLABLE WGPUBuffer drawCountBuffer, uint64_t drawCountBufferOffset) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderPopDebugGroup(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderPushDebugGroup(WGPURenderPassEncoder renderPassEncoder, WGPUStringView groupLabel) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderSetBindGroup(WGPURenderPassEncoder renderPassEncoder, uint32_t groupIndex, WGPU_NULLABLE WGPUBindGroup group, size_t dynamicOffsetCount, uint32_t const * dynamicOffsets) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderSetBlendConstant(WGPURenderPassEncoder renderPassEncoder, WGPUColor const * color) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderSetImmediates(WGPURenderPassEncoder renderPassEncoder, uint32_t offset, void const * data, size_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderSetIndexBuffer(WGPURenderPassEncoder renderPassEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderSetLabel(WGPURenderPassEncoder renderPassEncoder, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderSetPipeline(WGPURenderPassEncoder renderPassEncoder, WGPURenderPipeline pipeline) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder renderPassEncoder, uint32_t x, uint32_t y, uint32_t width, uint32_t height) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPU_NULLABLE WGPUBuffer buffer, uint64_t offset, uint64_t size) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderWriteTimestamp(WGPURenderPassEncoder renderPassEncoder, WGPUQuerySet querySet, uint32_t queryIndex) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderAddRef(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPassEncoderRelease(WGPURenderPassEncoder renderPassEncoder) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of RenderPipeline
+WGPU_EXPORT WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPipelineAddRef(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuRenderPipelineRelease(WGPURenderPipeline renderPipeline) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of Sampler
+WGPU_EXPORT void wgpuSamplerSetLabel(WGPUSampler sampler, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuSamplerAddRef(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuSamplerRelease(WGPUSampler sampler) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of ShaderModule
+WGPU_EXPORT WGPUFuture wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallbackInfo callbackInfo) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuShaderModuleAddRef(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuShaderModuleRelease(WGPUShaderModule shaderModule) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of SupportedFeatures
+WGPU_EXPORT void wgpuSupportedFeaturesFreeMembers(WGPUSupportedFeatures supportedFeatures) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of SupportedInstanceFeatures
+WGPU_EXPORT void wgpuSupportedInstanceFeaturesFreeMembers(WGPUSupportedInstanceFeatures supportedInstanceFeatures) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of SupportedWGSLLanguageFeatures
+WGPU_EXPORT void wgpuSupportedWGSLLanguageFeaturesFreeMembers(WGPUSupportedWGSLLanguageFeatures supportedWGSLLanguageFeatures) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of Surface
+WGPU_EXPORT void wgpuSurfaceConfigure(WGPUSurface surface, WGPUSurfaceConfiguration const * config) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUStatus wgpuSurfaceGetCapabilities(WGPUSurface surface, WGPUAdapter adapter, WGPUSurfaceCapabilities * capabilities) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuSurfaceGetCurrentTexture(WGPUSurface surface, WGPUSurfaceTexture * surfaceTexture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUStatus wgpuSurfacePresent(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuSurfaceSetLabel(WGPUSurface surface, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuSurfaceUnconfigure(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuSurfaceAddRef(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuSurfaceRelease(WGPUSurface surface) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of SurfaceCapabilities
+WGPU_EXPORT void wgpuSurfaceCapabilitiesFreeMembers(WGPUSurfaceCapabilities surfaceCapabilities) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of Texture
+WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPU_NULLABLE WGPUTextureViewDescriptor const * descriptor) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuTextureDestroy(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT uint32_t wgpuTextureGetDepthOrArrayLayers(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUTextureDimension wgpuTextureGetDimension(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUTextureFormat wgpuTextureGetFormat(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT uint32_t wgpuTextureGetHeight(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT uint32_t wgpuTextureGetMipLevelCount(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT uint32_t wgpuTextureGetSampleCount(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUTextureViewDimension wgpuTextureGetTextureBindingViewDimension(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT WGPUTextureUsage wgpuTextureGetUsage(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT uint32_t wgpuTextureGetWidth(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuTextureSetLabel(WGPUTexture texture, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuTextureAddRef(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuTextureRelease(WGPUTexture texture) WGPU_FUNCTION_ATTRIBUTE;
+
+// Methods of TextureView
+WGPU_EXPORT void wgpuTextureViewSetLabel(WGPUTextureView textureView, WGPUStringView label) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuTextureViewAddRef(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE;
+WGPU_EXPORT void wgpuTextureViewRelease(WGPUTextureView textureView) WGPU_FUNCTION_ATTRIBUTE;
+
+#endif  // !defined(WGPU_SKIP_DECLARATIONS)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // WEBGPU_H_

From 62a43fe19cb35d8dc525d9ce2d86ede3af314fdf Mon Sep 17 00:00:00 2001
From: Mark Harfouche 
Date: Thu, 1 Oct 2026 00:06:51 -0400
Subject: [PATCH 5/8] Enumerate all Dawn adapters and match wgpu-native's
 adapter info

Claude's draft pygfx selects an adapter by name (PYGFX_WGPU_ADAPTER_NAME=llvmpipe matches against adapter.summary in enumerate_adapters_sync()), and enables its screenshot tests only if adapter.info["vendor"] == "llvmpipe". With the Dawn backend neither worked: * enumerate_adapters_sync() requested one adapter per backend and power preference. Dawn always returns the "best" one, so a CPU adapter like lavapipe was never listed when there is a GPU (forceFallbackAdapter only matches SwiftShader). webgpu.h has no way to enumerate adapters, so this uses Dawn's C++ API (dawn::native::Instance::EnumerateAdapters) in a small native-only helper, dawn_native_extras.cpp. It is compiled if Dawn's C++ headers are available (they are in the conda package); otherwise the previous request-based enumeration is used, which now also tries fallback adapters and the compatibility level for OpenGL. Dawn's Null backend is left out. * Dawn reports a normalized vendor ("mesa" for lavapipe, "intel") and, for Vulkan, ": " as the description. wgpu-native reports the driver name as vendor ("llvmpipe") and the driver info as description. The Dawn backend now does the same, and keeps Dawn's vendor as info["vendor_name"]. Also accept ints for enum arguments, passed through as the raw webgpu.h value, like the wgpu-native backend (pygfx uses cull_mode=0). With this, pygfx's example tests on lavapipe give the same results with the Dawn backend as with wgpu-native, including the screenshot comparisons. Resume this Claude session: ``` cd /home/mark/git/feedstock/staged-recipes claude --resume 2cab6db9-a6ea-4976-a0e6-f4153fe5a651 ```
Claude-Session: https://claude.ai/code/session_01QMLpZTQYYCu2K7EaWNnkEG --- tests/test_dawn_backend.py | 17 ++++ tools/build_dawn.py | 14 +++- wgpu/backends/dawn/_api.pyx | 95 +++++++++++++++++++---- wgpu/backends/dawn/dawn_native_extras.cpp | 26 +++++++ wgpu/backends/dawn/dawn_native_extras.h | 47 +++++++++++ 5 files changed, 183 insertions(+), 16 deletions(-) create mode 100644 wgpu/backends/dawn/dawn_native_extras.cpp create mode 100644 wgpu/backends/dawn/dawn_native_extras.h diff --git a/tests/test_dawn_backend.py b/tests/test_dawn_backend.py index f748fb952..d817c00ba 100644 --- a/tests/test_dawn_backend.py +++ b/tests/test_dawn_backend.py @@ -80,6 +80,23 @@ def test_backend_is_dawn(): assert "core-features-and-limits" in adapter.features or adapter.features +def test_enumerate_adapters(): + adapters = wgpu.gpu.enumerate_adapters_sync() + assert adapters + for adapter in adapters: + assert isinstance(adapter, dawn.GPUAdapter) + assert adapter.info["backend_type"] != "Null" + # Dawn's own (normalized) vendor name is kept + assert isinstance(adapter.info["vendor_name"], str) + # Adapters can be selected by name, like pygfx does with PYGFX_WGPU_ADAPTER_NAME + name = adapter.info["device"] + assert adapter in [a for a in adapters if name in a.summary] + # Like wgpu-native, the vendor of lavapipe is "llvmpipe" (the driver name) + for adapter in adapters: + if "llvmpipe" in adapter.summary and adapter.info["backend_type"] == "Vulkan": + assert adapter.info["vendor"] == "llvmpipe" + + def test_request_device_with_features_and_limits(): adapter = wgpu.gpu.request_adapter_sync() features = [ diff --git a/tools/build_dawn.py b/tools/build_dawn.py index d622a8523..4f3cdc9b4 100644 --- a/tools/build_dawn.py +++ b/tools/build_dawn.py @@ -128,11 +128,21 @@ def get_native_extension(dawn_prefix, debug=False): if sys.platform.startswith("win"): extra_compile_args += ["/Od"] if debug else ["/O2"] + cpp_args = ["/std:c++20"] else: extra_compile_args += ["-O0", "-g"] if debug else ["-O2"] # Dawn's header has a few constructs that some compilers warn about extra_compile_args += ["-Wno-unused-function", "-Wno-unreachable-code"] extra_link_args += [f"-Wl,-rpath,{lib_dir}"] + cpp_args = ["-std=c++20"] + + # Helpers that use Dawn's C++ API (e.g. to enumerate adapters), if available + cpp_sources = [] + if os.path.isfile(os.path.join(include_dir, "dawn", "native", "DawnNative.h")): + define_macros.append(("WGPU_PY_HAVE_DAWN_NATIVE_EXTRAS", "1")) + cpp_sources.append(os.path.join(DAWN_DIR, "dawn_native_extras.cpp")) + else: + print("Dawn's C++ headers not found: building without dawn_native_extras.cpp") ext = Extension( "wgpu.backends.dawn._api", @@ -145,8 +155,8 @@ def get_native_extension(dawn_prefix, debug=False): extra_link_args=extra_link_args, py_limited_api=py_limited_api, ) - ext.cpp_sources = [] - ext.cpp_args = [] + ext.cpp_sources = cpp_sources + ext.cpp_args = extra_compile_args + cpp_args return ext diff --git a/wgpu/backends/dawn/_api.pyx b/wgpu/backends/dawn/_api.pyx index 5b89539f9..93eb47b51 100644 --- a/wgpu/backends/dawn/_api.pyx +++ b/wgpu/backends/dawn/_api.pyx @@ -63,6 +63,14 @@ cdef extern from "Python.h": cdef extern from "emdawn_glue.h": int wgpu_dawn_install(const char* code) +cdef extern from "dawn_native_extras.h": + size_t wgpupy_dawn_enumerate_adapters( + WGPUInstance instance, + const WGPURequestAdapterOptions* options, + WGPUAdapter* adapters, + size_t max_count, + ) + logger = logging.getLogger("wgpu") @@ -255,7 +263,13 @@ cdef class _Buffer: cdef int _enum(str enum_name, object value) except? -1: - """Convert an enum string to its int value in Dawn.""" + """Convert an enum string to its int value in Dawn. + + Like the wgpu-native backend, an int is passed through as the raw webgpu.h + value (e.g. 0 for "undefined", i.e. the default). + """ + if type(value) is int: + return value try: return enummap[enum_name + "." + value] except KeyError: @@ -999,7 +1013,10 @@ class GPU(classes.GPU): """Get a list of adapter objects available on the current system. This is the implementation based on Dawn. - In the browser, it returns the one adapter that the browser provides. + Natively, this lists all adapters that Dawn finds, e.g. GPUs as well as + CPU adapters like lavapipe. Since webgpu.h cannot enumerate adapters, + this uses Dawn's C++ API (see dawn_native_extras.cpp). In the browser, + it returns the one adapter that the browser provides. """ if _IS_EMSCRIPTEN: return self.request_adapter_async().then( @@ -1011,8 +1028,30 @@ class GPU(classes.GPU): return promise def _enumerate_adapters(self): - # The webgpu.h API has no way to enumerate adapters, so we request an - # adapter for each backend and power preference, and de-duplicate. + cdef WGPUAdapter* c_adapters + cdef size_t i, n + cdef WGPUInstance instance = _get_instance() + if not _IS_EMSCRIPTEN: + # Use Dawn's C++ API to list all adapters (see dawn_native_extras.cpp) + n = wgpupy_dawn_enumerate_adapters(instance, NULL, NULL, 0) + if n != -1: + c_adapters = PyMem_Calloc(max(n, 1), sizeof(WGPUAdapter)) + try: + n = min(n, wgpupy_dawn_enumerate_adapters(instance, NULL, c_adapters, n)) + _check() + ids = [c_adapters[i] for i in range(n)] + finally: + PyMem_Free(c_adapters) + adapters = [self._create_adapter(adapter_id) for adapter_id in ids] + # Dawn's Null backend is for testing only + return [a for a in adapters if a.info["backend_type"] != "Null"] + return self._enumerate_adapters_by_requesting() + + def _enumerate_adapters_by_requesting(self): + # Request an adapter for each combination of options, and de-duplicate. + # Dawn only returns a CPU adapter (e.g. lavapipe) if a fallback adapter + # is requested (or if it is the only one), and only exposes its OpenGL + # backends at the compatibility feature level. adapters = [] seen = set() backend_names = [ @@ -1027,16 +1066,26 @@ class GPU(classes.GPU): backend = enum_str2int["BackendType"].get(name) if backend is None: continue - for pref in ("high-performance", "low-power"): - try: - promise = self._request_adapter("core", pref, False, None, backend) - adapter = promise.sync_wait() - except Exception: - continue - key = (adapter.summary, adapter.info["backend_type"]) - if key not in seen: - seen.add(key) - adapters.append(adapter) + feature_level = "compatibility" if name.startswith("OpenGL") else "core" + for fallback in (False, True): + for pref in ("high-performance", "low-power"): + try: + promise = self._request_adapter( + feature_level, pref, fallback, None, backend + ) + adapter = promise.sync_wait() + except Exception: + continue + info = adapter.info + key = ( + info["vendor_id"], + info["device_id"], + info["device"], + info["backend_type"], + ) + if key not in seen: + seen.add(key) + adapters.append(adapter) return adapters def _create_adapter(self, adapter_id): @@ -1066,6 +1115,7 @@ class GPU(classes.GPU): ), } wgpuAdapterInfoFreeMembers(c_info) + _align_adapter_info(adapter_info_data) adapter_info = GPUAdapterInfo(adapter_info_data) limits = _get_limits(adapter, False) @@ -1093,6 +1143,23 @@ class GPU(classes.GPU): return names +def _align_adapter_info(d): + """Make the adapter info match that of the wgpu-native backend where Dawn differs. + + Dawn reports a normalized vendor name (e.g. "intel", or "mesa" for + lavapipe), and for Vulkan the description is ": ". + wgpu-native reports the driver name as the vendor (e.g. "llvmpipe") and the + driver info as the description. Code that identifies adapters (e.g. checks + for lavapipe with ``info["vendor"] == "llvmpipe"``) relies on the latter, so + we follow wgpu-native, and keep Dawn's vendor name as "vendor_name". + """ + d["vendor_name"] = d["vendor"] + if d["backend_type"] == "Vulkan" and ": " in d["description"]: + driver_name, driver_info = d["description"].split(": ", 1) + d["vendor"] = driver_name + d["description"] = driver_info + + # Instantiate API entrypoint gpu = GPU() diff --git a/wgpu/backends/dawn/dawn_native_extras.cpp b/wgpu/backends/dawn/dawn_native_extras.cpp new file mode 100644 index 000000000..5d66580ee --- /dev/null +++ b/wgpu/backends/dawn/dawn_native_extras.cpp @@ -0,0 +1,26 @@ +// Native-only helpers for the Dawn backend, see dawn_native_extras.h. + +#include + +#include + +#include "dawn_native_extras.h" + +extern "C" size_t wgpupy_dawn_enumerate_adapters(WGPUInstance instance, + const WGPURequestAdapterOptions* options, + WGPUAdapter* adapters, + size_t max_count) { + // webgpu.h can only request "the best" adapter for some options, and Dawn's + // forceFallbackAdapter only matches SwiftShader. Dawn's C++ API can list + // them all, e.g. a GPU as well as lavapipe. A WGPUInstance is a Dawn + // InstanceBase (the wrapper takes its own reference). + dawn::native::Instance wrapper(reinterpret_cast(instance)); + std::vector found = wrapper.EnumerateAdapters(options); + if (adapters != nullptr) { + for (size_t i = 0; i < found.size() && i < max_count; i++) { + adapters[i] = found[i].Get(); + wgpuAdapterAddRef(adapters[i]); + } + } + return found.size(); +} diff --git a/wgpu/backends/dawn/dawn_native_extras.h b/wgpu/backends/dawn/dawn_native_extras.h new file mode 100644 index 000000000..02b71feb0 --- /dev/null +++ b/wgpu/backends/dawn/dawn_native_extras.h @@ -0,0 +1,47 @@ +// Native-only helpers for the Dawn backend that are not in webgpu.h. +// +// These are implemented in dawn_native_extras.cpp, using Dawn's C++ API +// (dawn/native/DawnNative.h). That file is only compiled natively, and only if +// Dawn's C++ headers are available (see tools/build_dawn.py); otherwise these +// report that they are not available. + +#ifndef WGPU_PY_DAWN_NATIVE_EXTRAS_H_ +#define WGPU_PY_DAWN_NATIVE_EXTRAS_H_ + +#include +#include + +#ifdef WGPU_PY_HAVE_DAWN_NATIVE_EXTRAS + +#ifdef __cplusplus +extern "C" { +#endif + +// Enumerate all adapters of the instance that match the options (which may be +// NULL). Returns the number of adapters. If ``adapters`` is not NULL, it is +// filled with (at most ``max_count``) new references to the adapters. +size_t wgpupy_dawn_enumerate_adapters(WGPUInstance instance, + const WGPURequestAdapterOptions* options, + WGPUAdapter* adapters, + size_t max_count); + +#ifdef __cplusplus +} +#endif + +#else + +static inline size_t wgpupy_dawn_enumerate_adapters(WGPUInstance instance, + const WGPURequestAdapterOptions* options, + WGPUAdapter* adapters, + size_t max_count) { + (void)instance; + (void)options; + (void)adapters; + (void)max_count; + return (size_t)-1; // not available +} + +#endif // WGPU_PY_HAVE_DAWN_NATIVE_EXTRAS + +#endif // WGPU_PY_DAWN_NATIVE_EXTRAS_H_ From 077226f74873eaed4690fec03b3dc46e7cf7ce9f Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Thu, 1 Oct 2026 00:06:51 -0400 Subject: [PATCH 6/8] Add Pyodide jobs to the Dawn CI workflow
Claude's draft Modeled on the workflow of #840, without the GitHub Pages deployment: * pyodide-build: build the wgpu wheel with the Dawn extension for Pyodide (Pyodide 314.0.7, pyodide-build 0.39.1, Pyodide's Emscripten). * pyodide-node: run the example scripts and the wgpu-py tests that apply in Pyodide in Node.js, with navigator.gpu from the `webgpu` npm package (Dawn) on lavapipe. Also run the call-overhead benchmark. * pyodide-chrome: the same in headless Chrome (SwiftShader), with Pyodide from the CDN. Uploads a screenshot of the canvas and the demo page (a static site with the wheel) as an artifact. The native jobs now install a C++ compiler (for dawn_native_extras.cpp), print the enumerated adapters, and also run the example scripts. Resume this Claude session: ``` cd /home/mark/git/feedstock/staged-recipes claude --resume 2cab6db9-a6ea-4976-a0e6-f4153fe5a651 ```
Claude-Session: https://claude.ai/code/session_01QMLpZTQYYCu2K7EaWNnkEG --- .github/workflows/dawn.yml | 182 ++++++++++++++++++++++++++++++++++++- 1 file changed, 179 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dawn.yml b/.github/workflows/dawn.yml index ed0b78a8a..f67cc96ae 100644 --- a/.github/workflows/dawn.yml +++ b/.github/workflows/dawn.yml @@ -1,8 +1,16 @@ name: Dawn backend # CI for the (optional, experimental) Dawn backend. This is separate from the -# main CI, so that it does not affect the wgpu-native jobs. Dawn, Cython and -# the compilers are obtained from conda. +# main CI, so that it does not affect the wgpu-native jobs. The same Cython +# extension is built for two targets: +# +# * Native, against Dawn from conda (Dawn, Cython and the compilers are +# obtained with micromamba). Tested on lavapipe (software Vulkan). +# * Pyodide, against Emdawnwebgpu (Dawn's webgpu.h on top of the browser's +# WebGPU). Tested in Node.js (navigator.gpu from the `webgpu` npm package, +# which is Dawn, on lavapipe) and in headless Chrome (SwiftShader). +# +# See tools/build_dawn.py and tools/dawn_pyodide. on: workflow_dispatch: @@ -14,6 +22,35 @@ on: branches: - main +permissions: + contents: read + +env: + # Pyodide and its build tools. Emdawnwebgpu (pinned in tools/build_dawn.py) + # must be from the same Dawn release as the vendored headers. The JS glue is + # generated with Pyodide's Emscripten at build time. + PYODIDE_VERSION: "314.0.7" + PYODIDE_BUILD_VERSION: "0.39.1" + # The tests that apply to the Dawn backend in Pyodide. Not included: tests that + # need wgpu-native, subprocesses, trio or rendercanvas. + PYODIDE_TESTS: >- + tests/test_dawn_backend.py tests/test_not_finite.py tests/test_util_compute.py + tests/test_util_core.py tests/test_wgpu_native_buffer.py + tests/test_wgpu_native_compute_tex.py tests/test_wgpu_native_render.py + tests/test_wgpu_native_render_tex.py tests/test_wgpu_native_texture.py + tests/test_wgpu_occlusion_query.py tests/test_diagnostics.py + # Tests specific to wgpu-native (repr, diagnostics of all backends) + PYODIDE_DESELECT: >- + tests/test_wgpu_native_buffer.py::test_buffer_init1 + tests/test_diagnostics.py::test_diagnostics_with_backends + # In the browser, validation errors arrive asynchronously (uncapturederror + # event), so they are logged instead of raised by the failing call. + CHROME_DESELECT: >- + tests/test_dawn_backend.py::test_validation_error_raises_at_call_site + tests/test_dawn_backend.py::test_shader_error_raises + tests/test_wgpu_native_buffer.py::test_buffer_init3 + tests/test_wgpu_native_texture.py::test_view_formats + jobs: test-dawn: name: Dawn ${{ matrix.os }} py${{ matrix.python-version }} @@ -53,6 +90,7 @@ jobs: cython>=3.1 setuptools c-compiler + cxx-compiler cffi numpy pytest @@ -81,7 +119,7 @@ jobs: run: | # Use lavapipe as the Vulkan driver export VK_ICD_FILENAMES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -1) - python -c "import wgpu; print(wgpu.utils.get_default_device().adapter.summary)" + python -c "import wgpu; print([a.summary for a in wgpu.gpu.enumerate_adapters_sync()])" # Dawn-specific tests, plus the generic tests that also apply to Dawn. pytest -v tests/test_dawn_backend.py tests/test_api.py tests/test_async.py \ tests/test_canvas.py tests/test_not_finite.py tests/test_util_compute.py \ @@ -91,6 +129,17 @@ jobs: tests/test_wgpu_occlusion_query.py \ --deselect tests/test_wgpu_native_buffer.py::test_buffer_init1 + - name: Run the scripts that also run in Pyodide + env: + WGPUPY_BACKEND: dawn + PYTHONPATH: ${{ github.workspace }} + run: | + export VK_ICD_FILENAMES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -1) + cd tools/dawn_pyodide + python compute_async.py + python compute_sync.py + python triangle.py + - name: Report on the full test suite (informational) continue-on-error: true env: @@ -125,3 +174,130 @@ jobs: - name: Test codegen (includes the Dawn pxd and mappings) run: | pytest -v codegen + + pyodide-build: + name: Build the Pyodide wheel + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + PYODIDE_XBUILDENV_PATH: /home/runner/xbuildenv + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.14' + - name: Install pyodide-build + run: | + python -m pip install --upgrade pip + pip install pyodide-build==${PYODIDE_BUILD_VERSION} + - name: Install the Pyodide cross-build environment and Emscripten + run: | + pyodide xbuildenv install ${PYODIDE_VERSION} + pyodide xbuildenv install-emscripten + - name: Build the wgpu wheel with the Dawn backend for Pyodide + run: | + source ${PYODIDE_XBUILDENV_PATH}/${PYODIDE_VERSION}/emsdk/emsdk_env.sh + emcc --version | head -1 + # No wgpu-native; the Dawn extension is compiled against Emdawnwebgpu + WGPU_PY_BUILD_NOARCH=1 WGPU_PY_BUILD_DAWN=1 pyodide build --exports pyinit -o dist + - name: Show the wheel + run: | + ls -l dist + python -m zipfile -l dist/*.whl | grep -E "\.so|\.js" + - uses: actions/upload-artifact@v4 + with: + name: pyodide-wheel + path: dist/*.whl + + pyodide-node: + name: Pyodide in Node (webgpu npm, lavapipe) + needs: pyodide-build + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: pyodide-wheel + path: dist + - uses: actions/setup-node@v4 + with: + node-version: '26' + - name: Install lavapipe + run: | + sudo apt-get update -y -qq + sudo apt-get install -y mesa-vulkan-drivers libvulkan1 + - name: Install npm packages + run: cd tools/dawn_pyodide && npm install --no-audit --no-fund + - name: Run scripts + run: | + WHEELS=$(ls $PWD/dist/*.whl | tr '\n' ',') + cd tools/dawn_pyodide + node run_node.mjs $WHEELS compute_async.py + node run_node.mjs $WHEELS compute_sync.py + node run_node.mjs $WHEELS triangle.py + - name: Run wgpu-py tests + run: | + WHEELS=$(ls $PWD/dist/*.whl | tr '\n' ',') + DESELECT=$(for t in ${PYODIDE_DESELECT}; do echo -n " --deselect $t"; done) + cd tools/dawn_pyodide + node run_node.mjs $WHEELS --pytest ../../tests ${PYODIDE_TESTS} -k "not spirv" ${DESELECT} + - name: Benchmark the per-call overhead (informational) + continue-on-error: true + run: | + WHEELS=$(ls $PWD/dist/*.whl | tr '\n' ',') + cd tools/dawn_pyodide + node run_node.mjs $WHEELS ../bench_backends.py + + pyodide-chrome: + name: Pyodide in headless Chrome (SwiftShader) + needs: pyodide-build + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: pyodide-wheel + path: dist + - uses: actions/setup-node@v4 + with: + node-version: '26' + - name: Install npm packages + run: cd tools/dawn_pyodide && npm install --no-audit --no-fund + - name: Prepare site + run: | + mkdir site + cp tools/dawn_pyodide/runner.html tools/dawn_pyodide/*.py tools/bench_backends.py dist/*.whl site/ + zip -qr site/tests.zip tests/*.py conftest.py + echo "WHEELS=$(cd dist && ls *.whl | tr '\n' ',')" >> $GITHUB_ENV + # Pyodide itself (and its packages) come from the CDN + echo "PYODIDE_URL=https://cdn.jsdelivr.net/pyodide/v${PYODIDE_VERSION}/full/pyodide.mjs" >> $GITHUB_ENV + google-chrome --version + - name: Run scripts + run: | + cd tools/dawn_pyodide + node run_chrome.mjs ../../site "runner.html?pyodide=${PYODIDE_URL}&wheels=${WHEELS}&script=compute_async.py" + node run_chrome.mjs ../../site "runner.html?pyodide=${PYODIDE_URL}&wheels=${WHEELS}&script=compute_sync.py" + SCREENSHOT=../../triangle.png node run_chrome.mjs ../../site "runner.html?pyodide=${PYODIDE_URL}&wheels=${WHEELS}&script=triangle.py&canvas=1" + - name: Run wgpu-py tests + run: | + ARGS=$(echo ${PYODIDE_TESTS} | tr ' ' ',') + DESELECT=$(for t in ${PYODIDE_DESELECT} ${CHROME_DESELECT}; do echo -n ",--deselect,$t"; done) + cd tools/dawn_pyodide + node run_chrome.mjs ../../site "runner.html?pyodide=${PYODIDE_URL}&wheels=${WHEELS}&tests=tests.zip&pytest=${ARGS},-k,not spirv${DESELECT}" + - name: Benchmark the per-call overhead (informational) + continue-on-error: true + run: | + cd tools/dawn_pyodide + node run_chrome.mjs ../../site "runner.html?pyodide=${PYODIDE_URL}&wheels=${WHEELS}&script=bench_backends.py" + - name: Upload the triangle screenshot and the demo page + if: always() + uses: actions/upload-artifact@v4 + with: + # Serve the site directory (e.g. python -m http.server) and open + # runner.html?script=triangle.py&canvas=1 in a browser with WebGPU. + name: pyodide-demo + path: | + triangle.png + site From 1d92d70d549b783197aa9c5763f9581590be28a9 Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Thu, 1 Oct 2026 07:52:56 -0400 Subject: [PATCH 7/8] Port backend-agnostic fixes and tests from the cffi Dawn backend
Claude's draft Port what #840 gained that is not specific to cffi: * wgpu/_classes.py: the base GPUCompilationMessage and GPUCompilationInfo now store their values (same change as in #840), so the Dawn backend's subclasses no longer duplicate that code. * codegen: the struct-check validation parses the backend being patched, instead of always parsing the wgpu-native backend, and the report lists API methods that a (Python) backend does not implement. * tests/test_dawn_backend.py: the tests that #840 added in test_dawn_cffi.py: encoder errors raised at finish(), set_bind_group with dynamic offsets (list, numpy, start/length), and a render bundle with a depth_stencil_format (#839 did not have #840's bug there; the test now also executes the bundle in a pass with a depth attachment). Also check that enumerated adapters are unique and can create a device. The dynamic-offsets test found a bug in this backend: set_bind_group() tested `if dynamic_offsets_data:`, which drops a numpy array [0] (and raises for longer arrays). It now checks the length. auto.py: in Pyodide, detect the Dawn extension by its file instead of with find_spec(), which imported (and so registered) the backend as a side effect. Resume this Claude session: ``` cd /home/mark/git/feedstock/staged-recipes claude --resume 2cab6db9-a6ea-4976-a0e6-f4153fe5a651 ```
Claude-Session: https://claude.ai/code/session_01QMLpZTQYYCu2K7EaWNnkEG --- codegen/apipatcher.py | 13 +++- tests/test_dawn_backend.py | 117 +++++++++++++++++++++++++++++++ wgpu/_classes.py | 31 +++++--- wgpu/backends/auto.py | 9 ++- wgpu/backends/dawn/_api.pyx | 41 +---------- wgpu/resources/codegen_report.md | 3 +- 6 files changed, 159 insertions(+), 55 deletions(-) diff --git a/codegen/apipatcher.py b/codegen/apipatcher.py index dc6afe8d1..af9710dc0 100644 --- a/codegen/apipatcher.py +++ b/codegen/apipatcher.py @@ -190,9 +190,15 @@ class AbstractApiPatcher(Patcher): def apply(self, code): self._init(code) self._counts = {"classes": 0, "methods": 0, "properties": 0} + self._missing_methods = [] self.patch_classes() stats = ", ".join(f"{self._counts[key]} {key}" for key in self._counts) print("Validated " + stats) + if isinstance(self, BackendApiPatcher): + # Report the API methods that the backend does not (yet) implement + for name in self._missing_methods: + print(f"Not implemented: {name}") + print(f"Found {len(self._missing_methods)} methods not implemented") def patch_classes(self): seen_classes = set() @@ -324,6 +330,7 @@ def get_missing_methods(self, classname, seen_funcs): lines = [] for methodname in self.get_required_method_names(classname): if methodname not in seen_funcs: + self._missing_methods.append(f"{classname}.{methodname}") lines.append(" # FIXME: new method to implement") lines.append(self.get_method_def(classname, methodname)) lines.append(" raise NotImplementedError()\n") @@ -711,7 +718,7 @@ def apply(self, code): all_structs = set() ignore_structs = {"Extent3D", "Origin3D"} - structure_checks = self._get_structure_checks() + structure_checks = self._get_structure_checks(code) for classname, i1, i2 in self.iter_classes(): if classname not in idl.classes: @@ -772,7 +779,7 @@ def _get_sub_structs(self, idl, structname): return structnames @staticmethod - def _get_structure_checks(): + def _get_structure_checks(code): """ Returns a map (class_name, method_name) -> @@ -782,7 +789,7 @@ def _get_structure_checks(): For now, the helper function must be methods within the same class. This code does not yet deal with global functions or with methods in superclasses. """ - module = ast.parse(file_cache.read("backends/wgpu_native/_api.py")) + module = ast.parse(code) # We only care about top-level classes and their top-level methods. top_level_methods = { # (class_name, method_name) -> method_ast diff --git a/tests/test_dawn_backend.py b/tests/test_dawn_backend.py index d817c00ba..2a43b0ba7 100644 --- a/tests/test_dawn_backend.py +++ b/tests/test_dawn_backend.py @@ -95,6 +95,10 @@ def test_enumerate_adapters(): for adapter in adapters: if "llvmpipe" in adapter.summary and adapter.info["backend_type"] == "Vulkan": assert adapter.info["vendor"] == "llvmpipe" + # No duplicates, and each adapter can create a device + keys = [(a.summary, a.info["backend_type"]) for a in adapters] + assert len(set(keys)) == len(keys) + adapters[-1].request_device_sync() def test_request_device_with_features_and_limits(): @@ -365,3 +369,116 @@ def test_device_lost_on_destroy(): dawn.process_events() info = promise.sync_wait() assert info.reason == "destroyed" + + +# The tests below were added to the cffi Dawn backend in #840; they apply here too. + + +def test_encoder_errors_raise_at_finish(device): + texture = device.create_texture( + size=(4, 4, 1), format="rgba8unorm", usage=wgpu.TextureUsage.RENDER_ATTACHMENT + ) + encoder = device.create_command_encoder() + rpass = encoder.begin_render_pass( + color_attachments=[ + {"view": texture.create_view(), "load_op": "clear", "store_op": "store"} + ] + ) + rpass.draw(3) # no pipeline set: the error is deferred to finish() + rpass.end() + with pytest.raises(wgpu.GPUValidationError): + encoder.finish() + # And the next call is fine again + device.create_command_encoder().finish() + + +DYNAMIC_SHADER = """ +@group(0) @binding(0) var value: vec4; +@group(0) @binding(1) var out: array; +@compute @workgroup_size(1) +fn main() { + out[value.y] = value.x; +} +""" + + +@pytest.mark.parametrize("how", ["list", "numpy", "start_length"]) +def test_set_bind_group_dynamic_offsets(device, how): + # Two uniform values, 256 bytes apart (minUniformBufferOffsetAlignment) + data = np.zeros(128, np.uint32) + data[0:2] = 10, 0 + data[64:66] = 20, 1 + ubuf = device.create_buffer_with_data(data=data, usage=wgpu.BufferUsage.UNIFORM) + sbuf = device.create_buffer( + size=8, usage=wgpu.BufferUsage.STORAGE | wgpu.BufferUsage.COPY_SRC + ) + bgl = device.create_bind_group_layout( + entries=[ + { + "binding": 0, + "visibility": wgpu.ShaderStage.COMPUTE, + "buffer": {"type": "uniform", "has_dynamic_offset": True}, + }, + { + "binding": 1, + "visibility": wgpu.ShaderStage.COMPUTE, + "buffer": {"type": "storage"}, + }, + ] + ) + bind_group = device.create_bind_group( + layout=bgl, + entries=[ + {"binding": 0, "resource": {"buffer": ubuf, "offset": 0, "size": 16}}, + {"binding": 1, "resource": {"buffer": sbuf}}, + ], + ) + pipeline = device.create_compute_pipeline( + layout=device.create_pipeline_layout(bind_group_layouts=[bgl]), + compute={"module": device.create_shader_module(code=DYNAMIC_SHADER)}, + ) + encoder = device.create_command_encoder() + cpass = encoder.begin_compute_pass() + cpass.set_pipeline(pipeline) + for offset in (0, 256): + if how == "list": + cpass.set_bind_group(0, bind_group, [offset]) + elif how == "numpy": + cpass.set_bind_group(0, bind_group, np.array([offset], np.uint32)) + else: + cpass.set_bind_group(0, bind_group, [99, offset, 99], 1, 1) + cpass.dispatch_workgroups(1) + cpass.end() + device.queue.submit([encoder.finish()]) + out = np.frombuffer(device.queue.read_buffer(sbuf), np.uint32) + assert list(out) == [10, 20] + + +def test_render_bundle_with_depth_format(device): + bundle_encoder = device.create_render_bundle_encoder( + color_formats=["rgba8unorm"], depth_stencil_format="depth24plus" + ) + bundle = bundle_encoder.finish() + assert isinstance(bundle, dawn.GPURenderBundle) + # The bundle can be executed in a pass with a matching depth attachment + color = device.create_texture( + size=(4, 4, 1), format="rgba8unorm", usage=wgpu.TextureUsage.RENDER_ATTACHMENT + ) + depth = device.create_texture( + size=(4, 4, 1), format="depth24plus", usage=wgpu.TextureUsage.RENDER_ATTACHMENT + ) + encoder = device.create_command_encoder() + rpass = encoder.begin_render_pass( + color_attachments=[ + {"view": color.create_view(), "load_op": "clear", "store_op": "store"} + ], + depth_stencil_attachment={ + "view": depth.create_view(), + "depth_clear_value": 1.0, + "depth_load_op": "clear", + "depth_store_op": "store", + }, + ) + rpass.execute_bundles([bundle]) + rpass.end() + device.queue.submit([encoder.finish()]) diff --git a/wgpu/_classes.py b/wgpu/_classes.py index adb19a5cb..781a98178 100644 --- a/wgpu/_classes.py +++ b/wgpu/_classes.py @@ -2519,51 +2519,62 @@ def __init__(self, message: str): class GPUCompilationMessage: """An object that contains information about a problem with shader compilation.""" + def __init__(self, message, type, line_num, line_pos, offset, length): + self._message = message + self._type = type + self._line_num = line_num + self._line_pos = line_pos + self._offset = offset + self._length = length + # IDL: readonly attribute DOMString message; @property def message(self) -> str: """The warning/error message.""" - raise NotImplementedError() + return self._message # IDL: readonly attribute GPUCompilationMessageType type; @property def type(self) -> enums.CompilationMessageTypeEnum: """The type of warning/problem.""" - raise NotImplementedError() + return self._type # IDL: readonly attribute unsigned long long lineNum; @property def line_num(self) -> int: """The corresponding line number in the shader source.""" - raise NotImplementedError() + return self._line_num # IDL: readonly attribute unsigned long long linePos; @property def line_pos(self) -> int: """The position on the line in the shader source.""" - raise NotImplementedError() + return self._line_pos # IDL: readonly attribute unsigned long long offset; @property def offset(self) -> int: - """Offset of ...""" - raise NotImplementedError() + """The offset (in UTF-16 code units) in the shader source.""" + return self._offset # IDL: readonly attribute unsigned long long length; @property def length(self) -> int: - """The length of the line?""" - raise NotImplementedError() + """The length (in UTF-16 code units) of the substring that the message refers to.""" + return self._length class GPUCompilationInfo: - """TODO""" + """The result of `GPUShaderModule.get_compilation_info_async()`: a list of messages.""" + + def __init__(self, messages): + self._messages = list(messages) # IDL: readonly attribute FrozenArray messages; @property def messages(self) -> list[GPUCompilationMessage]: """A list of `GPUCompilationMessage` objects.""" - raise NotImplementedError() + return self._messages class GPUQuerySet(GPUObjectBase): diff --git a/wgpu/backends/auto.py b/wgpu/backends/auto.py index 133482fac..7483a8989 100644 --- a/wgpu/backends/auto.py +++ b/wgpu/backends/auto.py @@ -1,7 +1,7 @@ # The default backend is wgpu-native, but this may change in the future. import os import sys -import importlib.util +import importlib.machinery def _load_backend(backend_name): @@ -33,8 +33,11 @@ def _auto_load_backend(): return _load_backend(backend_name) if sys.platform == "emscripten": - # In Pyodide, prefer the Dawn backend if its extension module is built - if importlib.util.find_spec("wgpu.backends.dawn._api") is not None: + # In Pyodide, prefer the Dawn backend if its extension module is built. + # Look for the file, because importing the package registers the backend. + dawn_dir = os.path.join(os.path.dirname(__file__), "dawn") + suffixes = importlib.machinery.EXTENSION_SUFFIXES + if any(os.path.isfile(os.path.join(dawn_dir, "_api" + s)) for s in suffixes): return _load_backend("dawn") return _load_backend("js_webgpu") else: diff --git a/wgpu/backends/dawn/_api.pyx b/wgpu/backends/dawn/_api.pyx index 93eb47b51..145c27590 100644 --- a/wgpu/backends/dawn/_api.pyx +++ b/wgpu/backends/dawn/_api.pyx @@ -2711,7 +2711,7 @@ class GPUBindingCommandsMixin(classes.GPUBindingCommandsMixin): cdef _Arena arena if p == NULL: _raise_released(self) - if dynamic_offsets_data: + if dynamic_offsets_data is not None and len(dynamic_offsets_data) > 0: if ( dynamic_offsets_data_start is not None or dynamic_offsets_data_length is not None @@ -3585,46 +3585,11 @@ class GPUQuerySet(classes.GPUQuerySet, GPUObjectBase): class GPUCompilationMessage(classes.GPUCompilationMessage): - def __init__(self, message, type, line_num, line_pos, offset, length): - self._message = message - self._type = type - self._line_num = line_num - self._line_pos = line_pos - self._offset = offset - self._length = length - - @property - def message(self): - return self._message - - @property - def type(self): - return self._type - - @property - def line_num(self): - return self._line_num - - @property - def line_pos(self): - return self._line_pos - - @property - def offset(self): - return self._offset - - @property - def length(self): - return self._length + pass class GPUCompilationInfo(classes.GPUCompilationInfo): - def __init__(self, messages): - self._messages = list(messages) - - @property - def messages(self): - return self._messages + pass class GPUDeviceLostInfo(classes.GPUDeviceLostInfo): diff --git a/wgpu/resources/codegen_report.md b/wgpu/resources/codegen_report.md index b4496c4ae..b7db2539a 100644 --- a/wgpu/resources/codegen_report.md +++ b/wgpu/resources/codegen_report.md @@ -25,9 +25,10 @@ * Diffs for GPUBindingCommandsMixin: change set_bind_group * Diffs for GPUQueue: add read_buffer, add read_texture, hide copy_external_image_to_texture * Diffs for DrawCancelled: add DrawCancelled -* Validated 39 classes, 121 methods, 52 properties +* Validated 39 classes, 123 methods, 52 properties ### Patching API for backends/wgpu_native/_api.py * Validated 39 classes, 115 methods, 0 properties +* Found 0 methods not implemented ## Validating backends/wgpu_native/_api.py * Enum PipelineErrorReason missing in webgpu.h * Enum AutoLayoutMode missing in webgpu.h From 39595ca16749c3b053453ce09363a73634113dad Mon Sep 17 00:00:00 2001 From: Mark Harfouche Date: Thu, 1 Oct 2026 07:55:23 -0400 Subject: [PATCH 8/8] Deploy the Pyodide demo to the fork's Pages; benchmark vs wgpu-native
Claude's draft * tools/dawn_pyodide/demo: a demo page (adapted from #840's): it installs the wgpu wheel with the Cython Dawn backend in Pyodide, prints the adapter info, runs a compute shader on 1M floats and checks the result, and renders a rotating triangle to a , through the browser's WebGPU. * New `pages` job (pushes to `dawn` on the fork only, after the Pyodide jobs pass): deploys that demo to the fork's GitHub Pages. It also builds the demo of the cffi variant from the dawn-pyodide branch (#840) and puts it under /cffi/, so both stay reachable on one site. If that build fails, a placeholder is deployed at /cffi/ and the main demo still deploys. * The native benchmark step now downloads wgpu-native and runs `bench_backends.py --all`, for a Dawn vs wgpu-native table (informational). The Node and Chrome benchmark steps were already there. * Deselect test_encoder_errors_raise_at_finish in Chrome: like the other call-site error tests, the browser reports the error asynchronously. Resume this Claude session: ``` cd /home/mark/git/feedstock/staged-recipes claude --resume 2cab6db9-a6ea-4976-a0e6-f4153fe5a651 ```
Claude-Session: https://claude.ai/code/session_01QMLpZTQYYCu2K7EaWNnkEG --- .github/workflows/dawn.yml | 97 ++++++++++++++++++- tools/dawn_pyodide/demo/demo.py | 148 +++++++++++++++++++++++++++++ tools/dawn_pyodide/demo/index.html | 65 +++++++++++++ 3 files changed, 307 insertions(+), 3 deletions(-) create mode 100644 tools/dawn_pyodide/demo/demo.py create mode 100644 tools/dawn_pyodide/demo/index.html diff --git a/.github/workflows/dawn.yml b/.github/workflows/dawn.yml index f67cc96ae..a750d45f2 100644 --- a/.github/workflows/dawn.yml +++ b/.github/workflows/dawn.yml @@ -10,6 +10,14 @@ name: Dawn backend # WebGPU). Tested in Node.js (navigator.gpu from the `webgpu` npm package, # which is Dawn, on lavapipe) and in headless Chrome (SwiftShader). # +# The per-call overhead benchmark (tools/bench_backends.py) runs natively (Dawn +# and wgpu-native), in Node.js and in Chrome, as informational steps. +# +# On pushes to the `dawn` branch of the fork, the demo page is deployed to +# GitHub Pages, with the demo of the cffi variant (#840, branch dawn-pyodide) +# built from that branch and put under /cffi/. Note: as long as the workflow of +# dawn-pyodide also deploys (to the root), the last deployment wins. +# # See tools/build_dawn.py and tools/dawn_pyodide. on: @@ -48,6 +56,7 @@ env: CHROME_DESELECT: >- tests/test_dawn_backend.py::test_validation_error_raises_at_call_site tests/test_dawn_backend.py::test_shader_error_raises + tests/test_dawn_backend.py::test_encoder_errors_raise_at_finish tests/test_wgpu_native_buffer.py::test_buffer_init3 tests/test_wgpu_native_texture.py::test_view_formats @@ -100,6 +109,7 @@ jobs: rendercanvas imageio pypng + requests cache-environment: false - name: Show versions @@ -149,14 +159,14 @@ jobs: export VK_ICD_FILENAMES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -1) pytest tests -q -rfE --continue-on-collection-errors || true - - name: Benchmark the per-call overhead (informational) + - name: Benchmark the per-call overhead, Dawn vs wgpu-native (informational) continue-on-error: true env: - WGPUPY_BACKEND: dawn PYTHONPATH: ${{ github.workspace }} run: | export VK_ICD_FILENAMES=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -1) - python tools/bench_backends.py + python tools/download_wgpu_native.py + python tools/bench_backends.py --all codegen-dawn: name: Dawn codegen up to date @@ -301,3 +311,84 @@ jobs: path: | triangle.png site + + pages: + name: Deploy the demo to GitHub Pages (fork only) + if: github.event_name != 'pull_request' && github.repository == 'hmaarrfk/wgpu-py' && github.ref == 'refs/heads/dawn' + needs: [pyodide-build, pyodide-node, pyodide-chrome] + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + concurrency: + group: github-pages + cancel-in-progress: false + env: + PYODIDE_XBUILDENV_PATH: /home/runner/xbuildenv + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: pyodide-wheel + path: site/wheels + - name: Assemble the demo (this branch, Cython) + run: | + cp tools/dawn_pyodide/demo/index.html tools/dawn_pyodide/demo/demo.py site/ + python3 - site "${GITHUB_SHA}" <<'EOF' + import json, os, sys + d, sha = sys.argv[1:] + json.dump({ + "pyodide": os.environ["PYODIDE_VERSION"], + "dawn": "v20260929.200159", + "commit": sha[:10], + "wheels": sorted(os.listdir(os.path.join(d, "wheels"))), + }, open(os.path.join(d, "wheels.json"), "w")) + EOF + # The demo of the cffi variant (#840) is built from its branch, so that one + # workflow deploys the whole site. If that fails, the main demo still deploys. + - uses: actions/checkout@v4 + with: + ref: dawn-pyodide + path: cffi-src + - uses: actions/setup-python@v5 + with: + python-version: '3.14' + - name: Build the demo of the cffi variant (#840) for /cffi/ + id: cffi + continue-on-error: true + run: | + pip install pyodide-build==${PYODIDE_BUILD_VERSION} build hatchling + pyodide xbuildenv install ${PYODIDE_VERSION} + pyodide xbuildenv install-emscripten + source ${PYODIDE_XBUILDENV_PATH}/${PYODIDE_VERSION}/emsdk/emsdk_env.sh + mkdir -p site/cffi/wheels + (cd cffi-src/dawn_bindings && pyodide build --exports pyinit -o ../../site/cffi/wheels) + (cd cffi-src && WGPU_PY_BUILD_NOARCH=1 python -m build --wheel -o ../site/cffi/wheels) + cp cffi-src/dawn_bindings/demo/index.html cffi-src/dawn_bindings/demo/demo.py site/cffi/ + python3 - site/cffi "$(git -C cffi-src rev-parse HEAD)" <<'EOF' + import json, os, sys + d, sha = sys.argv[1:] + json.dump({ + "pyodide": os.environ["PYODIDE_VERSION"], + "dawn": "v20260929.200159", + "commit": sha[:10], + "wheels": sorted(os.listdir(os.path.join(d, "wheels"))), + }, open(os.path.join(d, "wheels.json"), "w")) + EOF + - name: Placeholder for /cffi/ if its build failed + if: steps.cffi.outcome != 'success' + run: | + rm -rf site/cffi && mkdir -p site/cffi + echo 'cffi demo

The demo of the cffi variant (#840) failed to build in the last deploy. The Cython demo.

' > site/cffi/index.html + - run: ls -R site + - uses: actions/configure-pages@v5 + - uses: actions/upload-pages-artifact@v3 + with: + path: site + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/tools/dawn_pyodide/demo/demo.py b/tools/dawn_pyodide/demo/demo.py new file mode 100644 index 000000000..3a90b072e --- /dev/null +++ b/tools/dawn_pyodide/demo/demo.py @@ -0,0 +1,148 @@ +# wgpu-py in the browser: the Dawn backend (a Cython extension) on top of +# Emdawnwebgpu, i.e. the browser's own WebGPU implementation (hardware +# accelerated). Deployed as a demo page by .github/workflows/dawn.yml; the same +# demo as for the cffi variant in #840. +import array +import struct +import time + +import js +from pyodide.ffi import create_proxy + +import wgpu + +COMPUTE_SHADER = """ +@group(0) @binding(0) var a: array; +@group(0) @binding(1) var b: array; +@compute @workgroup_size(64) fn main(@builtin(global_invocation_id) id: vec3) { + b[id.x] = a[id.x] * a[id.x]; +} +""" + +RENDER_SHADER = """ +struct VOut { @builtin(position) pos: vec4, @location(0) color: vec4 }; +@group(0) @binding(0) var angle: vec4; +@vertex fn vs_main(@builtin(vertex_index) i: u32) -> VOut { + var p = array, 3>(vec2(0.0, 0.7), vec2(-0.6, -0.5), vec2(0.6, -0.5)); + var c = array, 3>(vec3(1.0, 0.25, 0.2), vec3(0.2, 0.9, 0.3), vec3(0.2, 0.4, 1.0)); + let a = angle.x; + let q = vec2(p[i].x * cos(a) - p[i].y * sin(a), p[i].x * sin(a) + p[i].y * cos(a)); + var out: VOut; + out.pos = vec4(q, 0.0, 1.0); + out.color = vec4(c[i], 1.0); + return out; +} +@fragment fn fs_main(in: VOut) -> @location(0) vec4 { return in.color; } +""" + + +async def run_compute(device, log): + n = 1 << 20 + data = array.array("f", range(n)) + a = device.create_buffer_with_data(data=data, usage=wgpu.BufferUsage.STORAGE) + b = device.create_buffer( + size=n * 4, usage=wgpu.BufferUsage.STORAGE | wgpu.BufferUsage.COPY_SRC + ) + readback = device.create_buffer( + size=n * 4, usage=wgpu.BufferUsage.MAP_READ | wgpu.BufferUsage.COPY_DST + ) + pipeline = device.create_compute_pipeline( + layout="auto", + compute={"module": device.create_shader_module(code=COMPUTE_SHADER)}, + ) + bind_group = device.create_bind_group( + layout=pipeline.get_bind_group_layout(0), + entries=[ + {"binding": 0, "resource": {"buffer": a}}, + {"binding": 1, "resource": {"buffer": b}}, + ], + ) + t0 = time.perf_counter() + encoder = device.create_command_encoder() + cpass = encoder.begin_compute_pass() + cpass.set_pipeline(pipeline) + cpass.set_bind_group(0, bind_group) + cpass.dispatch_workgroups(n // 64) + cpass.end() + encoder.copy_buffer_to_buffer(b, 0, readback, 0, n * 4) + device.queue.submit([encoder.finish()]) + await readback.map_async(wgpu.MapMode.READ) + out = readback.read_mapped().cast("f") + readback.unmap() + dt = time.perf_counter() - t0 + ok = all(out[i] == float(i * i) for i in (0, 1, 2, 3, 1000, 4095)) + log( + f"Compute: squared {n:,} floats on the GPU in {dt * 1000:.1f} ms " + f"(incl. readback): out[:4] = {list(out[:4])}, out[4095] = {out[4095]}" + ) + log("Compute result: " + ("CORRECT" if ok else "WRONG")) + return ok + + +async def main(canvas, log): + adapter = await wgpu.gpu.request_adapter_async(power_preference="high-performance") + info = adapter.info + log(f"wgpu backend: {type(wgpu.gpu).__module__}") + log( + f"Adapter: vendor={info['vendor']!r} architecture={info['architecture']!r} " + f"device={info['device']!r} description={info['description']!r} " + f"backend={info['backend_type']}" + ) + if "swiftshader" in (info["architecture"] + info["vendor"]).lower(): + log( + "This is a software (SwiftShader) adapter: the browser has no usable GPU here." + ) + else: + log("This is a hardware adapter: the browser's WebGPU on your GPU.") + device = await adapter.request_device_async() + ok = await run_compute(device, log) + + # Render a rotating triangle to the + context = wgpu.gpu.get_canvas_context({"window": canvas, "platform": "browser"}) + context.set_physical_size(canvas.width, canvas.height) + fmt = context.get_preferred_format(adapter) + context.configure(device=device, format=fmt) + module = device.create_shader_module(code=RENDER_SHADER) + pipeline = device.create_render_pipeline( + layout="auto", + vertex={"module": module}, + fragment={"module": module, "targets": [{"format": fmt}]}, + ) + ubuf = device.create_buffer( + size=16, usage=wgpu.BufferUsage.UNIFORM | wgpu.BufferUsage.COPY_DST + ) + bind_group = device.create_bind_group( + layout=pipeline.get_bind_group_layout(0), + entries=[{"binding": 0, "resource": {"buffer": ubuf}}], + ) + t_start = time.perf_counter() + frames = [0] + + def draw_frame(_timestamp=None): + angle = (time.perf_counter() - t_start) * 0.8 + device.queue.write_buffer(ubuf, 0, struct.pack("4f", angle, 0, 0, 0)) + view = context.get_current_texture().create_view() + encoder = device.create_command_encoder() + rpass = encoder.begin_render_pass( + color_attachments=[ + { + "view": view, + "clear_value": (0.08, 0.08, 0.1, 1), + "load_op": "clear", + "store_op": "store", + } + ] + ) + rpass.set_pipeline(pipeline) + rpass.set_bind_group(0, bind_group) + rpass.draw(3) + rpass.end() + device.queue.submit([encoder.finish()]) + context.present() + frames[0] += 1 + js.requestAnimationFrame(draw_proxy) + + draw_proxy = create_proxy(draw_frame) + draw_frame() + log(f"Rendering a triangle to the canvas ({fmt}).") + return ok diff --git a/tools/dawn_pyodide/demo/index.html b/tools/dawn_pyodide/demo/index.html new file mode 100644 index 000000000..1857c2cdd --- /dev/null +++ b/tools/dawn_pyodide/demo/index.html @@ -0,0 +1,65 @@ + + + + + +wgpu-py on Dawn (Cython) in Pyodide + + + +

wgpu-py on Dawn (Cython backend), in Pyodide, on your GPU

+

+ This page loads Pyodide and installs a wgpu wheel that + contains the Dawn backend as a compiled Cython extension (built with pyodide build against Dawn's + Emdawnwebgpu). It then runs + demo.py: a compute shader and a rendered triangle, through the browser's WebGPU + (hardware accelerated). The same backend code also runs natively on Dawn. + See pygfx/wgpu-py#839 and + #838. + The variant with cffi bindings (#840) is at + cffi/. +

+

Loading…

+ +

+
+
+