tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 615bbf309838c1b6cf66796f1d6f4bce450f7815
parent 0ca69d4f07297d74741d096c3745c82b448db32f
Author: Nicolas Silva <nical@fastmail.com>
Date:   Tue,  9 Dec 2025 08:19:05 +0000

Bug 2000393 - Add YuvPrimitive. r=gw

Differential Revision: https://phabricator.services.mozilla.com/D272812

Diffstat:
Mgfx/wr/webrender/src/gpu_types.rs | 18++++++++++++++++++
Mgfx/wr/webrender/src/prim_store/image.rs | 15++++++---------
2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/gfx/wr/webrender/src/gpu_types.rs b/gfx/wr/webrender/src/gpu_types.rs @@ -1132,6 +1132,24 @@ impl GpuBufferDataF for BrushSegmentGpuData { } } +/// Matches YuvPrimitive in yuv.glsl +pub struct YuvPrimitive { + pub channel_bit_depth: u32, + pub color_space: YuvRangedColorSpace, + pub yuv_format: YuvFormat, +} + +impl GpuBufferDataF for YuvPrimitive { + const NUM_BLOCKS: usize = 1; + fn write(&self, writer: &mut GpuBufferWriterF) { + writer.push_one([ + pack_as_float(self.channel_bit_depth), + pack_as_float(self.color_space as u32), + pack_as_float(self.yuv_format as u32), + 0.0 + ]); + } +} // Set the local -> world transform for a given spatial // node in the transform palette. diff --git a/gfx/wr/webrender/src/prim_store/image.rs b/gfx/wr/webrender/src/prim_store/image.rs @@ -10,7 +10,7 @@ use api::{ use api::units::*; use euclid::point2; use crate::composite::CompositorSurfaceKind; -use crate::gpu_types::ImageBrushPrimitiveData; +use crate::gpu_types::{ImageBrushPrimitiveData, YuvPrimitive}; use crate::renderer::{GpuBufferBuilderF, GpuBufferWriterF}; use crate::scene_building::{CreateShadow, IsVisible}; use crate::frame_builder::{FrameBuildingContext, FrameBuildingState}; @@ -29,7 +29,6 @@ use crate::render_task_cache::{ RenderTaskCacheKey, RenderTaskCacheKeyKind, RenderTaskParent }; use crate::resource_cache::{ImageRequest, ImageProperties, ResourceCache}; -use crate::util::pack_as_float; use crate::visibility::{PrimitiveVisibility, compute_conservative_visible_rect}; use crate::spatial_tree::SpatialNodeIndex; use crate::image_tiling; @@ -711,13 +710,11 @@ impl YuvImageData { } pub fn write_prim_gpu_blocks(&self, writer: &mut GpuBufferWriterF) { - let ranged_color_space = self.color_space.with_range(self.color_range); - writer.push_one([ - pack_as_float(self.color_depth.bit_depth()), - pack_as_float(ranged_color_space as u32), - pack_as_float(self.format as u32), - 0.0 - ]); + writer.push(&YuvPrimitive { + channel_bit_depth: self.color_depth.bit_depth(), + color_space: self.color_space.with_range(self.color_range), + yuv_format: self.format, + }); } }