Commit Graph
8897 Commits
Author SHA1 Message Date
Dzmitry Malyshau a4f897b5d7 Include the extent into the framebuffer map key 2021-01-15 00:53:51 -05:00
Dzmitry Malyshau 012569845d Update render pass and framebuffers logic to the latest gfx-hal 2021-01-15 00:53:28 -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
bors[bot]anddasetwas 4ce449c89f Merge #1148
1148: Remove comment introduced in #1144 r=cwfitzgerald a=DasEtwas

Tested to be unnecessary by reading

Co-authored-by: dasetwas <dasetwas@dasetwas.dasetwas>
2021-01-13 23:28:23 +00:00
dasetwas c01e2d10ce Remove comment introduced in https://github.com/gfx-rs/wgpu/pull/1144 2021-01-13 23:28:44 +01:00
Andreas Reich 1974b2a344 [rs] Exposed get_texture_format_features on adapter 2021-01-13 23:23:44 +01:00
Pelle Johnsen 61d624c82e [glsl-in] Implement function call (#354) 2021-01-13 08:07:43 +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]andMikko Lehtonen c788b1cef6 Merge #1132
1132: Include pipeline id in some pass error scopes r=kvark a=scoopr



Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2021-01-12 21:16:30 +00:00
Mikko Lehtonen 6c56613045 Merge PassErrorScope::Draw* and Dispatch* variants 2021-01-12 22:23:17 +02:00
Mikko Lehtonen 0d60bd80c5 Include pipeline id in some pass error scopes 2021-01-12 17:58:44 +02:00
bors[bot]andDzmitry Malyshau ec9c8a2e84 Merge #1145
1145: Support trailing render passes after the swapchain rendering r=kvark a=kvark

**Connections**
Discussed on the matrix.

**Description**
Fixes a case where we have any other render pass in a command encoder that draws to the swapchain (after the pass that draws to the swapchain).

**Testing**
Tested on a modified hello-triangle example.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-01-12 02:56:46 +00:00
Dzmitry Malyshau 389a848dea Support trailing render passes after the swapchain rendering 2021-01-11 21:40:41 -05:00
bors[bot]andDasEtwas 09ba19b265 Merge #1144
1144: Fix and simplify attachment dimension mismatch check r=kvark a=DasEtwas

This also improves error messages with detailed dimension and attachment type name info which developers can hopefully recognize.

**Connections**
None

**Description**
Before this commit, depth/stencil attachments are not considered when evaluating the renderpasses' dimension, which will result in a "NoAttachment" error with a confusing display message.

**Testing**
Tested by running an application making use of color-only and depth/stencil-only attachment renderpasses.

Tested by running boids, hello-triangle and shadow examples.


Co-authored-by: DasEtwas <18222134+DasEtwas@users.noreply.github.com>
2021-01-11 23:05:10 +00:00
DasEtwas 93f68add27 Decrease error variant code verbosity, apply reviews 2021-01-11 23:46:26 +01: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
DasEtwas 151d521ad9 Fix and simplify attachment dimension mismatch check
This also improves error messages with detailed dimension and attachment type name info which should help developers can hopefully recognize.
2021-01-11 20:13:14 +01:00
bors[bot]andNiklas Korz ae3e5057af Merge #1142
1142: Move get_swap_chain_preferred_format from device to adapter and check formats r=kvark a=niklaskorz

**Connections**

https://github.com/gfx-rs/wgpu-rs/issues/123#issuecomment-757831458

**Description**

Not all devices actually support `Bgra8UnormSrgb`. If this is the case, a similar format like `Rgba8UnormSrgb` can be used.

**Testing**

https://github.com/niklaskorz/wgpu/blob/e5ebfa70a4416c1b579d32566b5c1c8190dac189/learn-wgpu/src/lib.rs#L137

- Output on MacBook Pro 13" Intel 2020 macOS Metal: `Format: Bgra8UnormSrgb`
- Output on OnePlus 7 Pro Android Vulkan: `Format: Rgba8UnormSrgb`


Co-authored-by: Niklas Korz <niklas@niklaskorz.de>
2021-01-11 19:03:40 +00:00
Niklas Korz ac98c0bdfa Move get_swap_chain_preferred_format from device to adapter and check formats
Squashed commit of the following:

commit 16e9c89dbccda3e37d05f7548dc8b9ddfb1d8613
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 19:15:43 2021 +0100

    format

commit 8c69a70ec22427b6a030915e06654bb0fc9b3c69
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 19:12:24 2021 +0100

    Implement Global::adapter_get_swap_chain_preferred_format

commit 63efae1cff508d060eaa6ccafe80c02af6af21f4
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 17:25:42 2021 +0100

    Move get_swap_chain_preferred_format to adapter

commit 1e72a876994820aec9b18f9dac7f1a9ae82d7cee
Author: Niklas Korz <niklas@niklaskorz.de>
Date:   Mon Jan 11 15:49:10 2021 +0100

    Add fallback to device_get_swap_chain_preferred_format
2021-01-11 19:50:32 +01:00
Dzmitry Malyshau 73cb6d4bdf [spv] Relax decoration checks for global variables 2021-01-11 09:32:27 -05:00
bors[bot]andAndreas Reich 5a29e010e2 Merge #1140
1140: Enable storage read/write format feature r=kvark a=Wumpf

**Connections**
#1112

**Description**
Use `wgt::TextureFormatFeatureFlags::STORAGE_READ_WRITE` in `get_texture_format_features`.
This has been waiting for a gfx update which was enabled by @ElArtista 's workaround in #1136 \o/

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2021-01-10 22:26:58 +00:00
Andreas Reich 78466fbb31 Enable storage read/write format feature 2021-01-10 22:12:09 +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
bors[bot]andJonathan Behrens 8920e8b2ba Merge #1135
1135: Make all textures support usage COPY_SRC and COPY_DST r=kvark a=fintelia

**Connections**
N/A

**Description**
In WebGPU, all textures should be allowed to have usages COPY_SRC and COPY_DST. However, right now when Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES is enabled any features that the backend says can't be blitted to/from will not gain these capabilities. In particular, compressed textures may not support blitting while still allowing access via copies to/from buffers.

You can also see the defaults used when TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES is not requested:
https://github.com/gfx-rs/wgpu/blob/8c00cbcc8e8b955477f2df29b4b0a20712fdef78/wgpu-types/src/lib.rs#L1224-L1342

**Testing**
I ran a [patched version of the wgpu-rs cube example](https://github.com/fintelia/wgpu-rs/tree/cube-bc4/examples/cube).

Co-authored-by: Jonathan Behrens <fintelia@gmail.com>
2021-01-10 16:09:13 +00:00
Jonathan Behrens 1e7fa480a1 Make all textures support their guaranteed usages 2021-01-10 10:59:42 -05: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
Dzmitry Malyshau c6658e775d Typifier support for vector * matrix multiplication 2021-01-09 21:06:28 -05:00
Dzmitry Malyshau 08b6c416a3 Unlock arbitrary binding indices in the validator 2021-01-09 20:59:51 -05:00
bors[bot]andTheArtist 5b9cfeb941 Merge #1136
1136: Changed Arc<B::Memory> to Arc<Mutex<B::Memory>> in GpuAllocator r=kvark a=ElArtista

Work around for blocker https://github.com/zakarumych/gpu-alloc/issues/33, makes wgpu compatible with latest gfx

Co-authored-by: TheArtist <agorglouk@gmail.com>
2021-01-09 23:17:03 +00:00
TheArtist ce908c5f57 Changed Arc<B::Memory> to Arc<Mutex<B::Memory>> in GpuAllocator 2021-01-09 19:53:13 +02:00
Dzmitry Malyshau 4e5b39f452 [spv] indexing arrays 2021-01-08 23:28:08 -05:00
Dzmitry Malyshau bd998f6c32 Validate constant array sizes 2021-01-07 15:04:31 -05: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]andAndreas Reich 8c00cbcc8e Merge #1112
1112: Expose adapter specific formats features via Extension, support for storage read+write r=kvark a=Wumpf

**Connections**
Draft until https://github.com/gfx-rs/gfx/pull/3559 landed (then update and comment two lines in)
New & improved replacement for #1109

PR for wgpu-rs to be opened once there's some confidence that this is that it should look like. [Preview](https://github.com/gfx-rs/wgpu-rs/compare/master...Wumpf:texture-format-feature-query?expand=1)

**Description**
Adapter exposes now per texture format specific features. Feature struct defined as allowed usages + flags. Flags describe only storage texture usage so far.

Query not used for validation unless `TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES` feature is enabled on a device. Otherwise uses hardcoded feature set guaranteed by webgpu.
Storage read/write binding can then be used as a consequence (storage atomic has no effect yet).

**Testing**
Manual testing with my fluid sim project through wgpu-rs which covers storage r/w for a few different formats and storage in general for formats that don't support this usage by default at all.
Ran tests and a couple of samples to see if anything broke with the feature disabled.

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2021-01-06 18:56:30 +00: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
Andreas Reich 30c96bfead Added note on why hal update needed for STORAGE_READ_WRITE is blocked atm 2021-01-06 17:59:53 +01:00
bors[bot]andGreg V 4c81941989 Merge #1134
1134: Never prefer CPU devices over GPUs r=kvark a=myfreeweb

**Connections**
Rebase of #969 onto master

**Description**
See #969

Co-authored-by: Greg V <greg@unrelenting.technology>
2021-01-06 16:32:54 +00:00
Greg V 072b94c9fd Never prefer CPU devices over GPUs 2021-01-06 19:19:39 +03: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
Jay Oster 3bf7f41068 WGSL // comments
- Update parser to match the latest spec: https://github.com/gpuweb/gpuweb/pull/1326
2021-01-06 09:19:46 -05:00
Andreas Reich e29d17a13f wgpu format features are again part of TextureFormatInfo
+ some cleanup/fix indentations
2021-01-05 23:54:50 +01: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