Commit Graph

2761 Commits

Author SHA1 Message Date
Dzmitry Malyshau
ba8c2eae54 Implement Queue::write_buffer 2020-05-10 01:21:47 -04:00
bors[bot]
da4f9006a8 Merge #641
641: Add optional SPIR-V shader validation r=kvark a=GabrielMajeri

This PR adds some basic validation for SPIR-V shaders when creating pipelines. Starts work towards #269.

Currently, I'm marking this as a draft because `naga` isn't mature enough to be able to parse shaders from the `wgpu-rs` examples.

For example:
- Trying to run `hello-triangle` from `wgpu-rs` results in the following error:
`Failed to parse shader SPIR-V code: UnsupportedInstruction(Function, Variable)`
- For `hello-compute` it is:
`Failed to parse shader SPIR-V code: UnsupportedInstruction(Type, TypeBool)`

Co-authored-by: Gabriel Majeri <gabriel.majeri6@gmail.com>
2020-05-09 22:07:30 +00:00
Gabriel Majeri
f70f32af87 Add optional SPIR-V shader validation
# Conflicts:
#	Cargo.lock
2020-05-09 19:55:10 +03:00
bors[bot]
c985df9fc8 [rs] Merge #272
272: Force the wasm32 types to match Send / Sync with the native types r=kvark a=kyren

This is potentially a controversial change so this is just a draft to discuss it.

Currently, when building wgpu on wasm32, none of the interface types are Send or Sync, whereas on any other platform they are generally Send and Sync and this can cause a lot of pain, especially in the presence of async.

This PR is the nuclear option: lie and forcibly declare nearly all interface types to be Send or Send + Sync.

I think I understand the situation with proposed wasm32 threading a bit better now, and as of right now at least with my current understanding, it seems to me unlikely that javascript values held by rust could *ever* be sent transparently to another worker.  The mechanism that rust apparently will use to implement transparent threading will be to use `SharedArrayBuffer` to share memory between multiple workers.  Javascript provides a way for certain (serializable) objects to be shared with with other workers through `worker.postMessage()`, so Javascript has *some* story for sending javascript values to other threads, but only plain rust values that exist solely in the `SharedArrayBuffer` memory are send-able under this scheme.  I've looked briefly through some of the wasm proposals like the interface types proposal, but I don't have a good sense if there's any proposed mechanism at all for interface types and threads to interact at all.

If that's true that's really unfortunate because it seems like any thread safe API shared by native and web is doomed to mismatch.  This is even more unfortunate because many of the webgpu types in the draft standard are marked as 'Serializable', meaning that they *are* actually safe to send to another worker via `postMessage`, but there does not appear to be a planned way for rust to do this transparently.

I definitely could be misunderstanding the situation though and even if I am understanding it, the situation may have since changed.  I also don't know the timing here, I don't know what the eventual timing of wasm32 threading support will be vs webgpu support and interface types support.  *Right now* this PR is almost certainly sound, but there's definitely a possible future where it becomes unsound, and even maybe a possible future where it becomes unsound but then could later be made sound again.

Co-authored-by: kyren <kerriganw@gmail.com>
2020-05-07 04:09:14 +00:00
kyren
a3e6e1024f [rs] Force the wasm32 types to match Send / Sync with the native types
There are several things in this commit:

1) Add `Send` or `Send + Sync` bounds to most of the associated types in `Context`.
2) Force most of the handle types and future types returned by the web backend to be Send / Sync
3) Make `BufferReadMapping` and `BufferWriteMapping` `Send` again on native by
   making the associated detail types implement `Send`.
2020-05-06 23:02:27 -04:00
bors[bot]
54c6f6751b Merge #645
645: Add a loom test for RefCount r=kvark a=paulkernfeld

A first effort at gfx-rs/wgpu-rs#96
loom testing is gated behind cfg(loom)

Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
2020-05-06 18:10:43 +00:00
Paul Kernfeld
29a4cee002 Add a loom test for RefCount 2020-05-06 13:53:57 -04:00
bors[bot]
0df263fe3e Merge #649
649: Proper maintenance of the command pools r=cart a=kvark

Fixes #648
This brings the memory consumption on the multi-threaded cube to constant 50Mb.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-06 17:44:52 +00:00
Dzmitry Malyshau
cf8513baf5 Proper maintenance of the command pools 2020-05-06 11:15:08 -04:00
bors[bot]
8e2486f172 [rs] Merge #300
300: Properly free pass contents r=kvark a=kvark

