Commit Graph

167 Commits

Author SHA1 Message Date
teoxoy
7910fd8059 [wgpu-hal] require a Surface to be passed to Instance.enumerate_adapters() on WebGL2
Also makes wgpu's `enumerate_adapters()` native only.
2024-07-04 10:17:07 +02:00
Imbris
3a6814770a
Allow unconsumed inputs in fragment shaders (#5531)
* Allow unconsumed inputs in fragment shaders by removing them from vertex
outputs when generating HLSL.

Fixes https://github.com/gfx-rs/wgpu/issues/3748

* Add naga:🔙:hlsl::FragmentEntryPoint for providing information
  about the fragment entry point when generating vertex entry points via
  naga:🔙:hlsl::Writer::write. Vertex outputs not consumed by the
  fragment entry point are omitted in the final output struct.
* Add naga snapshot test for this new feature,
* Remove Features::SHADER_UNUSED_VERTEX_OUTPUT,
  StageError::InputNotConsumed, and associated validation logic.
* Make wgpu dx12 backend pass fragment shader info when generating
  vertex HLSL.
* Add wgpu regression test for allowing unconsumed inputs.

* Address review

* Add note that nesting structs for the inter-stage interface can't
  happen.
* Remove new TODO notes (some addressed and some transferred to an issue
  https://github.com/gfx-rs/wgpu/issues/5577)
* Changed issue that regression test refers to 3748 -> 5553
* Add debug_assert that binding.is_some() in hlsl writer
* Fix typos caught in CI

Also, fix compiling snapshot test when hlsl-out feature is not enabled.
2024-07-04 09:08:46 +02:00
Andreas Reich
0a76c0fa84
Renderpass take resource ownership (#5884)
* share timestamp write struct

* Make name of set_push_constants methods consistently plural

* remove lifetime bounds of resources passed into render pass

* first render pass resource ownership test

* introduce dynrenderpass & immediately create ArcCommands and take ownership of resources passed on pass creation

* Use of dynrenderpass in deno

* Separate active occlusion & pipeline statitics query

* resolve render/compute command is now behind `replay` feature

* add vertex & index buffer to ownership test

* test for pipeline statistics query

* add occlusion query set to pass resource test

* add tests for resource ownership of render pass query timestamps

* RenderPass can now be made 'static just like ComputePass. Add respective test

* Extend encoder_operations_fail_while_pass_alive test to also check encoder locking errors with render passes

* improve changelog entry on lifetime bounds
2024-07-01 18:36:24 +02:00
Jim Blandy
b9b7050bb9 Give wgpu_test::compute_pass_ownership buffers unique labels.
Give each buffer in the
`wgpu_test::compute_pass_ownership::compute_pass_resource_ownership`
test a unique label, for easier debugging.
2024-06-13 12:25:05 +02:00
Jim Blandy
93c6fbe8ba
Skip compute_pass_resource_ownership on GL/AMD Radeon Pro WX 3200. (#5801)
Skip
`wgpu_test::compute_pass_ownership::compute_pass_resource_ownership`
on the GL backend on AMD Radeon Pro WX 3200, to avoid the kernel crash
described in #5800.
2024-06-12 21:27:34 +00:00
Atlas Dostal
abba12ae4e Add support for 64 bit integer atomic operations in shaders.
Add the following flags to `wgpu_types::Features`:

- `SHADER_INT64_ATOMIC_ALL_OPS` enables all atomic operations on `atomic<i64>` and
  `atomic<u64>` values.

- `SHADER_INT64_ATOMIC_MIN_MAX` is a subset of the above, enabling only
  `AtomicFunction::Min` and `AtomicFunction::Max` operations on `atomic<i64>` and
  `atomic<u64>` values in the `Storage` address space. These are the only 64-bit
  atomic operations available on Metal as of 3.1.

Add corresponding flags to `naga::valid::Capabilities`. These are supported by the
WGSL front end, and all Naga backends.

Platform support:

- On Direct3d 12, in `D3D12_FEATURE_DATA_D3D12_OPTIONS9`, if
  `AtomicInt64OnTypedResourceSupported` and `AtomicInt64OnGroupSharedSupported` are
  both available, then both wgpu features described above are available.

- On Metal, `SHADER_INT64_ATOMIC_MIN_MAX` is available on Apple9 hardware, and on
  hardware that advertises both Apple8 and Mac2 support. This also requires Metal
  Shading Language 2.4 or later. Metal does not yet support the more general
  `SHADER_INT64_ATOMIC_ALL_OPS`.

- On Vulkan, if the `VK_KHR_shader_atomic_int64` extension is available with both the
  `shader_buffer_int64_atomics` and `shader_shared_int64_atomics` features, then both
  wgpu features described above are available.
2024-06-08 18:36:26 -07:00
Andreas Reich
9a27ba53ca
Fix QuerySet ownership of ComputePass (#5671)
* add new tests for checking on query set lifetime

* Fix ownership management of query sets on compute passes for write_timestamp, timestamp_writes (on desc) and pipeline statistic queries

* changelog entry
2024-06-04 07:47:27 +00:00
Andreas Reich
aa2821bff6
Reintroduce computepass->encoder lifetime constraint and make it opt-out via wgpu::ComputePass::forget_lifetime (#5768)
* Reintroduce computepass->encoder lifetime constraint and make it opt-out via `wgpu::ComputePass::make_static`

* improve comments based on review feedback

* use the same lifetime name for all usages of `ComputePass<'encoder>`

* comment improvement that I missed earlier

* more review based comment improvements

* use suggested zero-overhead lifetime removal

* rename make_static to forge_lifetime

* missed comma
2024-06-03 20:04:12 +02:00
Brad Werth
9b7a965667 Add an experimental vertex pulling flag to Metal pipelines.
This proves a flag in msl::PipelineOptions that attempts to write all
Metal vertex entry points to use a vertex pulling technique. It does
this by:

1) Forcing the _buffer_sizes structure to be generated for all vertex
entry points. The structure has additional buffer_size members that
contain the byte sizes of the vertex buffers.
2) Adding new args to vertex entry points for the vertex id and/or
the instance id and for the bound buffers. If there is an existing
@builtin(vertex_index) or @builtin(instance_index) param, then no
duplicate arg is created.
3) Adding code at the beginning of the function for vertex entry points
to compare the vertex id or instance id against the lengths of all the
bound buffers, and force an early-exit if the bounds are violated.
4) Extracting the raw bytes from the vertex buffer(s) and unpacking
those bytes into the bound attributes with the expected types.
5) Replacing the varyings input and instead using the unpacked
attributes to fill any structs-as-args that are rebuilt in the entry
point.

A new naga test is added which exercises this flag and demonstrates the
effect of the transform. The msl generated by this test passes
validation.

Eventually this transformation will be the default, always-on behavior
for Metal pipelines, though the flag may remain so that naga
translation tests can be run with and without the tranformation.
2024-05-30 13:08:59 +02:00
Andreas Reich
588950110a
Remove lifetime dependency of ComputePass to its parent command encoder (#5620)
* lift encoder->computepass lifetime constraint and add now failing test
* compute passes now take an arc to their parent command encoder, thus removing compile time dependency to it
* Command encoder goes now into locked state while compute pass is open
* changelog entry
* share most of the code between get_encoder and lock_encoder
2024-05-29 22:43:24 +00:00
Erich Gubler
ccccffda19 test: migrate tests for specific validation err. msgs. 2024-05-21 17:16:06 -04:00
Erich Gubler
3b1e8da1b1 style: use concat!(…)'d string for DIFFERENT_BGL_ORDER_BW_SHADER_AND_API 2024-05-21 17:16:06 -04:00
Erich Gubler
94dba0b026 test: add expected msg. arg. to wgpu_test::fail{,_if} 2024-05-21 17:16:06 -04:00
Erich Gubler
18b758e388 test: ensure render pipelines have at least 1 target 2024-05-17 17:45:03 -04:00
Daniel McNab
4902e470ce
Pipeline cache API and implementation for Vulkan (#5319)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-05-16 13:52:56 +00:00
Andreas Reich
77a83fb0dd
Remove lifetime constraints from wgpu::ComputePass methods (#5570)
* basic test setup

* remove lifetime and drop resources on test - test fails now just as expected

* compute pass recording is now hub dependent (needs gfx_select)

* compute pass recording now bumps reference count of uses resources directly on recording

TODO:
* bind groups don't work because the Binder gets an id only
* wgpu level error handling is missing

* simplify compute pass state flush, compute pass execution no longer needs to lock bind_group storage

* wgpu sided error handling

* make ComputePass hal dependent, removing command cast hack. Introduce DynComputePass on wgpu side

* remove stray repr(C)

* changelog entry

* fix deno issues -> move DynComputePass into wgc

* split out resources setup from test
2024-05-14 20:05:17 +00:00
Vladislav
00456cfb37 Add parsing support for un/pack4xI/U8 2024-05-14 17:57:04 +02:00
Andreas Reich
452cf24fa1
Remove unnecessary Cargo.toml dependencies via cargo machete (#5692) 2024-05-12 19:05:00 -04:00
Jim Blandy
e5201a7267 When a #[gpu_test] test fails, print its source location.
Use `std::panic::Location` to record the source location of each
`#[gpu_test]` test, and if it fails, include that in the error output.
This is not essential, but it should make working with failures a bit
more comfortable.
2024-05-01 17:08:22 -07:00
Connor Fitzgerald
90e7060d0d Fix Failure Case for MacOS 14.3 2024-04-29 12:01:05 +02:00
stefnotch
f874ed061c
Add get_compilation_info (#5410)
* Add get_compilation_info API

* Rename glsl ParseError to ParseErrors

* Document ParseError label order

* Update line_position to count UTF-8 bytes
2024-04-29 11:35:36 +02:00
Connor Fitzgerald
c1291bd131
Fix Merge Issues Between #5301 and #5508 (#5549) 2024-04-17 16:31:20 -04:00
Daniel McNab
965b00c06b
Allow configuring whether workgroup memory is zero initialised (#5508) 2024-04-17 15:50:31 -04:00
Alexander Meißner
ea77d5674d
Subgroup Operations (#5301)
Co-authored-by: Jacob Hughes <j@distanthills.org>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: atlas dostal <rodol@rivalrebels.com>
2024-04-17 15:25:52 -04:00
teoxoy
3bda381812 add pipeline constants plumbing 2024-04-05 18:07:41 +02:00
Erich Gubler
0c5bebca51 fix: unlock guard for release_gpu_resources call in Device::maintain 2024-04-02 16:12:28 -04:00
Erich Gubler
b842265528 test: don't depend on BG{,L} entry order in HAL 2024-04-01 17:51:36 -04:00
Andreas Reich
ed7d9de439
Fix indexed drawing with RenderBundle (#5441)
* enhance vertex_indices test to also run with render bundles

* fix render bundle index limit check

* changelog entry
2024-03-30 10:19:17 +01:00
Brad Werth
00e0e72596
Invoke a DeviceLostClosure immediately if set on an invalid device. (#5358)
Invoke a DeviceLostClosure immediately if set on an invalid device.

To make the device invalid, this defines an explicit, test-only method
make_invalid. It also modifies calls that expect to always retrieve a
valid device.

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-03-21 13:33:25 -04:00
vero
4e6f873da5
Add shader I64 and U64 support (#5154)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-03-12 12:34:06 +01:00
Eshed Schacham
8e15707631
gles: fix crash when holding multiple devices on wayland/surfaceless. (#5351) 2024-03-10 21:12:51 +01:00
Nathan Adams
f78e2f7800
GL actually supports DEPTH32FLOAT_STENCIL8 (#5370) 2024-03-10 20:56:58 +01:00
dependabot[bot]
744454b9e2
Bump Many Dependencies and MSRV (#5241)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-02-27 14:43:05 -05:00
Nicolas Silva
c77b4d3f56
Use a unique tracker index per resource instead of the ID in trackers (#5244)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-02-26 20:25:12 +00:00
Erich Gubler
d6465702b6 fix: command_encoder_clear_buffer: err. on offset + size > u64::MAX
Rust would have made this operation either an overflow in release mode,
or a panic in debug mode. Neither seem appropriate for this context,
where I suspect an error should be returned instead. Web browsers, for
instance, shouldn't crash simply because of an issue of this nature.
Users may, quite reasonably, have bad arguments to this in early stages
of development!
2024-02-26 09:32:26 -05:00
Erich Gubler
9747a0ed23 fix: always check buffer clear offset for OOB
Fuzz testing in Firefox encountered crashes for calls of
`Global::command_encoder_clear_buffer` where:

* `offset` is greater than `buffer.size`, but…
* `size` is `None`.

Oops! We should _always_ check this (i.e., even when `size` is `None`),
because we have no guarantee that `offset` and the fallback value of
`size` is in bounds. 😅 So, we change validation here to unconditionally
compute `size` and run checks we previously gated behind `if let
Some(size) = size { … }`.

For convenience, the spec. link for this method:
<https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-clearbuffer>
2024-02-26 09:32:26 -05:00
Connor Fitzgerald
910fb7c341
Remove GPU based validation in Tests (#5271)
* Remove GPU based validation in Tests

* Lol Typo
2024-02-19 17:04:03 -05:00
Connor Fitzgerald
df386dae02
Add vec3-in-array-test (#5264) 2024-02-18 12:46:29 -05:00
Erich Gubler
2b487724f2 fix(dx12): discard cmd. enc. buf. on drop 2024-02-15 10:45:32 -05:00
Nicolas Silva
e4ef3b401a
Add an advanced_debugging preset including wgpu base validation (#5248)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2024-02-13 16:42:02 +00:00
Erich Gubler
31ac63ce3e feat(vulkan): enable GPU-based validation for Vulkan backend
If [`VK_LAYER_KHRONOS_validation`] is present, and it supports
[`VK_EXT_validation_features`], we can configure it with another instance
creation info. element of type [`VkValidationFeaturesEXT`] to enable
GPU-based validation. Wire `InstanceFlags::GPU_BASED_VALIDATION` to do
this in the Vulkan backend. It's even already finding issues in our
`examples` and other tests! But…we'd like to handle those later, since
this is so important for users. So, I've broken that out to separate
issues. The instances we're aware of:

* `water` is running into sync. validation issues: see
  <https://github.com/gfx-rs/wgpu/issues/5231>
* `wgpu_test::shader::struct_layout::uniform_input` is failing to
    instrument shaders now; see
    <https://github.com/gfx-rs/wgpu/issues/5245>

It is apparent from this and the [DX12 implementation of GPU-based
validation] that we will need to communicate clearly to users that
`InstanceFlags::GPU_BASED_VALIDATION` implies
`InstanceFlags::VALIDATION`. Not all backends enforce this yet; I have
[split out this work][follow-up for flag implication].

Note that `VK_EXT_validation_features` has been deprecated in favor of
the more general layer configuration mechanism offered by
[`VK_EXT_layer_settings`].

[DX12 implementation of GPU-based validation]: https://github.com/gfx-rs/wgpu/pull/5146
[`VK_EXT_layer_settings`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_layer_settings.html
[`VK_EXT_validation_features`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_validation_features.html
[`VK_LAYER_KHRONOS_validation`]:https://vulkan.lunarg.com/doc/sdk/1.3.275.0/linux/khronos_validation_layer.html
[`VkValidationFeaturesEXT`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkValidationFeaturesEXT.html
[follow-up for flag implication]: https://github.com/gfx-rs/wgpu/pull/5232
2024-02-12 10:23:07 -05:00
David Huculak
245d2da2fd
add test that verifies that we can drop the queue before using the device to create a command encoder (#5211) 2024-02-09 12:16:48 +01:00
Jim Blandy
4af531cf69
[wgpu-core] Compute minimum binding size correctly for arrays. (#5222)
* [wgpu-core] Add tests for minimum binding size validation.

* [wgpu-core] Compute minimum binding size correctly for arrays.

In early versions of WGSL, `storage` or `uniform` global variables had
to be either structs or runtime-sized arrays. This rule was relaxed,
and now globals can have any type; Naga automatically wraps such
variables in structs when required by the backend shading language.

Under the old rules, whenever wgpu-core saw a `storage` or `uniform`
global variable with an array type, it could assume it was a
runtime-sized array, and take the stride as the minimum binding size.
Under the new rules, wgpu-core must consider fixed-sized and
runtime-sized arrays separately.
2024-02-09 03:08:01 +00:00
Jim Blandy
07e59eb6fc
[wgpu-core] Add tests for minimum binding size validation. (#5220) 2024-02-08 10:55:18 +01:00
Connor Fitzgerald
faed98b45c
Add typos to Repository CI (#5191)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-02-05 12:30:29 -05:00
Andreas Reich
87b6513df3
Update docs for Backend and implement std::fmt::Display (#5170)
* Update docs for `Backend` and implement `std::fmt::Display`

* Update wgpu-types/src/lib.rs

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

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-02-01 00:24:12 +00:00
Brad Werth
0888a630a0
Call device lost callback when it is replaced, or when the global is dropped. (#5168)
This fixes two cases where a DeviceLostClosureC might not be consumed
before it is dropped, which is a requirement:

1) When the closure is replaced, this ensures the to-be-dropped closure
is invoked.
2)  When the global is dropped, this ensures that the closure is invoked
before it is dropped.

The first of these two cases is tested in a new test,
DEVICE_LOST_REPLACED_CALLBACK. The second case has a stub,
always-skipped test, DROPPED_GLOBAL_THEN_DEVICE_LOST. The test is
always-skipped because there does not appear to be a way to drop the
global from within a test. Nor is there any other way to reach
Device.prepare_to_die without having first dropping the device.
2024-01-31 08:15:45 +01:00
Bude
4face1c2ba
Feature/serde feature (#5149)
* Add serde, serialize, deserialize features to wgpu and wgpu-core
Remove trace, replay features from wgpu-types

* Do not use trace, replay in wgpu-types anymore

* Make use of deserialize, serialize features in wgpu-core

* Make use of serialize, deserialize features in wgpu

* Run cargo fmt

* Use serde(default) for deserialize only

* Fix serial-pass feature

* Add a comment for new features

* Add CHANGELOG entry

* Run cargo fmt

* serial-pass also needs serde features for Id<T>

* Add feature documentation to lib.rs docs

* wgpu-types implicit serde feature

* wgpu-core explicit serde feature

* wgpu explicit serde feature

* Update CHANGELOG.md

* Fix compilation with default features

* Address review comments
2024-01-28 20:13:04 +00:00
Nicolas Silva
b0e4734a7e Differentiate between device loss caused by an error and caused by dropping the device 2024-01-24 13:41:23 +01:00
Nicolas Silva
96b1e162c5 Request INDIRECT_FIRST_INSTANCE feature in vertex_indices test 2024-01-24 13:02:11 +01:00
Teodor Tanasoaia
f9509bcf9e
[d3d12] use plane 1 for stencil only views (#5100)
* [d3d12] use plane 1 for stencil only views

* add test

* skip stencil only view creation on WebGL
2024-01-19 21:42:19 +00:00
John-John Tedro
adf1e3b6c5
Improve test feedback and implementation (#5068) 2024-01-17 16:50:39 -05: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
Connor Fitzgerald
ad625f433f
Convert Tests to Use Async Poll (#5053)
* Convert Tests to Use Async Poll

* Update examples/src/repeated_compute/mod.rs

Co-authored-by: Andreas Reich <r_andreas2@web.de>

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-01-13 17:34:51 +00:00
Nicolas Silva
376d901d1e
Triage suspected resources after triaging submissions (#5050) 2024-01-12 13:19:19 -05:00
Andreas Reich
4fd4a7142e
Unify surface creation by introducing new SurfaceTarget enum (#4984) 2024-01-11 22:24:01 -05:00
Jim Blandy
8af6975d5e
Prefer Arc::into_inner over Arc::try_unwrap. (#5018) 2024-01-08 19:24:33 -05:00
Connor Fitzgerald
a01ff0741c
Re-Enable Mac CI (#5015) 2024-01-08 16:12:57 -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
Connor Fitzgerald
e26a853654
BGL Weak Pointer Deduplication Pool (#4927)
* Ho boy

* BGL pool finished

* Remove id32 feature

* Add BGL Test

* Iteration

* Working Dedupe

* Tests

* Iteration

* Re-iteration

* Hash Cleanup

* Add large slew of tests

* Whoops
2024-01-02 09:27:22 -05:00
Connor Fitzgerald
79e5169255
Add BGL Deduplication Index Test (#4914) 2023-12-21 12:16:20 -05: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
Nicolas Silva
aade481bdf
Remove some locks in BindGroup (#4894)
* Remove some locks in BindGroup

These are only written to clear the vectors when triaging bindgroups for destruction, which is not necessary. We can let the reference counts drop when the bind group is dropped.

* Make the mem_leak test pass again
2023-12-19 10:29:32 +01:00
Teodor Tanasoaia
0cbabcf229
Update multi-planar texture API (#4837) 2023-12-07 14:06:56 -05:00
Valaphee The Meerkat
a1fafe394f
Remove DX11 backend (#4828) 2023-12-06 15:12:46 -05:00
Almar Klein
32c5a22293
Add feature float32-filterable (#4759) 2023-12-04 14:23:13 +01:00
teoxoy
da73522720 rename DeviceDescriptor.limits to DeviceDescriptor.required_limits 2023-11-29 19:55:18 +01:00
teoxoy
9be6c8890f rename DeviceDescriptor.features to DeviceDescriptor.required_features 2023-11-29 19:55:18 +01:00
Xiaopeng Li
a6503e59c9
Support nv12 texture format (#4573)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-11-28 16:11:26 +00:00
Jacob Hughes
f9711831d2 Rename gpu.rs to root.rs 2023-11-28 10:46:28 -05:00
Jacob Hughes
00a8a9f89f Delete root.rs so git recognizes rename in following commit 2023-11-28 10:46:28 -05:00
Mauro Gentile
2c67f79970
Remove resources ONLY when needed inside wgpu and not in user land (#4782) 2023-11-27 13:09:50 +01:00
Connor Fitzgerald
4f24c31765
Fixes for Skybox and All Examples (#4780) 2023-11-27 11:40:37 +01:00
Connor Fitzgerald
7a37229630
Revamp Examples to Match Website (#4765)
* Revamp examples to match website

* Small fixes

* Fix stencil_triangles on resize

* Fix

* Fix everything
2023-11-25 17:20:11 -05:00
Connor Fitzgerald
06e9876adf
Move to A Single Example Executable (#4756)
* Move to combined examples

* Fix paths

* Curtail some tests

* Format

* Clippy

* Fix wasm

* Refactor main for wasm

* Style sheet

* Readme

* Lock
2023-11-23 05:26:42 -05:00
Connor Fitzgerald
3c261f3652
Allow Tests to Expect Certain Panic or Validation Messages (#4748) 2023-11-23 03:49:01 -05: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
30d67a329a
Skip Flaky Test (#4746) 2023-11-21 23:26:37 -05: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
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
Nicolas Silva
a697e4352c
Keep the value in its storage after destroy (#4678)
* Keep the value in its storage after destroy

in #4657 the destroy implementation was made to remove the value from the storage and leave an error variant in its place.
Unfortunately this causes some issues with the tracking code which expects the ID to be unregistered after the value has been fully destroyed, even if the latter is not in storage anymore.
To work around that, this commit adds a `Destroyed` variant in storage which keeps the value so that the tracking behavior is preserved while
still making sure that most accesses to the destroyed resource lead to validation errors.

... Except for submitted command buffers that need to be consumed right away. These are replaced with `Element::Error` like before this commit.

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-11-14 14:23:23 +00:00
Jim Blandy
049cb75976 [wgpu-test] Fix typo in error message. 2023-11-13 14:23:32 -08: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
Connor Fitzgerald
7f72c9fc3b
Fix GL Push Constant Layout (#4607)
* It verks!

* More tests

* Fixes

* Working multi-stage push constants

* Comments

* Add push constant partial update teste

* Docs

* Update Cargo.toml

* Comments
2023-11-06 07:58:26 -05:00
Connor Fitzgerald
2aa7c29068
Extra Profiling Scopes (#4610) 2023-10-30 03:58:32 +00:00
Connor Fitzgerald
2a9fdf9aa1
Misc Repo Cleanup Tasks (#4579)
* Misc Repo Cleanup Tasks

* Dependency Trimming

* Dep cleanup

* Restrict libfuzzer

* Flip cfg

* mod fuzz
2023-10-27 00:15:51 -04:00
Connor Fitzgerald
ca7ac86ccd
DXC on DX12 in CI (#4571) 2023-10-26 04:01:38 -04:00
Connor Fitzgerald
04ac5f2851
Update WARP and Install Mesa on Windows CI (#4270) 2023-10-22 00:34:00 -04:00
Connor Fitzgerald
543f921639
GPU Test Framework (#3873) 2023-10-19 12:06:42 -04: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
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
Nicolas Silva
f95d1c55e3
Expose Instance flags (#4230)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2023-10-11 17:39:04 +00: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
422c636877
Add Rgb10a2Uint format (#4199) 2023-10-03 14:56:21 +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
Jim Blandy
3666f1aef8
Add test case for #4167, marked as an expected failure. (#4168) 2023-09-25 19:55:55 -04: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