Skip to content

Commit

Permalink
Remove channel_count_from_format function
Browse files Browse the repository at this point in the history
  • Loading branch information
asny committed May 7, 2021
1 parent 6ad90a0 commit 9e2aa10
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/core/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,13 @@ impl<T: TextureValueType> ColorTargetTexture2D<T> {
})?;
}

let channels = channel_count_from_format(self.format);
let channels = match self.format {
Format::R => 1,
Format::RGB => 3,
Format::SRGB => 3,
Format::RGBA => 4,
Format::SRGBA => 4,
};
let mut pixels = vec![T::default(); viewport.width * viewport.height * channels];
let render_target = RenderTarget::new_color(&self.context, &self)?;
render_target.bind(consts::DRAW_FRAMEBUFFER)?;
Expand Down Expand Up @@ -1024,16 +1030,6 @@ fn internal_format_from_depth(format: DepthFormat) -> u32 {
}
}

fn channel_count_from_format(format: Format) -> usize {
match format {
Format::R => 1,
Format::RGB => 3,
Format::SRGB => 3,
Format::RGBA => 4,
Format::SRGBA => 4,
}
}

fn format_from(format: Format) -> u32 {
match format {
Format::R => consts::RED,
Expand Down

0 comments on commit 9e2aa10

Please sign in to comment.