mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
webgl: Fix tidy
This commit is contained in:
parent
29ab55d076
commit
54b100b0f1
3 changed files with 25 additions and 15 deletions
|
@ -2855,8 +2855,7 @@ fn image_to_tex_image_data(
|
|||
pixels.truncate(pixel_count * 2);
|
||||
pixels
|
||||
},
|
||||
(TexFormat::RGBA, TexDataType::Float) |
|
||||
(TexFormat::RGBA32f, TexDataType::Float) => {
|
||||
(TexFormat::RGBA, TexDataType::Float) | (TexFormat::RGBA32f, TexDataType::Float) => {
|
||||
let mut rgbaf32 = Vec::<u8>::with_capacity(pixel_count * 16);
|
||||
for rgba8 in pixels.chunks(4) {
|
||||
rgbaf32.write_f32::<NativeEndian>(rgba8[0] as f32).unwrap();
|
||||
|
@ -2867,8 +2866,7 @@ fn image_to_tex_image_data(
|
|||
rgbaf32
|
||||
},
|
||||
|
||||
(TexFormat::RGB, TexDataType::Float) |
|
||||
(TexFormat::RGB32f, TexDataType::Float) => {
|
||||
(TexFormat::RGB, TexDataType::Float) | (TexFormat::RGB32f, TexDataType::Float) => {
|
||||
let mut rgbf32 = Vec::<u8>::with_capacity(pixel_count * 12);
|
||||
for rgba8 in pixels.chunks(4) {
|
||||
rgbf32.write_f32::<NativeEndian>(rgba8[0] as f32).unwrap();
|
||||
|
@ -2878,8 +2876,7 @@ fn image_to_tex_image_data(
|
|||
rgbf32
|
||||
},
|
||||
|
||||
(TexFormat::Alpha, TexDataType::Float) |
|
||||
(TexFormat::Alpha32f, TexDataType::Float) => {
|
||||
(TexFormat::Alpha, TexDataType::Float) | (TexFormat::Alpha32f, TexDataType::Float) => {
|
||||
for rgba8 in pixels.chunks_mut(4) {
|
||||
let p = rgba8[3] as f32;
|
||||
NativeEndian::write_f32(rgba8, p);
|
||||
|
@ -2926,8 +2923,7 @@ fn image_to_tex_image_data(
|
|||
rgbaf16
|
||||
},
|
||||
|
||||
(TexFormat::RGB, TexDataType::HalfFloat) |
|
||||
(TexFormat::RGB16f, TexDataType::HalfFloat) => {
|
||||
(TexFormat::RGB, TexDataType::HalfFloat) | (TexFormat::RGB16f, TexDataType::HalfFloat) => {
|
||||
let mut rgbf16 = Vec::<u8>::with_capacity(pixel_count * 6);
|
||||
for rgba8 in pixels.chunks(4) {
|
||||
rgbf16
|
||||
|
|
|
@ -1181,9 +1181,21 @@ impl TexFormat {
|
|||
TexDataType::Float,
|
||||
TexDataType::HalfFloat,
|
||||
][..],
|
||||
TexFormat::LuminanceAlpha => &[TexDataType::UnsignedByte, TexDataType::Float, TexDataType::HalfFloat][..],
|
||||
TexFormat::Luminance => &[TexDataType::UnsignedByte, TexDataType::Float, TexDataType::HalfFloat][..],
|
||||
TexFormat::Alpha => &[TexDataType::UnsignedByte, TexDataType::Float, TexDataType::HalfFloat][..],
|
||||
TexFormat::LuminanceAlpha => &[
|
||||
TexDataType::UnsignedByte,
|
||||
TexDataType::Float,
|
||||
TexDataType::HalfFloat,
|
||||
][..],
|
||||
TexFormat::Luminance => &[
|
||||
TexDataType::UnsignedByte,
|
||||
TexDataType::Float,
|
||||
TexDataType::HalfFloat,
|
||||
][..],
|
||||
TexFormat::Alpha => &[
|
||||
TexDataType::UnsignedByte,
|
||||
TexDataType::Float,
|
||||
TexDataType::HalfFloat,
|
||||
][..],
|
||||
TexFormat::LuminanceAlpha32f => &[TexDataType::Float][..],
|
||||
TexFormat::LuminanceAlpha16f => &[TexDataType::HalfFloat][..],
|
||||
TexFormat::Luminance32f => &[TexDataType::Float][..],
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use super::{
|
||||
constants as webgl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions,
|
||||
};
|
||||
use super::{constants as webgl, WebGLExtension, WebGLExtensionSpec, WebGLExtensions};
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
|
||||
|
@ -46,7 +44,11 @@ impl WebGLExtension for OESTextureFloat {
|
|||
ext.enable_tex_type(webgl::FLOAT);
|
||||
ext.add_effective_tex_internal_format(TexFormat::RGBA, webgl::FLOAT, TexFormat::RGBA32f);
|
||||
ext.add_effective_tex_internal_format(TexFormat::RGB, webgl::FLOAT, TexFormat::RGB32f);
|
||||
ext.add_effective_tex_internal_format(TexFormat::Luminance, webgl::FLOAT, TexFormat::Luminance32f);
|
||||
ext.add_effective_tex_internal_format(
|
||||
TexFormat::Luminance,
|
||||
webgl::FLOAT,
|
||||
TexFormat::Luminance32f,
|
||||
);
|
||||
ext.add_effective_tex_internal_format(TexFormat::Alpha, webgl::FLOAT, TexFormat::Alpha32f);
|
||||
ext.add_effective_tex_internal_format(
|
||||
TexFormat::LuminanceAlpha,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue