-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fill in full design explanation in README.md #35
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,17 +47,52 @@ This proposal is a collection of multiple packages. | |
|
||
### Goals [or Motivating Use Cases, or Scenarios] | ||
|
||
[What is the end-user need which this project aims to address?] | ||
- Bring some of the benefits that Wasm provides to CPU code, over to GPU code. | ||
- Enable secure GPU compute. | ||
- Enable wasm-based UI applications. | ||
- Enable wasm-based graphics even in environments with no GPUs. | ||
- Enable wasm-based AI for cases not covered by wasi-nn. | ||
|
||
### Non-goals | ||
|
||
[If there are "adjacent" goals which may appear to be in scope but aren't, enumerate them here. This section may be fleshed out as your design progresses and you encounter necessary technical and other trade-offs.] | ||
- A full windowing API. | ||
- VR/AR (subject to change, if we find contributors with expertise in the field). | ||
|
||
### API walk-through | ||
|
||
The full API documentation can be found in [imports.md](imports.md). | ||
|
||
[Walk through of how someone would use this API.] | ||
#### `wasi:webgpu` | ||
|
||
`wasi:webgpu` is based on the official [webgpu spec](https://www.w3.org/TR/webgpu/). | ||
|
||
`wasi:webgpu` does deviate sometimes from the webgpu spec, namely, in cases where the spec makes assumptions about running in a web or JS environment. Wherever `wasi:webgpu` deviates from the spec, a clear explanation should be documented. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree we should say it deviates, but we should be careful to clarify that it varies only in syntax and not semantics. The goal is to remain 100% compatible with the functionality of WebGPU, with just minor syntactical differences from not having a JS/Web env. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair point, feel free to edit the text |
||
|
||
#### `wasi:surface` | ||
|
||
`wasi:surface` is a basic surface API. It lets you create a surface you can draw to (similar to canvas on web). You can also get basic user events from the surface, like pointer and keyboard events. | ||
|
||
`wasi:surface` supports the following event types: | ||
- Pointer: For mouse/touch/pencil/etc. | ||
- Key: For keyboard events. | ||
- Resize: Surface was resized. | ||
- Frame: Fires on each frame. (similar to [`requestAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) on the web) | ||
|
||
Other user input, such as scroll wheel, clipboard, drag-over, device motion, device orientation, gamepad input, etc., are all useful in many applications, but since they're a bit less common, they're out of scope for now. However, they might be added eventually. | ||
|
||
#### `wasi:frame-buffer` | ||
|
||
A simple frame buffer API for CPU-based rendering. | ||
|
||
This might be especially useful in embedded. | ||
|
||
#### `wasi:graphics-context` | ||
|
||
`wasi:graphics-context` is the point of connection between a graphics API (`wasi:webgpu`, `wasi:frame-buffer`, future graphics API) to a windowing system (`wasi:surface`, future windowing system). See diagram. | ||
|
||
![image](https://github.com/user-attachments/assets/55bcc436-7bcd-4f02-9090-888106b889ef) | ||
|
||
`wasi:graphics-context` has a method to get the next frame as an `abstract-buffer`. Abstract buffer's contents can't be read. Instead, the graphics API in use can turn the `abstract-buffer` into something it can make use of. E.g. webgpu is able to turn the buffer into a `GPUTexture`. The runtime can easily, in the background, represent the `abstract-buffer` as a `GPUTexture`, and the conversion would just be a no-op. | ||
|
||
#### [Use case 1] | ||
|
||
MendyBerger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
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.
Might want to clarify this - we're not explicitly addressing GPU ISAs which this statement could imply
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.
Fair point, feel free to edit the text