Commit Graph
123 Commits
Author SHA1 Message Date
Jim Blandy 9c6a60d97c Fix surface creation cfgs in example framework. (#3246) 2022-11-30 16:46:24 -05:00
Connor Fitzgerald 183ba3f231 Make Surface::get_default_config return an Option. 2022-11-27 01:50:47 -05:00
Jinlei Li caee97e402 Add get_default_configure to simplify user creation of SurfaceConfiguration (#3034) 2022-10-13 06:15:46 +00:00
Jinlei Li 44399bb4a3 Expose alpha_mode, support non-opaque mode on metal and vk backends (#2836) 2022-09-19 00:10:21 -04:00
victorvde 7375acb230 get_supported_formats: sort like the old get_preferred_format and simplify return type (#2786)
* get_supported_formats: sort srgb first like the old get_preferred_format

* get_supported_formats: simplify return type
2022-06-22 21:04:18 +00:00
Connor Fitzgerald 7df4fd1cd4 Use FIFO swapchain in examples 2022-06-20 23:15:28 -07:00
StevenandConnor Fitzgerald 0d4d3f4ceb Change get_preferred_format to get_supported_formats (#2783)
* Change all the functions

* Return the set of supported TextureFormat specified by WebGPU

* Remove redundant filtering and use list directly

* Replace pops with first

* Remove now unused function

* Fix doc and clarify preffered format

* Dereference enums

* Remove unused list

* Remove fancy coode

* Update wgpu-core/src/device/mod.rs

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-06-18 00:21:02 -04:00
StevenandConnor Fitzgerald df1472d4a3 Fix bunnymark test screenshot and replace rand with nanorand (#2746)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-06-10 21:44:27 +00:00
Harald ReingruberandZicklag 25b16d5cc8 OffscreenCanvas Support for WebGL Backend (#2603)
* First attempt of exposing create_surface_from_canvas for webgl

* Test Fix Compile For WebGL Offscreen Canvas

* Only specify web-sys feature version in wgpu-core, so that patch version is taken from workspace

* Reuse already existing fn create_surface_from_canvas

* Remove unnecessary unsafe

* Remove unsafe prefix also from top-level create_surface_from_canvas

* Add create_surface_from_offscreen_canvas() for webgl

* Cargo fmt

* Store webgl2_context instead of canvas, which works also for OffscreenCanvas

* Copy skybox example for OffscreenCanvas example

* Use offscreen_canvas instead in newly created example

* Update skypbox_offscreen readme.md

* Allow enabling OffscreenCanvas in examples via http://localhost:8000/?offscreen_canvas=true

* Fix cargo fmt

* [fix warning] Only import FromStr for wasm32

* [fix warning] Exclude offscreen_canvas_setup from non-wasm32

* [fix warning] Add ImageBitmap feature as well so that all related methods can be used

* Fix cargo fmt

* Fix emscripten build

* Remove `webgl` feature from wgpu-core as webgl is the only wasm32 backend

Co-authored-by: Zicklag <zicklag@katharostech.com>
2022-06-07 01:57:16 -04:00
Connor Fitzgerald 32af4f5607 Convert map_async from being async to being callback based (#2698) 2022-05-31 11:22:21 -04:00
Alphyr 58f318550d Fix clippy lints (#2560) 2022-03-28 09:00:09 -04:00
Alphyr b0da1a2c1d Switch from cgmath to glam in examples (#2544) 2022-03-21 10:32:59 -04:00
Connor Fitzgerald b87e50feae Rename get_downlevel_properties to get_downlevel_capabilities 2022-02-24 23:52:41 -05:00
Zicklag 312828f12f Implement WebGL2 Backend (#1686)
* Implement WebGL Backend

* Add WebGL Fixes by @mrk-its

* Update Limits for WASM and Examples

* Address Review Points
2021-10-07 16:18:09 -04:00
Dzmitry Malyshau 5092fb7ea5 Refactor presentation to be explicit 2021-10-06 17:02:10 -04:00
Dzmitry Malyshau d23288e455 hal/linux: Work around Intel+Nvidia presentation conflict 2021-09-02 14:50:05 -04:00
Christofer Nolander 39e8921fe8 example-framework: resize surface on scale factor change 2021-08-27 15:10:03 -04:00
Dzmitry Malyshau 4a1ae0d7ec Issue surface texture transitions 2021-08-11 20:58:42 -04:00
Dzmitry Malyshau dffe1f1793 Return a texture by the surface 2021-08-11 20:58:42 -04:00
Dzmitry Malyshau f78061bcef Merge swap chain into surface 2021-08-11 20:58:42 -04:00
Connor Fitzgerald adcd708cf1 Fix example limits 2021-07-13 14:07:39 -04:00
Connor Fitzgerald 130ddcf561 Unify CI and testing 2021-07-04 15:22:51 -04:00
Connor Fitzgerald 26f3c03150 Add downlevel limit for vertex shader access to SSBO 2021-07-03 22:15:16 -04:00
Dzmitry Malyshau d2a4af35af Generation of memory reports for Hubs 2021-07-03 01:51:04 -04:00
Connor Fitzgerald a336c9e160 Spell tolerance right 2021-07-02 00:13:33 -04:00
Dzmitry Malyshau ba006cfaa7 Rename ColorWrite, TextureUsage, and BufferUsage 2021-06-30 14:57:38 -04:00
Dzmitry Malyshau 568ac3fa24 Switch all bitflag names to plural 2021-06-30 14:43:36 -04:00
Connor Fitzgerald b060bf1afe Assorted touchups 2021-06-23 20:23:19 -04:00
Connor Fitzgerald 3356f5f993 PR comments 2021-06-23 19:10:11 -04:00
Connor Fitzgerald c0664c2bb7 Begin robust exception system 2021-06-23 19:10:11 -04:00
Connor Fitzgerald ec74722d57 Add image comparison to all examples 2021-06-23 19:10:11 -04:00
Connor Fitzgerald ebbbf2216b Add image comparison to the mipmap example 2021-06-23 19:10:11 -04:00
Connor Fitzgerald 6432c4f6d8 Massively refactor testing infrastructure to better share code 2021-06-23 19:09:44 -04:00
Connor Fitzgerald 03c7f0097a Unify testing and examples and add useful external utilities 2021-06-23 19:09:44 -04:00
Frizi 07376d11e8 Handle winit exception in web to avoid breaking async executor 2021-06-03 13:02:56 +02:00
Dzmitry Malyshau e98f36245b [rs] Framework and README update 2021-06-01 09:54:44 -04:00
Dzmitry Malyshau 070688a84d [rs] Schedule event waits after redraw events are cleared 2021-03-17 22:58:35 -04:00
bors[bot]andAron Granberg 0542ad585a [rs] Merge #798
798: Fix all the clippy lints r=kvark a=HalfVoxel

Clippy is now happy

Co-authored-by: Aron Granberg <aron.granberg@gmail.com>
2021-03-17 14:02:03 +00:00
Aron Granberg 162fe18e7d [rs] Fix all the clippy lints and add clippy/fmt CI 2021-03-17 14:40:25 +01:00
Connor Fitzgerald 3a131f5f60 [rs] Move from tracing to log + profiling 2021-03-17 01:34:38 -04:00
Oleg Andreev 5adaa23de9 [rs] Return None from get_swap_chain_preferred_format if the adapter does not support the surface. 2021-03-01 18:15:01 +03:00
Tnze e9d68a332d [rs] 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
Connor Fitzgerald af61d9c917 [rs] Add pipeline statistics and timeline queries 2021-01-16 01:05:03 -05: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
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
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
Manuel Gil d2844caaf0 [rs] Remove wgpu-subscriber -> subscriber alias in examples 2021-01-05 19:05:52 +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
Dzmitry Malyshau bafcc5ace5 [rs] Update wgpu with Naga fixes and OpenGL backend 2020-12-17 13:03:27 -05:00
Connor Fitzgerald 7e05bba6c4 [rs] Add create_texture_with_data helper 2020-12-12 01:50:49 -05:00