Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RGBAF16 support #4858

Draft
wants to merge 1 commit into
base: 0.65
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading