Commit Graph
63 Commits
Author SHA1 Message Date
Dzmitry Malyshau b8f430551b hal/mtl: fix supportsFamily call 2021-06-22 22:13:36 -04:00
bors[bot]andAlex S 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
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]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 b0ba01dba6 ...And add the feature flag to Vulkan, which previously worked by accident. 2021-06-20 05:12:19 +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
Gordon-F 2873ac32d9 Remove MPL 2.0 header in files 2021-06-19 21:06:08 +03: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
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
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
Dzmitry Malyshau c73ce25f42 hal/vk: update the fence value 2021-06-17 16:29:23 -04:00
Dzmitry Malyshau 220f359535 Address review notes 2021-06-17 14:18:30 -04:00
Dzmitry Malyshau 0b506afc60 hal/vk: use non-coherent-atom-size 2021-06-16 23:52:04 -04:00
Dzmitry Malyshau 7410b700d6 fix swapchain recycling, copies, device destruction, RODS 2021-06-16 23:18:50 -04:00
Dzmitry Malyshau 54d7391df0 Minor tweaks to make CI happy 2021-06-16 20:28:45 -04:00
Dzmitry Malyshau fb662dfbec hal/vk: polishing to run halmark with no validation issues 2021-06-16 17:15:34 -04:00
Dzmitry Malyshau c53addac8a hal/vk: draws and dispatches. Refactor query set descriptor 2021-06-16 14:17:37 -04:00
Dzmitry Malyshau 1952ecb99c hal/vk: enable vulkan portability support on macos 2021-06-16 11:42:37 -04:00
Dzmitry Malyshau 67dfdb9193 hal/vk: debug markers, bind groups, viewports 2021-06-16 02:05:34 -04:00
Dzmitry Malyshau bc6bb0c3df hal/vk: render passes and queries 2021-06-16 01:26:14 -04:00
Dzmitry Malyshau 6f655e0b14 hal/vk: barriers and copies 2021-06-15 15:58:12 -04:00
Dzmitry Malyshau a260cff0f0 hal/vk: queue operations 2021-06-15 11:38:07 -04:00
Dzmitry Malyshau 668fedd1c0 hal: rename aux to util 2021-06-15 01:33:19 -04:00
Dzmitry Malyshau 00de15990e hal/vk: pipeline creation 2021-06-15 01:24:25 -04:00
Dzmitry Malyshau 9d85602349 hal: re-architect command encoding and pooling 2021-06-14 13:30:28 -04:00
Dzmitry Malyshau d8979cad4a hal/vk: command pools, clippy warnings 2021-06-14 10:26:40 -04:00
Dzmitry Malyshau c2bb2d5dfc Experimental command pool API 2021-06-14 01:58:09 -04:00
Dzmitry Malyshau 4eae5a38d0 hal/vk: hook up gpu-descriptor 2021-06-12 01:04:15 -04:00
Dzmitry Malyshau 006c1baaf2 hal/vk: pipeline layout, object labels and logging 2021-06-11 20:23:15 -04:00
Dzmitry Malyshau 61e2e242cd hal/vk: textures and samplers 2021-06-11 19:14:41 -04:00
Dzmitry Malyshau b4380e4576 hal/vk: buffer and texture creation 2021-06-11 15:53:07 -04:00
Dzmitry Malyshau 9ae5e36ad8 hal/vk: format mapping 2021-06-11 14:27:00 -04:00
Dzmitry Malyshau dc340421c4 hal/vk: instance and adapter 2021-06-11 02:09:29 -04:00
Dzmitry Malyshau 75b6ecea58 hal: Fix iOS build 2021-06-10 17:09:46 -04:00
Dzmitry Malyshau faf8f7e890 Simple API for coherent mapping 2021-06-10 16:05:44 -04:00
Dzmitry Malyshau d88aa99997 Fix rows-per-image treatment, clippy warnings 2021-06-10 15:43:21 -04:00
Dzmitry Malyshau 38e13a178b hal/mtl: array length support 2021-06-10 14:22:32 -04:00
Dzmitry Malyshau 006f8abbba build and clippy fixes, command buffer cleanup 2021-06-10 12:44:29 -04:00
Dzmitry Malyshau 317237771e hal: rename bunnymark to halmark 2021-06-10 11:29:35 -04:00
Dzmitry Malyshau 782c72d32c hal/mtl: queue 2021-06-10 10:54:06 -04:00
Dzmitry Malyshau 3109b1b63d hal/mtl: most of the command encoding 2021-06-10 02:31:31 -04:00
Dzmitry Malyshau bdaf57dbed hal/mtl: pipelines and fences 2021-06-09 23:38:48 -04:00
Dzmitry Malyshau 9f904700ee hal/mtl: creation of bind groups 2021-06-09 17:06:43 -04:00
Dzmitry Malyshau f46459c589 hal/mtl: buffer, texture, and view creation 2021-06-09 01:51:45 -04:00