Commit Graph
228 Commits
Author SHA1 Message Date
Kent Slaney 2fac7fa954 [naga] Correct override resolution in array lengths.
When the user provides values for a module's overrides, rather than
replacing override-sized array types with ordinary array types (which
could require adjusting type handles throughout the module), instead
edit all overrides to have initializers that are fully-evaluated
constant expressions. Then, change all backends to handle
override-sized arrays by retrieving their overrides' values.

For arrays whose sizes are override expressions, not simple references
to a specific override's value, let front ends built array types that
refer to anonymous overrides whose initializers are the necessary
expression.

This means that all arrays whose sizes are override expressions are
references to some `Override`. Remove `naga::PendingArraySize`, and
let `ArraySize::Pending` hold a `Handle<Override>` in all cases.

Expand `tests/gpu-tests/shader/array_size_overrides.rs` to include the
test case that motivated this approach.
2025-03-06 14:21:40 -08:00
Vecvec 5b3266db23 Support getting hit vertex positions (#7183) 2025-03-04 20:06:44 +01:00
Connor Fitzgerald 99437e7343 Turn dependency tests from xtask subcommand into #[test]s (#7220) 2025-02-27 05:22:08 +00:00
Connor Fitzgerald 8fb09a5ad6 Move REPO_MSRV to 1.85 (#7218) 2025-02-24 23:39:34 -05:00
Connor Fitzgerald 8a4e50f1a0 Rename tests/validation_tests to tests/validation-tests 2025-02-23 14:06:34 -05:00
Connor Fitzgerald 31eb329748 Make tests/compile_tests into tests/compile-tests 2025-02-23 14:06:34 -05:00
Connor Fitzgerald c4114e7347 Rename tests/tests to tests/gpu-tests 2025-02-23 14:06:34 -05:00
Connor Fitzgerald ab0e4b1b6f Refactor Validation Tests a Bit (#7199) 2025-02-23 12:57:19 -05:00
Jamie Nicol 7e42040fa5 Add validation tests ensuring destroyed textures and buffers cause submission to fail (#7181) 2025-02-19 10:09:17 -05:00
Connor Fitzgerald e590555a8c test: use spirv-as instead of pre-assembled SPIR-V (#7157) 2025-02-17 14:48:09 -05:00
Connor Fitzgerald 194d4b1f36 New Binding Array Limit (#6952) 2025-02-17 09:22:24 -05:00
Kevin Reid 9da04c2b0b Add getters and From implementations to BufferSlice. (#7148)
* Add getters to `BufferSlice` to obtain its parts.

* Add conversions from `BufferSlice` to `BufferBinding` and `BindingResource`.
2025-02-17 11:06:13 +01:00
Connor Fitzgerald d8833d0798 Use Update After Bind Descriptors for Bind Groups With Binding Arrays (#6815)
* Use Update After Bind Descriptors for Bind Groups With Binding Arrays

Update After Bind

x

* Comments

* Fix URL
2025-02-15 12:02:27 -05:00
Connor Fitzgerald 7e119968ce Properly Deal with Timeouts (#7030) 2025-02-14 23:19:51 +00:00
Connor Fitzgerald 106b709798 Remove HashMaps from wgpu API (#7133)
* Remove HashMaps from Surface API

* Fix Comments and Errors
2025-02-14 14:36:22 -05:00
Kevin Reid c4b25b8794 Duplicate BufferSlice methods onto Buffer and vice versa. (#7123)
This allows users to skip creation of `BufferSlice` if they have no use
for it, and brings `wgpu` closer to the WebGPU API without removing any
Rust convenience. New functions:

* `BufferSlice::slice()`
* `Buffer::map_async()`
* `Buffer::get_mapped_range()`
* `Buffer::get_mapped_range_mut()`
* `Buffer::get_mapped_range()`
2025-02-13 14:40:09 +01:00
Kevin Reid 0f111cb27c Add a test for the noop backend. 2025-02-12 22:31:47 -05:00
Kevin Reid 118a985ccd Allow creating Noop backend through the normal mechanisms. 2025-02-12 22:31:47 -05:00
Vecvec 5af9e30009 Fix HLSL single scalar loads (#7104) 2025-02-12 18:05:32 +00:00
VecvecandNicolas Silva 0922631125 Fix transform buffer when building blas (#7062)
Co-authored-by: Nicolas Silva <nical@fastmail.com>
2025-02-10 20:18:41 -05:00
Vecvec 6558deb204 Split up features. (#6905)
Splits up features into wgpu & webgpu features.
2025-02-08 17:38:06 +01:00
Vecvec d34707ec3f Rename instance_id & instance_custom_index to instance_index & instance_custom_data (#6780) 2025-02-05 18:23:22 +01:00
Vecvec 7cde4707ec Fix hlsl storage format generation (#6993) 2025-01-31 16:31:03 +01:00
Connor Fitzgerald 8caefceb8e Add rust-version to more crates (#7036) 2025-01-31 10:33:10 +01:00
@brody4hire - C. Jonathan Brody ea4d18c108 cleanup: resolve spelling errors in test comments (#7028) 2025-01-29 23:49:26 +00:00
@brody4hire - C. Jonathan BrodyandConnor Fitzgerald df54acc05d use hashbrown in more crates (etc.) (#6938)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-27 11:50:33 -05:00
0fc0b35899 Transition resources (#6678)
* WIP

* Fix typo

* WIP: Implement structure of  command_encoder_transition_resources

* WIP

* More work

* Clippy

* Fix web build

* Use new types for API, more docs

* Add very basic test

* Try to fix test cfg

* Fix merge

* Missed commit

* Use wgt types instead of hal types

* Implement `Clone` for `ShaderModule` (#6939)

* Move to dispatch trait, move more things to wgt

* Move existing code to use new wgt types

* Fixes

* Format import

* Format another file

* Fixes

* Make module private

* Fix imports

* Fix test imports

* Rexport types

* Fix imports

* Fix import

---------

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-24 00:54:19 -05:00
Connor Fitzgerald d8e7ab1ad1 Refactor Cargo.toml Significantly (#6980) 2025-01-23 22:49:48 +00:00
Teodor Tanasoaia a8bd1fe1ac [d3d12] bound check dynamic buffers (#6931)
To achieve this for dynamic storage buffers we changed the way we bind them. They now go in root tables and we pass the offset via a root constant.
2025-01-23 17:18:36 +00:00
Connor Fitzgerald a1fc4a0316 Allow Short Circuting GL Fences (#6942) 2025-01-21 19:28:14 +00:00
Connor Fitzgerald 436f716715 Unconditionally Generate Bindless Samplers in DX12 (#6766) 2025-01-21 14:24:03 -05:00
Connor Fitzgerald 4ed5021996 Ban Dynamic Offsets and Binding Arrays in the Same Bind Group (#6811)
* Ban Dynamic Offsets and Binding Arrays in the Same Bind Group

* Add Tests and Uniform Buffer Restriction
2025-01-20 13:28:32 -05:00
Andreas Reich 426c1d364f Fix missing wgt re-export on wgpu for CopyExternalImageDestInfo (#6962) 2025-01-20 18:00:34 +00:00
VecvecandConnor Fitzgerald bdef8c0407 [spirv] Stop naga causing undefined behavior in rayQueryGet*Intersection (#6752)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-17 00:04:33 +00:00
Connor Fitzgerald 0f37714fb8 Separate Out Backend Options into Individual Structs (#6895) 2025-01-15 17:32:15 +00:00
atlv be95178709 64 bit image atomics (#5537) 2025-01-15 08:05:13 -05:00
VecvecandConnor Fitzgerald 0b2c9e4f4b [Ray-tracing] Change index offset to first index (#6873)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-14 16:56:24 -05:00
Connor Fitzgerald c71d67010f Fix Features when Depending on wgpu (#6915) 2025-01-14 18:19:43 +00:00
18471d8e78 Image atomics support (#6706)
* Image atomics support

* Address feedback

* fix merge

* Fixes

* Add a couple tests

* Update wgpu-types/src/lib.rs

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

* feedback

* feedback

* glsl

* glsl fix

* fix glsl

* fix fix

* fix fix fic

* fix?

* fix

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2025-01-13 15:37:12 +00:00
AbdullahElsheshtawyandConnor Fitzgerald 55391f716d Added Texture Blitting Utility (#6852)
* Added TextureBlitter Utility

* Fixed Clippy and made TextureBlitter Public

* Written Documentation

* change cull_mode

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

* syntax error

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

* 1 formatting space in shader

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

* Applied suggestions

* fix test

* Fixed typos

* Fixed the tests

* Fixed the shader after trying it manually and looking at the output.

* Added `BlendState` customization parameter.

* Apply suggestions from code review

Documentation!

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

* Made it Load instead of Clear(Black)

* Added `TextureBlitterBuilder`

* Added feature wgsl feature flag for `pub use texture_blitter...;`

* Re-add file

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-10 22:16:01 +00:00
Erich Gubler d9cc72785b Use more Rust features allowed under REPO_MSRV (#6887)
* chore: remove `std::mem::*` imports now unnecessary with `REPO_MSRV`

`std::mem::{size,align}_of{,_val}` was added to `std::prelude` in Rust
1.80; see
[`rust`#123168](https://github.com/rust-lang/rust/pull/123168/).

* refactor(benches): s/once_cell::Lazy/std::sync::LazyLock

Weaken our dependence on the `once_cell` crate by using functionality
from `std` instead that was upstreamed from `once_cell`, this time with
what's available in Rust 1.80+.

It's not yet possible to eliminate this dependency entirely, but do what
we can with `REPO_MSRV` for now.

* chore: remove unnecessarily `allow`'d lint rules under `REPO_MSRV`

* chore: migrate easy `allow`s to `expect` under `REPO_MSRV`

Remove or `expect` clear-cut `allow` statements that were easy for me to
figure out.

* chore: `warn` on `clippy::allow_attributes` under `REPO_MSRV`
2025-01-10 22:06:26 +00:00
Connor FitzgeraldandKevin Reid 98f1c728ed Turn #6827 Into Failing Regression Test (#6883)
* Turn 6827 Into Failing Regression Test

* Update tests/tests/regression/issue_6827.rs

Co-authored-by: Kevin Reid <kpreid@switchb.org>

* Format

* Fix Paravirtual Device

* DX12 Failure

* Validation Err

* Panick

---------

Co-authored-by: Kevin Reid <kpreid@switchb.org>
2025-01-09 16:53:29 +00:00
Asher Jingkong ChenandTeodor Tanasoaia 198762e5cc feat: Add 32-bit floating-point atomics (SHADER_FLOAT32_ATOMIC) (#6234)
* feat: Add 32-bit floating-point atomics

* Current supported platforms: Metal
* Platforms to support in the future: Vulkan

Related issues or PRs:

* gfx-rs/wgpu#1020

* Add changelog

* Edit changelog

* feat: Add 32-bit float atomics support for Vulkan (SPIR-V shaders)

* atomicSub for f32 in the previous commits is removed.

* Update test

* chore: doc type link

* refactor: Revise float atomics on msl and spv

* Make branches tidy
* Also revise old codes
* Ensure the implementations are supported by Metal and Vulkan backends

* refactor: Renaming flt32 atomics to float32 atomics

* chore: Add link to Vulkan feature

* fix: cargo fmt

* chore: hack comment

* Revert changelog

* Fix: Cargo advisory

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

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

* Update naga/src/lib.rs

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

* Adjust feature flag position

---------

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2025-01-09 16:03:47 +00:00
Vecvec 658052885a Use transform_buffer_offset when initialising transform_buffer. (#6864)
* use `transform_buffer_offset` instead of `index_buffer_offset` in part of the initialisation of transform_buffer.

* Format.

* Changelog.

* Only unwrap transform alignment once.
2025-01-07 03:01:50 -05:00
Andreas Reich fb210ab363 Pass InstanceDescriptor by reference and make it clonable (#6849) 2025-01-06 15:40:30 -05:00
Connor Fitzgerald 03ff99e2c3 Implement Clone on Api Types and Arc Dispatcher (#6665) 2025-01-02 19:30:47 -05:00
Connor Fitzgerald b38aad994a Fix Skipping Amd RT Tests (#6781) 2024-12-18 15:25:22 -05:00
Samson d63ca09c34 Add usage to TextureViewDescriptor (#6755)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-12-18 18:38:28 +01:00
Erich Gubler 964a8d99d2 chore: satisfy clippy::unnecessary_map_or (#6710)
Started firing in Rust 1.84.
2024-12-16 17:26:12 -05:00
Christofer Nolander 21ff9686a7 Add 1-component ({s,u}{int,norm}{8,16}, float16) and unorm8x4-bgra vertex formats (#6632)
* feat: add missing 8/16-bit vertex formats (and 8-bit bgra) #6614

* add tests for 1-component vertex formats (and bgra)

* metal: unpacking function for 1-component vertex formats

* test: use proper alignment for float16 vertex format

* changelog: new vertex formats
2024-12-16 10:18:50 -05:00