Add TextureFormat::Rg16Unorm support for Image and derive Resource for SpecializedComputePipelines (#5991)

# Objective

Currently some TextureFormats are not supported by the Image type.
The `TextureFormat::Rg16Unorm` format is useful for storing minmax heightmaps.
Similar to #5249 I now additionally require image to support the dual channel variant.

## Solution

Added `TextureFormat::Rg16Unorm` support to Image.

Additionally this PR derives `Resource` for `SpecializedComputePipelines`, because for some reason this was missing.
All other special pipelines do derive `Resource` already.


Co-authored-by: Kurt Kühnert <51823519+Ku95@users.noreply.github.com>
This commit is contained in:
Kurt Kühnert 2022-09-15 15:57:04 +00:00
parent 619c44f482
commit c256c38486
2 changed files with 4 additions and 1 deletions

View file

@ -49,6 +49,7 @@ pub trait SpecializedComputePipeline {
fn specialize(&self, key: Self::Key) -> ComputePipelineDescriptor; fn specialize(&self, key: Self::Key) -> ComputePipelineDescriptor;
} }
#[derive(Resource)]
pub struct SpecializedComputePipelines<S: SpecializedComputePipeline> { pub struct SpecializedComputePipelines<S: SpecializedComputePipeline> {
cache: HashMap<S::Key, CachedComputePipelineId>, cache: HashMap<S::Key, CachedComputePipelineId>,
} }

View file

@ -539,9 +539,10 @@ impl TextureFormatPixelInfo for TextureFormat {
TextureFormat::R16Uint TextureFormat::R16Uint
| TextureFormat::R16Sint | TextureFormat::R16Sint
| TextureFormat::R16Float | TextureFormat::R16Float
| TextureFormat::R16Unorm
| TextureFormat::Rg16Uint | TextureFormat::Rg16Uint
| TextureFormat::Rg16Sint | TextureFormat::Rg16Sint
| TextureFormat::R16Unorm | TextureFormat::Rg16Unorm
| TextureFormat::Rg16Float | TextureFormat::Rg16Float
| TextureFormat::Rgba16Uint | TextureFormat::Rgba16Uint
| TextureFormat::Rgba16Sint | TextureFormat::Rgba16Sint
@ -587,6 +588,7 @@ impl TextureFormatPixelInfo for TextureFormat {
| TextureFormat::Rg8Sint | TextureFormat::Rg8Sint
| TextureFormat::Rg16Uint | TextureFormat::Rg16Uint
| TextureFormat::Rg16Sint | TextureFormat::Rg16Sint
| TextureFormat::Rg16Unorm
| TextureFormat::Rg16Float | TextureFormat::Rg16Float
| TextureFormat::Rg32Uint | TextureFormat::Rg32Uint
| TextureFormat::Rg32Sint | TextureFormat::Rg32Sint