Commit Graph

701 Commits

Author SHA1 Message Date
Jim Blandy
6440af03a6
Join threads in MULTITHREADED_COMPUTE example. (#5129)
Join all threads before returning from the test case, to ensure that
we don't return from `main` until all open `Device`s have been
dropped.

This avoids a race condition in glibc in which a thread calling
`dlclose` can unmap a shared library's code even while the main thread
is still running its finalization functions. (See #5084 for details.)
Joining all threads before returning from the test ensures that the
Vulkan loader has finished `dlclose`-ing the Vulkan validation layer
shared library before `main` returns.

Remove `skip` for this test on GL/llvmpipe. With this change, that has
not been observed to crash. Without it, the test crashes within ten
runs or so.

Fixes #5084.
Fixed #4285.
2024-01-23 22:18:21 -05:00
Brad Werth
ac8756c2d3
Release GPU resources from device.trackers, not from lifetime_tracker. (#5075) 2024-01-22 17:55:42 +01:00
i509VCB
886dc94f57
Document Wayland specifics related to SurfaceTexture::present (#5093)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-01-21 18:10:56 -05:00
Imbris
6c7c6fb999
Make sure to unset current context in wgl Surface::configure/present (#5087) 2024-01-20 22:26:54 -05:00
Erich Gubler
c2f110ed0c feat(const_eval): impl. atanh 2024-01-18 16:57:46 -05:00
Erich Gubler
262c07f40c feat(const_eval): impl. atan 2024-01-18 16:57:46 -05:00
Erich Gubler
f8113c55b7 feat(const_eval): impl. asinh 2024-01-18 16:57:46 -05:00
Erich Gubler
e2783c7d45 feat(const_eval): impl. asin 2024-01-18 16:57:46 -05:00
Erich Gubler
afb54d58ba feat(const_eval): impl. acosh 2024-01-18 16:57:46 -05:00
Erich Gubler
6654c68950 feat(const_eval): impl. acos 2024-01-18 16:57:46 -05:00
Erich Gubler
12b11f870b feat(const_eval): impl. cosh 2024-01-18 16:57:46 -05:00
Erich Gubler
7528b22e57 feat(const_eval): impl. cos 2024-01-18 16:57:46 -05:00
Erich Gubler
3ab9a80815 feat(const_eval): impl. tanh 2024-01-18 16:57:46 -05:00
Erich Gubler
bdf1cb4ec3 feat(const_eval): impl. tan 2024-01-18 16:57:46 -05:00
Erich Gubler
6f5b2a64e2 feat(const_eval): impl. step 2024-01-18 16:57:46 -05:00
Erich Gubler
f2dbdfcdc6 feat(const_eval): impl. sqrt 2024-01-18 16:57:46 -05:00
Erich Gubler
133b573133 feat(const_eval): impl. sinh 2024-01-18 16:57:46 -05:00
Erich Gubler
99a38c7b7c feat(const_eval): impl. sin 2024-01-18 16:57:46 -05:00
Erich Gubler
5dc1038124 feat(const_eval): impl. saturate 2024-01-18 16:57:46 -05:00
Erich Gubler
87dafb645a feat(const_eval): impl. round 2024-01-18 16:57:46 -05:00
Erich Gubler
fc27b08dca feat(const_eval): impl. abs with new component_wise_scalar 2024-01-18 16:57:46 -05:00
Connor Fitzgerald
8b2098bd4e
Release 0.19 (#5082) 2024-01-17 14:42:11 -05:00
Andreas Reich
4c18e283d1
polish changelog for upcoming release (#5078)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-01-17 18:24:43 +00:00
Andreas Reich
b8f27c7284
Expose maximum_frame_latency (#4899)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-01-17 12:46:34 -05:00
Connor Fitzgerald
2e38187954
Re-export public dependencies (#5063) 2024-01-16 19:21:51 +00:00
Andreas Reich
7774f31021
Allow WebGPU & WebGL in same wasm and detect WebGPU availability (#5044)
* Rename backends: web -> webgpu, direct -> wgpu_core

* rename context objects for web & core

* allow webgpu & webgl features side-by-side

* make sure webgl ci doesn't use webgpu

* update any_backend_feature_enabled

* add panicing generate_report method for compatibility

* RequestDeviceErrorKind::Web rename, fixup various cfg attributes

* automatic webgpu support detection

* changelog entry

* fix emscripten

* fix weird cfg, fix comment typo

* remove try_generate_report again

* Make get_mapped_range_as_array_buffer WebGPU only again
2024-01-14 09:45:52 +00:00
Brad Werth
f89bd3b978
Make DeviceLostClosure.from_c consume the closure before dropping it. (#5032)
This clarifies that the Rust and C-style callbacks/closures need to be
consumed (not called) before they are dropped. It also makes the from_c
function consume the param closure so that it can be dropped without
panicking.

It also relaxes the restriction that the callback/closure can only be
called once.
2024-01-14 02:53:40 -05:00
Nicolas Silva
11c29c825f
Prevent a few integer overflows (#5042)
* Prevent a few integer overflows

* Add a changelog entry

* use u64
2024-01-12 16:23:23 +01:00
Andreas Reich
4fd4a7142e
Unify surface creation by introducing new SurfaceTarget enum (#4984) 2024-01-11 22:24:01 -05:00
Nick
00cf05c1d0
Fix Queue::write_texture, Fix DX12 write_texture_subset_2d and re-enable the test. (#4990) 2024-01-04 19:50:41 -05:00
Martin Vilcans
8e0b715954
hello_compute: check for missing command-line args (#4939)
* hello_compute: check for missing command-line args

Fixes off-by-one error when checking for missing arguments.
Before this, running the example gave this scary looking error message:

```
$ cargo run --bin wgpu-examples hello_compute
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s
     Running `target/debug/wgpu-examples hello_compute`
[2023-12-27T22:14:26Z ERROR wgpu::backend::direct] Handling wgpu errors as fatal by default
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_bind_group
    Buffer binding size 0 is less than minimum 4
      note: buffer = `Storage Buffer`

', wgpu/src/backend/direct.rs:3139:5
```

As this was the first example I tried to run, it almost scared me
away, thinking it was a driver issue.

Instead, without arguments the example should use defaults.

* Add PR #4939 to changelog as instructed
2024-01-02 21:08:41 +00:00
Nathan Adams
ec920e85d1
Fix incorrect ConfigureSurfaceError::TooLarge message (#4960)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-01-02 15:32:51 -05:00
Nathan Adams
aa48558e3f
Change examples page menu on smaller screens (#4958) 2024-01-02 13:27:39 -05:00
Divy Srivastava
92d494e4b1
Align wgpu_types::CompositeAlphaMode serde serializations to spec (#4940)
* Align wgpu_types::CompositeAlphaMode serde serializations to spec

* add changelog
2023-12-28 05:10:16 -05:00
Jim Blandy
de3df51807 [naga xtask] Add validate all subcommand. 2023-12-27 13:07:09 -08:00
Jim Blandy
9afd54ea24 [naga xtask] Use naga-cli's --bulk-validate option.
Use `naga --bulk-validate` for `cargo xtask validate wgsl`, reducing
runtime from 12s to 0.8s.
2023-12-24 12:03:28 -08:00
Brad Werth
9eea31a4ae
Eagerly release GPU resources when we lose the device. (#4851)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-20 22:43:43 +00:00
Brad Werth
56d9d32a07
[wgpu-core] Ensure that DeviceLostCallback is always called exactly once
* Ensure device lost closure is called exactly once before being dropped.

This requires a change to the Rust callback signature, which is now Fn
instead of FnOnce. When the Rust callback or the C closure are dropped,
they will panic if they haven't been called. `device_drop` is changed
to call the closure with a message of "Device dropped." A test is added.
2023-12-19 23:16:10 +00:00
Andreas Reich
ba56dd2901
Document wgpu & wgpu-core features (#4886) 2023-12-17 22:10:38 +00:00
daxpedda
2053358d89
Add wgpu crate features for backends (#4815)
* Introduce `dx12` and `metal` crate features to `wgpu`

* Implement dummy `Context` to allow compilation with `--no-default-features`

* Address review

* Remove `dummy::Context` in favor of `hal::api::Empty`

* Add changelog entry

* Panic early in `Instance::new()` if no backend is enabled

Co-Authored-By: Andreas Reich <1220815+Wumpf@users.noreply.github.com>

---------

Co-authored-by: Andreas Reich <1220815+Wumpf@users.noreply.github.com>
2023-12-16 10:39:53 +01:00
Jim Blandy
d9d051b7a5 [naga wgsl] Let unary operators accept and produce abstract types.
Fixes #4445.
Fixes #4492.
Fixes #4435.
2023-12-14 10:54:46 +01:00
Jim Blandy
c4b43875e5 [naga wgsl-in] Support abstract operands to binary operators. 2023-12-13 08:42:26 -08:00
Jim Blandy
3ffd5a1e56 [naga wgsl-out] Include the f suffix on f32 literals.
Without the suffix, `Expression::Literal(Literal::F32)` expressions
get written without any suffix on the number, meaning that they get
re-parsed as `AbstractFloat` values. In theory, this should always be
fine, but since we don't actually support abstract types yet in all
the places we should, having them appear in the output causes
validation problems.

See also: #4863, which did the same for `i32` literals.
2023-12-13 13:42:05 +01:00
Jim Blandy
6dc9ccab85
[naga wgsl-out] Include the i suffix on i32 literals. (#4863)
Without the suffix, `Expression::Literal(Literal::I32)` expressions
get written without any suffix on the decimal number, meaning that
they get re-parsed as AbstractInt values. In theory, this should
always be fine, but since we don't actually support abstract types yet
in all the places we should, having them appear in the output causes
validation problems.
2023-12-12 12:07:10 +00:00
Jim Blandy
4b6a2d1dfa [naga] Teach the constant evaluator vector/vector operators.
Allow constant evaluation of binary operators whose left and right
operands are both vectors.
2023-12-12 12:48:10 +01:00
Michael Palmos
eff9a362be
Add COPY_SRC to Metal's surface usage bits. (#4852) 2023-12-10 08:32:36 +00:00
Andreas Reich
d801c6111d
Fix BufferMapRange not being Send/Sync (on native) (#4818)
* Make `BufferMappedRange` trait WasmNotSendSync

* make QueueWriteBuffer trait Debug

* add changelog

* fix pr numbers in changelog

* missing send/sync on web.rs on BufferMappedRange for fragile-send-sync-non-atomic-wasm + !atomics
2023-12-09 11:25:27 +00:00
Theo Dulka
cf8e11efc3
Use VK_EXT_robustness2 only when not using an outdated intel iGPU driver (#4602) 2023-12-07 14:08:21 -05:00
Connor Fitzgerald
2c2145c3a6
Remove expose-ids Feature (#4841)
* Remove expose-ids feature

* Changelog
2023-12-06 17:09:10 -05:00
Douglas Dwyer
10253db555
Fix Javascript exception on repeated BufferSlice::get_mapped_range calls (#4726)
* Add reusable buffer mappings for WASM

* Run cargo fmt

* Update CHANGELOG.md

* Update web.rs

* Add documentation for WebBuffer struct
2023-12-06 21:24:09 +00:00
Daniel Keitel
0f4df52b5a
[wgpu-hal] Inline RayQuery Support (#3507)
Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
Co-authored-by: Ashley Ruglys <ashley.ruglys@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-12-06 21:12:41 +00:00
Valaphee The Meerkat
5022a6244b
[gl] add support for line and point polygon modes (#4836)
Co-authored-by: Nicolas Silva <nical@fastmail.com>
2023-12-06 15:51:27 -05:00
Valaphee The Meerkat
a1fafe394f
Remove DX11 backend (#4828) 2023-12-06 15:12:46 -05:00
Jim Blandy
f470103874 [naga wgsl-in] Automatic conversions for local var initializers. 2023-12-06 10:35:21 +01:00
Almar Klein
32c5a22293
Add feature float32-filterable (#4759) 2023-12-04 14:23:13 +01:00
teoxoy
08506fe1b7 add changelog entry 2023-11-29 19:55:18 +01:00
Andreas Reich
8da4925948
Remove surface extent validation (and thus fix the annoying Requested size ... is outside of the supported range warning) (#4796)
* Remove surface extent validation

* silence pnext vulkan validation warning which can happen on surface resize

* remove old VUID-VkSwapchainCreateInfoKHR-imageExtent-01689 validation warning ignore

* Validate surface against max texture size
2023-11-29 18:21:26 +01:00
Jim Blandy
601f235b34 [naga wgsl-in] Implement abstract types for consts, constructors. 2023-11-29 08:58:47 +01:00
Alphyr
fbbb7a0516
Fix Arcanization changelog (#4795) 2023-11-28 10:43:41 -05:00
Connor Fitzgerald
4f24c31765
Fixes for Skybox and All Examples (#4780) 2023-11-27 11:40:37 +01:00
Nicolas Silva
ebcfd25b58
Downgrade resource lifetime management log level to trace. (#4772)
* Downgrade resource lifetime management log level to trace.

Allow promoting it back to info via an feature flag.

* Don't filter out info and warning log in the examples.

* Changelog entry.
2023-11-25 17:33:02 +01:00
Teodor Tanasoaia
f4c6faf773
Rename ALLOW_NONCOMPLIANT_ADAPTER to ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER (#4760)
* rename `ALLOW_NONCOMPLIANT_ADAPTER` to `ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER`

* clarify comment
2023-11-24 14:29:54 -05:00
Jim Blandy
eb92ab2878 [naga wgsl] Experimental 64-bit floating-point literals.
In the WGSL front and back ends, support an `lf` suffix on
floating-point literals to yield 64-bit integer literals.
2023-11-23 12:17:21 +01:00
i509VCB
1a7db86917
wgpu-hal(vk): Add WGPU_ALLOW_NONCOMPLIANT_ADAPTER (#4754) 2023-11-22 23:13:29 -05:00
Jim Blandy
4f9cc288e3 [naga] Make compaction preserve named types, even if unused.
Have `compact::compact` preserve entries in the `Module::types` arena
if they have names.

Future abstract type support will require the WGSL front end to
compact the module before validation. Without this change, that will
drop `alias` declarations, making it harder to test type validation.
2023-11-22 18:33:59 +01:00
Jim Blandy
3f0465be59 [naga wgsl-in] Preserve type names in alias declarations.
Given a WGSL `alias` declaration, create a Naga `Type` with the
alias's name, rather than dropping the type name on the floor.
2023-11-22 18:17:02 +01:00
Erich Gubler
611da6da2d fix(msl-out): emit and init struct member padding always
Previously, implicit padding members of `struct`s were suppressed from
structure definitions in Metal output if they had a binding specified
for them (i.e., `@location(0)`). This padding is, however, is necessary
for correct access of member fields passed into shaders by uniform and
storage buffers. Unconditionally emit padding members for `struct`s.

Resolves
[`gfx-rs/wgpu`#4701](https://github.com/gfx-rs/wgpu/pull/4701).
2023-11-22 03:54:16 -07:00
Nicolas Silva
7dad106039
Make the command_encoder_clear_buffer's size an Option<BufferAddress> (#4737)
* Make the size parameter of command_encoder_clear_buffer an Option<BufferAddress>

* Add a changelog entry
2023-11-22 11:42:34 +01:00
Connor Fitzgerald
1df98d9888
Test And Normalize Vertex Behavior on All Backends (#4723)
Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-11-21 22:11:24 +00:00
Jim Blandy
72462267e8 [naga]: Let TypeInner::Matrix hold a Scalar, not just a width.
Let `naga::TypeInner::Matrix` hold a full `Scalar`, with a kind and
byte width, not merely a byte width, to make it possible to represent
matrices of AbstractFloats for WGSL.
2023-11-21 12:02:50 +01:00
Jim Blandy
42058cf24f [naga] Add Literal::I64, for signed 64-bit integer literals.
Add an `I64` variant to `crate::Literal`, making `crate::Expression`
suitable for representing `AbstractFloat` and `AbstractInt` values in
the WGSL front end.

Make validation reject uses of `Literal::I64` in constant and function
expression arenas unconditionally. Add tests for this.

Let the frontends and backends for languages that have 64-bit integers
read/write them.
2023-11-20 16:11:30 -08:00
Mauro Gentile
6e21f7a929
Arcanization of wgpu core resources (#3626)
Arcanization of wgpu_core resources

---------

Co-authored-by: Elabajaba <Elabajaba@users.noreply.github.com>
Co-authored-by: Niklas Korz <niklas@niklaskorz.de>
Co-authored-by: grovesNL <josh@joshgroves.com>
Co-authored-by: Jim Blandy <jimb@red-bean.com>
Co-authored-by: Mauro Gentile <Mauro.Gentile@ubisoft.com>
Co-authored-by: Sludge <96552222+SludgePhD@users.noreply.github.com>
2023-11-20 08:41:52 +01:00
Teodor Tanasoaia
a26e4a009a
[naga] remove span and validate features (#4706) 2023-11-17 13:37:25 -05:00
Fredrik Fornwall
a5c93caa56
Add more metal keywords (#4707) 2023-11-17 17:02:36 +01:00
Jim Blandy
3ec547cdca [naga] Preserve spans when compacting Arenas.
When compacting a module, properly adjust spans along with `Arena`
contents.
2023-11-16 22:50:54 +01:00
daxpedda
addb1e081f
Safe surface creation (#4597) 2023-11-16 16:40:14 -05:00
Vrishabh
c12c377f09
remove winit from hello-compute example (#4699) 2023-11-16 13:08:57 +00:00
Jim Blandy
b7dd59e1dc [naga] Let constant evaluation handle Compose of Splat.
When consuming a `Compose` expression that constructs a vector,
flatten `Splat` subexpressions out into their components.

Fixes #4581.
2023-11-16 13:34:27 +01:00
Connor Fitzgerald
acaeb8d9b1
Backport 0.18.1 changelog (#4694) 2023-11-15 21:40:12 +00:00
Jim Blandy
611471c4bc Update CHANGELOG.md. 2023-11-14 20:12:31 -08:00
Jim Blandy
734e246e87 [naga] Improve algorithm for Module compaction.
Identify reachable function expressions, constant expressions, and
types using a single pass over each arena, taking advantage of the
fact that expressions and types may only refer to other entries that
precede them within their arena. Only walking the statement tree still
requires a worklist/recursion.

In addition to presumably being faster, this change slightly reduces
the number of non-comment lines of code in `src/compact`.
2023-11-14 11:18:43 -08:00
Jim Blandy
9f91c95c24 [naga] Introduce Scalar type to IR.
Introduce a new struct type, `Scalar`, combining a `ScalarKind` and a
`Bytes` width, and use this whenever such pairs of values are passed
around.

In particular, use `Scalar` in `TypeInner` variants `Scalar`, `Vector`,
`Atomic`, and `ValuePointer`.

Introduce associated `Scalar` constants `I32`, `U32`, `F32`, `BOOL`
and `F64`, for common cases.

Introduce a helper function `Scalar::float` for constructing `Float`
scalars of a given width, for dealing with `TypeInner::Matrix`, which
only supplies the scalar width of its elements, not a kind.

Introduce helper functions on `Literal` and `TypeInner`, to produce
the `Scalar` describing elements' values.

Use `Scalar` in `wgpu_core::validation::NumericType` as well.
2023-11-14 14:21:27 +01:00
Andreas Reich
f7420511d0
rename/deprecate block_size -> block_copy_size, improve docs (#4647)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-11-13 19:04:35 +00:00
Nicolas Silva
1dc5347b14
Better handle destroying textures and buffers (#4657)
* Better handle destroying textures and buffers

Before this commit, explicitly destroying a texture or a buffer (without dropping it)
schedules the asynchronous destruction of its raw resources but does not actually mark
it as destroyed. This can cause some incorrect behavior, for example mapping a buffer
after destroying it does not cause a validation error (and later panics due to the
map callback being dropped without being called).

This Commit adds `Storage::take_and_mark_destroyed` for use in `destroy` methods.
Since it puts the resource in the error state, other methods properly catch that
the resource is no longer usable when attempting to access it and raise validation
errors.

There are other resource types that require similar treatment and will be addressed
in followup work.

* Add a changelog entry
2023-11-09 15:48:06 +01:00
Brad Werth
4e65eca1e8
More complete implementation of "lose the device". (#4645)
* More complete implementation of "lose the device".

This provides a way for wgpu-core to specify a callback on "lose the
device". It ensures this callback is called at the appropriate times:
either after device.destroy has empty queues, or on demand from
device.lose.

A test has been added to device.rs.

* Updated CHANGELOG.md.

* Fix conversion to *const c_char.

* Use an allow lint to permit trivial_casts.

* rustfmt changes.
2023-11-08 22:22:18 +01:00
Brad Werth
7aaf672576
Ensure that pipeline creation errors register layouts as errors also (#4624)
Since the pipeline id is provided by the caller, the caller may presume
that an implicit pipeline layout id is also created, even in error
conditions such as with an invalid device. Since our registry system
will panic if asked to retrieve a pipeline layout id that has never been
registered, it's dangerous to leave that id unregistered. This ensures
that the layout ids also get error values when the pipeline creation
returns an error.
2023-11-06 15:53:31 -05:00
exrook
e7e2f2aa73
vulkan: Log validation layer messages during instance creation/destruction (#4586) 2023-11-05 23:14:59 -05:00
Daniel McNab
7709010a79
Naga(msl): Clear named expressions after writing each function (#4594)
This appears to match other backends, and fixes
fix the case where expressions which were named in earlier
functions are used in local variable declarations
2023-11-02 18:46:36 +00:00
Zoxc
ff1ba0b4fe
[wgl] Create a hidden window per instance (#4603) 2023-10-30 01:10:01 -04:00
Connor Fitzgerald
34e947de4b
Integration of Naga into Repo (#4296) 2023-10-25 16:51:36 -04:00
Connor Fitzgerald
49b7ec97c1
Update CHANGELOG.md 2023-10-25 14:15:05 -04:00
Connor Fitzgerald
3abf81efd2
Update CHANGELOG.md 2023-10-24 14:55:00 -04:00
Connor Fitzgerald
a66075fd46
Changelog for v0.18 (#4289) 2023-10-24 03:17:50 +00:00
Zoxc
2b985e2fad
Add WGL context creation and OpenGL support (#4248)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-18 18:40:33 +00:00
Nicolas Silva
8c03aa85e6
Make it possible to filter labels out ahead of wgpu-hal (#4246)
* Make it possible to filter labels out.

Co-authored-by: Jim Blandy <jimb@red-bean.com>
2023-10-18 17:45:59 +02:00
Jim Blandy
da0b3fe685
Let the "strict_asserts" feature enable Token::root assertions. (#4258) 2023-10-17 23:00:39 -04:00
Brad Werth
5034756948
Use DeviceError::Lost to represent device loss. (#4238) 2023-10-14 00:02:08 -04:00
Nicolas Silva
ff306d20e0
Add support for bgra8unorm-storage (#4228)
* Add `BGRA8UNORM_STORAGE` extension

* Leave a comment in the backends that don't support bgra8unorm-storage

* Pass the appropriate storage format to naga

* Check for bgra8unorm storage support in the vulkan backend

* Add a test

Co-authored-by: Jinlei Li <jinleili0@outlook.com>
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-10-13 10:07:11 +00:00
Teodor Tanasoaia
6c8ccdeaa9
[gles] enable/disable blending per attachment only when available (on ES 3.2 or higher) (#4234) 2023-10-12 20:22:42 -04:00
Jim Blandy
9df73c5c6e
Update naga to 0.13.0@git:9eb3a1dc (const expressions) (#4233) 2023-10-12 11:56:46 -04:00
Nicolas Silva
f95d1c55e3
Expose Instance flags (#4230)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-11 17:39:04 +00:00
Colin Edwards
0f7b530ea8
Add WinUI 3 SwapChainPanel support (#4191) 2023-10-11 13:36:30 -04:00
Nicolas Silva
b3135b9320
Properly handle user callbacks in surface_configure (#4227)
* Properly handle user callbacks in surface_configure

* Add a changelog entry
2023-10-11 09:35:00 +02:00
TornaxO7
a5b9ebb3c9
fix clippy warnings and errors (#4205)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-09 16:34:06 +00:00
JustAnotherCodemonkey
f738551250
Add Extended Examples (#3885)
* Add the base of the example. May need refining and definitely fact-checking.

* Start change to changelog.

* Complete changelog change for repeated-compute.

* Apply suggestion to fix typos.

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>

* Add storage-texture example which currently works native but needs to be changed to work for wasm. [no ci]

* repeated-compute now works on the web. [no ci]

* `storage-texture` now works on the web as well as native.

* Format because I forgot to do that (ugh).

* Add `storage-texture` to changelog.

* Add `render-to-texture` example.

* Not all the files got git added. Fixed it.

* Add `render-to-texture` to changelog.

* Make better readme's and add examples to said readme's.

* Oops. Put the example updates in the wrong place.

* Add `uniform-values` example.

* Apply clippy suggestions.

* Improved readme's and documentation.

* Fmt. Turning into the Joker rn.

* Make instructions for examples on the web more clear. \(Fmt and clippy happy\)

* hello-workgroups It doesn't work.

* Add basic comments and readme to hello-workgroups.

* Add hello-synchronization example. Currently doesn't have any tests but those should be added later.

* Forgot to check wasm compatibility for hello-synchronization. Fixed it.

* Add test for hello-synchronization.

* Make my examples downlevel defaults.

* Make uniform-values downlevel defaults. (Forgot to do that last commit.)

* Fix clippy doc complaints.

* Didn't fully fix the docs last commit. Got it here I think.

* Fix redundant bullet point in examples/hello-workgroups/README.md.

* Trim down the introduction section of examples/hello-workgroups/README.md.

* Add technical links section to examples/hello-workgroups/README.md.

* Use idiomatic Rust comments, break up big text wall into paragraphs, and fix some spelling errors.

* Move output image functions into examples/common and give output_image_wasm some upgrades.

* Modify changelog for moving output_image_native and output_image_wasm into wgpu-example.

* Fix output_image_wasm. (Formerly did not handle pre-existing output image targets.)

* Make a multiline comment be made of single lines to be more ideomatic.

* "Fix" more multiline comments. I think this is actually the last of them.

* Make the window a consistant, square size that's convenient for viewing.

* Make the window on uniform-values not endlessly poll, taking up 100% of the main thread in background at idle. Also, change layout a little and make native use nanos by default for logging.

* Make execute in hello-synchronization return a struct of vecs instead of using out parameters.

* Didn't realize the naming of wgpu_example::framework so I moved my common example utility functions into wgpu_example::utils.

* Add add_web_nothing_to_see_msg function to replace all the instances of adding "open the console" messages across the examples.

* Add small documentation to add_web_nothing_to_see_msg and change it to use h1 instead of p.

* Add documentation to output_image_native and output_image_wasm in examples/common.

* Do better logging for output image functions in wgpu-example::utils.

* Remove redundant append_child'ing of the output image element in wgpu-example::utils::output_image_wasm.

* Fix error regarding log message for having written the image in wgpu-example::utils::output_image_native.

* Fmt.

* In examples/README.md, re-arrange the examples in the graph to be in alphabetical order.

* Fix changlog item regarding wgpu-example::utils and the output image functions.

* Move all the added examples into one changelog item that lists all of them.

* Updated table in examples/README.md with new examples. Added new features to the table to accurately represent the examples.\n\nFor the new features, not all old examples may be fully represented.

* Fix inaccurate comment in hello-workgroups/src/shader.wgsl.

* Update examples/README.md to include basic descriptions of the basic examples as well as hints on how examples build off of each other.

* Remove `capture` example. See changelog entry for reasoning.

* Fix typo in hello-workgroups/shader.wgsl

* Change the method of vertex generation in the shader code of render-to-texture to make it more clear.

* Modify/correct message in repeated-compute/main.rs regarding the output staging buffer.

* Update message in uniform-values/main.rs about writing the app state struct to the input WGSL buffer.

* Add notice in repeated-compute/main.rs about why async channels are necessary (portability to WASM).

* Revise comment in uniform-values/main.rs about why we don't cast the struct using POD to be more clear.

* Change uniform-values to use encase for translating AppState to WGSL bytes.

* Cargo & Clippy: My two best friends.

* Add MIT-0 to the list of allowed liscences.

* Fix docs for wasm.

---------

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>
2023-10-08 02:05:51 -04:00
Brad Werth
e6097ce3d4
Make buffer_map and buffer_unmap check for device validity, add tests. (#4212)
* Make buffer_unmap check for device validity, add tests.

This patch makes buffer_unmap check for a valid device, and corrects
buffer_map to return the appropriate error for an invalid device.
Tests are added for both operations.

It also adds device validity checks to device_maintain_ids and to the
functions that get and set buffer sub data.

* Update changelog and test comment.

* Run rustfmt.

* Update test device_lose_then_more to specify more buffer usages to keep Vulkan happy.
2023-10-07 16:28:07 +02:00
Nicolas Silva
198e1dfadc
Validate that resources belong to the right device. (#4207) 2023-10-04 14:39:03 -04:00
Teodor Tanasoaia
7d1005faad
[WebGPU] validate polygon mode (#4196) 2023-10-04 12:27:27 +00:00
Connor Fitzgerald
90a8feab77
Add v0.17.* changelog (#4203) 2023-10-03 23:49:05 +00:00
Elabajaba
61300afd22
update gpu-allocator to 0.23 (#4198) 2023-10-03 16:32:13 -04:00
Teodor Tanasoaia
fd02a12726
Make GLES optional on Windows & macOS (#4185) 2023-10-03 16:16:24 -04:00
Teodor Tanasoaia
422c636877
Add Rgb10a2Uint format (#4199) 2023-10-03 14:56:21 +02:00
Nicolas Silva
9a76c483da
Add trace level logging to most API entry points (#4183)
* Add trace level logging to most API entry points

* Add a changelog entry
2023-09-28 18:29:44 +02:00
Brad Werth
57f8757fad
Add device destroy method (#4163)
Plus tests that ensure that an invalid device behaves correctly.
Mostly a stub implementation otherwise.
2023-09-27 14:34:23 +02:00
Jacob Hughes
27f2ce397a Re-export Naga (#4172) 2023-09-25 13:23:03 -07:00
Aaron Hill
2b4a8b318f
wgpu-core: Only produce StageError::InputNotConsumed on DX11/DX12 (#4116)
* wgpu-core: Only produce StageError::InputNotConsumed on DX11/DX12

This error only exists due to an issue with naga's HLSL support:
https://github.com/gfx-rs/naga/issues/1945
The WGPU spec itself allows vertex shader outputs that are
not consumed by the fragment shader.

Until the issue is fixed, we can allow unconsumed outputs on
all platforms other than DX11/DX12.

* Add Features::SHADER_UNUSED_VERTEX_OUTPUT to allow disabling check

* Pick an unused feature id
2023-09-20 21:02:37 -04:00
Alphyr
82f0cd9ee6
Fix Features::TEXTURE_COMPRESSION_ASTC* doc (#4157)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-09-20 18:45:09 +00:00
Frederik Magnus Johansen Vestre
dc5beac8c9
Support dual source blending (#4022)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-09-19 13:26:30 +02:00
Andreas Reich
507101987b
Make StoreOp an enum instead of a bool (#4147)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-09-18 14:58:41 -04:00
Jim Blandy
471229a48f
Update Naga to df8107b7 (2023-9-15). (#4149) 2023-09-17 15:39:16 -04:00
Andreas Reich
0ffdae31a1
Metal encoder & pass timestamp support (#4008)
Implements timer queries via write_timestamp on Metal for encoders (whenever timer queries are available) and passes (for Intel/AMD GPUs, where we should advertise TIMESTAMP_QUERY_INSIDE_PASSES now).

Due to some bugs in Metal this was a lot harder than expected. I believe the solution is close to optimal with the current restrictions in place. For details see code comments.
2023-09-16 20:01:46 +00:00
Kevin Reid
7c575a0b40
Add details to RequestDeviceError. (#4145) 2023-09-16 00:16:49 -04:00
Luke Jones
d17165f08b
Enable vulkan presentation on Intel Mesa >= v21.2 (#4110)
Due to an issue with Mesa versions less than 21.2 presentation on Vulkan
was forced to Nvidia only. This in itself brought new issues around the
Nvidia driver specfic format modifers.

As of Mesa 21.2 the Intel vulkan issue is fixed. This commit enables
presentation on versions 21.2 and above for Intel.

References:
- https://github.com/NVIDIA/egl-wayland/issues/72

Closes [#4101](https://github.com/gfx-rs/wgpu/issues/4101)
2023-09-05 14:20:04 +00:00
Jim Blandy
ff807295da
hal/vulkan: Instance::required_extensions -> desired_extensions (#4115)
Rename `wgpu_hal::vulkan::Instance::required_extensions` to
`desired_extensions`, to match its behavior. Document the function to
clarify its role.
2023-09-05 13:41:46 +00:00
Jim Blandy
54a7f0eac9
Skip test_multithreaded_compute on MoltenVK. (#4096)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-09-04 03:54:39 +00:00
Kevin Reid
332cd0325d
Add details to InstanceError and CreateSurfaceError. (#4066)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-09-01 01:48:31 -04:00
Patrik Buhring
41efabbd88
Fix limits interface on web. (#4107) 2023-09-01 05:46:00 +00:00
Rajesh Malviya
625afc3b42
Drop texture clear_views in surface_texture_discard (#4057) 2023-08-30 17:58:47 -04:00
SMG
e47dc2adad
use WGSL for VertexFormat example types (#4035)
* use WGSL for VertexFormat example types

* Update CHANGELOG.md

* use f32 for all VertexFormat float types
2023-08-29 16:53:08 +00:00
Brad Werth
5c2c840159
Prevent Metal from crashing when a still-open encoder is deallocated, resolve issue #2077. (#4023) 2023-08-28 18:23:35 -07:00
Fredrik Fornwall
bf324fb947
Make power_preference_from_env() respect WGPU_POWER_PREF=none (#4076)
Also update wgpu/README.md now that default() is None.
2023-08-18 11:05:34 +02:00
Teodor Tanasoaia
f58be7b8f1
DX12 set Features::VERTEX_WRITABLE_STORAGE based on the right FL (#4033) 2023-08-17 15:55:58 -04:00
Nicolas Silva
7b07f42beb
Use i32::MAX as the max buffer size for Dx12 (#4020) 2023-08-16 17:12:19 -04:00
Pieter-Jan Briers
e973a06268
Allow specifying minor GLES3 version (#3998) 2023-08-16 11:51:56 -04:00
Jim Blandy
e11526e23c
[vulkan] Don't free command buffers before destroying the pool. (#4059)
Calling `vkDestroyCommandPool` automatically frees all command buffers allocated
from that pool, so there is no need for `Device::destroy_command_encoder` to
explicitly call `vkFreeCommandBuffers` on the `CommandEncoder`'s `free` and
`discarded` lists.
2023-08-16 15:23:31 +02:00
hybcloud
57874e5c54
improved PR#4038 by using ash's definition instead (#4044)
of hard-coded c_str.
2023-08-15 07:29:24 +00:00
James0124
7544af0f83
Add validation in accordance with WebGPU setViewport valid usage fo… (#4058)
* Add validation in accordance with WebGPU `setViewport` valid usage for `x`, `y` and `this.[[attachment_size]]`.

`x` and `y` must not be negative, and the rect must be contained in the render target.

* Add changelog entry.
2023-08-15 09:15:19 +02:00
Kevin Reid
2bdb3196f9
Add an overview of RenderPass and how render state works. (#4055)
* Explain the general relationship of `set` and `draw` methods.
* Explain render state changes and that you can have lots of them.
* Specify default values of render state.
2023-08-14 22:24:27 +02:00
Connor Fitzgerald
f825ce4ac2
Fix Callback Ordering (#4036)
* Fix Callback Ordering

* Format & Changelog
2023-08-14 08:33:50 -04:00
Ryan Kaplan
014ae3fe43
Add get_mapped_range_as_array_buffer which - on wasm WebGPU builds - avoids copying mapped data into wasm heap (#4042)
Co-authored-by: Ryan Kaplan <ryan@Ryans-M2.local>
2023-08-13 16:02:16 +02:00
Jim Blandy
07f92c97b1
[vk] Don't request portability enumeration without the extension. (#4038) 2023-08-11 21:14:25 -04:00
Teodor Tanasoaia
c7da76a4c6
Validate DownlevelFlags::READ_ONLY_DEPTH_STENCIL (#4031) 2023-08-11 16:34:35 -04:00
Teodor Tanasoaia
5bbaca7d55
DX12 doesn't support Features::POLYGON_MODE_POINT (#4032) 2023-08-11 16:30:01 -04:00
Valaphee The Meerkat
359e392322
Update CHANGELOG.md (#4003) 2023-08-03 14:53:24 +00:00
Christopher Fleetwood
3305e88d63
feature: Timestamp queries (#3636)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-08-02 18:04:24 -04:00
Valaphee The Meerkat
494ae1a815
Add support for occlusion queries (#3402)
Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-08-02 19:05:59 +00:00
JustAnotherCodemonkey
5b4c6b8ae4
List limits for Limits::downlevel_defaults and downlevel_webgl2_defaults in docs. (#3988)
* Add the docs. (And change max_buffer_size for default and downlevel_default to be more readable.)

* Put limits listed in documentation on seperate lines via bullet points.

* Update changelog.

* Fix fmt.

* Turn doc lists into testable code blocks with markers for changed values.
2023-08-02 10:20:20 +02:00
Teodor Tanasoaia
48078a800a
Derive storage bindings via naga::StorageAccess instead of naga::GlobalUse (#3985)
Removes the feature check for read-only and read-write storage textures as it's later checked by `create_bind_group_layout`.

335f40f85a/wgpu-core/src/device/resource.rs (L1505-L1518)

Also removes the `GlobalUse` checks from `check_binding_use` as naga is already checking those.

535701f6b2/src/valid/interface.rs (L639-L669)
2023-07-31 15:30:47 +02:00
Teodor Tanasoaia
adc43b5672
Omit texture store bound checks since they are no-ops if out of bounds on all APIs (#3975) 2023-07-25 17:04:54 +02:00
Bruce Mitchener
2a77bbd80d
Fix some typos. (#3965) 2023-07-23 08:15:20 +00:00
Ali
b93dc7c69a
Fixed: enabling PARTIALLY_BOUND_BINDING_ARRAY does not get enabled on vulkan backend (#3772) 2023-07-23 07:37:59 +00:00
Connor Fitzgerald
21098cdace
Add note about wgpu-info to changelog 2023-07-20 23:15:51 -04:00
Connor Fitzgerald
bdb98b1916 Chaneglog update 2023-07-20 23:14:11 -04:00
Nicolas Silva
4ab9dbea8f
Update max_bindings_per_bind_group from 640 to 1000 to reflect spec (#3942)
* Update max_bindings_per_bind_group from 640 to 1000 to reflect change in the spec.

* Add changelog entry.
2023-07-20 10:02:59 -04:00
Jinlei Li
d089b9488b
Ignore the exception values generated by the winit resize event (#3916) 2023-07-19 17:07:48 -04:00
Aaron Hill
fd5550cc89
Make RequestAdapterOptions.power_preference optional (#3903)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-07-19 21:04:31 +00:00
Ashley
e4eb5b38ec
Fix ASTC feature selection in the webgl backend (#3934)
* Update glow to a new minor version, improve gles adapter astc feature selection
* Update Cargo.lock
* Add changelog entry
* Improve cfg flags to filter out emscripten
2023-07-17 14:40:53 +02:00
Nicolas Silva
7198d60f68
Validate that BufferDescriptor::usage is not zero (#3928)
* Validate that BufferDescriptor::usage is not zero.

* Add a changelog entry.
2023-07-14 22:41:34 +02:00
Wez Furlong
2af6d1bc63
Ensure X11 connections are closed (#3924)
Introduces a DisplayOwner struct to own both the library
and associated display pointer; their lifetimes are combined
in that struct.

The display pointer is encapsulated in a DisplayRef.

When DisplayOwner is dropped, it ensures that the DisplayRef
is correctly closed prior to unloading the library.

refs: https://github.com/gfx-rs/wgpu/issues/3813
2023-07-13 12:32:18 +02:00
Fredrik Fornwall
89f721f882
Make initialize_adapter_from_env take a compatible surface (#3905)
* Make initialize_adapter_from_env take a compatible surface

Add a compatible surface parameter to initialize_adapter_from_env, and
use that to make initialize_adapter_from_env_or_default always respect
its compatible_surface parameter.

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2023-07-10 09:27:02 +02:00
Connor Fitzgerald
a885840a49
Update changelog for 0.16.2 (#3917) 2023-07-09 05:20:11 +00:00
AdrianEddy
e85cc91b5d
Add support for importing external buffers (#3355) 2023-07-07 18:00:08 -04:00
Fredrik Fornwall
234dea18c4 Fix link to GPUVertexBufferLayout
Fixes #3342.
2023-07-05 20:08:22 -02:30
Fredrik Fornwall
1c43272d2a
Remove backend_bits from initialize_adapter_from_env (#3904)
Remove backend_bits from initialize_adapter_from_env, backends can
be specified using the backends field in InstanceDescriptor instead.
2023-07-05 18:21:39 +02:00
Fredrik Fornwall
17143c149c
Make shader write&read storage buffers match non readonly layouts (#3893) 2023-06-29 22:30:34 +00:00
daxpedda
88f18ed190
Don't implement Send or Sync on Wasm (#3691)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-06-29 20:31:18 +00:00
AlbinBernhardssonARM
7c34cc86e8
Implement depth-clip-control using depthClamp (#3892) 2023-06-29 16:15:21 -04:00
Jinlei Li
757245cdfc
metal: support (simulated) visionOS (#3883) 2023-06-23 19:31:35 -04:00
Jinlei Li
cc203a66b1
web: use get_preferred_canvas_format() to fill SurfaceCapabilities (#3744)
* web: use `get_preferred_canvas_format()` to fill `formats` of `SurfaceCapabilities`

* Only keep preferred format as the first element

* Update CHANGELOG

* Find preferred format and move it to the first position in the formats.

* Add a note to preferred_format.

* Remove the unnecessary allocation.
2023-06-23 22:24:58 +08:00
Sven Sauleau
45efae315b
fix Wasm casing (#3878) 2023-06-21 20:54:07 +00:00
Andrew Wheeler(Genusis)
2ee2e1a770
Update RenderPass draw, draw_indexed, set_viewport and set_scissor_rect documentation (#3860) 2023-06-17 17:11:24 +00:00
Xiaopeng Li
f9fcb54ce4
Disable suballocation on Iris(R) Xe gpu (#3668)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-06-15 20:18:38 +00:00
Pieter-Jan Briers
acb7712c5a
Allow empty scissor rects (#3863) 2023-06-15 15:49:06 -04:00
liquidev
dfa5400a78
GLES: on EGL, respect the user requesting a non-sRGB surface format (#3817)
* EGL: respect the user requesting a non-sRGB surface format
What used to happen was that sRGB was used whether you requested it or not.
This commit fixes that and now passing in a non-sRGB texture format in SurfaceConfiguration will result in a non-sRGB surface being created.

* add changelog entry about the EGL non-sRGB support change
2023-06-06 19:59:00 +02:00
Teodor Tanasoaia
2e4209c537
Add back components info of TextureFormats (#3843)
* add back components info of `TextureFormat`s
* add changelog
2023-06-06 19:28:46 +02:00
Jim Blandy
3f0aed789d
Don't report violations of VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912 (#3809)
As described in [Vulkan-ValidationLayers#5671], the validation layers don't understand debug ranges paired across different command buffers on the same queue, even though the Vulkan spec says:

> An application may open a debug label region in one command buffer and close it in another, or otherwise split debug label regions across multiple command buffers or multiple queue submissions. When viewed from the linear series of submissions to a single queue, the calls to vkCmdBeginDebugUtilsLabelEXT and vkCmdEndDebugUtilsLabelEXT must be matched and balanced.

Until this is fixed, wgpu should ignore this validation error to reduce noise in test runs.

Fixes #3733.

[Vulkan-ValidationLayers#5671]: https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5671
2023-06-06 06:56:44 -04:00
Connor Fitzgerald
1d2a667b71
Fix trying to use a renderpass inside a compute pass (#3828)
* Fix trying to use a renderpass inside a compute pass

* Fix pipeline statistics test on mac

* Changelog
2023-06-05 09:05:59 -04:00
Connor Fitzgerald
1cb0bdcdef
Fix incorrect aspect in barriers when using emulated Stencil8 textures. (#3833) 2023-06-04 23:32:06 -04:00
Connor Fitzgerald
ad45f29bb6 Changelog backport 2023-06-01 01:55:55 -04:00
Elabajaba
e6314c4070
DX12 increase max_storage_buffers_per_shader_stage and max_storage_textures_per_shader_stage (#3798) 2023-05-30 12:38:54 +02:00
Emil Ernerfeldt
b0dfd11a01
Fix missing 4X MSAA support on some OpenGL backends (#3780)
* Always support 4x MSAA on GL

* Update changelog
2023-05-19 16:39:07 +02:00
Malek
dafc189d6b
Fix multiview rendering (#3779) 2023-05-19 00:03:57 -04:00
Robin KAY
c91a660ec5
Fix order of arguments to glPolygonOffset. (#3783) 2023-05-18 22:40:35 +00:00
Jim Blandy
3563849585
Document that various sizes and offsets are in bytes. (#3773) 2023-05-13 22:22:28 -04:00
Paul Hansen
28374fb1c8
Publish examples to wgpu.rs on updates to trunk branch instead of gecko (#3750) 2023-05-11 12:12:25 -04:00
Erich Gubler
f71a1bc736
docs(adapter): document device and vendor IDs repr. (#3763) 2023-05-10 12:13:01 +00:00
Ame
4d8a7ed38d
Change AdapterInfo::{device,vendor} fields to u32 (#3760)
* Change AdapterInfo device and vendor to u32s

* Add CHANGELOG
2023-05-09 11:17:27 +02:00
Erich Gubler
0f0044f358
fix(wgpu-core)!: use u32 indices for bind group layouts everywhere (#3743) 2023-05-03 20:56:54 -04:00
Jim Blandy
49800337d1
Define wgpu_core::Global::create_render_bundle_error. (#3746) 2023-05-03 14:17:18 -07:00
Erich Gubler
3e562aaeaa
docs: note feature req. for Depth32FloatStencil8 (#3734)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-05-03 10:08:52 +00:00
Andreas Reich
1dd105c3bf
Fix crash on command buffer drop (#3726) 2023-05-03 05:00:59 -04:00
Connor Fitzgerald
0b53b477c5
Update CHANGELOG.md 2023-04-19 21:54:23 -04:00
Connor Fitzgerald
011a4e26d0
Release v0.16.0 (#3707)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-19 22:06:21 +00:00
Alix Bott
c86f9773ca
Fix unsetting vertex attributes in gles backend (#3706)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-19 21:14:45 +00:00
daxpedda
85fc427470
Adjust internal canvas size on Surface::configure() (#3690) 2023-04-19 21:09:31 +00:00
François
bf8e6fe371
add feature RG11B10UFLOAT_RENDERABLE on webgpu (#3689)
* add feature RG11B10UFLOAT_RENDERABLE on web

* changelog
2023-04-14 14:52:37 +02:00
François
7c25c00f07
reject binding type multisampled when on a float filterable sample type (#3686) 2023-04-13 13:55:56 -04:00
Connor Fitzgerald
a7defb723f
Cleanups for WebGPU (#3671)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-12 21:27:30 +00:00
Josh Groves
cfc038aeb9
Avoid using WasmAbi functions on WebGPU backend (#3657)
Co-authored-by: Connor Fitzgerald <connor@modyfi.io>
2023-04-10 16:31:43 -04:00
David Huculak
4d15567392
add dxc error message formatting (#3632) 2023-04-10 15:51:46 -04:00
Niklas Korz
2c37608ad3
Web: handle None for depth_ops and stencil_ops (#3660) 2023-04-10 11:21:17 +02:00
Teodor Tanasoaia
6918cf33d4
[metal] Fix metal erroring on an array_stride of 0 (#3538)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-04-05 22:40:15 +00:00
Sebastian J. Hamel
27cdfd2954
Silence vulkan validation error (#3095) (#3627) 2023-04-05 18:15:43 -04:00
Lukas Herzberger
b6dbce740f
Implement resolve query set (#3489
* implement command_encoder_resolve_query_set

* fix args

* add BufferUsages::QUERY_RESOLVE

* update changelog

* fix link text

* validate query resolve: check for QUERY_RESOLVE instead of CPY_DST

* update changelog, replace COPY_DST with QUERY_RESOLVE in mipmap example
2023-04-05 17:59:04 -04:00
Benjamin Schaaf
fdbbd02c1e
Properly drop surfaces (#3647)
Co-authored-by: Benjamin Schaaf <bschaaf@sublimetext.com>
Fixes #3646
2023-04-05 17:48:12 -04:00
Teodor Tanasoaia
37fbae7872
Revert "Fix macro to allow disabling dx12 feature. (#3590)" (#3649)
This reverts commit 110e62aed2.
2023-04-04 15:16:31 +02:00
daxpedda
9fa7186ede
[gles] Fix tex_sub_image_* calls not always adjusting to target texture (#3641) 2023-04-04 13:51:13 +02:00
Jeremy Leibs
68b0b24ce8
Reset the queue state between each command buffer on queue submit (#3593)
Co-authored-by: Andreas Reich <andreas@rerun.io>
2023-03-22 15:08:44 -04:00
Emil Ernerfeldt
a89e35a4e0
Validate shader location clashes (#3613)
* Validate shader location clashes

* Add line to changelog
2023-03-22 14:56:52 +01:00
Connor Fitzgerald
0c3ca5c08b
Fix Metal Mipmap Behvior (#3610) 2023-03-21 16:37:30 +00:00
Christopher Fleetwood
a502282307
feat: correct bounds policy checking on MSL (#3603) 2023-03-21 12:33:25 +01:00
Andreas Reich
2a37b2d918 added changelog 2023-03-20 15:42:51 -02:30
Andrew Numrich
110e62aed2
Fix macro to allow disabling dx12 feature. (#3590)
* Fix macro for DX12 conditional compilation

* Update CHANGELOG.md

* Apply suggestions from code review

---------

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-03-15 18:48:47 +01:00
Jim Blandy
0772df798d
Don't emit ANSI colors in shader validation error messages. (#3591) 2023-03-14 22:35:02 -04:00
Connor Fitzgerald
42a0683d48
Remove unwraps inside surface.configure (#3585) 2023-03-14 11:01:02 +01:00
Jinlei Li
9445317f26
Set max_memory_allocation_size via PhysicalDeviceMaintenance3Properties (#3567)
* vulkan: set  `max_memory_allocation_size` via `PhysicalDeviceMaintenance3Properties`

* Update CHANGELOG

* Follow the suggestions

* Fix fmt

* Update wgpu-hal/src/vulkan/adapter.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

* Enable `KhrMaintenance3Fn` on vk < 1.1

---------

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-03-09 20:05:39 +01:00
Kevin Reid
13d2c3673c
In Context::handle_error_fatal, print cause chain. (#3563) 2023-03-06 23:00:34 -05:00
Teodor Tanasoaia
cf40e64b16
Change type of bytes_per_row and rows_per_image (#3529) 2023-03-06 16:44:36 -05:00
Josh Groves
2eb27f2c0e
Fix definition of NSOperatingSystemVersion (#3557) 2023-03-06 16:43:39 -05:00
Teodor Tanasoaia
54e4c8654d
[dx12] use typeless formats for textures that might be viewed as srgb or non-srgb (#3555)
query `CastingFullyTypedFormatSupported` and skip typeless formats if available
2023-03-03 19:42:34 +00:00
Teodor Tanasoaia
7e72f30179
Allow copying of textures with copy-compatible formats (#3528)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-03-03 17:24:17 +00:00
Teodor Tanasoaia
ac689cbe1f
Update feature documentation (#3534) 2023-03-03 12:09:17 -05:00
Connor Fitzgerald
db3be88f90 Uppercase all error strings 2023-03-03 11:33:20 -05:00
Jinlei Li
de695fca0b
metal: if new_texture() returns NULL, create_texture() returns an error (#3554) 2023-03-03 13:51:38 +01:00
James Liu
6ee0d4c14d
Replace fxhash with rustc-hash (#3502)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-03-01 18:46:38 +00:00
James0124
9dc834a0ac
Treat VK_SUBOPTIMAL_KHR as VK_SUCCESS on Android. (#3525) 2023-02-27 10:52:09 +01:00
Red Artist
af5f4d20f4
enable debug extension on emscripten (#3519)
* enable debug extension on emscripten

* update changelog

* extract emscripten stuff into a separate module

* use unmasked queries on w-u-u, and only enable extension on emscripten

* fix docs
2023-02-22 01:16:14 -05:00
Teodor Tanasoaia
074d1da831
Set the new naga capabilities (#3494)
* remove redundant flag

* set the `MULTISAMPLED_SHADING` downlevel flag for gles and dx11

* set the right naga capabilities

add `Features::SHADER_EARLY_DEPTH_TEST`

* add changelog entry

* remove `@early_depth_test` from water example
2023-02-16 22:43:38 -05:00
Teodor Tanasoaia
c51edd36fd
Support stencil-only views and copying to/from combined depth-stencil textures (#3436) 2023-02-15 16:20:22 -05:00
Artavazd Balaian
ee33f4d384
[gles] fix: Set FORCE_POINT_SIZE if it is vertex shader with mesh consist of point list (#3440) 2023-02-15 10:05:52 -05:00
Teodor Tanasoaia
b33731c44c
Validate before extracting texture selectors (#3487)
Move calls to `extract_texture_selector` after calls to `validate_texture_copy_range`, to avoid overflow.
2023-02-14 12:31:18 -08:00
Jinlei Li
4593f951dd
vk: fix surface view formats validation error (#3432)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-02-09 13:00:42 -05:00
Jinlei Li
0d5b4841d5
web: reimplement adapter|device_features (#3428) 2023-02-09 12:14:15 -05:00
Nathan Adams
238697c2da
Add MULTISAMPLE_X16 texture format feature flag where supported (#3454) 2023-02-06 19:53:48 +01:00
Teodor Tanasoaia
41de797c74
Change type of mip_level_count and array_layer_count (members of TextureViewDescriptor and ImageSubresourceRange) from Option<NonZeroU32> to Option<u32> (#3445)
Clean up duplicated code related to texture layers/mips.
2023-02-03 15:03:34 +01:00
Elabajaba
7826092d86
Fix dx12 shader validation errors when dxil.dll isn't available in the local scope. (#3434)
* Fix dx12 shader validation errors when dxil.dll isn't available in the local scope.

* changelog

* clippy

* always explicitly validate shaders to simplify code

* destructor ordering
2023-02-01 22:55:54 -05:00
Elabajaba
c5e2f5a7b9
Add SHADERINT_16 feature to allow 16bit ints in Vulkan shaders (#3401)
* add support for vulkan SHADER_INT16

* changelog

* deno shader-i16

* better INT16 docs

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

* fix typo

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-02-02 02:00:22 +00:00
AdrianEddy
2562f323bb
[Metal] Add a way to create a device and queue from raw resources in wgpu-hal (#3338) 2023-02-01 23:56:48 +00:00
João Capucho
c371e7039d
Implement the new checks for readonly stencils (#3443)
wgpu currently checks if the `write_mask` is 0 to determine wether a
stencil is used as readonly or not. However Webgpu contains a more
complex ruleset that also checks the cull mode and face operations to
determine if the stencil is readonly or not.

This commit brings these new rules to wgpu.
2023-02-01 21:13:46 +01:00
Teodor Tanasoaia
98ea3500fd
copyTextureToTexture src/dst aspects must both refer to all aspects of src/dst format (#3431)
* src/dst aspects must both refer to all aspects of src/dst format

* add changelog entry
2023-01-28 17:08:21 +01:00
Jinlei Li
b31069f14a
Improve vk format msaa capabilities detection (#3429)
* Improve vk format msaa capabilities detection

* Update CHANGELOG

* Follow the suggestions

* Update wgpu-hal/src/vulkan/adapter.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-01-28 12:03:43 +00:00
Raph Levien
fe2b230b0e
Implement clear_buffer on web (#3426) 2023-01-26 22:32:34 +00:00
Connor Fitzgerald
659f697705
Add naga section in changelog 2023-01-25 19:45:50 -05:00
Connor Fitzgerald
d3fec9524f
Release of 0.15 (#3424) 2023-01-25 19:25:41 -05:00
Teodor Tanasoaia
d2809137ba
Zero-initialize workgroup memory (#3174)
fixes https://github.com/gfx-rs/wgpu/issues/2430
2023-01-25 18:28:35 -05:00
Jinlei Li
33f94c7c84
Implement view_formats for SurfaceConfiguration (#3409)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-01-25 21:04:41 +00:00
IceSentry
bb876f372a
Better error message for 16 byte alignment error (#3414)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: gilescope <gilescope@gmail.com>
Closes https://github.com/gfx-rs/wgpu/pull/3099
Closes https://github.com/gfx-rs/wgpu/issues/2832
2023-01-24 20:46:19 +00:00
Elabajaba
5da2b8ad6b
implement add_srgb_suffix for TextureFormat (#3419) 2023-01-24 15:16:45 -05:00
Connor Fitzgerald
95a760bb42
Implement queue.copy_external_image_to_texture for WebGL2 and improve WebGPU Impl (#3288)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Closes https://github.com/gfx-rs/wgpu/issues/1888
2023-01-24 18:44:15 +00:00
Teodor Tanasoaia
964c94a02d
Update TextureView validation (#3410)
* update TextureView validation

* add changelog entry

* remove call to clone

* dereference instead
2023-01-24 12:02:16 +01:00
1e1001
5acb70691d
Make make_spirv_raw and make_spirv handle big-endian binaries (#3411)
Fixes https://github.com/gfx-rs/wgpu/issues/3408
2023-01-21 04:04:55 +00:00
Nathan Adams
c5851275c5
GLES: Cache and reuse programs between similar pipelines (#3380)
* Cache programs in GLES backend by their stage info, to avoid recreating the same program untold many times

* Don't duplicate an arcs ref count in gles programs

* Extract ProgramCacheKey from gles ProgramCache

* gles: Panic if we can't acquire program_cache lock

* Clarify why the program cache is safe
2023-01-20 09:44:34 -05:00
Nathan Adams
cecf0633a3
Don't panic when gl.create_buffer() fails on webgl (#3396) 2023-01-18 21:31:16 +00:00
Elabajaba
81569dd6c3
Updated Dxc integration for DX12 backend (#3356)
Co-authored-by: unknown <alimilhim5@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Closes https://github.com/gfx-rs/wgpu/issues/2722
closes https://github.com/gfx-rs/wgpu/pull/3147
2023-01-18 21:25:56 +00:00
Jinlei Li
0849e78600
Add view_formats in TextureDescriptor (#3237)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Closes https://github.com/gfx-rs/wgpu/issues/3030
2023-01-18 16:03:56 -05:00
Teodor Tanasoaia
fae740df5c
Fix being able to sample a depth texture with a filtering sampler (#3394) 2023-01-18 15:53:50 -05:00
Nathan Adams
0705c7ad6b
Create gles buffers with DYNAMIC_DRAW instead of STATIC_DRAW (#3391) 2023-01-17 10:56:27 +01:00
Leo Kettmeir
f40611fd5c
don't panic on mapped buffer in queue_submit (#3364) 2023-01-15 07:10:11 +01:00
Jim Blandy
fac4731288 Add missing CHANGELOG.md entry. 2023-01-14 10:25:21 -08:00
Nathan Adams
4400ff8289
Increase GL MAX_PUSH_CONSTANTS from 16 to 64 (#3374) 2023-01-13 00:18:54 +00:00
Mica White
f2d2a0c00c
Remove panics in Deref impl of QueueWriteBufferView and BufferViewMut (#3336) 2023-01-12 18:57:06 +01:00
Teodor Tanasoaia
80d237725e
[vk] Set WEBGPU_TEXTURE_FORMAT_SUPPORT downlevel flag depending on the proper format support (#3367) 2023-01-10 16:33:33 +01:00
Teodor Tanasoaia
98ddb402eb
Set COPY_SRC/COPY_DST only based on Vulkan's TRANSFER_SRC/TRANSFER_DST (#3366)
* remove `BLIT_SRC`/`BLIT_DST`

* add changelog entry
2023-01-10 15:48:16 +01:00
James0124
e7ca1716f5
Fix panic in the GLES backend when creating a pipeline with opaque ty… (#3361)
* Fix panic in the GLES backend when creating a pipeline with opaque types other than samplers.

* Add changelog entry for #3361.
2023-01-10 09:26:45 +01:00
JMS55
ad4dac87fb
Allow non-filtering integer texture sampling (#3362)
* Allow non-filtering integer texture sampling

* Add changelog entry
2023-01-09 11:08:14 +01:00
James0124
a06ef71fd7
Add validation in accordance with WebGPU GPUSamplerDescriptor valid… (#3353)
* Add validation in accordance with WebGPU `GPUSamplerDescriptor` valid usage for `lodMinClamp` and `lodMaxClamp`.

`lodMinClamp` must not be negative, and `lodMaxClamp` must be >= `lodMinClamp`

* Add changelog entry.

* Run `cargo fmt`.
2023-01-06 13:16:16 +01:00
Teodor Tanasoaia
39f6b03e19
Document and improve extension detection (#3327)
* document and improve extension detection

* add changelog entry

* request `VK_KHR_get_physical_device_properties2` unconditionally

* remove commented code

* remove vk 1.1 check
2023-01-05 11:20:56 +01:00
Teodor Tanasoaia
784ee43be7
Make ObjectId structure and invariants idiomatic (#3347) 2023-01-04 15:13:59 -05:00
Xiaopeng Li
71f50409e6
GraphicsCommandList validation (#3204)
* GraphicsCommandList validation

* Add change to CHANGELOG.md

* Close command list

* Destroy command buffer

* Find valid command list for reuse

* Fix clippy
2023-01-04 14:22:39 +01:00
Nathan Adams
186a29c34d
Implement TextureFormat::Stencil8 + add stencil example (#3343)
* Implement TextureFormat::Stencil8

* Add stencil-triangles demo to test Stencil8 and show how to use stencil testing

* Added changelog for Stencil8
2023-01-02 13:47:10 +01:00
Connor Fitzgerald
aa46e82f40 Fix texture view creation with full-resource views when using an explicit mip_level_count or array_layer_count 2022-12-21 17:24:46 -05:00
Andreas Reich
eaa87ba42c
Force all adapters to report min buffer alignment of 32 (#3262) 2022-12-21 13:46:15 -05:00
Connor Fitzgerald
5241633b3a
Implement Presentation Timestamp Correlation (#3240)
Co-authored-by: Jim Blandy <jimb@red-bean.com>
2022-12-20 17:52:08 +00:00
Elabajaba
f3c50918c2
Suballocate DX12 buffer creation (#3163)
closes https://github.com/gfx-rs/wgpu/issues/2720
2022-12-20 12:23:44 -05:00
Teodor Tanasoaia
62e932b0a8
Add missing DEPTH_BIAS_CLAMP and FULL_DRAW_INDEX_UINT32 downlevel flags (#3316)
* add missing `DEPTH_BIAS_CLAMP` and `FULL_DRAW_INDEX_UINT32` downlevel flags

* add changelog entry

* use require_downlevel_flags
2022-12-20 18:21:54 +01:00
Teodor Tanasoaia
c91cae47d2
[dxgi] fix depth16Unorm formats for nodepth and typeless (#3313)
* [dxgi] fix `depth16Unorm` formats for nodepth and typeless

* add changelog entry
2022-12-20 15:29:43 +01:00
Teodor Tanasoaia
14886ee142
Sync depth/stencil copy restrictions with the spec (#3314)
* sync depth/stencil copy restrictions with the spec

* add changelog entry
2022-12-20 15:26:00 +01:00
Teodor Tanasoaia
8ca6e385ba
Sync TextureFormat.describe with the spec (#3312)
* sync TextureFormat.describe with the spec

* add changelog entry
2022-12-20 15:23:15 +01:00
i509VCB
052bd17d41
Context dynamic dispatch (#3051) 2022-12-19 19:17:19 -05:00
Andreas Reich
46831a8b25
deref/deref_mut methods on buffer-views inline (#3307)
* mark deref/deref_mut methods on buffer-views inline

* inline for deref for both direct/web backend

* changelog entry
2022-12-19 15:40:47 +01:00
Jim Blandy
0e4c7dd6d2
Remove workspace inheritance (#3295) 2022-12-15 15:46:28 -05:00
Connor Fitzgerald
3ce5ca866b
Improve dynamic offset binding errors (#3294) 2022-12-15 00:53:42 +00:00
Connor Fitzgerald
2480eff65e
Error when not using cargo-nextest (#3293)
Closes https://github.com/gfx-rs/wgpu/issues/3285
2022-12-15 00:09:04 +00:00
Harald Reingruber
f0f700c2d9
Test setup for WebAssembly+WebGL (#3238)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-12-09 01:02:39 +00:00
Elabajaba
85fda2d18e
Update to ash 0.37.1 to replace deprecated function call (#3273)
* update to ash 0.37.1 to fix CI

* changelog

* Use equals for ash version

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

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-12-08 15:22:30 -05:00
Connor Fitzgerald
458fb9bed7
Implement SHADER_PRIMITIVE_INDEX on all Backends (#3272)
* Fix bunnymark on GL

* Implement SHADER_PRIMITIVE_INDEX on all backends

* Changelog
2022-12-08 08:47:44 -05:00
Jim Blandy
a50836e0cb
Make wgpu-core users responsible for choosing back ends. (#3254) 2022-12-07 20:58:45 -05:00
Jim Blandy
537f077132
Evaluate gfx_select's #[cfg] conditions at the right time. (#3253)
See the comments in the code for details.
2022-12-05 12:47:42 -08:00
Ashley
6147c91818
Support OES_texture_float_linear in webgl (#3261)
closes https://github.com/gfx-rs/wgpu/issues/3215
2022-12-05 12:58:06 -05:00
Jinlei Li
5f3acf50b4
Decrease max_buffer_size limit value to be compatible with Apple2 GPU (#3255)
* Decrease `max_buffer_size` limit value to be compatible with Apple2 GPU

* Update CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-12-03 08:12:43 +00:00
Kevin Reid
2209463a54
Return an error instead of panicking when canvas context is unavailable (#3052)
* Low-level error handling in canvas context creation (for WebGPU and WebGL 2).

Part of fixing #3017. This commit changes the handling of `web_sys`
errors and nulls from `expect()` to returning `Err`, but it doesn't
actually affect the public API — that will be done in the next commit.

* Breaking: Change type of `create_surface()` functions to expose canvas errors.

Part of fixing #3017.
2022-11-30 23:41:29 -05:00
Nicolas Silva
e90aacea96
Validate texture copy ranges earlier to prevent integer overflow (#3090)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2022-12-01 01:20:48 +00:00
Jim Blandy
9c6a60d97c
Fix surface creation cfgs in example framework. (#3246) 2022-11-30 16:46:24 -05:00
Nicolas Silva
a9d33193b3
Fix incorrect offset in get_mapped_range (#3233)
* Add a test.

* Fix incorrect offset in get_mapped_range.

* Add an entry in the changelog.
2022-11-30 16:45:49 -05:00
Connor Fitzgerald
183ba3f231 Make Surface::get_default_config return an Option. 2022-11-27 01:50:47 -05:00
Connor Fitzgerald
84cb3e65a9 Unify Surface Capabilities APIs under one function call 2022-11-27 01:50:47 -05:00
Nicolas Silva
82e9dcf8f7
Allow unspecified bits when deserializing the API's bitflags (#3229) 2022-11-25 23:13:22 -05:00
Jim Blandy
d4b1d57f3c
Move ResourceMetadata into its own module, and give it a proper interface (#3213) 2022-11-23 17:29:20 -05:00
Jim Blandy
73b23f1c8d
Move minimum supported rust version (MSRV) from 1.65 back to 1.64. (#3231) 2022-11-23 21:22:03 +00:00
Andreas Reich
2ccfb42440
allow gles float textures to be multisampled if available (#3183) 2022-11-23 16:10:11 -05:00