* First attempt of exposing create_surface_from_canvas for webgl
* Test Fix Compile For WebGL Offscreen Canvas
* Only specify web-sys feature version in wgpu-core, so that patch version is taken from workspace
* Reuse already existing fn create_surface_from_canvas
* Remove unnecessary unsafe
* Remove unsafe prefix also from top-level create_surface_from_canvas
* Add create_surface_from_offscreen_canvas() for webgl
* Cargo fmt
* Store webgl2_context instead of canvas, which works also for OffscreenCanvas
* Copy skybox example for OffscreenCanvas example
* Use offscreen_canvas instead in newly created example
* Update skypbox_offscreen readme.md
* Allow enabling OffscreenCanvas in examples via http://localhost:8000/?offscreen_canvas=true
* Fix cargo fmt
* [fix warning] Only import FromStr for wasm32
* [fix warning] Exclude offscreen_canvas_setup from non-wasm32
* [fix warning] Add ImageBitmap feature as well so that all related methods can be used
* Fix cargo fmt
* Fix emscripten build
* Remove `webgl` feature from wgpu-core as webgl is the only wasm32 backend
Co-authored-by: Zicklag <zicklag@katharostech.com>
* 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)
In parking_lot 0.12 and parking_lot_core 0.9.0, those crates switched
from the winapi crate to the official Microsoft windows-sys crate.
This is fine, except that windows-sys and its dependencies are even
larger than winapi. Some users may wish to stick with winapi for the
time being; this change allows wgpu to accommodate them.