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 (bevyengine#5991)

# Objective

Currently some TextureFormats are not supported by the Image type.
The `TextureFormat::Rg16Unorm` format is useful for storing minmax heightmaps.
Similar to bevyengine#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 <[email protected]>
  • Loading branch information
2 people authored and james7132 committed Oct 28, 2022
1 parent 775bbc6 commit 2ab2d3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 2ab2d3e

Please sign in to comment.