Bug 1658491 - Remove unused frame output functionality. r=kvark

This is unused by Gecko, and untested / unused in Servo. It was
only added as an initial prototype, and would need a more efficient
implementation if it was ever intended for production use.

Differential Revision: https://phabricator.services.mozilla.com/D86682
This commit is contained in:
Glenn Watson 2020-08-11 21:06:58 +00:00
parent e61827e4b0
commit 7c8c4f36e2
12 changed files with 21 additions and 474 deletions

View File

@ -88,12 +88,11 @@ pub trait Example {
) -> bool {
false
}
fn get_image_handlers(
fn get_image_handler(
&mut self,
_gl: &dyn gl::Gl,
) -> (Option<Box<dyn ExternalImageHandler>>,
Option<Box<dyn OutputImageHandler>>) {
(None, None)
) -> Option<Box<dyn ExternalImageHandler>> {
None
}
fn draw_custom(&mut self, _gl: &dyn gl::Gl) {
}
@ -188,11 +187,7 @@ pub fn main_wrapper<E: Example>(
let mut api = sender.create_api();
let document_id = api.add_document(device_size, 0);
let (external, output) = example.get_image_handlers(&*gl);
if let Some(output_image_handler) = output {
renderer.set_output_image_handler(output_image_handler);
}
let external = example.get_image_handler(&*gl);
if let Some(external_image_handler) = external {
renderer.set_external_image_handler(external_image_handler);

View File

@ -1,235 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
extern crate euclid;
extern crate gleam;
extern crate glutin;
extern crate webrender;
extern crate winit;
#[path = "common/boilerplate.rs"]
mod boilerplate;
use crate::boilerplate::{Example, HandyDandyRectBuilder};
use euclid::Scale;
use gleam::gl;
use webrender::api::*;
use webrender::api::units::*;
// This example demonstrates using the frame output feature to copy
// the output of a WR framebuffer to a custom texture.
#[derive(Debug)]
struct Document {
id: DocumentId,
pipeline_id: PipelineId,
content_rect: LayoutRect,
color: ColorF,
}
struct App {
external_image_key: Option<ImageKey>,
output_document: Option<Document>
}
struct OutputHandler {
texture_id: gl::GLuint
}
struct ExternalHandler {
texture_id: gl::GLuint
}
impl OutputImageHandler for OutputHandler {
fn lock(&mut self, _id: PipelineId) -> Option<(u32, FramebufferIntSize)> {
Some((self.texture_id, FramebufferIntSize::new(500, 500)))
}
fn unlock(&mut self, _id: PipelineId) {}
}
impl ExternalImageHandler for ExternalHandler {
fn lock(
&mut self,
_key: ExternalImageId,
_channel_index: u8,
_rendering: ImageRendering
) -> ExternalImage {
ExternalImage {
uv: TexelRect::new(0.0, 0.0, 1.0, 1.0),
source: ExternalImageSource::NativeTexture(self.texture_id),
}
}
fn unlock(&mut self, _key: ExternalImageId, _channel_index: u8) {}
}
impl App {
fn init_output_document(
&mut self,
api: &mut RenderApi,
device_size: DeviceIntSize,
device_pixel_ratio: f32,
) {
// Generate the external image key that will be used to render the output document to the root document.
self.external_image_key = Some(api.generate_image_key());
let pipeline_id = PipelineId(1, 0);
let layer = 1;
let color = ColorF::new(1., 1., 0., 1.);
let document_id = api.add_document(device_size, layer);
api.enable_frame_output(document_id, pipeline_id, true);
api.set_document_view(
document_id,
device_size.into(),
device_pixel_ratio,
);
let document = Document {
id: document_id,
pipeline_id,
content_rect: LayoutRect::new(
LayoutPoint::zero(),
device_size.to_f32() / Scale::new(device_pixel_ratio),
),
color,
};
let mut txn = Transaction::new();
txn.add_image(
self.external_image_key.unwrap(),
ImageDescriptor::new(100, 100, ImageFormat::BGRA8, ImageDescriptorFlags::IS_OPAQUE),
ImageData::External(ExternalImageData {
id: ExternalImageId(0),
channel_index: 0,
image_type: ExternalImageType::TextureHandle(TextureTarget::Default),
}),
None,
);
let space_and_clip = SpaceAndClipInfo::root_scroll(pipeline_id);
let mut builder = DisplayListBuilder::new(
document.pipeline_id,
);
builder.push_simple_stacking_context(
document.content_rect.origin,
space_and_clip.spatial_id,
PrimitiveFlags::IS_BACKFACE_VISIBLE,
);
builder.push_rect(
&CommonItemProperties::new(document.content_rect, space_and_clip),
document.content_rect,
ColorF::new(1.0, 1.0, 0.0, 1.0)
);
builder.pop_stacking_context();
txn.set_root_pipeline(pipeline_id);
txn.set_display_list(
Epoch(0),
Some(document.color),
document.content_rect.size,
builder.finalize(),
true,
);
txn.generate_frame();
api.send_transaction(document.id, txn);
self.output_document = Some(document);
}
}
impl Example for App {
fn render(
&mut self,
api: &mut RenderApi,
builder: &mut DisplayListBuilder,
_txn: &mut Transaction,
_device_size: DeviceIntSize,
pipeline_id: PipelineId,
_document_id: DocumentId,
) {
if self.output_document.is_none() {
self.init_output_document(api, DeviceIntSize::new(200, 200), 1.0);
}
let bounds = (100, 100).to(200, 200);
let space_and_clip = SpaceAndClipInfo::root_scroll(pipeline_id);
builder.push_simple_stacking_context(
bounds.origin,
space_and_clip.spatial_id,
PrimitiveFlags::IS_BACKFACE_VISIBLE,
);
builder.push_image(
&CommonItemProperties::new(bounds, space_and_clip),
bounds,
ImageRendering::Auto,
AlphaType::PremultipliedAlpha,
self.external_image_key.unwrap(),
ColorF::WHITE,
);
builder.pop_stacking_context();
}
fn get_image_handlers(
&mut self,
gl: &dyn gl::Gl,
) -> (Option<Box<dyn ExternalImageHandler>>,
Option<Box<dyn OutputImageHandler>>) {
let texture_id = gl.gen_textures(1)[0];
gl.bind_texture(gl::TEXTURE_2D, texture_id);
gl.tex_parameter_i(
gl::TEXTURE_2D,
gl::TEXTURE_MAG_FILTER,
gl::LINEAR as gl::GLint,
);
gl.tex_parameter_i(
gl::TEXTURE_2D,
gl::TEXTURE_MIN_FILTER,
gl::LINEAR as gl::GLint,
);
gl.tex_parameter_i(
gl::TEXTURE_2D,
gl::TEXTURE_WRAP_S,
gl::CLAMP_TO_EDGE as gl::GLint,
);
gl.tex_parameter_i(
gl::TEXTURE_2D,
gl::TEXTURE_WRAP_T,
gl::CLAMP_TO_EDGE as gl::GLint,
);
gl.tex_image_2d(
gl::TEXTURE_2D,
0,
gl::RGBA as gl::GLint,
100,
100,
0,
gl::BGRA,
gl::UNSIGNED_BYTE,
None,
);
gl.bind_texture(gl::TEXTURE_2D, 0);
(
Some(Box::new(ExternalHandler { texture_id })),
Some(Box::new(OutputHandler { texture_id }))
)
}
}
fn main() {
let mut app = App {
external_image_key: None,
output_document: None
};
boilerplate::main_wrapper(&mut app, None);
}

View File

@ -301,12 +301,11 @@ impl Example for App {
false
}
fn get_image_handlers(
fn get_image_handler(
&mut self,
_gl: &dyn gl::Gl,
) -> (Option<Box<dyn ExternalImageHandler>>,
Option<Box<dyn OutputImageHandler>>) {
(Some(Box::new(ImageGenerator::new())), None)
) -> Option<Box<dyn ExternalImageHandler>> {
Some(Box::new(ImageGenerator::new()))
}
}

View File

@ -195,14 +195,13 @@ impl Example for App {
false
}
fn get_image_handlers(
fn get_image_handler(
&mut self,
gl: &dyn gl::Gl,
) -> (Option<Box<dyn ExternalImageHandler>>,
Option<Box<dyn OutputImageHandler>>) {
) -> Option<Box<dyn ExternalImageHandler>> {
let provider = YuvImageProvider::new(gl);
self.texture_id = provider.texture_ids[0];
(Some(Box::new(provider)), None)
Some(Box::new(provider))
}
fn draw_custom(&mut self, gl: &dyn gl::Gl) {

View File

@ -94,7 +94,7 @@
//! blend the overlay tile (this is not always optimal right now, but will be
//! improved as a follow up).
use api::{MixBlendMode, PipelineId, PremultipliedColorF, FilterPrimitiveKind};
use api::{MixBlendMode, PremultipliedColorF, FilterPrimitiveKind};
use api::{PropertyBinding, PropertyBindingId, FilterPrimitive};
use api::{DebugFlags, RasterSpace, ImageKey, ColorF, ColorU, PrimitiveFlags};
use api::{ImageRendering, ColorDepth, YuvColorSpace, YuvFormat};
@ -4594,10 +4594,6 @@ pub struct PicturePrimitive {
pub raster_config: Option<RasterConfig>,
pub context_3d: Picture3DContext<OrderedPictureChild>,
// If requested as a frame output (for rendering
// pages to a texture), this is the pipeline this
// picture is the root of.
pub frame_output_pipeline_id: Option<PipelineId>,
// Optional cache handles for storing extra data
// in the GPU cache, depending on the type of
// picture.
@ -4723,7 +4719,6 @@ impl PicturePrimitive {
pub fn new_image(
requested_composite_mode: Option<PictureCompositeMode>,
context_3d: Picture3DContext<OrderedPictureChild>,
frame_output_pipeline_id: Option<PipelineId>,
apply_local_clip_rect: bool,
flags: PrimitiveFlags,
requested_raster_space: RasterSpace,
@ -4738,7 +4733,6 @@ impl PicturePrimitive {
requested_composite_mode,
raster_config: None,
context_3d,
frame_output_pipeline_id,
extra_gpu_data_handles: SmallVec::new(),
apply_local_clip_rect,
is_backface_visible: flags.contains(PrimitiveFlags::IS_BACKFACE_VISIBLE),

View File

@ -4,7 +4,7 @@
use api::units::*;
use api::{ColorF, PremultipliedColorF, ImageFormat, LineOrientation, BorderStyle, PipelineId};
use api::{ColorF, PremultipliedColorF, ImageFormat, LineOrientation, BorderStyle};
use crate::batch::{AlphaBatchBuilder, AlphaBatchContainer, BatchTextures, resolve_image};
use crate::batch::{ClipBatcher, BatchBuilder};
use crate::spatial_tree::{SpatialTree, ROOT_SPATIAL_NODE_INDEX};
@ -299,8 +299,6 @@ pub struct ColorRenderTarget {
pub scalings: FastHashMap<TextureSource, Vec<ScalingInstance>>,
pub svg_filters: Vec<(BatchTextures, Vec<SvgFilterInstance>)>,
pub blits: Vec<BlitJob>,
// List of frame buffer outputs for this render target.
pub outputs: Vec<FrameOutput>,
alpha_tasks: Vec<RenderTaskId>,
screen_size: DeviceIntSize,
// Track the used rect of the render target, so that
@ -322,7 +320,6 @@ impl RenderTarget for ColorRenderTarget {
scalings: FastHashMap::default(),
svg_filters: Vec::new(),
blits: Vec::new(),
outputs: Vec::new(),
alpha_tasks: Vec::new(),
screen_size,
used_rect: DeviceIntRect::zero(),
@ -476,18 +473,8 @@ impl RenderTarget for ColorRenderTarget {
render_tasks.get_task_address(task.children[0]),
);
}
RenderTaskKind::Picture(ref task_info) => {
let pic = &ctx.prim_store.pictures[task_info.pic_index.0];
RenderTaskKind::Picture(..) => {
self.alpha_tasks.push(task_id);
// If this pipeline is registered as a frame output
// store the information necessary to do the copy.
if let Some(pipeline_id) = pic.frame_output_pipeline_id {
self.outputs.push(FrameOutput {
pipeline_id,
task_id,
});
}
}
RenderTaskKind::SvgFilter(ref task_info) => {
add_svg_filter_instances(
@ -1093,14 +1080,3 @@ pub struct GradientJob {
pub axis_select: f32,
pub start_stop: [f32; 2],
}
/// Frame output information for a given pipeline ID.
/// Storing the task ID allows the renderer to find
/// the target rect within the render target that this
/// pipeline exists at.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
pub struct FrameOutput {
pub task_id: RenderTaskId,
pub pipeline_id: PipelineId,
}

View File

@ -37,7 +37,7 @@
use api::{ApiMsg, BlobImageHandler, ColorF, ColorU, MixBlendMode};
use api::{DocumentId, Epoch, ExternalImageHandler, ExternalImageId};
use api::{ExternalImageSource, ExternalImageType, FontRenderMode, FrameMsg, ImageFormat};
use api::{PipelineId, ImageRendering, Checkpoint, NotificationRequest, OutputImageHandler};
use api::{PipelineId, ImageRendering, Checkpoint, NotificationRequest};
use api::{DebugCommand, MemoryReport, VoidPtrToSizeFn, PremultipliedColorF};
use api::{RenderApiSender, RenderNotifier, TextureTarget, SharedFontInstanceMap};
#[cfg(feature = "replay")]
@ -56,11 +56,13 @@ use crate::c_str;
use crate::debug_colors;
use crate::debug_render::{DebugItem, DebugRenderer};
use crate::device::{DepthFunction, Device, GpuFrameId, Program, UploadMethod, Texture, PBO};
use crate::device::{DrawTarget, ExternalTexture, FBOId, ReadTarget, TextureSlot};
use crate::device::{DrawTarget, ExternalTexture, ReadTarget, TextureSlot};
use crate::device::{ShaderError, TextureFilter, TextureFlags,
VertexUsageHint, VAO, VBO, CustomVAO};
use crate::device::ProgramCache;
use crate::device::query::GpuTimer;
#[cfg(feature = "capture")]
use crate::device::FBOId;
use euclid::{rect, Transform3D, Scale, default};
use crate::frame_builder::{Frame, ChasePrimitive, FrameBuilderConfig};
use gleam::gl;
@ -101,6 +103,7 @@ use crate::util::drain_filter;
use std;
use std::cmp;
use std::collections::VecDeque;
#[cfg(any(feature = "capture", feature = "replay"))]
use std::collections::hash_map::Entry;
use std::f32;
use std::marker::PhantomData;
@ -1848,11 +1851,6 @@ impl<T> VertexDataTexture<T> {
}
}
struct FrameOutput {
last_access: GpuFrameId,
fbo_id: FBOId,
}
#[derive(PartialEq)]
struct TargetSelector {
size: DeviceIntSize,
@ -2090,18 +2088,10 @@ pub struct Renderer {
/// application to provide external buffers for image data.
external_image_handler: Option<Box<dyn ExternalImageHandler>>,
/// Optional trait object that allows the client
/// application to provide a texture handle to
/// copy the WR output to.
output_image_handler: Option<Box<dyn OutputImageHandler>>,
/// Optional function pointers for measuring memory used by a given
/// heap-allocated pointer.
size_of_ops: Option<MallocSizeOfOps>,
// Currently allocated FBOs for output frames.
output_targets: FastHashMap<u32, FrameOutput>,
pub renderer_errors: Vec<RendererError>,
pub(in crate) async_frame_recorder: Option<AsyncScreenshotGrabber>,
@ -2705,9 +2695,7 @@ impl Renderer {
pipeline_info: PipelineInfo::default(),
dither_matrix_texture,
external_image_handler: None,
output_image_handler: None,
size_of_ops: make_size_of_ops(),
output_targets: FastHashMap::default(),
cpu_profiles: VecDeque::new(),
gpu_profiles: VecDeque::new(),
gpu_cache_texture,
@ -3232,11 +3220,6 @@ impl Renderer {
self.external_image_handler = Some(handler);
}
/// Set a callback for handling external outputs.
pub fn set_output_image_handler(&mut self, handler: Box<dyn OutputImageHandler>) {
self.output_image_handler = Some(handler);
}
/// Retrieve (and clear) the current list of recorded frame profiles.
pub fn get_frame_profiles(&mut self) -> (Vec<CpuProfile>, Vec<GpuProfile>) {
let cpu_profiles = self.cpu_profiles.drain(..).collect();
@ -3519,7 +3502,6 @@ impl Renderer {
self.draw_frame(
frame,
device_size,
cpu_frame_id,
&mut results,
doc_index == 0,
);
@ -5122,7 +5104,6 @@ impl Renderer {
clear_depth: Option<f32>,
render_tasks: &RenderTaskGraph,
projection: &default::Transform3D<f32>,
frame_id: GpuFrameId,
stats: &mut RendererStats,
) {
profile_scope!("draw_color_target");
@ -5254,49 +5235,6 @@ impl Renderer {
stats,
);
}
// For any registered image outputs on this render target,
// get the texture from caller and blit it.
for output in &target.outputs {
let handler = self.output_image_handler
.as_mut()
.expect("Found output image, but no handler set!");
if let Some((texture_id, output_size)) = handler.lock(output.pipeline_id) {
let fbo_id = match self.output_targets.entry(texture_id) {
Entry::Vacant(entry) => {
let fbo_id = self.device.create_fbo_for_external_texture(texture_id);
entry.insert(FrameOutput {
fbo_id,
last_access: frame_id,
});
fbo_id
}
Entry::Occupied(mut entry) => {
let target = entry.get_mut();
target.last_access = frame_id;
target.fbo_id
}
};
let (src_rect, _) = render_tasks[output.task_id].get_target_rect();
if !self.device.surface_origin_is_top_left() {
self.device.blit_render_target_invert_y(
draw_target.into(),
draw_target.to_framebuffer_rect(src_rect.translate(-content_origin.to_vector())),
DrawTarget::External { fbo: fbo_id, size: output_size },
output_size.into(),
);
} else {
self.device.blit_render_target(
draw_target.into(),
draw_target.to_framebuffer_rect(src_rect.translate(-content_origin.to_vector())),
DrawTarget::External { fbo: fbo_id, size: output_size },
output_size.into(),
TextureFilter::Linear,
);
}
handler.unlock(output.pipeline_id);
}
}
}
/// Draw all the instances in a clip batcher list to the current target.
@ -5938,7 +5876,6 @@ impl Renderer {
&mut self,
frame: &mut Frame,
device_size: Option<DeviceIntSize>,
frame_id: GpuFrameId,
results: &mut RenderResults,
clear_framebuffer: bool,
) {
@ -6103,7 +6040,6 @@ impl Renderer {
None,
&frame.render_tasks,
&projection,
frame_id,
&mut results.stats,
);
}
@ -6267,7 +6203,6 @@ impl Renderer {
clear_depth,
&frame.render_tasks,
&projection,
frame_id,
&mut results.stats,
);
}
@ -6299,16 +6234,6 @@ impl Renderer {
}
self.draw_epoch_debug();
// Garbage collect any frame outputs that weren't used this frame.
let device = &mut self.device;
self.output_targets
.retain(|_, target| if target.last_access != frame_id {
device.delete_fbo(target.fbo_id);
false
} else {
true
});
frame.has_been_rendered = true;
}
@ -6829,9 +6754,6 @@ impl Renderer {
self.debug.deinit(&mut self.device);
for (_, target) in self.output_targets {
self.device.delete_fbo(target.fbo_id);
}
if let Ok(shaders) = Rc::try_unwrap(self.shaders) {
shaders.into_inner().deinit(&mut self.device);
}
@ -7294,19 +7216,6 @@ impl ExternalImageHandler for DummyExternalImageHandler {
fn unlock(&mut self, _key: ExternalImageId, _channel_index: u8) {}
}
#[cfg(feature = "replay")]
struct VoidHandler;
#[cfg(feature = "replay")]
impl OutputImageHandler for VoidHandler {
fn lock(&mut self, _: PipelineId) -> Option<(u32, FramebufferIntSize)> {
None
}
fn unlock(&mut self, _: PipelineId) {
unreachable!()
}
}
#[derive(Default)]
pub struct PipelineInfo {
pub epochs: FastHashMap<(PipelineId, DocumentId), Epoch>,
@ -7693,7 +7602,6 @@ impl Renderer {
self.device.end_frame();
}
self.output_image_handler = Some(Box::new(VoidHandler) as Box<_>);
self.external_image_handler = Some(Box::new(image_handler) as Box<_>);
info!("done.");
}

View File

@ -218,9 +218,6 @@ struct Document {
interners: Interners,
stats: SceneStats,
view: SceneView,
/// A set of pipelines that the caller has requested be
/// made available as output textures.
output_pipelines: FastHashSet<PipelineId>,
}
impl Document {
@ -229,7 +226,6 @@ impl Document {
scene: Scene::new(),
interners: Interners::default(),
stats: SceneStats::empty(),
output_pipelines: FastHashSet::default(),
view: SceneView {
device_rect,
layer,
@ -457,14 +453,11 @@ impl SceneBuilderThread {
let mut built_scene = None;
let mut interner_updates = None;
let output_pipelines = FastHashSet::default();
if item.scene.has_root_pipeline() {
built_scene = Some(SceneBuilder::build(
&item.scene,
item.font_instances,
&item.view,
&output_pipelines,
&self.config,
&mut item.interners,
&SceneStats::empty(),
@ -482,7 +475,6 @@ impl SceneBuilderThread {
interners: item.interners,
stats: SceneStats::empty(),
view: item.view.clone(),
output_pipelines,
},
);
@ -688,13 +680,6 @@ impl SceneBuilderThread {
self.removed_pipelines.insert(pipeline_id);
removed_pipelines.push((pipeline_id, txn.document_id));
}
SceneMsg::EnableFrameOutput(pipeline_id, enable) => {
if enable {
doc.output_pipelines.insert(pipeline_id);
} else {
doc.output_pipelines.remove(&pipeline_id);
}
}
}
}
@ -708,7 +693,6 @@ impl SceneBuilderThread {
&scene,
self.font_instances.clone(),
&doc.view,
&doc.output_pipelines,
&self.config,
&mut doc.interners,
&doc.stats,

View File

@ -21,7 +21,7 @@ use crate::frame_builder::{ChasePrimitive, FrameBuilderConfig};
use crate::glyph_rasterizer::FontInstance;
use crate::hit_test::{HitTestingItem, HitTestingScene};
use crate::intern::Interner;
use crate::internal_types::{FastHashMap, FastHashSet, LayoutPrimitiveInfo, Filter};
use crate::internal_types::{FastHashMap, LayoutPrimitiveInfo, Filter};
use crate::picture::{Picture3DContext, PictureCompositeMode, PicturePrimitive, PictureOptions};
use crate::picture::{BlitReason, OrderedPictureChild, PrimitiveList};
use crate::prim_store::{PrimitiveInstance, register_prim_chase_id};
@ -223,10 +223,6 @@ pub struct SceneBuilder<'a> {
/// The map of all font instances.
font_instances: SharedFontInstanceMap,
/// A set of pipelines that the caller has requested be made available as
/// output textures.
output_pipelines: &'a FastHashSet<PipelineId>,
/// The data structure that converts between ClipId/SpatialId and the various
/// index types that the SpatialTree uses.
id_to_index_mapper: NodeIdToIndexMapper,
@ -288,7 +284,6 @@ impl<'a> SceneBuilder<'a> {
scene: &Scene,
font_instances: SharedFontInstanceMap,
view: &SceneView,
output_pipelines: &FastHashSet<PipelineId>,
frame_builder_config: &FrameBuilderConfig,
interners: &mut Interners,
stats: &SceneStats,
@ -316,7 +311,6 @@ impl<'a> SceneBuilder<'a> {
spatial_tree,
font_instances,
config: *frame_builder_config,
output_pipelines,
id_to_index_mapper: NodeIdToIndexMapper::default(),
hit_testing_scene: HitTestingScene::new(&stats.hit_test_stats),
pending_shadow_items: VecDeque::new(),
@ -348,7 +342,6 @@ impl<'a> SceneBuilder<'a> {
.init(PicturePrimitive::new_image(
None,
Picture3DContext::Out,
None,
true,
PrimitiveFlags::IS_BACKFACE_VISIBLE,
RasterSpace::Screen,
@ -452,7 +445,6 @@ impl<'a> SceneBuilder<'a> {
);
let sc_info = self.push_stacking_context(
bc.pipeline_id,
composition_operations,
info.stacking_context.transform_style,
info.prim_flags,
@ -1532,7 +1524,6 @@ impl<'a> SceneBuilder<'a> {
/// Push a new stacking context. Returns context that must be passed to pop_stacking_context().
fn push_stacking_context(
&mut self,
pipeline_id: PipelineId,
composite_ops: CompositeOps,
transform_style: TransformStyle,
prim_flags: PrimitiveFlags,
@ -1543,16 +1534,6 @@ impl<'a> SceneBuilder<'a> {
) -> StackingContextInfo {
profile_scope!("push_stacking_context");
// Check if this stacking context is the root of a pipeline, and the caller
// has requested it as an output frame.
let is_pipeline_root =
self.sc_stack.last().map_or(true, |sc| sc.pipeline_id != pipeline_id);
let frame_output_pipeline_id = if is_pipeline_root && self.output_pipelines.contains(&pipeline_id) {
Some(pipeline_id)
} else {
None
};
let clip_chain_id = match clip_id {
Some(clip_id) => self.clip_store.get_or_build_clip_chain_id(clip_id),
None => ClipChainId::NONE,
@ -1699,12 +1680,10 @@ impl<'a> SceneBuilder<'a> {
// pop_stacking_context.
self.sc_stack.push(FlattenedStackingContext {
prim_list: PrimitiveList::empty(),
pipeline_id,
prim_flags,
requested_raster_space,
spatial_node_index,
clip_chain_id,
frame_output_pipeline_id,
composite_ops,
blit_reason,
transform_style,
@ -1748,7 +1727,7 @@ impl<'a> SceneBuilder<'a> {
None => true,
};
let (leaf_context_3d, leaf_composite_mode, leaf_output_pipeline_id) = match stacking_context.context_3d {
let (leaf_context_3d, leaf_composite_mode) = match stacking_context.context_3d {
// TODO(gw): For now, as soon as this picture is in
// a 3D context, we draw it to an intermediate
// surface and apply plane splitting. However,
@ -1759,7 +1738,6 @@ impl<'a> SceneBuilder<'a> {
Picture3DContext::In { ancestor_index, .. } => (
Picture3DContext::In { root_data: None, ancestor_index },
Some(PictureCompositeMode::Blit(BlitReason::PRESERVE3D | stacking_context.blit_reason)),
None,
),
Picture3DContext::Out => (
Picture3DContext::Out,
@ -1771,7 +1749,6 @@ impl<'a> SceneBuilder<'a> {
// Add a dummy composite filter if the SC has to be isolated.
Some(PictureCompositeMode::Blit(stacking_context.blit_reason))
},
stacking_context.frame_output_pipeline_id
),
};
@ -1781,7 +1758,6 @@ impl<'a> SceneBuilder<'a> {
.init(PicturePrimitive::new_image(
leaf_composite_mode.clone(),
leaf_context_3d,
leaf_output_pipeline_id,
true,
stacking_context.prim_flags,
stacking_context.requested_raster_space,
@ -1835,7 +1811,6 @@ impl<'a> SceneBuilder<'a> {
root_data: Some(Vec::new()),
ancestor_index,
},
stacking_context.frame_output_pipeline_id,
true,
stacking_context.prim_flags,
stacking_context.requested_raster_space,
@ -1902,7 +1877,6 @@ impl<'a> SceneBuilder<'a> {
.init(PicturePrimitive::new_image(
composite_mode.clone(),
Picture3DContext::Out,
None,
true,
stacking_context.prim_flags,
stacking_context.requested_raster_space,
@ -2372,7 +2346,6 @@ impl<'a> SceneBuilder<'a> {
.init(PicturePrimitive::new_image(
composite_mode,
Picture3DContext::Out,
None,
is_passthrough,
PrimitiveFlags::IS_BACKFACE_VISIBLE,
raster_space,
@ -3116,7 +3089,6 @@ impl<'a> SceneBuilder<'a> {
.init(PicturePrimitive::new_image(
composite_mode.clone(),
Picture3DContext::Out,
None,
true,
prim_flags,
requested_raster_space,
@ -3306,7 +3278,6 @@ impl<'a> SceneBuilder<'a> {
.init(PicturePrimitive::new_image(
composite_mode.clone(),
Picture3DContext::Out,
None,
true,
flags,
requested_raster_space,
@ -3371,7 +3342,6 @@ impl<'a> SceneBuilder<'a> {
.init(PicturePrimitive::new_image(
Some(composite_mode.clone()),
Picture3DContext::Out,
None,
true,
flags,
requested_raster_space,
@ -3448,10 +3418,6 @@ struct FlattenedStackingContext {
/// The clip chain for this stacking context
clip_chain_id: ClipChainId,
/// If set, this should be provided to caller
/// as an output texture.
frame_output_pipeline_id: Option<PipelineId>,
/// The list of filters / mix-blend-mode for this
/// stacking context.
composite_ops: CompositeOps,
@ -3460,9 +3426,6 @@ struct FlattenedStackingContext {
/// be an offscreen surface.
blit_reason: BlitReason,
/// Pipeline this stacking context belongs to.
pipeline_id: PipelineId,
/// CSS transform-style property.
transform_style: TransformStyle,
@ -3572,7 +3535,6 @@ impl FlattenedStackingContext {
.init(PicturePrimitive::new_image(
composite_mode.clone(),
flat_items_context_3d,
None,
true,
self.prim_flags,
self.requested_raster_space,

View File

@ -421,7 +421,6 @@ fn create_tile_cache(
let pic_index = prim_store.pictures.alloc().init(PicturePrimitive::new_image(
Some(PictureCompositeMode::TileCache { slice_id }),
Picture3DContext::Out,
None,
true,
PrimitiveFlags::IS_BACKFACE_VISIBLE,
RasterSpace::Screen,

View File

@ -307,12 +307,6 @@ impl Transaction {
);
}
/// Enable copying of the output of this pipeline id to
/// an external texture for callers to consume.
pub fn enable_frame_output(&mut self, pipeline_id: PipelineId, enable: bool) {
self.scene_ops.push(SceneMsg::EnableFrameOutput(pipeline_id, enable));
}
/// Scrolls the scrolling layer under the `cursor`
///
/// WebRender looks for the layer closest to the user
@ -799,8 +793,6 @@ pub enum SceneMsg {
///
RemovePipeline(PipelineId),
///
EnableFrameOutput(PipelineId, bool),
///
SetDisplayList {
///
display_list: BuiltDisplayList,
@ -862,7 +854,6 @@ impl fmt::Debug for SceneMsg {
SceneMsg::SetDisplayList { .. } => "SceneMsg::SetDisplayList",
SceneMsg::SetPageZoom(..) => "SceneMsg::SetPageZoom",
SceneMsg::RemovePipeline(..) => "SceneMsg::RemovePipeline",
SceneMsg::EnableFrameOutput(..) => "SceneMsg::EnableFrameOutput",
SceneMsg::SetDocumentView { .. } => "SceneMsg::SetDocumentView",
SceneMsg::SetRootPipeline(..) => "SceneMsg::SetRootPipeline",
SceneMsg::SetQualitySettings { .. } => "SceneMsg::SetQualitySettings",
@ -1727,21 +1718,6 @@ impl RenderApi {
);
}
/// Setup the output region in the framebuffer for a given document.
/// Enable copying of the output of this pipeline id to
/// an external texture for callers to consume.
pub fn enable_frame_output(
&self,
document_id: DocumentId,
pipeline_id: PipelineId,
enable: bool,
) {
self.send_scene_msg(
document_id,
SceneMsg::EnableFrameOutput(pipeline_id, enable),
);
}
///
pub fn get_scroll_node_state(&self, document_id: DocumentId) -> Vec<ScrollNodeState> {
let (tx, rx) = single_msg_channel();

View File

@ -9,7 +9,7 @@ use peek_poke::PeekPoke;
use std::ops::{Add, Sub};
use std::sync::Arc;
// local imports
use crate::api::{IdNamespace, PipelineId, TileSize};
use crate::api::{IdNamespace, TileSize};
use crate::display_item::ImageRendering;
use crate::font::{FontInstanceKey, FontInstanceData, FontKey, FontTemplate};
use crate::units::*;
@ -100,16 +100,6 @@ pub trait ExternalImageHandler {
fn unlock(&mut self, key: ExternalImageId, channel_index: u8);
}
/// Allows callers to receive a texture with the contents of a specific
/// pipeline copied to it.
pub trait OutputImageHandler {
/// Return the native texture handle and the size of the texture.
fn lock(&mut self, pipeline_id: PipelineId) -> Option<(u32, FramebufferIntSize)>;
/// Unlock will only be called if the lock() call succeeds, when WR has issued
/// the GL commands to copy the output to the texture handle.
fn unlock(&mut self, pipeline_id: PipelineId);
}
/// Specifies the type of texture target in driver terms.
#[repr(u8)]
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]