Commit Graph

1179 Commits

Author SHA1 Message Date
Connor Fitzgerald
84633a8b12
Force binding sizes to be multiples of 16 on webgl (#2808) 2022-06-27 02:39:51 +00:00
i509VCB
f041991d0c allow creating wgpu::Instance from wgpu_core::Instance 2022-06-26 15:32:34 -07:00
Connor Fitzgerald
533fc13afe
Properly Barrier Compute Indirect Buffers (#2810) 2022-06-26 21:03:56 +00:00
Connor Fitzgerald
de5fe90f20
Restrict WriteTimestamp Inside Passes (#2802)
* Define feature flags in terms of the previous

* Add WRITE_TIMESTAMP_INSIDE_PASSES feature
2022-06-25 01:23:13 -04:00
victorvde
7375acb230
get_supported_formats: sort like the old get_preferred_format and simplify return type (#2786)
* get_supported_formats: sort srgb first like the old get_preferred_format

* get_supported_formats: simplify return type
2022-06-22 21:04:18 +00:00
Nicolas Silva
5dcd19c167
Add a vulkan workaround for large buffers. (#2796)
* Add Limit::max_buffer_size.

* Prevent very large buffer with some drivers.

Some drivers run into issues when buffer sizes and ranges are larger than what fits signed 32 bit integer. Adapt the maximum buffer size accordingly.
2022-06-22 12:31:53 -04:00
Nicolas Silva
a9f1b4f8e0
Add create_texture_error. (#2800)
Firefox needs it to implement WebGPU's error model (see create_buffer_error).
2022-06-22 12:58:37 +00:00
Kevin Reid
2881a74de9
Fix formatting of TextureDimensionError::LimitExceeded. (#2799)
in the thiserror error format string, `{0:?}` ends up referring to the
first named argument, not the first struct field or a compile error, so
the error was incorrectly
    Dimension 32768 value 32768 exceeds the limit of 16384
instead of
    Dimension X value 32768 exceeds the limit of 16384
2022-06-21 21:46:12 -04:00
Rajveer Malviya
f27a9788fd
fix BufferMapCallbackC & SubmittedWorkDoneClosureC (#2787) 2022-06-18 16:55:24 +00:00
Steven
0d4d3f4ceb
Change get_preferred_format to get_supported_formats (#2783)
* Change all the functions

* Return the set of supported TextureFormat specified by WebGPU

* Remove redundant filtering and use list directly

* Replace pops with first

* Remove now unused function

* Fix doc and clarify preffered format

* Dereference enums

* Remove unused list

* Remove fancy coode

* Update wgpu-core/src/device/mod.rs

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-06-18 00:21:02 -04:00
Jim Blandy
aba7197fe8
Update Naga to 0b60f410 (Thu 2022-6-16). (#2779) 2022-06-17 16:51:22 -04:00
Jinlei Li
f4c01052ef Rename MAX_COLOR_TARGETS to MAX_COLOR_ATTACHMENTS to match spec 2022-06-16 20:36:15 -07:00
Jinlei Li
f2c3d42818 Add InvalidGroupIndex validation at create_shader_module 2022-06-16 10:06:11 -07:00
Nicolas Silva
191537021e
Expose naga span location helpers (#2752)
* Expose the source location in CreateShaderModuleError.

* Bump naga dep to 89bed99.
2022-06-14 23:10:22 -04:00
Jim Blandy
6da57dd4e0
Add type annotation to render pass code, for rust-analyzer. (#2773)
This is a workaround for a limitation in rust-analyzer:
https://github.com/rust-lang/rust-analyzer/issues/12247
2022-06-14 23:06:22 -04:00
Jim Blandy
915be10443
wgpu_core::command::bundle: Consolidate pipeline and vertex state. (#2769)
Refactor `wgpu_core::command::bundle::State` to more closely resemble
the internal slots of a WebGPU `GPURenderBundleEncoder`, and add
validation required by the WebGPU specification.

Use `Option` to represent state that may be left unset on the encoder:
specifically, the pipeline and vertex buffers. (Previous commits have
already addressed index buffers and bind groups.) Use `.ok_or`, etc.
for unwrapping, to ensure that encoding state errors are reported.

Consolidate state derived from the pipeline in a new `PipelineState`
struct.

Remove `wgpu_core::command::bundle::PushConstantState::is_dirty`; just
represent push constant state as a vector of `PushConstantRange`
values. It's sufficient to simply zero the push constants whenever the
vector is non-empty.

Rename `bundle::State::flush_push_constants` to `zero_push_constants`a.
This is not a "flush pending state changes" function like all the
others; it just ensures that each pipeline's push constant state is
initialized.
2022-06-14 23:06:05 -04:00
Jim Blandy
b30b445423
Clarify docs for wgpu_core's Id and gfx_select!. (#2766)
Clarify that `gfx_select!` is not specific to `hub::Global`.

Clarify that the `T` in `id<T>` is not a real resource type.
2022-06-14 00:46:58 -04:00
Jim Blandy
3a193ec3d3
Introduce VertexStep: a stride and a step mode. (#2768)
This is used in various places around render pipelines, passes, and
bundles.

The public `wgpu_core::pipeline::VertexBufferLayout` could use
`VertexStep` as well, but I think it's best to let that continue to
resemble `GPUVertexBufferLayout`.
2022-06-14 00:42:03 -04:00
Jim Blandy
a4352a1dac
Improve push constant documentation, including internal docs. (#2764) 2022-06-11 15:11:06 -04:00
Nicolas Silva
629ccaf4e0
Align the validation of Device::create_texture with the WebGPU spec (#2759) 2022-06-10 16:02:49 -04:00
Jim Blandy
b2cc6ff185
Move RenderBundleEncoder::finish's pipeline layout id into the state. (#2755) 2022-06-10 15:41:32 -04:00
Jim Blandy
f94f25f355 Fix documentation links. 2022-06-09 17:42:03 -07:00
Jinlei Li
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
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 Reingruber
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
Connor Fitzgerald
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
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
Connor Fitzgerald
32af4f5607
Convert map_async from being async to being callback based (#2698) 2022-05-31 11:22:21 -04:00
Jinlei Li
8063edc648
Add DEPTH24UNORM_STENCIL8 feature (#2689) 2022-05-30 15:29:12 -04:00
Connor Fitzgerald
fd954a2bd6
Stop using storage usage for sampling (#2703) 2022-05-29 19:52:41 -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
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
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
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
Jim Blandy
afed25fa5c Clean up render bundle bind group tracking.
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.
2022-05-22 08:38:47 -07:00
Jim Blandy
d3235484f9 Document some parts of wgpu_core's render bundle code. 2022-05-22 08:38:47 -07:00
Jim Blandy
b53a8bcb17
New function: Global::create_buffer_error. (#2673) 2022-05-19 13:10:47 -04:00
Jinlei Li
8b2e6fe3a2
Roll naga to 571302e (50 revisions) (#2672) 2022-05-18 21:09:22 -07:00
i509VCB
f5c2ff11d0
Adapter and Instance as_hal functions (#2663)
These functions are added to allow lower level access to adapter and instance from backends.
2022-05-17 06:13:58 +00:00
Jinlei Li
26f96c7dfe
Add DEPTH32FLOAT_STENCIL8 featue (#2664) 2022-05-17 02:11:05 -04:00
Jim Blandy
b51fd851be Report invalid pipelines in render bundles as errors, not panics.
Fixes #2665.
2022-05-16 14:26:36 -07:00
Jim Blandy
c608ee0bbe
Accept both parking-lot 0.11 and 0.12.*, to avoid windows-rs. (#2660)
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.
2022-05-16 01:16:53 -04:00
Jim Blandy
202d81a64a
Move set_index_buffer FFI functions back into wgpu. (#2661)
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.
2022-05-15 15:18:05 -04:00
Shaye Garg
75b881e636
fix: panic in Storage::get (#2657)
* 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
2022-05-14 14:59:47 +05:30
Jim Blandy
284ed4654e Spell out the type of the result from map_pass_err.
Without these changes, rust-analyzer cannot determine the type of
`cmd_buf`.
2022-05-13 22:18:12 -07:00
Poly
bfcf5fa513 Make GLES DeviceType unknown by default 2022-05-11 20:32:43 -07:00
xiaopengli89
654a75b058 Return all_queue_empty for Instance::poll_all 2022-05-10 16:35:56 -07:00
xiaopengli89
3f3af605db Return queue_empty for Device::poll 2022-05-10 16:35:56 -07:00
Emilio Cobos Álvarez
a613a568b6
Update parking_lot. (#2639) 2022-05-03 04:28:17 +00:00
Connor Fitzgerald
e54a36ee78
Move texture-array example over to wgsl (#2618) 2022-04-25 18:32:53 +00:00
Connor Fitzgerald
bc850d2a0e
Bind group deduplication (#2623) 2022-04-25 04:19:25 +00:00
Jinlei Li
8feac35033
Update texture_create_view logic to match spec (#2621) 2022-04-21 12:08:13 -04:00
Jinlei Li
5706263917 Rename dispatch -> dispatch_workgroups 2022-04-20 23:24:21 -07:00
Jim Blandy
6d7c092dad Update Naga to 85056524 (2022-4-18). 2022-04-18 20:27:42 -07:00
Jim Blandy
06ee8a6862 Permit non-struct, non-array types as buffers.
Fixes #2583.
2022-04-18 09:50:51 -07:00
Jim Blandy
3d10678a91 Update to Naga 0e2bb019. 2022-04-18 09:09:47 -07:00
Kevin Reid
cb7ad30d58 Prefix every wgpu-generated label with (wgpu internal).
This is intended to help developers new to wgpu or to graphics debugging
quickly recognize in a debugging tool which items are wgpu-generated, as
opposed to either part of their program or part of the platform graphics
system.

I also removed existing marker-like text such as leading underscores and
angle brackets.
2022-04-15 22:39:08 -07:00
Igor Shaposhnik
eff50436f5 Update to Naga rev 1720725 2022-04-15 22:22:48 +03:00
Jim Blandy
a47b5c554f Update to Naga rev 7aaac25f. 2022-04-13 14:41:26 -07:00
Jim Blandy
84fadca870 wgpu-core: Register new pipelines with device's tracker.
Without this change, `LifetimeTracker::triage_suspected` never notices
that compute or render pipelines are free, and they stick around until
the hub is destroyed.

Fixes #2564.
2022-03-31 22:59:11 -07:00
Jim Blandy
85e5c36b68 Tell cargo test to ignore pseudocode in gfx_select macro docs. 2022-03-31 22:59:11 -07:00
Jim Blandy
44dafd3b4d Documentation for various things. 2022-03-31 22:57:38 -07:00
Jim Blandy
3bdef1cbe3 Free the raw device when wgpu::Device is dropped.
Go ahead and call `global.device_drop` from `direct::Context::device_drop`.

Let `Global::device_drop` simply drop the life guard's `RefCount`, and
put off everything else entailed in freeing a device until
`Device::maintain` says its queue is empty and there are no more
references to it. (The user can reach that function, even after
dropping their `Device`, by calling `wgpu::Instance::poll_all`.)

Fixes #2563.
2022-03-31 22:54:20 -07:00
Jim Blandy
b58b512afb Add logging to Global::X_drop methods.
This adds `log::debug` lines reporting calls to the `wgpu-core` entry
points for dropping resources.
2022-03-31 22:51:49 -07:00
Jim Blandy
d6f3472467 Add logging to LifetimeTracker::triage_suspected.
This adds `log::debug` lines reporting the decision to actually free
something, for all resource types.
2022-03-31 22:51:49 -07:00
Jim Blandy
1e42208657
Provide a proper new method for RefCount. (#2570) 2022-03-31 22:50:48 -07:00
Alphyr
58f318550d
Fix clippy lints (#2560) 2022-03-28 09:00:09 -04:00
Jim Blandy
0d39818b91 Document some aspects of resource tracking. 2022-03-27 07:41:31 -07:00
Jim Blandy
1be43d8073
Document the gfx_select! macro. (#2555) 2022-03-23 19:35:42 -04:00
Jim Blandy
e821e185a1
Simplify implementation of RefCount and MultiRefCount. (#2548)
`RefCount::rich_drop_inner` is no longer used by anything other than `RefCount::drop`. It's simpler to just handle it directly in `drop`.

`MultiRefCount` has no need to heap-allocate the count, since it's
never cloned.
2022-03-21 16:40:11 -07:00
Igor Shaposhnik
c5d5dbc7eb [naga] Update naga with new struct members separator 2022-03-16 20:42:21 -07:00
Connor Fitzgerald
73f42352f3
Dx11 Backend (#2443) 2022-03-12 17:14:18 +00:00
Connor Fitzgerald
129c32ffc3 Prevent 3D compressed textures 2022-02-28 21:38:52 -08:00
Connor Fitzgerald
b61939650c Add DownlevelFlag to prevent copies between Depth32 Textures 2022-02-28 21:38:52 -08:00
Connor Fitzgerald
df50028e49 Fix up some downlevel capabilities 2022-02-24 23:52:41 -05:00
Connor Fitzgerald
80da80b497 Move limit comparison logic into wgpu-types for easy reuse 2022-02-24 23:52:41 -05:00
Connor Fitzgerald
b87e50feae Rename get_downlevel_properties to get_downlevel_capabilities 2022-02-24 23:52:41 -05:00
Connor Fitzgerald
1e403e12a3 Always check texture features if we're running on a downlevel platform 2022-02-24 23:52:41 -05:00
Jinlei Li
1bd85a835a Roll naga from 8e2e39e to a45b9a6 (27 revisions) 2022-02-22 15:45:05 -05:00
Jinlei Li
7f3c6f7019 vulkan: correctly set INDEPENDENT_BLEND,make runable on Android 8.x 2022-02-22 15:45:05 -05:00
Jinlei Li
01628a1fad vulkan: HDR ASTC formats support 2022-02-20 00:00:06 -05:00
Jinlei Li
fa35c0a0f4 Re-allow vk backend on Apple platforms via vulkan-portability feature 2022-02-18 20:26:53 -05:00
Dzmitry Malyshau
0545e36aa8 Validated render usages for 3D textures 2022-02-15 18:49:04 -05:00
Nicolas Silva
210014ed89 Fix mistake in Access doc comment. 2022-02-15 09:59:42 -05:00
Jinlei Li
1c17d15507
Metal backend ASTC HDR formats support (#2477) 2022-02-15 09:43:16 -05:00
Alexander Guryanov
d586d6dce9 added id32 feature 2022-02-14 14:42:23 -05:00
Dzmitry Malyshau
6931e57180
Don't recycle indices that reach EOL (#2462) 2022-02-07 19:23:40 -05:00
Xiaopeng Li
8c351970ce
Support to create surface from visual on Windows (#2434)
* Support to create surface from visual on Windows, add mpo(Multiple Plane Overlay) feature to AdapterInfo

* Expose create_surface_from_visual method

* Fix code style

* Make code more concise

* Revert mpo from AdapterInfo
2022-02-07 14:57:57 -05:00
Dzmitry Malyshau
6b4f1b843f
msl: support unsized array not in structures (#2459) 2022-02-06 05:33:20 +00:00
Samuel Hurel
3e0305d27d
Allow non struct buffers in wgsl (#2451)
* Bump naga

* Update examples
2022-02-05 09:53:04 -05:00
Connor Fitzgerald
63dfd98d68
Improve some error messages (#2446)
* Fix render target mismatch error message

* Reword bind group layout mismatch error
2022-02-01 18:51:48 -05:00
Jim Blandy
36ce638381 IdentityManager: from_index method is unneeded.
The `min_index` parameter has no useful effect. Because the range 0..n is pushed
on the free list, index values less than `min_index` do get allocated.

Document `IdentityManager` and `TypedId`.
2022-01-28 01:03:15 -05:00
Alexander Guryanov
b19000367c feature: emscripten 2022-01-27 14:14:29 -05:00
João Capucho
dcd07f0391 Update to upstream naga 2022-01-22 18:36:26 -05:00
Dzmitry Malyshau
f3891fed33
hal/dx12: improve RowPitch computation (#2409) 2022-01-20 19:59:25 -05:00
Aaron O'Mullan
cdd480a89c
lint: deno_webgpu & wgpu-core (#2403) 2022-01-18 09:34:10 -05:00
Aaron O'Mullan
5877117529
chore: bump naga to a1840be (#2401)
* chore: bump naga to a1840be

So tip no longer indirectly pins indexmap, etc...

* feedback

* TODO push_constant_binding
2022-01-17 19:17:31 -05:00
Ibiyemi Abiodun
0183e7d1e8
add AddressMode::ClampToZero (#2364)
* add AddressMode::ClampToZero

* add feature checks

* oops

* rustfmt

* fix dx12

* change to use SamplerBorderColor

* fix metal

* update to use new config

* update dx12 + docs

* address nits

* cargo fmt

* fix dx12
2022-01-15 05:16:35 +00:00
Dzmitry Malyshau
16edd91976 Support writeTexture for surface textures 2022-01-12 13:31:03 -05:00
Dzmitry Malyshau
1bab287eae Update naga to c0b7ac7 2022-01-11 11:45:33 -05:00
Dzmitry Malyshau
dbec075cdc Texture format MSAA capabilities 2022-01-11 09:32:25 -05:00
Dzmitry Malyshau
01f62baad2 Limits 1D texture mips to 1 2022-01-10 12:22:49 -05:00
Dzmitry Malyshau
eda3d4fa34 Update naga to 09d35f3 2022-01-05 23:33:43 -05:00
Alex S
43f09fdb21 Don't create array layer trackers for 3D textures. 2022-01-03 14:09:20 -05:00
Dzmitry Malyshau
55cbbdea62 metal: fix surface texture clear view 2021-12-31 11:41:00 -05:00
Dzmitry Malyshau
a1251dc36a Improve detection and validation of cubemap views 2021-12-30 11:34:40 -05:00
Connor Fitzgerald
276de0e2d6 Fix trac(y/ing) compile issue 2021-12-30 10:46:07 -05:00
Wumpf
2fa75aaf05
Do texture init via clear passes when possible (#2307)
* CLEAR_COMMANDS extension is now more of a window into wgpu zero-init
this has mostly implications on the constraints, but also allows a more leaky documentation which makes sense for this non-standard function as there is no other place to look it up

* clear_texture via renderpasses wip

* 3D depth textures are no longer allowed, volumes are always cleared via CPY_DST

* cleanup texture's clear_views

* rename CLEAR_COMMANDS to CLEAR_TEXTURE

* separate clear_texture into reusable & more descriptive parts

* texture clear views are now created ahead of time

* discarded surface fixup goes through new clear_texture method now

* onq ueue texture initialization now goes threw clear_texture
pending inits need to store Stored textures now though, causing more ref count bumping

* texture init on queue_write_texture now also goes through new clear_texture

* transfer functions on commandbuffer use now new texture init route

* merge collect_zero_buffer_copies_for_clear_texture into clear_texture_via_buffer_copies

* clear functions now take TextureInitRange

* Fix clippy lints

* command_encoder_clear_texture no longer takes write lock on texture

* TextureClearMode encodes now is_color

* code cleanup, mostly about `use`

* Handle volume textures in clear_texture_via_render_passes properly

* texture clear no longer requires id::Stored

* init tracking fixes for volumes and init on partial subresource writes

* texture creation enforces COPY_DST only if absolutely necessary

* unrolled functional chain, reduce unsafe scope size

* fix clippy lints

* clear_texture test no longer creates 1D textures

see #2323

* 3D textures are no longer cleared as render target since this isn't supported on Metal

* fix deno building issue, fix formatting

* TextureInner::Surface can now be zero initialized
2021-12-28 17:05:53 -05:00
Dzmitry Malyshau
39b7a8a202 Update naga to 8df5421 2021-12-25 00:03:15 -05:00
Dzmitry Malyshau
c00e471274 Release 0.12 2021-12-18 12:36:41 -05:00
Dzmitry Malyshau
1e593a6bd3
Trace push/pop debug group on command encoder (#2294) 2021-12-15 17:48:48 +00:00
Dzmitry Malyshau
3960658529
Remove block decorations (#2292) 2021-12-15 12:29:37 -05:00
Dzmitry Malyshau
0e5892fa04
Update naga with Metal bounds checks (#2276) 2021-12-15 04:59:06 +00:00
aloucks
70f7c375e0
Add feature gated 16-bit normalized texture support (#2282)
* Add feature gated 16-bit normalized texture support

Fixes #1934

* Query format properties only once

* Prevent supports_format from erroneously reporting false if the format wasn't queried

* Assert that 16bit norm formats also support  on vulkan

* Add storage to TextureFormatInfo for 16-bit norm formats now that we check for support
2021-12-13 12:31:16 -05:00
Dzmitry Malyshau
a8caa367ee Add limits for compute storage and max invocations 2021-12-08 21:43:41 -05:00
Dzmitry Malyshau
c1c855bb98 Allow strip index format None if no indexed drawing is done 2021-12-07 18:58:06 -05:00
Dzmitry Malyshau
e867a7434c Let GLES/Angle path compile on macOS 2021-12-05 17:09:36 -05:00
Dzmitry Malyshau
ab28009d80 Angle support on Windows
Also remove the macros module in favor of generic functions.
2021-12-05 17:09:36 -05:00
Dzmitry Malyshau
9bbea3d348 Update naga to c69f676 2021-12-04 12:46:49 -05:00
Dzmitry Malyshau
cdf948b920 Fix and re-enable player tests 2021-12-03 17:11:26 -05:00
UpsettingBoy
d8c3b9489f Added command_encoder_copy_texture_to_texture texture format validation
+ Corrected small typo
2021-12-03 12:49:17 -05:00
Dzmitry Malyshau
ed020ceb78 Fix order of late bindings in BG creation 2021-12-02 12:43:44 -05:00
Dzmitry Malyshau
6372aad845 Rename fill_buffer back to clear_buffer 2021-12-02 12:33:59 -05:00
Dzmitry Malyshau
ef08738330 Insert texture barrier after initializing a texture 2021-12-02 12:33:26 -05:00
Igor Shaposhnik
c6d1491bb1 Update raw-window-handle to 0.4 2021-12-01 15:59:05 -05:00
Samuel Hurel
f622c83a19 Allows for depth texture copies 2021-11-29 12:56:07 -05:00
Leo Kettmeir
cda893fe73
feat(deno_webgpu): fill buffer (#2221)
* fill buffer

* fix

* fmt
2021-11-28 21:22:15 -05:00
Dzmitry Malyshau
5864b776a4
Refactor command buffer states to ensure proper cleanup on errors (#2208) 2021-11-23 15:57:13 -05:00
James Beilby
ed7f8a84a3
Remove very slow debug assertion in hubs (#2193) (#2203) 2021-11-22 13:58:53 +00:00
dan
cd59c76e3a
Add new BindingResource type SamplerArray (#2113)
* implemented SamplerArray

* modified shaders

* fixed doc

* fixed code format
2021-11-22 12:19:46 +00:00
Dzmitry Malyshau
ddac6a369b
Validate min_binding_size at draw time (#2195) 2021-11-20 16:15:54 -05:00
Layl
2ef72b9313
Add multiview support (#2187)
Co-authored-by: Layl Bongers <2385329-layl@users.noreply.gitlab.com>
2021-11-19 10:56:48 -05:00
Dzmitry Malyshau
fca82ddd7e
Populate sampling pairs for validation (#2188) 2021-11-18 19:06:24 -05:00
Xiaopeng Li
39f3f08b55
Add Device::as_hal and always assume texture from hal is initialized (#2180)
* Add Device::as_hal, create_texture_from_hal_initialized

* Add Safety doc

* Always assume that the texture from hal is initialized
2021-11-18 17:34:01 -05:00
Boris-Chengbiao Zhou
3545a4fdd5
Introduce SamplerBindingType enum and fix bug in validation (#2181)
* 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
2021-11-16 23:08:03 -05:00
Dzmitry Malyshau
1ff70329f1
Refactor texture view non-referenced resources (#2184) 2021-11-15 15:58:47 -05:00
Jerónimo Sánchez
052cb3da39
Renaming CommandEncoder::clearBuffer to CommandEncoder::fillBuffer (#2174)
* Renamed clear_buffer to fill_buffer (keeping up with spec)
* fill_buffer does not require CLEAR_BUFFER feature

* Changed ClearBuffer to FillBuffer for `trace` feature

* Renamed clearBuffer for web backend
2021-11-14 19:16:10 -05:00
Boris-Chengbiao Zhou
08b9c46ec4
Validate strip_index_format (#2177)
The spec mandates that stripIndexFormat is set even when drawIndexed is
not used. (https://www.w3.org/TR/webgpu/#primitive-state)
There is some recent discussion about this though:
https://github.com/gpuweb/gpuweb/issues/2199
2021-11-14 19:03:33 -05:00
Dzmitry Malyshau
f25a45f4e2
Evolve depth clamping into clip control (#2171) 2021-11-10 16:55:27 -05:00
Dzmitry Malyshau
27aae2a2a2
Update naga to eda078d (#2172) 2021-11-10 16:06:32 -05:00
Dzmitry Malyshau
7e00abf651
Manually implement Error for ShaderError (#2160) 2021-11-06 17:17:08 -04:00
Dzmitry Malyshau
693bc58bdd
Validate device descriptor before opening (#2159) 2021-11-06 17:09:52 -04:00
Timo Kösters
dbf65234a3
fix typo (#2153) 2021-11-05 02:47:16 +00:00
Alphyr
99830957e8
Update ron (#2154) 2021-11-04 22:41:21 -04:00