-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add and document many synchronous error statuses #377
Open
kainino0x
wants to merge
1
commit into
webgpu-native:main
Choose a base branch
from
kainino0x:return-statuses
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 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,42 @@ | ||
# 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 Errors {#CallbackErrors} | ||
|
||
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 Errors {#SynchronousErrors} | ||
|
||
These errors include: | ||
|
||
- @ref StructChainingError 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`. | ||
|
||
### Struct-Chaining Error {#StructChainingError} | ||
|
||
A struct-chaining error happens when the `SType` of a struct in a struct chain is not valid for that chain. | ||
The API returns a failure status or `NULL` and produces 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. |
This file contains 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't these piggy-back on device errors when possible? There's a lot of call that take extensible structs and that return void.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically they are validation errors.