Commit Graph
8897 Commits
Author SHA1 Message Date
Jinlei Li 5e070783bc vk: fix PIPELINE_STATISTICS_QUERY feature support (#2750) 2022-06-08 01:08:16 -04:00
kwillemsenandKoen Willemsen ed9cdb7946 Fixed builtin(primitive_index) for vulkan backend (#2716)
Co-authored-by: Koen Willemsen <koen.willemsen@materialise.be>
2022-06-07 20:24:46 +00:00
Jinlei LiandConnor Fitzgerald f0c7fe3a8e Improve read-write and read-only texture storage error message (#2745)
* Improve read-write and read-only texture storage error message

* Update wgpu-core/src/binding_model.rs

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-06-07 06:21:17 +00:00
Jim Blandy 091e9b1788 Clean up render bundle index buffer tracking. (#2743)
* 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.
2022-06-07 02:17:27 -04:00
Jim Blandy d26c04c715 Don't dirty the vertex buffer for stride/rate changes on bundles. (#2744)
`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.
2022-06-07 02:10:08 -04:00
Josh Groves be625f9a01 gles: allow clearing index buffers on WebGL (#2740) 2022-06-07 02:08:51 -04:00
Jinlei Li 31c6b39c20 metal: check if in the main thread when calling create_surface (#2736) 2022-06-07 02:07:38 -04:00
Jim Blandy 5bee63e605 Track depth and stencil writability separately. (#2693)
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.
2022-06-07 02:02:23 -04:00
Harald ReingruberandZicklag 25b16d5cc8 OffscreenCanvas Support for WebGL Backend (#2603)
* 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>
2022-06-07 01:57:16 -04:00
Ashley 717bc40106 Add Features::MULTI_DRAW_INDIRECT to Metal (#2737) 2022-06-06 08:00:34 -04:00
Ashley a3b241857d [gles] Handle cubemap copies (#2725) 2022-06-05 17:23:31 -04:00
Connor FitzgeraldandJim Blandy 5bd0a6c4ac Implement submission indexes (#2700)
* 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>
2022-06-05 17:22:25 -04:00
Robert Bragg 444836f747 Acquire texture: Option<std::time::Duration> timeouts (#2724)
* 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)
2022-06-04 16:05:40 +00:00
Xiaopeng Li 46420212d7 Add raw_adapter method for dx12 hal adapter (#2714) 2022-06-04 01:20:13 -04:00
Jinlei Li 9e3cd08e59 Improve InvalidViewport error message (#2723) 2022-06-03 01:54:09 -04:00
Jinlei Li 75db572bf7 Improve InvalidScissorRect error message (#2713) 2022-06-02 07:35:13 +00:00
Jim Blandy 89bed99bcc Forbid returning pointers and atomics from functions.
Introduce a new `TypeFlags::CONSTRUCTIBLE` flag, corresponding to
WGSL's "constructible types". Set this on the appropriate types.
Check for this flag on function return types.
2022-06-01 14:20:55 -07:00
Jim Blandy 1c21fc02fe Let validation check for more unsupported builtins.
Add `valid::Capabilities` flags for the `ClipDistance` and
`CullDistance` builtins, which are not supported by all back ends.

Have the CLI perform valation with only those capabilities that the
requested back ends support.

Fixes #1961.
2022-06-01 14:20:06 -07:00
Jim Blandy 7f5ec31825 Verify in CI that benchmarks build.
Also, the documentation job probably doesn't need Clippy.
2022-06-01 10:59:18 -07:00
Jim Blandy 231341f056 Fix Criterion benchmark build.
As of #1889, the GLSL back end takes an additional argument specifying
the bounds checks policies to use.
2022-06-01 08:18:46 -07:00
Connor Fitzgerald 32af4f5607 Convert map_async from being async to being callback based (#2698) 2022-05-31 11:22:21 -04:00
João Capucho e461d30865 glsl-in: Fix matrix multiplication check
The previous check compared rows to rows and columns to columns but
multiplication of matrices only needs the columns of the left matrix to
be equal to the rows of the right matrix.
2022-05-30 22:54:14 +01:00
João Capucho cff744dc89 spv-in: Implement OpBitReverse and OpBitCount 2022-05-30 22:51:50 +01:00
Jim Blandy 6a3f526c12 [spv-in] Finish truncated comment. 2022-05-30 14:31:26 -07:00
João Capucho 9e75332283 glsl-in: Stop emitter in conditional
This wasn't being done when there were no implicit conversions, causing
the emitter to panic.
2022-05-30 13:27:06 -07:00
teoxoy 768e1fe703 [hlsl-out] avoid error X3504: array index out of bounds 2022-05-30 13:15:40 -07:00
teoxoy a8256e94c2 [hlsl-out] avoid error X3694: race condition writing to shared resource detected 2022-05-30 13:14:00 -07:00
teoxoy 91ee407c87 [hlsl-out] fix fallthrough in switch statements 2022-05-30 13:11:56 -07:00
Jinlei Li 8063edc648 Add DEPTH24UNORM_STENCIL8 feature (#2689) 2022-05-30 15:29:12 -04:00
teoxoy 7c7e96276a [hlsl-out] fix missing break statements (for FXC) 2022-05-30 12:15:16 -07:00
João Capucho 0aa7681165 glsl-out: Implement bounds checks for ImageLoad (#1889)
* glsl-out: Implement bounds checks for `ImageLoad`

* Enable image bounds check snapshot tests for GLSL.

In addition to the snapshot.rs changes, this entails adding an entry
point function to `bounds-check-image-restrict.wgsl` and
`bounds-check-image-rzsw.wgsl`, including appropriate data in the
param.ron files.

* Apply comments

Snapshot test changes:
Co-authored-by: Jim Blandy <jimb@red-bean.com>
2022-05-30 12:13:58 -07:00
Connor Fitzgerald fd954a2bd6 Stop using storage usage for sampling (#2703) 2022-05-29 19:52:41 -04:00
João Capucho c7e245c083 Update README for glsl-in (#1951) 2022-05-29 19:50:30 -04:00
Connor Fitzgerald c12ae0880f Check that all vertex outputs are consumed by the fragment shader (#2704) 2022-05-29 23:38:11 +00:00
Daisuke Kato 16c796578c Add symlink LICENSE files into crates. (#2604) 2022-05-29 03:07:42 -04:00
i509VCB 2c9c5bbbe5 expose egl display in gles (#2670) 2022-05-29 03:05:57 -04:00
João Capucho 4cd997a3eb glsl-out: Fix storage format for Rgba8Unorm 2022-05-28 14:30:12 -07:00
Jim Blandy 0c0bbdb3ad Perform "valid to use with" checks when recording render bundles. (#2690)
* Update module docs for `wgpu_core::commands::bundle`.

* Perform "valid to use with" checks when recording render bundles.
2022-05-28 04:57:06 -04:00
DHuan a2e27afd82 Add links for SpirV documents. (#2697) 2022-05-28 06:27:37 +00:00
Jim Blandy f035854dac Doc tweaks. 2022-05-25 17:17:47 -07:00
Nicolas Silva f9dfc38c40 Add a helper for getting the location of a span in some textual source. 2022-05-25 17:17:47 -07:00
Connor Fitzgerald 9114283707 Tracking Optimization and Rewrite (#2662)
* Texture state full is dead code

* temp

* temp2 - next is lifetime only

* temp3 - all trackers in place

* temp4 - continue muddling along

* temp5 - doodle doodle

* temp6 - continuous progress is continuous

* temp7 - pro-gress

* temp8 - Add refcounts to trackers

* temp9 - Soundness, generics, refcounts, and epochs

* temp10 - Compiling?!1?!1?!1

* temp11 - Add bind group state optimization

* temp12 - Safety and adding size setting

* temp13 - unsafe

* temp14 - Abstract all the state transitions

* temp15 - It verks! kinda...

* temp16 - it more verks!

* temp17 - debugging and unit tests

* temp18 - fixing unfixed things

* temp19 - hmmm

* temp20 - curious about line deltas

* temp21 - working texture trackers

* temp22 - write merge/update/barrier for buffers

* temp23 - cleanup and buffers

* temp24 - clippy cleanup

* temp25 - Add inline markers on buffer functions

* temp26 - Fix buffer trackers

* temp27 - fixed texture insert to handle both sides

* temp28 - document tracker and usages

* temp29 - document track/mod.rs

* temp30 - convert STORAGE_WRITE to STORAGE_READ_WRITE

* temp31 - Add some debug asserts to make sure we can't insert invalid states

* temp32 - clippy is opinionated sometimes

* temp33 - renaming and documentation

* temp34 - logging
2022-05-24 11:36:13 -04:00
Leo Kettmeir dd6febe309 Update deno (#2691)
* update deno crates & align to IDL

* revert GPUAutoLayoutMode

* revert GPUAutoLayoutMode
2022-05-24 00:01:19 -07:00
teoxoy 62da3bf348 add HLSL validation via FXC to CI 2022-05-22 08:53:46 -07:00
i509VCB 435188cb89 expose some underlying types in Vulkan hal 2022-05-22 08:49:04 -07:00
Ashley Ruglys 104f4dc7ec Fix a broken clippy lint 2022-05-22 08:42:20 -07:00
Ashley Ruglys 196c9981bc Run cargo fmt 2022-05-22 08:42:20 -07:00
Ashley Ruglys fea733f58e Add MultiView to SUPPORTED_CAPABILITIES 2022-05-22 08:42:20 -07:00
Jim Blandy c7872ab8b5 Eliminate wgpu_core::commands::bundle::State::raw_dynamic_offsets.
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.
2022-05-22 08:38:47 -07:00
Jim Blandy 87d75d9c7b Document command::BasePass. 2022-05-22 08:38:47 -07:00