WebGPU Headers
The WebGPU C API
 
Loading...
Searching...
No Matches
Utility Types

Data Structures

struct  WGPUStringView
 

Macros

#define WGPU_STRLEN   SIZE_MAX
 
#define WGPU_STRING_VIEW_INIT
 

Typedefs

typedef uint64_t WGPUFlags
 
typedef uint32_t WGPUBool
 
typedef struct WGPUStringView WGPUStringView
 

Detailed Description

Macro Definition Documentation

◆ WGPU_STRLEN

#define WGPU_STRLEN   SIZE_MAX

Sentinel value used in WGPUStringView to indicate that the pointer is to a null-terminated string, rather than an explicitly-sized string.

Definition at line 129 of file webgpu.h.

◆ WGPU_STRING_VIEW_INIT

#define WGPU_STRING_VIEW_INIT
Value:
_wgpu_MAKE_INIT_STRUCT(WGPUStringView, { \
/*.data=*/NULL _wgpu_COMMA \
/*.length=*/WGPU_STRLEN _wgpu_COMMA \
})
#define WGPU_STRLEN
Definition webgpu.h:129

Definition at line 131 of file webgpu.h.

Typedef Documentation

◆ WGPUFlags

typedef uint64_t WGPUFlags

Definition at line 96 of file webgpu.h.

◆ WGPUBool

typedef uint32_t WGPUBool

Definition at line 97 of file webgpu.h.

◆ 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.