Skip to content

Commit

Permalink
Add ImageFormat::RGBAF16
Browse files Browse the repository at this point in the history
Signed-off-by: Samson <[email protected]>
  • Loading branch information
sagudev committed Sep 24, 2024
1 parent 8468e81 commit 6ab2701
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions webrender/src/device/gl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4113,6 +4113,12 @@ impl Device {
read: gl::RG,
pixel_type: gl::UNSIGNED_SHORT,
},
ImageFormat::RGBAF16 => FormatDesc {
internal: gl::RGBA16F,
external: gl::RGBA,
read: gl::RGBA,
pixel_type: gl::HALF_FLOAT,
},
}
}

Expand Down Expand Up @@ -4754,6 +4760,7 @@ impl<'a> TextureUploader<'a> {
ImageFormat::RG16 => (gl::RG, 4, gl::UNSIGNED_SHORT),
ImageFormat::RGBAF32 => (gl::RGBA, 16, gl::FLOAT),
ImageFormat::RGBAI32 => (gl::RGBA_INTEGER, 16, gl::INT),
ImageFormat::RGBAF16 => (gl::RGBA, 8, gl::HALF_FLOAT),
};

let row_length = match chunk.stride {
Expand Down
4 changes: 4 additions & 0 deletions webrender_api/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ pub enum ImageFormat {
RGBAI32 = 7,
/// Four channels, byte storage.
RGBA8 = 8,

/// Four channels, float16 storage.
RGBAF16 = 9,
}

impl ImageFormat {
Expand All @@ -185,6 +188,7 @@ impl ImageFormat {
ImageFormat::RG16 => 4,
ImageFormat::RGBAI32 => 16,
ImageFormat::RGBA8 => 4,
ImageFormat::RGBAF16 => 8,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions wrench/src/yaml_frame_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ fn is_image_opaque(format: ImageFormat, bytes: &[u8]) -> bool {
ImageFormat::RG16 => true,
ImageFormat::R8 => false,
ImageFormat::R16 => false,
ImageFormat::RGBAF16 |
ImageFormat::RGBAF32 |
ImageFormat::RGBAI32 => unreachable!(),
}
Expand Down

0 comments on commit 6ab2701

Please sign in to comment.