Commit Graph
752 Commits
Author SHA1 Message Date
Dzmitry Malyshau 35fa7c184e Update naga to gfx-10 2021-02-09 10:21:56 -05:00
cd74c8d9a4 Merge #710
710: Implement read_buffer r=kvark a=fintelia

I'm not sure about the exact interface that makes sense, but this PR sketches out how read_buffer (and eventually also read_texture) could be implemented. 

Resolves #694

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
Co-authored-by: Jonathan Behrens <fintelia@gmail.com>
2021-02-06 20:53:26 +00:00
Jonathan Behrens b17cb30f17 Implement read_buffer utility function 2021-02-06 11:22:37 -05:00
bors[bot]andImbris 1f1a7e5dd4 Merge #745
745: Bump wgpu-core r=kvark a=Imberflur

For the fix of this issue https://github.com/gfx-rs/wgpu/issues/1188

Co-authored-by: Imbris <imbrisf@gmail.com>
2021-02-06 05:16:11 +00:00
Imbris f839755e12 Bump wgpu-core 2021-02-05 22:02:48 -05:00
Dzmitry Malyshau 91fca7c5c3 Experimental ReadBuffer structure 2021-02-05 12:59:49 -05:00
bors[bot]andDzmitry Malyshau f891e86e87 Merge #738
738: Update version and dependencies to gfx-9 r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-02-01 07:17:07 +00:00
Dzmitry Malyshau 7235072f6d Update version and dependencies to gfx-9 2021-02-01 02:16:31 -05:00
bors[bot]andDzmitry Malyshau f882abcf4b Merge #679
679: WGSL shader conversion for the examples r=grovesNL a=kvark

Blocked on:
  - ~~https://github.com/gfx-rs/naga/issues/335~~
  - ~~https://github.com/gfx-rs/naga/issues/336~~
  - ~~https://github.com/gfx-rs/wgpu/issues/1095~~
  - ~~https://github.com/gfx-rs/naga/pull/360~~
  - https://github.com/gfx-rs/gfx/pull/3622
  - ~~GL backend doing the program link check earlier~~

Converted:
- [x] boids
- [x] cube
- [x] mipmap
- [x] msaa-line
- [x] shadow
- [x] skybox
- [ ] texture-array
- [ ] water

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2021-01-30 06:05:49 +00:00
Dzmitry Malyshau 74eed253d8 Convert cube, skybox, msaa-line, and mipmap, to WGSL
Validate example shaders in tests

Support WGSL on the Web via Naga

Port the shadow WGSL partially

Convert hello-compute and boids to WGSL

Conver the shadow's fragment shader to WGSL

Shader entry point refactor
2021-01-30 01:02:04 -05:00
bors[bot]andDzmitry Malyshau c45fbce8b4 Merge #734
734: Update wgpu to the new render pipeline descriptor API r=grovesNL a=kvark

MAJOR API BREAKING CHANGE
Gets us https://github.com/gfx-rs/wgpu/pull/1176

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-01-30 02:44:01 +00:00
Dzmitry Malyshau 517ce3ef8d Update wgpu to the new render pipeline descriptor API 2021-01-29 00:51:44 -05:00
bors[bot]andDzmitry Malyshau 9fd0630621 Merge #730
730: Fix the web backend in code and CI r=grovesNL a=kvark

Fixes #729

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2021-01-27 01:58:43 +00:00
Dzmitry Malyshau c1225c42ac Fix the web backend in code and CI 2021-01-26 20:58:13 -05:00
bors[bot]andConnor Fitzgerald b04cc289e8 Merge #717
717: Fixup WebGL Building Docs r=kvark a=cwfitzgerald

Improved the docs for building wgpu for targeting webgl. This would have prevented https://github.com/gfx-rs/gfx/issues/3594.

I also think (but haven't changed yet) that all the examples should use `wgpu::BackendBit::all()` as that is really what people should be defaulting to.

(Rendered: https://github.com/cwfitzgerald/wgpu-rs/blob/webgl-docs/README.md#run-examples-on-the-web-wasm32-unknown-unknown)

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-01-23 23:53:30 +00:00
Connor Fitzgerald 26f8605ec7 Fixup webgl docs 2021-01-23 18:20:41 -05:00
bors[bot]andMatt Keeter 8ee42da76c 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 2d16ade76c Bump wgpu-core and update texture_view_drop call 2021-01-23 12:12:42 -05:00
bors[bot]andDzmitry Malyshau 7273dba07a 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 ba99775974 Remove typed-arena dependency 2021-01-19 22:01:54 -05:00
bors[bot]andConnor Fitzgerald 639257e9e5 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 24ae87c4ea Update wgpu-core etc 2021-01-16 02:58:07 -05:00
bors[bot]andConnor Fitzgerald 15d784a11a 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 6d52bc5535 Add pipeline statistics and timeline queries 2021-01-16 01:05:03 -05:00
bors[bot]andAndreas Reich baf6c433bb 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 5ad4f19cea Exposed get_texture_format_features on adapter 2021-01-13 23:23:44 +01:00
bors[bot]andMikko Lehtonen da5fbcfc74 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 a6cc17c12e Format PassErrorScope pipelines 2021-01-12 23:32:10 +02:00
bors[bot]andNiklas Korz 4c51891279 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 0578cda7a6 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 0710a7a911 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 7e6bc07955 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 6cfd424360 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 4efca69727 Update to latest wgpu 2021-01-10 10:54:38 +02:00
bors[bot]andJay Oster ab8b0e3766 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 dae801baa0 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 1bcbc6999e 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 80d8526c83 Fix cargo doc warnings due to unresolved links 2021-01-06 18:30:24 +00:00
bors[bot]andAndreas Reich 78755f595f 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 2b2aed3a46 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 c37947dbb7 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 a5f44f2759 Remove wgpu-subscriber -> subscriber alias in examples 2021-01-05 19:05:52 +00:00
bors[bot]andManuel Gil f89175e19c 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 e00ef5d584 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 3d605463bb 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 a7c87edaef Add set_push_constants to RenderEncoder 2020-12-25 14:01:04 +00:00
0x182d4454fb211940 fb5a449206 Remove unneeded cast from encoder.rs 2020-12-25 13:50:36 +00:00
0x182d4454fb211940 a99411c290 Move RenderEncoder to util 2020-12-25 13:47:38 +00:00
0x182d4454fb211940 1490d7be3a Add RenderEncoder 2020-12-24 17:37:06 +00:00
bors[bot]andVincent Jousse c0418b1b8a 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