From 9539e4cb0e512ff3c3ff776c3663f01f096cf840 Mon Sep 17 00:00:00 2001 From: atlas dostal Date: Sat, 20 Apr 2024 23:51:06 -0700 Subject: [PATCH 1/3] Move request_type_capabilities outside of LocalType lookup to avoid incorrect caching --- CHANGELOG.md | 2 +- naga/src/back/spv/mod.rs | 2 +- naga/src/back/spv/writer.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b9fdf7783..fafe9cd227 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -168,7 +168,7 @@ Bottom level categories: #### Tests - Fix intermittent crashes on Linux in the `multithreaded_compute` test. By @jimblandy in [#5129](https://github.com/gfx-rs/wgpu/pull/5129). -- Refactor tests to read feature flags by name instead of a hardcoded hexadecimal u64. By @rodolphito in [#5155](https://github.com/gfx-rs/wgpu/pull/5155). +- Refactor tests to read feature flags by name instead of a hardcoded hexadecimal u64. By @atlv24 in [#5155](https://github.com/gfx-rs/wgpu/pull/5155). - Add test that verifies that we can drop the queue before using the device to create a command encoder. By @Davidster in [#5211](https://github.com/gfx-rs/wgpu/pull/5211) #### GLES diff --git a/naga/src/back/spv/mod.rs b/naga/src/back/spv/mod.rs index 3bc2225b01..38a87049e6 100644 --- a/naga/src/back/spv/mod.rs +++ b/naga/src/back/spv/mod.rs @@ -248,7 +248,7 @@ impl LocalImageType { /// this, by converting everything possible to a `LocalType` before inspecting /// it. /// -/// ## `Localtype` equality and SPIR-V `OpType` uniqueness +/// ## `LocalType` equality and SPIR-V `OpType` uniqueness /// /// The definition of `Eq` on `LocalType` is carefully chosen to help us follow /// certain SPIR-V rules. SPIR-V ยง2.8 requires some classes of `OpType...` diff --git a/naga/src/back/spv/writer.rs b/naga/src/back/spv/writer.rs index a1ee26a5c7..a7692be2f9 100644 --- a/naga/src/back/spv/writer.rs +++ b/naga/src/back/spv/writer.rs @@ -971,6 +971,10 @@ impl Writer { ) -> Result { let ty = &arena[handle]; let id = if let Some(local) = make_local(&ty.inner) { + // If it's a type that needs SPIR-V capabilities, request them now, + // so write_type_declaration_local can stay infallible. + self.request_type_capabilities(&ty.inner)?; + // This type can be represented as a `LocalType`, so check if we've // already written an instruction for it. If not, do so now, with // `write_type_declaration_local`. @@ -985,10 +989,6 @@ impl Writer { self.write_type_declaration_local(id, local); - // If it's a type that needs SPIR-V capabilities, request them now, - // so write_type_declaration_local can stay infallible. - self.request_type_capabilities(&ty.inner)?; - id } } From 0ef828da7df58214a9729ef52333b2ef910dd858 Mon Sep 17 00:00:00 2001 From: atlas dostal Date: Tue, 23 Apr 2024 10:31:03 -0700 Subject: [PATCH 2/3] Docs --- naga/src/back/spv/writer.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/naga/src/back/spv/writer.rs b/naga/src/back/spv/writer.rs index a7692be2f9..745d818ce3 100644 --- a/naga/src/back/spv/writer.rs +++ b/naga/src/back/spv/writer.rs @@ -971,8 +971,10 @@ impl Writer { ) -> Result { let ty = &arena[handle]; let id = if let Some(local) = make_local(&ty.inner) { - // If it's a type that needs SPIR-V capabilities, request them now, - // so write_type_declaration_local can stay infallible. + // If it's a type that needs SPIR-V capabilities, request them now. + // This needs to happen regardless of the LocalType lookup succeeding, + // because some types which map to the same LocalType have different + // capability requirements. See https://github.com/gfx-rs/wgpu/issues/5569 self.request_type_capabilities(&ty.inner)?; // This type can be represented as a `LocalType`, so check if we've From 408b244f8f6d5fe2d4bfe3bbbafc2474f61ee650 Mon Sep 17 00:00:00 2001 From: vero Date: Wed, 24 Apr 2024 11:23:24 -0700 Subject: [PATCH 3/3] Update naga/src/back/spv/writer.rs Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> --- naga/src/back/spv/writer.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/naga/src/back/spv/writer.rs b/naga/src/back/spv/writer.rs index 745d818ce3..73a16c273e 100644 --- a/naga/src/back/spv/writer.rs +++ b/naga/src/back/spv/writer.rs @@ -970,13 +970,12 @@ impl Writer { handle: Handle, ) -> Result { let ty = &arena[handle]; + // If it's a type that needs SPIR-V capabilities, request them now. + // This needs to happen regardless of the LocalType lookup succeeding, + // because some types which map to the same LocalType have different + // capability requirements. See https://github.com/gfx-rs/wgpu/issues/5569 + self.request_type_capabilities(&ty.inner)?; let id = if let Some(local) = make_local(&ty.inner) { - // If it's a type that needs SPIR-V capabilities, request them now. - // This needs to happen regardless of the LocalType lookup succeeding, - // because some types which map to the same LocalType have different - // capability requirements. See https://github.com/gfx-rs/wgpu/issues/5569 - self.request_type_capabilities(&ty.inner)?; - // This type can be represented as a `LocalType`, so check if we've // already written an instruction for it. If not, do so now, with // `write_type_declaration_local`.