-
Notifications
You must be signed in to change notification settings - Fork 53
Add and document many synchronous error statuses #377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
77e4660
Add and document many synchronous error statuses
kainino0x 7cb02b2
address comments, only use synchronous struct-chaining error on out-s…
kainino0x 5f9d99f
change I forgot to save
kainino0x e9cf7dd
Merge branch 'main' into return-statuses
kainino0x e6fa1e3
allow overlapping const ranges
kainino0x e6fdcca
Merge branch 'main' into return-statuses
kainino0x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Errors {#Errors} | ||
|
||
Errors are surfaced in several ways. | ||
|
||
Most errors only result from incorrect use of the API and should not need to be handled at runtime. | ||
However, a few (@ref WGPUErrorType_OutOfMemory, @ref WGPUErrorType_Internal) are potentially useful to handle. | ||
|
||
## Device Error {#DeviceError} | ||
|
||
These behave the same way as [in the WebGPU JavaScript API specification](https://www.w3.org/TR/webgpu/#errors-and-debugging). | ||
They are receivable via @ref wgpuDevicePopErrorScope() and @ref WGPUDeviceDescriptor::uncapturedErrorCallbackInfo. | ||
|
||
These errors include: | ||
|
||
- All device-timeline errors in the WebGPU specification. | ||
- Enum values which are numerically invalid (this is not possible in JavaScript). | ||
- Enum values which are require features not enabled on the device (a [content-timeline](https://www.w3.org/TR/webgpu/#content-timeline) error in JavaScript), for example compressed texture formats. | ||
- Other content-timeline errors where specified. | ||
|
||
## Callback Error {#CallbackError} | ||
|
||
These behave similarly to the Promise-returning JavaScript APIs. Instead of there being two callbacks like in JavaScript (one for resolve and one for reject), there is a single callback which receives a status code, and depending on the status, _either_ a valid result with an empty message string (`{NULL, 0}`), _or_ an invalid result with a non-empty message string. | ||
|
||
## Synchronous Error {#SynchronousError} | ||
|
||
These errors include: | ||
|
||
- @ref SynchronousStructChainingError cases. | ||
- [Content-timeline](https://www.w3.org/TR/webgpu/#content-timeline) errors other than those which are surfaced as @ref DeviceError in `webgpu.h`. See specific documentation to determine how each error is exposed. | ||
|
||
Generally these will return some kind of failure status (like \ref WGPUStatus_Error) or `NULL`, and produce an @ref ImplementationDefinedLogging message. | ||
|
||
### Implementation-Defined Logging {#ImplementationDefinedLogging} | ||
|
||
Entry points may also specify that they produce "implementation-defined logging". | ||
These messages are logged in an implementation defined way (e.g. to an implementation-specific callback, or to a logging runtime). | ||
They are intended to be intended to be read by humans, useful primarily for development and crash reporting. | ||
|
||
## Struct-Chaining Errors {#StructChainingErrors} | ||
|
||
A struct-chaining error happens when the @ref SType of a struct in a struct chain is not valid for that chain. | ||
|
||
Struct chains which are used in device-timeline validation/operations (e.g. @ref WGPUBufferDescriptor in @ref WGPUDeviceCreateBuffer) have their chain errors surfaced asynchronously, like any other validation error. | ||
|
||
### Out-Struct-Chain Error {#OutStructChainError} | ||
|
||
Operations which take out-struct-chains (e.g. @ref WGPULimits, in @ref WGPUAdapterGetLimits/@ref WGPUDeviceGetLimits, but not in @ref WGPUDeviceDescriptor) handle struct-chaining errors as follows: | ||
|
||
- The output struct and struct chain is not modified. | ||
- The operation produces a @ref SynchronousError (return value and log message). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.