Commit Graph

2871 Commits

Author SHA1 Message Date
Connor Fitzgerald
ebbbf2216b Add image comparison to the mipmap example 2021-06-23 19:10:11 -04:00
Connor Fitzgerald
3d8a4baeb8 Add out multiple tests of vertex pulling 2021-06-23 19:09:45 -04:00
Connor Fitzgerald
528a311dd1 Get test functioning 2021-06-23 19:09:44 -04:00
Connor Fitzgerald
cfda2258f5 Finish fs_main 2021-06-23 19:09:44 -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
Connor Fitzgerald
49b4bcb552 Finish out first vertex test 2021-06-23 19:09:44 -04:00
Connor Fitzgerald
cecf357452 Fully convert testing infrastructure to wgpu-rs 2021-06-23 19:09:44 -04:00
bors[bot]
eeb9ead199
Merge #1547
1547: Don't merge stateless trackers from bind groups r=cwfitzgerald a=kvark

**Connections**
Hinted by @pythonesque on the matrix
Follow-up to #1417

**Description**
This is an optimization only.

When a bind group is used, we need to ensure two things:
  1. stateful usages are merged in (buffers and textures)
  2. other resources are help alive by the command buffer

We used to merge all of the states into the local trackers. However, the local tracker already
keeps a strong reference to the whole bind group, so the resources in it are not going away.
Therefore, we can skip having them separately in the local trackers.

**Testing**
Untested.


Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2021-06-23 20:16:24 +00:00
Dzmitry Malyshau
c2f879b4f7 Don't merge stateless trackers from bind groups 2021-06-23 15:28:40 -04:00
bors[bot]
6035e988a4
Merge #1546
1546: Fix readme in wgpu r=kvark a=Dispersia

**Description**
 Just fixes the logo image in the wgpu/wgpu directory, didn't move the logo.png down because several other places reference it still as well.


Co-authored-by: Dispersia <dispersias@gmail.com>
2021-06-23 18:34:22 +00:00
Dispersia
ba7f4f1b7c Fix readme in wgpu 2021-06-23 10:27:02 -07:00
Dzmitry Malyshau
b8f430551b hal/mtl: fix supportsFamily call 2021-06-22 22:13:36 -04:00
bors[bot]
cb118e57f6
Merge #1540
1540: Test wgpu-rs more on CI r=scoopr a=kvark

**Connections**
https://github.com/gfx-rs/wgpu/pull/1539#issuecomment-866269882

**Description**
Enabling the build of `wgpu` with examples on all platforms, also covering by clippy.

**Testing**
Self-tested


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-06-22 22:08:14 +00:00
Dzmitry Malyshau
36939477c5 Test wgpu-rs more on CI 2021-06-22 17:23:32 -04:00
bors[bot]
eceffc1d35
Merge #1539
1539: Fix spirv feature by removing profiling::scope bit r=kvark a=scoopr

**Description**
Compilation failed with `spirv` featue enabled

**Testing**
Compiled with `spirv` feature enabled

Co-authored-by: Mikko Lehtonen <scoopr@iki.fi>
2021-06-22 20:01:32 +00:00
Mikko Lehtonen
886d2714e3 Fix spirv feature by removing profiling::scope bit 2021-06-22 22:23:03 +03:00
bors[bot]
5f2df9af79
Merge #1518
1518: Make spirv an optional feature r=cwfitzgerald a=kvark

**Connections**
https://github.com/gfx-rs/naga/issues/940 shows how much SPIR-V parsing can be a pain.

**Description**
Keep it supported natively, but put it behind a feature flag. This allows to skip compilation of parts of Naga as well as dependencies like `petgraph`.
On my machine, compiling `wgpu-core` time is reduced from 40.87s to 35.36s, which is about 13% improvement.

**Testing**
Just compiling


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-06-22 16:42:28 +00:00
Dzmitry Malyshau
4c03d286c6 Remove SPIRV entirely from wgpu-core 2021-06-22 12:35:22 -04:00
Dzmitry Malyshau
da38b8b077 Make spirv an optional feature 2021-06-21 12:09:12 -04:00
bors[bot]
56d584ad92
Merge #1534
1534: web: Restore WebGPU CI r=kvark a=grovesNL

**Connections**
Depends on/currently includes #1533

**Description**
Even though the WebGL backend needs to be temporarily disabled, we should be able to continue checking WebGPU on wasm.

**Testing**
Manually ran the CI command `cargo check --package wgpu --examples --target=wasm32-unknown-unknown` locally which seems to catch the mistake in #1533 without building wgpu-core/wgpu-hal.

