Skip to content
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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kainino0x
Copy link
Collaborator

@kainino0x kainino0x commented Oct 19, 2024

Sorry this is a lot of things in one PR, but I kept changing all of the docs to be consistent with each other, so this was easier.
(Can split if there are some parts that need more time to discuss.)

Fixes #255
Fixes (again?) #291
Issue #225
Fixes #64


Generally these will return some kind of failure status (like \ref WGPUStatus_Error), or `NULL`.

### Struct-Chaining Error {#StructChainingError}
Copy link
Collaborator

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.

Copy link
Collaborator

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.

@@ -840,6 +840,8 @@ enums:
doc: The system ran out of memory.
- name: device_lost
doc: The @ref WGPUDevice configured on the @ref WGPUSurface was lost.
- name: error
doc: The surface is not configured, or there was a @ref StructChainingError.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just point at the Surface.md article for a description of what might return an error?

@@ -3184,8 +3190,8 @@ objects:
TODO
returns:
doc: |
TODO
type: bool
Returns @ref WGPUStatus_Error (and leaves `limits` unchanged) if there was a @ref StructChainingError.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about if the device/adapter itself is an error? IMHO the error cases should be defined in the algorithm steps of the articles, and not call out a particular kind of error.

@@ -3291,34 +3299,43 @@ objects:
TODO
returns:
doc: |
TODO
Returns a mutable pointer to beginning of the mapped range.
It may be written, but reading is undefined behavior unless the buffer was also mapped with @ref WGPUMapMode_Read.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading should be a valid for mapped write buffers, because any mapped range should get flushed to the GPU and not be modified if the implementation didn't end up writing to it. That's what happens in JS.

@@ -4081,7 +4096,8 @@ objects:
callback: callback.queue_work_done
- name: write_buffer
doc: |
TODO
Produces a @ref DeviceError if `size` is not a multiple of 4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error is already handled in the JS spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error management in unconfigured Surface methods Synchronous validation in getMappedRange
2 participants