Commit Graph

217 Commits

Author SHA1 Message Date
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
bors[bot]
c9f4936df4 Merge #56
56: Initial compute pipeline support r=kvark a=swiftcoder

Hey, I'd love to help out with this effort, but please let me know if I'm only going to be slowing you down :)

Sample is a port of https://github.com/gfx-rs/gfx/blob/master/examples/compute/main.rs - as yet incomplete because we don't have a read-back API defined.

I'm happy to do the implementation of the read-back API, but I wanted to touch base about how you envision `mapReadAsync`/`mapWriteAsync` working in Rust. Do we introduce futures to match the webgpu spec? Or expose it in a more direct fashion.

Co-authored-by: Tristam MacDonald <swiftcoder@gmail.com>
2019-02-12 04:39:37 +00:00
Tristam MacDonald
5f0df67dcc Initial compute pipeline support 2019-02-11 19:02:18 -08:00
bors[bot]
c7cd741543 Merge #55
55: All the transfers r=grovesNL a=kvark



Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-02-07 13:20:29 +00:00
Dzmitry Malyshau
8b6eafcdca Rust and C API for transfers 2019-02-07 08:17:13 -05:00
Dzmitry Malyshau
901463d7ce native: copy_texture_to_texture 2019-02-06 09:29:21 -05:00
Dzmitry Malyshau
1b76b2b96c native: copy_texture_to_buffer 2019-02-06 09:21:12 -05:00
Dzmitry Malyshau
dc7bf3404e Refactor get_with_usage for better ergonomics 2019-02-06 09:15:57 -05:00
Dzmitry Malyshau
2f0601c92c native: implement copy buffer to buffer 2019-02-06 09:04:31 -05:00
Dzmitry Malyshau
4b1897b254 Separate module for transfer functions 2019-02-06 08:55:21 -05:00
bors[bot]
f385b787a1 Merge #53
53: Depenency gfx update to 0.1.1 r=almost_simple a=kvark

It appears that we still can't run on DX12, because it has `update_buffer` as `unimplemented!`. But at least we have the benefit of the empty backend updates.

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-02-05 14:46:34 +00:00
Dzmitry Malyshau
1c95eef7a3 Depenency gfx update to 0.1.1 2019-02-05 09:45:52 -05:00
bors[bot]
8ebaae7a3f Merge #52
52: Gfx examples framework r=grovesNL a=kvark

Fixes #37 
It's not functional yet, I think it needs a proper resize event handler. We can do this incrementally.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2019-02-04 15:01:14 +00:00
Dzmitry Malyshau
c74f8e8db8 Cube cleanup and the new generated texture 2019-02-04 09:55:32 -05:00
Dzmitry Malyshau
8f985dd09e Fix gfx-cube example 2019-02-03 22:19:36 -05:00
Dzmitry Malyshau
d50f8199dd Buffer to texture copies 2019-02-03 21:59:35 -05:00
Dzmitry Malyshau
3ec4ff99b0 Vertex buffer description in the pipelines 2019-02-03 20:39:13 -05:00
Dzmitry Malyshau
3d47436129 rust: vertex/index binding 2019-02-03 15:51:54 -05:00
Dzmitry Malyshau
d4c8c881d0 gfx framework GLSL reading, most of the cube example 2019-02-02 22:48:53 -05:00
Dzmitry Malyshau
a735eddf81 Sampler creation support 2019-02-02 22:37:51 -05:00
Dzmitry Malyshau
ed5499d025 Basic gfx-examples framework 2019-02-02 21:02:33 -05:00
Dzmitry Malyshau
afe00aa90f Borrow temporary queus and frames on Rust side 2019-02-02 21:02:33 -05:00
bors[bot]
a2b6ec167f Merge #51
51: native: basic support for pipeine stages in barriers r=grovesNL a=kvark

It's a naive approach focused on solving the Vulkan validation errors :)

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-02-02 09:25:43 +00:00
Dzmitry Malyshau
57f0cd184f native: basic support for pipeine stages in barriers 2019-01-31 21:42:35 -05:00
bors[bot]
6c202f627c Merge #48
48: Set buffer data r=grovesNL a=kvark

Simple and limited implementation, should be sufficient for the first examples.

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-01-31 21:18:56 +00:00
Dzmitry Malyshau
55c22a0d9a Implement basic set_buffer_data 2019-01-30 15:31:06 -05:00
bors[bot]
664d9e75e5 Merge #50
50: added forgotten create_bind_group r=kvark a=porky11

I added the missing function `create_bind_group` and some important data types.
See an example [here](https://github.com/porky11/wgpu/blob/uniform-buffer-example/examples/hello_triangle_rust/main.rs). (Should work when filling the vertex buffer with useful values).

Co-authored-by: Fabio Krapohl <fabio.u.krapohl@fau.de>
2019-01-30 19:44:54 +00:00
Fabio Krapohl
c5be22a242 added forgotten create_bind_group
fixed suggestions

use `ref` in match
2019-01-30 20:35:20 +01:00
bors[bot]
3dbcdc0327 Merge #49
49: GLFW integration r=grovesNL a=kvark

This is #40 that is rebased and fixed a bit.

Co-authored-by: Joshua Groves <josh@joshgroves.com>
Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-01-24 20:10:53 +00:00
Dzmitry Malyshau
e8e5938e06 Linux support for GLFW example 2019-01-24 12:33:34 -05:00