Commit Graph

246 Commits

Author SHA1 Message Date
bors[bot]
370236330f Merge #82
82: Add updated texture formats r=kvark a=unconed

Adds the texture formats from:
https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl


Co-authored-by: Steven Wittens <steven@acko.net>
2019-02-28 14:50:35 +00:00
bors[bot]
193eec694e Merge #81
81: Buffer tracking and unmapping r=kvark a=swiftcoder

Adds preliminary transitioning of buffers to mapped state.
Adds buffer unmapping to the cube sample.
Modifies wgpu_queue_submit to not hold a write lock on the device during callbacks (this could definitely be cleaner, but I'm not sure which direction to take refactoring here).

Co-authored-by: Tristam MacDonald <tristam@trist.am>
2019-02-28 14:18:16 +00:00
Steven Wittens
b74b7fdd8c Update textureformats in examples 2019-02-28 06:36:45 +01:00
Steven Wittens
9151510b24 Add updated texture formats 2019-02-28 06:32:26 +01:00
Tristam MacDonald
0f85eb86a1 Buffer tracking and unmapping
Adds preliminary transitioning of buffers to mapped state.
Adds buffer unmapping to the cube sample.
Modifies wgpu_queue_submit to not hold a write lock on the device during callbacks.
2019-02-27 21:15:47 -08:00
bors[bot]
26bc6955f8 Merge #77
77: Storage indexing, framebuffer tracking, and a bunch of validation fixes r=grovesNL a=kvark

Closes #73
Closes #75
Closes #79

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-02-27 13:34:12 +00:00
Dzmitry Malyshau
8ad1476872 Fix tracking of the set_sub_data service command buffer 2019-02-27 08:31:38 -05:00
Dzmitry Malyshau
76473bb38a Stitch mode for insert_barriers 2019-02-26 23:56:38 -05:00
Dzmitry Malyshau
cc5900b160 Refactor the view tracker 2019-02-26 23:05:36 -05:00
Dzmitry Malyshau
0d59c16f16 Refactor insert_barriers 2019-02-26 22:55:04 -05:00
Dzmitry Malyshau
d631b2c6f2 Fix depth clamping semantics 2019-02-26 22:36:58 -05:00
Dzmitry Malyshau
cdc9d65395 Free memory objects 2019-02-26 15:10:43 -05:00
Dzmitry Malyshau
f0e245e4dc Cleanup unused framebuffers 2019-02-26 11:21:31 -05:00
Dzmitry Malyshau
f2365ea71e Unify the texture view creation 2019-02-26 10:28:08 -05:00
Dzmitry Malyshau
5b129704a0 Storage indexing 2019-02-26 10:27:51 -05:00
bors[bot]
dd73675868 Merge #65
65: First bits of wgpu-remote r=grovesNL a=kvark



Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-02-26 15:13:14 +00:00
Dzmitry Malyshau
ce08429729 Make Id serializable 2019-02-26 10:12:11 -05:00
Dzmitry Malyshau
e16ceafb81 Epoch tracking of indices 2019-02-26 10:12:11 -05:00
Dzmitry Malyshau
ea18c8fa85 Generate remote header 2019-02-26 10:10:07 -05:00
Dzmitry Malyshau
bd0de53f8e First bits of wgpu-remote 2019-02-26 10:10:07 -05:00
bors[bot]
1504542019 Merge #59
59: Map buffers async r=kvark a=swiftcoder

This is not ready to merge. It works well enough for the example, but looking for some early feedback.

In particular:
- It's not really async, since gfx-hal's mapping APIs seem to all be immediate.
- Async callbacks in Rust are really unpleasant due to lifetimes, so maybe it's just as well they aren't async.
- There is no validation and no real error handling here yet.

Co-authored-by: Tristam MacDonald <swiftcoder@gmail.com>
2019-02-26 15:02:46 +00:00
Tristam MacDonald
8431da80ed Implement map read/write async 2019-02-26 06:45:07 -08:00
bors[bot]
b2f58d0975 Merge #71
71: Shadow example r=grovesNL a=kvark

~~I believe all the nuts and bolts are in place, just figuring out some details of making the shadow match between the rendering and sampling (hence the WIP).~~

Most importantly, this PR includes crucial fixes and improvements of our resource tracking, plus a few fixes in the bind group and texture creation code.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-02-23 07:50:17 +00:00
Dzmitry Malyshau
616a3dd849 Fix leaking swapchain textures 2019-02-22 22:23:52 -05:00
Dzmitry Malyshau
cfe3da1c6f Remove the outdated frame concept in favor of aggressive swapchain re-creation 2019-02-22 18:43:19 -05:00
Dzmitry Malyshau
9df7cc4a8e Fix depth projection in the examples, add some rotation to the shadow 2019-02-22 18:43:06 -05:00
Dzmitry Malyshau
5ada8d9943 Fix full_range of arrays 2019-02-22 13:53:28 -05:00
Dzmitry Malyshau
c21420399a Refactored tracking, now includes the views 2019-02-22 12:59:29 -05:00
Dzmitry Malyshau
7386a05a0d Shadow shaders 2019-02-22 12:59:29 -05:00
Dzmitry Malyshau
056cc64eb4 Shadow example shaders and improvements 2019-02-22 12:59:29 -05:00
Dzmitry Malyshau
957a5b57dd Rust side of the shadow example 2019-02-22 12:59:29 -05:00
bors[bot]
022087b0b8 Merge #69
69: Swapchain resize r=kvark a=kvark

Based on #67 

Here are the steps (as outlined on Gitter) that this PR follows:
  1. create a dummy frame in the swapchain (`SwapChain::outdated`). We return it when we aren't able to acquire a real frame. No synchronization is done atm, but shouldn't be anything critical there.
  2. handle the errors on acquire and present, use the dummy frame where needed. Presentation errors are just ignored, while acquiring errors are forcing the dummy frame. The idea is that the user would know about a swapchain resize from some kind of event loop / WSI, and thus they'd know when they should actually re-create it.
  3. associate surface with a swapchain. We merge the IDs since there can't be multiple swapchains on the same surface in the near future. Merging simplifies a lot of things in the implementation, but this is to be revised for sure once we get a better look on the browser integration.
  4. when the swapchain is re-created, consume the old one associated with a surface.


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-02-22 17:37:28 +00:00
Dzmitry Malyshau
59fe349633 Resize support for gfx-cube and framework 2019-02-21 15:59:24 -05:00
Dzmitry Malyshau
14ee80f463 Update the trackers on resource destruction 2019-02-21 15:59:24 -05:00
Dzmitry Malyshau
28551103c2 Fix old outdated frame cleanup 2019-02-21 15:59:24 -05:00
Dzmitry Malyshau
f2a0e6fe15 Swapchain resize, merged with the surface 2019-02-21 15:59:24 -05:00
Dzmitry Malyshau
5b509692d1 Outdated frame for the swapchain 2019-02-21 15:59:24 -05:00
bors[bot]
917626c0ec Merge #70
70: Allow creating a surface by passing a metal layer. r=kvark a=seivan

This is useful if you're using `SDL2`
```rust
    let canvas = window.into_canvas().build().unwrap();
    let metal_layer = unsafe { sdl2::sys::SDL_RenderGetMetalLayer(canvas.raw()) }; 
    let surface = instance.create_surface_with_metal_layer(metal_layer);
```

For now, Metal only - but could be useful in the future if there was a trait or a facade to use for setting up a surface. The intention is to support other window backends without depending on them directly as a dependency. 

Co-authored-by: Seivan Heidari <seivan.heidari@icloud.com>
2019-02-21 20:50:41 +00:00
Seivan Heidari
d63d367ec0
Allow creating a surface by passing a metal layer.
This is useful if you're using `SDL2`
```rust
    let canvas = window.into_canvas().build().unwrap();
    let metal_layer = unsafe { sdl2::sys::SDL_RenderGetMetalLayer(canvas.raw()) }; 
    let surface = instance.create_surface_with_metal_layer(metal_layer);
```
2019-02-21 21:30:41 +01:00
bors[bot]
fef27e46d3 Merge #67
67: Dropping textures and buffers r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-02-21 17:56:15 +00:00
Dzmitry Malyshau
038e49aa25 Allow examples to run from any dir 2019-02-21 09:49:30 -05:00
Dzmitry Malyshau
855bcfe176 Resource destruction refactoring, hook up to rust 2019-02-21 08:42:57 -05:00
Dzmitry Malyshau
a7476ee69a rust: temporary vector of command buffers 2019-02-21 08:15:39 -05:00
bors[bot]
a60f3f13fa Merge #62
62: Separate object identity from storage r=grovesNL a=kvark

This turned out to be a giant change touching multiple parts... with main goal to prepare for wgpu-remote. The basic incompatibility I found is that the client side needs to know the IDs and manage them, while the server side needs to access the actual objects by those IDs. This change moves the `IdentityManager` out, while still making it convenient for the local bindings to use it the old way.

The actions for creating a buffer remotely would be:
  1. client allocates a new ID
  2. client sends the descriptor and ID to the server
  3. server creates an actual backend object from the descriptor
  4. server associates it with the given ID

While doing that, I also decided to bring the local/remote registries closer together. There isn't much benefit from representing an ID with a pointer in local mode. Locking is still the same (at least, it's hugely problematic to make it different and maintain both paths sanely), and the cache utilization is better when they are stored sequentially. This simplification leaded to the renaming and refactoring of "registry/mod.rs" to just "hub.rs".

