mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Backed out 6 changesets (bug 1921980) for causing wrench bustages. CLOSED TREE
Backed out changeset d519011c078b (bug 1921980) Backed out changeset 46b1ed75bb19 (bug 1921980) Backed out changeset b14169d1c137 (bug 1921980) Backed out changeset 877f329b665d (bug 1921980) Backed out changeset bb7a2635293a (bug 1921980) Backed out changeset 1fcd83380d56 (bug 1921980)
This commit is contained in:
parent
fcda2befe7
commit
d337c98ae6
@ -1059,14 +1059,6 @@ void TransactionBuilder::DeleteBlobImage(BlobImageKey aKey) {
|
||||
wr_resource_updates_delete_blob_image(mTxn, aKey);
|
||||
}
|
||||
|
||||
void TransactionBuilder::AddSnapshotImage(wr::SnapshotImageKey aKey) {
|
||||
wr_resource_updates_add_snapshot_image(mTxn, aKey);
|
||||
}
|
||||
|
||||
void TransactionBuilder::DeleteSnapshotImage(wr::SnapshotImageKey aKey) {
|
||||
wr_resource_updates_delete_snapshot_image(mTxn, aKey);
|
||||
}
|
||||
|
||||
void TransactionBuilder::AddRawFont(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes,
|
||||
uint32_t aIndex) {
|
||||
wr_resource_updates_add_raw_font(mTxn, aKey, &aBytes.inner, aIndex);
|
||||
|
@ -186,10 +186,6 @@ class TransactionBuilder final {
|
||||
|
||||
void DeleteBlobImage(wr::BlobImageKey aKey);
|
||||
|
||||
void AddSnapshotImage(wr::SnapshotImageKey aKey);
|
||||
|
||||
void DeleteSnapshotImage(wr::SnapshotImageKey aKey);
|
||||
|
||||
void AddRawFont(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes, uint32_t aIndex);
|
||||
|
||||
void AddFontDescriptor(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes,
|
||||
|
@ -2311,21 +2311,6 @@ pub extern "C" fn wr_resource_updates_delete_blob_image(txn: &mut Transaction, k
|
||||
txn.delete_blob_image(key);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_resource_updates_add_snapshot_image(
|
||||
txn: &mut Transaction,
|
||||
image_key: SnapshotImageKey,
|
||||
) {
|
||||
txn.add_snapshot_image(
|
||||
image_key,
|
||||
);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_resource_updates_delete_snapshot_image(txn: &mut Transaction, key: SnapshotImageKey) {
|
||||
txn.delete_snapshot_image(key);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_api_send_transaction(dh: &mut DocumentHandle, transaction: &mut Transaction, is_async: bool) {
|
||||
if transaction.is_empty() {
|
||||
@ -2804,7 +2789,6 @@ pub extern "C" fn wr_dp_push_stacking_context(
|
||||
&[],
|
||||
glyph_raster_space,
|
||||
params.flags,
|
||||
None, // TODO(nical)
|
||||
);
|
||||
|
||||
result
|
||||
|
@ -2569,13 +2569,9 @@ impl BatchBuilder {
|
||||
(gpu_cache.get_address(&segment_instance.gpu_cache_handle), segments)
|
||||
};
|
||||
|
||||
let local_rect = image_instance.adjustment.map_local_rect(&prim_rect);
|
||||
let local_clip_rect = image_instance.tight_local_clip_rect
|
||||
.intersection_unchecked(&local_rect);
|
||||
|
||||
let prim_header = PrimitiveHeader {
|
||||
local_rect,
|
||||
local_clip_rect,
|
||||
local_rect: prim_rect,
|
||||
local_clip_rect: prim_info.clip_chain.local_clip_rect,
|
||||
specific_prim_address: prim_cache_address,
|
||||
transform_id,
|
||||
};
|
||||
|
@ -2,11 +2,12 @@
|
||||
* 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/. */
|
||||
|
||||
use std::hash;
|
||||
use crate::gpu_cache::{GpuCache, GpuCacheHandle};
|
||||
use std::{hash};
|
||||
use crate::gpu_cache::{GpuCacheHandle};
|
||||
use crate::frame_builder::FrameBuildingState;
|
||||
use crate::gpu_cache::GpuDataRequest;
|
||||
use crate::intern;
|
||||
use api::ComponentTransferFuncType;
|
||||
use api::{ComponentTransferFuncType};
|
||||
|
||||
|
||||
pub type FilterDataHandle = intern::Handle<FilterDataIntern>;
|
||||
@ -145,9 +146,9 @@ impl SFilterDataTemplate {
|
||||
/// done if the cache entry is invalid (due to first use or eviction).
|
||||
pub fn update(
|
||||
&mut self,
|
||||
gpu_cache: &mut GpuCache,
|
||||
frame_state: &mut FrameBuildingState,
|
||||
) {
|
||||
if let Some(request) = gpu_cache.request(&mut self.gpu_cache_handle) {
|
||||
if let Some(request) = frame_state.gpu_cache.request(&mut self.gpu_cache_handle) {
|
||||
self.data.update(request);
|
||||
}
|
||||
}
|
||||
|
@ -94,13 +94,12 @@
|
||||
//! blend the overlay tile (this is not always optimal right now, but will be
|
||||
//! improved as a follow up).
|
||||
|
||||
use api::{FilterPrimitiveKind, MixBlendMode, PremultipliedColorF, SVGFE_GRAPH_MAX};
|
||||
use api::{MixBlendMode, PremultipliedColorF, FilterPrimitiveKind, SVGFE_GRAPH_MAX};
|
||||
use api::{PropertyBinding, PropertyBindingId, FilterPrimitive, FilterOpGraphPictureBufferId, RasterSpace};
|
||||
use api::{DebugFlags, ImageKey, ColorF, ColorU, PrimitiveFlags, SnapshotInfo};
|
||||
use api::{DebugFlags, ImageKey, ColorF, ColorU, PrimitiveFlags};
|
||||
use api::{ImageRendering, ColorDepth, YuvRangedColorSpace, YuvFormat, AlphaType};
|
||||
use api::units::*;
|
||||
use crate::prim_store::image::AdjustedImageSource;
|
||||
use crate::{command_buffer::PrimitiveCommand, render_task_graph::RenderTaskGraphBuilder, renderer::GpuBufferBuilderF};
|
||||
use crate::command_buffer::PrimitiveCommand;
|
||||
use crate::box_shadow::BLUR_SAMPLE_SCALE;
|
||||
use crate::clip::{ClipStore, ClipChainInstance, ClipLeafId, ClipNodeId, ClipTreeBuilder};
|
||||
use crate::profiler::{self, TransactionProfile};
|
||||
@ -3534,7 +3533,7 @@ impl TileCacheInstance {
|
||||
PrimitiveInstanceKind::TextRun { .. } => {
|
||||
// These don't contribute dependencies
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
self.maybe_report_promotion_failure(promotion_result, pic_coverage_rect, &mut promotion_failure_reported);
|
||||
|
||||
@ -4210,8 +4209,6 @@ bitflags! {
|
||||
const PRESERVE3D = 4;
|
||||
/// A backdrop that is reused which requires a surface.
|
||||
const BACKDROP = 8;
|
||||
/// We may need to render the picture into an image and cache it.
|
||||
const SNAPSHOT = 16;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5064,10 +5061,6 @@ pub struct PicturePrimitive {
|
||||
/// picture, to be ignored when clipping those primitives and applied
|
||||
/// later when compositing the picture.
|
||||
pub clip_root: Option<ClipNodeId>,
|
||||
|
||||
/// If provided, cache the content of this picture into an image
|
||||
/// associated with the image key.
|
||||
pub snapshot: Option<SnapshotInfo>,
|
||||
}
|
||||
|
||||
impl PicturePrimitive {
|
||||
@ -5139,7 +5132,6 @@ impl PicturePrimitive {
|
||||
spatial_node_index: SpatialNodeIndex,
|
||||
raster_space: RasterSpace,
|
||||
flags: PictureFlags,
|
||||
snapshot: Option<SnapshotInfo>,
|
||||
) -> Self {
|
||||
PicturePrimitive {
|
||||
prim_list,
|
||||
@ -5157,7 +5149,6 @@ impl PicturePrimitive {
|
||||
raster_space,
|
||||
flags,
|
||||
clip_root: None,
|
||||
snapshot,
|
||||
}
|
||||
}
|
||||
|
||||
@ -5920,23 +5911,15 @@ impl PicturePrimitive {
|
||||
).with_uv_rect_kind(uv_rect_kind)
|
||||
);
|
||||
|
||||
|
||||
let blur_render_task_id = request_render_task(
|
||||
frame_state,
|
||||
&self.snapshot,
|
||||
&surface_rects,
|
||||
false,
|
||||
&mut|rg_builder, _, _| {
|
||||
RenderTask::new_blur(
|
||||
blur_std_deviation,
|
||||
picture_task_id,
|
||||
rg_builder,
|
||||
RenderTargetKind::Color,
|
||||
None,
|
||||
original_size.to_i32(),
|
||||
)
|
||||
}
|
||||
let blur_render_task_id = RenderTask::new_blur(
|
||||
blur_std_deviation,
|
||||
picture_task_id,
|
||||
frame_state.rg_builder,
|
||||
RenderTargetKind::Color,
|
||||
None,
|
||||
original_size.to_i32(),
|
||||
);
|
||||
|
||||
primary_render_task_id = blur_render_task_id;
|
||||
|
||||
surface_descriptor = SurfaceDescriptor::new_chained(
|
||||
@ -5995,8 +5978,6 @@ impl PicturePrimitive {
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: Ensure that snapshots bake their shadow.
|
||||
|
||||
// Add this content picture as a dependency of the parent surface, to
|
||||
// ensure it isn't free'd after the shadow uses it as an input.
|
||||
frame_state.surface_builder.add_picture_render_task(picture_task_id);
|
||||
@ -6094,32 +6075,23 @@ impl PicturePrimitive {
|
||||
|
||||
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
||||
|
||||
let is_opaque = false; // TODO
|
||||
let render_task_id = request_render_task(
|
||||
frame_state,
|
||||
&self.snapshot,
|
||||
&surface_rects,
|
||||
is_opaque,
|
||||
&mut|rg_builder, _, _| {
|
||||
rg_builder.add().init(
|
||||
RenderTask::new_dynamic(
|
||||
task_size,
|
||||
RenderTaskKind::new_picture(
|
||||
task_size,
|
||||
surface_rects.needs_scissor_rect,
|
||||
surface_rects.clipped.min,
|
||||
surface_spatial_node_index,
|
||||
raster_spatial_node_index,
|
||||
device_pixel_scale,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cmd_buffer_index,
|
||||
can_use_shared_surface,
|
||||
)
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
let render_task_id = frame_state.rg_builder.add().init(
|
||||
RenderTask::new_dynamic(
|
||||
task_size,
|
||||
RenderTaskKind::new_picture(
|
||||
task_size,
|
||||
surface_rects.needs_scissor_rect,
|
||||
surface_rects.clipped.min,
|
||||
surface_spatial_node_index,
|
||||
raster_spatial_node_index,
|
||||
device_pixel_scale,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cmd_buffer_index,
|
||||
can_use_shared_surface,
|
||||
)
|
||||
}
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
);
|
||||
|
||||
primary_render_task_id = render_task_id;
|
||||
@ -6132,32 +6104,23 @@ impl PicturePrimitive {
|
||||
PictureCompositeMode::Filter(..) => {
|
||||
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
||||
|
||||
let is_opaque = false; // TODO
|
||||
let render_task_id = request_render_task(
|
||||
frame_state,
|
||||
&self.snapshot,
|
||||
&surface_rects,
|
||||
is_opaque,
|
||||
&mut|rg_builder, _, _| {
|
||||
rg_builder.add().init(
|
||||
RenderTask::new_dynamic(
|
||||
surface_rects.task_size,
|
||||
RenderTaskKind::new_picture(
|
||||
surface_rects.task_size,
|
||||
surface_rects.needs_scissor_rect,
|
||||
surface_rects.clipped.min,
|
||||
surface_spatial_node_index,
|
||||
raster_spatial_node_index,
|
||||
device_pixel_scale,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cmd_buffer_index,
|
||||
can_use_shared_surface,
|
||||
)
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
let render_task_id = frame_state.rg_builder.add().init(
|
||||
RenderTask::new_dynamic(
|
||||
surface_rects.task_size,
|
||||
RenderTaskKind::new_picture(
|
||||
surface_rects.task_size,
|
||||
surface_rects.needs_scissor_rect,
|
||||
surface_rects.clipped.min,
|
||||
surface_spatial_node_index,
|
||||
raster_spatial_node_index,
|
||||
device_pixel_scale,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cmd_buffer_index,
|
||||
can_use_shared_surface,
|
||||
)
|
||||
},
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
);
|
||||
|
||||
primary_render_task_id = render_task_id;
|
||||
@ -6170,32 +6133,23 @@ impl PicturePrimitive {
|
||||
PictureCompositeMode::ComponentTransferFilter(..) => {
|
||||
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
||||
|
||||
let is_opaque = false; // TODO
|
||||
let render_task_id = request_render_task(
|
||||
frame_state,
|
||||
&self.snapshot,
|
||||
&surface_rects,
|
||||
is_opaque,
|
||||
&mut|rg_builder, _, _| {
|
||||
rg_builder.add().init(
|
||||
RenderTask::new_dynamic(
|
||||
surface_rects.task_size,
|
||||
RenderTaskKind::new_picture(
|
||||
surface_rects.task_size,
|
||||
surface_rects.needs_scissor_rect,
|
||||
surface_rects.clipped.min,
|
||||
surface_spatial_node_index,
|
||||
raster_spatial_node_index,
|
||||
device_pixel_scale,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cmd_buffer_index,
|
||||
can_use_shared_surface,
|
||||
)
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
let render_task_id = frame_state.rg_builder.add().init(
|
||||
RenderTask::new_dynamic(
|
||||
surface_rects.task_size,
|
||||
RenderTaskKind::new_picture(
|
||||
surface_rects.task_size,
|
||||
surface_rects.needs_scissor_rect,
|
||||
surface_rects.clipped.min,
|
||||
surface_spatial_node_index,
|
||||
raster_spatial_node_index,
|
||||
device_pixel_scale,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cmd_buffer_index,
|
||||
can_use_shared_surface,
|
||||
)
|
||||
}
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
);
|
||||
|
||||
primary_render_task_id = render_task_id;
|
||||
@ -6209,32 +6163,23 @@ impl PicturePrimitive {
|
||||
PictureCompositeMode::Blit(_) => {
|
||||
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
||||
|
||||
let is_opaque = false; // TODO
|
||||
let render_task_id = request_render_task(
|
||||
frame_state,
|
||||
&self.snapshot,
|
||||
&surface_rects,
|
||||
is_opaque,
|
||||
&mut|rg_builder, _, _| {
|
||||
rg_builder.add().init(
|
||||
RenderTask::new_dynamic(
|
||||
surface_rects.task_size,
|
||||
RenderTaskKind::new_picture(
|
||||
surface_rects.task_size,
|
||||
surface_rects.needs_scissor_rect,
|
||||
surface_rects.clipped.min,
|
||||
surface_spatial_node_index,
|
||||
raster_spatial_node_index,
|
||||
device_pixel_scale,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cmd_buffer_index,
|
||||
can_use_shared_surface,
|
||||
)
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
let render_task_id = frame_state.rg_builder.add().init(
|
||||
RenderTask::new_dynamic(
|
||||
surface_rects.task_size,
|
||||
RenderTaskKind::new_picture(
|
||||
surface_rects.task_size,
|
||||
surface_rects.needs_scissor_rect,
|
||||
surface_rects.clipped.min,
|
||||
surface_spatial_node_index,
|
||||
raster_spatial_node_index,
|
||||
device_pixel_scale,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cmd_buffer_index,
|
||||
can_use_shared_surface,
|
||||
)
|
||||
}
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
);
|
||||
|
||||
primary_render_task_id = render_task_id;
|
||||
@ -6253,32 +6198,23 @@ impl PicturePrimitive {
|
||||
// match cases (they used to be quite different).
|
||||
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
||||
|
||||
let is_opaque = false; // TODO
|
||||
let render_task_id = request_render_task(
|
||||
frame_state,
|
||||
&self.snapshot,
|
||||
&surface_rects,
|
||||
is_opaque,
|
||||
&mut|rg_builder, _, _| {
|
||||
rg_builder.add().init(
|
||||
RenderTask::new_dynamic(
|
||||
surface_rects.task_size,
|
||||
RenderTaskKind::new_picture(
|
||||
surface_rects.task_size,
|
||||
surface_rects.needs_scissor_rect,
|
||||
surface_rects.clipped.min,
|
||||
surface_spatial_node_index,
|
||||
raster_spatial_node_index,
|
||||
device_pixel_scale,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cmd_buffer_index,
|
||||
can_use_shared_surface,
|
||||
)
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
let render_task_id = frame_state.rg_builder.add().init(
|
||||
RenderTask::new_dynamic(
|
||||
surface_rects.task_size,
|
||||
RenderTaskKind::new_picture(
|
||||
surface_rects.task_size,
|
||||
surface_rects.needs_scissor_rect,
|
||||
surface_rects.clipped.min,
|
||||
surface_spatial_node_index,
|
||||
raster_spatial_node_index,
|
||||
device_pixel_scale,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cmd_buffer_index,
|
||||
can_use_shared_surface,
|
||||
)
|
||||
}
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
);
|
||||
|
||||
primary_render_task_id = render_task_id;
|
||||
@ -6310,23 +6246,14 @@ impl PicturePrimitive {
|
||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||
);
|
||||
|
||||
let is_opaque = false; // TODO
|
||||
let filter_task_id = request_render_task(
|
||||
frame_state,
|
||||
&self.snapshot,
|
||||
&surface_rects,
|
||||
is_opaque,
|
||||
&mut|rg_builder, _, _| {
|
||||
RenderTask::new_svg_filter(
|
||||
primitives,
|
||||
filter_datas,
|
||||
rg_builder,
|
||||
surface_rects.clipped.size().to_i32(),
|
||||
surface_rects.uv_rect_kind,
|
||||
picture_task_id,
|
||||
device_pixel_scale,
|
||||
)
|
||||
}
|
||||
let filter_task_id = RenderTask::new_svg_filter(
|
||||
primitives,
|
||||
filter_datas,
|
||||
frame_state.rg_builder,
|
||||
surface_rects.clipped.size().to_i32(),
|
||||
surface_rects.uv_rect_kind,
|
||||
picture_task_id,
|
||||
device_pixel_scale,
|
||||
);
|
||||
|
||||
primary_render_task_id = filter_task_id;
|
||||
@ -6377,26 +6304,17 @@ impl PicturePrimitive {
|
||||
|
||||
// Produce the target pixels, this is the result of the
|
||||
// composite op
|
||||
let filter_task_id = request_render_task(
|
||||
let filter_task_id = RenderTask::new_svg_filter_graph(
|
||||
filters,
|
||||
frame_state,
|
||||
&self.snapshot,
|
||||
&surface_rects,
|
||||
false,
|
||||
&mut|rg_builder, _, gpu_cache| {
|
||||
RenderTask::new_svg_filter_graph(
|
||||
filters,
|
||||
rg_builder,
|
||||
gpu_cache,
|
||||
data_stores,
|
||||
surface_rects.uv_rect_kind,
|
||||
picture_task_id,
|
||||
source_subregion.cast_unit(),
|
||||
target_subregion.cast_unit(),
|
||||
prim_subregion.cast_unit(),
|
||||
surface_rects.clipped.cast_unit(),
|
||||
surface_rects.clipped_local.cast_unit(),
|
||||
)
|
||||
}
|
||||
data_stores,
|
||||
surface_rects.uv_rect_kind,
|
||||
picture_task_id,
|
||||
source_subregion.cast_unit(),
|
||||
target_subregion.cast_unit(),
|
||||
prim_subregion.cast_unit(),
|
||||
surface_rects.clipped.cast_unit(),
|
||||
surface_rects.clipped_local.cast_unit(),
|
||||
);
|
||||
|
||||
primary_render_task_id = filter_task_id;
|
||||
@ -7081,7 +6999,7 @@ impl PicturePrimitive {
|
||||
}
|
||||
PictureCompositeMode::ComponentTransferFilter(handle) => {
|
||||
let filter_data = &mut data_stores.filter_data[handle];
|
||||
filter_data.update(&mut frame_state.gpu_cache);
|
||||
filter_data.update(frame_state);
|
||||
}
|
||||
PictureCompositeMode::MixBlend(..) |
|
||||
PictureCompositeMode::Blit(_) |
|
||||
@ -7093,7 +7011,7 @@ impl PicturePrimitive {
|
||||
match op {
|
||||
FilterGraphOp::SVGFEComponentTransferInterned { handle, creates_pixels: _ } => {
|
||||
let filter_data = &mut data_stores.filter_data[*handle];
|
||||
filter_data.update(&mut frame_state.gpu_cache);
|
||||
filter_data.update(frame_state);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@ -7128,7 +7046,7 @@ impl PicturePrimitive {
|
||||
thickness,
|
||||
color,
|
||||
ColorF::TRANSPARENT,
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7526,7 +7444,7 @@ impl TileNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Calculate the four child rects for a given node
|
||||
fn get_child_rects(
|
||||
rect: &PictureBox2D,
|
||||
@ -8324,45 +8242,3 @@ fn test_drop_filter_dirty_region_outside_prim() {
|
||||
).expect("No surface rect");
|
||||
assert_eq!(info.task_size, DeviceIntSize::new(432, 578));
|
||||
}
|
||||
|
||||
fn request_render_task(
|
||||
frame_state: &mut FrameBuildingState,
|
||||
snapshot: &Option<SnapshotInfo>,
|
||||
surface_rects: &SurfaceAllocInfo,
|
||||
is_opaque: bool,
|
||||
f: &mut dyn FnMut(&mut RenderTaskGraphBuilder, &mut GpuBufferBuilderF, &mut GpuCache) -> RenderTaskId,
|
||||
) -> RenderTaskId {
|
||||
|
||||
let task_id = match snapshot {
|
||||
Some(info) => {
|
||||
let adjustment = AdjustedImageSource::from_rects(
|
||||
&info.area,
|
||||
&surface_rects.clipped_local.cast_unit()
|
||||
);
|
||||
frame_state.resource_cache.render_as_image(
|
||||
info.key.as_image(),
|
||||
surface_rects.task_size,
|
||||
frame_state.rg_builder,
|
||||
&mut frame_state.frame_gpu_data.f32,
|
||||
frame_state.gpu_cache,
|
||||
is_opaque,
|
||||
&adjustment,
|
||||
f
|
||||
)
|
||||
}
|
||||
None => {
|
||||
f(
|
||||
frame_state.rg_builder,
|
||||
&mut frame_state.frame_gpu_data.f32,
|
||||
frame_state.gpu_cache
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
frame_state.surface_builder.add_child_render_task(
|
||||
task_id,
|
||||
frame_state.rg_builder,
|
||||
);
|
||||
|
||||
task_id
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ fn prepare_interned_prim_for_render(
|
||||
&mut frame_state.frame_gpu_data.f32,
|
||||
frame_state.rg_builder,
|
||||
&mut frame_state.surface_builder,
|
||||
&mut |rg_builder, _, _| {
|
||||
&mut |rg_builder, _| {
|
||||
rg_builder.add().init(RenderTask::new_dynamic(
|
||||
task_size,
|
||||
RenderTaskKind::new_line_decoration(
|
||||
@ -567,7 +567,7 @@ fn prepare_interned_prim_for_render(
|
||||
&mut frame_state.frame_gpu_data.f32,
|
||||
frame_state.rg_builder,
|
||||
&mut frame_state.surface_builder,
|
||||
&mut |rg_builder, _, _| {
|
||||
&mut |rg_builder, _| {
|
||||
rg_builder.add().init(RenderTask::new_dynamic(
|
||||
cache_size,
|
||||
RenderTaskKind::new_border_segment(
|
||||
@ -718,7 +718,7 @@ fn prepare_interned_prim_for_render(
|
||||
&mut scratch.segments,
|
||||
&mut scratch.segment_instances,
|
||||
|request| {
|
||||
image_data.write_prim_gpu_blocks(&image_instance.adjustment, request);
|
||||
image_data.write_prim_gpu_blocks(request);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ impl ConicGradientTemplate {
|
||||
&mut frame_state.frame_gpu_data.f32,
|
||||
frame_state.rg_builder,
|
||||
&mut frame_state.surface_builder,
|
||||
&mut |rg_builder, gpu_buffer_builder, _| {
|
||||
&mut |rg_builder, gpu_buffer_builder| {
|
||||
let stops = GradientGpuBlockBuilder::build(
|
||||
false,
|
||||
gpu_buffer_builder,
|
||||
|
@ -525,7 +525,7 @@ impl LinearGradientTemplate {
|
||||
&mut frame_state.frame_gpu_data.f32,
|
||||
frame_state.rg_builder,
|
||||
&mut frame_state.surface_builder,
|
||||
&mut |rg_builder, _, _| {
|
||||
&mut |rg_builder, _| {
|
||||
rg_builder.add().init(RenderTask::new_dynamic(
|
||||
self.task_size,
|
||||
RenderTaskKind::FastLinearGradient(gradient),
|
||||
@ -554,7 +554,7 @@ impl LinearGradientTemplate {
|
||||
&mut frame_state.frame_gpu_data.f32,
|
||||
frame_state.rg_builder,
|
||||
&mut frame_state.surface_builder,
|
||||
&mut |rg_builder, gpu_buffer_builder, _| {
|
||||
&mut |rg_builder, gpu_buffer_builder| {
|
||||
let stops = Some(GradientGpuBlockBuilder::build(
|
||||
self.reverse_stops,
|
||||
gpu_buffer_builder,
|
||||
|
@ -259,7 +259,7 @@ impl RadialGradientTemplate {
|
||||
&mut frame_state.frame_gpu_data.f32,
|
||||
frame_state.rg_builder,
|
||||
&mut frame_state.surface_builder,
|
||||
&mut |rg_builder, gpu_buffer_builder, _| {
|
||||
&mut |rg_builder, gpu_buffer_builder| {
|
||||
let stops = GradientGpuBlockBuilder::build(
|
||||
false,
|
||||
gpu_buffer_builder,
|
||||
|
@ -8,7 +8,6 @@ use api::{
|
||||
RasterSpace, Shadow, YuvColorSpace, ColorRange, YuvFormat,
|
||||
};
|
||||
use api::units::*;
|
||||
use euclid::point2;
|
||||
use crate::composite::CompositorSurfaceKind;
|
||||
use crate::scene_building::{CreateShadow, IsVisible};
|
||||
use crate::frame_builder::{FrameBuildingContext, FrameBuildingState};
|
||||
@ -73,7 +72,6 @@ pub struct ImageInstance {
|
||||
pub visible_tiles: Vec<VisibleImageTile>,
|
||||
pub src_color: Option<RenderTaskId>,
|
||||
pub normalized_uvs: bool,
|
||||
pub adjustment: AdjustedImageSource,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
@ -171,25 +169,9 @@ impl ImageData {
|
||||
tile: None,
|
||||
};
|
||||
|
||||
// Tighten the clip rect because decomposing the repeated image can
|
||||
// produce primitives that are partially covering the original image
|
||||
// rect and we want to clip these extra parts out.
|
||||
// We also rely on having a tight clip rect in some cases other than
|
||||
// tiled/repeated images, for example when rendering a snapshot image
|
||||
// where the snapshot area is tighter than the rasterized area.
|
||||
let tight_clip_rect = visibility
|
||||
.clip_chain
|
||||
.local_clip_rect
|
||||
.intersection(&common.prim_rect).unwrap();
|
||||
image_instance.tight_local_clip_rect = tight_clip_rect;
|
||||
|
||||
image_instance.adjustment = AdjustedImageSource::new();
|
||||
|
||||
match image_properties {
|
||||
// Non-tiled (most common) path.
|
||||
Some(ImageProperties { tiling: None, ref descriptor, ref external_image, adjustment, .. }) => {
|
||||
image_instance.adjustment = adjustment;
|
||||
|
||||
Some(ImageProperties { tiling: None, ref descriptor, ref external_image, .. }) => {
|
||||
let mut size = frame_state.resource_cache.request_image(
|
||||
request,
|
||||
frame_state.gpu_cache,
|
||||
@ -278,7 +260,7 @@ impl ImageData {
|
||||
&mut frame_state.frame_gpu_data.f32,
|
||||
frame_state.rg_builder,
|
||||
&mut frame_state.surface_builder,
|
||||
&mut |rg_builder, _, _| {
|
||||
&mut |rg_builder, _| {
|
||||
// Create a task to blit from the texture cache to
|
||||
// a normal transient render task surface.
|
||||
// TODO: figure out if/when we can do a blit instead.
|
||||
@ -316,6 +298,15 @@ impl ImageData {
|
||||
// thing.
|
||||
let active_rect = visible_rect;
|
||||
|
||||
// Tighten the clip rect because decomposing the repeated image can
|
||||
// produce primitives that are partially covering the original image
|
||||
// rect and we want to clip these extra parts out.
|
||||
let tight_clip_rect = visibility
|
||||
.clip_chain
|
||||
.local_clip_rect
|
||||
.intersection(&common.prim_rect).unwrap();
|
||||
image_instance.tight_local_clip_rect = tight_clip_rect;
|
||||
|
||||
let visible_rect = compute_conservative_visible_rect(
|
||||
&visibility.clip_chain,
|
||||
frame_state.current_dirty_region().combined,
|
||||
@ -383,20 +374,19 @@ impl ImageData {
|
||||
}
|
||||
|
||||
if let Some(mut request) = frame_state.gpu_cache.request(&mut common.gpu_cache_handle) {
|
||||
self.write_prim_gpu_blocks(&image_instance.adjustment, &mut request);
|
||||
self.write_prim_gpu_blocks(&mut request);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn write_prim_gpu_blocks(&self, adjustment: &AdjustedImageSource, request: &mut GpuDataRequest) {
|
||||
let stretch_size = adjustment.map_stretch_size(self.stretch_size);
|
||||
pub fn write_prim_gpu_blocks(&self, request: &mut GpuDataRequest) {
|
||||
// Images are drawn as a white color, modulated by the total
|
||||
// opacity coming from any collapsed property bindings.
|
||||
// Size has to match `VECS_PER_SPECIFIC_BRUSH` from `brush_image.glsl` exactly.
|
||||
request.push(self.color.premultiplied());
|
||||
request.push(PremultipliedColorF::WHITE);
|
||||
request.push([
|
||||
stretch_size.width + self.tile_spacing.width,
|
||||
stretch_size.height + self.tile_spacing.height,
|
||||
self.stretch_size.width + self.tile_spacing.width,
|
||||
self.stretch_size.height + self.tile_spacing.height,
|
||||
0.0,
|
||||
0.0,
|
||||
]);
|
||||
@ -459,7 +449,6 @@ impl InternablePrimitive for Image {
|
||||
visible_tiles: Vec::new(),
|
||||
src_color: None,
|
||||
normalized_uvs: false,
|
||||
adjustment: AdjustedImageSource::new(),
|
||||
});
|
||||
|
||||
PrimitiveInstanceKind::Image {
|
||||
@ -494,95 +483,6 @@ impl IsVisible for Image {
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents an adjustment to apply to an image primitive.
|
||||
/// This can be used to compensate for a difference between the bounds of
|
||||
/// the images expected by the primitive and the bounds that were actually
|
||||
/// drawn in the texture cache.
|
||||
///
|
||||
/// This happens when rendering snapshot images: A picture is marked so that
|
||||
/// a specific reference area in layout space can be rendered as an image.
|
||||
/// However, the bounds of the rasterized area of the picture typically differ
|
||||
/// from that reference area.
|
||||
///
|
||||
/// The adjustment is stored as 4 floats (x0, y0, x1, y1) that represent a
|
||||
/// transformation of the primitve's local rect such that:
|
||||
///
|
||||
/// ```
|
||||
/// adjusted_rect.min = prim_rect.min + prim_rect.size() * (x0, y0);
|
||||
/// adjusted_rect.max = prim_rect.max + prim_rect.size() * (x1, y1);
|
||||
/// ```
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
pub struct AdjustedImageSource {
|
||||
x0: f32,
|
||||
y0: f32,
|
||||
x1: f32,
|
||||
y1: f32,
|
||||
}
|
||||
|
||||
impl AdjustedImageSource {
|
||||
/// The "identity" adjustment.
|
||||
pub fn new() -> Self {
|
||||
AdjustedImageSource {
|
||||
x0: 0.0,
|
||||
y0: 0.0,
|
||||
x1: 0.0,
|
||||
y1: 0.0,
|
||||
}
|
||||
}
|
||||
|
||||
/// An adjustment to render an image item defined in function of the `reference`
|
||||
/// rect whereas the `actual` rect was cached instead.
|
||||
pub fn from_rects(reference: &LayoutRect, actual: &LayoutRect) -> Self {
|
||||
let ref_size = reference.size();
|
||||
let min_offset = reference.min.to_vector();
|
||||
let max_offset = reference.max.to_vector();
|
||||
AdjustedImageSource {
|
||||
x0: (actual.min.x - min_offset.x) / ref_size.width,
|
||||
y0: (actual.min.y - min_offset.y) / ref_size.height,
|
||||
x1: (actual.max.x - max_offset.x) / ref_size.width,
|
||||
y1: (actual.max.y - max_offset.y) / ref_size.height,
|
||||
}
|
||||
}
|
||||
|
||||
/// Adjust the primitive's local rect.
|
||||
pub fn map_local_rect(&self, rect: &LayoutRect) -> LayoutRect {
|
||||
let w = rect.width();
|
||||
let h = rect.height();
|
||||
LayoutRect {
|
||||
min: point2(
|
||||
rect.min.x + w * self.x0,
|
||||
rect.min.y + h * self.y0,
|
||||
),
|
||||
max: point2(
|
||||
rect.max.x + w * self.x1,
|
||||
rect.max.y + h * self.y1,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
/// The stretch size has to be adjusted as well because it is defined
|
||||
/// using the snapshot area as reference but will stretch the rasterized
|
||||
/// area instead.
|
||||
///
|
||||
/// It has to be scaled by a factor of (adjusted.size() / prim_rect.size()).
|
||||
/// We derive the formula in function of the adjustment factors:
|
||||
///
|
||||
/// ```
|
||||
/// factor = (adjusted.max - adjusted.min) / (w, h)
|
||||
/// = (rect.max + (w, h) * (x1, y1) - (rect.min + (w, h) * (x0, y0))) / (w, h)
|
||||
/// = ((w, h) + (w, h) * (x1, y1) - (w, h) * (x0, y0)) / (w, h)
|
||||
/// = (1.0, 1.0) + (x1, y1) - (x0, y0)
|
||||
/// ```
|
||||
pub fn map_stretch_size(&self, size: LayoutSize) -> LayoutSize {
|
||||
LayoutSize::new(
|
||||
size.width * (1.0 + self.x1 - self.x0),
|
||||
size.height * (1.0 + self.y1 - self.y0),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||
|
@ -10,7 +10,7 @@ use std::marker::PhantomData;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::u32;
|
||||
use api::{MinimapData, SnapshotImageKey};
|
||||
use api::MinimapData;
|
||||
use time::precise_time_ns;
|
||||
use crate::api::channel::{Sender, single_msg_channel, unbounded_channel};
|
||||
use crate::api::{BuiltDisplayList, IdNamespace, ExternalScrollId, Parameter, BoolParameter};
|
||||
@ -59,10 +59,6 @@ pub enum ResourceUpdate {
|
||||
DeleteBlobImage(BlobImageKey),
|
||||
/// See `AddBlobImage::visible_area`.
|
||||
SetBlobImageVisibleArea(BlobImageKey, DeviceIntRect),
|
||||
/// See `AddSnapshotImage`.
|
||||
AddSnapshotImage(AddSnapshotImage),
|
||||
/// See `AddSnapshotImage`.
|
||||
DeleteSnapshotImage(SnapshotImageKey),
|
||||
/// See `AddFont`.
|
||||
AddFont(AddFont),
|
||||
/// Deletes an already existing font resource.
|
||||
@ -103,8 +99,6 @@ impl fmt::Debug for ResourceUpdate {
|
||||
ResourceUpdate::DeleteImage(..) => f.write_str("ResourceUpdate::DeleteImage"),
|
||||
ResourceUpdate::DeleteBlobImage(..) => f.write_str("ResourceUpdate::DeleteBlobImage"),
|
||||
ResourceUpdate::SetBlobImageVisibleArea(..) => f.write_str("ResourceUpdate::SetBlobImageVisibleArea"),
|
||||
ResourceUpdate::AddSnapshotImage(..) => f.write_str("ResourceUpdate::AddSnapshotImage"),
|
||||
ResourceUpdate::DeleteSnapshotImage(..) => f.write_str("ResourceUpdate::DeleteSnapshotImage"),
|
||||
ResourceUpdate::AddFont(..) => f.write_str("ResourceUpdate::AddFont"),
|
||||
ResourceUpdate::DeleteFont(..) => f.write_str("ResourceUpdate::DeleteFont"),
|
||||
ResourceUpdate::AddFontInstance(..) => f.write_str("ResourceUpdate::AddFontInstance"),
|
||||
@ -511,21 +505,6 @@ impl Transaction {
|
||||
self.resource_updates.push(ResourceUpdate::SetBlobImageVisibleArea(key, area));
|
||||
}
|
||||
|
||||
/// See `ResourceUpdate::AddSnapshotImage`.
|
||||
pub fn add_snapshot_image(
|
||||
&mut self,
|
||||
key: SnapshotImageKey,
|
||||
) {
|
||||
self.resource_updates.push(
|
||||
ResourceUpdate::AddSnapshotImage(AddSnapshotImage { key })
|
||||
);
|
||||
}
|
||||
|
||||
/// See `ResourceUpdate::DeleteSnapshotImage`.
|
||||
pub fn delete_snapshot_image(&mut self, key: SnapshotImageKey) {
|
||||
self.resource_updates.push(ResourceUpdate::DeleteSnapshotImage(key));
|
||||
}
|
||||
|
||||
/// See `ResourceUpdate::AddFont`.
|
||||
pub fn add_raw_font(&mut self, key: FontKey, bytes: Vec<u8>, index: u32) {
|
||||
self.resource_updates
|
||||
@ -745,16 +724,6 @@ pub struct UpdateBlobImage {
|
||||
pub dirty_rect: BlobDirtyRect,
|
||||
}
|
||||
|
||||
/// Creates a snapshot image resource.
|
||||
///
|
||||
/// Must be matched with a `DeleteSnapshotImage` at some point to prevent memory leaks.
|
||||
#[derive(Clone)]
|
||||
#[cfg_attr(any(feature = "serde"), derive(Deserialize, Serialize))]
|
||||
pub struct AddSnapshotImage {
|
||||
/// The key identfying the snapshot resource.
|
||||
pub key: SnapshotImageKey,
|
||||
}
|
||||
|
||||
/// Creates a font resource.
|
||||
///
|
||||
/// Must be matched with a corresponding `ResourceUpdate::DeleteFont` at some point to prevent
|
||||
|
@ -12,7 +12,7 @@ use crate::command_buffer::{CommandBufferIndex, QuadFlags};
|
||||
use crate::pattern::{PatternKind, PatternShaderInput};
|
||||
use crate::spatial_tree::SpatialNodeIndex;
|
||||
use crate::filterdata::SFilterData;
|
||||
use crate::frame_builder::FrameBuilderConfig;
|
||||
use crate::frame_builder::{FrameBuilderConfig, FrameBuildingState};
|
||||
use crate::gpu_cache::{GpuCache, GpuCacheAddress, GpuCacheHandle};
|
||||
use crate::gpu_types::{BorderInstance, ImageSource, UvRectKind, TransformPaletteId};
|
||||
use crate::internal_types::{CacheTextureId, FastHashMap, FilterGraphNode, FilterGraphOp, FilterGraphPictureReference, SVGFE_CONVOLVE_VALUES_LIMIT, TextureSource, Swizzle};
|
||||
@ -677,7 +677,7 @@ impl RenderTaskKind {
|
||||
gpu_buffer_builder,
|
||||
rg_builder,
|
||||
surface_builder,
|
||||
&mut |rg_builder, _, _| {
|
||||
&mut |rg_builder, _| {
|
||||
let clip_data = ClipData::rounded_rect(
|
||||
source.minimal_shadow_rect.size(),
|
||||
&source.shadow_radius,
|
||||
@ -1641,8 +1641,7 @@ impl RenderTask {
|
||||
/// * render_target.rs : add_svg_filter_node_instances
|
||||
pub fn new_svg_filter_graph(
|
||||
filter_nodes: &[(FilterGraphNode, FilterGraphOp)],
|
||||
rg_builder: &mut RenderTaskGraphBuilder,
|
||||
gpu_cache: &mut GpuCache,
|
||||
frame_state: &mut FrameBuildingState,
|
||||
data_stores: &mut DataStores,
|
||||
_uv_rect_kind: UvRectKind,
|
||||
original_task_id: RenderTaskId,
|
||||
@ -2336,7 +2335,7 @@ impl RenderTask {
|
||||
)
|
||||
.scale(render_to_device_scale, render_to_device_scale);
|
||||
|
||||
let input_subregion_task_id = rg_builder.add().init(RenderTask::new_dynamic(
|
||||
let input_subregion_task_id = frame_state.rg_builder.add().init(RenderTask::new_dynamic(
|
||||
adjusted_blur_task_size.to_i32(),
|
||||
RenderTaskKind::SVGFENode(
|
||||
SVGFEFilterTask{
|
||||
@ -2354,7 +2353,7 @@ impl RenderTask {
|
||||
),
|
||||
).with_uv_rect_kind(UvRectKind::Rect));
|
||||
// Adding the dependencies sets the inputs for this task
|
||||
rg_builder.add_dependency(input_subregion_task_id, source_task_id);
|
||||
frame_state.rg_builder.add_dependency(input_subregion_task_id, source_task_id);
|
||||
|
||||
// TODO: We should do this blur in the correct
|
||||
// colorspace, linear=true is the default in SVG and
|
||||
@ -2365,13 +2364,13 @@ impl RenderTask {
|
||||
RenderTask::new_blur(
|
||||
adjusted_blur_std_deviation,
|
||||
input_subregion_task_id,
|
||||
rg_builder,
|
||||
frame_state.rg_builder,
|
||||
RenderTargetKind::Color,
|
||||
None,
|
||||
adjusted_blur_task_size.to_i32(),
|
||||
);
|
||||
|
||||
task_id = rg_builder.add().init(RenderTask::new_dynamic(
|
||||
task_id = frame_state.rg_builder.add().init(RenderTask::new_dynamic(
|
||||
node_task_size,
|
||||
RenderTaskKind::SVGFENode(
|
||||
SVGFEFilterTask{
|
||||
@ -2397,7 +2396,7 @@ impl RenderTask {
|
||||
),
|
||||
).with_uv_rect_kind(node_uv_rect_kind));
|
||||
// Adding the dependencies sets the inputs for this task
|
||||
rg_builder.add_dependency(task_id, blur_task_id);
|
||||
frame_state.rg_builder.add_dependency(task_id, blur_task_id);
|
||||
}
|
||||
FilterGraphOp::SVGFEDropShadow { color, dx, dy, std_deviation_x, std_deviation_y } => {
|
||||
// Note: wrap_prim_with_filters copies the SourceGraphic to
|
||||
@ -2454,7 +2453,7 @@ impl RenderTask {
|
||||
)
|
||||
.scale(render_to_device_scale, render_to_device_scale);
|
||||
|
||||
let input_subregion_task_id = rg_builder.add().init(RenderTask::new_dynamic(
|
||||
let input_subregion_task_id = frame_state.rg_builder.add().init(RenderTask::new_dynamic(
|
||||
adjusted_blur_task_size.to_i32(),
|
||||
RenderTaskKind::SVGFENode(
|
||||
SVGFEFilterTask{
|
||||
@ -2480,7 +2479,7 @@ impl RenderTask {
|
||||
),
|
||||
).with_uv_rect_kind(UvRectKind::Rect));
|
||||
// Adding the dependencies sets the inputs for this task
|
||||
rg_builder.add_dependency(input_subregion_task_id, source_task_id);
|
||||
frame_state.rg_builder.add_dependency(input_subregion_task_id, source_task_id);
|
||||
|
||||
// The shadow compositing only cares about alpha channel
|
||||
// which is always linear, so we can blur this in sRGB or
|
||||
@ -2490,7 +2489,7 @@ impl RenderTask {
|
||||
RenderTask::new_blur(
|
||||
adjusted_blur_std_deviation,
|
||||
input_subregion_task_id,
|
||||
rg_builder,
|
||||
frame_state.rg_builder,
|
||||
RenderTargetKind::Color,
|
||||
None,
|
||||
adjusted_blur_task_size.to_i32(),
|
||||
@ -2500,7 +2499,7 @@ impl RenderTask {
|
||||
// the blurred shadow image at the correct subregion offset
|
||||
let blur_subregion_translated = blur_subregion
|
||||
.translate(LayoutVector2D::new(dx, dy));
|
||||
task_id = rg_builder.add().init(RenderTask::new_dynamic(
|
||||
task_id = frame_state.rg_builder.add().init(RenderTask::new_dynamic(
|
||||
node_task_size,
|
||||
RenderTaskKind::SVGFENode(
|
||||
SVGFEFilterTask{
|
||||
@ -2534,8 +2533,8 @@ impl RenderTask {
|
||||
),
|
||||
).with_uv_rect_kind(node_uv_rect_kind));
|
||||
// Adding the dependencies sets the inputs for this task
|
||||
rg_builder.add_dependency(task_id, source_task_id);
|
||||
rg_builder.add_dependency(task_id, blur_task_id);
|
||||
frame_state.rg_builder.add_dependency(task_id, source_task_id);
|
||||
frame_state.rg_builder.add_dependency(task_id, blur_task_id);
|
||||
}
|
||||
FilterGraphOp::SVGFESourceAlpha |
|
||||
FilterGraphOp::SVGFESourceGraphic => {
|
||||
@ -2543,7 +2542,7 @@ impl RenderTask {
|
||||
// a fake input binding to make the shader do the copy. In
|
||||
// the case of SourceAlpha the shader will zero the RGB but
|
||||
// we don't have to care about that distinction here.
|
||||
task_id = rg_builder.add().init(RenderTask::new_dynamic(
|
||||
task_id = frame_state.rg_builder.add().init(RenderTask::new_dynamic(
|
||||
node_task_size,
|
||||
RenderTaskKind::SVGFENode(
|
||||
SVGFEFilterTask{
|
||||
@ -2571,17 +2570,17 @@ impl RenderTask {
|
||||
}
|
||||
),
|
||||
).with_uv_rect_kind(node_uv_rect_kind));
|
||||
rg_builder.add_dependency(task_id, original_task_id);
|
||||
frame_state.rg_builder.add_dependency(task_id, original_task_id);
|
||||
made_dependency_on_source = true;
|
||||
}
|
||||
FilterGraphOp::SVGFEComponentTransferInterned { handle, creates_pixels: _ } => {
|
||||
// FIXME: Doing this in prepare_interned_prim_for_render
|
||||
// doesn't seem to be enough, where should it be done?
|
||||
let filter_data = &mut data_stores.filter_data[handle];
|
||||
filter_data.update(gpu_cache);
|
||||
filter_data.update(frame_state);
|
||||
// ComponentTransfer has a gpu_cache_handle that we need to
|
||||
// pass along
|
||||
task_id = rg_builder.add().init(RenderTask::new_dynamic(
|
||||
task_id = frame_state.rg_builder.add().init(RenderTask::new_dynamic(
|
||||
node_task_size,
|
||||
RenderTaskKind::SVGFENode(
|
||||
SVGFEFilterTask{
|
||||
@ -2606,14 +2605,14 @@ impl RenderTask {
|
||||
made_dependency_on_source = true;
|
||||
}
|
||||
if *input_task != RenderTaskId::INVALID {
|
||||
rg_builder.add_dependency(task_id, *input_task);
|
||||
frame_state.rg_builder.add_dependency(task_id, *input_task);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// This is the usual case - zero, one or two inputs that
|
||||
// reference earlier node results.
|
||||
task_id = rg_builder.add().init(RenderTask::new_dynamic(
|
||||
task_id = frame_state.rg_builder.add().init(RenderTask::new_dynamic(
|
||||
node_task_size,
|
||||
RenderTaskKind::SVGFENode(
|
||||
SVGFEFilterTask{
|
||||
@ -2638,7 +2637,7 @@ impl RenderTask {
|
||||
made_dependency_on_source = true;
|
||||
}
|
||||
if *input_task != RenderTaskId::INVALID {
|
||||
rg_builder.add_dependency(task_id, *input_task);
|
||||
frame_state.rg_builder.add_dependency(task_id, *input_task);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2657,7 +2656,7 @@ impl RenderTask {
|
||||
// If no tasks referenced the SourceGraphic, we actually have to create
|
||||
// a fake dependency so that it does not leak.
|
||||
if !made_dependency_on_source && output_task_id != original_task_id {
|
||||
rg_builder.add_dependency(output_task_id, original_task_id);
|
||||
frame_state.rg_builder.add_dependency(output_task_id, original_task_id);
|
||||
}
|
||||
|
||||
output_task_id
|
||||
|
@ -3,7 +3,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
use api::{DirtyRect, ImageDescriptor, ImageDescriptorFlags, SnapshotImageKey};
|
||||
use api::{ImageDescriptor, ImageDescriptorFlags, DirtyRect};
|
||||
use api::units::*;
|
||||
use crate::border::BorderSegmentCacheKey;
|
||||
use crate::box_shadow::{BoxShadowCacheKey};
|
||||
@ -52,7 +52,6 @@ pub enum RenderTaskCacheKeyKind {
|
||||
LinearGradient(LinearGradientCacheKey),
|
||||
RadialGradient(RadialGradientCacheKey),
|
||||
ConicGradient(ConicGradientCacheKey),
|
||||
Snapshot(SnapshotImageKey),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||
@ -233,13 +232,13 @@ impl RenderTaskCache {
|
||||
gpu_buffer_builder: &mut GpuBufferBuilderF,
|
||||
rg_builder: &mut RenderTaskGraphBuilder,
|
||||
surface_builder: &mut SurfaceBuilder,
|
||||
f: &mut dyn FnMut(&mut RenderTaskGraphBuilder, &mut GpuBufferBuilderF, &mut GpuCache) -> RenderTaskId,
|
||||
f: &mut dyn FnMut(&mut RenderTaskGraphBuilder, &mut GpuBufferBuilderF) -> RenderTaskId,
|
||||
) -> RenderTaskId {
|
||||
// If this render task cache is being drawn this frame, ensure we hook up the
|
||||
// render task for it as a dependency of any render task that uses this as
|
||||
// an input source.
|
||||
let (task_id, rendered_this_frame) = match key {
|
||||
None => (f(rg_builder, gpu_buffer_builder, gpu_cache), true),
|
||||
None => (f(rg_builder, gpu_buffer_builder), true),
|
||||
Some(key) => self.request_render_task_impl(
|
||||
key,
|
||||
is_opaque,
|
||||
@ -286,7 +285,7 @@ impl RenderTaskCache {
|
||||
gpu_cache: &mut GpuCache,
|
||||
gpu_buffer_builder: &mut GpuBufferBuilderF,
|
||||
rg_builder: &mut RenderTaskGraphBuilder,
|
||||
f: &mut dyn FnMut(&mut RenderTaskGraphBuilder, &mut GpuBufferBuilderF, &mut GpuCache) -> RenderTaskId,
|
||||
f: &mut dyn FnMut(&mut RenderTaskGraphBuilder, &mut GpuBufferBuilderF) -> RenderTaskId,
|
||||
) -> (RenderTaskId, bool) {
|
||||
let frame_id = self.frame_id;
|
||||
let size = key.size;
|
||||
@ -311,7 +310,7 @@ impl RenderTaskCache {
|
||||
if texture_cache.request(&cache_entry.handle, gpu_cache) {
|
||||
// Invoke user closure to get render task chain
|
||||
// to draw this into the texture cache.
|
||||
let render_task_id = f(rg_builder, gpu_buffer_builder, gpu_cache);
|
||||
let render_task_id = f(rg_builder, gpu_buffer_builder);
|
||||
|
||||
cache_entry.user_data = None;
|
||||
cache_entry.is_opaque = is_opaque;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* 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/. */
|
||||
|
||||
use api::{BlobImageRequest, ImageDescriptorFlags, ImageFormat, RasterizedBlobImage};
|
||||
use api::{BlobImageRequest, RasterizedBlobImage, ImageFormat, ImageDescriptorFlags};
|
||||
use api::{DebugFlags, FontInstanceKey, FontKey, FontTemplate, GlyphIndex};
|
||||
use api::{ExternalImageData, ExternalImageType, ExternalImageId, BlobImageResult};
|
||||
use api::{DirtyRect, GlyphDimensions, IdNamespace, DEFAULT_TILE_SIZE};
|
||||
@ -10,10 +10,7 @@ use api::{ColorF, ImageData, ImageDescriptor, ImageKey, ImageRendering, TileSize
|
||||
use api::{BlobImageHandler, BlobImageKey, VoidPtrToSizeFn};
|
||||
use api::units::*;
|
||||
use euclid::size2;
|
||||
use crate::render_target::RenderTargetKind;
|
||||
use crate::render_task::{RenderTaskLocation, StaticRenderTaskSurface};
|
||||
use crate::{render_api::{ClearCache, AddFont, ResourceUpdate, MemoryReport}, util::WeakTable};
|
||||
use crate::prim_store::image::AdjustedImageSource;
|
||||
use crate::image_tiling::{compute_tile_size, compute_tile_range};
|
||||
#[cfg(feature = "capture")]
|
||||
use crate::capture::ExternalCaptureImage;
|
||||
@ -116,11 +113,6 @@ pub enum CachedImageData {
|
||||
///
|
||||
/// The commands are stored elsewhere and this variant is used as a placeholder.
|
||||
Blob,
|
||||
/// A stacking context for which a snapshot has been requested.
|
||||
///
|
||||
/// The snapshot is grabbed from GPU-side rasterized pixels so there is no
|
||||
/// CPU-side data to store here.
|
||||
Snapshot,
|
||||
/// An image owned by the embedding, and referenced by WebRender. This may
|
||||
/// take the form of a texture or a heap-allocated buffer.
|
||||
External(ExternalImageData),
|
||||
@ -145,14 +137,6 @@ impl CachedImageData {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_snapshot(&self) -> bool {
|
||||
match *self {
|
||||
CachedImageData::Snapshot => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if this variant of CachedImageData should go through the texture
|
||||
/// cache.
|
||||
#[inline]
|
||||
@ -164,7 +148,6 @@ impl CachedImageData {
|
||||
},
|
||||
CachedImageData::Blob => true,
|
||||
CachedImageData::Raw(_) => true,
|
||||
CachedImageData::Snapshot => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -179,7 +162,6 @@ pub struct ImageProperties {
|
||||
// Potentially a subset of the image's total rectangle. This rectangle is what
|
||||
// we map to the (layout space) display item bounds.
|
||||
pub visible_rect: DeviceIntRect,
|
||||
pub adjustment: AdjustedImageSource,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
@ -208,7 +190,6 @@ struct ImageResource {
|
||||
/// This is used to express images that are virtually very large
|
||||
/// but with only a visible sub-set that is valid at a given time.
|
||||
visible_rect: DeviceIntRect,
|
||||
adjustment: AdjustedImageSource,
|
||||
generation: ImageGeneration,
|
||||
}
|
||||
|
||||
@ -592,7 +573,6 @@ impl ResourceCache {
|
||||
// not make sense to tile them into smaller ones.
|
||||
info.image_type == ExternalImageType::Buffer && size_check
|
||||
}
|
||||
CachedImageData::Snapshot => false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -616,10 +596,10 @@ impl ResourceCache {
|
||||
gpu_buffer_builder: &mut GpuBufferBuilderF,
|
||||
rg_builder: &mut RenderTaskGraphBuilder,
|
||||
surface_builder: &mut SurfaceBuilder,
|
||||
f: &mut dyn FnMut(&mut RenderTaskGraphBuilder, &mut GpuBufferBuilderF, &mut GpuCache) -> RenderTaskId,
|
||||
f: &mut dyn FnMut(&mut RenderTaskGraphBuilder, &mut GpuBufferBuilderF) -> RenderTaskId,
|
||||
) -> RenderTaskId {
|
||||
self.cached_render_tasks.request_render_task(
|
||||
key.clone(),
|
||||
key,
|
||||
&mut self.texture_cache,
|
||||
is_opaque,
|
||||
parent,
|
||||
@ -631,85 +611,6 @@ impl ResourceCache {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn render_as_image(
|
||||
&mut self,
|
||||
image_key: ImageKey,
|
||||
size: DeviceIntSize,
|
||||
rg_builder: &mut RenderTaskGraphBuilder,
|
||||
gpu_buffer_builder: &mut GpuBufferBuilderF,
|
||||
gpu_cache: &mut GpuCache,
|
||||
is_opaque: bool,
|
||||
adjustment: &AdjustedImageSource,
|
||||
f: &mut dyn FnMut(&mut RenderTaskGraphBuilder, &mut GpuBufferBuilderF, &mut GpuCache) -> RenderTaskId,
|
||||
) -> RenderTaskId {
|
||||
|
||||
let task_id = f(rg_builder, gpu_buffer_builder, gpu_cache);
|
||||
|
||||
let render_task = rg_builder.get_task_mut(task_id);
|
||||
|
||||
let mut texture_cache_handle = TextureCacheHandle::invalid();
|
||||
|
||||
let flags = if is_opaque {
|
||||
ImageDescriptorFlags::IS_OPAQUE
|
||||
} else {
|
||||
ImageDescriptorFlags::empty()
|
||||
};
|
||||
|
||||
let descriptor = ImageDescriptor::new(
|
||||
size.width,
|
||||
size.height,
|
||||
self.texture_cache.shared_color_expected_format(),
|
||||
flags,
|
||||
);
|
||||
|
||||
// Allocate space in the texture cache, but don't supply
|
||||
// and CPU-side data to be uploaded.
|
||||
let user_data = [0.0; 4];
|
||||
self.texture_cache.update(
|
||||
&mut texture_cache_handle,
|
||||
descriptor,
|
||||
TextureFilter::Linear,
|
||||
None,
|
||||
user_data,
|
||||
DirtyRect::All,
|
||||
gpu_cache,
|
||||
None,
|
||||
render_task.uv_rect_kind(),
|
||||
Eviction::Manual,
|
||||
TargetShader::Default,
|
||||
);
|
||||
|
||||
// Get the allocation details in the texture cache, and store
|
||||
// this in the render task. The renderer will draw this task
|
||||
// into the appropriate rect of the texture cache on this frame.
|
||||
let (texture_id, uv_rect, _, _, _) =
|
||||
self.texture_cache.get_cache_location(&texture_cache_handle);
|
||||
|
||||
render_task.location = RenderTaskLocation::Static {
|
||||
surface: StaticRenderTaskSurface::TextureCache {
|
||||
texture: texture_id,
|
||||
target_kind: RenderTargetKind::Color,
|
||||
},
|
||||
rect: uv_rect.to_i32(),
|
||||
};
|
||||
|
||||
self.cached_images.insert(
|
||||
image_key,
|
||||
ImageResult::UntiledAuto(CachedImageInfo {
|
||||
texture_cache_handle,
|
||||
dirty_rect: ImageDirtyRect::All,
|
||||
manual_eviction: true,
|
||||
})
|
||||
);
|
||||
|
||||
self.resources.image_templates
|
||||
.get_mut(image_key)
|
||||
.unwrap()
|
||||
.adjustment = *adjustment;
|
||||
|
||||
task_id
|
||||
}
|
||||
|
||||
pub fn post_scene_building_update(
|
||||
&mut self,
|
||||
updates: Vec<ResourceUpdate>,
|
||||
@ -772,26 +673,6 @@ impl ResourceCache {
|
||||
ResourceUpdate::DeleteBlobImage(img) => {
|
||||
self.delete_image_template(img.as_image());
|
||||
}
|
||||
ResourceUpdate::AddSnapshotImage(img) => {
|
||||
let format = self.texture_cache.shared_color_expected_format();
|
||||
self.add_image_template(
|
||||
img.key.as_image(),
|
||||
ImageDescriptor {
|
||||
format,
|
||||
// We'll know about the size when creating the render task.
|
||||
size: DeviceIntSize::zero(),
|
||||
stride: None,
|
||||
offset: 0,
|
||||
flags: ImageDescriptorFlags::empty(),
|
||||
},
|
||||
CachedImageData::Snapshot,
|
||||
&DeviceIntRect::zero(),
|
||||
None,
|
||||
);
|
||||
}
|
||||
ResourceUpdate::DeleteSnapshotImage(img) => {
|
||||
self.delete_image_template(img.as_image());
|
||||
}
|
||||
ResourceUpdate::DeleteFont(font) => {
|
||||
if let Some(shared_key) = self.resources.fonts.font_keys.delete_key(&font) {
|
||||
self.delete_font_template(shared_key);
|
||||
@ -933,7 +814,6 @@ impl ResourceCache {
|
||||
data,
|
||||
tiling,
|
||||
visible_rect: *visible_rect,
|
||||
adjustment: AdjustedImageSource::new(),
|
||||
generation: ImageGeneration(0),
|
||||
};
|
||||
|
||||
@ -1003,7 +883,6 @@ impl ResourceCache {
|
||||
data,
|
||||
tiling,
|
||||
visible_rect: descriptor.size.into(),
|
||||
adjustment: AdjustedImageSource::new(),
|
||||
generation: ImageGeneration(image.generation.0 + 1),
|
||||
};
|
||||
}
|
||||
@ -1373,10 +1252,7 @@ impl ResourceCache {
|
||||
ExternalImageType::Buffer => None,
|
||||
},
|
||||
// raw and blob image are all using resource_cache.
|
||||
CachedImageData::Raw(..)
|
||||
| CachedImageData::Blob
|
||||
| CachedImageData::Snapshot
|
||||
=> None,
|
||||
CachedImageData::Raw(..) | CachedImageData::Blob => None,
|
||||
};
|
||||
|
||||
ImageProperties {
|
||||
@ -1384,7 +1260,6 @@ impl ResourceCache {
|
||||
external_image,
|
||||
tiling: image_template.tiling,
|
||||
visible_rect: image_template.visible_rect,
|
||||
adjustment: image_template.adjustment,
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -1481,11 +1356,7 @@ impl ResourceCache {
|
||||
let mut updates: SmallVec<[(CachedImageData, Option<DeviceIntRect>); 1]> = SmallVec::new();
|
||||
|
||||
match image_template.data {
|
||||
CachedImageData::Snapshot => {
|
||||
// The update is done in ResourceCache::render_as_image.
|
||||
}
|
||||
CachedImageData::Raw(..)
|
||||
| CachedImageData::External(..) => {
|
||||
CachedImageData::Raw(..) | CachedImageData::External(..) => {
|
||||
// Safe to clone here since the Raw image data is an
|
||||
// Arc, and the external image data is small.
|
||||
updates.push((image_template.data.clone(), None));
|
||||
@ -1565,14 +1436,11 @@ impl ResourceCache {
|
||||
}
|
||||
};
|
||||
|
||||
let eviction = match &image_template.data {
|
||||
CachedImageData::Blob | CachedImageData::Snapshot => {
|
||||
entry.manual_eviction = true;
|
||||
Eviction::Manual
|
||||
}
|
||||
_ => {
|
||||
Eviction::Auto
|
||||
}
|
||||
let eviction = if image_template.data.is_blob() {
|
||||
entry.manual_eviction = true;
|
||||
Eviction::Manual
|
||||
} else {
|
||||
Eviction::Auto
|
||||
};
|
||||
|
||||
//Note: at this point, the dirty rectangle is local to the descriptor space
|
||||
@ -1839,9 +1707,7 @@ impl ResourceCache {
|
||||
for (_, image) in self.resources.image_templates.images.iter() {
|
||||
report.images += match image.data {
|
||||
CachedImageData::Raw(ref v) => unsafe { op(v.as_ptr() as *const c_void) },
|
||||
CachedImageData::Blob
|
||||
| CachedImageData::External(..)
|
||||
| CachedImageData::Snapshot => 0,
|
||||
CachedImageData::Blob | CachedImageData::External(..) => 0,
|
||||
}
|
||||
}
|
||||
|
||||
@ -2184,9 +2050,6 @@ impl ResourceCache {
|
||||
.unwrap();
|
||||
other_paths.insert(key, short_path);
|
||||
}
|
||||
CachedImageData::Snapshot => {
|
||||
unimplemented!();
|
||||
}
|
||||
CachedImageData::External(ref ext) => {
|
||||
let short_path = format!("externals/{}", external_images.len() + 1);
|
||||
other_paths.insert(key, short_path.clone());
|
||||
@ -2417,7 +2280,6 @@ impl ResourceCache {
|
||||
descriptor: template.descriptor,
|
||||
tiling: template.tiling,
|
||||
visible_rect: template.descriptor.size.into(),
|
||||
adjustment: AdjustedImageSource::new(), // TODO(nical)
|
||||
generation: template.generation,
|
||||
});
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
//! - backdrop filters (see add_backdrop_filter)
|
||||
//!
|
||||
|
||||
use api::{AlphaType, BorderDetails, BorderDisplayItem, BuiltDisplayList, BuiltDisplayListIter, PrimitiveFlags, SnapshotInfo};
|
||||
use api::{AlphaType, BorderDetails, BorderDisplayItem, BuiltDisplayListIter, BuiltDisplayList, PrimitiveFlags};
|
||||
use api::{ClipId, ColorF, CommonItemProperties, ComplexClipRegion, ComponentTransferFuncType, RasterSpace};
|
||||
use api::{DebugFlags, DisplayItem, DisplayItemRef, ExtendMode, ExternalScrollId, FilterData};
|
||||
use api::{FilterOp, FilterPrimitive, FontInstanceKey, FontSize, GlyphInstance, GlyphOptions, GradientStop};
|
||||
@ -152,7 +152,6 @@ pub struct CompositeOps {
|
||||
pub filters: Vec<Filter>,
|
||||
pub filter_datas: Vec<FilterData>,
|
||||
pub filter_primitives: Vec<FilterPrimitive>,
|
||||
pub snapshot: Option<SnapshotInfo>,
|
||||
|
||||
// Requires two source textures (e.g. mix-blend-mode)
|
||||
pub mix_blend_mode: Option<MixBlendMode>,
|
||||
@ -163,23 +162,20 @@ impl CompositeOps {
|
||||
filters: Vec<Filter>,
|
||||
filter_datas: Vec<FilterData>,
|
||||
filter_primitives: Vec<FilterPrimitive>,
|
||||
mix_blend_mode: Option<MixBlendMode>,
|
||||
snapshot: Option<SnapshotInfo>,
|
||||
mix_blend_mode: Option<MixBlendMode>
|
||||
) -> Self {
|
||||
CompositeOps {
|
||||
filters,
|
||||
filter_datas,
|
||||
filter_primitives,
|
||||
mix_blend_mode,
|
||||
snapshot,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.filters.is_empty() &&
|
||||
self.filter_primitives.is_empty() &&
|
||||
self.mix_blend_mode.is_none() &&
|
||||
self.snapshot.is_none()
|
||||
self.mix_blend_mode.is_none()
|
||||
}
|
||||
|
||||
/// Returns true if this CompositeOps contains any filters that affect
|
||||
@ -336,7 +332,6 @@ impl PictureChainBuilder {
|
||||
self.spatial_node_index,
|
||||
self.raster_space,
|
||||
flags,
|
||||
None,
|
||||
))
|
||||
);
|
||||
|
||||
@ -369,7 +364,6 @@ impl PictureChainBuilder {
|
||||
interners: &mut Interners,
|
||||
prim_store: &mut PrimitiveStore,
|
||||
clip_tree_builder: &mut ClipTreeBuilder,
|
||||
snapshot: Option<SnapshotInfo>,
|
||||
) -> PrimitiveInstance {
|
||||
let mut flags = PictureFlags::empty();
|
||||
if self.establishes_sub_graph {
|
||||
@ -379,9 +373,7 @@ impl PictureChainBuilder {
|
||||
match self.current {
|
||||
PictureSource::WrappedPicture { instance } => {
|
||||
let pic_index = instance.kind.as_pic();
|
||||
let picture = &mut prim_store.pictures[pic_index.0];
|
||||
picture.flags |= flags;
|
||||
picture.snapshot = snapshot;
|
||||
prim_store.pictures[pic_index.0].flags |= flags;
|
||||
|
||||
instance
|
||||
}
|
||||
@ -403,7 +395,6 @@ impl PictureChainBuilder {
|
||||
self.spatial_node_index,
|
||||
self.raster_space,
|
||||
flags,
|
||||
snapshot,
|
||||
))
|
||||
);
|
||||
|
||||
@ -946,7 +937,6 @@ impl<'a> SceneBuilder<'a> {
|
||||
filter_datas_for_compositing(item.filter_datas()),
|
||||
filter_primitives_for_compositing(item.filter_primitives()),
|
||||
info.stacking_context.mix_blend_mode_for_compositing(),
|
||||
info.snapshot,
|
||||
);
|
||||
|
||||
let sc_info = self.push_stacking_context(
|
||||
@ -2255,11 +2245,6 @@ impl<'a> SceneBuilder<'a> {
|
||||
// clip node doesn't affect the stacking context rect.
|
||||
let mut blit_reason = BlitReason::empty();
|
||||
|
||||
// Stacking context snapshots are offscreen syrfaces.
|
||||
if composite_ops.snapshot.is_some() {
|
||||
blit_reason = BlitReason::SNAPSHOT;
|
||||
}
|
||||
|
||||
// If this stacking context has any complex clips, we need to draw it
|
||||
// to an off-screen surface.
|
||||
if let Some(clip_chain_id) = clip_chain_id {
|
||||
@ -2408,7 +2393,6 @@ impl<'a> SceneBuilder<'a> {
|
||||
stacking_context.spatial_node_index,
|
||||
stacking_context.raster_space,
|
||||
PictureFlags::empty(),
|
||||
None,
|
||||
))
|
||||
);
|
||||
|
||||
@ -2453,7 +2437,6 @@ impl<'a> SceneBuilder<'a> {
|
||||
stacking_context.spatial_node_index,
|
||||
stacking_context.raster_space,
|
||||
PictureFlags::empty(),
|
||||
None,
|
||||
))
|
||||
);
|
||||
|
||||
@ -2485,7 +2468,6 @@ impl<'a> SceneBuilder<'a> {
|
||||
&mut self.interners,
|
||||
&mut self.prim_store,
|
||||
&mut self.clip_tree_builder,
|
||||
None,
|
||||
);
|
||||
|
||||
prims.push(ExtendedPrimitiveInstance {
|
||||
@ -2559,7 +2541,6 @@ impl<'a> SceneBuilder<'a> {
|
||||
stacking_context.spatial_node_index,
|
||||
stacking_context.raster_space,
|
||||
PictureFlags::empty(),
|
||||
None,
|
||||
))
|
||||
);
|
||||
|
||||
@ -2628,7 +2609,6 @@ impl<'a> SceneBuilder<'a> {
|
||||
&mut self.interners,
|
||||
&mut self.prim_store,
|
||||
&mut self.clip_tree_builder,
|
||||
stacking_context.composite_ops.snapshot,
|
||||
);
|
||||
|
||||
// The primitive instance for the remainder of flat children of this SC
|
||||
@ -3040,7 +3020,6 @@ impl<'a> SceneBuilder<'a> {
|
||||
pending_shadow.spatial_node_index,
|
||||
raster_space,
|
||||
PictureFlags::empty(),
|
||||
None,
|
||||
))
|
||||
);
|
||||
|
||||
@ -3763,7 +3742,6 @@ impl<'a> SceneBuilder<'a> {
|
||||
&mut self.interners,
|
||||
&mut self.prim_store,
|
||||
&mut self.clip_tree_builder,
|
||||
None,
|
||||
);
|
||||
|
||||
// Extract the pic index for the intermediate surface. We need to
|
||||
@ -4598,7 +4576,6 @@ impl FlattenedStackingContext {
|
||||
self.spatial_node_index,
|
||||
self.raster_space,
|
||||
PictureFlags::empty(),
|
||||
None
|
||||
))
|
||||
);
|
||||
|
||||
@ -4783,7 +4760,7 @@ fn read_gradient_stops(stops: ItemRange<GradientStop>) -> Vec<GradientStopKey> {
|
||||
|
||||
/// A helper for reusing the scene builder's memory allocations and dropping
|
||||
/// scene allocations on the scene builder thread to avoid lock contention in
|
||||
/// jemalloc.
|
||||
/// jemalloc.
|
||||
pub struct SceneRecycler {
|
||||
pub tx: Sender<BuiltScene>,
|
||||
rx: Receiver<BuiltScene>,
|
||||
@ -4852,7 +4829,7 @@ impl SceneRecycler {
|
||||
self.clip_store = scene.clip_store;
|
||||
// We currently retain top-level allocations but don't attempt to retain leaf
|
||||
// allocations in the prim store and clip store. We don't have to reset it here
|
||||
// but doing so avoids dropping the leaf allocations in the
|
||||
// but doing so avoids dropping the leaf allocations in the
|
||||
self.prim_store.reset();
|
||||
self.clip_store.reset();
|
||||
self.hit_testing_scene = Arc::try_unwrap(scene.hit_testing_scene).ok();
|
||||
|
@ -1574,9 +1574,6 @@ impl TextureCacheUpdate {
|
||||
dirty_rect: &ImageDirtyRect,
|
||||
) -> TextureCacheUpdate {
|
||||
let source = match data {
|
||||
CachedImageData::Snapshot => {
|
||||
panic!("Snapshots should not do texture uploads");
|
||||
}
|
||||
CachedImageData::Blob => {
|
||||
panic!("The vector image should have been rasterized.");
|
||||
}
|
||||
|
@ -638,7 +638,6 @@ fn create_tile_cache(
|
||||
scroll_root,
|
||||
RasterSpace::Screen,
|
||||
PictureFlags::empty(),
|
||||
None,
|
||||
));
|
||||
|
||||
tile_cache_pictures.push(PictureIndex(pic_index));
|
||||
|
@ -6,7 +6,7 @@ use euclid::{SideOffsets2D, Angle};
|
||||
use peek_poke::PeekPoke;
|
||||
use std::ops::Not;
|
||||
// local imports
|
||||
use crate::{font, SnapshotImageKey};
|
||||
use crate::font;
|
||||
use crate::{APZScrollGeneration, HasScrollLinkedEffect, PipelineId, PropertyBinding};
|
||||
use crate::serde::{Serialize, Deserialize};
|
||||
use crate::color::ColorF;
|
||||
@ -876,17 +876,10 @@ pub struct ReferenceFrame {
|
||||
pub key: SpatialTreeItemKey,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)]
|
||||
pub struct SnapshotInfo {
|
||||
pub key: SnapshotImageKey,
|
||||
pub area: LayoutRect,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)]
|
||||
pub struct PushStackingContextDisplayItem {
|
||||
pub origin: LayoutPoint,
|
||||
pub spatial_id: SpatialId,
|
||||
pub snapshot: Option<SnapshotInfo>,
|
||||
pub prim_flags: PrimitiveFlags,
|
||||
pub ref_frame_offset: LayoutVector2D,
|
||||
pub stacking_context: StackingContext,
|
||||
|
@ -1795,7 +1795,6 @@ impl DisplayListBuilder {
|
||||
filter_primitives: &[di::FilterPrimitive],
|
||||
raster_space: di::RasterSpace,
|
||||
flags: di::StackingContextFlags,
|
||||
snapshot: Option<di::SnapshotInfo>
|
||||
) {
|
||||
let ref_frame_offset = self.rf_mapper.current_offset();
|
||||
self.push_filters(filters, filter_datas, filter_primitives);
|
||||
@ -1803,7 +1802,6 @@ impl DisplayListBuilder {
|
||||
let item = di::DisplayItem::PushStackingContext(di::PushStackingContextDisplayItem {
|
||||
origin,
|
||||
spatial_id,
|
||||
snapshot,
|
||||
prim_flags,
|
||||
ref_frame_offset,
|
||||
stacking_context: di::StackingContext {
|
||||
@ -1858,7 +1856,6 @@ impl DisplayListBuilder {
|
||||
filter_primitives,
|
||||
di::RasterSpace::Screen,
|
||||
di::StackingContextFlags::empty(),
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -54,26 +54,6 @@ impl BlobImageKey {
|
||||
}
|
||||
}
|
||||
|
||||
/// An opaque identifier describing a snapshot image registered with WebRender.
|
||||
/// This is used as a handle to reference snapshot images, and can be used as an
|
||||
/// image in display items.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize, PeekPoke)]
|
||||
pub struct SnapshotImageKey(pub ImageKey);
|
||||
|
||||
impl SnapshotImageKey {
|
||||
/// Interpret this snapshot image as an image for a display item.
|
||||
pub fn as_image(self) -> ImageKey {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for SnapshotImageKey {
|
||||
fn default() -> Self {
|
||||
SnapshotImageKey(ImageKey::DUMMY)
|
||||
}
|
||||
}
|
||||
|
||||
/// An arbitrary identifier for an external image provided by the
|
||||
/// application. It must be a unique identifier for each external
|
||||
/// image.
|
||||
|
@ -17,4 +17,3 @@ fuzzy(1,160000) == image-alpha-stretch.yaml green-alpha-ref.yaml
|
||||
fuzzy(1,160000) == image-alpha-stretch-tile.yaml green-alpha-ref.yaml
|
||||
fuzzy(1,160000) == image-filter-stretch.yaml green-alpha-ref.yaml
|
||||
fuzzy(1,160000) == image-filter-stretch-tile.yaml green-alpha-ref.yaml
|
||||
== snapshot-area-01.yaml snapshot-area-01-ref.yaml
|
@ -1,33 +0,0 @@
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: stacking-context
|
||||
bounds: [0, 0, 100, 100]
|
||||
items:
|
||||
- type: rect
|
||||
bounds: [ 0, 0, 90, 100 ]
|
||||
color: [0, 150, 0]
|
||||
- type: rect
|
||||
bounds: [ 10, 100, 90, 100 ]
|
||||
color: [150, 0, 0]
|
||||
|
||||
- type: rect
|
||||
bounds: [ 0, 300, 90, 100 ]
|
||||
color: [0, 150, 0]
|
||||
- type: rect
|
||||
bounds: [ 10, 400, 90, 100 ]
|
||||
color: [150, 0, 0]
|
||||
|
||||
- type: rect
|
||||
bounds: [310, 10, 80, 90 ]
|
||||
color: [0, 150, 0]
|
||||
- type: rect
|
||||
bounds: [310, 100, 80, 90 ]
|
||||
color: [150, 0, 0]
|
||||
|
||||
- type: rect
|
||||
bounds: [300, 300, 90, 100 ]
|
||||
color: [0, 150, 0]
|
||||
- type: rect
|
||||
bounds: [310, 400, 90, 100 ]
|
||||
color: [150, 0, 0]
|
@ -1,44 +0,0 @@
|
||||
---
|
||||
root:
|
||||
items:
|
||||
- type: stacking-context
|
||||
bounds: [0, 0, 100, 100]
|
||||
items:
|
||||
# Stacking context snapshotted as "snap0".
|
||||
# Note that the snapshot area is smaller than
|
||||
# the bounds of the stacking context.
|
||||
- type: stacking-context
|
||||
bounds: [0, 0, 200, 200]
|
||||
snapshot:
|
||||
name: "snap0"
|
||||
area: [10, 10, 80, 180]
|
||||
items:
|
||||
- type: rect
|
||||
bounds: [ 0, 0, 90, 100 ]
|
||||
color: [0, 150, 0]
|
||||
- type: rect
|
||||
bounds: [ 10, 100, 90, 100 ]
|
||||
color: [150, 0, 0]
|
||||
# Stacking context snapshotted as "snap1".
|
||||
# Note that the snapshot area is larger than
|
||||
# the bounds of the stacking context.
|
||||
- type: stacking-context
|
||||
bounds: [0, 300, 200, 200]
|
||||
snapshot:
|
||||
name: "snap1"
|
||||
area: [-10, 290, 120, 220]
|
||||
items:
|
||||
- type: rect
|
||||
bounds: [ 0, 0, 90, 100 ]
|
||||
color: [0, 150, 0]
|
||||
- type: rect
|
||||
bounds: [ 10, 100, 90, 100 ]
|
||||
color: [150, 0, 0]
|
||||
# Show the two stacking contexts again, as images.
|
||||
# The sizes of the images are match the snapshot areas
|
||||
# to avoid stretching.
|
||||
- image: snapshot(snap0)
|
||||
bounds: [310, 10, 80, 180]
|
||||
|
||||
- image: snapshot(snap1)
|
||||
bounds: [290, 290, 120, 220]
|
@ -312,11 +312,6 @@ fn is_image_opaque(format: ImageFormat, bytes: &[u8]) -> bool {
|
||||
|
||||
struct IsRoot(bool);
|
||||
|
||||
pub struct Snapshot {
|
||||
key: SnapshotImageKey,
|
||||
size: LayoutSize,
|
||||
}
|
||||
|
||||
pub struct YamlFrameReader {
|
||||
yaml_path: PathBuf,
|
||||
aux_dir: PathBuf,
|
||||
@ -337,7 +332,6 @@ pub struct YamlFrameReader {
|
||||
fonts: HashMap<FontDescriptor, FontKey>,
|
||||
font_instances: HashMap<(FontKey, FontSize, FontInstanceFlags, SyntheticItalics), FontInstanceKey>,
|
||||
font_render_mode: Option<FontRenderMode>,
|
||||
snapshots: HashMap<String, Snapshot>,
|
||||
allow_mipmaps: bool,
|
||||
|
||||
/// A HashMap that allows specifying a numeric id for clip and clip chains in YAML
|
||||
@ -372,7 +366,6 @@ impl YamlFrameReader {
|
||||
fonts: HashMap::new(),
|
||||
font_instances: HashMap::new(),
|
||||
font_render_mode: None,
|
||||
snapshots: HashMap::new(),
|
||||
allow_mipmaps: false,
|
||||
image_map: HashMap::new(),
|
||||
user_clip_id_map: HashMap::new(),
|
||||
@ -673,15 +666,6 @@ impl YamlFrameReader {
|
||||
kind,
|
||||
)
|
||||
}
|
||||
("snapshot", args, _) => {
|
||||
let snapshot = self.snapshots
|
||||
.get(args[0])
|
||||
.expect("Missing snapshot");
|
||||
return (
|
||||
snapshot.key.as_image(),
|
||||
snapshot.size,
|
||||
);
|
||||
}
|
||||
_ => {
|
||||
panic!("Failed to load image {:?}", file.to_str());
|
||||
}
|
||||
@ -1302,7 +1286,6 @@ impl YamlFrameReader {
|
||||
"src"
|
||||
}];
|
||||
let tiling = item["tile-size"].as_i64();
|
||||
|
||||
let file = rsrc_path(filename, &self.aux_dir);
|
||||
let (image_key, image_dims) =
|
||||
self.add_or_get_image(&file, tiling, item, wrench);
|
||||
@ -2037,26 +2020,6 @@ impl YamlFrameReader {
|
||||
let filter_datas = yaml["filter-datas"].as_vec_filter_data().unwrap_or_default();
|
||||
let filter_primitives = yaml["filter-primitives"].as_vec_filter_primitive().unwrap_or_default();
|
||||
|
||||
let snapshot = if !yaml["snapshot"].is_badvalue() {
|
||||
let yaml = &yaml["snapshot"];
|
||||
let name = yaml["name"].as_str().unwrap_or("snapshot");
|
||||
let area = yaml["area"].as_rect().unwrap_or(bounds);
|
||||
|
||||
let key = SnapshotImageKey(wrench.api.generate_image_key());
|
||||
self.snapshots.insert(name.to_string(), Snapshot {
|
||||
key,
|
||||
size: bounds.size(),
|
||||
});
|
||||
|
||||
let mut txn = Transaction::new();
|
||||
txn.add_snapshot_image(key);
|
||||
wrench.api.send_transaction(wrench.document_id, txn);
|
||||
|
||||
Some(SnapshotInfo { key, area })
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let mut flags = StackingContextFlags::empty();
|
||||
flags.set(StackingContextFlags::IS_BLEND_CONTAINER, is_blend_container);
|
||||
flags.set(StackingContextFlags::WRAPS_BACKDROP_FILTER, wraps_backdrop_filter);
|
||||
@ -2073,7 +2036,6 @@ impl YamlFrameReader {
|
||||
&filter_primitives,
|
||||
raster_space,
|
||||
flags,
|
||||
snapshot,
|
||||
);
|
||||
|
||||
if let Some(yaml_items) = yaml["items"].as_vec() {
|
||||
|
Loading…
Reference in New Issue
Block a user