* Remove unused field `bundle::IndexState::pipeline_format`.
* Clean up render bundle index buffer tracking.
Put all state associated with an established index buffer within an
`Option`, so that the Rust types accurately represent value liveness.
Generate `MissingIndexBuffer` errors as needed for `DrawIndexed` and
indexed `MultiDrawIndirect` commands.
`wgpu_core::command::bundle::State::set_pipeline` marks a vertex
buffer slot dirty if the pipeline's stride or step mode for that
vertex buffer slot differs from what had been previously established.
The effect of marking the slot dirty is to ensure that a new
`SetVertexBuffer` command is inserted before the next draw command
that uses that vertex buffer. However, this is unnecessary:
`wgpu_hal::CommandEncoder::set_vertex_buffer` does not need to be
called simply because the stride or rate has changed.
Put some plumbing in place to accomodate the latest definition of
`GPURenderBundleEncoderDescriptor` in the WebGPU spec, which now has
separate `depthReadOnly` and `stencilReadOnly` members.
Rename `RenderPassDepthStencilAttachment::is_read_only` to
`depth_stencil_read_only`, and don't skip validation steps due to
early returns.
* 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>
* Implement submission indexes
* Write some unit tests for poll
* Update wgpu/src/lib.rs
Co-authored-by: Jim Blandy <jimb@red-bean.com>
* Unify Maintain in both wgc and wgpu
Co-authored-by: Jim Blandy <jimb@red-bean.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)
This vector's contents always ended up identical to the
`RenderBundleEncoder`'s `BasePass`'s `dynamic_offsets` vector, so
we can just take values from there instead of copying them.
The `dynamic_offsets` and `is_dirty` flags only make sense when the
slot is occupied, so they should be inside the `Option`. This makes
`State::bind` into an `ArrayVec<Option<BindState>>`, and cleans up
various other bits.
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.
It's very odd to have almost all the render pass and compute pass ffi
functions in `wgpu` except for the `set_index_buffer` functions, which
live in Firefox. I'd like to remove these from Firefox and put them
back next to their companions.
These functions were originally removed from wgpu in #1077, because
wgpu-native has its own incompatible version of IndexFormat (see that
PR for details). However, with wgpu-native#85, that code was removed,
so having these functions in `wgpu` should be no longer be a problem
for wgpu-native.
* fix: don't panic on invalid id in Storage::get
* formatting
* removed double matches
* more match removal
* fix formatting
* add fix to Storage::label_for_invalid_id
Lifetime names like `<'a, 'b>` mean that the reader must look at how
they are used to understand them. By changing them to `'tex` (lifetime
of borrows of the texture views the documentation describes) and `'desc`
(everything else), and mentioning them in the documentation, it's more
obvious which role each one plays.
For consistency, I also changed `begin_render_pass()`,
`RenderPassColorAttachment`, and `RenderPassDepthStencilAttachment` to
use matching lifetime names.
Also, this made it clear that the `Label` had the wrong lifetime --
the docs say that the texture views have a different lifetime from
“everything else”, but the `Label` in fact had the same lifetime as
the texture views, so I changed it to the `'desc` (formerly `'b`)
lifetime. (On review of change history, this mismatch was previously
introduced in commit 632f828eda9af1f6f18c74398b5f40644cf02f03.)
This change is definitely safe because I followed the data flow down
to `BasePass::new` which promptly calls `to_string()` on the label,
thus converting it to owned data.
Added:
* WebGPU specification links.
* How to create an instance, if it is not all-public-fields.
* What function or enclosing type this type is used for.
(The latter two are not present for `wgpu-types` items due to the
dependency running the wrong direction for that — I saw existing
`../wgpu/` links, but those do not work on https://docs.rs/wgpu/.)
This commit specifically does not:
* substantially revise existing language, except where necessary to fit
the new information, or when there was an obvious trivial improvement
like adding a link to support "how to use this".
* add similar information to the documentation of types not directly
corresponding to the WebGPU specification