Skip to content

Commit

Permalink
Default *CallbackInfo.mode to zero (invalid) instead of WaitAnyOnly (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x authored Dec 20, 2024
1 parent 77a0f3d commit f0121fc
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 10 deletions.
7 changes: 6 additions & 1 deletion gen/cheader.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ typedef struct WGPUChainedStruct {
typedef struct WGPU{{.Name | PascalCase}}CallbackInfo{{$.ExtSuffix}} {
WGPUChainedStruct const * nextInChain;
{{- if eq .Style "callback_mode" }}
/**
* Controls when the callback may be called.
*
* Has no default. The `INIT` macro sets this to (@ref WGPUCallbackMode)0.
*/
WGPUCallbackMode mode;
{{- end}}
WGPU{{.Name | PascalCase}}Callback{{$.ExtSuffix}} callback;
Expand All @@ -298,7 +303,7 @@ typedef struct WGPU{{.Name | PascalCase}}CallbackInfo{{$.ExtSuffix}} {
#define WGPU_{{.Name | ConstantCase}}_CALLBACK_INFO{{if $.ExtSuffix}}_{{$.ExtSuffix}}{{end}}_INIT _wgpu_MAKE_INIT_STRUCT(WGPU{{.Name | PascalCase}}CallbackInfo{{$.ExtSuffix}}, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
{{- if eq .Style "callback_mode" }}
/*.mode=*/WGPUCallbackMode_WaitAnyOnly _wgpu_COMMA \
/*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
{{- end}}
/*.callback=*/NULL _wgpu_COMMA \
/*.userdata1=*/NULL _wgpu_COMMA \
Expand Down
63 changes: 54 additions & 9 deletions webgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,11 @@ typedef struct WGPUChainedStruct {
*/
typedef struct WGPUBufferMapCallbackInfo {
WGPUChainedStruct const * nextInChain;
/**
* Controls when the callback may be called.
*
* Has no default. The `INIT` macro sets this to (@ref WGPUCallbackMode)0.
*/
WGPUCallbackMode mode;
WGPUBufferMapCallback callback;
WGPU_NULLABLE void* userdata1;
Expand All @@ -1337,14 +1342,19 @@ typedef struct WGPUBufferMapCallbackInfo {
*/
#define WGPU_BUFFER_MAP_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUBufferMapCallbackInfo, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.mode=*/WGPUCallbackMode_WaitAnyOnly _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 const * nextInChain;
/**
* Controls when the callback may be called.
*
* Has no default. The `INIT` macro sets this to (@ref WGPUCallbackMode)0.
*/
WGPUCallbackMode mode;
WGPUCompilationInfoCallback callback;
WGPU_NULLABLE void* userdata1;
Expand All @@ -1356,14 +1366,19 @@ typedef struct WGPUCompilationInfoCallbackInfo {
*/
#define WGPU_COMPILATION_INFO_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCompilationInfoCallbackInfo, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.mode=*/WGPUCallbackMode_WaitAnyOnly _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 const * nextInChain;
/**
* Controls when the callback may be called.
*
* Has no default. The `INIT` macro sets this to (@ref WGPUCallbackMode)0.
*/
WGPUCallbackMode mode;
WGPUCreateComputePipelineAsyncCallback callback;
WGPU_NULLABLE void* userdata1;
Expand All @@ -1375,14 +1390,19 @@ typedef struct WGPUCreateComputePipelineAsyncCallbackInfo {
*/
#define WGPU_CREATE_COMPUTE_PIPELINE_ASYNC_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCreateComputePipelineAsyncCallbackInfo, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.mode=*/WGPUCallbackMode_WaitAnyOnly _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 const * nextInChain;
/**
* Controls when the callback may be called.
*
* Has no default. The `INIT` macro sets this to (@ref WGPUCallbackMode)0.
*/
WGPUCallbackMode mode;
WGPUCreateRenderPipelineAsyncCallback callback;
WGPU_NULLABLE void* userdata1;
Expand All @@ -1394,14 +1414,19 @@ typedef struct WGPUCreateRenderPipelineAsyncCallbackInfo {
*/
#define WGPU_CREATE_RENDER_PIPELINE_ASYNC_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUCreateRenderPipelineAsyncCallbackInfo, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.mode=*/WGPUCallbackMode_WaitAnyOnly _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 const * nextInChain;
/**
* Controls when the callback may be called.
*
* Has no default. The `INIT` macro sets this to (@ref WGPUCallbackMode)0.
*/
WGPUCallbackMode mode;
WGPUDeviceLostCallback callback;
WGPU_NULLABLE void* userdata1;
Expand All @@ -1413,14 +1438,19 @@ typedef struct WGPUDeviceLostCallbackInfo {
*/
#define WGPU_DEVICE_LOST_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUDeviceLostCallbackInfo, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.mode=*/WGPUCallbackMode_WaitAnyOnly _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 const * nextInChain;
/**
* Controls when the callback may be called.
*
* Has no default. The `INIT` macro sets this to (@ref WGPUCallbackMode)0.
*/
WGPUCallbackMode mode;
WGPUPopErrorScopeCallback callback;
WGPU_NULLABLE void* userdata1;
Expand All @@ -1432,14 +1462,19 @@ typedef struct WGPUPopErrorScopeCallbackInfo {
*/
#define WGPU_POP_ERROR_SCOPE_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUPopErrorScopeCallbackInfo, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.mode=*/WGPUCallbackMode_WaitAnyOnly _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 const * nextInChain;
/**
* Controls when the callback may be called.
*
* Has no default. The `INIT` macro sets this to (@ref WGPUCallbackMode)0.
*/
WGPUCallbackMode mode;
WGPUQueueWorkDoneCallback callback;
WGPU_NULLABLE void* userdata1;
Expand All @@ -1451,14 +1486,19 @@ typedef struct WGPUQueueWorkDoneCallbackInfo {
*/
#define WGPU_QUEUE_WORK_DONE_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPUQueueWorkDoneCallbackInfo, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.mode=*/WGPUCallbackMode_WaitAnyOnly _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 const * nextInChain;
/**
* Controls when the callback may be called.
*
* Has no default. The `INIT` macro sets this to (@ref WGPUCallbackMode)0.
*/
WGPUCallbackMode mode;
WGPURequestAdapterCallback callback;
WGPU_NULLABLE void* userdata1;
Expand All @@ -1470,14 +1510,19 @@ typedef struct WGPURequestAdapterCallbackInfo {
*/
#define WGPU_REQUEST_ADAPTER_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestAdapterCallbackInfo, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.mode=*/WGPUCallbackMode_WaitAnyOnly _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 const * nextInChain;
/**
* Controls when the callback may be called.
*
* Has no default. The `INIT` macro sets this to (@ref WGPUCallbackMode)0.
*/
WGPUCallbackMode mode;
WGPURequestDeviceCallback callback;
WGPU_NULLABLE void* userdata1;
Expand All @@ -1489,7 +1534,7 @@ typedef struct WGPURequestDeviceCallbackInfo {
*/
#define WGPU_REQUEST_DEVICE_CALLBACK_INFO_INIT _wgpu_MAKE_INIT_STRUCT(WGPURequestDeviceCallbackInfo, { \
/*.nextInChain=*/NULL _wgpu_COMMA \
/*.mode=*/WGPUCallbackMode_WaitAnyOnly _wgpu_COMMA \
/*.mode=*/_wgpu_ENUM_ZERO_INIT(WGPUCallbackMode) _wgpu_COMMA \
/*.callback=*/NULL _wgpu_COMMA \
/*.userdata1=*/NULL _wgpu_COMMA \
/*.userdata2=*/NULL _wgpu_COMMA \
Expand Down

0 comments on commit f0121fc

Please sign in to comment.