From f82008f96e579fa876b6113f6efd180eece7a976 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Thu, 7 Dec 2023 16:10:07 +0000 Subject: [PATCH] Bug 1868143 - Update `wgpu` to revision 767ac03245ee937d3dc552edc13fe7ab0a860eec. r=webgpu-reviewers,supply-chain-reviewers,ErichDonGubler # Changelog * #4708 Fix max_vertex_buffers validation By nical in https://github.com/gfx-rs/wgpu/pull/4708 * #4729 Remove expected failure on AMD/DX12 from msaa example By teoxoy in https://github.com/gfx-rs/wgpu/pull/4729 * #4711 [naga] Add `Literal::I64`, for signed 64-bit integer literals. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4711 * #4736 Bump serde from 1.0.192 to 1.0.193 By dependabot[bot] in https://github.com/gfx-rs/wgpu/pull/4736 * #4735 [naga]: Let `TypeInner::Matrix` hold a `Scalar`, not just a width. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4735 * #4741 [naga] Fix type error in test. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4741 * #4742 [naga]: Make snapshot tests include paths in errors. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4742 * #4723 Test And Normalize Vertex Behavior on All Backends By cwfitzgerald in https://github.com/gfx-rs/wgpu/pull/4723 * #4746 Skip Flaky Test By cwfitzgerald in https://github.com/gfx-rs/wgpu/pull/4746 * #4744 Ensure DeviceLostClosureC callbacks have null-terminated message strings By bradwerth in https://github.com/gfx-rs/wgpu/pull/4744 * #4745 [naga wgsl-in] Test hex float suffix handling corner case. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4745 * #4737 Make the command_encoder_clear_buffer's size an Option By nical in https://github.com/gfx-rs/wgpu/pull/4737 * #4701 [naga msl-out] Emit and init `struct` member padding always By ErichDonGubler in https://github.com/gfx-rs/wgpu/pull/4701 * #4701 [naga msl-out] Emit and init `struct` member padding always By ErichDonGubler in https://github.com/gfx-rs/wgpu/pull/4701 * #4701 [naga msl-out] Emit and init `struct` member padding always By ErichDonGubler in https://github.com/gfx-rs/wgpu/pull/4701 * #4701 [naga msl-out] Emit and init `struct` member padding always By ErichDonGubler in https://github.com/gfx-rs/wgpu/pull/4701 * #4733 [naga wgsl-in] Preserve type names in `alias` declarations. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4733 * #4734 [naga] Make compaction preserve named types, even if unused. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4734 * #4752 Logging cleanups in device/global.rs By nical in https://github.com/gfx-rs/wgpu/pull/4752 * #4753 Fix Mac Event Loop By cwfitzgerald in https://github.com/gfx-rs/wgpu/pull/4753 * #4754 wgpu-hal(vk): Add WGPU_ALLOW_NONCOMPLIANT_ADAPTER By i509VCB in https://github.com/gfx-rs/wgpu/pull/4754 * #4748 Allow Tests to Expect Certain Panic or Validation Messages By cwfitzgerald in https://github.com/gfx-rs/wgpu/pull/4748 * #4756 Move to A Single Example Executable By cwfitzgerald in https://github.com/gfx-rs/wgpu/pull/4756 * #4747 [naga wgsl-in] Experimental 64-bit floating-point literals. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4747 * #4747 [naga wgsl-in] Experimental 64-bit floating-point literals. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4747 * #4761 [naga] Make the `example_wgsl` test build without `wgsl-in` feature. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4761 * #4769 Conditionally lift API logging from trace to info level By nical in https://github.com/gfx-rs/wgpu/pull/4769 * #4771 Downgrade some of wgpu_core's logging level from info to trace and debug By nical in https://github.com/gfx-rs/wgpu/pull/4771 * #4760 Rename `ALLOW_NONCOMPLIANT_ADAPTER` to `ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER` By teoxoy in https://github.com/gfx-rs/wgpu/pull/4760 * #4772 Downgrade resource lifetime management log level to trace. By nical in https://github.com/gfx-rs/wgpu/pull/4772 * #4765 Revamp Examples to Match Website By cwfitzgerald in https://github.com/gfx-rs/wgpu/pull/4765 * #4774 Update examples readme files By roffs in https://github.com/gfx-rs/wgpu/pull/4774 * #4781 remove_abandoned fix By gents83 in https://github.com/gfx-rs/wgpu/pull/4781 * #4777 Bump web-sys to 0.3.65 By torokati44 in https://github.com/gfx-rs/wgpu/pull/4777 * #4780 Fixes for Skybox and All Examples By cwfitzgerald in https://github.com/gfx-rs/wgpu/pull/4780 * #4782 Remove resources ONLY when needed inside wgpu and not in user land By gents83 in https://github.com/gfx-rs/wgpu/pull/4782 * #4786 Don't keep a strong ref in storage for destroyed resources By gents83 in https://github.com/gfx-rs/wgpu/pull/4786 * #4795 Fix Arcanization changelog By a1phyr in https://github.com/gfx-rs/wgpu/pull/4795 * #4794 Delete/rename now-unused gpu.rs By exrook in https://github.com/gfx-rs/wgpu/pull/4794 * #4794 Delete/rename now-unused gpu.rs By exrook in https://github.com/gfx-rs/wgpu/pull/4794 * #4573 Support nv12 texture format By xiaopengli89 in https://github.com/gfx-rs/wgpu/pull/4573 * #4789 Bump js-sys from 0.3.65 to 0.3.66 By dependabot[bot] in https://github.com/gfx-rs/wgpu/pull/4789 * #4784 Bump winit from 0.29.3 to 0.29.4 By dependabot[bot] in https://github.com/gfx-rs/wgpu/pull/4784 * #4798 Bump JamesIves/github-pages-deploy-action from 4.4.3 to 4.5.0 By dependabot[bot] in https://github.com/gfx-rs/wgpu/pull/4798 * #4800 Bump web-sys from 0.3.65 to 0.3.66 By dependabot[bot] in https://github.com/gfx-rs/wgpu/pull/4800 * #4743 Implement WGSL abstract types for global `const` declarations and constructor calls. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4743 * #4743 Implement WGSL abstract types for global `const` declarations and constructor calls. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4743 * #4743 Implement WGSL abstract types for global `const` declarations and constructor calls. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4743 * #4743 Implement WGSL abstract types for global `const` declarations and constructor calls. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4743 * #4743 Implement WGSL abstract types for global `const` declarations and constructor calls. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4743 * #4743 Implement WGSL abstract types for global `const` declarations and constructor calls. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4743 * #4743 Implement WGSL abstract types for global `const` declarations and constructor calls. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4743 * #4743 Implement WGSL abstract types for global `const` declarations and constructor calls. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4743 * #4743 Implement WGSL abstract types for global `const` declarations and constructor calls. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4743 * #4799 Bump wasm-bindgen-futures from 0.4.38 to 0.4.39 By dependabot[bot] in https://github.com/gfx-rs/wgpu/pull/4799 * #4796 Remove surface extent validation (and thus fix the annoying `Requested size ... is outside of the supported range` warning) By Wumpf in https://github.com/gfx-rs/wgpu/pull/4796 * #4804 Add space to a comment inside make_spirv_raw By ComfyFluffy in https://github.com/gfx-rs/wgpu/pull/4804 * #4803 `features`/`limits` refactors By teoxoy in https://github.com/gfx-rs/wgpu/pull/4803 * #4803 `features`/`limits` refactors By teoxoy in https://github.com/gfx-rs/wgpu/pull/4803 * #4803 `features`/`limits` refactors By teoxoy in https://github.com/gfx-rs/wgpu/pull/4803 * #4803 `features`/`limits` refactors By teoxoy in https://github.com/gfx-rs/wgpu/pull/4803 * #4803 `features`/`limits` refactors By teoxoy in https://github.com/gfx-rs/wgpu/pull/4803 * #4805 [naga] Improve ConstantEvaluatorError::InvalidCastArg message. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4805 * #4801 update deno By crowlKats in https://github.com/gfx-rs/wgpu/pull/4801 * #4806 Fixes and changes to the documentation for increasing clarity By Blatko1 in https://github.com/gfx-rs/wgpu/pull/4806 * #4809 [naga wgsl-in] Use a better span for errors in constructors. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4809 * #4808 [naga wgsl-in] Drop spanless labels from front-end error messages. By jimblandy in https://github.com/gfx-rs/wgpu/pull/4808 * #4822 Fix expected error message By teoxoy in https://github.com/gfx-rs/wgpu/pull/4822 * #4759 Add feature float32-filterable By almarklein in https://github.com/gfx-rs/wgpu/pull/4759 * #4813 Bump core-graphics-types from 0.1.2 to 0.1.3 By dependabot[bot] in https://github.com/gfx-rs/wgpu/pull/4813 Differential Revision: https://phabricator.services.mozilla.com/D195438 UltraBlame original commit: 985aabb5bf419ffcc9248010353ff190c225ba61 --- .cargo/config.in | 4 +- Cargo.lock | 20 +- dom/webgpu/Adapter.cpp | 18 +- gfx/wgpu_bindings/Cargo.toml | 14 +- gfx/wgpu_bindings/moz.yaml | 4 +- gfx/wgpu_bindings/src/client.rs | 3 + supply-chain/audits.toml | 256 +++ third_party/rust/d3d12/.cargo-checksum.json | 2 +- third_party/rust/d3d12/src/command_list.rs | 16 +- third_party/rust/naga/.cargo-checksum.json | 71 +- third_party/rust/naga/Cargo.toml | 27 + third_party/rust/naga/README.md | 3 +- .../rust/naga/src/back/glsl/features.rs | 166 +- .../rust/naga/src/back/glsl/keywords.rs | 4 + third_party/rust/naga/src/back/glsl/mod.rs | 477 ++++- third_party/rust/naga/src/back/hlsl/conv.rs | 39 + third_party/rust/naga/src/back/hlsl/writer.rs | 72 +- third_party/rust/naga/src/back/msl/writer.rs | 123 +- third_party/rust/naga/src/back/spv/block.rs | 10 + third_party/rust/naga/src/back/spv/image.rs | 53 + third_party/rust/naga/src/back/spv/writer.rs | 104 + third_party/rust/naga/src/back/wgsl/writer.rs | 58 +- third_party/rust/naga/src/compact/mod.rs | 59 + third_party/rust/naga/src/front/glsl/types.rs | 10 + third_party/rust/naga/src/front/wgsl/error.rs | 144 +- .../naga/src/front/wgsl/lower/construction.rs | 1363 +++++++++--- .../naga/src/front/wgsl/lower/conversion.rs | 1896 +++++++++++++++++ .../rust/naga/src/front/wgsl/lower/mod.rs | 423 +++- .../rust/naga/src/front/wgsl/parse/lexer.rs | 335 ++- .../rust/naga/src/front/wgsl/parse/number.rs | 416 ++-- third_party/rust/naga/src/front/wgsl/tests.rs | 15 +- .../rust/naga/src/front/wgsl/to_wgsl.rs | 38 + third_party/rust/naga/src/lib.rs | 18 + .../rust/naga/src/proc/constant_evaluator.rs | 1721 +++++++++++++-- third_party/rust/naga/src/proc/mod.rs | 140 +- third_party/rust/naga/src/valid/expression.rs | 70 + third_party/rust/naga/src/valid/function.rs | 18 +- third_party/rust/naga/src/valid/type.rs | 61 + .../rust/wgpu-core/.cargo-checksum.json | 54 +- third_party/rust/wgpu-core/Cargo.toml | 10 +- .../rust/wgpu-core/src/binding_model.rs | 121 +- .../rust/wgpu-core/src/command/clear.rs | 45 +- third_party/rust/wgpu-core/src/command/mod.rs | 33 +- .../rust/wgpu-core/src/command/render.rs | 111 +- .../rust/wgpu-core/src/command/transfer.rs | 126 ++ .../rust/wgpu-core/src/device/global.rs | 918 ++++---- third_party/rust/wgpu-core/src/device/life.rs | 516 +---- third_party/rust/wgpu-core/src/device/mod.rs | 46 +- .../rust/wgpu-core/src/device/queue.rs | 73 +- .../rust/wgpu-core/src/device/resource.rs | 504 ++++- .../rust/wgpu-core/src/device/trace.rs | 2 +- third_party/rust/wgpu-core/src/global.rs | 10 +- third_party/rust/wgpu-core/src/id.rs | 110 +- third_party/rust/wgpu-core/src/instance.rs | 97 +- third_party/rust/wgpu-core/src/lib.rs | 176 ++ third_party/rust/wgpu-core/src/pipeline.rs | 121 +- third_party/rust/wgpu-core/src/present.rs | 53 +- third_party/rust/wgpu-core/src/registry.rs | 28 - third_party/rust/wgpu-core/src/resource.rs | 262 ++- third_party/rust/wgpu-core/src/storage.rs | 83 +- .../rust/wgpu-core/src/track/buffer.rs | 21 +- .../rust/wgpu-core/src/track/metadata.rs | 12 +- third_party/rust/wgpu-core/src/track/mod.rs | 3 - .../rust/wgpu-core/src/track/stateless.rs | 38 +- .../rust/wgpu-core/src/track/texture.rs | 21 +- third_party/rust/wgpu-core/src/validation.rs | 31 + .../rust/wgpu-hal/.cargo-checksum.json | 58 +- third_party/rust/wgpu-hal/Cargo.toml | 6 +- third_party/rust/wgpu-hal/README.md | 2 +- .../rust/wgpu-hal/examples/halmark/main.rs | 6 + .../rust/wgpu-hal/examples/raw-gles.rs | 3 + .../rust/wgpu-hal/src/auxil/dxgi/conv.rs | 7 + .../rust/wgpu-hal/src/auxil/dxgi/exception.rs | 7 +- third_party/rust/wgpu-hal/src/dx11/adapter.rs | 14 + third_party/rust/wgpu-hal/src/dx11/command.rs | 8 +- third_party/rust/wgpu-hal/src/dx12/adapter.rs | 94 +- third_party/rust/wgpu-hal/src/dx12/command.rs | 66 +- third_party/rust/wgpu-hal/src/dx12/device.rs | 9 +- third_party/rust/wgpu-hal/src/dx12/mod.rs | 4 +- third_party/rust/wgpu-hal/src/dx12/view.rs | 37 +- third_party/rust/wgpu-hal/src/empty.rs | 8 +- third_party/rust/wgpu-hal/src/gles/adapter.rs | 206 +- third_party/rust/wgpu-hal/src/gles/command.rs | 174 +- third_party/rust/wgpu-hal/src/gles/conv.rs | 10 + third_party/rust/wgpu-hal/src/gles/device.rs | 227 +- third_party/rust/wgpu-hal/src/gles/mod.rs | 311 ++- third_party/rust/wgpu-hal/src/gles/queue.rs | 215 +- third_party/rust/wgpu-hal/src/lib.rs | 118 +- .../rust/wgpu-hal/src/metal/adapter.rs | 193 +- .../rust/wgpu-hal/src/metal/command.rs | 24 +- third_party/rust/wgpu-hal/src/metal/mod.rs | 7 +- .../rust/wgpu-hal/src/vulkan/adapter.rs | 402 +++- .../rust/wgpu-hal/src/vulkan/command.rs | 16 +- third_party/rust/wgpu-hal/src/vulkan/conv.rs | 100 + .../rust/wgpu-hal/src/vulkan/device.rs | 3 + .../rust/wgpu-hal/src/vulkan/instance.rs | 13 +- .../rust/wgpu-types/.cargo-checksum.json | 4 +- third_party/rust/wgpu-types/Cargo.toml | 4 +- third_party/rust/wgpu-types/src/lib.rs | 1404 ++++++++++-- 99 files changed, 12159 insertions(+), 3497 deletions(-) create mode 100644 third_party/rust/naga/src/front/wgsl/lower/conversion.rs diff --git a/.cargo/config.in b/.cargo/config.in index cae549949f06..2755c638b40a 100644 --- a/.cargo/config.in +++ b/.cargo/config.in @@ -292,7 +292,7 @@ wgpu ? rev = -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " ] git @@ -315,7 +315,7 @@ wgpu rev = " -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " replace - diff --git a/Cargo.lock b/Cargo.lock index 02503221eb5e..ce96768da4b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6686,9 +6686,9 @@ wgpu ? rev = -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec # -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " dependencies = @@ -20906,9 +20906,9 @@ wgpu ? rev = -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec # -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " dependencies = @@ -35406,9 +35406,9 @@ wgpu ? rev = -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec # -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " dependencies = @@ -35521,9 +35521,9 @@ wgpu ? rev = -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec # -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " dependencies = @@ -35694,9 +35694,9 @@ wgpu ? rev = -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec # -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " dependencies = diff --git a/dom/webgpu/Adapter.cpp b/dom/webgpu/Adapter.cpp index ca11915a3a95..ea0cb81aa387 100644 --- a/dom/webgpu/Adapter.cpp +++ b/dom/webgpu/Adapter.cpp @@ -706,18 +706,10 @@ GPUFeatureName : Float32_filterable : -# -ifdef -WGPUFeatures_FLOAT32_FILTERABLE -# -error -fix -todo -# -endif return -Nothing +Some ( +WGPUFeatures_FLOAT32_FILTERABLE ) ; case @@ -2704,7 +2696,7 @@ ffiDesc ; ffiDesc . -features +required_features = * MakeFeatureBits @@ -2716,7 +2708,7 @@ mRequiredFeatures ; ffiDesc . -limits +required_limits = deviceLimits ; @@ -2771,7 +2763,7 @@ request mId ffiDesc . -limits +required_limits ) ; for diff --git a/gfx/wgpu_bindings/Cargo.toml b/gfx/wgpu_bindings/Cargo.toml index aa993364075e..db5b4e3b4707 100644 --- a/gfx/wgpu_bindings/Cargo.toml +++ b/gfx/wgpu_bindings/Cargo.toml @@ -98,7 +98,7 @@ wgpu rev = " -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " # Note @@ -226,7 +226,7 @@ wgpu rev = " -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " features = @@ -288,7 +288,7 @@ wgpu rev = " -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " features = @@ -378,7 +378,7 @@ wgpu rev = " -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " features = @@ -419,7 +419,7 @@ wgpu rev = " -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " [ dependencies @@ -453,7 +453,7 @@ wgpu rev = " -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " [ target @@ -489,7 +489,7 @@ wgpu rev = " -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec " [ target diff --git a/gfx/wgpu_bindings/moz.yaml b/gfx/wgpu_bindings/moz.yaml index 43a874a35843..36aa974d62ad 100644 --- a/gfx/wgpu_bindings/moz.yaml +++ b/gfx/wgpu_bindings/moz.yaml @@ -124,7 +124,7 @@ SSS release : commit -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec # Revision to @@ -145,7 +145,7 @@ preferred ) revision : -a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +767ac03245ee937d3dc552edc13fe7ab0a860eec license : [ diff --git a/gfx/wgpu_bindings/src/client.rs b/gfx/wgpu_bindings/src/client.rs index 9e387c578745..2ec647b058fd 100644 --- a/gfx/wgpu_bindings/src/client.rs +++ b/gfx/wgpu_bindings/src/client.rs @@ -3432,6 +3432,9 @@ ptr ptr ) } +plane +: +None } ; let diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index beb5e40a1578..6dda1dca7350 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -11381,6 +11381,56 @@ d3d12 who = " +Nicolas +Silva +< +nical +fastmail +. +com +> +" +criteria += +" +safe +- +to +- +deploy +" +delta += +" +0 +. +7 +. +0 +git +: +a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +- +> +0 +. +7 +. +0 +git +: +767ac03245ee937d3dc552edc13fe7ab0a860eec +" +[ +[ +audits +. +d3d12 +] +] +who += +" Teodor Tanasoaia < @@ -23997,6 +24047,56 @@ naga who = " +Nicolas +Silva +< +nical +fastmail +. +com +> +" +criteria += +" +safe +- +to +- +deploy +" +delta += +" +0 +. +14 +. +0 +git +: +a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +- +> +0 +. +14 +. +0 +git +: +767ac03245ee937d3dc552edc13fe7ab0a860eec +" +[ +[ +audits +. +naga +] +] +who += +" Teodor Tanasoaia < @@ -40416,6 +40516,58 @@ core who = " +Nicolas +Silva +< +nical +fastmail +. +com +> +" +criteria += +" +safe +- +to +- +deploy +" +delta += +" +0 +. +18 +. +0 +git +: +a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +- +> +0 +. +18 +. +0 +git +: +767ac03245ee937d3dc552edc13fe7ab0a860eec +" +[ +[ +audits +. +wgpu +- +core +] +] +who += +" Teodor Tanasoaia < @@ -41080,6 +41232,58 @@ hal who = " +Nicolas +Silva +< +nical +fastmail +. +com +> +" +criteria += +" +safe +- +to +- +deploy +" +delta += +" +0 +. +18 +. +0 +git +: +a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +- +> +0 +. +18 +. +0 +git +: +767ac03245ee937d3dc552edc13fe7ab0a860eec +" +[ +[ +audits +. +wgpu +- +hal +] +] +who += +" Teodor Tanasoaia < @@ -41744,6 +41948,58 @@ types who = " +Nicolas +Silva +< +nical +fastmail +. +com +> +" +criteria += +" +safe +- +to +- +deploy +" +delta += +" +0 +. +18 +. +0 +git +: +a820a3ffba468cbb87c2a7e7bbe37065ed5207ee +- +> +0 +. +18 +. +0 +git +: +767ac03245ee937d3dc552edc13fe7ab0a860eec +" +[ +[ +audits +. +wgpu +- +types +] +] +who += +" Teodor Tanasoaia < diff --git a/third_party/rust/d3d12/.cargo-checksum.json b/third_party/rust/d3d12/.cargo-checksum.json index 605686564c63..ec067fa0e889 100644 --- a/third_party/rust/d3d12/.cargo-checksum.json +++ b/third_party/rust/d3d12/.cargo-checksum.json @@ -62,7 +62,7 @@ rs " : " -beb49cf5a4e53e3e5b121ea7c3247fc8e74eaba67f1fb7dee3416174d5a9fa07 +8723f3b755b721e0dbb234bd604956c1b7922a2368231197495daa3fa6548e63 " " src diff --git a/third_party/rust/d3d12/src/command_list.rs b/third_party/rust/d3d12/src/command_list.rs index 6da2f97b8d14..8d120b0b6323 100644 --- a/third_party/rust/d3d12/src/command_list.rs +++ b/third_party/rust/d3d12/src/command_list.rs @@ -1158,10 +1158,10 @@ VertexCount num_instances : InstanceCount -start_vertex +first_vertex : VertexCount -start_instance +first_instance : InstanceCount ) @@ -1174,8 +1174,8 @@ DrawInstanced ( num_vertices num_instances -start_vertex -start_instance +first_vertex +first_instance ) ; } @@ -1192,13 +1192,13 @@ IndexCount num_instances : InstanceCount -start_index +first_index : IndexCount base_vertex : VertexOffset -start_instance +first_instance : InstanceCount ) @@ -1211,9 +1211,9 @@ DrawIndexedInstanced ( num_indices num_instances -start_index +first_index base_vertex -start_instance +first_instance ) ; } diff --git a/third_party/rust/naga/.cargo-checksum.json b/third_party/rust/naga/.cargo-checksum.json index 74f8931f6232..82e5d6df9d4b 100644 --- a/third_party/rust/naga/.cargo-checksum.json +++ b/third_party/rust/naga/.cargo-checksum.json @@ -32,7 +32,7 @@ toml " : " -26d629b351260272be0812654b139819b7648176e8414636e0780133aa9792e5 +5bd726a75d7177a43e517d27d412ac38879231f79795226ebcd0873ff1255fe9 " " README @@ -41,7 +41,7 @@ md " : " -a8209bed7462de253558ee8b197c0ce706d505243b2d23614f74464f1d62e15f +a76b47b656e7390265312709b62b357a4f39c7509ec9ebe0b133c5841a8ab60b " " benches @@ -93,7 +93,7 @@ rs " : " -c0988dd960f545c0706f701a5b143fc638330eb2bca6f6e5b9131651da1300be +90c6a6255d550e9d97a04d6b6660c1a7af8e2433dd9379dc1d527693fa56523b " " src @@ -108,7 +108,7 @@ rs " : " -fbc6dad7e0da457f682ee21f86f5b9ebf0b080d750e34e5600085e14f07ab1c1 +1546facbaddf696602102f32e47db7afc875f8ca3fbccc2122e0bcc45e022b53 " " src @@ -123,7 +123,7 @@ rs " : " -2501ebfcab34af68c6858053d04d92bae12d1a1b93349ccfbc56ec1978c90b73 +bba387392e3b9b22835d78a1db7d1490e7199cafcb347d54b22373b7b76b2900 " " src @@ -138,7 +138,7 @@ rs " : " -487dd2786ab6153c3fc8637ad11cd17dd7015400684ae4daa949b2dc0d9929be +5e40946f2d5ad6589dd2b0570d2c300dd96f92f0f954b829dc54a822de7774e8 " " src @@ -213,7 +213,7 @@ rs " : " -41a29d43b2d75bfd5b8d682d5a07be3fc1ff8a54cf4ba4aaa898889010e7200d +8e61501bae6982273a525734d3e446694d4bf7a081419ec312c32b354e89d3ef " " src @@ -286,7 +286,7 @@ rs " : " -63d7a4fbc0544662549f650af4e10e1ea2f3bb6b0587d0500a01e46cae376fc0 +9503df4ae10d1d7b6840cb68e2e2ff4f7ed8761b217faa99e6927d87da546071 " " src @@ -301,7 +301,7 @@ rs " : " -75fdfd576951f12c0d6da3d6167ae550d89dc50635f97a67cd375285fb441ad1 +976c0856d25dc0f54f4b5039b5e101088f32a92c373c7449682e9c8d64fc48c0 " " src @@ -331,7 +331,7 @@ rs " : " -d81d770645913fd57725237f6f96cc4d0a6674b7096fab7e620fb58dc0087e64 +5840a6d5cdffbf30cb20a76ddfdb468041fc6b687a476b3b2fc2553bda6f4af7 " " src @@ -451,7 +451,7 @@ rs " : " -a45c9357e097de1c225ea4a36f91a921f6c871140c15a98a2903e6975e46d59c +a76a73c0692162da24ab5508bc3ca70eb5e01367fe54472d100e237dbd594467 " " src @@ -481,7 +481,7 @@ rs " : " -27bb426c3726547b4799f1d77befb563bffa9b6086bfc81cb5a507454aedd8ba +f996c393aac339139eed8592b5fdd15fc786a49d3542985dc8ecb07f549a77ea " " src @@ -544,7 +544,7 @@ rs " : " -6b171f09fcd9423eecb2865fa854ed5cec725ff30dc572baaee68b3b24cef0eb +8abea7a8a9870d953fb628a32bac2bc15e87e077910cb95aa1f26e58a0a35c2a " " src @@ -818,7 +818,7 @@ rs " : " -e47355199f45cafed16818f73688cebf12a217493a770df7b091b9a5f3058216 +58c9cf3d570dff8cb68f2931faf5b18e875e510741bf035ec10b9ff6df27c5d8 " " src @@ -977,7 +977,7 @@ rs " : " -8b4887c1ede20efb3c1b885ca2a8848856553ac0b8ced26e1285082b620da39b +a2abfd483afe46e1e80d47568ea56c2d587de8dd6291739b03de788f37dada0e " " src @@ -1009,7 +1009,24 @@ rs " : " -1629d80fffc31859328388760fea8572a314152a38b166bde5d1285a33df0bb9 +48b2c1b0ef93345bc3cdbf1af29690cc128a4507f0b9d7d908a136f4c0fd48ca +" +" +src +/ +front +/ +wgsl +/ +lower +/ +conversion +. +rs +" +: +" +6d123e0148fc6d5b8df3d218ce1978a154d0edb86f65ca20fdc91bb4bf9475ce " " src @@ -1026,7 +1043,7 @@ rs " : " -054dfa8bb76d9f1ec07d0decb1ccd23d86cc55be005a26a1e223104478d4d359 +d1954f9845fd4fedbf688dbcff85310954eb69ac228a3e2a128bd5759ad8667d " " src @@ -1092,7 +1109,7 @@ rs " : " -a26d1c6f76b4883a4b79a617f9914eb3f4b05fbae4d4112606a9598d31a46b8e +bff1d0e3cd920b2e9342b521bed7483595556b90088dc0b22e1599900585ff8e " " src @@ -1126,7 +1143,7 @@ rs " : " -64fe5d5f6b1d6a6acf15f4cad3cda8045ad5d82efda179627f848aba9c47e605 +623423471a13cf9a45662ee3ac01554644ac544338c7493cfe6087549bab91f7 " " src @@ -1141,7 +1158,7 @@ rs " : " -ab26c5c82a21a4e8072fcdc8b3c47c3d6ac1d854047dd88db99e02aa67502e48 +39d0b44d0f073a7599c88b7c4efd1572886f3af074fa2015454623be313b297f " " src @@ -1156,7 +1173,7 @@ rs " : " -0ad5ab5662a8538fe238143ea288b8b52fa9f4ce52a3ea4c3ae6353bd9429eca +2e2e30d86b07f209b866e530d3a882803bf28b39ce379052561a749f628e8e28 " " src @@ -1193,7 +1210,7 @@ rs " : " -ea60e2bfa334456b1c2572ceacd14b6feb30759f8f06d1f0013c72c74b7de2e1 +c5d91c603ae310a7ef9ff8444898959a3dbbc32ba262cabb1fd5682823921d98 " " src @@ -1206,7 +1223,7 @@ rs " : " -3559cfdce73957eceb1589435aaf1a09514ea0bfd49d1a1092dd7e06f82e9af3 +0f55fb6f8310dee8dc021f27ab5c3c0ed896963f82150346fcdfbefc47b5e4a1 " " src @@ -1258,7 +1275,7 @@ rs " : " -96ade50eefb2541e59b30c7377d97fc5b10c0d03a4d0492541c4db79d1ecfb92 +e6ce6a376aa4e3584f0386fdbe95c7ea2a93abe19b03cc261b6152c8fca24842 " " src @@ -1347,7 +1364,7 @@ rs " : " -37b9b3ae31fe13d0ae73a53496adc6ce3cc3ae30e617090ffaf8a9cabacc0987 +1cdbd594dbdb33d8473d93c11112cf717e262bb8c35cee10b01db4322b2237d7 " " src @@ -1360,7 +1377,7 @@ rs " : " -9782913bb4d3df874ca976aa86b06bffd6c30401b8861440a9430203fef9852a +5ec31146aacf7daae689836ff3e2978f075f2cc62b3fd829d09c760a6e606501 " " src @@ -1412,7 +1429,7 @@ rs " : " -447d5004f18778dee31df0caa68e5a31351f3aeaec3e4e142107d32d0308cd55 +09e18bb9510dbb0cfb4a8ac054afee4c4f56063d614159ab5b956aa1e5850468 " } " diff --git a/third_party/rust/naga/Cargo.toml b/third_party/rust/naga/Cargo.toml index c835a2b849a8..3e39727e96db 100644 --- a/third_party/rust/naga/Cargo.toml +++ b/third_party/rust/naga/Cargo.toml @@ -168,6 +168,9 @@ target * " ] +autotests += +false description = " @@ -255,6 +258,27 @@ features true [ [ +test +] +] +name += +" +naga +- +test +" +path += +" +tests +/ +root +. +rs +" +[ +[ bench ] ] @@ -778,6 +802,9 @@ unicode - xid " +" +compact +" ] wgsl - diff --git a/third_party/rust/naga/README.md b/third_party/rust/naga/README.md index 4222d65587d0..82129859a76e 100644 --- a/third_party/rust/naga/README.md +++ b/third_party/rust/naga/README.md @@ -603,8 +603,7 @@ a CLI which allows -to -test +testing the conversion of diff --git a/third_party/rust/naga/src/back/glsl/features.rs b/third_party/rust/naga/src/back/glsl/features.rs index 92d2d8c8cc25..f75d6aeff4c4 100644 --- a/third_party/rust/naga/src/back/glsl/features.rs +++ b/third_party/rust/naga/src/back/glsl/features.rs @@ -14,6 +14,16 @@ crate : : { +back +: +: +glsl +: +: +{ +Options +WriterFlags +} AddressSpace Binding Expression @@ -344,6 +354,37 @@ DUAL_SOURCE_BLENDING < 21 ; +/ +/ +/ +Instance +index +/ +/ +/ +/ +/ +/ +We +can +always +support +this +either +through +the +language +or +a +polyfill +const +INSTANCE_INDEX += +1 +< +< +22 +; } } pub @@ -397,6 +438,30 @@ features } pub fn +contains +( +& +mut +self +features +: +Features +) +- +> +bool +{ +self +. +0 +. +contains +( +features +) +} +pub +fn check_availability ( & @@ -776,9 +841,10 @@ write ( & self -version +options : -Version +& +Options mut out : @@ -804,6 +870,8 @@ COMPUTE_SHADER & & ! +options +. version . is_es @@ -840,6 +908,8 @@ BUFFER_STORAGE & & ! +options +. version . is_es @@ -875,6 +945,8 @@ DOUBLE_TYPE ) & & +options +. version < Version @@ -914,6 +986,8 @@ CUBE_TEXTURES_ARRAY ) { if +options +. version . is_es @@ -937,6 +1011,8 @@ require } else if +options +. version < Version @@ -977,6 +1053,8 @@ MULTISAMPLED_TEXTURE_ARRAYS ) & & +options +. version . is_es @@ -1012,6 +1090,8 @@ ARRAY_OF_ARRAYS ) & & +options +. version < Version @@ -1064,6 +1144,8 @@ FULL_IMAGE_FORMATS ) & & +options +. version . is_es @@ -1086,6 +1168,8 @@ require ; } if +options +. version < Version @@ -1126,6 +1210,8 @@ CONSERVATIVE_DEPTH ) { if +options +. version . is_es @@ -1148,6 +1234,8 @@ require ; } if +options +. version < Version @@ -1203,6 +1291,8 @@ CULL_DISTANCE ) & & +options +. version . is_es @@ -1238,6 +1328,8 @@ SAMPLE_VARIABLES ) & & +options +. version . is_es @@ -1286,6 +1378,8 @@ true . } = +options +. version { writeln @@ -1363,6 +1457,8 @@ TEXTURE_LEVELS ) & & +options +. version < Version @@ -1402,6 +1498,8 @@ DUAL_SOURCE_BLENDING ) & & +options +. version . is_es @@ -1423,6 +1521,48 @@ require ? ; } +if +self +. +0 +. +contains +( +Features +: +: +INSTANCE_INDEX +) +{ +if +options +. +writer_flags +. +contains +( +WriterFlags +: +: +DRAW_PARAMETERS +) +{ +writeln +! +( +out +" +# +extension +GL_ARB_shader_draw_parameters +: +require +" +) +? +; +} +} Ok ( ( @@ -2804,6 +2944,28 @@ Features MULTI_VIEW ) } +crate +: +: +BuiltIn +: +: +InstanceIndex += +> +{ +self +. +features +. +request +( +Features +: +: +INSTANCE_INDEX +) +} _ = > diff --git a/third_party/rust/naga/src/back/glsl/keywords.rs b/third_party/rust/naga/src/back/glsl/keywords.rs index cabf8319eb7d..d017d7f3640e 100644 --- a/third_party/rust/naga/src/back/glsl/keywords.rs +++ b/third_party/rust/naga/src/back/glsl/keywords.rs @@ -1338,5 +1338,9 @@ super : : FREXP_FUNCTION +super +: +: +FIRST_INSTANCE_BINDING ] ; diff --git a/third_party/rust/naga/src/back/glsl/mod.rs b/third_party/rust/naga/src/back/glsl/mod.rs index 28741469ad68..4e6d300e3ce0 100644 --- a/third_party/rust/naga/src/back/glsl/mod.rs +++ b/third_party/rust/naga/src/back/glsl/mod.rs @@ -142,6 +142,17 @@ naga_frexp " ; pub +const +FIRST_INSTANCE_BINDING +: +& +str += +" +naga_vs_first_instance +" +; +pub type BindingMap = @@ -1206,6 +1217,31 @@ TEXTURE_SHADOW_LOD / / / +Supports +ARB_shader_draw_parameters +on +the +host +which +provides +/ +/ +/ +support +for +gl_BaseInstanceARB +gl_BaseVertexARB +and +gl_DrawIDARB +. +const +DRAW_PARAMETERS += +0x4 +; +/ +/ +/ Include unused global @@ -1255,7 +1291,7 @@ variables const INCLUDE_UNUSED_ITEMS = -0x4 +0x10 ; / / @@ -1367,7 +1403,7 @@ stages const FORCE_POINT_SIZE = -0x10 +0x20 ; } } @@ -1742,6 +1778,74 @@ self ret } } +# +[ +derive +( +Clone +Copy +) +] +struct +VaryingOptions +{ +output +: +bool +targetting_webgl +: +bool +draw_parameters +: +bool +} +impl +VaryingOptions +{ +const +fn +from_writer_options +( +options +: +& +Options +output +: +bool +) +- +> +Self +{ +Self +{ +output +targetting_webgl +: +options +. +version +. +is_webgl +( +) +draw_parameters +: +options +. +writer_flags +. +contains +( +WriterFlags +: +: +DRAW_PARAMETERS +) +} +} +} struct VaryingName < @@ -1761,12 +1865,9 @@ Binding stage : ShaderStage -output -: -bool -targetting_webgl +options : -bool +VaryingOptions } impl fmt @@ -1858,6 +1959,8 @@ self stage self . +options +. output ) { @@ -1962,10 +2065,7 @@ glsl_built_in built_in self . -output -self -. -targetting_webgl +options ) ) } @@ -2561,6 +2661,12 @@ RESERVED_KEYWORDS " gl_ " +" +_group +" +" +_push_constant_binding_ +" ] & mut @@ -2722,8 +2828,6 @@ write self . options -. -version & mut self @@ -2889,6 +2993,75 @@ out ; } if +self +. +entry_point +. +stage += += +ShaderStage +: +: +Vertex +& +& +! +self +. +options +. +writer_flags +. +contains +( +WriterFlags +: +: +DRAW_PARAMETERS +) +& +& +self +. +features +. +contains +( +Features +: +: +INSTANCE_INDEX +) +{ +writeln +! +( +self +. +out +" +uniform +uint +{ +FIRST_INSTANCE_BINDING +} +; +" +) +? +; +writeln +! +( +self +. +out +) +? +; +} +if let Some ( @@ -7010,15 +7183,15 @@ invariant glsl_built_in ( built_in -output +VaryingOptions +: +: +from_writer_options +( self . options -. -version -. -is_webgl -( +output ) ) ) @@ -7309,17 +7482,17 @@ self entry_point . stage -output -targetting_webgl +options +: +VaryingOptions +: : +from_writer_options +( self . options -. -version -. -is_webgl -( +output ) } ; @@ -8261,19 +8434,17 @@ unwrap ( ) stage -output +options +: +VaryingOptions : -false -targetting_webgl : +from_writer_options +( self . options -. -version -. -is_webgl -( +false ) } ; @@ -8347,19 +8518,17 @@ unwrap ( ) stage -output +options : -false -targetting_webgl +VaryingOptions : +: +from_writer_options +( self . options -. -version -. -is_webgl -( +false ) } ; @@ -11097,19 +11266,17 @@ stage ep . stage -output +options +: +VaryingOptions : -true -targetting_webgl : +from_writer_options +( self . options -. -version -. -is_webgl -( +true ) } ; @@ -11241,19 +11408,17 @@ stage ep . stage -output +options : -true -targetting_webgl +VaryingOptions : +: +from_writer_options +( self . options -. -version -. -is_webgl -( +true ) } ; @@ -12615,6 +12780,58 @@ into ) ; } +crate +: +: +Literal +: +: +AbstractInt +( +_ +) +| +crate +: +: +Literal +: +: +AbstractFloat +( +_ +) += +> +{ +return +Err +( +Error +: +: +Custom +( +" +Abstract +types +should +not +appear +in +IR +presented +to +backends +" +. +into +( +) +) +) +; +} } } Expression @@ -20316,6 +20533,39 @@ bool ) ? } +( +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat +_ +_ +) +| +( +_ +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat +_ +) += +> +unreachable +! +( +) } ; write @@ -23227,6 +23477,51 @@ out " ) ? +crate +: +: +ScalarKind +: +: +AbstractInt +| +crate +: +: +ScalarKind +: +: +AbstractFloat += +> +{ +return +Err +( +Error +: +: +Custom +( +" +Abstract +types +should +not +appear +in +IR +presented +to +backends +" +. +to_string +( +) +) +) +} } Ok ( @@ -24505,6 +24800,31 @@ full bool " } +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat += +> +{ +return +Err +( +Error +: +: +UnsupportedScalar +( +scalar +) +) +; +} } ) } @@ -24518,12 +24838,9 @@ crate : : BuiltIn -output -: -bool -targetting_webgl +options : -bool +VaryingOptions ) - > @@ -24555,6 +24872,8 @@ Position > { if +options +. output { " @@ -24573,6 +24892,8 @@ Bi : ViewIndex if +options +. targetting_webgl = > @@ -24639,12 +24960,40 @@ Bi InstanceIndex = > +{ +if +options +. +draw_parameters +{ +" +( +uint +( +gl_InstanceID +) ++ +uint +( +gl_BaseInstanceARB +) +) " +} +else +{ +" +( uint ( gl_InstanceID ) ++ +naga_vs_first_instance +) " +} +} Bi : : @@ -24722,6 +25071,8 @@ SampleMask > { if +options +. output { " diff --git a/third_party/rust/naga/src/back/hlsl/conv.rs b/third_party/rust/naga/src/back/hlsl/conv.rs index dcab6b5598ad..7d2b7542a6e0 100644 --- a/third_party/rust/naga/src/back/hlsl/conv.rs +++ b/third_party/rust/naga/src/back/hlsl/conv.rs @@ -78,6 +78,16 @@ Self : : Bool +| +Self +: +: +AbstractInt +| +Self +: +: +AbstractFloat = > unreachable @@ -219,6 +229,35 @@ Ok bool " ) +crate +: +: +ScalarKind +: +: +AbstractInt +| +crate +: +: +ScalarKind +: +: +AbstractFloat += +> +{ +Err +( +Error +: +: +UnsupportedScalar +( +self +) +) +} } } } diff --git a/third_party/rust/naga/src/back/hlsl/writer.rs b/third_party/rust/naga/src/back/hlsl/writer.rs index 0001714b19d2..fb150dbd067e 100644 --- a/third_party/rust/naga/src/back/hlsl/writer.rs +++ b/third_party/rust/naga/src/back/hlsl/writer.rs @@ -82,23 +82,23 @@ _NagaConstants " ; const -SPECIAL_BASE_VERTEX +SPECIAL_FIRST_VERTEX : & str = " -base_vertex +first_vertex " ; const -SPECIAL_BASE_INSTANCE +SPECIAL_FIRST_INSTANCE : & str = " -base_instance +first_instance " ; const @@ -1089,7 +1089,7 @@ back : : INDENT -SPECIAL_BASE_VERTEX +SPECIAL_FIRST_VERTEX ) ? ; @@ -1111,7 +1111,7 @@ back : : INDENT -SPECIAL_BASE_INSTANCE +SPECIAL_FIRST_INSTANCE ) ? ; @@ -12696,6 +12696,58 @@ out value ) ? +crate +: +: +Literal +: +: +AbstractInt +( +_ +) +| +crate +: +: +Literal +: +: +AbstractFloat +( +_ +) += +> +{ +return +Err +( +Error +: +: +Custom +( +" +Abstract +types +should +not +appear +in +IR +presented +to +backends +" +. +into +( +) +) +) +; +} } Expression : @@ -13133,7 +13185,7 @@ SPECIAL_CBUF_VAR } . { -SPECIAL_BASE_VERTEX +SPECIAL_FIRST_VERTEX } + " @@ -13170,7 +13222,7 @@ SPECIAL_CBUF_VAR } . { -SPECIAL_BASE_INSTANCE +SPECIAL_FIRST_INSTANCE } + " @@ -13208,14 +13260,14 @@ SPECIAL_CBUF_VAR } . { -SPECIAL_BASE_VERTEX +SPECIAL_FIRST_VERTEX } { SPECIAL_CBUF_VAR } . { -SPECIAL_BASE_INSTANCE +SPECIAL_FIRST_INSTANCE } { SPECIAL_CBUF_VAR diff --git a/third_party/rust/naga/src/back/msl/writer.rs b/third_party/rust/naga/src/back/msl/writer.rs index c94e38a7bd16..3d18ea3181d5 100644 --- a/third_party/rust/naga/src/back/msl/writer.rs +++ b/third_party/rust/naga/src/back/msl/writer.rs @@ -2159,6 +2159,29 @@ _ " bool " +Self +{ +kind +: +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat +width +: +_ +} += +> +unreachable +! +( +) } } } @@ -2234,19 +2257,6 @@ members index ] ; -if -member -. -binding -. -is_some -( -) -{ -return -None -; -} let ty_inner = @@ -2353,16 +2363,6 @@ width } } if -member -. -offset -& -0xF -! -= -0 -| -| is_tight = > @@ -7836,6 +7836,40 @@ value ? ; } +crate +: +: +Literal +: +: +AbstractInt +( +_ +) +| +crate +: +: +Literal +: +: +AbstractFloat +( +_ +) += +> +{ +return +Err +( +Error +: +: +Validation +) +; +} } crate : @@ -21242,15 +21276,6 @@ enumerate if member . -binding -. -is_none -( -) -& -& -member -. offset > last_offset @@ -26803,6 +26828,40 @@ out ; } if +self +. +struct_member_pads +. +contains +( +& +( +arg +. +ty +member_index +as +u32 +) +) +{ +write +! +( +self +. +out +" +{ +{ +} +} +" +) +? +; +} +if let Some ( diff --git a/third_party/rust/naga/src/back/spv/block.rs b/third_party/rust/naga/src/back/spv/block.rs index 686f7961905c..2bb2c7147bf5 100644 --- a/third_party/rust/naga/src/back/spv/block.rs +++ b/third_party/rust/naga/src/back/spv/block.rs @@ -7972,6 +7972,16 @@ Sk : : Bool +| +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat = > unreachable diff --git a/third_party/rust/naga/src/back/spv/image.rs b/third_party/rust/naga/src/back/spv/image.rs index 02bef56fed0b..414a512c67c8 100644 --- a/third_party/rust/naga/src/back/spv/image.rs +++ b/third_party/rust/naga/src/back/spv/image.rs @@ -1374,6 +1374,59 @@ index " ) } +( +crate +: +: +ScalarKind +: +: +AbstractInt +| +crate +: +: +ScalarKind +: +: +AbstractFloat +_ +) +| +( +_ +crate +: +: +ScalarKind +: +: +AbstractInt +| +crate +: +: +ScalarKind +: +: +AbstractFloat +) += +> +{ +unreachable +! +( +" +abstract +types +should +never +reach +backends +" +) +} } ; let diff --git a/third_party/rust/naga/src/back/spv/writer.rs b/third_party/rust/naga/src/back/spv/writer.rs index 3289ed88602b..8fa928e2efad 100644 --- a/third_party/rust/naga/src/back/spv/writer.rs +++ b/third_party/rust/naga/src/back/spv/writer.rs @@ -4892,6 +4892,33 @@ type_bool ( id ) +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat += +> +{ +unreachable +! +( +" +abstract +types +should +never +reach +the +backend +" +) +; +} } } fn @@ -7242,6 +7269,48 @@ constant_false type_id id ) +crate +: +: +Literal +: +: +AbstractInt +( +_ +) +| +crate +: +: +Literal +: +: +AbstractFloat +( +_ +) += +> +{ +unreachable +! +( +" +Abstract +types +should +not +appear +in +IR +presented +to +backends +" +) +; +} } ; instruction @@ -9625,6 +9694,41 @@ Float = > false +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat += +> +{ +return +Err +( +Error +: +: +Validation +( +" +Abstract +types +should +not +appear +in +IR +presented +to +backends +" +) +) +} } _ = diff --git a/third_party/rust/naga/src/back/wgsl/writer.rs b/third_party/rust/naga/src/back/wgsl/writer.rs index c1a848452087..8c2a8fedd81a 100644 --- a/third_party/rust/naga/src/back/wgsl/writer.rs +++ b/third_party/rust/naga/src/back/wgsl/writer.rs @@ -6463,6 +6463,34 @@ Literal : F64 ( +value +) += +> +write +! +( +self +. +out +" +{ +: +? +} +lf +" +value +) +? +crate +: +: +Literal +: +: +I64 +( _ ) = @@ -6478,7 +6506,7 @@ Custom ( " unsupported -f64 +i64 literal " . @@ -6495,7 +6523,18 @@ crate Literal : : -I64 +AbstractInt +( +_ +) +| +crate +: +: +Literal +: +: +AbstractFloat ( _ ) @@ -6511,12 +6550,19 @@ Error Custom ( " -unsupported -i64 -literal +Abstract +types +should +not +appear +in +IR +presented +to +backends " . -to_string +into ( ) ) diff --git a/third_party/rust/naga/src/compact/mod.rs b/third_party/rust/naga/src/compact/mod.rs index db627ae19513..c284ac1b5936 100644 --- a/third_party/rust/naga/src/compact/mod.rs +++ b/third_party/rust/naga/src/compact/mod.rs @@ -424,6 +424,65 @@ ty ; } } +for +( +handle +ty +) +in +module +. +types +. +iter +( +) +{ +log +: +: +trace +! +( +" +tracing +type +{ +: +? +} +name +{ +: +? +} +" +handle +ty +. +name +) +; +if +ty +. +name +. +is_some +( +) +{ +module_tracer +. +types_used +. +insert +( +handle +) +; +} +} module_tracer . as_type diff --git a/third_party/rust/naga/src/front/glsl/types.rs b/third_party/rust/naga/src/front/glsl/types.rs index d195a84b6a41..ccf4ca17cf02 100644 --- a/third_party/rust/naga/src/front/glsl/types.rs +++ b/third_party/rust/naga/src/front/glsl/types.rs @@ -1282,6 +1282,16 @@ ScalarKind : : Bool +| +ScalarKind +: +: +AbstractInt +| +ScalarKind +: +: +AbstractFloat = > return diff --git a/third_party/rust/naga/src/front/wgsl/error.rs b/third_party/rust/naga/src/front/wgsl/error.rs index 91d6b25dd7a2..7244b6b38635 100644 --- a/third_party/rust/naga/src/front/wgsl/error.rs +++ b/third_party/rust/naga/src/front/wgsl/error.rs @@ -264,19 +264,11 @@ iter ( ) . -map +filter_map ( | label | -{ -Label -: -: -primary -( -( -) label . 0 @@ -285,11 +277,37 @@ to_range ( ) . -unwrap +map ( +| +range +| +( +label +range +) ) ) . +map +( +| +( +label +range +) +| +{ +Label +: +: +primary +( +( +) +range +) +. with_message ( label @@ -1249,6 +1267,21 @@ ConstantEvaluatorError ConstantEvaluatorError Span ) +AutoConversion +{ +dest_span +: +Span +dest_type +: +String +source_span +: +Span +source_type +: +String +} } impl < @@ -5561,6 +5594,97 @@ vec [ ] } +Error +: +: +AutoConversion +{ +dest_span +ref +dest_type +source_span +ref +source_type +} += +> +ParseError +{ +message +: +format +! +( +" +automatic +conversions +cannot +convert +{ +source_type +} +to +{ +dest_type +} +" +) +labels +: +vec +! +[ +( +dest_span +format +! +( +" +a +value +of +type +{ +dest_type +} +is +required +here +" +) +. +into +( +) +) +( +source_span +format +! +( +" +this +expression +has +type +{ +source_type +} +" +) +. +into +( +) +) +] +notes +: +vec +! +[ +] +} } } } diff --git a/third_party/rust/naga/src/front/wgsl/lower/construction.rs b/third_party/rust/naga/src/front/wgsl/lower/construction.rs index b7c279693528..08e8598c2a81 100644 --- a/third_party/rust/naga/src/front/wgsl/lower/construction.rs +++ b/third_party/rust/naga/src/front/wgsl/lower/construction.rs @@ -64,6 +64,18 @@ ExpressionContext Lowerer } ; +use +crate +: +: +front +: +: +wgsl +: +: +Scalar +; enum Constructor < @@ -416,15 +428,6 @@ Vec < Span > -first_component_ty_inner -: -& -' -a -crate -: -: -TypeInner } } impl @@ -583,6 +586,17 @@ source > > { +use +crate +: +: +proc +: +: +TypeResolution +as +Tr +; let constructor_h = @@ -633,7 +647,7 @@ component = self . -expression +expression_for_abstract ( component ctx @@ -663,10 +677,11 @@ span ty_inner } } -[ -component ref -rest +ast_components +[ +_ +_ . . ] @@ -674,49 +689,9 @@ rest > { let -span -= -ctx -. -ast_expressions -. -get_span -( -component -) -; -let -component -= -self -. -expression -( -component -ctx -) -? -; -let components = -std -: -: -iter -: -: -once -( -Ok -( -component -) -) -. -chain -( -rest +ast_components . iter ( @@ -726,17 +701,16 @@ map ( | & -component +expr | self . -expression +expression_for_abstract ( -component +expr ctx ) ) -) . collect : @@ -755,20 +729,7 @@ _ let spans = -std -: -: -iter -: -: -once -( -span -) -. -chain -( -rest +ast_components . iter ( @@ -778,7 +739,7 @@ map ( | & -component +expr | ctx . @@ -786,8 +747,7 @@ ast_expressions . get_span ( -component -) +expr ) ) . @@ -795,19 +755,22 @@ collect ( ) ; -let -first_component_ty_inner -= -super -: -: -resolve_inner -! -( +for +& +component +in +& +components +{ ctx +. +grow_types +( component ) +? ; +} Components : : @@ -815,7 +778,6 @@ Many { components spans -first_component_ty_inner } } } @@ -834,7 +796,7 @@ module ; let expr -= +; match ( components @@ -970,6 +932,9 @@ scalar ) = > +{ +expr += crate : : @@ -995,6 +960,8 @@ scalar width ) } +; +} ( Components : @@ -1055,6 +1022,9 @@ dst_size src_size = > +{ +expr += crate : : @@ -1080,6 +1050,8 @@ dst_scalar width ) } +; +} ( Components : @@ -1204,6 +1176,9 @@ dst_rows src_rows = > +{ +expr += crate : : @@ -1217,13 +1192,9 @@ expr component kind : -crate -: -: -ScalarKind -: -: -Float +dst_scalar +. +kind convert : Some @@ -1233,6 +1204,8 @@ dst_scalar width ) } +; +} ( Components : @@ -1331,6 +1304,9 @@ size ) = > +{ +expr += crate : : @@ -1344,12 +1320,15 @@ value : component } +; +} ( Components : : One { +mut component ty_inner : @@ -1362,7 +1341,7 @@ TypeInner : Scalar ( -src_scalar +_ ) . . @@ -1385,19 +1364,35 @@ Vector { size scalar -: -dst_scalar } ) ) ) -if -dst_scalar -= -= -src_scalar = > +{ +ctx +. +convert_slice_to_common_scalar +( +std +: +: +slice +: +: +from_mut +( +& +mut +component +) +scalar +) +? +; +expr += crate : : @@ -1411,42 +1406,17 @@ value : component } +; +} ( Components : : Many { +mut components -first_component_ty_inner -: -& -crate -: -: -TypeInner -: -: -Scalar -( -scalar -) -| -& -crate -: -: -TypeInner -: -: -Vector -{ -scalar -. -. -} -. -. +spans } Constructor : @@ -1456,83 +1426,62 @@ PartialVector size } ) -| -( -Components -: -: -Many += +> { -components -first_component_ty_inner -: +let +consensus_scalar += +automatic_conversion_consensus +( & -crate -: -: -TypeInner -: -: -Scalar -{ -. +components +ctx +) . -} +map_err +( +| +index | -& -crate -: -: -TypeInner -: -: -Vector { -. -. -} -. -. -} -Constructor +Error : : -Type +InvalidConstructorComponentType ( +spans +[ +index +] +index +as +i32 +) +} +) +? +; +ctx +. +convert_slice_to_common_scalar ( -_ & -crate -: -: -TypeInner -: -: -Vector -{ -size -scalar -} -) -) +mut +components +consensus_scalar ) -= -> -{ +? +; let inner = -crate -: -: -TypeInner -: -: -Vector -{ +consensus_scalar +. +to_inner_vector +( size -scalar -} +) ; let ty @@ -1544,6 +1493,8 @@ ensure_type_exists inner ) ; +expr += crate : : @@ -1555,6 +1506,7 @@ Compose ty components } +; } ( Components @@ -1562,9 +1514,18 @@ Components : Many { +mut components -first_component_ty_inner +. +. +} +Constructor +: : +Type +( +( +ty & crate : @@ -1572,13 +1533,55 @@ crate TypeInner : : -Scalar -( +Vector +{ scalar -) . . } +) +) +) += +> +{ +ctx +. +try_automatic_conversions_for_vector +( +& +mut +components +scalar +ty_span +) +? +; +expr += +crate +: +: +Expression +: +: +Compose +{ +ty +components +} +; +} +( +Components +: +: +Many +{ +mut +components +spans +} Constructor : : @@ -1588,28 +1591,220 @@ columns rows } ) +if +components +. +len +( +) += += +columns +as +usize +* +rows +as +usize += +> +{ +let +consensus_scalar += +automatic_conversion_consensus +( +& +components +ctx +) +. +map_err +( +| +index | +{ +Error +: +: +InvalidConstructorComponentType ( -Components +spans +[ +index +] +index +as +i32 +) +} +) +? +; +let +consensus_scalar += +consensus_scalar +. +automatic_conversion_combine +( +crate : : -Many -{ -components -first_component_ty_inner +Scalar +: : +ABSTRACT_FLOAT +) +. +unwrap_or +( +consensus_scalar +) +; +ctx +. +convert_slice_to_common_scalar +( & +mut +components +consensus_scalar +) +? +; +let +vec_ty += +ctx +. +ensure_type_exists +( +consensus_scalar +. +to_inner_vector +( +rows +) +) +; +let +components += +components +. +chunks +( +rows +as +usize +) +. +map +( +| +vec_components +| +{ +ctx +. +append_expression +( crate : : -TypeInner +Expression : : -Scalar +Compose { +ty +: +vec_ty +components +: +Vec +: +: +from +( +vec_components +) +} +Default +: +: +default +( +) +) +} +) . +collect +: +: +< +Result +< +Vec +< +_ +> +_ +> +> +( +) +? +; +let +ty += +ctx . +ensure_type_exists +( +crate +: +: +TypeInner +: +: +Matrix +{ +columns +rows +scalar +: +consensus_scalar } +) +; +expr += +crate +: +: +Expression +: +: +Compose +{ +ty +components +} +; +} +( +Components +: +: +Many +{ +mut +components . . } @@ -1636,15 +1831,31 @@ scalar ) ) ) +if +components +. +len +( +) += += +columns +as +usize +* +rows +as +usize = > { let -vec_ty +element = -ctx -. -ensure_type_exists +Tr +: +: +Value ( crate : @@ -1652,13 +1863,38 @@ crate TypeInner : : -Vector -{ +Scalar +( scalar -size -: +) +) +; +ctx +. +try_automatic_conversions_slice +( +& +mut +components +& +element +ty_span +) +? +; +let +vec_ty += +ctx +. +ensure_type_exists +( +scalar +. +to_inner_vector +( rows -} +) ) ; let @@ -1752,6 +1988,8 @@ scalar } ) ; +expr += crate : : @@ -1763,6 +2001,7 @@ Compose ty components } +; } ( Components @@ -1770,24 +2009,9 @@ Components : Many { +mut components -first_component_ty_inner -: -& -crate -: -: -TypeInner -: -: -Vector -{ -scalar -. -. -} -. -. +spans } Constructor : @@ -1798,28 +2022,99 @@ columns rows } ) += +> +{ +let +consensus_scalar += +automatic_conversion_consensus +( +& +components +ctx +) +. +map_err +( +| +index | +{ +Error +: +: +InvalidConstructorComponentType ( -Components +spans +[ +index +] +index +as +i32 +) +} +) +? +; +ctx +. +convert_slice_to_common_scalar +( +& +mut +components +consensus_scalar +) +? +; +let +ty += +ctx +. +ensure_type_exists +( +crate : : -Many +TypeInner +: +: +Matrix { -components -first_component_ty_inner +columns +rows +scalar : -& +consensus_scalar +} +) +; +expr += crate : : -TypeInner +Expression : : -Vector +Compose { -. -. +ty +components +} +; } +( +Components +: +: +Many +{ +mut +components . . } @@ -1829,7 +2124,7 @@ Constructor Type ( ( -_ +ty & crate : @@ -1840,6 +2135,8 @@ TypeInner Matrix { columns +: +_ rows scalar } @@ -1850,26 +2147,43 @@ scalar > { let -ty +component_ty = -ctx -. -ensure_type_exists -( crate : : TypeInner : : -Matrix +Vector { -columns +size +: rows scalar } +; +ctx +. +try_automatic_conversions_slice +( +& +mut +components +& +Tr +: +: +Value +( +component_ty +) +ty_span ) +? ; +expr += crate : : @@ -1881,6 +2195,7 @@ Compose ty components } +; } ( components @@ -1893,6 +2208,7 @@ PartialArray > { let +mut components = components @@ -1901,6 +2217,35 @@ into_components_vec ( ) ; +if +let +Ok +( +consensus_scalar +) += +automatic_conversion_consensus +( +& +components +ctx +) +{ +ctx +. +convert_slice_to_common_scalar +( +& +mut +components +consensus_scalar +) +? +; +} +else +{ +} let base = @@ -2008,6 +2353,8 @@ ensure_type_exists inner ) ; +expr += crate : : @@ -2019,6 +2366,7 @@ Compose ty components } +; } ( components @@ -2038,19 +2386,7 @@ TypeInner : Array { -. -. -} -| -& -crate -: -: -TypeInner -: -: -Struct -{ +base . . } @@ -2061,6 +2397,7 @@ Struct > { let +mut components = components @@ -2069,6 +2406,27 @@ into_components_vec ( ) ; +ctx +. +try_automatic_conversions_slice +( +& +mut +components +& +Tr +: +: +Handle +( +base +) +ty_span +) +? +; +expr += crate : : @@ -2080,114 +2438,180 @@ Compose ty components } +; } ( -Components +components +Constructor : : -One +Type +( +( +ty +& +crate +: +: +TypeInner +: +: +Struct { -span -ty_inner +ref +members . . } -constructor +) +) ) = > { let -from_type +mut +components = -ty_inner +components . -to_wgsl +into_components_vec ( -& +) +; +let +struct_ty_span += ctx . module . -to_ctx +types +. +get_span ( -) +ty ) ; -return -Err -( -Error +let +members : +Vec +< +Handle +< +crate : -BadTypeCast -{ -span -from_type -to_type : -constructor +Type +> +> += +members . -to_error_string +iter ( -ctx ) -} +. +map +( +| +m +| +m +. +ty +) +. +collect +( ) ; -} +for ( -Components -: -: -Many -{ -spans +component +& +ty +) +in +components . +iter_mut +( +) . -} -Constructor -: -: -Type +zip ( +& +members +) +{ +* +component += +ctx +. +try_automatic_conversions ( -_ +* +component & +Tr +: +: +Handle +( +ty +) +struct_ty_span +) +? +; +} +expr += crate : : -TypeInner +Expression : : -Scalar +Compose +{ +ty +components +} +; +} +( +Components +: +: +One { +span +ty_inner . . } -) -) +constructor ) = > { let -span +from_type = -spans -[ -1 -] +ty_inner . -until +to_wgsl ( -spans +& +ctx . -last -( -) +module . -unwrap +to_ctx ( ) ) @@ -2198,10 +2622,19 @@ Err Error : : -UnexpectedComponents -( +BadTypeCast +{ span +from_type +to_type +: +constructor +. +to_error_string +( +ctx ) +} ) ; } @@ -2221,20 +2654,7 @@ Constructor Type ( ( -_ -& -crate -: -: -TypeInner -: -: -Vector -{ -. -. -} -| +_ & crate : @@ -2242,48 +2662,47 @@ crate TypeInner : : -Matrix +Scalar { . . } ) ) -| -Constructor -: -: -PartialVector +) += +> { +let +span += +spans +[ +1 +] . +until +( +spans . -} -| -Constructor -: -: -PartialMatrix -{ -. +last +( +) . -} +unwrap +( ) -= -> -{ +) +; return Err ( Error : : -InvalidConstructorComponentType +UnexpectedComponents ( -spans -[ -0 -] -0 +span ) ) ; @@ -2303,7 +2722,6 @@ ty_span ) ) } -; let expr = @@ -2705,3 +3123,244 @@ handle ) } } +fn +automatic_conversion_consensus +( +components +: +& +[ +Handle +< +crate +: +: +Expression +> +] +ctx +: +& +ExpressionContext +< +' +_ +' +_ +' +_ +> +) +- +> +Result +< +Scalar +usize +> +{ +let +types += +& +ctx +. +module +. +types +; +let +mut +inners += +components +. +iter +( +) +. +map +( +| +& +c +| +ctx +. +typifier +( +) +[ +c +] +. +inner_with +( +types +) +) +; +log +: +: +debug +! +( +" +wgsl +automatic_conversion_consensus +: +{ +: +? +} +" +inners +. +clone +( +) +. +map +( +| +inner +| +inner +. +to_wgsl +( +& +ctx +. +module +. +to_ctx +( +) +) +) +. +collect +: +: +< +Vec +< +String +> +> +( +) +) +; +let +mut +best += +inners +. +next +( +) +. +unwrap +( +) +. +scalar +( +) +. +ok_or +( +0_usize +) +? +; +for +( +inner +i +) +in +inners +. +zip +( +1 +. +. +) +{ +let +scalar += +inner +. +scalar +( +) +. +ok_or +( +i +) +? +; +match +best +. +automatic_conversion_combine +( +scalar +) +{ +Some +( +new_best +) += +> +{ +best += +new_best +; +} +None += +> +return +Err +( +i +) +} +} +log +: +: +debug +! +( +" +consensus +: +{ +: +? +} +" +best +. +to_wgsl +( +) +) +; +Ok +( +best +) +} diff --git a/third_party/rust/naga/src/front/wgsl/lower/conversion.rs b/third_party/rust/naga/src/front/wgsl/lower/conversion.rs new file mode 100644 index 000000000000..0c518af798fe --- /dev/null +++ b/third_party/rust/naga/src/front/wgsl/lower/conversion.rs @@ -0,0 +1,1896 @@ +use +crate +: +: +{ +Handle +Span +} +; +impl +< +' +source +' +temp +' +out +> +super +: +: +ExpressionContext +< +' +source +' +temp +' +out +> +{ +pub +fn +try_automatic_conversions +( +& +mut +self +expr +: +Handle +< +crate +: +: +Expression +> +goal_ty +: +& +crate +: +: +proc +: +: +TypeResolution +goal_span +: +Span +) +- +> +Result +< +Handle +< +crate +: +: +Expression +> +super +: +: +Error +< +' +source +> +> +{ +let +expr_span += +self +. +get_expression_span +( +expr +) +; +let +expr_resolution += +super +: +: +resolve +! +( +self +expr +) +; +let +types += +& +self +. +module +. +types +; +let +expr_inner += +expr_resolution +. +inner_with +( +types +) +; +let +goal_inner += +goal_ty +. +inner_with +( +types +) +; +if +expr_inner +. +equivalent +( +goal_inner +types +) +{ +return +Ok +( +expr +) +; +} +let +( +_expr_scalar +goal_scalar +) += +match +expr_inner +. +automatically_converts_to +( +goal_inner +types +) +{ +Some +( +scalars +) += +> +scalars +None += +> +{ +let +gctx += +& +self +. +module +. +to_ctx +( +) +; +let +source_type += +expr_resolution +. +to_wgsl +( +gctx +) +; +let +dest_type += +goal_ty +. +to_wgsl +( +gctx +) +; +return +Err +( +super +: +: +Error +: +: +AutoConversion +{ +dest_span +: +goal_span +dest_type +source_span +: +expr_span +source_type +} +) +; +} +} +; +let +converted += +if +let +crate +: +: +TypeInner +: +: +Array +{ +. +. +} += +* +goal_inner +{ +let +span += +self +. +get_expression_span +( +expr +) +; +self +. +as_const_evaluator +( +) +. +cast_array +( +expr +goal_scalar +span +) +. +map_err +( +| +err +| +super +: +: +Error +: +: +ConstantEvaluatorError +( +err +span +) +) +? +} +else +{ +let +cast += +crate +: +: +Expression +: +: +As +{ +expr +kind +: +goal_scalar +. +kind +convert +: +Some +( +goal_scalar +. +width +) +} +; +self +. +append_expression +( +cast +expr_span +) +? +} +; +Ok +( +converted +) +} +pub +fn +try_automatic_conversions_slice +( +& +mut +self +exprs +: +& +mut +[ +Handle +< +crate +: +: +Expression +> +] +goal_ty +: +& +crate +: +: +proc +: +: +TypeResolution +goal_span +: +Span +) +- +> +Result +< +( +) +super +: +: +Error +< +' +source +> +> +{ +for +expr +in +exprs +. +iter_mut +( +) +{ +* +expr += +self +. +try_automatic_conversions +( +* +expr +goal_ty +goal_span +) +? +; +} +Ok +( +( +) +) +} +pub +fn +try_automatic_conversions_for_vector +( +& +mut +self +exprs +: +& +mut +[ +Handle +< +crate +: +: +Expression +> +] +goal_scalar +: +crate +: +: +Scalar +goal_span +: +Span +) +- +> +Result +< +( +) +super +: +: +Error +< +' +source +> +> +{ +use +crate +: +: +proc +: +: +TypeResolution +as +Tr +; +use +crate +: +: +TypeInner +as +Ti +; +let +goal_scalar_res += +Tr +: +: +Value +( +Ti +: +: +Scalar +( +goal_scalar +) +) +; +for +( +i +expr +) +in +exprs +. +iter_mut +( +) +. +enumerate +( +) +{ +let +expr_resolution += +super +: +: +resolve +! +( +self +* +expr +) +; +let +types += +& +self +. +module +. +types +; +let +expr_inner += +expr_resolution +. +inner_with +( +types +) +; +match +* +expr_inner +{ +Ti +: +: +Scalar +( +_ +) += +> +{ +* +expr += +self +. +try_automatic_conversions +( +* +expr +& +goal_scalar_res +goal_span +) +? +; +} +Ti +: +: +Vector +{ +size +scalar +: +_ +} += +> +{ +let +goal_vector_res += +Tr +: +: +Value +( +Ti +: +: +Vector +{ +size +scalar +: +goal_scalar +} +) +; +* +expr += +self +. +try_automatic_conversions +( +* +expr +& +goal_vector_res +goal_span +) +? +; +} +_ += +> +{ +let +span += +self +. +get_expression_span +( +* +expr +) +; +return +Err +( +super +: +: +Error +: +: +InvalidConstructorComponentType +( +span +i +as +i32 +) +) +; +} +} +} +Ok +( +( +) +) +} +pub +fn +convert_slice_to_common_scalar +( +& +mut +self +exprs +: +& +mut +[ +Handle +< +crate +: +: +Expression +> +] +goal +: +crate +: +: +Scalar +) +- +> +Result +< +( +) +super +: +: +Error +< +' +source +> +> +{ +for +expr +in +exprs +. +iter_mut +( +) +{ +let +inner += +super +: +: +resolve_inner +! +( +self +* +expr +) +; +if +inner +. +scalar +( +) +! += +Some +( +goal +) +{ +let +cast += +crate +: +: +Expression +: +: +As +{ +expr +: +* +expr +kind +: +goal +. +kind +convert +: +Some +( +goal +. +width +) +} +; +let +expr_span += +self +. +get_expression_span +( +* +expr +) +; +* +expr += +self +. +append_expression +( +cast +expr_span +) +? +; +} +} +Ok +( +( +) +) +} +pub +fn +concretize +( +& +mut +self +mut +expr +: +Handle +< +crate +: +: +Expression +> +) +- +> +Result +< +Handle +< +crate +: +: +Expression +> +super +: +: +Error +< +' +source +> +> +{ +let +inner += +super +: +: +resolve_inner +! +( +self +expr +) +; +if +let +Some +( +scalar +) += +inner +. +automatically_convertible_scalar +( +& +self +. +module +. +types +) +{ +let +concretized += +scalar +. +concretize +( +) +; +if +concretized +! += +scalar +{ +let +span += +self +. +get_expression_span +( +expr +) +; +expr += +self +. +as_const_evaluator +( +) +. +cast_array +( +expr +concretized +span +) +. +map_err +( +| +err +| +super +: +: +Error +: +: +ConstantEvaluatorError +( +err +span +) +) +? +; +} +} +Ok +( +expr +) +} +} +impl +crate +: +: +TypeInner +{ +fn +automatically_converts_to +( +& +self +goal +: +& +Self +types +: +& +crate +: +: +UniqueArena +< +crate +: +: +Type +> +) +- +> +Option +< +( +crate +: +: +Scalar +crate +: +: +Scalar +) +> +{ +use +crate +: +: +ScalarKind +as +Sk +; +use +crate +: +: +TypeInner +as +Ti +; +let +expr_scalar +; +let +goal_scalar +; +match +( +self +goal +) +{ +( +& +Ti +: +: +Scalar +( +expr +) +& +Ti +: +: +Scalar +( +goal +) +) += +> +{ +expr_scalar += +expr +; +goal_scalar += +goal +; +} +( +& +Ti +: +: +Vector +{ +size +: +expr_size +scalar +: +expr +} +& +Ti +: +: +Vector +{ +size +: +goal_size +scalar +: +goal +} +) +if +expr_size += += +goal_size += +> +{ +expr_scalar += +expr +; +goal_scalar += +goal +; +} +( +& +Ti +: +: +Matrix +{ +rows +: +expr_rows +columns +: +expr_columns +scalar +: +expr +} +& +Ti +: +: +Matrix +{ +rows +: +goal_rows +columns +: +goal_columns +scalar +: +goal +} +) +if +expr_rows += += +goal_rows +& +& +expr_columns += += +goal_columns += +> +{ +expr_scalar += +expr +; +goal_scalar += +goal +; +} +( +& +Ti +: +: +Array +{ +base +: +expr_base +size +: +expr_size +stride +: +_ +} +& +Ti +: +: +Array +{ +base +: +goal_base +size +: +goal_size +stride +: +_ +} +) +if +expr_size += += +goal_size += +> +{ +return +types +[ +expr_base +] +. +inner +. +automatically_converts_to +( +& +types +[ +goal_base +] +. +inner +types +) +; +} +_ += +> +return +None +} +match +( +expr_scalar +. +kind +goal_scalar +. +kind +) +{ +( +Sk +: +: +AbstractFloat +Sk +: +: +Float +) += +> +{ +} +( +Sk +: +: +AbstractInt +Sk +: +: +Sint +| +Sk +: +: +Uint +| +Sk +: +: +AbstractFloat +| +Sk +: +: +Float +) += +> +{ +} +_ += +> +return +None +} +log +: +: +trace +! +( +" +okay +: +expr +{ +expr_scalar +: +? +} +goal +{ +goal_scalar +: +? +} +" +) +; +Some +( +( +expr_scalar +goal_scalar +) +) +} +fn +automatically_convertible_scalar +( +& +self +types +: +& +crate +: +: +UniqueArena +< +crate +: +: +Type +> +) +- +> +Option +< +crate +: +: +Scalar +> +{ +use +crate +: +: +TypeInner +as +Ti +; +match +* +self +{ +Ti +: +: +Scalar +( +scalar +) +| +Ti +: +: +Vector +{ +scalar +. +. +} +| +Ti +: +: +Matrix +{ +scalar +. +. +} += +> +{ +Some +( +scalar +) +} +Ti +: +: +Array +{ +base +. +. +} += +> +types +[ +base +] +. +inner +. +automatically_convertible_scalar +( +types +) +Ti +: +: +Atomic +( +_ +) +| +Ti +: +: +Pointer +{ +. +. +} +| +Ti +: +: +ValuePointer +{ +. +. +} +| +Ti +: +: +Struct +{ +. +. +} +| +Ti +: +: +Image +{ +. +. +} +| +Ti +: +: +Sampler +{ +. +. +} +| +Ti +: +: +AccelerationStructure +| +Ti +: +: +RayQuery +| +Ti +: +: +BindingArray +{ +. +. +} += +> +None +} +} +} +impl +crate +: +: +Scalar +{ +pub +const +fn +automatic_conversion_combine +( +self +other +: +Self +) +- +> +Option +< +crate +: +: +Scalar +> +{ +use +crate +: +: +ScalarKind +as +Sk +; +match +( +self +. +kind +other +. +kind +) +{ +( +Sk +: +: +AbstractFloat +Sk +: +: +AbstractFloat +) +| +( +Sk +: +: +AbstractInt +Sk +: +: +AbstractInt +) +| +( +Sk +: +: +Sint +Sk +: +: +Sint +) +| +( +Sk +: +: +Uint +Sk +: +: +Uint +) +| +( +Sk +: +: +Float +Sk +: +: +Float +) +| +( +Sk +: +: +Bool +Sk +: +: +Bool +) += +> +{ +if +self +. +width += += +other +. +width +{ +Some +( +self +) +} +else +{ +None +} +} +( +Sk +: +: +AbstractFloat +Sk +: +: +AbstractInt +) += +> +Some +( +self +) +( +Sk +: +: +AbstractInt +Sk +: +: +AbstractFloat +) += +> +Some +( +other +) +( +Sk +: +: +AbstractFloat +Sk +: +: +Float +) += +> +Some +( +other +) +( +Sk +: +: +Float +Sk +: +: +AbstractFloat +) += +> +Some +( +self +) +( +Sk +: +: +AbstractInt +Sk +: +: +Uint +| +Sk +: +: +Sint +| +Sk +: +: +Float +) += +> +Some +( +other +) +( +Sk +: +: +Uint +| +Sk +: +: +Sint +| +Sk +: +: +Float +Sk +: +: +AbstractInt +) += +> +Some +( +self +) +( +Sk +: +: +AbstractFloat +Sk +: +: +Uint +| +Sk +: +: +Sint +) +| +( +Sk +: +: +Uint +| +Sk +: +: +Sint +Sk +: +: +AbstractFloat +) += +> +{ +None +} +( +Sk +: +: +Bool +_ +) +| +( +_ +Sk +: +: +Bool +) += +> +None +( +Sk +: +: +Sint +| +Sk +: +: +Uint +| +Sk +: +: +Float +Sk +: +: +Sint +| +Sk +: +: +Uint +| +Sk +: +: +Float +) += +> +None +} +} +const +fn +concretize +( +self +) +- +> +Self +{ +use +crate +: +: +ScalarKind +as +Sk +; +match +self +. +kind +{ +Sk +: +: +Sint +| +Sk +: +: +Uint +| +Sk +: +: +Float +| +Sk +: +: +Bool += +> +self +Sk +: +: +AbstractInt += +> +Self +: +: +I32 +Sk +: +: +AbstractFloat += +> +Self +: +: +F32 +} +} +} diff --git a/third_party/rust/naga/src/front/wgsl/lower/mod.rs b/third_party/rust/naga/src/front/wgsl/lower/mod.rs index 7871961d08f3..49136402c412 100644 --- a/third_party/rust/naga/src/front/wgsl/lower/mod.rs +++ b/third_party/rust/naga/src/front/wgsl/lower/mod.rs @@ -117,6 +117,9 @@ Span mod construction ; +mod +conversion +; macro_rules ! resolve_inner @@ -285,6 +288,13 @@ expr ; } pub +( +super +) +use +resolve +; +pub struct GlobalContext < @@ -435,6 +445,12 @@ ensure_type_exists & mut self +name +: +Option +< +String +> inner : crate @@ -467,8 +483,6 @@ Type { inner name -: -None } Span : @@ -2826,6 +2840,7 @@ as_global . ensure_type_exists ( +None inner ) } @@ -4331,11 +4346,12 @@ as_const ) ; let +mut init = self . -expression +expression_for_abstract ( c . @@ -4347,73 +4363,94 @@ ectx ? ; let -inferred_type -= -ectx -. -register_type -( -init -) -? +ty ; +if let +Some +( explicit_ty +) = c . ty -. -map -( -| -ty -| +{ +let +explicit_ty += self . resolve_ast_type ( -ty +explicit_ty & mut -ctx -) -) +ectx . -transpose +as_global ( ) +) ? ; -if let -Some -( -explicit -) +explicit_ty_res = +crate +: +: +proc +: +: +TypeResolution +: +: +Handle +( explicit_ty -{ -if -explicit -! -= -inferred_type -{ -let -gctx +) +; +init = -ctx -. -module +ectx . -to_ctx +try_automatic_conversions ( +init +& +explicit_ty_res +c +. +name +. +span ) -; -return -Err +. +map_err ( +| +error +| +match +error +{ +Error +: +: +AutoConversion +{ +dest_span +: +_ +dest_type +source_span +: +_ +source_type +} += +> Error : : @@ -4428,27 +4465,47 @@ name span expected : -explicit -. -to_wgsl -( -& -gctx -) +dest_type got : -inferred_type +source_type +} +other += +> +other +} +) +? +; +ty += +explicit_ty +; +} +else +{ +init += +ectx . -to_wgsl +concretize ( -& -gctx +init ) -} +? +; +ty += +ectx +. +register_type +( +init ) +? ; } -} let handle = @@ -4491,8 +4548,6 @@ Override : None ty -: -inferred_type init } span @@ -4590,11 +4645,23 @@ ty = self . -resolve_ast_type +resolve_named_ast_type ( alias . ty +Some +( +alias +. +name +. +name +. +to_string +( +) +) & mut ctx @@ -4624,6 +4691,19 @@ ty } } } +crate +: +: +compact +: +: +compact +( +& +mut +module +) +; Ok ( module @@ -8016,6 +8096,76 @@ expr = self . +expression_for_abstract +( +expr +ctx +) +? +; +ctx +. +concretize +( +expr +) +} +fn +expression_for_abstract +( +& +mut +self +expr +: +Handle +< +ast +: +: +Expression +< +' +source +> +> +ctx +: +& +mut +ExpressionContext +< +' +source +' +_ +' +_ +> +) +- +> +Result +< +Handle +< +crate +: +: +Expression +> +Error +< +' +source +> +> +{ +let +expr += +self +. expression_for_reference ( expr @@ -8233,25 +8383,83 @@ Literal : Number ( -_ +Number +: +: +F64 +( +f +) +) += +> +crate +: +: +Literal +: +: +F64 +( +f +) +ast +: +: +Literal +: +: +Number +( +Number +: +: +AbstractInt +( +i +) +) += +> +crate +: +: +Literal +: +: +AbstractInt +( +i +) +ast +: +: +Literal +: +: +Number +( +Number +: +: +AbstractFloat +( +f +) ) = > { -unreachable -! +crate +: +: +Literal +: +: +AbstractFloat ( -" -got -abstract -numeric -type -when -not -expected -" +f ) -; } ast : @@ -15070,7 +15278,7 @@ Dynamic ) } fn -resolve_ast_type +resolve_named_ast_type ( & mut @@ -15088,6 +15296,12 @@ Type source > > +name +: +Option +< +String +> ctx : & @@ -15610,11 +15824,72 @@ ctx . ensure_type_exists ( +name inner ) ) } fn +resolve_ast_type +( +& +mut +self +handle +: +Handle +< +ast +: +: +Type +< +' +source +> +> +ctx +: +& +mut +GlobalContext +< +' +source +' +_ +' +_ +> +) +- +> +Result +< +Handle +< +crate +: +: +Type +> +Error +< +' +source +> +> +{ +self +. +resolve_named_ast_type +( +handle +None +ctx +) +} +fn binding ( & diff --git a/third_party/rust/naga/src/front/wgsl/parse/lexer.rs b/third_party/rust/naga/src/front/wgsl/parse/lexer.rs index a850ef898508..ead7fb0fda6a 100644 --- a/third_party/rust/naga/src/front/wgsl/parse/lexer.rs +++ b/third_party/rust/naga/src/front/wgsl/parse/lexer.rs @@ -3312,6 +3312,10 @@ cfg test ) ] +# +[ +track_caller +] fn sub_test ( @@ -3408,7 +3412,7 @@ Ok Number : : -I32 +AbstractInt ( 291 ) @@ -3456,7 +3460,7 @@ Ok Number : : -I32 +AbstractInt ( 123 ) @@ -3472,7 +3476,7 @@ Ok Number : : -I32 +AbstractInt ( 0 ) @@ -3504,7 +3508,7 @@ Ok Number : : -I32 +AbstractInt ( 63 ) @@ -3588,7 +3592,7 @@ Ok Number : : -F32 +AbstractFloat ( 1 . @@ -3605,7 +3609,7 @@ Ok Number : : -F32 +AbstractFloat ( 0 . @@ -3623,7 +3627,7 @@ Ok Number : : -F32 +AbstractFloat ( 12 . @@ -3671,7 +3675,7 @@ Ok Number : : -F32 +AbstractFloat ( 0 . @@ -3689,7 +3693,7 @@ Ok Number : : -F32 +AbstractFloat ( 43 . @@ -3724,7 +3728,7 @@ Ok Number : : -F32 +AbstractFloat ( 0 . @@ -3755,7 +3759,7 @@ Ok Number : : -F32 +AbstractFloat ( 0 . @@ -4561,6 +4565,151 @@ NotRepresentable test ] fn +double_floats +( +) +{ +sub_test +( +" +0x1 +. +2p4lf +0x1p8lf +0 +. +0625lf +625e +- +4lf +10lf +10l +" +& +[ +Token +: +: +Number +( +Ok +( +Number +: +: +F64 +( +18 +. +0 +) +) +) +Token +: +: +Number +( +Ok +( +Number +: +: +F64 +( +256 +. +0 +) +) +) +Token +: +: +Number +( +Ok +( +Number +: +: +F64 +( +0 +. +0625 +) +) +) +Token +: +: +Number +( +Ok +( +Number +: +: +F64 +( +0 +. +0625 +) +) +) +Token +: +: +Number +( +Ok +( +Number +: +: +F64 +( +10 +. +0 +) +) +) +Token +: +: +Number +( +Ok +( +Number +: +: +AbstractInt +( +10 +) +) +) +Token +: +: +Word +( +" +l +" +) +] +) +} +# +[ +test +] +fn test_tokens ( ) @@ -4601,7 +4750,7 @@ Ok Number : : -I32 +AbstractInt ( 92 ) @@ -4652,7 +4801,7 @@ Ok Number : : -I32 +AbstractInt ( 3 ) @@ -4707,7 +4856,7 @@ Ok Number : : -I32 +AbstractInt ( 44 ) @@ -4958,6 +5107,162 @@ Operation ] ) ; +sub_test +( +" +0x1 +. +2f +0x1 +. +2f +0x1 +. +2h +0x1 +. +2H +0x1 +. +2lf +" +& +[ +Token +: +: +Number +( +Ok +( +Number +: +: +AbstractFloat +( +1 +. +0 ++ +0x2f +as +f64 +/ +256 +. +0 +) +) +) +Token +: +: +Number +( +Ok +( +Number +: +: +AbstractFloat +( +1 +. +0 ++ +0x2f +as +f64 +/ +256 +. +0 +) +) +) +Token +: +: +Number +( +Ok +( +Number +: +: +AbstractFloat +( +1 +. +125 +) +) +) +Token +: +: +Word +( +" +h +" +) +Token +: +: +Number +( +Ok +( +Number +: +: +AbstractFloat +( +1 +. +125 +) +) +) +Token +: +: +Word +( +" +H +" +) +Token +: +: +Number +( +Ok +( +Number +: +: +AbstractFloat +( +1 +. +125 +) +) +) +Token +: +: +Word +( +" +lf +" +) +] +) } # [ @@ -5021,7 +5326,7 @@ Ok Number : : -I32 +AbstractInt ( 0 ) diff --git a/third_party/rust/naga/src/front/wgsl/parse/number.rs b/third_party/rust/naga/src/front/wgsl/parse/number.rs index 65fdb63989c8..ff577c97b103 100644 --- a/third_party/rust/naga/src/front/wgsl/parse/number.rs +++ b/third_party/rust/naga/src/front/wgsl/parse/number.rs @@ -74,117 +74,11 @@ F32 ( f32 ) -} -impl -Number -{ -fn -abstract_to_concrete -( -self -) -- -> -Result -< -Number -NumberError -> -{ -match -self -{ -Number -: -: -AbstractInt -( -num -) -= -> -i32 -: -: -try_from +F64 ( -num -) -. -map -( -Number -: -: -I32 -) -. -map_err -( -| -_ -| -NumberError -: -: -NotRepresentable -) -Number -: -: -AbstractFloat -( -num -) -= -> -{ -let -num -= -num -as -f32 -; -if -num -. -is_finite -( -) -{ -Ok -( -Number -: -: -F32 -( -num -) -) -} -else -{ -Err -( -NumberError -: -: -NotRepresentable -) -} -} -num -= -> -Ok -( -num +f64 ) } -} -} pub ( in @@ -234,14 +128,6 @@ Token Number ( result -. -and_then -( -Number -: -: -abstract_to_concrete -) ) rest ) @@ -264,11 +150,19 @@ IntKind I32 U32 } +# +[ +derive +( +Debug +) +] enum FloatKind { -F32 F16 +F32 +F64 } fn parse @@ -349,9 +243,12 @@ bytes ident [ ( +( pattern : pat_param +) +* = > to @@ -359,6 +256,9 @@ to expr ) * +( +) +? ] ) = @@ -370,7 +270,10 @@ bytes ( & [ +( pattern +) +* ref rest . @@ -546,6 +449,62 @@ len } macro_rules ! +consume_float_suffix +{ +( +bytes +: +ident +) += +> +{ +consume_map +! +( +bytes +[ +b +' +h +' += +> +FloatKind +: +: +F16 +b +' +f +' += +> +FloatKind +: +: +F32 +b +' +l +' +b +' +f +' += +> +FloatKind +: +: +F64 +] +) +} +; +} +macro_rules +! rest_to_str { ( @@ -904,32 +863,10 @@ bytes let kind = -consume_map +consume_float_suffix ! ( bytes -[ -b -' -f -' -= -> -FloatKind -: -: -F32 -b -' -h -' -= -> -FloatKind -: -: -F16 -] ) ; ( @@ -1094,32 +1031,10 @@ bytes let kind = -consume_map +consume_float_suffix ! ( bytes -[ -b -' -f -' -= -> -FloatKind -: -: -F32 -b -' -h -' -= -> -FloatKind -: -: -F16 -] ) ; ( @@ -1337,32 +1252,10 @@ bytes let kind = -consume_map +consume_float_suffix ! ( bytes -[ -b -' -f -' -= -> -FloatKind -: -: -F32 -b -' -h -' -= -> -FloatKind -: -: -F16 -] ) ; ( @@ -1479,32 +1372,10 @@ bytes let kind = -consume_map +consume_float_suffix ! ( bytes -[ -b -' -f -' -= -> -FloatKind -: -: -F32 -b -' -h -' -= -> -FloatKind -: -: -F16 -] ) ; ( @@ -1599,6 +1470,22 @@ U32 ) b ' +h +' += +> +Kind +: +: +Float +( +FloatKind +: +: +F16 +) +b +' f ' = @@ -1615,7 +1502,11 @@ F32 ) b ' -h +l +' +b +' +f ' = > @@ -1627,7 +1518,7 @@ Float FloatKind : : -F16 +F64 ) ] ) @@ -1966,6 +1857,22 @@ Some FloatKind : : +F16 +) += +> +Err +( +NumberError +: +: +UnimplementedF16 +) +Some +( +FloatKind +: +: F32 ) = @@ -2012,19 +1919,49 @@ Some FloatKind : : -F16 +F64 ) = > +match +hexf_parse +: +: +parse_hexf64 +( +input +false +) +{ +Ok +( +num +) += +> +Ok +( +Number +: +: +F64 +( +num +) +) +_ += +> Err ( NumberError : : -UnimplementedF16 +NotRepresentable ) } } +} fn parse_dec_float ( @@ -2155,6 +2092,59 @@ Some FloatKind : : +F64 +) += +> +{ +let +num += +input +. +parse +: +: +< +f64 +> +( +) +. +unwrap +( +) +; +num +. +is_finite +( +) +. +then_some +( +Number +: +: +F64 +( +num +) +) +. +ok_or +( +NumberError +: +: +NotRepresentable +) +} +Some +( +FloatKind +: +: F16 ) = diff --git a/third_party/rust/naga/src/front/wgsl/tests.rs b/third_party/rust/naga/src/front/wgsl/tests.rs index 1ef3a111418c..0d22d27af67b 100644 --- a/third_party/rust/naga/src/front/wgsl/tests.rs +++ b/third_party/rust/naga/src/front/wgsl/tests.rs @@ -615,7 +615,8 @@ vec2 f32 > ( -0 +0i +0i ) ; } @@ -1435,15 +1436,9 @@ vec3 u32 > ( -0 -. -0 -1 -. -0 -2 -. -0 +0u +1u +2u ) 1 ) diff --git a/third_party/rust/naga/src/front/wgsl/to_wgsl.rs b/third_party/rust/naga/src/front/wgsl/to_wgsl.rs index 9a799aa4d046..e7fab6ad179b 100644 --- a/third_party/rust/naga/src/front/wgsl/to_wgsl.rs +++ b/third_party/rust/naga/src/front/wgsl/to_wgsl.rs @@ -1008,6 +1008,44 @@ bool to_string ( ) +crate +: +: +ScalarKind +: +: +AbstractInt += +> +return +" +{ +AbstractInt +} +" +. +to_string +( +) +crate +: +: +ScalarKind +: +: +AbstractFloat += +> +return +" +{ +AbstractFloat +} +" +. +to_string +( +) } ; format diff --git a/third_party/rust/naga/src/lib.rs b/third_party/rust/naga/src/lib.rs index 785e20fd9d0d..9d8e9b9fd9a4 100644 --- a/third_party/rust/naga/src/lib.rs +++ b/third_party/rust/naga/src/lib.rs @@ -239,6 +239,14 @@ Bytes 1 ; pub +const +ABSTRACT_WIDTH +: +Bytes += +8 +; +pub type FastHashMap < @@ -882,6 +890,8 @@ Sint Uint Float Bool +AbstractInt +AbstractFloat } # [ @@ -1994,6 +2004,14 @@ Bool ( bool ) +AbstractInt +( +i64 +) +AbstractFloat +( +f64 +) } # [ diff --git a/third_party/rust/naga/src/proc/constant_evaluator.rs b/third_party/rust/naga/src/proc/constant_evaluator.rs index 8c51412092a6..eb5f25b51d88 100644 --- a/third_party/rust/naga/src/proc/constant_evaluator.rs +++ b/third_party/rust/naga/src/proc/constant_evaluator.rs @@ -708,10 +708,25 @@ error Cannot cast type +{ +from +} +to +{ +to +} " ) ] InvalidCastArg +{ +from +: +String +to +: +String +} # [ error @@ -942,6 +957,69 @@ String error ( " +the +concrete +type +{ +to_type +} +cannot +represent +the +abstract +value +{ +value +} +accurately +" +) +] +AutomaticConversionLossy +{ +value +: +String +to_type +: +& +' +static +str +} +# +[ +error +( +" +abstract +floating +- +point +values +cannot +be +automatically +converted +to +integers +" +) +] +AutomaticConversionFloatToInt +{ +to_type +: +& +' +static +str +} +# +[ +error +( +" Division by zero @@ -1363,6 +1441,67 @@ block ) } } +pub +fn +to_ctx +( +& +self +) +- +> +crate +: +: +proc +: +: +GlobalCtx +{ +crate +: +: +proc +: +: +GlobalCtx +{ +types +: +self +. +types +constants +: +self +. +constants +const_expressions +: +match +self +. +function_local_data +{ +Some +( +ref +data +) += +> +data +. +const_expressions +None += +> +self +. +expressions +} +} +} fn check ( @@ -5447,6 +5586,155 @@ span ? ; let +make_error += +| +| +- +> +Result +< +_ +ConstantEvaluatorError +> +{ +let +ty += +self +. +resolve_type +( +expr +) +? +; +# +[ +cfg +( +feature += +" +wgsl +- +in +" +) +] +let +from += +ty +. +to_wgsl +( +& +self +. +to_ctx +( +) +) +; +# +[ +cfg +( +feature += +" +wgsl +- +in +" +) +] +let +to += +target +. +to_wgsl +( +) +; +# +[ +cfg +( +not +( +feature += +" +wgsl +- +in +" +) +) +] +let +from += +format +! +( +" +{ +ty +: +? +} +" +) +; +# +[ +cfg +( +not +( +feature += +" +wgsl +- +in +" +) +) +] +let +to += +format +! +( +" +{ +target +: +? +} +" +) +; +Err +( +ConstantEvaluatorError +: +: +InvalidCastArg +{ +from +to +} +) +} +; +let expr = match @@ -5552,14 +5840,45 @@ _ > { return -Err +make_error ( -ConstantEvaluatorError -: -: -InvalidCastArg ) +; } +Literal +: +: +AbstractInt +( +v +) += +> +i32 +: +: +try_from_abstract +( +v +) +? +Literal +: +: +AbstractFloat +( +v +) += +> +i32 +: +: +try_from_abstract +( +v +) +? } ) Sc @@ -5641,14 +5960,45 @@ _ > { return -Err +make_error ( -ConstantEvaluatorError +) +; +} +Literal : : -InvalidCastArg +AbstractInt +( +v ) -} += +> +u32 +: +: +try_from_abstract +( +v +) +? +Literal +: +: +AbstractFloat +( +v +) += +> +u32 +: +: +try_from_abstract +( +v +) +? } ) Sc @@ -5732,14 +6082,168 @@ _ > { return -Err +make_error ( -ConstantEvaluatorError +) +; +} +Literal : : -InvalidCastArg +AbstractInt +( +v +) += +> +f32 +: +: +try_from_abstract +( +v +) +? +Literal +: +: +AbstractFloat +( +v +) += +> +f32 +: +: +try_from_abstract +( +v ) +? } +) +Sc +: +: +F64 += +> +Literal +: +: +F64 +( +match +literal +{ +Literal +: +: +I32 +( +v +) += +> +v +as +f64 +Literal +: +: +U32 +( +v +) += +> +v +as +f64 +Literal +: +: +F32 +( +v +) += +> +v +as +f64 +Literal +: +: +F64 +( +v +) += +> +v +Literal +: +: +Bool +( +v +) += +> +v +as +u32 +as +f64 +Literal +: +: +I64 +( +_ +) += +> +return +make_error +( +) +Literal +: +: +AbstractInt +( +v +) += +> +f64 +: +: +try_from_abstract +( +v +) +? +Literal +: +: +AbstractFloat +( +v +) += +> +f64 +: +: +try_from_abstract +( +v +) +? } ) Sc @@ -5822,39 +6326,120 @@ I64 ( _ ) +| +Literal +: +: +AbstractInt +( +_ +) +| +Literal +: +: +AbstractFloat +( +_ +) = > { return -Err +make_error ( -ConstantEvaluatorError -: -: -InvalidCastArg ) +; } } ) -_ +Sc +: +: +ABSTRACT_FLOAT = > -return -Err +Literal +: +: +AbstractFloat ( -ConstantEvaluatorError +match +literal +{ +Literal : : -InvalidCastArg +AbstractInt +( +v ) += +> +{ +v +as +f64 } -; -Expression +Literal : : -Literal +AbstractFloat ( -literal +v +) += +> +v +_ += +> +return +make_error +( +) +} +) +_ += +> +{ +log +: +: +debug +! +( +" +Constant +evaluator +refused +to +convert +value +to +{ +target +: +? +} +" +) +; +return +make_error +( +) +; +} +} +; +Expression +: +: +Literal +( +literal ) } Expression @@ -5932,12 +6517,8 @@ _ = > return -Err +make_error ( -ConstantEvaluatorError -: -: -InvalidCastArg ) } ; @@ -6054,12 +6635,8 @@ _ = > return -Err +make_error ( -ConstantEvaluatorError -: -: -InvalidCastArg ) } ; @@ -6071,21 +6648,25 @@ expr span ) } +pub fn -unary_op +cast_array ( & mut self -op -: -UnaryOperator expr : Handle < Expression > +target +: +crate +: +: +Scalar span : Span @@ -6102,131 +6683,416 @@ ConstantEvaluatorError > { let -expr +Expression +: +: +Compose +{ +ty +ref +components +} = self . -eval_zero_value_and_splat +expressions +[ +expr +] +else +{ +return +self +. +cast ( expr +target span ) -? +; +} ; let -expr +crate +: +: +TypeInner +: +: +Array +{ +base +: +_ +size +stride +: +_ +} = -match self . -expressions +types [ -expr +ty ] +. +inner +else { -Expression -: -: -Literal +return +self +. +cast ( -value +expr +target +span ) +; +} +; +let +mut +components = -> -Expression -: -: -Literal +components +. +clone ( -match -op +) +; +for +component +in +& +mut +components { -UnaryOperator -: -: -Negate +* +component = -> -match -value -{ -Literal -: -: -I32 +self +. +cast_array ( -v +* +component +target +span ) +? +; +} +let +first = -> -Literal -: -: -I32 +components +. +first ( -- -v ) -Literal -: -: -F32 +. +unwrap ( -v ) +; +let +new_base = -> -Literal -: -: -F32 +match +self +. +resolve_type ( -- -v +* +first ) -_ -= -> -return -Err -( -ConstantEvaluatorError +? +{ +crate : : -InvalidUnaryOpArg -) -} -UnaryOperator +proc : : -LogicalNot -= -> -match -value -{ -Literal +TypeResolution : : -Bool +Handle ( -v +ty ) = > -Literal +ty +crate : : -Bool +proc +: +: +TypeResolution +: +: +Value ( -! -v +inner ) -_ = > -return -Err +{ +self +. +types +. +insert +( +Type +{ +name +: +None +inner +} +span +) +} +} +; +let +new_base_stride += +self +. +types +[ +new_base +] +. +inner +. +size +( +self +. +to_ctx +( +) +) +; +let +new_array_ty += +self +. +types +. +insert +( +Type +{ +name +: +None +inner +: +TypeInner +: +: +Array +{ +base +: +new_base +size +stride +: +new_base_stride +} +} +span +) +; +let +compose += +Expression +: +: +Compose +{ +ty +: +new_array_ty +components +} +; +self +. +register_evaluated_expr +( +compose +span +) +} +fn +unary_op +( +& +mut +self +op +: +UnaryOperator +expr +: +Handle +< +Expression +> +span +: +Span +) +- +> +Result +< +Handle +< +Expression +> +ConstantEvaluatorError +> +{ +let +expr += +self +. +eval_zero_value_and_splat +( +expr +span +) +? +; +let +expr += +match +self +. +expressions +[ +expr +] +{ +Expression +: +: +Literal +( +value +) += +> +Expression +: +: +Literal +( +match +op +{ +UnaryOperator +: +: +Negate += +> +match +value +{ +Literal +: +: +I32 +( +v +) += +> +Literal +: +: +I32 +( +- +v +) +Literal +: +: +F32 +( +v +) += +> +Literal +: +: +F32 +( +- +v +) +_ += +> +return +Err +( +ConstantEvaluatorError +: +: +InvalidUnaryOpArg +) +} +UnaryOperator +: +: +LogicalNot += +> +match +value +{ +Literal +: +: +Bool +( +v +) += +> +Literal +: +: +Bool +( +! +v +) +_ += +> +return +Err ( ConstantEvaluatorError : @@ -7937,14 +8803,219 @@ span ) } } -} -# -[ -cfg +fn +resolve_type ( -test +& +self +expr +: +Handle +< +Expression +> ) -] +- +> +Result +< +crate +: +: +proc +: +: +TypeResolution +ConstantEvaluatorError +> +{ +use +crate +: +: +proc +: +: +TypeResolution +as +Tr +; +use +crate +: +: +Expression +as +Ex +; +let +resolution += +match +self +. +expressions +[ +expr +] +{ +Ex +: +: +Literal +( +ref +literal +) += +> +Tr +: +: +Value +( +literal +. +ty_inner +( +) +) +Ex +: +: +Constant +( +c +) += +> +Tr +: +: +Handle +( +self +. +constants +[ +c +] +. +ty +) +Ex +: +: +ZeroValue +( +ty +) +| +Ex +: +: +Compose +{ +ty +. +. +} += +> +Tr +: +: +Handle +( +ty +) +Ex +: +: +Splat +{ +size +value +} += +> +{ +let +Tr +: +: +Value +( +TypeInner +: +: +Scalar +( +scalar +) +) += +self +. +resolve_type +( +value +) +? +else +{ +return +Err +( +ConstantEvaluatorError +: +: +SplatScalarOnly +) +; +} +; +Tr +: +: +Value +( +TypeInner +: +: +Vector +{ +scalar +size +} +) +} +_ += +> +return +Err +( +ConstantEvaluatorError +: +: +SubexpressionsAreNotConstant +) +} +; +Ok +( +resolution +) +} +} +# +[ +cfg +( +test +) +] mod tests { @@ -10492,3 +11563,405 @@ result } } } +trait +TryFromAbstract +< +T +> +: +Sized +{ +fn +try_from_abstract +( +value +: +T +) +- +> +Result +< +Self +ConstantEvaluatorError +> +; +} +impl +TryFromAbstract +< +i64 +> +for +i32 +{ +fn +try_from_abstract +( +value +: +i64 +) +- +> +Result +< +i32 +ConstantEvaluatorError +> +{ +i32 +: +: +try_from +( +value +) +. +map_err +( +| +_ +| +ConstantEvaluatorError +: +: +AutomaticConversionLossy +{ +value +: +format +! +( +" +{ +value +: +? +} +" +) +to_type +: +" +i32 +" +} +) +} +} +impl +TryFromAbstract +< +i64 +> +for +u32 +{ +fn +try_from_abstract +( +value +: +i64 +) +- +> +Result +< +u32 +ConstantEvaluatorError +> +{ +u32 +: +: +try_from +( +value +) +. +map_err +( +| +_ +| +ConstantEvaluatorError +: +: +AutomaticConversionLossy +{ +value +: +format +! +( +" +{ +value +: +? +} +" +) +to_type +: +" +u32 +" +} +) +} +} +impl +TryFromAbstract +< +i64 +> +for +f32 +{ +fn +try_from_abstract +( +value +: +i64 +) +- +> +Result +< +Self +ConstantEvaluatorError +> +{ +let +f += +value +as +f32 +; +Ok +( +f +) +} +} +impl +TryFromAbstract +< +f64 +> +for +f32 +{ +fn +try_from_abstract +( +value +: +f64 +) +- +> +Result +< +f32 +ConstantEvaluatorError +> +{ +let +f += +value +as +f32 +; +if +f +. +is_infinite +( +) +{ +return +Err +( +ConstantEvaluatorError +: +: +AutomaticConversionLossy +{ +value +: +format +! +( +" +{ +value +: +? +} +" +) +to_type +: +" +f32 +" +} +) +; +} +Ok +( +f +) +} +} +impl +TryFromAbstract +< +i64 +> +for +f64 +{ +fn +try_from_abstract +( +value +: +i64 +) +- +> +Result +< +Self +ConstantEvaluatorError +> +{ +let +f += +value +as +f64 +; +Ok +( +f +) +} +} +impl +TryFromAbstract +< +f64 +> +for +f64 +{ +fn +try_from_abstract +( +value +: +f64 +) +- +> +Result +< +f64 +ConstantEvaluatorError +> +{ +Ok +( +value +) +} +} +impl +TryFromAbstract +< +f64 +> +for +i32 +{ +fn +try_from_abstract +( +_ +: +f64 +) +- +> +Result +< +Self +ConstantEvaluatorError +> +{ +Err +( +ConstantEvaluatorError +: +: +AutomaticConversionFloatToInt +{ +to_type +: +" +i32 +" +} +) +} +} +impl +TryFromAbstract +< +f64 +> +for +u32 +{ +fn +try_from_abstract +( +_ +: +f64 +) +- +> +Result +< +Self +ConstantEvaluatorError +> +{ +Err +( +ConstantEvaluatorError +: +: +AutomaticConversionFloatToInt +{ +to_type +: +" +u32 +" +} +) +} +} diff --git a/third_party/rust/naga/src/proc/mod.rs b/third_party/rust/naga/src/proc/mod.rs index 4848c8fc5180..753471899f6b 100644 --- a/third_party/rust/naga/src/proc/mod.rs +++ b/third_party/rust/naga/src/proc/mod.rs @@ -582,6 +582,22 @@ ScalarKind : : Float +| +crate +: +: +ScalarKind +: +: +AbstractInt +| +crate +: +: +ScalarKind +: +: +AbstractFloat = > true @@ -741,6 +757,56 @@ BOOL_WIDTH ; pub const +ABSTRACT_INT +: +Self += +Self +{ +kind +: +crate +: +: +ScalarKind +: +: +AbstractInt +width +: +crate +: +: +ABSTRACT_WIDTH +} +; +pub +const +ABSTRACT_FLOAT +: +Self += +Self +{ +kind +: +crate +: +: +ScalarKind +: +: +AbstractFloat +width +: +crate +: +: +ABSTRACT_WIDTH +} +; +pub +const fn float ( @@ -1096,6 +1162,14 @@ F64 ( v ) +| +Self +: +: +AbstractFloat +( +v +) = > { @@ -1229,6 +1303,14 @@ I64 ( v ) +| +Self +: +: +AbstractInt +( +v +) = > { @@ -1594,7 +1676,31 @@ _ ) = > -1 +crate +: +: +BOOL_WIDTH +Self +: +: +AbstractInt +( +_ +) +| +Self +: +: +AbstractFloat +( +_ +) += +> +crate +: +: +ABSTRACT_WIDTH } } pub @@ -1712,6 +1818,38 @@ Scalar : : BOOL +Self +: +: +AbstractInt +( +_ +) += +> +crate +: +: +Scalar +: +: +ABSTRACT_INT +Self +: +: +AbstractFloat +( +_ +) += +> +crate +: +: +Scalar +: +: +ABSTRACT_FLOAT } } pub diff --git a/third_party/rust/naga/src/valid/expression.rs b/third_party/rust/naga/src/valid/expression.rs index 36df6412a540..0b5e67465f4c 100644 --- a/third_party/rust/naga/src/valid/expression.rs +++ b/third_party/rust/naga/src/valid/expression.rs @@ -5224,6 +5224,16 @@ Sk : : Bool +| +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat = > false @@ -5310,6 +5320,16 @@ Sk : : Bool +| +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat = > false @@ -5362,6 +5382,16 @@ Sk : : Bool +| +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat ) | None @@ -5800,6 +5830,16 @@ Sk : : Bool +| +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat = > false @@ -5990,6 +6030,16 @@ Sk : : Float +| +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat = > false @@ -6083,6 +6133,16 @@ Sk : : Float +| +Sk +: +: +AbstractInt +| +Sk +: +: +AbstractFloat = > false @@ -6348,6 +6408,16 @@ Float Sk : : +AbstractInt +| +Sk +: +: +AbstractFloat +| +Sk +: +: Bool = > diff --git a/third_party/rust/naga/src/valid/function.rs b/third_party/rust/naga/src/valid/function.rs index 219a707cdc5e..099256e1afab 100644 --- a/third_party/rust/naga/src/valid/function.rs +++ b/third_party/rust/naga/src/valid/function.rs @@ -1077,25 +1077,27 @@ Expression error ( " -Store +The +type of { value : ? } -into +doesn +' +t +match +the +type +stored +in { pointer : ? } -doesn -' -t -have -matching -types " ) ] diff --git a/third_party/rust/naga/src/valid/type.rs b/third_party/rust/naga/src/valid/type.rs index 560cdf3e9e33..43447627c3d8 100644 --- a/third_party/rust/naga/src/valid/type.rs +++ b/third_party/rust/naga/src/valid/type.rs @@ -1345,6 +1345,23 @@ supported ) ] Unsupported64Bit +# +[ +error +( +" +Abstract +types +may +only +appear +in +constant +expressions +" +) +] +Abstract } type LayoutCompatibility @@ -1888,6 +1905,34 @@ width = 4 } +crate +: +: +ScalarKind +: +: +AbstractInt +| +crate +: +: +ScalarKind +: +: +AbstractFloat += +> +{ +return +Err +( +WidthError +: +: +Abstract +) +; +} } ; if @@ -2356,6 +2401,22 @@ ScalarKind : : Float +| +crate +: +: +ScalarKind +: +: +AbstractInt +| +crate +: +: +ScalarKind +: +: +AbstractFloat = > false diff --git a/third_party/rust/wgpu-core/.cargo-checksum.json b/third_party/rust/wgpu-core/.cargo-checksum.json index 3920960c1165..dbdb6f1a11c8 100644 --- a/third_party/rust/wgpu-core/.cargo-checksum.json +++ b/third_party/rust/wgpu-core/.cargo-checksum.json @@ -11,7 +11,7 @@ toml " : " -bde42e04a69f912ac871368e202df8af116ea0ef010a2f08a62388b6985ca61f +5119648ea52e97ad3fa2f0f24cc30e0b305fe81f710a33396bdadaf7397d41b9 " " LICENSE @@ -51,7 +51,7 @@ rs " : " -d7add33189aa453ad19acd8ac38465f44e233d0e8da42be5a3aadfc50a87a491 +b709658ed6b9af2ed07ff77b8da64912cd26a9d7caaecee26c77a92efdc615d4 " " src @@ -90,7 +90,7 @@ rs " : " -65499812d269e23efb12a12a455f58f52f3014f8db224d02951b7331638f6ad4 +8929095abd1508fdbc4b51db1bcfe513f77954fcfb269888c91b47c90b943c03 " " src @@ -142,7 +142,7 @@ rs " : " -e7c5e83a1b6398e68279b10910f426d7dde1ce3c800752bb88688b37f69b7872 +9ffa26b0306067ad63fc61fbde985ad98d495a2ad739f51bf54a39f702f45d3a " " src @@ -168,7 +168,7 @@ rs " : " -0b9a8804de0a85d3b4c593df2da78ce5d6c3e53169b05ca9babd3ec984cbe9f7 +61a9f34d813700606b49224d9de19773c49eb3dd42fa4027357a334dc63e2579 " " src @@ -181,7 +181,7 @@ rs " : " -49dd1261e3ad1effc4ebdad1bc3061f4330f991b8291df75591a1e2bc5eaa257 +60969f020bddfb88a0c3b459b72b94d3a9a96cc635d20e88d016765d0fb94ba5 " " src @@ -218,7 +218,7 @@ rs " : " -3be88717a7d164ea73842f90b93c359f8ea06bbae253af9a195734640d5a830d +33c47e5aaa44ad4a485a996af52247e765bedfa18724ab7662ce34c78754448b " " src @@ -231,7 +231,7 @@ rs " : " -6c2b2e7f98f71231c97f19cf19c4d8ff254ee9862a8422f973270656658aed96 +bbda212777bf5156feb9ee4c46d7c7621888c11544903a26bf86e7b708590f5a " " src @@ -244,7 +244,7 @@ rs " : " -9bae0d30eaf51af5545eea10d5c8af6ca3ced2518d24c42880ec3c8f1f7664b2 +4ec88e037307e597fc661c85c9fa28f2d70a82a222a5fec5c97c450d33224f37 " " src @@ -257,7 +257,7 @@ rs " : " -aec77faebaa750f843f2f04ea9a2021598098783f16f95e739bc64fabcc29619 +9525b939e49b4c2860928c04a660a4556b34bfbed23e00318635a5ad46bce061 " " src @@ -270,7 +270,7 @@ rs " : " -0e707723d58cecfb402fe35eb9944278de96a95496bd2e62b50a71ef3e44d079 +a47f4d8b605c477fc6a63058e1340872590631c9a1a7f4e454bbbbe01aada757 " " src @@ -283,7 +283,7 @@ rs " : " -21408dfd2c99e3ce36a77d08ba86cf52f32bb376ed82690bbbf74937bfd42cbe +9a8ec674567a8866a6bd1ed2ad06e474bd2504ed91f228d3040cb6db18fe5f2b " " src @@ -305,7 +305,7 @@ rs " : " -fd2a7995bdb64f1186fd71c4f6b59f34c543ee695912b1fad7931c88ec024584 +9aa9448791477007b850c5eb1584e7c74c14fe43ac47ab3b5f29373850f463ee " " src @@ -338,7 +338,7 @@ rs " : " -4684c40d56ad8f49f36455ea84f2901df587fc3574274ac132b8236ece6926a3 +0aa4258f93e05f6991385980a553e67892a0f1769e37624ae0466f83161af697 " " src @@ -399,7 +399,7 @@ rs " : " -643ce09d9a623f00e66e1eb50b2facc4d072f4149c9953343c1b0e8c4a5f6915 +46b13911e15310a7ced4e5f13eeaa5d2cde7762b8ffa282a28d0c812e7036458 " " src @@ -410,7 +410,7 @@ rs " : " -23ac375edd02c7808ccb901b392bb34960339027b2e068b9009f89d413946515 +9408b33250c7062599045cc11dd1f52d6036415f0e5c568b37c73348b330bb7c " " src @@ -421,7 +421,7 @@ rs " : " -e09adc811a7553daa4d826fd6001be14a7d21222fc8ba76040d4fd5c0f017787 +1d615e582254cfa108dd1925df7b6b0ae0c9845714b1351b8bcd4c7aa4b4dd69 " " src @@ -432,7 +432,7 @@ rs " : " -5a15e583ee2b4c1afcf596c8429437a50e9fd1e17f8fbf4fafb482928940815e +1c28d6dbc3125b5eebd12265013618d8585d5c90f3fd1d3529c20e41e1ddecb3 " " src @@ -443,7 +443,7 @@ rs " : " -52a52b0ed41abbed3c6a84f0fb01c5f45c75953bacaa7a9b9bdb95a8825eb573 +e93369ae372b133649b554a3d0338d74823cfded8b7e84d01bf1f000b670f471 " " src @@ -454,7 +454,7 @@ rs " : " -14a3fedcf422688dc484c91abc5b2522c388fd5587c61e11a4b0bd882284fb24 +be6b9b648911c2277d9f88ca9e9a2811ec28fdf8118e009a47de0c16179f28aa " " src @@ -465,7 +465,7 @@ rs " : " -343811d28ed0926ef2d7f116d5ad8b4b6b6f530d7dfb5b9afbb90f2bb3ccfbc1 +6ba6416522ba2f1d2a279c220960aabdfb071c4e0ade888c8cbc2b91325c4203 " " src @@ -478,7 +478,7 @@ rs " : " -2e37fdae4e3b81f4e9d4bc35d71849ce82846afbb55c3de75c5db101c888e216 +a6762fad8bf5b257d37fb8844f0ee44ecb04f052c58655404b8af0036ac929e5 " " src @@ -491,7 +491,7 @@ rs " : " -8ef7af1d0152a3a8d706402a416c2e74c9282354cad055d2c0c527486cb3019e +f8994ad91db7f3bb1b7f8b8b0f6884753d733ce28238b36f31da2230706f848e " " src @@ -504,7 +504,7 @@ rs " : " -028b04676f8a42a1f67bb9f6ffb809f56fa6349596b52561bce5b78c176e51e7 +5fdef0bcf20999fda97342e261341809394dcad3ee97e2bc2429c5a1e41d48d5 " " src @@ -530,7 +530,7 @@ rs " : " -57f13386f0829cd6e1a894e454f69929eea7494565e530ed9f80bd7d50a4ba2d +65142de8e8425eee26e32bfef8169af3ed0e98455d5e470517717a3c15e8036c " " src @@ -543,7 +543,7 @@ rs " : " -ea8ba2089e72401dcd37738d0583c411ec100a7436626f738d8d81bc188cbd99 +d4e92ef3400cf48b2e76d8b7c1e4c6a1cef0d3d060c6abdb46b9a3b386bc9dc9 " " src @@ -554,7 +554,7 @@ rs " : " -0ca7fe772c06f788bd758e720d35e5664ffe69188922c7a1981f3855206e200b +4bd36b7b02ad0122fda719790d40cc68058e0f8e3ba3cd622f1d76db377320f9 " } " diff --git a/third_party/rust/wgpu-core/Cargo.toml b/third_party/rust/wgpu-core/Cargo.toml index d11bff8a64c1..3cbda4428ac3 100644 --- a/third_party/rust/wgpu-core/Cargo.toml +++ b/third_party/rust/wgpu-core/Cargo.toml @@ -500,6 +500,10 @@ types [ features ] +api_log_info += +[ +] default = [ @@ -631,6 +635,10 @@ naga deserialize " ] +resource_log_info += +[ +] serial - pass @@ -746,7 +754,7 @@ version . 3 . -64 +66 " features = diff --git a/third_party/rust/wgpu-core/src/binding_model.rs b/third_party/rust/wgpu-core/src/binding_model.rs index 4c32d25c1aa7..2e7c47086e7b 100644 --- a/third_party/rust/wgpu-core/src/binding_model.rs +++ b/third_party/rust/wgpu-core/src/binding_model.rs @@ -51,6 +51,7 @@ Resource ResourceInfo ResourceType } +resource_log track : : @@ -2971,18 +2972,29 @@ mut self ) { -log -: -: -info +if +let +Some +( +raw +) += +self +. +raw +. +take +( +) +{ +resource_log ! ( " -Destroying +Destroy +raw BindGroupLayout { -: -? } " self @@ -2994,21 +3006,6 @@ label ) ) ; -if -let -Some -( -raw -) -= -self -. -raw -. -take -( -) -{ unsafe { use @@ -4024,18 +4021,29 @@ mut self ) { -log -: -: -info +if +let +Some +( +raw +) += +self +. +raw +. +take +( +) +{ +resource_log ! ( " -Destroying +Destroy +raw PipelineLayout { -: -? } " self @@ -4047,21 +4055,6 @@ label ) ) ; -if -let -Some -( -raw -) -= -self -. -raw -. -take -( -) -{ unsafe { use @@ -5198,18 +5191,29 @@ mut self ) { -log -: -: -info +if +let +Some +( +raw +) += +self +. +raw +. +take +( +) +{ +resource_log ! ( " -Destroying +Destroy +raw BindGroup { -: -? } " self @@ -5221,21 +5225,6 @@ label ) ) ; -if -let -Some -( -raw -) -= -self -. -raw -. -take -( -) -{ unsafe { use diff --git a/third_party/rust/wgpu-core/src/command/clear.rs b/third_party/rust/wgpu-core/src/command/clear.rs index 49bc1369b5cd..ab7fdb35b0e0 100644 --- a/third_party/rust/wgpu-core/src/command/clear.rs +++ b/third_party/rust/wgpu-core/src/command/clear.rs @@ -43,6 +43,7 @@ crate : : { +api_log command : : @@ -117,7 +118,6 @@ math : align_to BufferAddress -BufferSize BufferUsages ImageSubresourceRange TextureAspect @@ -290,7 +290,7 @@ COPY_BUFFER_ALIGNMENT ] UnalignedFillSize ( -BufferSize +BufferAddress ) # [ @@ -600,7 +600,7 @@ size : Option < -BufferSize +BufferAddress > ) - @@ -626,10 +626,7 @@ clear_buffer " ) ; -log -: -: -trace +api_log ! ( " @@ -911,10 +908,6 @@ size { if size -. -get -( -) % wgt : @@ -943,10 +936,6 @@ destination_end_offset offset + size -. -get -( -) ; if destination_end_offset @@ -994,10 +983,6 @@ size offset + size -. -get -( -) None = > @@ -1170,10 +1155,7 @@ clear_texture " ) ; -log -: -: -trace +api_log ! ( " @@ -2117,6 +2099,23 @@ FormatAspects COLOR ) ; +if +texture_desc +. +format += += +wgt +: +: +TextureFormat +: +: +NV12 +{ +return +; +} let mut zero_buffer_copy_regions diff --git a/third_party/rust/wgpu-core/src/command/mod.rs b/third_party/rust/wgpu-core/src/command/mod.rs index fb53f6838d0b..302aeb9d25b2 100644 --- a/third_party/rust/wgpu-core/src/command/mod.rs +++ b/third_party/rust/wgpu-core/src/command/mod.rs @@ -176,6 +176,7 @@ crate : : { +api_log global : : @@ -189,6 +190,7 @@ identity : : GlobalIdentityHandlerFactory +resource_log Label } ; @@ -880,18 +882,18 @@ is_none return ; } -log -: -: -info +resource_log ! ( " -Destroying +resource +: +: CommandBuffer -{ : -? +: +drop +{ } " self @@ -1664,7 +1666,7 @@ A log : : -info +trace ! ( " @@ -2638,10 +2640,7 @@ push_debug_group " ) ; -log -: -: -trace +api_log ! ( " @@ -2838,10 +2837,7 @@ insert_debug_marker " ) ; -log -: -: -trace +api_log ! ( " @@ -3034,10 +3030,7 @@ pop_debug_marker " ) ; -log -: -: -trace +api_log ! ( " diff --git a/third_party/rust/wgpu-core/src/command/render.rs b/third_party/rust/wgpu-core/src/command/render.rs index 35c36c9f1d77..479bf34e28e1 100644 --- a/third_party/rust/wgpu-core/src/command/render.rs +++ b/third_party/rust/wgpu-core/src/command/render.rs @@ -12,6 +12,7 @@ crate : : { +api_log binding_model : : @@ -7825,10 +7826,7 @@ bind_group_id = > { -log -: -: -trace +api_log ! ( " @@ -8246,10 +8244,7 @@ pipeline_id = > { -log -: -: -trace +api_log ! ( " @@ -8858,10 +8853,7 @@ size = > { -log -: -: -trace +api_log ! ( " @@ -9131,10 +9123,7 @@ size = > { -log -: -: -trace +api_log ! ( " @@ -9493,10 +9482,7 @@ color = > { -log -: -: -trace +api_log ! ( " @@ -9564,10 +9550,7 @@ value = > { -log -: -: -trace +api_log ! ( " @@ -9625,10 +9608,7 @@ depth_max = > { -log -: -: -trace +api_log ! ( " @@ -9864,10 +9844,7 @@ values_offset = > { -log -: -: -trace +api_log ! ( " @@ -10024,10 +10001,7 @@ rect = > { -log -: -: -trace +api_log ! ( " @@ -10158,10 +10132,7 @@ first_instance = > { -log -: -: -trace +api_log ! ( " @@ -10343,10 +10314,7 @@ first_instance = > { -log -: -: -trace +api_log ! ( " @@ -10524,10 +10492,7 @@ indexed = > { -log -: -: -trace +api_log ! ( " @@ -10892,10 +10857,7 @@ indexed = > { -log -: -: -trace +api_log ! ( " @@ -11429,10 +11391,7 @@ unwrap ( ) ; -log -: -: -trace +api_log ! ( " @@ -11472,10 +11431,7 @@ PopDebugGroup = > { -log -: -: -trace +api_log ! ( " @@ -11582,10 +11538,7 @@ unwrap ( ) ; -log -: -: -trace +api_log ! ( " @@ -11629,10 +11582,7 @@ query_index = > { -log -: -: -trace +api_log ! ( " @@ -11744,10 +11694,7 @@ query_index = > { -log -: -: -trace +api_log ! ( " @@ -11854,10 +11801,7 @@ EndOcclusionQuery = > { -log -: -: -trace +api_log ! ( " @@ -11905,10 +11849,7 @@ query_index = > { -log -: -: -trace +api_log ! ( " @@ -12001,10 +11942,7 @@ EndPipelineStatisticsQuery = > { -log -: -: -trace +api_log ! ( " @@ -12051,10 +11989,7 @@ bundle_id = > { -log -: -: -trace +api_log ! ( " diff --git a/third_party/rust/wgpu-core/src/command/transfer.rs b/third_party/rust/wgpu-core/src/command/transfer.rs index 34806e8c0253..db1174f9ba32 100644 --- a/third_party/rust/wgpu-core/src/command/transfer.rs +++ b/third_party/rust/wgpu-core/src/command/transfer.rs @@ -28,6 +28,7 @@ crate : : { +api_log command : : @@ -3098,6 +3099,35 @@ copy_buffer_to_buffer " ) ; +api_log +! +( +" +CommandEncoder +: +: +copy_buffer_to_buffer +{ +source +: +? +} +- +> +{ +destination +: +? +} +{ +size +: +? +} +bytes +" +) +; if source = @@ -4096,6 +4126,38 @@ copy_buffer_to_texture " ) ; +api_log +! +( +" +CommandEncoder +: +: +copy_buffer_to_texture +{ +: +? +} +- +> +{ +: +? +} +{ +copy_size +: +? +} +" +source +. +buffer +destination +. +texture +) +; let hub = @@ -5036,6 +5098,38 @@ copy_texture_to_buffer " ) ; +api_log +! +( +" +CommandEncoder +: +: +copy_texture_to_buffer +{ +: +? +} +- +> +{ +: +? +} +{ +copy_size +: +? +} +" +source +. +texture +destination +. +buffer +) +; let hub = @@ -6056,6 +6150,38 @@ copy_texture_to_texture " ) ; +api_log +! +( +" +CommandEncoder +: +: +copy_texture_to_texture +{ +: +? +} +- +> +{ +: +? +} +{ +copy_size +: +? +} +" +source +. +texture +destination +. +texture +) +; let hub = diff --git a/third_party/rust/wgpu-core/src/device/global.rs b/third_party/rust/wgpu-core/src/device/global.rs index b6362c4a271c..b2d0dba9182f 100644 --- a/third_party/rust/wgpu-core/src/device/global.rs +++ b/third_party/rust/wgpu-core/src/device/global.rs @@ -23,6 +23,7 @@ crate : : { +api_log binding_model command conv @@ -1202,27 +1203,29 @@ assign buffer ) ; -log -: -: -info +api_log ! ( " -Created -Buffer +Device +: +: +create_buffer +( { +desc : ? } -with +) +- +> { +id : ? } " -id -desc ) ; let @@ -2922,36 +2925,31 @@ destroy " ) ; -let -hub -= -A -: -: -hub -( -self -) -; -log -: -: -debug +api_log ! ( " Buffer +: +: +destroy { +buffer_id : ? } -is -asked -to -be -dropped " -buffer_id +) +; +let +hub += +A +: +: +hub +( +self ) ; let @@ -3033,25 +3031,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " Buffer +: +: +drop { +buffer_id : ? } -is -asked -to -be -dropped " -buffer_id ) ; let @@ -3486,27 +3479,29 @@ assign texture ) ; -log -: -: -info +api_log ! ( " -Created -Texture +Device +: +: +create_texture +( { +desc : ? } -with +) +- +> { +id : ? } " -id -desc ) ; device @@ -3540,6 +3535,26 @@ None ; } ; +log +: +: +error +! +( +" +Device +: +: +create_texture +error +{ +error +: +? +} +" +) +; let id = @@ -3931,27 +3946,22 @@ assign texture ) ; -log -: -: -info +api_log ! ( " -Created -Texture -{ +Device : -? -} -with +: +create_texture +- +> { +id : ? } " -id -desc ) ; device @@ -3985,6 +3995,26 @@ None ; } ; +log +: +: +error +! +( +" +Device +: +: +create_texture +error +{ +error +: +? +} +" +) +; let id = @@ -4256,27 +4286,22 @@ assign buffer ) ; -log -: -: -info +api_log ! ( " -Created -buffer -{ +Device : -? -} -with +: +create_buffer +- +> { +id : ? } " -id -desc ) ; device @@ -4312,6 +4337,26 @@ None ; } ; +log +: +: +error +! +( +" +Device +: +: +create_buffer +error +{ +error +: +? +} +" +) +; let id = @@ -4417,10 +4462,7 @@ destroy " ) ; -log -: -: -trace +api_log ! ( " @@ -4447,24 +4489,6 @@ hub self ) ; -log -: -: -debug -! -( -" -Texture -{ -: -? -} -is -destroyed -" -texture_id -) -; let mut texture_guard @@ -4747,25 +4771,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " Texture +: +: +drop { +texture_id : ? } -is -asked -to -be -dropped " -texture_id ) ; let @@ -5192,21 +5211,29 @@ assign view ) ; -log -: -: -info +api_log ! ( " -Created -TextureView +Texture +: +: +create_view +( { +texture_id : ? } -" +) +- +> +{ id +: +? +} +" ) ; device @@ -5244,18 +5271,20 @@ Texture : : create_view +( { +texture_id : ? } +) error { +error : ? } " -texture_id -error ) ; let @@ -5366,25 +5395,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " TextureView +: +: +drop { +texture_view_id : ? } -is -asked -to -be -dropped " -texture_view_id ) ; let @@ -5755,21 +5779,22 @@ assign sampler ) ; -log -: -: -info +api_log ! ( " -Created -Sampler +Device +: +: +create_sampler +- +> { +id : ? } " -id ) ; device @@ -5890,25 +5915,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " Sampler +: +: +drop { +sampler_id : ? } -is -asked -to -be -dropped " -sampler_id ) ; let @@ -6296,10 +6316,7 @@ bgl_guard ) } { -log -: -: -info +api_log ! ( " @@ -6383,21 +6400,22 @@ assign layout ) ; -log -: -: -info +api_log ! ( " -Created -BindGroupLayout +Device +: +: +create_bind_group_layout +- +> { +id : ? } " -id ) ; return @@ -6519,25 +6537,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " BindGroupLayout +: +: +drop { +bind_group_layout_id : ? } -is -asked -to -be -dropped " -bind_group_layout_id ) ; let @@ -6852,21 +6865,22 @@ assign layout ) ; -log -: -: -info +api_log ! ( " -Created -PipelineLayout +Device +: +: +create_pipeline_layout +- +> { +id : ? } " -id ) ; return @@ -6971,25 +6985,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " PipelineLayout +: +: +drop { +pipeline_layout_id : ? } -is -asked -to -be -dropped " -pipeline_layout_id ) ; let @@ -7373,21 +7382,22 @@ assign bind_group ) ; -log -: -: -info +api_log ! ( " -Created -BindGroup +Device +: +: +create_bind_group +- +> { +id : ? } " -id ) ; device @@ -7508,25 +7518,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " BindGroup +: +: +drop { +bind_group_id : ? } -is -asked -to -be -dropped " -bind_group_id ) ; let @@ -7968,27 +7973,22 @@ assign shader ) ; -log -: -: -info +api_log ! ( " -Created -ShaderModule -{ +Device : -? -} -with +: +create_shader_module +- +> { +id : ? } " -id -desc ) ; return @@ -7999,6 +7999,27 @@ None ; } ; +log +: +: +error +! +( +" +Device +: +: +create_shader_module +error +: +{ +error +: +? +} +" +) +; let id = @@ -8337,27 +8358,22 @@ assign shader ) ; -log -: -: -info +api_log ! ( " -Created -ShaderModule -{ +Device : -? -} -with +: +create_shader_module_spirv +- +> { +id : ? } " -id -desc ) ; return @@ -8368,6 +8384,27 @@ None ; } ; +log +: +: +error +! +( +" +Device +: +: +create_shader_module_spirv +error +: +{ +error +: +? +} +" +) +; let id = @@ -8462,25 +8499,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " ShaderModule +: +: +drop { +shader_module_id : ? } -is -asked -to -be -dropped " -shader_module_id ) ; let @@ -8823,27 +8855,22 @@ assign command_buffer ) ; -log -: -: -info +api_log ! ( " -Created -CommandBuffer -{ +Device : -? -} -with +: +create_command_encoder +- +> { +id : ? } " -id -desc ) ; return @@ -8948,25 +8975,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " CommandEncoder +: +: +drop { +command_encoder_id : ? } -is -asked -to -be -dropped " -command_encoder_id ) ; let @@ -9057,25 +9079,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " CommandBuffer +: +: +drop { +command_buffer_id : ? } -is -asked -to -be -dropped " -command_buffer_id ) ; self @@ -9137,10 +9154,7 @@ create_render_bundle_encoder " ) ; -log -: -: -trace +api_log ! ( " @@ -9506,21 +9520,22 @@ assign render_bundle ) ; -log -: -: -info +api_log ! ( " -Created -RenderBundle +RenderBundleEncoder +: +: +finish +- +> { +id : ? } " -id ) ; device @@ -9641,25 +9656,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " RenderBundle +: +: +drop { +render_bundle_id : ? } -is -asked -to -be -dropped " -render_bundle_id ) ; let @@ -9962,21 +9972,22 @@ assign query_set ) ; -log -: -: -info +api_log ! ( " -Created -QuerySet +Device +: +: +create_query_set +- +> { +id : ? } " -id ) ; device @@ -10055,25 +10066,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " QuerySet +: +: +drop { +query_set_id : ? } -is -asked -to -be -dropped " -query_set_id ) ; let @@ -10512,29 +10518,24 @@ fid assign ( pipeline -) -; -log -: -: -info +) +; +api_log ! ( " -Created -RenderPipeline -{ +Device : -? -} -with +: +create_render_pipeline +- +> { +id : ? } " -id -desc ) ; device @@ -10679,6 +10680,26 @@ IMPLICIT_FAILURE ; } } +log +: +: +error +! +( +" +Device +: +: +create_render_pipeline +error +{ +error +: +? +} +" +) +; ( id Some @@ -10955,25 +10976,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " RenderPipeline +: +: +drop { +render_pipeline_id : ? } -is -asked -to -be -dropped " -render_pipeline_id ) ; let @@ -11364,27 +11380,22 @@ assign pipeline ) ; -log -: -: -info +api_log ! ( " -Created -ComputePipeline -{ +Device : -? -} -with +: +create_compute_pipeline +- +> { +id : ? } " -id -desc ) ; device @@ -11814,25 +11825,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " ComputePipeline +: +: +drop { +compute_pipeline_id : ? } -is -asked -to -be -dropped " -compute_pipeline_id ) ; let @@ -12018,6 +12024,9 @@ hal : : SurfaceCapabilities +max_texture_dimension_2d +: +u32 ) - > @@ -12048,87 +12057,26 @@ height ; if width -< -caps -. -extents -. -start -( -) -. -width -| -| -width > -caps -. -extents -. -end -( -) -. -width -| -| -height -< -caps -. -extents -. -start -( -) -. -height +max_texture_dimension_2d | | height > -caps -. -extents -. -end -( -) -. -height +max_texture_dimension_2d { -log -: -: -warn -! +return +Err ( -" -Requested -size -{ -} -x -{ -} -is -outside -of -the -supported -range +E : -{ : -? -} -" +TooLarge +{ width height -caps -. -extents +max_texture_dimension_2d +} ) ; } @@ -12328,10 +12276,7 @@ present_modes ; } ; -log -: -: -info +api_log ! ( " @@ -12563,10 +12508,7 @@ composite_alpha_modes ; } ; -log -: -: -info +api_log ! ( " @@ -13176,6 +13118,11 @@ mut hal_config & caps +device +. +limits +. +max_texture_dimension_2d ) { break @@ -13211,7 +13158,6 @@ device . maintain ( -hub fence wgt : @@ -13584,7 +13530,6 @@ lock_life . triage_suspected ( -hub & device . @@ -13644,10 +13589,7 @@ bool WaitIdleError > { -log -: -: -trace +api_log ! ( " @@ -13768,7 +13710,6 @@ device . maintain ( -hub fence maintain ) @@ -13928,7 +13869,6 @@ device . maintain ( -hub fence maintain ) @@ -13973,6 +13913,14 @@ bool WaitIdleError > { +api_log +! +( +" +poll_all_devices +" +) +; let mut closures @@ -14286,10 +14234,7 @@ id DeviceId ) { -log -: -: -trace +api_log ! ( " @@ -14369,10 +14314,7 @@ id DeviceId ) { -log -: -: -trace +api_log ! ( " @@ -14466,25 +14408,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " Device +: +: +drop { +device_id : ? } -is -asked -to -be -dropped " -device_id ) ; let @@ -14651,10 +14588,7 @@ device_id DeviceId ) { -log -: -: -trace +api_log ! ( " @@ -14743,10 +14677,7 @@ message str ) { -log -: -: -trace +api_log ! ( " @@ -14828,25 +14759,20 @@ drop " ) ; -log -: -: -debug +api_log ! ( " Queue +: +: +drop { +queue_id : ? } -is -asked -to -be -dropped " -queue_id ) ; let @@ -14914,10 +14840,7 @@ BufferMapOperation > BufferAccessResult { -log -: -: -trace +api_log ! ( " @@ -14988,6 +14911,26 @@ clone ) ; } +log +: +: +error +! +( +" +Buffer +: +: +map_async +error +{ +err +: +? +} +" +) +; return Err ( @@ -15474,27 +15417,6 @@ clone } ; } -log -: -: -debug -! -( -" -Buffer -{ -: -? -} -map -state -- -> -Waiting -" -buffer_id -) -; { let mut @@ -15614,10 +15536,7 @@ get_mapped_range " ) ; -log -: -: -trace +api_log ! ( " @@ -16015,10 +15934,7 @@ Buffer " ) ; -log -: -: -trace +api_log ! ( " diff --git a/third_party/rust/wgpu-core/src/device/life.rs b/third_party/rust/wgpu-core/src/device/life.rs index 66db7d57aaa0..2782f87ff26d 100644 --- a/third_party/rust/wgpu-core/src/device/life.rs +++ b/third_party/rust/wgpu-core/src/device/life.rs @@ -54,10 +54,6 @@ hal_api : : HalApi -hub -: -: -Hub id : : @@ -83,10 +79,6 @@ pipeline ComputePipeline RenderPipeline } -registry -: -: -Registry resource : : @@ -456,100 +448,6 @@ map self } fn -map -< -Id -R -> -( -& -self -) -- -> -& -FastHashMap -< -Id -Arc -< -R -> -> -where -Id -: -id -: -: -TypedId -R -: -Resource -< -Id -> -{ -let -map -= -self -. -maps -. -get -( -R -: -: -TYPE -) -. -unwrap -( -) -; -let -any_map -= -map -. -as_ref -( -) -. -as_any -( -) -; -let -map -= -any_map -. -downcast_ref -: -: -< -FastHashMap -< -Id -Arc -< -R -> -> -> -( -) -. -unwrap -( -) -; -map -} -fn map_mut < Id @@ -1014,59 +912,6 @@ r ; self } -pub -( -crate -) -fn -contains -< -Id -R -> -( -& -mut -self -id -: -& -Id -) -- -> -bool -where -Id -: -id -: -: -TypedId -R -: -Resource -< -Id -> -{ -self -. -map -: -: -< -Id -R -> -( -) -. -contains_key -( -id -) -} } struct ActiveSubmission @@ -1842,7 +1687,7 @@ done_count log : : -info +debug ! ( " @@ -2167,7 +2012,6 @@ triage_resources < Id R -F T > ( @@ -2208,17 +2052,6 @@ ResourceTracker Id R > -registry -: -& -Registry -< -Id -R -> -count_fn -: -F mut on_remove : @@ -2246,24 +2079,6 @@ Resource < Id > -F -: -Fn -( -u64 -& -[ -ActiveSubmission -< -A -> -] -& -Id -) -- -> -usize T : FnMut @@ -2312,35 +2127,6 @@ submission_index ) ; let -mut -count -= -1 -; -count -+ -= -count_fn -( -submit_index -active -& -id -) -; -count -+ -= -registry -. -contains -( -id -) -as -usize -; -let non_referenced_resources = active @@ -2378,25 +2164,6 @@ a last_resources ) ; -count -+ -= -non_referenced_resources -. -contains -: -: -< -Id -R -> -( -& -id -) -as -usize -; let is_removed = @@ -2405,7 +2172,6 @@ trackers remove_abandoned ( id -count ) ; if @@ -2455,13 +2221,6 @@ triage_suspected_render_bundles & mut self -hub -: -& -Hub -< -A -> trackers : & @@ -2551,16 +2310,6 @@ mut trackers . bundles -& -hub -. -render_bundles -| -_submit_index -_active -_id -| -0 | _bundle_id _bundle @@ -2815,13 +2564,6 @@ triage_suspected_bind_groups & mut self -hub -: -& -Hub -< -A -> trackers : & @@ -2911,16 +2653,6 @@ mut trackers . bind_groups -& -hub -. -bind_groups -| -_submit_index -_active -_id -| -0 | _bind_group_id _bind_group @@ -3185,13 +2917,6 @@ triage_suspected_texture_views & mut self -hub -: -& -Hub -< -A -> trackers : & @@ -3281,16 +3006,6 @@ mut trackers . views -& -hub -. -texture_views -| -_submit_index -_active -_id -| -0 | _texture_view_id _texture_view @@ -3409,13 +3124,6 @@ triage_suspected_textures & mut self -hub -: -& -Hub -< -A -> trackers : & @@ -3501,16 +3209,6 @@ mut trackers . textures -& -hub -. -textures -| -_submit_index -_active -_id -| -0 | _texture_id _texture @@ -3568,13 +3266,6 @@ triage_suspected_samplers & mut self -hub -: -& -Hub -< -A -> trackers : & @@ -3660,16 +3351,6 @@ mut trackers . samplers -& -hub -. -samplers -| -_submit_index -_active -_id -| -0 | _sampler_id _sampler @@ -3727,13 +3408,6 @@ triage_suspected_buffers & mut self -hub -: -& -Hub -< -A -> trackers : & @@ -3823,97 +3497,6 @@ mut trackers . buffers -& -hub -. -buffers -| -submit_index -active -buffer_id -| -{ -let -mut -count -= -0 -; -let -mapped -= -active -. -iter -( -) -. -find -( -| -a -| -a -. -index -= -= -submit_index -) -. -map_or -( -& -self -. -mapped -| -a -| -& -a -. -mapped -) -; -mapped -. -iter -( -) -. -for_each -( -| -b -| -{ -if -b -. -as_info -( -) -. -id -( -) -= -= -* -buffer_id -{ -count -+ -= -1 -; -} -} -) -; -count -} | _buffer_id _buffer @@ -4036,13 +3619,6 @@ triage_suspected_compute_pipelines & mut self -hub -: -& -Hub -< -A -> trackers : & @@ -4132,16 +3708,6 @@ mut trackers . compute_pipelines -& -hub -. -compute_pipelines -| -_submit_index -_active -_id -| -0 | _compute_pipeline_id _compute_pipeline @@ -4242,13 +3808,6 @@ triage_suspected_render_pipelines & mut self -hub -: -& -Hub -< -A -> trackers : & @@ -4338,16 +3897,6 @@ mut trackers . render_pipelines -& -hub -. -render_pipelines -| -_submit_index -_active -_id -| -0 | _render_pipeline_id _render_pipeline @@ -4749,13 +4298,6 @@ triage_suspected_query_sets & mut self -hub -: -& -Hub -< -A -> trackers : & @@ -4817,16 +4359,6 @@ mut trackers . query_sets -& -hub -. -query_sets -| -_submit_index -_active -_id -| -0 | _query_set_id _query_set @@ -4905,13 +4437,6 @@ triage_suspected & mut self -hub -: -& -Hub -< -A -> trackers : & @@ -4962,7 +4487,6 @@ self . triage_suspected_render_bundles ( -hub trackers # [ @@ -4984,7 +4508,6 @@ self . triage_suspected_compute_pipelines ( -hub trackers # [ @@ -5006,7 +4529,6 @@ self . triage_suspected_render_pipelines ( -hub trackers # [ @@ -5028,7 +4550,6 @@ self . triage_suspected_bind_groups ( -hub trackers # [ @@ -5090,7 +4611,6 @@ self . triage_suspected_query_sets ( -hub trackers ) ; @@ -5098,7 +4618,6 @@ self . triage_suspected_samplers ( -hub trackers # [ @@ -5126,7 +4645,6 @@ self . triage_suspected_texture_views ( -hub trackers # [ @@ -5148,7 +4666,6 @@ self . triage_suspected_textures ( -hub trackers # [ @@ -5170,7 +4687,6 @@ self . triage_suspected_buffers ( -hub trackers # [ @@ -5354,13 +4870,6 @@ handle_mapping & mut self -hub -: -& -Hub -< -A -> raw : & @@ -5471,26 +4980,6 @@ lock ( ) ; -let -mut -count -= -1 -; -count -+ -= -hub -. -buffers -. -contains -( -buffer_id -) -as -usize -; trackers . buffers @@ -5498,7 +4987,6 @@ buffers remove_abandoned ( buffer_id -count ) } ; @@ -5525,7 +5013,7 @@ Idle log : : -info +trace ! ( " diff --git a/third_party/rust/wgpu-core/src/device/mod.rs b/third_party/rust/wgpu-core/src/device/mod.rs index 1b7a311b360a..9cf36632114c 100644 --- a/third_party/rust/wgpu-core/src/device/mod.rs +++ b/third_party/rust/wgpu-core/src/device/mod.rs @@ -39,6 +39,7 @@ resource BufferAccessError BufferMapOperation } +resource_log Label DOWNLEVEL_ERROR_MESSAGE } @@ -1589,13 +1590,6 @@ inner } } } -# -[ -allow -( -trivial_casts -) -] pub ( crate @@ -1642,6 +1636,27 @@ inner > unsafe { +let +message += +std +: +: +ffi +: +: +CString +: +: +new +( +message +) +. +unwrap +( +) +; ( inner . @@ -1659,10 +1674,6 @@ message as_ptr ( ) -as -* -const -c_char ) } } @@ -2135,18 +2146,17 @@ A Device ) { -log -: -: -info +resource_log ! ( " -Destroying +CommandAllocator +: +: +dispose +encoders { } -command -encoders " self . diff --git a/third_party/rust/wgpu-core/src/device/queue.rs b/third_party/rust/wgpu-core/src/device/queue.rs index 233444d9a8ef..6ea81fa57bcb 100644 --- a/third_party/rust/wgpu-core/src/device/queue.rs +++ b/third_party/rust/wgpu-core/src/device/queue.rs @@ -26,6 +26,7 @@ crate : : { +api_log command : : @@ -96,6 +97,7 @@ StagingBuffer Texture TextureInner } +resource_log track FastHashMap SubmissionIndex @@ -2027,6 +2029,30 @@ write_buffer " ) ; +api_log +! +( +" +Queue +: +: +write_buffer +{ +buffer_id +: +? +} +{ +} +bytes +" +data +. +len +( +) +) +; let hub = @@ -2507,21 +2533,20 @@ assign staging_buffer ) ; -log -: -: -info +resource_log ! ( " -Created -StagingBuffer +Queue +: +: +create_staging_buffer { +id : ? } " -id ) ; Ok @@ -3562,6 +3587,29 @@ write_texture " ) ; +api_log +! +( +" +Queue +: +: +write_texture +{ +: +? +} +{ +size +: +? +} +" +destination +. +texture +) +; let hub = @@ -6281,10 +6329,7 @@ submit " ) ; -log -: -: -trace +api_log ! ( " @@ -8390,7 +8435,6 @@ device . maintain ( -hub fence wgt : @@ -8616,10 +8660,7 @@ Result InvalidQueue > { -log -: -: -trace +api_log ! ( " diff --git a/third_party/rust/wgpu-core/src/device/resource.rs b/third_party/rust/wgpu-core/src/device/resource.rs index eb8308e4a956..623244a29156 100644 --- a/third_party/rust/wgpu-core/src/device/resource.rs +++ b/third_party/rust/wgpu-core/src/device/resource.rs @@ -117,6 +117,7 @@ Texture TextureView TextureViewNotRenderableReason } +resource_log storage : : @@ -642,18 +643,14 @@ mut self ) { -log -: -: -info +resource_log ! ( " -Destroying +Destroy +raw Device { -: -? } " self @@ -1041,18 +1038,6 @@ Adapter A > > -alignments -: -hal -: -: -Alignments -downlevel -: -wgt -: -: -DownlevelCapabilities desc : & @@ -1396,6 +1381,36 @@ COPY_SRC ) ; } +let +alignments += +adapter +. +raw +. +capabilities +. +alignments +. +clone +( +) +; +let +downlevel += +adapter +. +raw +. +capabilities +. +downlevel +. +clone +( +) +; Ok ( Self @@ -1672,7 +1687,7 @@ limits : desc . -limits +required_limits . clone ( @@ -1681,7 +1696,7 @@ features : desc . -features +required_features downlevel instance_flags pending_writes @@ -1804,13 +1819,6 @@ this ' this self -hub -: -& -Hub -< -A -> fence : & @@ -1910,7 +1918,6 @@ life_tracker . triage_suspected ( -hub & self . @@ -2102,7 +2109,6 @@ life_tracker . handle_mapping ( -hub self . raw @@ -4356,19 +4362,14 @@ continue ; } if +! +check_texture_view_format_compatible +( desc . format -. -remove_srgb_suffix -( -) -! -= +* format -. -remove_srgb_suffix -( ) { return @@ -4705,6 +4706,21 @@ size . depth_or_array_layers { +macro_rules +! +push_clear_view +{ +( +format +: +expr +plane +: +expr +) += +> +{ let desc = @@ -4718,8 +4734,6 @@ label clear_label format : -desc -. format dimension usage @@ -4758,6 +4772,9 @@ Some 1 ) } +plane +: +plane } ; clear_views @@ -4795,6 +4812,68 @@ from ) ; } +; +} +if +desc +. +format += += +wgt +: +: +TextureFormat +: +: +NV12 +{ +push_clear_view +! +( +wgt +: +: +TextureFormat +: +: +R8Unorm +Some +( +0 +) +) +; +push_clear_view +! +( +wgt +: +: +TextureFormat +: +: +Rg8Unorm +Some +( +1 +) +) +; +} +else +{ +push_clear_view +! +( +desc +. +format +None +) +; +} +} } resource : @@ -5723,6 +5802,20 @@ layer_end ; } ; +validate_texture_view_plane +( +texture +. +desc +. +format +resolved_format +desc +. +plane +) +? +; let render_extent = @@ -6218,6 +6311,11 @@ usage range : resolved_range +plane +: +desc +. +plane } ; let @@ -11677,9 +11775,8 @@ pub_usage internal_use ) = -Self -: -: +self +. texture_use_parameters ( binding @@ -11834,9 +11931,8 @@ pub_usage internal_use ) = -Self -: -: +self +. texture_use_parameters ( binding @@ -12347,6 +12443,13 @@ crate fn texture_use_parameters ( +self +: +& +Arc +< +Self +> binding : u32 @@ -12523,6 +12626,12 @@ range . aspect ) +Some +( +self +. +features +) ) . unwrap @@ -13552,7 +13661,7 @@ hal PipelineLayoutFlags : : -BASE_VERTEX_INSTANCE +FIRST_VERTEX_INSTANCE bind_group_layouts : & @@ -18430,6 +18539,114 @@ pub crate ) fn +get_texture_format_features +( +& +self +adapter +: +& +Adapter +< +A +> +format +: +TextureFormat +) +- +> +wgt +: +: +TextureFormatFeatures +{ +use +wgt +: +: +TextureFormatFeatureFlags +as +tfsc +; +let +mut +format_features += +adapter +. +get_texture_format_features +( +format +) +; +if +( +format += += +TextureFormat +: +: +R32Float +| +| +format += += +TextureFormat +: +: +Rg32Float +| +| +format += += +TextureFormat +: +: +Rgba32Float +) +& +& +! +self +. +features +. +contains +( +wgt +: +: +Features +: +: +FLOAT32_FILTERABLE +) +{ +format_features +. +flags +. +set +( +tfsc +: +: +FILTERABLE +false +) +; +} +format_features +} +pub +( +crate +) +fn describe_format_features ( & @@ -18506,10 +18723,11 @@ downlevel { Ok ( -adapter +self . get_texture_format_features ( +adapter format ) ) @@ -19377,3 +19595,191 @@ self info } } +fn +check_texture_view_format_compatible +( +texture_format +: +TextureFormat +view_format +: +TextureFormat +) +- +> +bool +{ +use +TextureFormat +: +: +* +; +match +( +texture_format +view_format +) +{ +( +NV12 +R8Unorm +| +R8Uint +| +Rg8Unorm +| +Rg8Uint +) += +> +true +_ += +> +texture_format +. +remove_srgb_suffix +( +) += += +view_format +. +remove_srgb_suffix +( +) +} +} +fn +validate_texture_view_plane +( +texture_format +: +TextureFormat +view_format +: +TextureFormat +plane +: +Option +< +u32 +> +) +- +> +Result +< +( +) +resource +: +: +CreateTextureViewError +> +{ +use +TextureFormat +: +: +* +; +match +( +texture_format +view_format +plane +) +{ +( +NV12 +R8Unorm +| +R8Uint +Some +( +0 +) +) += +> +Ok +( +( +) +) +( +NV12 +Rg8Unorm +| +Rg8Uint +Some +( +1 +) +) += +> +Ok +( +( +) +) +( +NV12 +_ +_ +) += +> +{ +Err +( +resource +: +: +CreateTextureViewError +: +: +InvalidTextureViewPlane +{ +plane +view_format +} +) +} +( +_ +_ +Some +( +_ +) +) += +> +Err +( +resource +: +: +CreateTextureViewError +: +: +InvalidTextureViewPlaneOnNonplanarTexture +{ +plane +texture_format +} +) +_ += +> +Ok +( +( +) +) +} +} diff --git a/third_party/rust/wgpu-core/src/device/trace.rs b/third_party/rust/wgpu-core/src/device/trace.rs index bfb384cf761f..a87a14195f75 100644 --- a/third_party/rust/wgpu-core/src/device/trace.rs +++ b/third_party/rust/wgpu-core/src/device/trace.rs @@ -971,7 +971,7 @@ Option wgt : : -BufferSize +BufferAddress > } ClearTexture diff --git a/third_party/rust/wgpu-core/src/global.rs b/third_party/rust/wgpu-core/src/global.rs index bceada0b6792..46ad46099366 100644 --- a/third_party/rust/wgpu-core/src/global.rs +++ b/third_party/rust/wgpu-core/src/global.rs @@ -57,6 +57,7 @@ registry Registry RegistryReport } +resource_log storage : : @@ -1078,15 +1079,14 @@ drop " ) ; -log -: -: -info +resource_log ! ( " -Destroying Global +: +: +drop " ) ; diff --git a/third_party/rust/wgpu-core/src/id.rs b/third_party/rust/wgpu-core/src/id.rs index caf77f4db946..3e8b91770cec 100644 --- a/third_party/rust/wgpu-core/src/id.rs +++ b/third_party/rust/wgpu-core/src/id.rs @@ -852,44 +852,102 @@ unzip ( ) ; -formatter -. -debug_struct -( +let +backend += +match +backend +{ +Backend +: +: +Vulkan += +> " -Id +vk " -) -. -field -( +Backend +: +: +Metal += +> " -index +mtl " -& -index -) -. -field -( +Backend +: +: +Dx12 += +> " -epoch +d3d12 " -& -epoch -) -. -field +Backend +: +: +Dx11 += +> +" +d3d11 +" +Backend +: +: +Gl += +> +" +gl +" +Backend +: +: +BrowserWebGpu += +> +" +webgpu +" +Backend +: +: +Empty += +> +" +_ +" +} +; +write +! ( +formatter " +Id +( +{ +index +} +{ +epoch +} +{ backend +} +) " -& -backend ) -. -finish +? +; +Ok ( +( +) ) } } diff --git a/third_party/rust/wgpu-core/src/instance.rs b/third_party/rust/wgpu-core/src/instance.rs index 45dc171ecb7c..eef5dc4e0531 100644 --- a/third_party/rust/wgpu-core/src/instance.rs +++ b/third_party/rust/wgpu-core/src/instance.rs @@ -16,6 +16,7 @@ any_surface : : AnySurface +api_log device : : @@ -66,6 +67,7 @@ Resource ResourceInfo ResourceType } +resource_log LabelHelpers DOWNLEVEL_WARNING_MESSAGE } @@ -2146,10 +2148,7 @@ A RequestDeviceError > { -log -: -: -info +api_log ! ( " @@ -2160,16 +2159,6 @@ create_device " ) ; -let -caps -= -& -self -. -raw -. -capabilities -; if let Ok @@ -2190,20 +2179,6 @@ hal_device . queue self -caps -. -alignments -. -clone -( -) -caps -. -downlevel -. -clone -( -) desc trace_path instance_flags @@ -2321,7 +2296,7 @@ contains ( desc . -features +required_features ) { return @@ -2334,7 +2309,7 @@ UnsupportedFeature ( desc . -features +required_features - self . @@ -2456,7 +2431,7 @@ downlevel if desc . -features +required_features . contains ( @@ -2543,7 +2518,7 @@ check_limits & desc . -limits +required_limits & caps . @@ -2582,11 +2557,11 @@ open ( desc . -features +required_features & desc . -limits +required_limits ) } . @@ -4883,10 +4858,7 @@ drop " ) ; -log -: -: -info +api_log ! ( " @@ -5534,10 +5506,7 @@ enumerate_adapters " ) ; -log -: -: -trace +api_log ! ( " @@ -5973,21 +5942,18 @@ scope Instance : : -pick_adapter +request_adapter " ) ; -log -: -: -trace +api_log ! ( " Instance : : -pick_adapter +request_adapter " ) ; @@ -7445,10 +7411,7 @@ unreachable ) } ; -log -: -: -info +resource_log ! ( " @@ -7921,10 +7884,7 @@ drop " ) ; -log -: -: -trace +api_log ! ( " @@ -8100,10 +8060,7 @@ request_device " ) ; -log -: -: -trace +api_log ! ( " @@ -8254,10 +8211,7 @@ assign device ) ; -log -: -: -info +resource_log ! ( " @@ -8313,10 +8267,7 @@ assign queue ) ; -log -: -: -info +resource_log ! ( " @@ -8606,10 +8557,7 @@ assign device ) ; -log -: -: -info +resource_log ! ( " @@ -8665,10 +8613,7 @@ assign queue ) ; -log -: -: -info +resource_log ! ( " diff --git a/third_party/rust/wgpu-core/src/lib.rs b/third_party/rust/wgpu-core/src/lib.rs index 2296e4d2e512..0d18e631aa9b 100644 --- a/third_party/rust/wgpu-core/src/lib.rs +++ b/third_party/rust/wgpu-core/src/lib.rs @@ -1216,6 +1216,182 @@ other } ; } +# +[ +cfg +( +feature += +" +api_log_info +" +) +] +macro_rules +! +api_log +{ +( +( +arg +: +tt +) ++ +) += +> +( +log +: +: +info +! +( +( +arg +) ++ +) +) +} +# +[ +cfg +( +not +( +feature += +" +api_log_info +" +) +) +] +macro_rules +! +api_log +{ +( +( +arg +: +tt +) ++ +) += +> +( +log +: +: +trace +! +( +( +arg +) ++ +) +) +} +pub +( +crate +) +use +api_log +; +# +[ +cfg +( +feature += +" +resource_log_info +" +) +] +macro_rules +! +resource_log +{ +( +( +arg +: +tt +) ++ +) += +> +( +log +: +: +info +! +( +( +arg +) ++ +) +) +} +# +[ +cfg +( +not +( +feature += +" +resource_log_info +" +) +) +] +macro_rules +! +resource_log +{ +( +( +arg +: +tt +) ++ +) += +> +( +log +: +: +trace +! +( +( +arg +) ++ +) +) +} +pub +( +crate +) +use +resource_log +; type FastHashMap < diff --git a/third_party/rust/wgpu-core/src/pipeline.rs b/third_party/rust/wgpu-core/src/pipeline.rs index 562a1afc36b6..1d9eba60a4c4 100644 --- a/third_party/rust/wgpu-core/src/pipeline.rs +++ b/third_party/rust/wgpu-core/src/pipeline.rs @@ -66,6 +66,7 @@ Resource ResourceInfo ResourceType } +resource_log validation Label } @@ -391,18 +392,29 @@ mut self ) { -log -: -: -info +if +let +Some +( +raw +) += +self +. +raw +. +take +( +) +{ +resource_log ! ( " -Destroying +Destroy +raw ShaderModule { -: -? } " self @@ -414,21 +426,6 @@ label ) ) ; -if -let -Some -( -raw -) -= -self -. -raw -. -take -( -) -{ # [ cfg @@ -1854,18 +1851,29 @@ mut self ) { -log -: -: -info +if +let +Some +( +raw +) += +self +. +raw +. +take +( +) +{ +resource_log ! ( " -Destroying +Destroy +raw ComputePipeline { -: -? } " self @@ -1877,21 +1885,6 @@ label ) ) ; -if -let -Some -( -raw -) -= -self -. -raw -. -take -( -) -{ unsafe { use @@ -3870,18 +3863,29 @@ mut self ) { -log -: -: -info +if +let +Some +( +raw +) += +self +. +raw +. +take +( +) +{ +resource_log ! ( " -Destroying +Destroy +raw RenderPipeline { -: -? } " self @@ -3893,21 +3897,6 @@ label ) ) ; -if -let -Some -( -raw -) -= -self -. -raw -. -take -( -) -{ unsafe { use diff --git a/third_party/rust/wgpu-core/src/present.rs b/third_party/rust/wgpu-core/src/present.rs index 24242c32e95b..df6dcc6a1f37 100644 --- a/third_party/rust/wgpu-core/src/present.rs +++ b/third_party/rust/wgpu-core/src/present.rs @@ -464,6 +464,54 @@ error ( " Surface +width +and +height +must +be +within +the +maximum +supported +texture +size +. +Requested +was +( +{ +width +} +height +) +maximum +extent +is +{ +max_texture_dimension_2d +} +. +" +) +] +TooLarge +{ +width +: +u32 +height +: +u32 +max_texture_dimension_2d +: +u32 +} +# +[ +error +( +" +Surface does not support @@ -1277,6 +1325,9 @@ ImageSubresourceRange default ( ) +plane +: +None } ; let @@ -1493,7 +1544,7 @@ texture log : : -info +debug ! ( " diff --git a/third_party/rust/wgpu-core/src/registry.rs b/third_party/rust/wgpu-core/src/registry.rs index 60ab513264bc..713e04dc7e2d 100644 --- a/third_party/rust/wgpu-core/src/registry.rs +++ b/third_party/rust/wgpu-core/src/registry.rs @@ -770,34 +770,6 @@ pub crate ) fn -contains -( -& -self -id -: -I -) -- -> -bool -{ -self -. -read -( -) -. -contains -( -id -) -} -pub -( -crate -) -fn try_get ( & diff --git a/third_party/rust/wgpu-core/src/resource.rs b/third_party/rust/wgpu-core/src/resource.rs index c7cb7a333e55..a47e958876ac 100644 --- a/third_party/rust/wgpu-core/src/resource.rs +++ b/third_party/rust/wgpu-core/src/resource.rs @@ -73,6 +73,7 @@ BufferInitTracker TextureInitTracker } resource +resource_log track : : @@ -270,26 +271,6 @@ free id ) ; -log -: -: -info -! -( -" -Freeing -{ -: -? -} -" -self -. -label -( -) -) -; } } } @@ -2215,18 +2196,29 @@ mut self ) { -log -: -: -info +if +let +Some +( +raw +) += +self +. +raw +. +take +( +) +{ +resource_log ! ( " -Destroying +Destroy +raw Buffer { -: -? } " self @@ -2238,21 +2230,6 @@ label ) ) ; -if -let -Some -( -raw -) -= -self -. -raw -. -take -( -) -{ unsafe { use @@ -3656,29 +3633,6 @@ mut self ) { -log -: -: -info -! -( -" -Destroying -StagingBuffer -{ -: -? -} -" -self -. -info -. -label -( -) -) -; if let Some @@ -3698,6 +3652,25 @@ take ( ) { +resource_log +! +( +" +Destroy +raw +StagingBuffer +{ +} +" +self +. +info +. +label +( +) +) +; unsafe { use @@ -4174,18 +4147,14 @@ mut self ) { -log -: -: -info +resource_log ! ( " -Destroying +Destroy +raw Texture { -: -? } " self @@ -6131,6 +6100,13 @@ wgt : : ImageSubresourceRange +pub +plane +: +Option +< +u32 +> } # [ @@ -6527,18 +6503,29 @@ mut self ) { -log -: -: -info +if +let +Some +( +raw +) += +self +. +raw +. +take +( +) +{ +resource_log ! ( " -Destroying +Destroy +raw TextureView { -: -? } " self @@ -6550,21 +6537,6 @@ label ) ) ; -if -let -Some -( -raw -) -= -self -. -raw -. -take -( -) -{ unsafe { use @@ -7080,6 +7052,88 @@ wgt : TextureFormat } +# +[ +error +( +" +Invalid +texture +view +plane +{ +plane +: +? +} +with +view +format +{ +view_format +: +? +} +" +) +] +InvalidTextureViewPlane +{ +plane +: +Option +< +u32 +> +view_format +: +wgt +: +: +TextureFormat +} +# +[ +error +( +" +Invalid +texture +view +plane +{ +plane +: +? +} +on +non +- +planar +texture +{ +texture_format +: +? +} +" +) +] +InvalidTextureViewPlaneOnNonplanarTexture +{ +plane +: +Option +< +u32 +> +texture_format +: +wgt +: +: +TextureFormat +} } # [ @@ -7380,18 +7434,14 @@ mut self ) { -log -: -: -info +resource_log ! ( " -Destroying +Destroy +raw Sampler { -: -? } " self @@ -8079,18 +8129,14 @@ mut self ) { -log -: -: -info +resource_log ! ( " -Destroying +Destroy +raw QuerySet { -: -? } " self diff --git a/third_party/rust/wgpu-core/src/storage.rs b/third_party/rust/wgpu-core/src/storage.rs index 1840fd198f28..1d343f86f111 100644 --- a/third_party/rust/wgpu-core/src/storage.rs +++ b/third_party/rust/wgpu-core/src/storage.rs @@ -62,10 +62,6 @@ Epoch ) Destroyed ( -Arc -< -T -> Epoch ) Error @@ -372,7 +368,6 @@ Element : Destroyed ( -_ storage_epoch ) | @@ -911,7 +906,6 @@ Element : Destroyed ( -_ storage_epoch ) = @@ -1045,7 +1039,7 @@ T log : : -info +trace ! ( " @@ -1119,7 +1113,7 @@ str log : : -info +trace ! ( " @@ -1358,8 +1352,8 @@ Element : Occupied ( -. -. +_ +e ) = slot @@ -1387,7 +1381,10 @@ slot Element : : -Vacant +Destroyed +( +e +) ) { debug_assert_eq @@ -1397,53 +1394,19 @@ storage_epoch epoch ) ; -* -slot -= -Element -: -: -Destroyed +return +Ok ( value -storage_epoch ) ; } } -if -let -Element -: -: -Destroyed -( -ref -value -. -. -) -= -* -slot -{ -Ok -( -value -. -clone -( -) -) -} -else -{ Err ( InvalidId ) } -} pub ( crate @@ -1465,7 +1428,7 @@ T log : : -info +trace ! ( " @@ -1551,7 +1514,7 @@ T log : : -info +trace ! ( " @@ -1618,13 +1581,26 @@ Occupied value storage_epoch ) -| += +> +{ +assert_eq +! +( +epoch +storage_epoch +) +; +Some +( +value +) +} Element : : Destroyed ( -value storage_epoch ) = @@ -1637,10 +1613,7 @@ epoch storage_epoch ) ; -Some -( -value -) +None } Element : diff --git a/third_party/rust/wgpu-core/src/track/buffer.rs b/third_party/rust/wgpu-core/src/track/buffer.rs index aaa683ae0733..86593915113e 100644 --- a/third_party/rust/wgpu-core/src/track/buffer.rs +++ b/third_party/rust/wgpu-core/src/track/buffer.rs @@ -1403,9 +1403,6 @@ self id : BufferId -external_count -: -usize ) - > @@ -1470,18 +1467,11 @@ get_ref_count_unchecked index ) ; -let -min_ref_count -= -1 -+ -external_count -; if existing_ref_count < = -min_ref_count +2 { self . @@ -1495,7 +1485,7 @@ index log : : -info +trace ! ( " @@ -1521,7 +1511,7 @@ else log : : -info +trace ! ( " @@ -1541,10 +1531,13 @@ id existing_ref_count ) ; +return +false +; } } } -false +true } } impl diff --git a/third_party/rust/wgpu-core/src/track/metadata.rs b/third_party/rust/wgpu-core/src/track/metadata.rs index c3e93d611370..bc1e3be940d1 100644 --- a/third_party/rust/wgpu-core/src/track/metadata.rs +++ b/third_party/rust/wgpu-core/src/track/metadata.rs @@ -539,20 +539,10 @@ strong_count ( self . -resources -. -get_unchecked +get_resource_unchecked ( index ) -. -as_ref -( -) -. -unwrap_unchecked -( -) ) } } diff --git a/third_party/rust/wgpu-core/src/track/mod.rs b/third_party/rust/wgpu-core/src/track/mod.rs index 9038a2d9ba9e..4b2a2bdbbefd 100644 --- a/third_party/rust/wgpu-core/src/track/mod.rs +++ b/third_party/rust/wgpu-core/src/track/mod.rs @@ -2087,9 +2087,6 @@ self id : Id -external_count -: -usize ) - > diff --git a/third_party/rust/wgpu-core/src/track/stateless.rs b/third_party/rust/wgpu-core/src/track/stateless.rs index 66f2eedc23ea..58df0b9a37e8 100644 --- a/third_party/rust/wgpu-core/src/track/stateless.rs +++ b/third_party/rust/wgpu-core/src/track/stateless.rs @@ -36,6 +36,7 @@ resource : : Resource +resource_log storage : : @@ -486,9 +487,6 @@ self id : Id -external_count -: -usize ) - > @@ -522,6 +520,22 @@ return false ; } +resource_log +! +( +" +StatelessTracker +: +: +remove_abandoned +{ +id +: +? +} +" +) +; self . tracker_assert_in_bounds @@ -553,18 +567,11 @@ get_ref_count_unchecked index ) ; -let -min_ref_count -= -1 -+ -external_count -; if existing_ref_count < = -min_ref_count +2 { self . @@ -578,7 +585,7 @@ index log : : -info +trace ! ( " @@ -609,7 +616,7 @@ else log : : -info +trace ! ( " @@ -634,10 +641,13 @@ id existing_ref_count ) ; +return +false +; } } } -false +true } } impl diff --git a/third_party/rust/wgpu-core/src/track/texture.rs b/third_party/rust/wgpu-core/src/track/texture.rs index 9e4a2724836c..fc578f7ba618 100644 --- a/third_party/rust/wgpu-core/src/track/texture.rs +++ b/third_party/rust/wgpu-core/src/track/texture.rs @@ -1716,9 +1716,6 @@ self id : TextureId -external_count -: -usize ) - > @@ -1783,18 +1780,11 @@ get_ref_count_unchecked index ) ; -let -min_ref_count -= -1 -+ -external_count -; if existing_ref_count < = -min_ref_count +2 { self . @@ -1832,7 +1822,7 @@ index log : : -info +trace ! ( " @@ -1858,7 +1848,7 @@ else log : : -info +trace ! ( " @@ -1878,10 +1868,13 @@ id existing_ref_count ) ; +return +false +; } } } -false +true } } impl diff --git a/third_party/rust/wgpu-core/src/validation.rs b/third_party/rust/wgpu-core/src/validation.rs index 49e6d998e2e3..de882da8a72d 100644 --- a/third_party/rust/wgpu-core/src/validation.rs +++ b/third_party/rust/wgpu-core/src/validation.rs @@ -3853,6 +3853,22 @@ naga ScalarKind : : +AbstractInt +| +naga +: +: +ScalarKind +: +: +AbstractFloat +| +naga +: +: +ScalarKind +: +: Bool = > @@ -5023,6 +5039,21 @@ format Tf : : +NV12 += +> +panic +! +( +" +Unexpected +nv12 +format +" +) +Tf +: +: Rgb9e5Ufloat = > diff --git a/third_party/rust/wgpu-hal/.cargo-checksum.json b/third_party/rust/wgpu-hal/.cargo-checksum.json index da28a7cebfa4..151627678324 100644 --- a/third_party/rust/wgpu-hal/.cargo-checksum.json +++ b/third_party/rust/wgpu-hal/.cargo-checksum.json @@ -11,7 +11,7 @@ toml " : " -af8f5b97c66922b8f68e5214102cc79befc3a3a86984a611a3bdc01fae168523 +f472b730bbef76aa4770fd53b53535c1d0773145c8a40aac2deb6e7465ff70bc " " LICENSE @@ -38,7 +38,7 @@ md " : " -78377f5876fafd77963eff7e3c2ba3a7e3ad5cf9201b09ed5612e49c2288eb18 +099ee611a911dc19330a61bffcde13663929a51b25ac528ee33ea796d695491e " " examples @@ -51,7 +51,7 @@ rs " : " -360828f6f103ce966a152ceaff50087b59d0eac580fac12c8f89850024ccc233 +c74696fd871200a46e3592ce5a662c42d9587c13b7def75c5cac4c34d9685ad5 " " examples @@ -92,7 +92,7 @@ rs " : " -33f536693b08a9f00b0358416be8f368894bf92a2e673b16622fa9c244854c91 +81210e7603f5304fa1dc294f984eacf27e18df7d3f228063f6acb0d7985c37cd " " src @@ -107,7 +107,7 @@ rs " : " -536a6ff638ce32bdbf7cd697270f563c14f2c8cc013bb0e9565e06dc5127730a +3cd184da7712d1cea10cad740afb4c9dbdb40b69d7386d56dbaa15f4853c6ac7 " " src @@ -122,7 +122,7 @@ rs " : " -baad31f4529f1cf9d10519c4cceccbb21ed9bba7d7ea99e4789c1d5ddf3a450b +fc68c6211c82a912b454c3004185f46a1416bce38ddc5b0555e0def6539cfb27 " " src @@ -221,7 +221,7 @@ rs " : " -cacb8243f9107f63bc3247a76b3d28adc3b87d79ffee0af90214a483ab51285b +173e99507610282a7858c142ffe2b9755dac0d61bcaed7ae69394002d476c4f6 " " src @@ -234,7 +234,7 @@ rs " : " -e4959ec3dc6f8494844e01b56ba162ba91270c9c9a52e83315c8730fcfe188b9 +3a329369bbd9deeb2fbe3c274a5a5d5f0d2da9eeb64b76592e922446e52c5a51 " " src @@ -299,7 +299,7 @@ rs " : " -03763cc928b38a4153ab91d7a6ab7d38e2f64c7590f2e17a29c56e0a93b1284f +33c4b790c22115d68db11883a8fb8da194fba0937636a56cc779b7bf48a5ce44 " " src @@ -312,7 +312,7 @@ rs " : " -8a99d028ce379f14c19d88069c91a58d6fd7b1957e0a114c369f51a0bfaee1e9 +9c6b24f7a09c54b61ac36d0cbd74b2ff8e5c5474ee834f06f39cf18caf95b7d2 " " src @@ -351,7 +351,7 @@ rs " : " -0ac995a92acd8cbe160f58f7347ed50ce5c0d16a3da496127aff66eecca765e7 +6baf4b32df1f91a7d2060b00a14850530b857de1147c8cf1d85abd6f5e90e4c2 " " src @@ -377,7 +377,7 @@ rs " : " -9c5c3babcdfc0daa81ba85a2729020e102e5bcc7c2ec35d3d228ccf477775edf +fe9e7ed1786c7142fa5bf04e9ad2ee729fdd92c926bb734afa75651206cf737d " " src @@ -429,7 +429,7 @@ rs " : " -c09241520377e6a47ad8822c69075e6e16e6c558e18bb64398c8d7424fc57dcf +7db9595d0f67c441605ef5830555c27fc2e9c9c6aa0151baf52c9d04fc536617 " " src @@ -440,7 +440,7 @@ rs " : " -8288689e0016c60e58d1c3e24fe3a9ef247bb23961c9f01482a0bf21870379a0 +de72a7dcbd2b562195a3a49a4065008cb4402381b8dbb83ef348398c3f9d920e " " src @@ -453,7 +453,7 @@ rs " : " -6e38936a7a3f01f9aa13b6568e495499b320d009f33146cf978cf57bcd795013 +32f658df60a226fb4f3ff242267f442945c9c9670d7a5692301c3f90cdd1f5cf " " src @@ -466,7 +466,7 @@ rs " : " -9c4f2e474d0fd512f4d8da2a42ca309f9ec3c7bbf472d043b59a180cb3b0f459 +7d6a760c721e759c6c32998b5a42466fe35bcff5ecc109af42b2aaec85e444ea " " src @@ -479,7 +479,7 @@ rs " : " -23f7f82b74fb01dc09cf9b696a6977d993e65c4f700b3029984ff2dbdc9b3dda +9cd65b70c1a2f92f22a83dda825e175f367cbb3d6201a31d90e84aaf63e63d9b " " src @@ -492,7 +492,7 @@ rs " : " -8e13133b398f25850e342777edd06076188644a1013004b2a08e00845d62e6a6 +b19f2437e403e08511ff341efc63e55c78fcdeffa3785d02a892a743a26a3663 " " src @@ -531,7 +531,7 @@ rs " : " -43b3e9d03f9eca064832dd307e4b8b8f1d2d3bbcdad21c87af3854f9bd479e3d +e9a232ffb9331cd3873ea7afd4bd39e07503873d592bacd576efebd58e452323 " " src @@ -544,7 +544,7 @@ rs " : " -ee8e9673b4856baa23026009ee41fe92c5c91503b07c484199229334a99f9e0c +fe795add7b32ae4cd89e40db93e5bae62b6c7bc5741c71f21d292bd0a511de58 " " src @@ -641,7 +641,7 @@ rs " : " -04b61b4d07fc001fd3c2d95d7577bc485e7ac67406e7052681222d32233cc0ae +072e3f2a781b9cba47d17e7fe3954697d6328cb48ecd2dd0f0f2f500efefe51a " " src @@ -654,7 +654,7 @@ rs " : " -9d200608a3f931ee2d37f085809c761eb809bae2058f8caa25c592c7d2c19752 +9ae2496b3a2df3263f2f5a53a6bd4245800c53072673c3444c274c7fffa2a8dc " " src @@ -667,7 +667,7 @@ rs " : " -95512642ff903a57b661b10b72b44c065a760a3096bcb2aabbd9977e6dba0d5b +702edebb7aff60acc67d6e183f2dad999f2528b0f00bccc25197fb01911a3b6e " " src @@ -706,7 +706,7 @@ rs " : " -3c49207a7cc88b75785aa4886147121192d19d01cdc621319aff36b3659fa98c +e248de570dddfad70a83ef1788d1a15b037b0e861937c8eff00dd0c09dfae82d " " src @@ -745,7 +745,7 @@ rs " : " -d9af751f16d30b3d129a7481d1f529ef53cc7c6e0ca0b6f25181f8449f23b6fd +5a8d9a2757c9ec86ba7f1ac7b79cf577830908c6fd9935ea1af7519457d85562 " " src @@ -758,7 +758,7 @@ rs " : " -e10346068cdf97f50b98b5d7481b09f601319843cf843206c95c597fad36144e +5f0da371d3189ce42c141039a3a435717c12077f5d09226af61b5c51e4bde68c " " src @@ -771,7 +771,7 @@ rs " : " -63abaed541f7f5263f5e3a27e3e7fad419cb32c7b8af25081aa547add12087a8 +ee41a6d5a17c9474296b8e850b5dcb10452c8077e3ff70a68351a374726115b6 " " src @@ -784,7 +784,7 @@ rs " : " -1557ee3b93a085b1704b858a42a7b3b8c742c20b87ab325e9f0096ec5b97bc59 +c83be51f540e5a3294eb755ec8c787edc204aaea727d62b66887d7f88775a041 " " src @@ -797,7 +797,7 @@ rs " : " -e16d2e849b2ead8d83d354946bbffd03c26e2b024b07fe8b59c3ea47093a0a12 +d9a084ac91a2b541b14d8ea565a7a581d281e54ec2828b64e5be2989e0113ed7 " " src diff --git a/third_party/rust/wgpu-hal/Cargo.toml b/third_party/rust/wgpu-hal/Cargo.toml index c55df4abae6f..0f1083546e1d 100644 --- a/third_party/rust/wgpu-hal/Cargo.toml +++ b/third_party/rust/wgpu-hal/Cargo.toml @@ -552,7 +552,7 @@ version . 29 . -2 +4 " features = @@ -856,7 +856,7 @@ sys . 3 . -65 +66 " wasm - @@ -911,7 +911,7 @@ version . 3 . -64 +66 " features = diff --git a/third_party/rust/wgpu-hal/README.md b/third_party/rust/wgpu-hal/README.md index f338fb3ebdc3..8450d4f9dd81 100644 --- a/third_party/rust/wgpu-hal/README.md +++ b/third_party/rust/wgpu-hal/README.md @@ -193,7 +193,7 @@ it . The API -accept +accepts iterators in order diff --git a/third_party/rust/wgpu-hal/examples/halmark/main.rs b/third_party/rust/wgpu-hal/examples/halmark/main.rs index 2e08f5fc65b8..19cab65e9761 100644 --- a/third_party/rust/wgpu-hal/examples/halmark/main.rs +++ b/third_party/rust/wgpu-hal/examples/halmark/main.rs @@ -2823,6 +2823,9 @@ ImageSubresourceRange default ( ) +plane +: +None } ; let @@ -4293,6 +4296,9 @@ ImageSubresourceRange default ( ) +plane +: +None } ; let diff --git a/third_party/rust/wgpu-hal/examples/raw-gles.rs b/third_party/rust/wgpu-hal/examples/raw-gles.rs index 22c36da98485..956922274065 100644 --- a/third_party/rust/wgpu-hal/examples/raw-gles.rs +++ b/third_party/rust/wgpu-hal/examples/raw-gles.rs @@ -951,6 +951,9 @@ ImageSubresourceRange default ( ) +plane +: +None } ) . diff --git a/third_party/rust/wgpu-hal/src/auxil/dxgi/conv.rs b/third_party/rust/wgpu-hal/src/auxil/dxgi/conv.rs index 3c305c1986d6..b5490d22a0c4 100644 --- a/third_party/rust/wgpu-hal/src/auxil/dxgi/conv.rs +++ b/third_party/rust/wgpu-hal/src/auxil/dxgi/conv.rs @@ -489,6 +489,13 @@ DXGI_FORMAT_D32_FLOAT_S8X24_UINT Tf : : +NV12 += +> +DXGI_FORMAT_NV12 +Tf +: +: Bc1RgbaUnorm = > diff --git a/third_party/rust/wgpu-hal/src/auxil/dxgi/exception.rs b/third_party/rust/wgpu-hal/src/auxil/dxgi/exception.rs index 4b22aa3cf689..0f8f74a2f903 100644 --- a/third_party/rust/wgpu-hal/src/auxil/dxgi/exception.rs +++ b/third_party/rust/wgpu-hal/src/auxil/dxgi/exception.rs @@ -623,8 +623,13 @@ crate : VALIDATION_CANARY . -set +add ( +message +. +to_string +( +) ) ; } diff --git a/third_party/rust/wgpu-hal/src/dx11/adapter.rs b/third_party/rust/wgpu-hal/src/dx11/adapter.rs index 2baa4b9bdb39..5fc95932ab1d 100644 --- a/third_party/rust/wgpu-hal/src/dx11/adapter.rs +++ b/third_party/rust/wgpu-hal/src/dx11/adapter.rs @@ -783,6 +783,20 @@ Features VERTEX_WRITABLE_STORAGE ; } +features +. +set +( +wgt +: +: +Features +: +: +FLOAT32_FILTERABLE +true +) +; let max_texture_dimension_2d = diff --git a/third_party/rust/wgpu-hal/src/dx11/command.rs b/third_party/rust/wgpu-hal/src/dx11/command.rs index 74f590857ae0..54255ecfc593 100644 --- a/third_party/rust/wgpu-hal/src/dx11/command.rs +++ b/third_party/rust/wgpu-hal/src/dx11/command.rs @@ -950,13 +950,13 @@ draw & mut self -start_vertex +first_vertex : u32 vertex_count : u32 -start_instance +first_instance : u32 instance_count @@ -976,7 +976,7 @@ draw_indexed & mut self -start_index +first_index : u32 index_count @@ -985,7 +985,7 @@ u32 base_vertex : i32 -start_instance +first_instance : u32 instance_count diff --git a/third_party/rust/wgpu-hal/src/dx12/adapter.rs b/third_party/rust/wgpu-hal/src/dx12/adapter.rs index d7aada465c23..41d1e248ab43 100644 --- a/third_party/rust/wgpu-hal/src/dx12/adapter.rs +++ b/third_party/rust/wgpu-hal/src/dx12/adapter.rs @@ -1455,6 +1455,14 @@ Features : : DUAL_SOURCE_BLENDING +| +wgt +: +: +Features +: +: +TEXTURE_FORMAT_NV12 ; if max_feature_level @@ -1651,6 +1659,20 @@ BGRA8UNORM_STORAGE bgra8unorm_storage_supported ) ; +features +. +set +( +wgt +: +: +Features +: +: +FLOAT32_FILTERABLE +true +) +; let presentation_timer = @@ -1683,6 +1705,33 @@ default ( ) ; +let +mut +downlevel += +wgt +: +: +DownlevelCapabilities +: +: +default +( +) +; +downlevel +. +flags +- += +wgt +: +: +DownlevelFlags +: +: +VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW +; Some ( crate @@ -1998,16 +2047,6 @@ unwrap ) } downlevel -: -wgt -: -: -DownlevelCapabilities -: -: -default -( -) } } ) @@ -3237,41 +3276,6 @@ swap_chain_sizes = 16 current_extent -extents -: -wgt -: -: -Extent3d -{ -width -: -16 -height -: -16 -depth_or_array_layers -: -1 -} -. -. -= -wgt -: -: -Extent3d -{ -width -: -4096 -height -: -4096 -depth_or_array_layers -: -1 -} usage : crate diff --git a/third_party/rust/wgpu-hal/src/dx12/command.rs b/third_party/rust/wgpu-hal/src/dx12/command.rs index 7a8e81cf31af..13535dcc94e5 100644 --- a/third_party/rust/wgpu-hal/src/dx12/command.rs +++ b/third_party/rust/wgpu-hal/src/dx12/command.rs @@ -606,10 +606,10 @@ prepare_draw & mut self -base_vertex +first_vertex : i32 -base_instance +first_instance : u32 ) @@ -730,10 +730,10 @@ RootElement : SpecialConstantBuffer { -base_vertex +first_vertex : other_vertex -base_instance +first_instance : other_instance other @@ -742,13 +742,13 @@ _ } = > -base_vertex +first_vertex ! = other_vertex | | -base_instance +first_instance ! = other_instance @@ -792,8 +792,8 @@ RootElement : SpecialConstantBuffer { -base_vertex -base_instance +first_vertex +first_instance other : 0 @@ -861,17 +861,17 @@ RootElement : SpecialConstantBuffer { -base_vertex -base_instance +first_vertex +first_instance other } = > [ -base_vertex +first_vertex as u32 -base_instance +first_instance other ] ! @@ -917,7 +917,7 @@ RootElement : SpecialConstantBuffer { -base_vertex +first_vertex : count [ @@ -925,7 +925,7 @@ count ] as i32 -base_instance +first_instance : count [ @@ -1165,8 +1165,8 @@ RootElement : SpecialConstantBuffer { -base_vertex -base_instance +first_vertex +first_instance other } = @@ -1190,7 +1190,7 @@ list set_graphics_root_constant ( index -base_vertex +first_vertex as u32 0 @@ -1201,7 +1201,7 @@ list set_graphics_root_constant ( index -base_instance +first_instance 1 ) ; @@ -1218,7 +1218,7 @@ list set_compute_root_constant ( index -base_vertex +first_vertex as u32 0 @@ -1229,7 +1229,7 @@ list set_compute_root_constant ( index -base_instance +first_instance 1 ) ; @@ -1536,10 +1536,10 @@ RootElement : SpecialConstantBuffer { -base_vertex +first_vertex : 0 -base_instance +first_instance : 0 other @@ -6714,13 +6714,13 @@ draw & mut self -start_vertex +first_vertex : u32 vertex_count : u32 -start_instance +first_instance : u32 instance_count @@ -6734,10 +6734,10 @@ self . prepare_draw ( -start_vertex +first_vertex as i32 -start_instance +first_instance ) } ; @@ -6757,8 +6757,8 @@ draw ( vertex_count instance_count -start_vertex -start_instance +first_vertex +first_instance ) ; } @@ -6769,7 +6769,7 @@ draw_indexed & mut self -start_index +first_index : u32 index_count @@ -6778,7 +6778,7 @@ u32 base_vertex : i32 -start_instance +first_instance : u32 instance_count @@ -6793,7 +6793,7 @@ self prepare_draw ( base_vertex -start_instance +first_instance ) } ; @@ -6813,9 +6813,9 @@ draw_indexed ( index_count instance_count -start_index +first_index base_vertex -start_instance +first_instance ) ; } diff --git a/third_party/rust/wgpu-hal/src/dx12/device.rs b/third_party/rust/wgpu-hal/src/dx12/device.rs index 6c52b26be9c1..1ccfb58f45dd 100644 --- a/third_party/rust/wgpu-hal/src/dx12/device.rs +++ b/third_party/rust/wgpu-hal/src/dx12/device.rs @@ -2731,9 +2731,16 @@ desc range . base_array_layer +desc +. +plane +. +unwrap_or +( 0 ) ) +) handle_srv : if @@ -5710,7 +5717,7 @@ crate PipelineLayoutFlags : : -BASE_VERTEX_INSTANCE +FIRST_VERTEX_INSTANCE | crate : diff --git a/third_party/rust/wgpu-hal/src/dx12/mod.rs b/third_party/rust/wgpu-hal/src/dx12/mod.rs index 4bca218e3c88..39bdcd4b6698 100644 --- a/third_party/rust/wgpu-hal/src/dx12/mod.rs +++ b/third_party/rust/wgpu-hal/src/dx12/mod.rs @@ -1195,10 +1195,10 @@ Empty Constant SpecialConstantBuffer { -base_vertex +first_vertex : i32 -base_instance +first_instance : u32 other diff --git a/third_party/rust/wgpu-hal/src/dx12/view.rs b/third_party/rust/wgpu-hal/src/dx12/view.rs index 261d2156aae1..68e380b8d40a 100644 --- a/third_party/rust/wgpu-hal/src/dx12/view.rs +++ b/third_party/rust/wgpu-hal/src/dx12/view.rs @@ -83,6 +83,9 @@ u32 mip_level_count : u32 +plane +: +u32 } impl crate @@ -226,6 +229,16 @@ unwrap_or ! 0 ) +plane +: +self +. +plane +. +unwrap_or +( +0 +) } } } @@ -452,7 +465,9 @@ self mip_level_count PlaneSlice : -0 +self +. +plane ResourceMinLODClamp : 0 @@ -586,7 +601,9 @@ self array_layer_count PlaneSlice : -0 +self +. +plane ResourceMinLODClamp : 0 @@ -951,7 +968,9 @@ self mip_level_base PlaneSlice : -0 +self +. +plane } } } @@ -1015,7 +1034,9 @@ self array_layer_count PlaneSlice : -0 +self +. +plane } } } @@ -1308,7 +1329,9 @@ self mip_level_base PlaneSlice : -0 +self +. +plane } } } @@ -1432,7 +1455,9 @@ self array_layer_count PlaneSlice : -0 +self +. +plane } } } diff --git a/third_party/rust/wgpu-hal/src/empty.rs b/third_party/rust/wgpu-hal/src/empty.rs index 8ae5c435cba2..36f69a6db58c 100644 --- a/third_party/rust/wgpu-hal/src/empty.rs +++ b/third_party/rust/wgpu-hal/src/empty.rs @@ -2112,13 +2112,13 @@ draw & mut self -start_vertex +first_vertex : u32 vertex_count : u32 -start_instance +first_instance : u32 instance_count @@ -2134,7 +2134,7 @@ draw_indexed & mut self -start_index +first_index : u32 index_count @@ -2143,7 +2143,7 @@ u32 base_vertex : i32 -start_instance +first_instance : u32 instance_count diff --git a/third_party/rust/wgpu-hal/src/gles/adapter.rs b/third_party/rust/wgpu-hal/src/gles/adapter.rs index ae00b5c88d4a..e6ddfd0719ad 100644 --- a/third_party/rust/wgpu-hal/src/gles/adapter.rs +++ b/third_party/rust/wgpu-hal/src/gles/adapter.rs @@ -2241,6 +2241,14 @@ DownlevelFlags : : COMPARISON_SAMPLERS +| +wgt +: +: +DownlevelFlags +: +: +VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW ; downlevel_flags . @@ -3327,6 +3335,47 @@ GL_KHR_texture_compression_astc_hdr ) ; } +features +. +set +( +wgt +: +: +Features +: +: +FLOAT32_FILTERABLE +extensions +. +contains +( +" +GL_ARB_color_buffer_float +" +) +| +| +extensions +. +contains +( +" +GL_EXT_color_buffer_float +" +) +| +| +extensions +. +contains +( +" +OES_texture_float_linear +" +) +) +; let mut private_caps @@ -3612,27 +3661,8 @@ super PrivateCapabilities : : -TEXTURE_FLOAT_LINEAR -if -full_ver -. -is_some -( -) -{ -color_buffer_float -} -else -{ -extensions -. -contains -( -" -OES_texture_float_linear -" -) -} +QUERY_BUFFERS +query_buffers ) ; private_caps @@ -3645,8 +3675,12 @@ super PrivateCapabilities : : -QUERY_BUFFERS -query_buffers +QUERY_64BIT +full_ver +. +is_some +( +) ) ; private_caps @@ -3725,6 +3759,65 @@ supported ) ) ; +if +let +Some +( +full_ver +) += +full_ver +{ +let +supported += +full_ver +> += +( +4 +2 +) +& +& +extensions +. +contains +( +" +GL_ARB_shader_draw_parameters +" +) +; +private_caps +. +set +( +super +: +: +PrivateCapabilities +: +: +FULLY_FEATURED_INSTANCING +supported +) +; +features +. +set +( +wgt +: +: +Features +: +: +INDIRECT_FIRST_INSTANCE +supported +) +; +} let max_texture_size = @@ -4601,10 +4694,7 @@ wasm32 " allow ( -clippy -: -: -drop_ref +dropping_references ) ) ] @@ -4644,7 +4734,6 @@ private_caps workarounds features shading_language_version -max_texture_size next_shader_id : Default @@ -6049,15 +6138,15 @@ MULTISAMPLE_RESOLVE let texture_float_linear = -private_caps_fn +feature_fn ( -super +wgt : : -PrivateCapabilities +Features : : -TEXTURE_FLOAT_LINEAR +FLOAT32_FILTERABLE filterable ) ; @@ -6433,6 +6522,16 @@ depth Tf : : +NV12 += +> +unreachable +! +( +) +Tf +: +: Rgb9e5Ufloat = > @@ -6817,49 +6916,6 @@ swap_chain_sizes current_extent : None -extents -: -wgt -: -: -Extent3d -{ -width -: -4 -height -: -4 -depth_or_array_layers -: -1 -} -. -. -= -wgt -: -: -Extent3d -{ -width -: -self -. -shared -. -max_texture_size -height -: -self -. -shared -. -max_texture_size -depth_or_array_layers -: -1 -} usage : crate diff --git a/third_party/rust/wgpu-hal/src/gles/command.rs b/third_party/rust/wgpu-hal/src/gles/command.rs index 227afa84b17a..a42116cd87a0 100644 --- a/third_party/rust/wgpu-hal/src/gles/command.rs +++ b/third_party/rust/wgpu-hal/src/gles/command.rs @@ -224,6 +224,15 @@ usize active_first_instance : u32 +first_instance_location +: +Option +< +glow +: +: +UniformLocation +> push_constant_descs : ArrayVec @@ -426,6 +435,14 @@ Default default ( ) +first_instance_location +: +Default +: +: +default +( +) push_constant_descs : Default @@ -1370,8 +1387,34 @@ first_instance u32 ) { +let +emulated_first_instance_value += if +self +. +private_caps +. +contains +( +super +: +: +PrivateCapabilities +: +: +FULLY_FEATURED_INSTANCING +) +{ +0 +} +else +{ first_instance +} +; +if +emulated_first_instance_value ! = self @@ -1399,7 +1442,7 @@ state . active_first_instance = -first_instance +emulated_first_instance_value ; } if @@ -1416,11 +1459,21 @@ self . rebind_vertex_data ( -first_instance +emulated_first_instance_value ) ; } } +# +[ +allow +( +clippy +: +: +clone_on_copy +) +] fn set_pipeline_inner ( @@ -1459,6 +1512,20 @@ self . state . +first_instance_location += +inner +. +first_instance_location +. +clone +( +) +; +self +. +state +. push_constant_descs = inner @@ -3776,6 +3843,7 @@ format sample_type ( None +None ) . unwrap @@ -6377,13 +6445,13 @@ draw & mut self -start_vertex +first_vertex : u32 vertex_count : u32 -start_instance +first_instance : u32 instance_count @@ -6395,9 +6463,19 @@ self . prepare_draw ( -start_instance +first_instance ) ; +# +[ +allow +( +clippy +: +: +clone_on_copy +) +] self . cmd_buffer @@ -6418,9 +6496,21 @@ self state . topology -start_vertex +first_vertex vertex_count +first_instance instance_count +first_instance_location +: +self +. +state +. +first_instance_location +. +clone +( +) } ) ; @@ -6432,7 +6522,7 @@ draw_indexed & mut self -start_index +first_index : u32 index_count @@ -6441,7 +6531,7 @@ u32 base_vertex : i32 -start_instance +first_instance : u32 instance_count @@ -6453,7 +6543,7 @@ self . prepare_draw ( -start_instance +first_instance ) ; let @@ -6514,13 +6604,23 @@ index_offset + index_size * -start_index +first_index as wgt : : BufferAddress ; +# +[ +allow +( +clippy +: +: +clone_on_copy +) +] self . cmd_buffer @@ -6545,7 +6645,19 @@ index_type index_offset index_count base_vertex +first_instance instance_count +first_instance_location +: +self +. +state +. +first_instance_location +. +clone +( +) } ) ; @@ -6622,6 +6734,16 @@ wgt : BufferAddress ; +# +[ +allow +( +clippy +: +: +clone_on_copy +) +] self . cmd_buffer @@ -6652,6 +6774,17 @@ unwrap ( ) indirect_offset +first_instance_location +: +self +. +state +. +first_instance_location +. +clone +( +) } ) ; @@ -6767,6 +6900,16 @@ wgt : BufferAddress ; +# +[ +allow +( +clippy +: +: +clone_on_copy +) +] self . cmd_buffer @@ -6798,6 +6941,17 @@ unwrap ( ) indirect_offset +first_instance_location +: +self +. +state +. +first_instance_location +. +clone +( +) } ) ; diff --git a/third_party/rust/wgpu-hal/src/gles/conv.rs b/third_party/rust/wgpu-hal/src/gles/conv.rs index 7faadd00a06e..539619be469e 100644 --- a/third_party/rust/wgpu-hal/src/gles/conv.rs +++ b/third_party/rust/wgpu-hal/src/gles/conv.rs @@ -1017,6 +1017,16 @@ UNSIGNED_INT_24_8 Tf : : +NV12 += +> +unreachable +! +( +) +Tf +: +: Rgb9e5Ufloat = > diff --git a/third_party/rust/wgpu-hal/src/gles/device.rs b/third_party/rust/wgpu-hal/src/gles/device.rs index 8e9f540b0ea3..a19dcc3edd87 100644 --- a/third_party/rust/wgpu-hal/src/gles/device.rs +++ b/third_party/rust/wgpu-hal/src/gles/device.rs @@ -3135,6 +3135,48 @@ clone } } } +let +first_instance_location += +if +has_stages +. +contains +( +wgt +: +: +ShaderStages +: +: +VERTEX +) +{ +unsafe +{ +gl +. +get_uniform_location +( +program +naga +: +: +back +: +: +glsl +: +: +FIRST_INSTANCE_BINDING +) +} +} +else +{ +None +} +; Ok ( Arc @@ -3149,6 +3191,7 @@ PipelineInner { program sampler_map +first_instance_location push_constant_descs : uniforms @@ -4924,6 +4967,14 @@ format sample_type ( None +Some +( +self +. +shared +. +features +) ) { Some @@ -6801,6 +6852,35 @@ glsl WriterFlags : : +DRAW_PARAMETERS +self +. +shared +. +private_caps +. +contains +( +super +: +: +PrivateCapabilities +: +: +FULLY_FEATURED_INSTANCING +) +) +; +writer_flags +. +set +( +glsl +: +: +WriterFlags +: +: FORCE_POINT_SIZE true ) @@ -8654,17 +8734,6 @@ lock ; let mut -temp_string -= -String -: -: -new -( -) -; -let -mut queries = Vec @@ -8680,7 +8749,7 @@ usize ) ; for -i +_ in 0 . @@ -8716,140 +8785,6 @@ OutOfMemory ) ? ; -# -[ -cfg -( -not -( -target_arch -= -" -wasm32 -" -) -) -] -if -gl -. -supports_debug -( -) -{ -use -std -: -: -fmt -: -: -Write -; -match -desc -. -ty -{ -wgt -: -: -QueryType -: -: -Timestamp -= -> -unsafe -{ -gl -. -query_counter -( -query -glow -: -: -TIMESTAMP -) -} -_ -= -> -( -) -} -if -let -Some -( -label -) -= -desc -. -label -{ -temp_string -. -clear -( -) -; -let -_ -= -write -! -( -temp_string -" -{ -label -} -[ -{ -i -} -] -" -) -; -let -name -= -unsafe -{ -mem -: -: -transmute -( -query -) -} -; -unsafe -{ -gl -. -object_label -( -glow -: -: -QUERY -name -Some -( -& -temp_string -) -) -} -; -} -} queries . push diff --git a/third_party/rust/wgpu-hal/src/gles/mod.rs b/third_party/rust/wgpu-hal/src/gles/mod.rs index b8ef68c4371b..dd9c2b26e670 100644 --- a/third_party/rust/wgpu-hal/src/gles/mod.rs +++ b/third_party/rust/wgpu-hal/src/gles/mod.rs @@ -735,34 +735,34 @@ COLOR_BUFFER_FLOAT / / Supports -linear -flitering -f32 -textures +query +buffer +objects . const -TEXTURE_FLOAT_LINEAR +QUERY_BUFFERS = 1 < < -10 +11 ; / / / Supports -query -buffer -objects -. +64 +bit +queries +via +glGetQueryObjectui64v const -QUERY_BUFFERS +QUERY_64BIT = 1 < < -11 +12 ; / / @@ -777,7 +777,7 @@ TEXTURE_STORAGE 1 < < -12 +13 ; / / @@ -794,7 +794,7 @@ DEBUG_FNS 1 < < -13 +14 ; / / @@ -809,7 +809,49 @@ INVALIDATE_FRAMEBUFFER 1 < < -14 +15 +; +/ +/ +/ +Indicates +support +for +glDrawElementsInstancedBaseVertexBaseInstance +and +ARB_shader_draw_parameters +/ +/ +/ +/ +/ +/ +When +this +is +true +instance +offset +emulation +via +vertex +buffer +rebinding +and +a +shader +uniform +will +be +disabled +. +const +FULLY_FEATURED_INSTANCING += +1 +< +< +16 ; } } @@ -1054,9 +1096,6 @@ glsl : : Version -max_texture_size -: -u32 next_shader_id : AtomicU32 @@ -2435,6 +2474,15 @@ Program sampler_map : SamplerBindMap +first_instance_location +: +Option +< +glow +: +: +UniformLocation +> push_constant_descs : ArrayVec @@ -3387,15 +3435,27 @@ Draw topology : u32 -start_vertex +first_vertex : u32 vertex_count : u32 +first_instance +: +u32 instance_count : u32 +first_instance_location +: +Option +< +glow +: +: +UniformLocation +> } DrawIndexed { @@ -3417,9 +3477,21 @@ BufferAddress base_vertex : i32 +first_instance +: +u32 instance_count : u32 +first_instance_location +: +Option +< +glow +: +: +UniformLocation +> } DrawIndirect { @@ -3438,6 +3510,15 @@ wgt : : BufferAddress +first_instance_location +: +Option +< +glow +: +: +UniformLocation +> } DrawIndexedIndirect { @@ -3459,6 +3540,15 @@ wgt : : BufferAddress +first_instance_location +: +Option +< +glow +: +: +UniformLocation +> } Dispatch ( @@ -4175,6 +4265,94 @@ finish ) } } +# +[ +cfg +( +all +( +target_arch += +" +wasm32 +" +feature += +" +fragile +- +send +- +sync +- +non +- +atomic +- +wasm +" +not +( +target_feature += +" +atomics +" +) +) +) +] +unsafe +impl +Sync +for +CommandBuffer +{ +} +# +[ +cfg +( +all +( +target_arch += +" +wasm32 +" +feature += +" +fragile +- +send +- +sync +- +non +- +atomic +- +wasm +" +not +( +target_feature += +" +atomics +" +) +) +) +] +unsafe +impl +Send +for +CommandBuffer +{ +} pub struct CommandEncoder @@ -4254,6 +4432,94 @@ finish [ cfg ( +all +( +target_arch += +" +wasm32 +" +feature += +" +fragile +- +send +- +sync +- +non +- +atomic +- +wasm +" +not +( +target_feature += +" +atomics +" +) +) +) +] +unsafe +impl +Sync +for +CommandEncoder +{ +} +# +[ +cfg +( +all +( +target_arch += +" +wasm32 +" +feature += +" +fragile +- +send +- +sync +- +non +- +atomic +- +wasm +" +not +( +target_feature += +" +atomics +" +) +) +) +] +unsafe +impl +Send +for +CommandEncoder +{ +} +# +[ +cfg +( not ( all @@ -4605,8 +4871,13 @@ crate : VALIDATION_CANARY . -set +add ( +message +. +to_string +( +) ) ; } diff --git a/third_party/rust/wgpu-hal/src/gles/queue.rs b/third_party/rust/wgpu-hal/src/gles/queue.rs index 391fb4101e6d..a9ee5d4cfde4 100644 --- a/third_party/rust/wgpu-hal/src/gles/queue.rs +++ b/third_party/rust/wgpu-hal/src/gles/queue.rs @@ -1063,13 +1063,73 @@ C Draw { topology -start_vertex +first_vertex vertex_count instance_count +first_instance +ref +first_instance_location } = > { +let +supports_full_instancing += +self +. +shared +. +private_caps +. +contains +( +PrivateCapabilities +: +: +FULLY_FEATURED_INSTANCING +) +; +if +supports_full_instancing +{ +unsafe +{ +gl +. +draw_arrays_instanced_base_instance +( +topology +first_vertex +as +i32 +vertex_count +as +i32 +instance_count +as +i32 +first_instance +) +} +} +else +{ +unsafe +{ +gl +. +uniform_1_u32 +( +first_instance_location +. +as_ref +( +) +first_instance +) +; +} unsafe { gl @@ -1077,7 +1137,7 @@ gl draw_arrays_instanced ( topology -start_vertex +first_vertex as i32 vertex_count @@ -1088,6 +1148,7 @@ as i32 ) } +} ; } C @@ -1100,7 +1161,10 @@ index_type index_count index_offset base_vertex +first_instance instance_count +ref +first_instance_location } = > @@ -1111,6 +1175,22 @@ base_vertex 0 = > +{ +unsafe +{ +gl +. +uniform_1_u32 +( +first_instance_location +. +as_ref +( +) +first_instance +) +} +; unsafe { gl @@ -1130,9 +1210,70 @@ as i32 ) } +} _ = > +{ +let +supports_full_instancing += +self +. +shared +. +private_caps +. +contains +( +PrivateCapabilities +: +: +FULLY_FEATURED_INSTANCING +) +; +if +supports_full_instancing +{ +unsafe +{ +gl +. +draw_elements_instanced_base_vertex_base_instance +( +topology +index_count +as +i32 +index_type +index_offset +as +i32 +instance_count +as +i32 +base_vertex +first_instance +) +} +} +else +{ +unsafe +{ +gl +. +uniform_1_u32 +( +first_instance_location +. +as_ref +( +) +first_instance +) +} +; unsafe { gl @@ -1155,6 +1296,8 @@ base_vertex } } } +} +} C : : @@ -1163,6 +1306,8 @@ DrawIndirect topology indirect_buf indirect_offset +ref +first_instance_location } = > @@ -1171,6 +1316,21 @@ unsafe { gl . +uniform_1_u32 +( +first_instance_location +. +as_ref +( +) +0 +) +} +; +unsafe +{ +gl +. bind_buffer ( glow @@ -1207,6 +1367,8 @@ topology index_type indirect_buf indirect_offset +ref +first_instance_location } = > @@ -1215,6 +1377,21 @@ unsafe { gl . +uniform_1_u32 +( +first_instance_location +. +as_ref +( +) +0 +) +} +; +unsafe +{ +gl +. bind_buffer ( glow @@ -4685,6 +4862,21 @@ u64 ; unsafe { +if +self +. +shared +. +private_caps +. +contains +( +PrivateCapabilities +: +: +QUERY_64BIT +) +{ let result : @@ -4710,6 +4902,25 @@ as usize ) } +else +{ +result += +gl +. +get_query_parameter_u32 +( +query +glow +: +: +QUERY_RESULT +) +as +u64 +; +} +} ; temp_query_results . diff --git a/third_party/rust/wgpu-hal/src/lib.rs b/third_party/rust/wgpu-hal/src/lib.rs index e3dce4b681dd..66089ba8b19c 100644 --- a/third_party/rust/wgpu-hal/src/lib.rs +++ b/third_party/rust/wgpu-hal/src/lib.rs @@ -395,14 +395,8 @@ NonNull sync : : -{ -atomic -: -: -AtomicBool Arc } -} ; use bitflags @@ -411,6 +405,12 @@ bitflags bitflags ; use +parking_lot +: +: +Mutex +; +use thiserror : : @@ -3036,13 +3036,13 @@ draw & mut self -start_vertex +first_vertex : u32 vertex_count : u32 -start_instance +first_instance : u32 instance_count @@ -3057,7 +3057,7 @@ draw_indexed & mut self -start_index +first_index : u32 index_count @@ -3066,7 +3066,7 @@ u32 base_vertex : i32 -start_instance +first_instance : u32 instance_count @@ -3315,14 +3315,13 @@ u32 Include support for -base -vertex +first_vertex / -instance +first_instance drawing . const -BASE_VERTEX_INSTANCE +FIRST_VERTEX_INSTANCE = 1 < @@ -5373,16 +5372,6 @@ wgt Extent3d > pub -extents -: -RangeInclusive -< -wgt -: -: -Extent3d -> -pub usage : TextureUses @@ -5792,6 +5781,13 @@ wgt : : ImageSubresourceRange +pub +plane +: +Option +< +u32 +> } # [ @@ -7610,12 +7606,17 @@ ValidationCanary { inner : -AtomicBool +Mutex +: +: +new +( +Vec : : new ( -false +) ) } ; @@ -7625,7 +7626,13 @@ ValidationCanary { inner : -AtomicBool +Mutex +< +Vec +< +String +> +> } impl ValidationCanary @@ -7638,32 +7645,26 @@ dead_code ) ] fn -set +add ( & self +msg +: +String ) { self . inner . -store +lock ( -true -std -: -: -sync -: -: -atomic -: -: -Ordering -: -: -SeqCst +) +. +push +( +msg ) ; } @@ -7676,28 +7677,27 @@ self ) - > -bool +Vec +< +String +> { self . inner . -swap +lock +( +) +. +drain +( +. +. +) +. +collect ( -false -std -: -: -sync -: -: -atomic -: -: -Ordering -: -: -SeqCst ) } } diff --git a/third_party/rust/wgpu-hal/src/metal/adapter.rs b/third_party/rust/wgpu-hal/src/metal/adapter.rs index 0edff0502c3e..ca2554dee3db 100644 --- a/third_party/rust/wgpu-hal/src/metal/adapter.rs +++ b/third_party/rust/wgpu-hal/src/metal/adapter.rs @@ -1250,6 +1250,19 @@ flags Tf : : +NV12 += +> +return +Tfc +: +: +empty +( +) +Tf +: +: Rgb9e5Ufloat = > @@ -1754,49 +1767,6 @@ CompositeAlphaMode PostMultiplied ] current_extent -extents -: -wgt -: -: -Extent3d -{ -width -: -4 -height -: -4 -depth_or_array_layers -: -1 -} -. -. -= -wgt -: -: -Extent3d -{ -width -: -pc -. -max_texture_size -as -u32 -height -: -pc -. -max_texture_size -as -u32 -depth_or_array_layers -: -1 -} usage : crate @@ -2138,7 +2108,7 @@ macOS_GPUFamily2_v1 ] ; const -BASE_INSTANCE_SUPPORT +INDIRECT_DRAW_DISPATCH_SUPPORT : & [ @@ -2162,28 +2132,14 @@ macOS_GPUFamily1_v1 ] ; const -BASE_VERTEX_INSTANCE_SUPPORT +BASE_VERTEX_FIRST_INSTANCE_SUPPORT : & [ MTLFeatureSet ] = -& -[ -MTLFeatureSet -: -: -iOS_GPUFamily3_v1 -MTLFeatureSet -: -: -tvOS_GPUFamily2_v1 -MTLFeatureSet -: -: -macOS_GPUFamily1_v1 -] +INDIRECT_DRAW_DISPATCH_SUPPORT ; const TEXTURE_CUBE_ARRAY_SUPPORT @@ -3161,7 +3117,7 @@ supports_any device SAMPLER_CLAMP_TO_BORDER_SUPPORT ) -base_instance +indirect_draw_dispatch : Self : @@ -3169,9 +3125,9 @@ Self supports_any ( device -BASE_INSTANCE_SUPPORT +INDIRECT_DRAW_DISPATCH_SUPPORT ) -base_vertex_instance_drawing +base_vertex_first_instance_drawing : Self : @@ -3179,7 +3135,7 @@ Self supports_any ( device -BASE_VERTEX_INSTANCE_SUPPORT +BASE_VERTEX_FIRST_INSTANCE_SUPPORT ) dual_source_blending : @@ -3252,6 +3208,34 @@ supports_any device TEXTURE_CUBE_ARRAY_SUPPORT ) +supports_float_filtering +: +os_is_mac +| +| +( +version +. +at_least +( +( +11 +0 +) +( +14 +0 +) +os_is_mac +) +& +& +device +. +supports_32bit_float_filtering +( +) +) format_depth24_stencil8 : os_is_mac @@ -4243,11 +4227,6 @@ empty F : : -INDIRECT_FIRST_INSTANCE -| -F -: -: MAPPABLE_PRIMARY_BUFFERS | F @@ -4293,12 +4272,38 @@ DEPTH32FLOAT_STENCIL8 F : : -MULTI_DRAW_INDIRECT +BGRA8UNORM_STORAGE +; +features +. +set +( +F +: +: +FLOAT32_FILTERABLE +self +. +supports_float_filtering +) +; +features +. +set +( +F +: +: +INDIRECT_FIRST_INSTANCE | F : : -BGRA8UNORM_STORAGE +MULTI_DRAW_INDIRECT +self +. +indirect_draw_dispatch +) ; features . @@ -4654,6 +4659,42 @@ wgt DownlevelFlags : : +INDIRECT_EXECUTION +self +. +indirect_draw_dispatch +) +; +downlevel +. +flags +. +set +( +wgt +: +: +DownlevelFlags +: +: +BASE_VERTEX +self +. +base_vertex_first_instance_drawing +) +; +downlevel +. +flags +. +set +( +wgt +: +: +DownlevelFlags +: +: ANISOTROPIC_FILTERING true ) @@ -5308,6 +5349,16 @@ Depth32Float_Stencil8 Tf : : +NV12 += +> +unreachable +! +( +) +Tf +: +: Rgb9e5Ufloat = > diff --git a/third_party/rust/wgpu-hal/src/metal/command.rs b/third_party/rust/wgpu-hal/src/metal/command.rs index 7b929e1b85e1..22341ab01a22 100644 --- a/third_party/rust/wgpu-hal/src/metal/command.rs +++ b/third_party/rust/wgpu-hal/src/metal/command.rs @@ -6129,13 +6129,13 @@ draw & mut self -start_vertex +first_vertex : u32 vertex_count : u32 -start_instance +first_instance : u32 instance_count @@ -6161,7 +6161,7 @@ unwrap ) ; if -start_instance +first_instance ! = 0 @@ -6175,7 +6175,7 @@ self state . raw_primitive_type -start_vertex +first_vertex as _ vertex_count @@ -6184,7 +6184,7 @@ _ instance_count as _ -start_instance +first_instance as _ ) @@ -6206,7 +6206,7 @@ self state . raw_primitive_type -start_vertex +first_vertex as _ vertex_count @@ -6229,7 +6229,7 @@ self state . raw_primitive_type -start_vertex +first_vertex as _ vertex_count @@ -6246,7 +6246,7 @@ draw_indexed & mut self -start_index +first_index : u32 index_count @@ -6255,7 +6255,7 @@ u32 base_vertex : i32 -start_instance +first_instance : u32 instance_count @@ -6308,7 +6308,7 @@ index . stride * -start_index +first_index as wgt : @@ -6322,7 +6322,7 @@ base_vertex 0 | | -start_instance +first_instance ! = 0 @@ -6356,7 +6356,7 @@ _ base_vertex as _ -start_instance +first_instance as _ ) diff --git a/third_party/rust/wgpu-hal/src/metal/mod.rs b/third_party/rust/wgpu-hal/src/metal/mod.rs index c95278d780b4..ae9f3bfdce44 100644 --- a/third_party/rust/wgpu-hal/src/metal/mod.rs +++ b/third_party/rust/wgpu-hal/src/metal/mod.rs @@ -943,10 +943,10 @@ bool sampler_clamp_to_border : bool -base_instance +indirect_draw_dispatch : bool -base_vertex_instance_drawing +base_vertex_first_instance_drawing : bool dual_source_blending @@ -970,6 +970,9 @@ bool texture_cube_array : bool +supports_float_filtering +: +bool format_depth24_stencil8 : bool diff --git a/third_party/rust/wgpu-hal/src/vulkan/adapter.rs b/third_party/rust/wgpu-hal/src/vulkan/adapter.rs index 43ba0224281f..fc9c721d3844 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/adapter.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/adapter.rs @@ -1571,6 +1571,13 @@ to_wgpu ( & self +adapter_info +: +& +wgt +: +: +AdapterInfo instance : & @@ -1753,6 +1760,11 @@ Df : : NONBLOCKING_QUERY_RESOLVE +| +Df +: +: +VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW ; dl_flags . @@ -2768,6 +2780,115 @@ device_api_version ) ) ; +features +. +set +( +F +: +: +FLOAT32_FILTERABLE +is_float32_filterable_supported +( +instance +phd +) +) +; +features +. +set +( +F +: +: +TEXTURE_FORMAT_NV12 +( +caps +. +device_api_version +> += +vk +: +: +API_VERSION_1_1 +| +| +caps +. +supports_extension +( +vk +: +: +KhrSamplerYcbcrConversionFn +: +: +name +( +) +) +) +& +& +supports_format +( +instance +phd +vk +: +: +Format +: +: +G8_B8R8_2PLANE_420_UNORM +vk +: +: +ImageTiling +: +: +OPTIMAL +vk +: +: +FormatFeatureFlags +: +: +SAMPLED_IMAGE +| +vk +: +: +FormatFeatureFlags +: +: +TRANSFER_SRC +| +vk +: +: +FormatFeatureFlags +: +: +TRANSFER_DST +) +& +& +! +adapter_info +. +driver +. +contains +( +" +MoltenVK +" +) +) +; ( features dl_flags @@ -5388,6 +5509,8 @@ phd_features to_wgpu ( & +info +& self . shared @@ -5576,6 +5699,86 @@ major = 0 { +if +driver +. +driver_id += += +ash +: +: +vk +: +: +DriverId +: +: +MOLTENVK +{ +log +: +: +debug +! +( +" +Adapter +is +not +Vulkan +compliant +but +is +MoltenVK +continuing +" +) +; +} +else +if +self +. +shared +. +flags +. +contains +( +wgt +: +: +InstanceFlags +: +: +ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER +) +{ +log +: +: +warn +! +( +" +Adapter +is +not +Vulkan +compliant +: +{ +} +" +info +. +name +) +; +} +else +{ log : : @@ -5604,6 +5807,7 @@ None ; } } +} if phd_capabilities . @@ -8579,12 +8783,11 @@ format sample_type ( None -) -. -unwrap -( +None ) { +Some +( wgt : : @@ -8593,10 +8796,10 @@ TextureSampleType : Float { -filterable -: -_ +. +. } +) = > limits @@ -8609,6 +8812,8 @@ limits . sampled_image_color_sample_counts ) +Some +( wgt : : @@ -8616,7 +8821,10 @@ TextureSampleType : : Sint +) | +Some +( wgt : : @@ -8624,6 +8832,7 @@ TextureSampleType : : Uint +) = > { @@ -8634,10 +8843,13 @@ sampled_image_integer_sample_counts _ = > -unreachable -! -( -) +vk +: +: +SampleCountFlags +: +: +TYPE_1 } } ; @@ -8995,62 +9207,6 @@ None } ; let -min_extent -= -wgt -: -: -Extent3d -{ -width -: -caps -. -min_image_extent -. -width -height -: -caps -. -min_image_extent -. -height -depth_or_array_layers -: -1 -} -; -let -max_extent -= -wgt -: -: -Extent3d -{ -width -: -caps -. -max_image_extent -. -width -height -: -caps -. -max_image_extent -. -height -depth_or_array_layers -: -caps -. -max_image_array_layers -} -; -let raw_present_modes = { @@ -9233,13 +9389,6 @@ min_image_count = max_image_count current_extent -extents -: -min_extent -. -. -= -max_extent usage : conv @@ -9574,6 +9723,111 @@ rgba16unorm rgba16snorm } fn +is_float32_filterable_supported +( +instance +: +& +ash +: +: +Instance +phd +: +vk +: +: +PhysicalDevice +) +- +> +bool +{ +let +tiling += +vk +: +: +ImageTiling +: +: +OPTIMAL +; +let +features += +vk +: +: +FormatFeatureFlags +: +: +SAMPLED_IMAGE_FILTER_LINEAR +; +let +r_float += +supports_format +( +instance +phd +vk +: +: +Format +: +: +R32_SFLOAT +tiling +features +) +; +let +rg_float += +supports_format +( +instance +phd +vk +: +: +Format +: +: +R32G32_SFLOAT +tiling +features +) +; +let +rgba_float += +supports_format +( +instance +phd +vk +: +: +Format +: +: +R32G32B32A32_SFLOAT +tiling +features +) +; +r_float +& +& +rg_float +& +& +rgba_float +} +fn supports_format ( instance diff --git a/third_party/rust/wgpu-hal/src/vulkan/command.rs b/third_party/rust/wgpu-hal/src/vulkan/command.rs index 4d6815c13678..ec15be319223 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/command.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/command.rs @@ -4131,13 +4131,13 @@ draw & mut self -start_vertex +first_vertex : u32 vertex_count : u32 -start_instance +first_instance : u32 instance_count @@ -4160,8 +4160,8 @@ self active vertex_count instance_count -start_vertex -start_instance +first_vertex +first_instance ) } ; @@ -4173,7 +4173,7 @@ draw_indexed & mut self -start_index +first_index : u32 index_count @@ -4182,7 +4182,7 @@ u32 base_vertex : i32 -start_instance +first_instance : u32 instance_count @@ -4205,9 +4205,9 @@ self active index_count instance_count -start_index +first_index base_vertex -start_instance +first_instance ) } ; diff --git a/third_party/rust/wgpu-hal/src/vulkan/conv.rs b/third_party/rust/wgpu-hal/src/vulkan/conv.rs index d48000113fe3..d627a6bace3d 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/conv.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/conv.rs @@ -600,6 +600,16 @@ D16_UNORM Tf : : +NV12 += +> +F +: +: +G8_B8R8_2PLANE_420_UNORM +Tf +: +: Rgb9e5Ufloat = > @@ -1635,6 +1645,7 @@ view_format sample_type ( None +None ) . unwrap @@ -3448,6 +3459,12 @@ crate : : FormatAspects +plane +: +Option +< +u32 +> ) - > @@ -3470,6 +3487,78 @@ empty ( ) ; +match +plane +{ +Some +( +0 +) += +> +flags +| += +vk +: +: +ImageAspectFlags +: +: +PLANE_0 +Some +( +1 +) += +> +flags +| += +vk +: +: +ImageAspectFlags +: +: +PLANE_1 +Some +( +2 +) += +> +flags +| += +vk +: +: +ImageAspectFlags +: +: +PLANE_2 +Some +( +plane +) += +> +panic +! +( +" +Unexpected +plane +{ +} +" +plane +) +None += +> +{ if aspects . @@ -3496,6 +3585,8 @@ ImageAspectFlags COLOR ; } +} +} if aspects . @@ -4999,6 +5090,12 @@ wgt : : TextureFormat +plane +: +Option +< +u32 +> ) - > @@ -5029,6 +5126,7 @@ range . aspect ) +plane ) base_mip_level : @@ -5111,6 +5209,7 @@ map_subresource_range ( range format +None ) ; if @@ -5224,6 +5323,7 @@ map_aspects base . aspect +None ) mip_level : diff --git a/third_party/rust/wgpu-hal/src/vulkan/device.rs b/third_party/rust/wgpu-hal/src/vulkan/device.rs index d1b59505de76..85da26a3f48e 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/device.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/device.rs @@ -6811,6 +6811,9 @@ range desc . format +desc +. +plane ) ; let diff --git a/third_party/rust/wgpu-hal/src/vulkan/instance.rs b/third_party/rust/wgpu-hal/src/vulkan/instance.rs index e75b39fdc687..3f181f79ff35 100644 --- a/third_party/rust/wgpu-hal/src/vulkan/instance.rs +++ b/third_party/rust/wgpu-hal/src/vulkan/instance.rs @@ -232,11 +232,11 @@ FALSE } } const -VUID_VKSWAPCHAINCREATEINFOKHR_IMAGEEXTENT_01274 +VUID_VKSWAPCHAINCREATEINFOKHR_PNEXT_07781 : i32 = -0x7cd0911d +0x4c8929c1 ; if cd @@ -244,7 +244,7 @@ cd message_id_number = = -VUID_VKSWAPCHAINCREATEINFOKHR_IMAGEEXTENT_01274 +VUID_VKSWAPCHAINCREATEINFOKHR_PNEXT_07781 { return vk @@ -966,8 +966,13 @@ crate : VALIDATION_CANARY . -set +add ( +message +. +to_string +( +) ) ; } diff --git a/third_party/rust/wgpu-types/.cargo-checksum.json b/third_party/rust/wgpu-types/.cargo-checksum.json index bfbb7b453796..6fa2b850914b 100644 --- a/third_party/rust/wgpu-types/.cargo-checksum.json +++ b/third_party/rust/wgpu-types/.cargo-checksum.json @@ -11,7 +11,7 @@ toml " : " -e45ee369c8f91526056ba7f46504e270da1d8b2de65431bbaf36426bcd54da68 +18549fb7d7de2ea2481f30292dca63889856a33bd1b3698e16cee6631ab65df4 " " LICENSE @@ -51,7 +51,7 @@ rs " : " -6c3886f27653eee4359a8d150a6091a7d6e0ff1abab44c9afff2d54a0d0a474b +61f4f46533468f82e3d22e42d6e8b3d8b68504ccd4f9b4b9ea67b0664c42a34e " " src diff --git a/third_party/rust/wgpu-types/Cargo.toml b/third_party/rust/wgpu-types/Cargo.toml index eca9278789fb..a46f983c7514 100644 --- a/third_party/rust/wgpu-types/Cargo.toml +++ b/third_party/rust/wgpu-types/Cargo.toml @@ -380,7 +380,7 @@ sys . 3 . -65 +66 " [ target @@ -411,7 +411,7 @@ version . 3 . -64 +66 " features = diff --git a/third_party/rust/wgpu-types/src/lib.rs b/third_party/rust/wgpu-types/src/lib.rs index 30d2cfda5865..675899e24095 100644 --- a/third_party/rust/wgpu-types/src/lib.rs +++ b/third_party/rust/wgpu-types/src/lib.rs @@ -1691,10 +1691,8 @@ zero value for the -" -first -instance -" +first_instance +member in indirect draw @@ -1706,6 +1704,72 @@ calls / / / +If +this +feature +is +not +enabled +and +the +first_instance +member +is +non +- +zero +the +behavior +may +be +: +/ +/ +/ +- +The +draw +call +is +ignored +. +/ +/ +/ +- +The +draw +call +is +executed +as +if +the +first_instance +is +zero +. +/ +/ +/ +- +The +draw +call +is +executed +with +the +correct +first_instance +value +. +/ +/ +/ +/ +/ +/ Supported Platforms : @@ -1727,6 +1791,44 @@ DX12 / - Metal +on +Apple3 ++ +or +Mac1 ++ +/ +/ +/ +- +OpenGL +( +Desktop +4 +. +2 ++ +with +ARB_shader_draw_parameters +only +) +/ +/ +/ +/ +/ +/ +Not +Supported +: +/ +/ +/ +- +OpenGL +ES +/ +WebGL / / / @@ -2078,7 +2180,98 @@ issues ) / / -TODO +/ +Allows +textures +with +formats +" +r32float +" +" +rg32float +" +and +" +rgba32float +" +to +be +filterable +. +/ +/ +/ +/ +/ +/ +Supported +Platforms +: +/ +/ +/ +- +Vulkan +( +mainly +on +Desktop +GPUs +) +/ +/ +/ +- +DX12 +/ +/ +/ +- +Metal +on +macOS +or +Apple9 ++ +GPUs +optional +on +iOS +/ +iPadOS +with +Apple7 +/ +8 +GPUs +/ +/ +/ +- +GL +with +one +of +GL_ARB_color_buffer_float +/ +GL_EXT_color_buffer_float +/ +OES_texture_float_linear +/ +/ +/ +/ +/ +/ +This +is +a +web +and +native +feature +. const FLOAT32_FILTERABLE = @@ -4702,6 +4895,12 @@ Vulkan / - Metal +on +Apple3 ++ +or +Mac1 ++ ( Emulated on @@ -5977,7 +6176,63 @@ SHADER_UNUSED_VERTEX_OUTPUT ; / / -54 +/ +Allows +for +creation +of +textures +of +format +[ +TextureFormat +: +: +NV12 +] +/ +/ +/ +/ +/ +/ +Supported +platforms +: +/ +/ +/ +- +DX12 +/ +/ +/ +- +Vulkan +/ +/ +/ +/ +/ +/ +This +is +a +native +only +feature +. +const +TEXTURE_FORMAT_NV12 += +1 +< +< +55 +; +/ +/ +55 . . 59 @@ -6582,22 +6837,170 @@ DISCARD_HAL_LABELS < 2 ; -} -} -impl -Default -for -InstanceFlags -{ -fn -default -( -) -- -> -Self -{ -Self +/ +/ +/ +Whether +wgpu +should +expose +adapters +that +run +on +top +of +non +- +compliant +adapters +. +/ +/ +/ +/ +/ +/ +Turning +this +on +might +mean +that +some +of +the +functionality +provided +by +the +wgpu +/ +/ +/ +adapter +/ +device +is +not +working +or +is +broken +. +It +could +be +that +all +the +functionality +/ +/ +/ +wgpu +currently +exposes +works +but +we +can +' +t +tell +for +sure +since +we +have +no +additional +/ +/ +/ +transparency +into +what +is +working +and +what +is +not +on +the +underlying +adapter +. +/ +/ +/ +/ +/ +/ +This +mainly +applies +to +a +Vulkan +driver +' +s +compliance +version +. +If +the +major +compliance +version +/ +/ +/ +is +0 +then +the +driver +is +ignored +. +This +flag +allows +that +driver +to +be +enabled +for +testing +. +const +ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER += +1 +< +< +3 +; +} +} +impl +Default +for +InstanceFlags +{ +fn +default +( +) +- +> +Self +{ +Self : : from_build_config @@ -6777,6 +7180,32 @@ bit ) ; } +if +let +Some +( +bit +) += +env +( +" +WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER +" +) +{ +self +. +set +( +Self +: +: +ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER +bit +) +; +} self } } @@ -8184,12 +8613,17 @@ FL10 level hardware WebGL2 -and GLES 3 . 0 -devices +and +Metal +on +Apple1 +/ +Apple2 +GPUs do not support @@ -8213,10 +8647,76 @@ zero base_vertex parameter to +direct indexed draw calls . +/ +/ +/ +/ +/ +/ +Indirect +calls +if +supported +always +support +non +- +zero +base_vertex +. +/ +/ +/ +/ +/ +/ +Supported +by +: +/ +/ +/ +- +Vulkan +/ +/ +/ +- +DX12 +/ +/ +/ +- +Metal +on +Apple3 ++ +or +Mac1 ++ +/ +/ +/ +- +OpenGL +3 +. +2 ++ +/ +/ +/ +- +OpenGL +ES +3 +. +2 const BASE_VERTEX = @@ -9038,95 +9538,348 @@ timeline / / / -If +If +this +is +false +calls +to +CommandEncoder +: +: +resolve_query_set +will +be +performed +on +the +device +( +i +. +e +. +cpu +) +timeline +/ +/ +/ +and +will +block +that +timeline +until +the +query +has +data +. +You +may +work +around +this +limitation +by +waiting +until +the +submit +/ +/ +/ +whose +queries +you +are +resolving +is +fully +finished +( +through +use +of +queue +. +on_submitted_work_done +) +and +only +/ +/ +/ +then +submitting +the +resolve_query_set +command +. +The +queries +will +be +guarenteed +finished +so +will +not +block +. +/ +/ +/ +/ +/ +/ +Supported +by +: +/ +/ +/ +- +Vulkan +/ +/ +/ +- +DX12 +/ +/ +/ +- +Metal +/ +/ +/ +- +OpenGL +4 +. +4 ++ +/ +/ +/ +/ +/ +/ +Not +Supported +by +: +/ +/ +/ +- +GL +ES +/ +WebGL +const +NONBLOCKING_QUERY_RESOLVE += +1 +< +< +22 +; +/ +/ +/ +If +this +is +true +use +of +builtin +( +vertex_index +) +and +builtin +( +instance_index +) +will +properly +take +into +consideration +/ +/ +/ +the +first_vertex +and +first_instance +parameters +of +indirect +draw +calls +. +/ +/ +/ +/ +/ +/ +If +this +is +false +builtin +( +vertex_index +) +and +builtin +( +instance_index +) +will +start +by +counting +from +0 +ignoring +the +/ +/ +/ +first_vertex +and +first_instance +parameters +. +/ +/ +/ +/ +/ +/ +For +example +if +you +had +a +draw +call +like +this +: +/ +/ +/ +- +first_vertex +: +4 +/ +/ +/ +- +vertex_count +: +12 +/ +/ +/ +/ +/ +/ +When +this +flag +is +present +builtin +( +vertex_index +) +will +start +at +4 +and +go +up +to +15 +( +12 +invocations +) +. +/ +/ +/ +/ +/ +/ +When this +flag is -false -calls -to -CommandEncoder -: -: -resolve_query_set +not +present +builtin +( +vertex_index +) will -be -performed -on -the -device +start +at +0 +and +go +up +to +11 ( -i -. -e -. -cpu +12 +invocations ) -timeline +. / / / -and -will -block -that -timeline -until -the -query -has -data -. -You -may -work -around -this -limitation -by -waiting -until -the -submit / / / -whose -queries -you -are -resolving -is -fully -finished -( -through -use -of -queue -. -on_submitted_work_done -) -and +This only +affects +the +builtins +in +the +shaders / / / -then -submitting -the -resolve_query_set -command -. -The -queries -will -be -guarenteed -finished -so +vertex +buffers +and +instance +rate +vertex +buffers will -not -block +behave +like +expected +with +this +flag +disabled . / / @@ -9134,19 +9887,27 @@ block / / / -Supported -by +See +also +[ +Features +: : +] / / / -- -Vulkan +/ +/ +/ +Supported +By +: / / / - -DX12 +Vulkan / / / @@ -9157,35 +9918,57 @@ Metal / - OpenGL -4 -. -4 -+ / / / / / / -Not -Supported +Will +be +implemented +in +the +future by : / / / - -GL -ES +DX12 +( +[ +# +2471 +] +( +https +: / -WebGL +/ +github +. +com +/ +gfx +- +rs +/ +wgpu +/ +issues +/ +2471 +) +) const -NONBLOCKING_QUERY_RESOLVE +VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW = 1 < < -22 +23 ; } } @@ -9453,11 +10236,11 @@ label : L pub -features +required_features : Features pub -limits +required_limits : Limits } @@ -9509,16 +10292,16 @@ self . label ) -features +required_features : self . -features -limits +required_features +required_limits : self . -limits +required_limits . clone ( @@ -12142,6 +12925,7 @@ Depth24Plus Depth24PlusStencil8 Depth32Float Depth32FloatStencil8 +NV12 Bc1RgbaUnorm Bc1RgbaUnormSrgb Bc2RgbaUnorm @@ -12784,6 +13568,15 @@ TextureFormat : Depth24PlusStencil8 " +nv12 +" += +> +TextureFormat +: +: +NV12 +" rgb9e5ufloat " = @@ -13928,6 +14721,15 @@ stencil8 TextureFormat : : +NV12 += +> +" +nv12 +" +TextureFormat +: +: Rgb9e5Ufloat = > @@ -15127,6 +15929,16 @@ Depth32FloatStencil8 Self : : +NV12 += +> +( +2 +2 +) +Self +: +: Bc1RgbaUnorm | Self @@ -15679,6 +16491,16 @@ DEPTH32FLOAT_STENCIL8 Self : : +NV12 += +> +Features +: +: +TEXTURE_FORMAT_NV12 +Self +: +: R16Unorm | Self @@ -15964,6 +16786,14 @@ TextureUsages STORAGE_BINDING ; let +binding += +TextureUsages +: +: +TEXTURE_BINDING +; +let all_flags = TextureUsages @@ -16461,6 +17291,16 @@ attachment Self : : +NV12 += +> +( +noaa +binding +) +Self +: +: R16Unorm = > @@ -16763,36 +17603,75 @@ Self : EacRg11Snorm = -> +> +( +noaa +basic +) +Self +: +: +Astc +{ +. +. +} += +> +( +noaa +basic +) +} +; +let +sample_type1 += +self +. +sample_type +( +None +Some +( +device_features +) +) +; +let +is_filterable += +sample_type1 += += +Some ( -noaa -basic -) -Self +TextureSampleType : : -Astc +Float { -. -. +filterable +: +true } -= -> -( -noaa -basic ) -} ; let -is_filterable +sample_type2 = self . sample_type ( None +None ) +; +let +is_blendable += +sample_type2 = = Some @@ -16827,7 +17706,7 @@ TextureFormatFeatureFlags : : BLENDABLE -is_filterable +is_blendable ) ; TextureFormatFeatures @@ -16848,6 +17727,12 @@ Option < TextureAspect > +device_features +: +Option +< +Features +> ) - > @@ -16870,7 +17755,7 @@ true } ; let -unfilterable_float +float32_sample_type = TextureSampleType : @@ -16879,7 +17764,25 @@ Float { filterable : -false +device_features +. +unwrap_or +( +Features +: +: +empty +( +) +) +. +contains +( +Features +: +: +FLOAT32_FILTERABLE +) } ; let @@ -17003,7 +17906,7 @@ Rgba32Float > Some ( -unfilterable_float +float32_sample_type ) Self : @@ -17196,6 +18099,13 @@ uint Self : : +NV12 += +> +None +Self +: +: R16Unorm | Self @@ -17860,6 +18770,13 @@ Some Self : : +NV12 += +> +None +Self +: +: Bc1RgbaUnorm | Self @@ -18338,6 +19255,13 @@ StencilOnly Self : : +NV12 += +> +3 +Self +: +: Bc4RUnorm | Self @@ -32140,9 +33064,10 @@ C [ derive ( -Clone Copy +Clone Debug +Default ) ] pub @@ -32166,6 +33091,69 @@ first_instance : u32 } +impl +DrawIndirectArgs +{ +pub +fn +as_bytes +( +& +self +) +- +> +& +[ +u8 +] +{ +unsafe +{ +std +: +: +mem +: +: +transmute +( +std +: +: +slice +: +: +from_raw_parts +( +self +as +* +const +_ +as +* +const +u8 +std +: +: +mem +: +: +size_of +: +: +< +Self +> +( +) +) +) +} +} +} # [ repr @@ -32177,9 +33165,10 @@ C [ derive ( -Clone Copy +Clone Debug +Default ) ] pub @@ -32207,6 +33196,69 @@ first_instance : u32 } +impl +DrawIndexedIndirectArgs +{ +pub +fn +as_bytes +( +& +self +) +- +> +& +[ +u8 +] +{ +unsafe +{ +std +: +: +mem +: +: +transmute +( +std +: +: +slice +: +: +from_raw_parts +( +self +as +* +const +_ +as +* +const +u8 +std +: +: +mem +: +: +size_of +: +: +< +Self +> +( +) +) +) +} +} +} # [ repr @@ -32218,9 +33270,10 @@ C [ derive ( -Clone Copy +Clone Debug +Default ) ] pub @@ -32228,18 +33281,81 @@ struct DispatchIndirectArgs { pub -group_size_x +x : u32 pub -group_size_y +y : u32 pub -group_size_z +z : u32 } +impl +DispatchIndirectArgs +{ +pub +fn +as_bytes +( +& +self +) +- +> +& +[ +u8 +] +{ +unsafe +{ +std +: +: +mem +: +: +transmute +( +std +: +: +slice +: +: +from_raw_parts +( +self +as +* +const +_ +as +* +const +u8 +std +: +: +mem +: +: +size_of +: +: +< +Self +> +( +) +) +) +} +} +} # [ derive