package
0.0.0-20241214054307-77a0f3d5ad72
Repository: https://github.com/webgpu-native/webgpu-headers.git
Documentation: pkg.go.dev

# README

gen

The generator for generating webgpu.h header and other extension headers or implementation specific headers from the yaml spec files.

Generate implementation specific header

The generator also allows generating custom implementation specific headers that build on top of webgpu.h header. The generator accepts the combination of -yaml & -header flags in sequence, which it uses to validate the specifications and then generate their headers.

For example, if wgpu.yml contains the implementation specific API, the header can be generated using:

> go run ./gen -schema schema.json -yaml webgpu.yml -header webgpu.h -yaml wgpu.yml -header wgpu.h

Since the generator does some duplication validation, the order of the files matter, so generator mandates the core webgpu.yml to be first in the sequence.

yaml spec

Types

Primitive typesComplex types
boolenum.*
stringbitflag.*
uint16struct.*
uint32function_type.*
uint64object.*
usize
int16
int32
float32
float64
c_void
Structure types
extensiblestructs that can be extended
extensionextension structs used in extensible structs' chains
standalonestructs that are neither extensions nor extensible

Arrays

Arrays are supported using a special syntax, for example array<uint32>. The generator will emit two fields for array types, one for element count and another for the pointer to the type.