Cross-platform, safe, pure-rust graphics api.
Go to file
bors[bot] 0f592b4443 Merge #34
34: Basic windowing and presentation r=grovesNL a=kvark

- [x] native swapchain creation
- [x] native use of frames and presentation
- [x] native semaphore waits
- [x] rust wrapping
- [x] working examples

~~I may or may not bite the bullet and update gfx-rs here. Probably not :)~~

## Architecture

There is a bit of complexity here to manage all the synchronization and lifetimes properly. Essentially, presentation is exposed in Vulkan/gfx-rs as a separate hidden queue, so we inevitably run into the territory of using semaphores for synchronization, where previously we could ignore them for workloads on a single queue.

A swapchain has a fixed (at creation) number of frames, each represented by a texture plus view pair. When `get_next_texture` is called we acquire the next image index and return this pair. We wait for the associated fence to make sure the frame is no image used. We then associate a semaphore with this index for image availability.

The texture has extra information to link back to an image of the swapchain (which is `None` for regular textures). Whenever it's used, the command buffer collects that link to be used on submission, where it's just resolved to a semaphore that we wait on actual submission.

Presenting on a swapchain creates a temporary command buffer that we only use for transiting the swapchain image into presentable state. This small submission is useful for establishing a "ready" semaphore as well as a fence (waited in `get_next_image`). The "ready" semaphore is used immediately for native `present` call.

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-01-19 13:31:35 +00:00
examples DX11 support 2019-01-17 23:03:11 -05:00
wgpu-bindings native: basic surface and swapchain creation 2019-01-14 16:03:51 -05:00
wgpu-native DX11 support 2019-01-17 23:03:11 -05:00
wgpu-rs DX11 support 2019-01-17 23:03:11 -05:00
.gitignore Create C example 2018-09-23 13:25:05 -06:00
.travis.yml Fix deadlock in barrier insertion 2018-12-01 22:53:21 -05:00
bors.toml CI scripts 2018-09-14 11:39:24 -04:00
Cargo.lock DX11 support 2019-01-17 23:03:11 -05:00
Cargo.toml First bits of wgpu-rs 2018-09-26 14:31:03 -04:00
LICENSE Initial commit 2018-09-13 15:18:51 -04:00
Makefile Fix deadlock in barrier insertion 2018-12-01 22:53:21 -05:00
README.md Readme update with fixed links and components description 2018-09-26 14:31:06 -04:00
rustfmt.toml CI scripts 2018-09-14 11:39:24 -04:00

WebGPU

Build Status Gitter

This is an experimental WebGPU implementation as a native static library. It's written in Rust and is based on gfx-hal and satellite libraries. The corresponding WebIDL specification can be found at gpuweb project.

The implementation consists of the following parts:

  • wgpu-native - the native implementation of WebGPU as a C API library
  • wgpu-bindings - automatic generator of actual C headers
  • wgpu-remote - remoting layer to work with WebGPU across the process boundary
  • wgpu-rs - idiomatic Rust wrapper of the native library