* Fix validation error when configuring the surface on WebGL
* Remove unneeded `webgl` feature
* Fix compilation of the `noop` backend on `wasm32`
* Prevent `webgpu` examples from incorrectly falling back to WebGL
* Reduce dependency set when building wasm examples
* Fix various warnings
With the only caveat that device creation will now panic if the `wgsl` feature is not enabled, `InstanceFlags::VALIDATION_INDIRECT_CALL` is set and the device supports `DownlevelFlags::INDIRECT_EXECUTION`.
This is a useful shortcut for tests and example code, allowing it to
create a noop device without needing to deal with nonexistent
fallibility and asynchrony.
* Added “upward” links from `VertexAttribute` and `VertexBufferLayout`
to the places they are used.
* Documented the exact expected inputs of `vertex_attr_array!` and hid
the internal implementation.
* Added doc-test examples for:
* `VertexBufferLayout`, demonstrating how to construct a
`VertexBufferLayout` that corresponds to a `struct`.
* `vertex_attr_array!`, demonstrating exactly what the output of the
macro is.
This will help users determine whether the problem is:
* a backend is not statically enabled
* a backend is not dynamically enabled
* no drivers or physical adapters are present for that backend
(further distinction would be useful here)
* no adapters met the required criteria
There are deficiencies in the reporting of WebGPU vs. WebGL support.
Those would best be fixed by also fixing the mutual exclusion of those
backends.
* Add `# Performance considerations` heading, to separate the facts
about how to use the method from the advice about how best to use the
method.
Back when I was learning `wgpu`, I thought that “does *not* submit the
transfer to the GPU immediately” was a claim about *ordering* relevant
to correctness, not just performance. This reorganization and
rewording should help future readers build an accurate model quicker.
* Clarify when it is best to use `write_buffer_with()` — in particular,
if you just copy from other memory, then you aren't making any
improvement over `write_buffer()`, and the advantage comes from being
able to assemble your data in-place.
* Flesh out the first `queue.submit([])` example code block,
and trim back the second one.
* Mention what techniques you might use for writing to a texture other
other than `write_texture()`.
This allows `wgpu` to not unconditionally depend on `std::path::Path`.
It’s also, in my opinion, more user-friendly, because the feature which
most users will not use (and is not currently functional) is now a
defaultable struct field instead of a required parameter.
The disadvantage is that `wgpu-types` now has to know about tracing.
Makes the dual source implementation in wgpu WebGPU spec compliant.
Furthermore, makes the dual source blending extension available when targeting WebGPU.
* Add basic drm support to vulkan backend
* Move vulkan drm implementation to its own module
* Properly feature gate drm support and add safety docs
* Disable drm on wasm targets
* Remove old fixme comment from vulkan drm backend
* Move cfg check inside drm module
* Use expect instead of allow for create_surface_from_drm
* Document that drm is not available on apple platforms
This allows `wgpu-hal` to be used in `no_std` environments, except that
currently, only the `noop` backend supports `no_std`.
In the future, `cfg(all(gles, webgl))` should also be `no_std`, but that
requires further work.
Co-Authored_by: Kevin Reid <kpreid@switchb.org>
This allows using `StagingBelt` for copying to textures or any other
operation where copying to an existing buffer is not the desired outcome.
One unfortunate feature of the API is that `allocate()` returns the entire
buffer and an offset, so applications could accidentally touch parts of
the belt buffer outside the intended allocation. It might make more sense
to return `wgpu::BufferSlice`, but that struct cannot be used in
operations like `copy_buffer_to_texture` and does not have getters, so it
is not currently suitable for that purpose.
I also moved `Exclusive` into a module so that its unsafe-to-access field
is properly private, and made various improvements to the `StagingBelt`
documentation, such as acknowledging that `write_buffer_with()` exists.
This allows users to skip creation of `BufferSlice` if they have no use
for it, and brings `wgpu` closer to the WebGPU API without removing any
Rust convenience. New functions:
* `BufferSlice::slice()`
* `Buffer::map_async()`
* `Buffer::get_mapped_range()`
* `Buffer::get_mapped_range_mut()`
* `Buffer::get_mapped_range()`
* move tests into conditionally compiled mod and place them at the end. add some whitespace for readability
* allow creation of `Features` from `FeaturesWGPU` & `FeaturesWebGPU`