Total list of changes:
  - separate object identity from storage, this affects all the entry points creating items. They are now split into a public-visible "_impl()" method that just creates something, and the old creation is only visible under "local" feature now, using that helper. The sequence of actions on remote is different, as described above.
  - unified local/remote registries
  - "local" feature instead of "remote"
  - removed blend and depth/stencil interfaces in favor of structs inside the pipeline descriptors
  - pipeline descriptors are update to reflect the IDL (shader stages, rasterization state, color states, etc)

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-02-15 15:14:47 +00:00
Dzmitry Malyshau
00e0347b8c Renamed the impl methods, switched structure argumetns from references to contained items 2019-02-15 10:13:04 -05:00
Dzmitry Malyshau
2e21285434 Separate object identity from storage 2019-02-14 14:28:55 -05:00
bors[bot]
edef343439 Merge #57
57: Command encoder interface r=grovesNL a=kvark

Implements https://github.com/gpuweb/gpuweb/pull/203

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-02-13 22:22:33 +00:00
Dzmitry Malyshau
844d371989 Command encoder interface 2019-02-12 16:48:56 -05:00
bors[bot]
3274fc92f5 Merge #54
54: Document how to run examples r=grovesNL a=rukai

I had assumed the triangle example wasn't functional yet, because I didn't realize I had to specify a feature. I only realized it was supposed to work when I saw a screenshot of the cube example.

I'm not sure what the future is of the triangle example? Will it remain outside of the gfx-examples folder?

Co-authored-by: Rukai <rubickent@gmail.com>
2019-02-12 14:30:30 +00:00
Rukai
9374d52272 Document how to run examples 2019-02-12 22:01:49 +11:00