This change is to help with an attempt to allow the Context type in wgpu to be swappable at runtime. In order to do that, the functions provided by Context and it's associated types need to be object safe. Instead of passing a impl trait that combines both HasRawWindowHandle and HasRawDisplayHandle, we seperate the types into their RawDisplayHandle and RawWindowHandle parts internally to reduce some of the hal implementation code mess.
* Make the color attachments `Option`-al in render pipelines, render passes, and render bundles
* vk: `Option`-al color attachments support
* dx12: sparse color_attachments support
* Only non-hole attachments is supported on wasm target and gl backend
* deno_webgpu: `Option`-al color attachments support
* Follow all suggestions
* surface.acquire_texture: pass Option<Duration> for timeout
A std::time::Duration allows for timeouts to be specified more clearly in
Rust using whatever units are convenient for the caller, and an Option also
makes it clearer in case no timeout is wanted, as opposed to passing a
bitwise !0 as special timeout value.
Notably there was an impedance mismatch with the Vulkan backend that
takes a 64bit timeout in nanoseconds and uses u64::MAX to indicate no
timeout and the backend was not mapping a given u32::MAX into a u64::MAX
* surface.acquire_texture: ignore timeout for Android < 11
Prior to Android 11 then Android's vkAcquireNextImageKHR implementation was
non-conformant and didn't support timeouts and additionally would log a
verbose warning if a timeout was requested.
For reference this version of AcquireNextImageKHR doesn't support timeouts:
https://android.googlesource.com/platform/frameworks/native/+/refs/tags/android-mainline-10.0.0_r13/vulkan/libvulkan/swapchain.cpp#1426
and this version does:
https://android.googlesource.com/platform/frameworks/native/+/refs/tags/android-mainline-11.0.0_r45/vulkan/libvulkan/swapchain.cpp#1438
(i.e. timeout support was added in Android 11)
This patch adds a dependency on the `android-properties` crate that provides
a simple wrapper for the `__system_property_set` syscall so that the
platform version can be read via the `ro.build.version.sdk` property
and then for versions < 30 (corresponds to Android 11) any timeout
given to `acquire_texture` will be ignored (and `u64::MAX` will be
passed to Vulkan)
* Introduce SamplerBindingType enum and fix bug in validation
This matches the WebGPU spec more closely and also lets us implement the
validation as it's written in the spec[1]. This fixes a bug which
previously prevented the "shadow" example from running in Firefox.
Previously the validation would check whether the filtering was
appropiate even if it was a comparison sampler. This didn't matter when
running the shadow example natively since the example was setting
`filtering: true` in addition to `comparison: true`. But this failed
when running through a browser since there the used WebIDL has the
proper enum representation and eventually resulted in `filtering: false`
being passed to wgpu-core which would then fail validation.[2]
[1]: https://gpuweb.github.io/gpuweb/#bind-group-creation
[2]: 674b6582ba/dom/webgpu/ipc/WebGPUChild.cpp (L502-L513)
* Fix remaining examples
* Fix deno_webgpu