Co-authored-by: grovesNL <josh@joshgroves.com>
2021-06-21 06:04:34 +00:00
bors[bot]
88b11e28b4
Merge #1533
1533: web: add empty `device_create_shader_module_spirv` r=kvark a=grovesNL

**Description**
We added a SPIR-V passthrough function to the `Context` trait shared between web/native backends, but the web backend also needs an implementation of this function to fully implement the trait.

**Testing**
Compiling the web backend for WebGPU.

Co-authored-by: grovesNL <josh@joshgroves.com>
2021-06-21 05:57:47 +00:00
grovesNL
ee254291c7 web: restore CI for WebGPU 2021-06-21 01:32:24 -02:30
grovesNL
fdd30916db web: add empty device_create_shader_module_spirv 2021-06-21 01:19:25 -02:30
bors[bot]
96dbd06a1f
Merge #1525
1525: Add Naga bypass to allow feeding raw SPIR-V shader data to the backend. r=kvark a=ElectronicRU

**Connections**
Fixes #1520 .

**Description**
While Naga checking is undoubtedly very useful, it currently lags behind
what is possible in SPIR-V and even what is promised by WGPU (ie binding
arrays). This adds an unsafe method to wgpu::Device to allow feeding
raw SPIR-V data into the backend, and adds a feature flag to request a
backend supporting this operation.

**Testing**
`texture_arrays` example is runnable now, which uncovers an additional bug in Vulkan backend - binding arrays are instead treated like sole bindings, and indices shift, too. Lots of errors from validation layer ensue.


Co-authored-by: Alex S <alex0player@gmail.com>
2021-06-20 16:13:53 +00:00
bors[bot]
55c7b7975b
Merge #1530
1530: Fix wgpu downlevel check r=kvark a=kvark

**Connections**
Fixes #1529

**Description**
The anisotropic flag is not in the compliant set, but the check was made for equality of the flags (instead of inclusion).

**Testing**
Untested


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-06-20 16:07:56 +00:00
Alex S
7cd7b18560 Code review:
- Remove Cow from wgpu-hal API surface. You graze on in our hearts.
- Rename feature flag to SPIRV_SHADER_PASSTHROUGH in anticipation
  of crate feature `spirv` to reduce confusion.
- Add some more documentation about behaviour and intended avenues of
  use to the feature.
2021-06-20 15:22:04 +03:00
bors[bot]
cfda54f108
Merge #1528
1528: Support TEXTURE_SPECIFIC_FORMAT_CAPABILITIES for rendertargets. r=kvark a=ElectronicRU

**Description**
With TEXTURE_SPECIFIC_FORMAT_FEATURES enabled, one would assume that render pipeline creation would use extended features
for color/depth-stencil render targets. However, it does not. This aims to fix that discrepancy.

Co-authored-by: Alex S <alex0player@gmail.com>
2021-06-20 06:14:42 +00:00
Dzmitry Malyshau
e72bf3e10c Fix wgpu downlevel check 2021-06-20 01:24:44 -04:00
bors[bot]
6cacfca10b
Merge #1527
1527: Fix wgpu-hal incorrectly ignoring arrays of bindings. r=kvark a=ElectronicRU

**Connections**
Fixes #1526.

**Description**
Even though binding sizes could potentially be derived from resource array lengths and binding indices, current implementation
flat out ignored that. Metal did a more sensible (?) thing and bound only the first resource in each array, Vulkan did a less
sensible thing and bound as many resources as there are bindings, obtaining them from unwrapped arrays.
(IE on Vulkan, if you bound two arrays, [view1, view2] and [view3, view4], it would actually bind [view1, <invalid>] and [view2, <invalid>]).

This aims to fix the issue.

**Testing**
After #1525 is merged, `cargo run --example texture-arrays` would be working as intended for Vulkan. Unfortunately, I can think of no easy way to test this on Metal - the shader support isn't there yet.


Co-authored-by: Alex S <alex0player@gmail.com>
2021-06-20 05:08:12 +00:00
Alex S
a82062595a Code review:
Remove .size field from BindGroupEntry, since this information
can be obtained from the layout.
2021-06-20 06:53:03 +03:00
Alex S
8bfa949261 Code review:
- rename ShaderInput variants
- rename feature flag
- hard error on Metal backend trying to compile SPIR-V
- fix test failing because of feature flag bits changing
2021-06-20 06:22:59 +03:00
Alex S
066bd7e647 Support TEXTURE_SPECIFIC_FORMAT_CAPABILITIES for rendertargets. 2021-06-20 05:57:55 +03:00
Alex S
b0ba01dba6 ...And add the feature flag to Vulkan, which previously worked by accident. 2021-06-20 05:12:19 +03:00
Alex S
3d6cda100a Fix unfortunate flag duplication. (I wish bitflags would catch that). 2021-06-20 05:05:33 +03:00
Alex S
7e6d6a33ed Fix (?) texture array binding for Metal.
Potentially needs more testing - Metal's binding model is quite
different from Vulkan and WGPU, but as far as I understand from the
documentation, arrays of textures occupy a contiguous range of binding
slots, so unwrapping and binding one-by-one should be fine.

