Commit Graph
8897 Commits
Author SHA1 Message Date
Dzmitry Malyshau e72bf3e10c Fix wgpu downlevel check 2021-06-20 01:24:44 -04:00
bors[bot]andAlex S 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]andGordon-F 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
João Capucho 4bc4c60663 [glsl-in] Implicit casts for function calls 2021-06-19 13:58:21 -04:00
bors[bot]andAlex S 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]andAlex S 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
Gordon-F 6cdd332cef Reorganize test snapshot folder 2021-06-19 10:19:04 -04:00
Jim Blandy c16f2097ad [spv-out]: Ensure array subscripts are in bounds. 2021-06-18 20:44:07 -04:00
Jim Blandy a7cacab276 [spv-out] Move Writer type to back/spv/mod.rs.
The `impl` blocks for `Writer` and its associated types remain in spv/writer.rs.

There should be no substantive code changes in this commit, only moving code
around and adjusting `use` declarations to match.
2021-06-18 20:44:07 -04:00
Jim Blandy 9146942412 [spv-out]: Abstract out null constant creation. 2021-06-18 20:44:07 -04:00
Jim Blandy ac92f09a48 [spv-out] Document is_intermediate. 2021-06-18 20:44:07 -04:00
Jim Blandy 1d0b3f3a75 Functions can take pointers to unsized structs, but no other unsized types. 2021-06-18 20:44:07 -04:00
Jim Blandy fd3b2a93d4 access.wgsl: Make array mutable, and assign to an element. 2021-06-18 20:44:07 -04:00
Jim Blandy b8724eb1fd Tweak access.wgsl to avoid #913 and make SPIR-V more distinctive. 2021-06-18 20:44:07 -04:00
Dzmitry Malyshau 8376bab562 Bump version to 0.5 naga-v0.5.0 2021-06-18 20:18:52 -04:00
Dzmitry Malyshau f0f8a5f3ba Fix GLSL frontend clippy error 2021-06-18 20:18:52 -04:00
Dzmitry Malyshau bfeab40c8d Changelog for v0.5 release 2021-06-18 20:18:52 -04:00
bors[bot]andAlex S 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
João Capucho a1bd4a8053 [glsl-in] Allow structs as local type 2021-06-18 16:54:45 -04:00
Gordon-F 46be75fb37 [hlsl-out] Implement all parts required by quad-spv snaphost test 2021-06-18 15:23:09 -04:00
Frizi 5242d4f5a9 avoid hashmap allocation when entering namer namespace 2021-06-18 13:57:44 -04:00
Frizi b89da31cc7 reorder namer assignment order to preserve names for reflection 2021-06-18 13:57:44 -04:00
bors[bot]andConnor Fitzgerald 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]andConnor Fitzgerald 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
Connor Fitzgerald aad39c7886 Fix validation issue with shadow example 2021-06-18 13:15:28 -04:00
Connor Fitzgerald f49c50442f Update naga to gfx-26 2021-06-18 13:15:28 -04:00
Connor Fitzgerald 91437ea706 Updated changelog for 0.9 2021-06-18 13:07:52 -04:00
bors[bot]andAlex S 49f677b1fd Merge #1513
1513: Fix failing test compilation on windows - DX12 and DX11 not there. r=kvark a=ElectronicRU

**Description**
Due to some things in macros being left on cfg(windows) and some changed to cfg(dx12/dx11), the tests didn't even compile, much less run.

**Testing**
Ideally, some CI for Windows should be set up.


Co-authored-by: Alex S <alex0player@gmail.com>
2021-06-18 16:44:18 +00:00
Alex S 9f6f4da4ba blindsided by clippy 2021-06-18 19:31:12 +03:00
Alex S 8d13d97663 Fix failing test compilation on windows - DX12 and DX11 not there. 2021-06-18 19:29:09 +03:00
Alex S 52fab481e6 Added storage texture array support.
I also took the liberty to refactor texture format checking a bit,
and tighten up sampled texture support detection for Metal as well.
2021-06-18 19:20:37 +03:00
Jakob Hellermann 9d7e5cf0b5 [cli] add codespan_reporting to glsl error 2021-06-18 16:23:13 +01:00
Jakob Hellermann 8f410d5ca8 [glsl-in] add source metadata to VariableAlreadyDeclared error 2021-06-18 16:23:13 +01:00
Jakob Hellermann c2cfcbf84b [glsl-in] include information on what was expected in InvalidToken 2021-06-18 16:23:13 +01:00
Dzmitry Malyshau 9c8d4dbfa6 Hot patch for temp_suspected tracking 2021-06-18 10:59:47 -04:00
bors[bot]andDzmitry Malyshau ca291bfc4f Merge #1505
1505: Change the order to suspect temporary resources earlier r=kvark a=kvark

**Connections**
Fixes #1504

**Description**
I don't fully understand why this works.

**Testing**
tested on the privately given case, also our examples


Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-06-18 13:58:30 +00:00