Commit Graph

641 Commits

Author SHA1 Message Date
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
Andreas Reich
cbace631ec
Fix surfaces only compatible with first enabled backend (#5535) 2024-04-17 15:32:04 -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
Valaphee The Meerkat
0dc9dd6bec
Prefer OpenGL over OpenGL ES (#5482)
* Prefer OpenGL over OpenGL ES

* Fix sRGB on egl

* Check if OpenGL is supported

* Add changelog entry

* Remove expected failure for OpenGL Non-ES,  add comment explaining FRAMEBUFFER_SRGB, add driver info to AdapterInfo

* Fix draw indexed

* CI host doesn't seem to support Rg8Snorm and Rgb9eUfloat clearing
2024-04-16 22:57:33 +02:00
vero
911baf3e8c
Add DirectX ShaderModel 6.1-6.7 detection (#5498) 2024-04-06 11:35:59 +02:00
vero
1c48a23cff
Add Metal 3.0 and 3.1 detection (#5497) 2024-04-05 19:22:33 +02:00
teoxoy
b985f16ac2 add changelog entry 2024-04-05 18:07:41 +02:00
Erich Gubler
fb305b85f6 docs: add warning about stack size for WGSL compilation 2024-04-03 15:54:43 -04:00
Erich Gubler
b21a3265de fix(wgsl-in)!: limit brace recursion 2024-04-03 15:54:43 -04:00
Chase MacDonnell
3db0e46f7d
Implement Unorm10_10_10_2 VertexFormat (#5477) 2024-04-03 19:43:54 +00:00
JMS55
ed843f8029
Add more hal methods (#5452)
* Add return value to Texture::as_hal()

* Add TextureView::as_hal()

* Add CommandEncoder::as_hal_mut()

* Add changelog

* Add TextureView::raw_handle()

* Add CommandEncoder::raw_handle()

* Add additional docs for command_encoder_as_hal_mut
2024-04-03 00:37:18 +02:00
Dzmitry Malyshau
5bab673926 Update CHANGELOG for the spv-out arrayLength feature 2024-04-02 19:22:34 +02:00
Vecvec
1ead28701d
Fix unused acceleration structures causing invalid SPIR-V (#5463) 2024-04-02 11:06:28 +00:00
Erich Gubler
1144b065c4 style(readme): adjust whitespace to match previous entries 2024-04-01 17:51:36 -04:00
Erich Gubler
d12e89c483 fix(metal): don't depend on BG{,L} entry order
This isn't guaranteed by `wgpu-core`; we should try to match by binding
slot index instead.
2024-04-01 17:51:36 -04:00
Erich Gubler
74f514ca6b fix(gles): don't depend on BG{,L} entry order
This isn't guaranteed by `wgpu-core`; we should try to match by binding
slot index instead.
2024-04-01 17:51:36 -04:00
Erich Gubler
4fa2fbb5aa fix(dx12): don't depend on BG{,L} entry order
This isn't guaranteed by `wgpu-core`; we should try to match by binding
slot index instead.
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
李祥煜
b34219ca21
Implement the device_set_device_lost_callback method for ContextWebGpu (#5438)
* impl device_set_device_lost_callback for ContextWebGpu

* merge changelog

---------

Co-authored-by: lixiangyu.ava <lixiangyu.ava@bytedance.com>
2024-03-26 15:12:50 +00:00
Lukas Herzberger
a9ccbc7dea
Add support for storage texture access modes ReadOnly and ReadWrite on WebGPU backend (#5434)
* add support for all storage texture access modes

* update changelog

* fix typo
2024-03-26 14:57:24 +01:00
Sludge
6b996dd9c7
Avoid recursive snatch lock acquisitions (#5426)
* Avoid recursive snatch lock acquisitions

* Always acquire the snatch lock before the fence lock

* Address review comments

* Add changelog entry
2024-03-23 21:29:00 +01:00
robtfm
ed95dfe9b4
Pool tracker vecs (#5414)
* pool tracker vecs

* pool

* ci

* move pool to device

* use pool ref, cleanup and comment

* suspect all the future suspects (#5413)

* suspect all the future suspects

* changelog

* changelog

* review feedback

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2024-03-23 11:42:08 +00: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
robtfm
152a94bc6c
suspect all the future suspects (#5413)
* suspect all the future suspects

* changelog
2024-03-18 10:53:41 -04:00
Andreas Reich
e68e62801f
Add patch release notes from 0.19.1/2/3 and remove redundant changelog entries (#5405) 2024-03-16 18:47:56 -04:00
Bruce Mitchener
fe91958010
Give short example of WGSL push_constant syntax. (#5393) 2024-03-15 21:20:21 -04:00
Patrick Cleavelin
a63bec8cd6 add cli arg to choose metal version 2024-03-15 10:39:40 +01:00
stefnotch
6a5418b93f
Fix 5385 by updating the documentation (#5386)
* Fix 5385 by updating the documentation

* Update changelog
2024-03-13 21:30:50 -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
caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaat
5e1227343a
docs: mention primitive restart in the description of strip_index_format (#5350)
* docs: mention primitive restart in the description of strip_index_format

* update changelog for #5350
2024-03-09 10:20:23 +01:00
Nathan Adams
2234fd681d
Cache MAX_SAMPLES on gles backend (#5346) 2024-03-09 10:16:31 +01:00
Nathan Adams
f86898ffeb
Don't create shader-clear program on GLES if it's not needed (#5348)
* Store GLES shader clear program in its own struct

* Make shader_clear_program optional on GLES, only created if needed
2024-03-08 20:36:12 +01:00
Erik Zivkovic
d417433e0c Naga: GLSL 410 does not support layout(binding = ...)
Naga assumed that GLSL 410 supported layout(binding = ...) but it does not,
it only supports layout(location = ...). It is not possible to enable only
layout(location = ...) currently, so we need to predicate the feature on GLSL
420 instead.
2024-03-07 12:28:26 +01:00
Daniel McNab
5162fd440d Add a changelog entry 2024-03-06 12:47:42 -08:00
multisn8
badb3c88ea
feat: const feature defaults (#5343)
* feat: make downlevel feature defaults const

* docs: add 5343 to changelog
2024-03-05 15:01:38 +01:00
Erik Živković
19cc9d9776
Revert "Add OpenGL support for TEXTURE_FORMAT_16BIT_NORM on supported versions (#5330)" (#5339)
This reverts commit 352cb3d40b.
2024-03-04 09:19:57 +01:00
Erik Živković
352cb3d40b
Add OpenGL support for TEXTURE_FORMAT_16BIT_NORM on supported versions (#5330) 2024-03-03 21:38:38 +00:00
Erik Živković
f0ed4cf520
Add support for running on OpenGL 4.1 with a core profile on macOS (#5331)
When running wgpu with an OpenGL context on macOS that is created with a core
profile and with the forward-compatibility bit set, the MAX_VARYING_COMPONENTS
constant returns 0 when queried. The default value is 60, so we return the
default value if the query returns 0.

We also need to use `#version 140` on macOS since `#version 130` isn't accepted.
Since `#version 140` should be available from OpenGL 3.1, we use that everywhere.
That way we don't need any specific macOS flags or features.
2024-03-03 22:22:20 +01:00
Eshed Schacham
2d8d045453
wgpu-hal: add ndk-sys dependency to fix linking error. (#5326) 2024-03-01 21:16:09 +00:00
Connor Fitzgerald
aaf6db6a3d
Vendor WebGPU Bindings from web_sys (#5325) 2024-03-01 21:13:14 +00:00
Connor Fitzgerald
a5c0181c3a
Bitfield Fixes (#5305) 2024-02-29 20:50:42 +00:00
Connor Fitzgerald
8129897ccb Nested loop test 2024-02-28 13:54:27 +01:00
Erich Gubler
023b0e063f feat!: make ProgrammableStage::entry_point optional in wgpu-core 2024-02-27 13:57:17 -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
Connor Fitzgerald
38419a9cf2
Fix Integer Clamp (#5300)
* Fix Integer Clamp

* Changelog
2024-02-26 20:28:23 +01: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
Bartłomiej Maryńczak
2e9ee0aa56
[wgpu-hal.gles] Error log for failed GLES heuristics (#5266)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-02-19 20:33:47 +00:00
Nicolas Silva
004e3efe84
Simplify the ID allocation in IdentityValues (#5229)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2024-02-15 20:55:55 +00:00
Imbris
b704132b4c Remove unnecessary "gl_PerVertex" name check so unused builtins will be
handled even when this name is not in the input SPIRV.
2024-02-15 18:12:25 +01:00
Erich Gubler
18b7904b8e fix: discard cmd. enc. buf. on wgpu_core::Global::command_encoder_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
Andreas Reich
f350f28c35
Separate native-only feature for wgpu::CommandEncoder::write_timestamp (#5188)
* split out TIMESTAMP_QUERY_INSIDE_ENCODERS from TIMESTAMP_QUERY

* changelog entry

* update changelog change number

* fix web warnings

* single line changelog

* note on followup issue
2024-02-13 16:03:33 +00:00
Erich Gubler
95c026b2df docs: note that GPU_BASED_VALIDATION implies VALIDATION 2024-02-12 10:23:07 -05: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
Bruce Mitchener
665c075fa0
Remove TextureInner::Surface::has_work. (#5200)
When no work is submitted for a frame, presenting the surface results
in a timeout due to no work having been submitted.

Fixes #3189.

This flag was added in #1892 with a note that it was going to be
temporary until #1688 landed.
2024-02-09 11:36:24 +00: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
Christian Schwarz
2382c8e74f
Fix glsl backend errors regarding samplerCubeArrayShadow (#5171)
* add GL_EXT_texture_shadow_lod feature detection

* allow more cases of cube depth texture sampling in glsl

* add test for sampling a cubemap array depth texture with lod

* add test for chosing GL_EXT_texture_shadow_lod over the grad workaround if instructed

* add changelog entry for GL_EXT_texture_shadow_lod

* fix criteria for requiring and using TEXTURE_SHADOW_LOD

* require gles 320 for textureSampling over cubeArrayShadow

* prevent false positives in TEXTURE_SHADOW_LOD in checks

* make workaround_lod_with_grad usecase selection less context dependant

* move 3d array texture error into the validator

* correct ImageSample logic errors
2024-02-08 18:27:58 +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
Connor Fitzgerald
d0c52d70fd
Ord for Id (#5176) 2024-02-01 09:29:34 +01:00
Andreas Reich
62cc81cbfd
Allow wgpu::Instance to report which backends were enabled (#5167)
* Replace `Instance::any_backend_feature_enabled` with `Instance::enabled_backend_features` which reports all available backends instead of just reporting if none is available.

* add changelog entry

* update enabled_backend_features in doc

* fix not enabling any backend on android, fix related doc issues
2024-01-31 09:17:59 +00:00
Andreas Reich
45957088ad
Fix panic when creating a surface while no backend is available (#5166)
* Fix panic when creating a surface while no backend is available

* changelog entry
2024-01-31 08:48:33 +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
Erich Gubler
c28466cc21 feat: make GPU-based validation opt-in with new InstanceFlags::GPU_BASED_VALIDATION 2024-01-30 21:57:01 -05:00
Erich Gubler
c559be933b feat(const_eval): impl. min 2024-01-30 10:53:03 +01:00
Erich Gubler
abcc6ddff3 feat(const_eval): impl. max 2024-01-30 10:53:03 +01:00
Erich Gubler
18f50092a6 feat(const_eval): impl. trunc 2024-01-30 10:53:03 +01:00
Erich Gubler
2d3005b745 feat(const_eval): impl. sign with new component_wise_signed 2024-01-30 10:53:03 +01:00
Erich Gubler
0bd5f77601 feat(const_eval): impl. reverseBits 2024-01-30 10:53:03 +01:00
Erich Gubler
7dedd002c0 feat(const_eval): impl. radians 2024-01-30 10:53:03 +01:00
Erich Gubler
e6f6eb7036 feat(const_eval): impl. log2 2024-01-30 10:53:03 +01:00
Erich Gubler
39cb92cf88 feat(const_eval): impl. log 2024-01-30 10:53:03 +01:00
Erich Gubler
4db02d1962 feat(const_eval): impl. fract 2024-01-30 10:53:03 +01:00
Erich Gubler
fc04518750 feat(const_eval): impl. inverseSqrt 2024-01-30 10:53:03 +01:00
Erich Gubler
19f5e4d5e4 feat(const_eval): impl. fma 2024-01-30 10:53:03 +01:00
Erich Gubler
7b274fc161 feat(const_eval): impl. exp2 2024-01-30 10:53:03 +01:00
Erich Gubler
0f8adae123 feat(const_eval): impl. degrees 2024-01-30 10:53:03 +01:00
Erich Gubler
01d02caca3 feat(const_eval): impl. exp 2024-01-30 10:53:03 +01:00
Erich Gubler
66fd1872ab feat(const_eval): impl. countTrailingZeros 2024-01-30 10:53:03 +01:00
Erich Gubler
2ccc4f49ee feat(const_eval): impl. countOneBits 2024-01-30 10:53:03 +01:00
Erich Gubler
ea044f039c feat(const_eval): impl. countLeadingZeros with new component_wise_concrete_int 2024-01-30 10:53:03 +01:00
Erich Gubler
7f70df0c47 feat(const_eval): impl. floor 2024-01-30 10:53:03 +01:00
Erich Gubler
a05cc37e3c feat(const_eval): impl. ceil 2024-01-30 10:53:03 +01:00
Nicolas Silva
6e020a079e
Fix the validation for vertex limits for regular render passes (#5156) 2024-01-29 14:01:03 +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
vero
0003db18c4
Refactor tests to be feature flag bit-width agnostic (#5155) 2024-01-28 01:42:02 +00:00
Okko Hakola
b3490de69d
[d3d12] Avoid panic on instance drop (#5134) 2024-01-24 12:49:18 +01:00
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