Commit Graph
224 Commits
Author SHA1 Message Date
bors[bot]andOleg Andreev ae7b47784b Merge #778
778: Return None from get_swap_chain_preferred_format if the adapter does not support the surface r=kvark a=OlegOAndreev

Fixes #777 

Almost every other method in wgpu panics on failure, so I decided to make the return value an `Option<TextureFormat>`, not a `Result<Option<TextureFormat>>`

Co-authored-by: Oleg Andreev <ooandreev@yandex-team.ru>
2021-03-02 04:36:08 +00:00
Dzmitry Malyshau d4ec1157f0 Update wgpu depth_or_array_layers 2021-03-01 23:26:08 -05:00
Oleg Andreev c9a7fe75d4 Return None from get_swap_chain_preferred_format if the adapter does not support the surface. 2021-03-01 18:15:01 +03:00
Dzmitry Malyshau 6d39d8f739 Update wgpu with the new vertex format 2021-02-27 22:56:47 -05:00
Patrick LaFontaine 3bb7c94b9e spelling error in skybox 2021-02-24 17:29:13 -05:00
Dzmitry Malyshau 60fe95205a Blend state API update 2021-02-19 16:16:19 -05:00
Dzmitry Malyshau e733e17e49 Update naga to gfx-11 2021-02-16 10:55:29 -05:00
Dzmitry Malyshau 657ee0ba61 Stop using vertex attributes in the mipmap example 2021-02-12 22:33:17 -05:00
Dzmitry Malyshau de8182f152 Demonstrate obj loading in the skybox example 2021-02-12 22:33:17 -05:00
Zsolt Bölöny 66b9633cf8 Convert PrimitiveState::cull_mode to Option<Face> 2021-02-11 12:59:47 +01:00
Tnze 6e6816e938 Use the "max" function to ensure that the swapchain size is not less than 1. For better readability. 2021-02-09 14:20:22 +08:00
Dzmitry Malyshau 7235072f6d Update version and dependencies to gfx-9 2021-02-01 02:16:31 -05: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
Dzmitry Malyshau 517ce3ef8d Update wgpu to the new render pipeline descriptor API 2021-01-29 00:51:44 -05:00
Connor Fitzgerald 6d52bc5535 Add pipeline statistics and timeline queries 2021-01-16 01:05:03 -05: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
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
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
Manuel Gil a5f44f2759 Remove wgpu-subscriber -> subscriber alias in examples 2021-01-05 19:05:52 +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
Connor Fitzgerald 1d216c590e Use only 1 and 4 samples for msaa-line example 2020-12-21 15:34:19 -05:00
Dzmitry Malyshau f3d6d242d7 Update wgpu with Naga fixes and OpenGL backend 2020-12-17 13:03:27 -05:00
Emanuele Dalla Longa bdd6edecd2 Require labels to match gfx-rs/wgpu#1088
Change-Id: I1acc45a3023dfc78b6694bd4a28a0131f07b7ba7
2020-12-16 00:15:05 +01:00
Connor Fitzgerald a4202a4ff0 Add create_texture_with_data helper 2020-12-12 01:50:49 -05:00
Dzmitry Malyshau f213d1db8f Update wgpu with Naga changes, replace hello-triangle shaders with WGSL 2020-12-07 09:45:24 -05:00
Connor Fitzgerald 7dbe4274fb Integrate ETC and ASTC textures in skybox example 2020-12-06 16:51:57 -05:00
Dzmitry Malyshau 7b06c4a3f7 Introduce ShaderModuleDescriptor 2020-12-05 18:53:37 -05:00
kejor 423c2489b8 API and examples update for index_format 2020-12-04 20:29:42 -05:00
Dzmitry Malyshau 9c529b94f5 Adopt the updated bind group entry API 2020-11-30 22:31:31 -05:00
Diggory Blake bed49ac654 Print chosen adapter when running examples 2020-11-30 18:33:51 +00:00
Devin Hill 337612a49f make TextureViewArray take a slice of refs; fix texture-arrays example to match. 2020-11-24 21:09:00 -05:00
Dzmitry Malyshau 2dc59ba2d9 Port to the updated wgpu error model 2020-11-23 17:59:21 -05:00
Joshua Groves 4fafceb30a Fix typo 2020-11-21 00:07:57 -03:30
Joshua Groves 8d5ef65dcb Temporarily use BackendBit::PRIMARY in examples
`BackendBit::all()` allows GL/surfman to be used on macOS which appears
to prevent rendering with Metal (e.g. hello-triangle displays an empty
window).

surfman will be removed in later versions of gfx, which will allow us
to switch back to `BackendBit::all()` in the examples.
2020-11-20 23:33:10 -03:30
Dzmitry Malyshau 9c638a2707 Update wgpu, work around surface validation 2020-11-18 10:05:20 -05:00
infinitesnow 2c2f778dba Fixed size in "boids" example 2020-11-17 21:26:35 +01:00
Timo de Kort ee220edce0 Remove implicit conversion hello-triangle shader.vert 2020-11-15 23:13:53 +01:00
Stygeon ef56676cfc Removed unusued Uniform struct in texture-arrays example. 2020-11-12 02:26:58 +01:00
Dzmitry Malyshau d004ddc038 Match inputs/outputs in msaa-line shader 2020-11-09 09:27:51 -05:00
Zsolt Bölöny 16427aed19 Rename TextureUsage::OUTPUT_ATTACHMENT to RENDER_ATTACHMENT 2020-11-09 10:35:55 +01:00
Dzmitry Malyshau b6cabe16a2 Enable GL backend 2020-11-04 23:02:01 -05:00
Dzmitry Malyshau 503b61dc6c Update wgpu with another bind group fix, updated power preference 2020-10-13 16:57:52 -04:00
Paris DOUADY c4d7ce146f Fix mipmap example which was y-flipped 2020-10-12 16:51:24 +02:00
Dzmitry Malyshau 30fb46a999 Really fix the environment to WGPU_BACKEND this time 2020-10-11 23:43:39 -04:00
Dzmitry Malyshau d8fe188305 Support WGPU_BACKEND environment in the examples 2020-10-11 23:17:38 -04:00
Joshua Groves 0fb8a436e5 Reorder framework window creation for web 2020-09-16 01:04:49 -02:30
Dzmitry Malyshau 568072fb18 Use implicit bind group layout in the mipmap example 2020-09-10 23:59:52 -04:00
Dzmitry Malyshau a9e9f8cabc Update wgpu with the polygon modes support, use in the cube example 2020-09-10 22:02:05 -04:00
qthree 0be45b5d67 Add hello-windows example 2020-09-10 06:55:42 +07:00
Rukai 085e50c798 Replace unsafe impl Pod with safe derive 2020-09-08 23:39:12 +10:00