WebGPU Headers: Utility Types

Macros

#define WGPU_STRING_VIEW_INIT
 

Typedefs

typedef struct WGPUStringView WGPUStringView
 
typedef uint64_t WGPUFlags
 
typedef uint32_t WGPUBool
 

◆ WGPU_STRING_VIEW_INIT

#define WGPU_STRING_VIEW_INIT

◆ WGPUStringView

typedef struct WGPUStringView WGPUStringView

Nullable value defining a pointer+length view into a UTF-8 encoded string.

Values passed into the API may use the special length value WGPU_STRLEN to indicate a null-terminated string. Non-null values passed out of the API (for example as callback arguments) always provide an explicit length and may or may not be null-terminated.

Some inputs to the API accept null values. Those which do not accept null values "default" to the empty string when null values are passed.

Values are encoded as follows:

  • {NULL, WGPU_STRLEN}: the null value.
  • {non_null_pointer, WGPU_STRLEN}: a null-terminated string view.
  • {any, 0}: the empty string.
  • {NULL, non_zero_length}: not allowed (null dereference).
  • {non_null_pointer, non_zero_length}: an explictly-sized string view with size non_zero_length (in bytes).

For info on how this is used in various places, see Strings.

◆ WGPUFlags

typedef uint64_t WGPUFlags

◆ WGPUBool

typedef uint32_t WGPUBool