Fixes #299

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-06 01:56:54 +00:00
Dzmitry Malyshau
55b727e0c5 [rs] Rustfmt pass on examples 2020-05-05 21:55:42 -04:00
Dzmitry Malyshau
4b7f26b8a2 [rs] Free pass contents 2020-05-05 21:55:25 -04:00
Dzmitry Malyshau
4c448c3fc5 Add a way to destroy a pass by a mutable reference (#647) 2020-05-05 21:52:06 -04:00
bors[bot]
ae58ac8447 [rs] Merge #298
298: Added a screenshot for harmony. r=kvark a=StarArawn



Co-authored-by: John Mitchell <john.mitchell@mangolanguages.com>
2020-05-05 16:05:05 +00:00
John Mitchell
cbbc067ef7 [rs] Added a screenshot for harmony. 2020-05-05 11:59:56 -04:00
bors[bot]
e2d713a0d9 Merge #643
643: Refactor create_surface a bit r=antonok-edm a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-05 15:25:41 +00:00
Dzmitry Malyshau
2c3d278ee3 [rs] Add wgpu-pbr to README 2020-05-05 11:20:15 -04:00
Dzmitry Malyshau
3e57c11260 Refactor create_surface a bit 2020-05-05 09:47:51 -04:00
bors[bot]
c2b5719029 [rs] Merge #297
297: Update wgpu with the BGL fix r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2020-05-05 04:05:22 +00:00
Dzmitry Malyshau
b1f0961713 [rs] Update wgpu with the BGL fix 2020-05-05 00:04:24 -04:00
bors[bot]
bee826e79d Merge #640
640: Save bind group layout inside pipeline layouts r=kvark a=kvark

Fixes #639

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2020-05-05 03:55:38 +00:00
Dzmitry Malyshau
fbc533bfee Save bind group layout inside pipeline layouts 2020-05-04 23:46:06 -04:00
bors[bot]
e2d59201fd Merge #351
351: Optionally support XCB windows on Unix r=kvark a=antonok-edm

`gfx-hal` supports XCB windows on Unix platforms, but it can't be used through `wgpu`. I added a new `xcb` feature to enable that support. `x11` support is now enabled using a default feature to remain backwards compatible.

Co-authored-by: Anton Lazarev <antonok35@gmail.com>
2020-05-04 20:41:25 +00:00
Anton Lazarev
29ce9a44cf Pass through raw-window-handle 2020-05-04 15:55:19 -04:00
bors[bot]
644949d945 Merge #637
637: Wait for idle before destroying swapchains r=kvark a=kvark

Follow up to #636 
I was trying to address the D3D12 error in https://github.com/gfx-rs/gfx/issues/3242
The debug messages complain about a resource being used by the queue while it's being destroyed. I thought forcing a wait there would help, but it does not. I think it's still a good change to land though.

In the meantime, I wonder if it considers the swapchain to be used because it's currently presented. Could be something else I'm missing here.

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2020-05-04 03:47:15 +00:00
Dzmitry Malyshau
71d4f77ab8 Wait for idle before destroying swapchains 2020-05-03 23:39:05 -04:00
bors[bot]
1e43dafa4d Merge #636
636: Properly destroy swap chains r=kvark a=kvark

This is the last piece of the cleanup puzzle, I think, as closing an example becomes fully validation-free 🎉 

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-04 02:35:14 +00:00
Dzmitry Malyshau
831d908663 Properly destroy swap chains 2020-05-03 22:13:43 -04:00
Dzmitry Malyshau
7a3fd709da Create issue templates 2020-05-02 22:39:48 -04:00
bors[bot]
48decb6d78 Merge #634
634: Make assertions more verbose in src/command r=kvark a=paulkernfeld

This contributes to #485

Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
2020-05-02 22:35:42 +00:00
Paul Kernfeld
cc2e6db7f5 Make assertions more verbose in src/command
This contributes to #485
2020-05-02 13:16:09 -04:00
bors[bot]
81a725c561 [rs] Merge #295
295: Remove wasm-bindgen patches r=grovesNL a=rukai

A new release occurred with the required fixes, so we no longer need to patch it.

Co-authored-by: Rukai <rubickent@gmail.com>
2020-05-02 12:44:45 +00:00
Rukai
881071a21a [rs] Remove wasm-bindgen patches 2020-05-02 22:41:15 +10:00
bors[bot]
9911115d78 Merge #633
633: Fix build status badge r=grovesNL a=Gordon-F

fix #630 

Co-authored-by: Igor Shaposhnik <Gordon-F@users.noreply.github.com>
2020-05-02 12:26:04 +00:00
Igor Shaposhnik
6d455e4479 Fix build status badge 2020-05-02 12:10:29 +03:00
bors[bot]
3586f123c9 [rs] Merge #291
291: Update for wgpu-core r=grovesNL a=kvark

Depends on https://github.com/gfx-rs/wgpu/pull/619
Closes #285

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-02 03:59:45 +00:00
bors[bot]
3059109f77 Merge #632
632: Fix player validation errors on exit r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-02 03:34:34 +00:00
Dzmitry Malyshau
2d09b1d08d Fix player validation errors on exit 2020-05-01 23:33:16 -04:00
bors[bot]
6d920185fa Merge #628
628: Implement `From<TextureFormat>` for `TextureComponentType` r=kvark a=mitchmindtree



Co-authored-by: mitchmindtree <mitchell.nordine@gmail.com>
2020-05-02 02:01:43 +00:00
mitchmindtree
a8b8bc8283 Implement From<TextureFormat> for TextureComponentType 2020-05-02 02:33:22 +02:00
Dzmitry Malyshau
5bbe6ec38c Integrate with RenderDoc on winit-less captures (#627) 2020-05-01 15:34:32 -04:00
Igor Shaposhnik
0a0ef9a100 Split CI jobs by OS (#626) 2020-05-01 13:32:38 -04:00
bors[bot]
e2100b6911 Merge #621
621: Keep Adapter alive r=grovesNL a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-05-01 04:30:09 +00:00
Dzmitry Malyshau
f35dd741aa Android support (#625) 2020-05-01 00:22:00 -04:00
Dzmitry Malyshau
288f8342b1 Don't drop the Global on panic 2020-05-01 00:20:54 -04:00
Dzmitry Malyshau
9500cfa4f3 Keep Adapter alive by the device 2020-05-01 00:20:54 -04:00
Paul Kernfeld
29fe9a935a Make assertions in wgpu-core device/mod.rs verbose (#622)
Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
2020-05-01 00:05:13 -04:00
Dzmitry Malyshau
26b424e35b [rs] Update for wgpu-core 2020-04-30 15:52:16 -04:00
Dzmitry Malyshau
f64b2dd3bb trace: make Id serialization nicer 2020-04-30 09:55:52 -04:00
Dzmitry Malyshau
3c68fb17e4 player: full winit integration 2020-04-30 09:55:52 -04:00