Commit Graph
736 Commits
Author SHA1 Message Date
bors[bot]andMatt Keeter 7ea65e8f9f [rs] Merge #726
726: Bump wgpu-core and update texture_view_drop call r=kvark a=mkeeter

This PR updates to the latest `wgpu-core` commit ([wgpu #1163](https://github.com/gfx-rs/wgpu/pull/1163)), and is the counterpart to [wgpu-native #66](https://github.com/gfx-rs/wgpu-native/pull/66).

I'm using `wait = false` in the `texture_view_drop` call to match `buffer_drop` and `texture_drop` elsewhere `backend/direct.rs`, though I don't quite understand the implications 😅

Co-authored-by: Matt Keeter <matt.j.keeter@gmail.com>
2021-01-23 21:40:06 +00:00
Matt Keeter 3ca0b0cf9c [rs] Bump wgpu-core and update texture_view_drop call 2021-01-23 12:12:42 -05:00
bors[bot]andDzmitry Malyshau fe0644b040 [rs] Merge #720
720: Remove typed-arena dependency r=cwfitzgerald a=kvark

Also bumps the wgpu dependency to include https://github.com/gfx-rs/wgpu/pull/1160

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-01-20 06:03:01 +00:00
Dzmitry Malyshau ea16651793 [rs] Remove typed-arena dependency 2021-01-19 22:01:54 -05:00
bors[bot]andConnor Fitzgerald f8bb6482ac [rs] Merge #716
716: Update Wgpu-Core r=trivial a=cwfitzgerald

This rollup fixes a pretty bad segfault that always occurs.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-01-16 07:59:22 +00:00
Connor Fitzgerald eb2d591d59 [rs] Update wgpu-core etc 2021-01-16 02:58:07 -05:00
bors[bot]andConnor Fitzgerald e71cb4c964 [rs] Merge #715
715: Add pipeline statistics and timeline queries r=kvark a=cwfitzgerald

Blocked on https://github.com/gfx-rs/wgpu/pull/1128.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-01-16 06:06:18 +00:00
Connor Fitzgerald af61d9c917 [rs] Add pipeline statistics and timeline queries 2021-01-16 01:05:03 -05:00
bors[bot]andAndreas Reich cb2f9e45df [rs] Merge #713
713: Expose texture format feature query (and update to latest wgpu) r=kvark a=Wumpf

Exposes texture format feature query from https://github.com/gfx-rs/wgpu/pull/1112
Updating wgpu-core led to breaking change of moving get_swap_chain_preferred_format from device to adapter.

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2021-01-13 23:51:48 +00:00
Andreas Reich 1974b2a344 [rs] Exposed get_texture_format_features on adapter 2021-01-13 23:23:44 +01:00
bors[bot]andMikko Lehtonen 5c9b6704c0 [rs] Merge #698
698: Format PassErrorScope pipelines r=kvark a=scoopr

Pairing for gfx-rs/wgpu#1132, formats the pipeline ids

Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2021-01-12 21:34:35 +00:00
Mikko Lehtonen 9ab5cdbd1f [rs] Format PassErrorScope pipelines 2021-01-12 23:32:10 +02:00
bors[bot]andNiklas Korz 76bfba0969 [rs] Merge #709
709: Move get_swap_chain_preferred_format from device to adapter r=kvark a=niklaskorz

See https://github.com/gfx-rs/wgpu/pull/1142. This PR applies the necessary changes for the move of `get_swap_chain_preferred_format` from device to adapter.

Co-authored-by: Niklas Korz <niklas@niklaskorz.de>
2021-01-11 21:43:51 +00:00
Niklas Korz 4d2bec6cab [rs] Move get_swap_chain_preferred_format from device to adapter
Squashed commit of the following:

commit 260976b10e3a54b253768d71e5e47c51b976c25c
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 20:23:31 2021 +0100

    Formatting

commit e3f837e1b6a81c8c7a9566ba6a2c6dd8adfbbde7
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 20:20:37 2021 +0100

    Update examples

commit b0774c0aa56fbdfe741dd6c0e86d55b8c6b42de3
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 19:31:29 2021 +0100

    Use adapter.get_swap_chain_preferred_format
2021-01-11 20:32:03 +01:00
bors[bot]andAndrew Kilroy 1e3a93a632 [rs] Merge #707
707: Fix compilation on aarch64-apple-darwin r=kvark a=andykilroy

wgpu-rs couldn't compile on the Apple M1 (arm64) macs due to a compilation
problem in winit.  winit 0.24.0 has the fix so upgrade the dependency.

Link to the fix's pull request in winit:
   https://github.com/rust-windowing/winit/pull/1752

Co-authored-by: Andrew Kilroy <7545475+andykilroy@users.noreply.github.com>
2021-01-10 16:11:43 +00:00
Andrew Kilroy 08fd37b429 [rs] Fix compilation on aarch64-apple-darwin
wgpu-rs couldn't compile on the Apple M1 (arm64) macs due to a compilation
problem in winit.  winit 0.24.0 has the fix so upgrade the dependency.

Link to the fix's pull request in winit:
   https://github.com/rust-windowing/winit/pull/1752
2021-01-10 11:16:04 +00:00
bors[bot]andTheArtist ee0d0cb2c5 [rs] Merge #706
706: Update to latest wgpu r=grovesNL a=ElArtista



Co-authored-by: TheArtist <agorglouk@gmail.com>
2021-01-10 10:43:20 +00:00
TheArtist f5dc0f91f7 [rs] Update to latest wgpu 2021-01-10 10:54:38 +02:00
bors[bot]andJay Oster a6a5cbbd3c [rs] Merge #685
685: Replace futures crate with pollster. r=grovesNL a=parasyte

This PR removes all of the `futures` dependencies. `std::future` does not contain a lot of useful helpers available in `futures`. The obvious ones are `join_all`, `FutureExt::map`, and `block_on`.

- `join_all` is replaced with a `Vec<T>` and an `async` block.
- `FuturesExt::map` in the web backend is replaced by rolling the `map` function into the `MakeSendFuture` type.
- `block_on` is provided by `pollster`.

The original code using `join_all` ignored the result type yielded by the Future from `map_async`. This code does the same, but makes dropping the result a little more obvious.

These should not be troublesome. Figured I would call them out anyway.

The last big change is replacing `futures-executor` in the examples with `async-executor`. A new concrete `Spawner` type is used in the example framework instead of an implementation of `futures_task::LocalSpawn`.

Fixes #628

Co-authored-by: Jay Oster <jay@kodewerx.org>
2021-01-07 19:08:55 +00:00
Jay Oster 78f33bcf67 [rs] Replace futures with pollster
This PR removes all of the `futures` dependencies. `std::future` does not contain a lot of useful helpers available in futures. The obvious ones are `join_all`, `FutureExt::map`, and `block_on`.

* `join_all` is replaced with a `Vec<T>` and async blocks.
* `FuturesExt::map` in the web backend is replaced by rolling the `map` function into the `MakeSendFuture` type.
* `block_on` is provided by `pollster`.

The original code using `join_all` ignored the result type yielded by the Future from `map_async`. This code does the same, but makes dropping the result a little more obvious.

These should not be troublesome. Figured I would call them out anyway.

The last big change is replacing `futures-executor` in the examples with `async-executor`. A new concrete `Spawner` type is used in the example framework instead of an implementation of `futures_task::LocalSpawn`.
2021-01-07 10:10:18 -08:00
bors[bot]andManuel Gil b83f520605 [rs] Merge #701
701: Fix cargo doc warnings due to unresolved links r=kvark a=manugildev

This PR fixes 13 warnings caused by unresolved internal and external(wgt) links in `cargo doc`.

> <img width="800" alt="Screenshot 2021-01-06 at 18 33 00" src="https://user-images.githubusercontent.com/13288771/103807298-809b4100-5056-11eb-8667-752f4bdd7902.png">


Co-authored-by: Manuel Gil <manugildev@gmail.com>
2021-01-06 18:49:52 +00:00
Manuel Gil 291668d124 [rs] Fix cargo doc warnings due to unresolved links 2021-01-06 18:30:24 +00:00
bors[bot]andAndreas Reich 788d1c7eda [rs] Merge #699
699: Fixed inconsistent framerate in examples. r=kvark a=Wumpf

Does not affect web builds.

Previously, framerate would float between 30-40 fps depending on how many events would come in. Fast mouse movements over the window lead to higher framerates since request_redraw was called every 20ms (-> 50fps) AND all events were consumed, additionally the event loop would wake up only every 10ms, so actual rate of request_redraw depended on how often we'd wake up.

Fixed this by setting the max sleep time of the event loop to the remaining time until hitting the desired time interval since the last frame.

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2021-01-06 14:22:33 +00:00
Andreas Reich 070bceda31 [rs] Fixed inconsistent framerate in examples.
Does not affect web builds.
Previously, framerate would float between 30-40 fps depending on how many events would come in. Fast mouse movements over the window lead to higher framerates since request_redraw was called every 20ms (-> 50fps) AND all events were consumed, additionally the event loop would wake up only every 10ms, so actual rate of request_redraw depended on how often we'd wake up.
Fixed this by setting the max sleep time of the event loop to the remaining time until hitting the desired time interval since the last frame.

The difference is most visible on the spinning cubes in the shadow example since the cubes currently spin with a fixed angle per frame (independent of frame timings).
2021-01-05 22:58:28 +01:00
bors[bot]andManuel Gil 365cbfa898 [rs] Merge #697
697: Remove wgpu-subscriber -> subscriber alias in examples r=kvark a=manugildev

Fixes #686

> All examples should be able to be copied into their own project and missing crates filled in based on errors alone.

Co-authored-by: Manuel Gil <manugildev@gmail.com>
2021-01-05 19:22:58 +00:00
Manuel Gil d2844caaf0 [rs] Remove wgpu-subscriber -> subscriber alias in examples 2021-01-05 19:05:52 +00:00
bors[bot]andManuel Gil 7f0b8f3e34 [rs] Merge #693
693: Expose get_swap_chain_preferred_format r=kvark a=manugildev

Fixes #691

This functionality was committed in gfx-rs/wgpu@6f1d614 but never exposed to `wgpu-rs`.

Problem: Examples made use of `wgpu::TextureFormat::Bgra8UnormSrgb` but that's unreliable and according to the [API](https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-getswapchainpreferredformat) this method is the way of properly obtaining an optimal texture format for the `SwapChain` based on the platform.

- [x]  Expose `get_swap_chain_preferred_format()` on Device
- [x]  Use `TextureFormat::Bgra8Unorm` for [web.rs](https://github.com/gfx-rs/wgpu-rs/blob/e00ef5d5842a1fcfb46bb531789b1c340bdee3ab/src/backend/web.rs#L970)
- [x]  Update [framework.rs](https://github.com/gfx-rs/wgpu-rs/blob/e00ef5d5842a1fcfb46bb531789b1c340bdee3ab/examples/framework.rs#L227) and examples to call this new method

Co-authored-by: Manuel Gil <manugildev@gmail.com>
2021-01-04 14:12:35 +00:00
Manuel Gil 81bcc72651 [rs] Expose get_swap_chain_preferred_format on Device
- Update examples to make use of the new method
2021-01-03 17:35:04 +00:00
bors[bot]and0x182d4454fb211940 ee3ca89105 [rs] Merge #690
690: Add `RenderEncoder` r=kvark a=0x182d4454fb211940

It seems like `RenderPass` and `RenderBundleEncoder` share many methods in common (`set_pipeline`, `draw_indexed`, etc). By creating a shared trait, it allows more reusable code. For instance:

```rust
impl RedCircle {
    fn new(...) -> Self { .. }
    fn draw<'a>(&'a self, encoder: &mut impl RenderEncoder<'a>) { .. }
}
```

This code would then work for both structs.

Moving the previous methods from their `impl`s to the trait's would break previous code, as to use these methods code would now have to import `RenderEncoder`. To avoid this, it is implemented by calling the direct methods.

It may be worth considering moving this to `wgpu::util`.

Co-authored-by: 0x182d4454fb211940 <nathanwoodformal@gmail.com>
2020-12-28 01:19:59 +00:00
0x182d4454fb211940 cbbf25c6f8 [rs] Add set_push_constants to RenderEncoder 2020-12-25 14:01:04 +00:00
0x182d4454fb211940 a2ff43f989 [rs] Remove unneeded cast from encoder.rs 2020-12-25 13:50:36 +00:00
0x182d4454fb211940 8dc1c0896b [rs] Move RenderEncoder to util 2020-12-25 13:47:38 +00:00
0x182d4454fb211940 6ee00ab401 [rs] Add RenderEncoder 2020-12-24 17:37:06 +00:00
bors[bot]andVincent Jousse f1604cdc57 [rs] Merge #684
684: First step for WebGL support. r=grovesNL a=VincentFTS

This permits to test WebGL backend in Wgpu-rs.
Next step is to test examples to make them work with WebGL backend !

Co-authored-by: Vincent Jousse <contact@ftsoftware.fr>
2020-12-22 17:48:23 +00:00
Vincent Jousse 9f3a050fc4 [rs] First step for WebGL support. 2020-12-22 18:41:07 +01:00
bors[bot]andConnor Fitzgerald 46d9c19390 [rs] Merge #688
688: Use only 1 and 4 samples for msaa-line example r=kvark a=cwfitzgerald

As 1 and 4 samples are the only universally supported values, switch the msaa-line example to only using them. In the future where users can determine the supported sample counts. See https://github.com/gfx-rs/wgpu/issues/804

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-12-22 03:29:30 +00:00
Connor Fitzgerald 5fac4835f6 [rs] Use only 1 and 4 samples for msaa-line example 2020-12-21 15:34:19 -05:00
bors[bot]andDzmitry Malyshau 860265e5e9 [rs] Merge #682
682: Expose adapter.get_info() everywhere r=grovesNL a=kvark



Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2020-12-19 04:51:29 +00:00
Dzmitry Malyshau 7a8c6cefe1 [rs] Expose adapter.get_info() everywhere 2020-12-18 21:18:07 -05:00
bors[bot]andDzmitry Malyshau 6489a1190d [rs] Merge #681
681: Move DeviceExt into a separate module r=cwfitzgerald a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2020-12-18 01:06:56 +00:00
Dzmitry Malyshau 92c7cdbaba [rs] Move DeviceExt into a separate module 2020-12-17 17:55:11 -05:00
bors[bot]andDzmitry Malyshau 5bbe5eb4f3 [rs] Merge #680
680: Update wgpu with Naga fixes and OpenGL backend r=cwfitzgerald a=kvark

This PR makes it easier to build wgpu-rs on Linux, since it doesn't require pkg-config into EGL.
Fixes #607
Fixes https://github.com/gfx-rs/wgpu/issues/1063

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2020-12-17 21:57:25 +00:00
Dzmitry Malyshau 09e589e5a6 [rs] Simplify the CI check script 2020-12-17 16:34:01 -05:00
Dzmitry Malyshau bafcc5ace5 [rs] Update wgpu with Naga fixes and OpenGL backend 2020-12-17 13:03:27 -05:00
bors[bot]andEmanuele Dalla Longa 9090076253 [rs] Merge #678
678: Require labels for ComputePass and RenderPass  r=kvark a=infinitesnow

Blocked on https://github.com/gfx-rs/wgpu/pull/1088/

https://github.com/gfx-rs/wgpu/pull/1088/ improved labelling, update `wgpu-rs` and examples to match.

Change-Id: I1acc45a3023dfc78b6694bd4a28a0131f07b7ba7

Co-authored-by: Emanuele Dalla Longa <3xplosive.g@gmail.com>
2020-12-15 23:27:10 +00:00
Emanuele Dalla Longa 0b718aea93 [rs] Require labels to match gfx-rs/wgpu#1088
Change-Id: I1acc45a3023dfc78b6694bd4a28a0131f07b7ba7
2020-12-16 00:15:05 +01:00
bors[bot]andZsolt Bölöny b369dd3954 [rs] Merge #677
677: Update to latest wgpu master r=kvark a=yzsolt

- Update to latest `wgpu` master
- Fix build error caused by https://github.com/gfx-rs/wgpu/pull/1077

Co-authored-by: Zsolt Bölöny <bolony.zsolt@gmail.com>
2020-12-14 19:12:27 +00:00
Zsolt Bölöny acf94e9321 [rs] Update to latest wgpu master 2020-12-14 17:57:27 +01:00
bors[bot]andConnor Fitzgerald cdda85e7c3 [rs] Merge #672
672: Add write_whole_texture_mips Helper r=kvark a=cwfitzgerald

Adds a helper in QueueExt for uploading an entire texture with all of its mips. Name very bikeshedable.

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2020-12-13 05:45:03 +00:00
Connor Fitzgerald 7e05bba6c4 [rs] Add create_texture_with_data helper 2020-12-12 01:50:49 -05:00