Someone should actually go and test this on a Mac, maybe.
2021-06-19 23:35:48 +03:00
Alex S
dd4c681a2f Fix HAL binding for Vulkan. 2021-06-19 23:35:18 +03:00
Alex S
6d2e6e5a56 Add Naga bypass to allow feeding raw SPIR-V shader data to the backend.
While Naga checking is undoubtedly very useful, it currently lags behind
what is possible in SPIR-V and even what is promised by WGPU (ie binding
arrays). This adds an unsafe method to wgpu::Device to allow feeding
raw SPIR-V data into the backend, and adds a feature flag to request a
backend supporting this operation.
2021-06-19 23:32:44 +03:00
bors[bot]
616b489061
Merge #1524
1524: Remove MPL 2.0 header in files r=kvark a=Gordon-F

This is no more required since the repository is licensed under `MIT` and `Apache 2.0`.

Co-authored-by: Gordon-F <ishaposhnik@icloud.com>
2021-06-19 18:17:10 +00:00
Gordon-F
2873ac32d9 Remove MPL 2.0 header in files 2021-06-19 21:06:08 +03:00
bors[bot]
a8be371acf
Merge #1521
1521: Better compile error for not using resolver=2. r=kvark a=ElectronicRU

**Connections**
Usability fix proposed in #1517 with some re-wording to make the intent clearer.

**Description**
Provide a useful compile error in case a downstream project is using old Cargo resolver, instead of the deluge of obscure errors they get r/n if not on MacOS.

**Limitations**
On MacOS, vulkan feature is totally valid, so we cannot detect resolver=1 on Mac.


Co-authored-by: Alex S <alex0player@gmail.com>
2021-06-19 15:08:13 +00:00
Alex S
1dea443340 Better compile error for not using resolver=2. 2021-06-19 17:36:50 +03:00
bors[bot]
77e57ebcc6
Merge #1519
1519: Add TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES to supported for Vulkan and Metal. r=kvark a=ElectronicRU

Adapter callbacks are already there, so this is likely an oversight.

**Description**
Adapter callbacks for texture capabilities were there, but feature flags weren't enabled, which prevented use of them.


Co-authored-by: Alex S <alex0player@gmail.com>
2021-06-19 14:29:45 +00:00
Alex S
70168ee0f5 Query optimal tiling features for Vulkan.
Images are always created with vk::ImageTiling::OPTIMAL,
so it doesn't make much sense querying linear tiling features.
2021-06-19 17:25:39 +03:00
Alex S
1b96f1a27e Add TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES to supported for Vulkan and Metal.
Adapter callbacks are already there, so this is likely an oversight.
2021-06-19 17:25:39 +03:00
bors[bot]
1d2efb43bc
Merge #1511
1511: Added storage texture array support. r=kvark a=ElectronicRU

**Description**
Arrays of storage images (*f*image*n*D in GLSL parlance) should now be supported.
I also took the liberty to refactor texture format checking a bit,
and tighten up sampled texture support detection for Metal as well.

**Testing**
Not completely sure what's the proper testing approach here, open to suggestions.


Co-authored-by: Alex S <alex0player@gmail.com>
2021-06-18 21:38:54 +00:00
Alex S
894489b8ff Add changelog entry 2021-06-19 00:30:10 +03:00
bors[bot]
fae0d4b971
Merge #1516
1516: Relicense to MIT/Apache r=kvark a=cwfitzgerald

**Connections**

Closes #1440 #1473

**Description**

Relicenses all of the project to MIT/Apache. Thank you to all 142 people who replied on the issue!


Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-06-18 17:44:21 +00:00
Connor Fitzgerald
74d2becb18 Relicense to MIT/Apache 2021-06-18 13:40:31 -04:00
bors[bot]
26f9be9a7c
Merge #1514
1514: Updated changelog for 0.9 r=kvark a=cwfitzgerald

Ports #1512 forward

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-06-18 17:16:28 +00:00