diff --git a/CHANGELOG.md b/CHANGELOG.md index fb1bc4a0c..324ebd9f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,8 @@ By @wumpf in [#6069](https://github.com/gfx-rs/wgpu/pull/6069), [#6099](https:// ### Bug Fixes +- Fix incorrect hlsl image output type conversion. By @atlv24 in [#6123](https://github.com/gfx-rs/wgpu/pull/6123) + #### General - If GL context creation fails retry with GLES. By @Rapdorian in [#5996](https://github.com/gfx-rs/wgpu/pull/5996) diff --git a/naga/src/back/hlsl/conv.rs b/naga/src/back/hlsl/conv.rs index 6c0daf476..9df73b279 100644 --- a/naga/src/back/hlsl/conv.rs +++ b/naga/src/back/hlsl/conv.rs @@ -119,38 +119,29 @@ impl crate::TypeInner { impl crate::StorageFormat { pub(super) const fn to_hlsl_str(self) -> &'static str { match self { - Self::R16Float => "float", + Self::R16Float | Self::R32Float => "float", Self::R8Unorm | Self::R16Unorm => "unorm float", Self::R8Snorm | Self::R16Snorm => "snorm float", - Self::R8Uint | Self::R16Uint => "uint", - Self::R8Sint | Self::R16Sint => "int", + Self::R8Uint | Self::R16Uint | Self::R32Uint => "uint", + Self::R8Sint | Self::R16Sint | Self::R32Sint => "int", - Self::Rg16Float => "float2", + Self::Rg16Float | Self::Rg32Float => "float2", Self::Rg8Unorm | Self::Rg16Unorm => "unorm float2", Self::Rg8Snorm | Self::Rg16Snorm => "snorm float2", - Self::Rg8Sint | Self::Rg16Sint => "int2", - Self::Rg8Uint | Self::Rg16Uint => "uint2", + Self::Rg8Sint | Self::Rg16Sint | Self::Rg32Uint => "int2", + Self::Rg8Uint | Self::Rg16Uint | Self::Rg32Sint => "uint2", Self::Rg11b10UFloat => "float3", - Self::Rgba16Float | Self::R32Float | Self::Rg32Float | Self::Rgba32Float => "float4", + Self::Rgba16Float | Self::Rgba32Float => "float4", Self::Rgba8Unorm | Self::Bgra8Unorm | Self::Rgba16Unorm | Self::Rgb10a2Unorm => { "unorm float4" } Self::Rgba8Snorm | Self::Rgba16Snorm => "snorm float4", - Self::Rgba8Uint - | Self::Rgba16Uint - | Self::R32Uint - | Self::Rg32Uint - | Self::Rgba32Uint - | Self::Rgb10a2Uint => "uint4", - Self::Rgba8Sint - | Self::Rgba16Sint - | Self::R32Sint - | Self::Rg32Sint - | Self::Rgba32Sint => "int4", + Self::Rgba8Uint | Self::Rgba16Uint | Self::Rgba32Uint | Self::Rgb10a2Uint => "uint4", + Self::Rgba8Sint | Self::Rgba16Sint | Self::Rgba32Sint => "int4", } } } diff --git a/naga/tests/out/hlsl/image.hlsl b/naga/tests/out/hlsl/image.hlsl index 1b41aa56e..5ad6d3d2c 100644 --- a/naga/tests/out/hlsl/image.hlsl +++ b/naga/tests/out/hlsl/image.hlsl @@ -3,9 +3,9 @@ Texture2DMS image_multisampled_src : register(t3); Texture2DMS image_depth_multisampled_src : register(t4); RWTexture2D image_storage_src : register(u1); Texture2DArray image_array_src : register(t5); -RWTexture1D image_dup_src : register(u6); +RWTexture1D image_dup_src : register(u6); Texture1D image_1d_src : register(t7); -RWTexture1D image_dst : register(u2); +RWTexture1D image_dst : register(u2); Texture1D image_1d : register(t0); Texture2D image_2d : register(t1); Texture2D image_2d_u32_ : register(t2); diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index de64dfa12..6ec70e5fb 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -3384,7 +3384,7 @@ impl TextureFormat { Self::Bgra8UnormSrgb => (msaa_resolve, attachment), Self::Rgb10a2Uint => ( msaa, attachment), Self::Rgb10a2Unorm => (msaa_resolve, attachment), - Self::Rg11b10UFloat => ( msaa, rg11b10f), + Self::Rg11b10UFloat => ( msaa, rg11b10f), Self::Rg32Uint => ( noaa, all_flags), Self::Rg32Sint => ( noaa, all_flags), Self::Rg32Float => ( noaa, all_flags),