Skip to content

Commit

Permalink
Add TextureFormat::Rg16Unorm support for Image and derive Resource fo…
Browse files Browse the repository at this point in the history
…r 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>
  • Loading branch information
kurtkuehnert and kurtkuehnert committed Sep 15, 2022
1 parent 619c44f commit c256c38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -49,6 +49,7 @@ pub trait SpecializedComputePipeline {
fn specialize(&self, key: Self::Key) -> ComputePipelineDescriptor;
}

#[derive(Resource)]
pub struct SpecializedComputePipelines<S: SpecializedComputePipeline> {
cache: HashMap<S::Key, CachedComputePipelineId>,
}
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_render/src/texture/image.rs
Expand Up @@ -539,9 +539,10 @@ impl TextureFormatPixelInfo for TextureFormat {
TextureFormat::R16Uint
| TextureFormat::R16Sint
| TextureFormat::R16Float
| TextureFormat::R16Unorm
| TextureFormat::Rg16Uint
| TextureFormat::Rg16Sint
| TextureFormat::R16Unorm
| TextureFormat::Rg16Unorm
| TextureFormat::Rg16Float
| TextureFormat::Rgba16Uint
| TextureFormat::Rgba16Sint
Expand Down Expand Up @@ -587,6 +588,7 @@ impl TextureFormatPixelInfo for TextureFormat {
| TextureFormat::Rg8Sint
| TextureFormat::Rg16Uint
| TextureFormat::Rg16Sint
| TextureFormat::Rg16Unorm
| TextureFormat::Rg16Float
| TextureFormat::Rg32Uint
| TextureFormat::Rg32Sint
Expand Down

0 comments on commit c256c38

Please sign in to comment.