From 1c77f87b0fa8863b827d2f0e350565adb5c141a7 Mon Sep 17 00:00:00 2001 From: Trey Date: Mon, 15 Jun 2026 06:01:41 -0700 Subject: [PATCH] fix packSnorm2x16/packUnorm2x16 swap in naga GLSL frontend (#9675) --- CHANGELOG.md | 1 + naga/src/front/glsl/builtins.rs | 4 ++-- naga/tests/out/wgsl/glsl-bits.frag.wgsl | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed0469eb2..264a0a085 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -229,6 +229,7 @@ By @beholdnec in [#8505](https://github.com/gfx-rs/wgpu/pull/8505). - Added support for `enable wgpu_binding_array;`. By @39ali in [#9298](https://github.com/gfx-rs/wgpu/pull/9298). - Ability to disable integer division safety checks on Vulkan and Metal. By @kvark in [#9443](https://github.com/gfx-rs/wgpu/pull/9443). - \[hlsl\] more `matCx2` fixes. By @teoxoy in [#9507](https://github.com/gfx-rs/wgpu/pull/9507). +- Fix `packSnorm2x16` and `packUnorm2x16` swap in the GLSL frontend. By @treylutton in [#9675](https://github.com/gfx-rs/wgpu/pull/9675). #### Vulkan diff --git a/naga/src/front/glsl/builtins.rs b/naga/src/front/glsl/builtins.rs index d07ba9c12..a22a402d9 100644 --- a/naga/src/front/glsl/builtins.rs +++ b/naga/src/front/glsl/builtins.rs @@ -753,8 +753,8 @@ fn inject_standard_builtins( let fun = match name { "packSnorm4x8" => MathFunction::Pack4x8snorm, "packUnorm4x8" => MathFunction::Pack4x8unorm, - "packSnorm2x16" => MathFunction::Pack2x16unorm, - "packUnorm2x16" => MathFunction::Pack2x16snorm, + "packSnorm2x16" => MathFunction::Pack2x16snorm, + "packUnorm2x16" => MathFunction::Pack2x16unorm, "packHalf2x16" => MathFunction::Pack2x16float, _ => unreachable!(), }; diff --git a/naga/tests/out/wgsl/glsl-bits.frag.wgsl b/naga/tests/out/wgsl/glsl-bits.frag.wgsl index 50117a2a0..b72eac575 100644 --- a/naga/tests/out/wgsl/glsl-bits.frag.wgsl +++ b/naga/tests/out/wgsl/glsl-bits.frag.wgsl @@ -15,9 +15,9 @@ fn main_1() { let _e30 = f4_; u = pack4x8unorm(_e30); let _e32 = f2_; - u = pack2x16unorm(_e32); + u = pack2x16snorm(_e32); let _e34 = f2_; - u = pack2x16snorm(_e34); + u = pack2x16unorm(_e34); let _e36 = f2_; u = pack2x16float(_e36); let _e38 = u;