Backed out 5 changesets (bug 1921980) for causing Linux wrench bustages. CLOSED TREE
Backed out changeset 70ae923fd74b (bug 1921980) Backed out changeset ae3fdc5495a6 (bug 1921980) Backed out changeset 53119e779c89 (bug 1921980) Backed out changeset f4ad9697fb5d (bug 1921980) Backed out changeset e4f2f5ea2563 (bug 1921980)
This commit is contained in:
@@ -1059,14 +1059,6 @@ void TransactionBuilder::DeleteBlobImage(BlobImageKey aKey) {
|
|||||||
wr_resource_updates_delete_blob_image(mTxn, 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,
|
void TransactionBuilder::AddRawFont(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes,
|
||||||
uint32_t aIndex) {
|
uint32_t aIndex) {
|
||||||
wr_resource_updates_add_raw_font(mTxn, aKey, &aBytes.inner, 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 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 AddRawFont(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes, uint32_t aIndex);
|
||||||
|
|
||||||
void AddFontDescriptor(wr::FontKey aKey, wr::Vec<uint8_t>& aBytes,
|
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);
|
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]
|
#[no_mangle]
|
||||||
pub extern "C" fn wr_api_send_transaction(dh: &mut DocumentHandle, transaction: &mut Transaction, is_async: bool) {
|
pub extern "C" fn wr_api_send_transaction(dh: &mut DocumentHandle, transaction: &mut Transaction, is_async: bool) {
|
||||||
if transaction.is_empty() {
|
if transaction.is_empty() {
|
||||||
@@ -2804,7 +2789,6 @@ pub extern "C" fn wr_dp_push_stacking_context(
|
|||||||
&[],
|
&[],
|
||||||
glyph_raster_space,
|
glyph_raster_space,
|
||||||
params.flags,
|
params.flags,
|
||||||
None, // TODO(nical)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|||||||
@@ -2569,13 +2569,9 @@ impl BatchBuilder {
|
|||||||
(gpu_cache.get_address(&segment_instance.gpu_cache_handle), segments)
|
(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 {
|
let prim_header = PrimitiveHeader {
|
||||||
local_rect,
|
local_rect: prim_rect,
|
||||||
local_clip_rect,
|
local_clip_rect: prim_info.clip_chain.local_clip_rect,
|
||||||
specific_prim_address: prim_cache_address,
|
specific_prim_address: prim_cache_address,
|
||||||
transform_id,
|
transform_id,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use std::hash;
|
use std::{hash};
|
||||||
use crate::gpu_cache::{GpuCache, GpuCacheHandle};
|
use crate::gpu_cache::{GpuCacheHandle};
|
||||||
|
use crate::frame_builder::FrameBuildingState;
|
||||||
use crate::gpu_cache::GpuDataRequest;
|
use crate::gpu_cache::GpuDataRequest;
|
||||||
use crate::intern;
|
use crate::intern;
|
||||||
use api::ComponentTransferFuncType;
|
use api::{ComponentTransferFuncType};
|
||||||
|
|
||||||
|
|
||||||
pub type FilterDataHandle = intern::Handle<FilterDataIntern>;
|
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).
|
/// done if the cache entry is invalid (due to first use or eviction).
|
||||||
pub fn update(
|
pub fn update(
|
||||||
&mut self,
|
&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);
|
self.data.update(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,13 +94,12 @@
|
|||||||
//! blend the overlay tile (this is not always optimal right now, but will be
|
//! blend the overlay tile (this is not always optimal right now, but will be
|
||||||
//! improved as a follow up).
|
//! 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::{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::{ImageRendering, ColorDepth, YuvRangedColorSpace, YuvFormat, AlphaType};
|
||||||
use api::units::*;
|
use api::units::*;
|
||||||
use crate::prim_store::image::AdjustedImageSource;
|
use crate::command_buffer::PrimitiveCommand;
|
||||||
use crate::{command_buffer::PrimitiveCommand, render_task_graph::RenderTaskGraphBuilder, renderer::GpuBufferBuilderF};
|
|
||||||
use crate::box_shadow::BLUR_SAMPLE_SCALE;
|
use crate::box_shadow::BLUR_SAMPLE_SCALE;
|
||||||
use crate::clip::{ClipStore, ClipChainInstance, ClipLeafId, ClipNodeId, ClipTreeBuilder};
|
use crate::clip::{ClipStore, ClipChainInstance, ClipLeafId, ClipNodeId, ClipTreeBuilder};
|
||||||
use crate::profiler::{self, TransactionProfile};
|
use crate::profiler::{self, TransactionProfile};
|
||||||
@@ -3534,7 +3533,7 @@ impl TileCacheInstance {
|
|||||||
PrimitiveInstanceKind::TextRun { .. } => {
|
PrimitiveInstanceKind::TextRun { .. } => {
|
||||||
// These don't contribute dependencies
|
// These don't contribute dependencies
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.maybe_report_promotion_failure(promotion_result, pic_coverage_rect, &mut promotion_failure_reported);
|
self.maybe_report_promotion_failure(promotion_result, pic_coverage_rect, &mut promotion_failure_reported);
|
||||||
|
|
||||||
@@ -4210,8 +4209,6 @@ bitflags! {
|
|||||||
const PRESERVE3D = 4;
|
const PRESERVE3D = 4;
|
||||||
/// A backdrop that is reused which requires a surface.
|
/// A backdrop that is reused which requires a surface.
|
||||||
const BACKDROP = 8;
|
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
|
/// picture, to be ignored when clipping those primitives and applied
|
||||||
/// later when compositing the picture.
|
/// later when compositing the picture.
|
||||||
pub clip_root: Option<ClipNodeId>,
|
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 {
|
impl PicturePrimitive {
|
||||||
@@ -5139,7 +5132,6 @@ impl PicturePrimitive {
|
|||||||
spatial_node_index: SpatialNodeIndex,
|
spatial_node_index: SpatialNodeIndex,
|
||||||
raster_space: RasterSpace,
|
raster_space: RasterSpace,
|
||||||
flags: PictureFlags,
|
flags: PictureFlags,
|
||||||
snapshot: Option<SnapshotInfo>,
|
|
||||||
) -> Self {
|
) -> Self {
|
||||||
PicturePrimitive {
|
PicturePrimitive {
|
||||||
prim_list,
|
prim_list,
|
||||||
@@ -5157,7 +5149,6 @@ impl PicturePrimitive {
|
|||||||
raster_space,
|
raster_space,
|
||||||
flags,
|
flags,
|
||||||
clip_root: None,
|
clip_root: None,
|
||||||
snapshot,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5920,23 +5911,15 @@ impl PicturePrimitive {
|
|||||||
).with_uv_rect_kind(uv_rect_kind)
|
).with_uv_rect_kind(uv_rect_kind)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let blur_render_task_id = RenderTask::new_blur(
|
||||||
let blur_render_task_id = request_render_task(
|
blur_std_deviation,
|
||||||
frame_state,
|
picture_task_id,
|
||||||
&self.snapshot,
|
frame_state.rg_builder,
|
||||||
&surface_rects,
|
RenderTargetKind::Color,
|
||||||
false,
|
None,
|
||||||
&mut|rg_builder, _, _| {
|
original_size.to_i32(),
|
||||||
RenderTask::new_blur(
|
|
||||||
blur_std_deviation,
|
|
||||||
picture_task_id,
|
|
||||||
rg_builder,
|
|
||||||
RenderTargetKind::Color,
|
|
||||||
None,
|
|
||||||
original_size.to_i32(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
primary_render_task_id = blur_render_task_id;
|
primary_render_task_id = blur_render_task_id;
|
||||||
|
|
||||||
surface_descriptor = SurfaceDescriptor::new_chained(
|
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
|
// 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.
|
// 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);
|
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 cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
||||||
|
|
||||||
let is_opaque = false; // TODO
|
let render_task_id = frame_state.rg_builder.add().init(
|
||||||
let render_task_id = request_render_task(
|
RenderTask::new_dynamic(
|
||||||
frame_state,
|
task_size,
|
||||||
&self.snapshot,
|
RenderTaskKind::new_picture(
|
||||||
&surface_rects,
|
task_size,
|
||||||
is_opaque,
|
surface_rects.needs_scissor_rect,
|
||||||
&mut|rg_builder, _, _| {
|
surface_rects.clipped.min,
|
||||||
rg_builder.add().init(
|
surface_spatial_node_index,
|
||||||
RenderTask::new_dynamic(
|
raster_spatial_node_index,
|
||||||
task_size,
|
device_pixel_scale,
|
||||||
RenderTaskKind::new_picture(
|
None,
|
||||||
task_size,
|
None,
|
||||||
surface_rects.needs_scissor_rect,
|
None,
|
||||||
surface_rects.clipped.min,
|
cmd_buffer_index,
|
||||||
surface_spatial_node_index,
|
can_use_shared_surface,
|
||||||
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)
|
|
||||||
)
|
)
|
||||||
}
|
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||||
);
|
);
|
||||||
|
|
||||||
primary_render_task_id = render_task_id;
|
primary_render_task_id = render_task_id;
|
||||||
@@ -6132,32 +6104,23 @@ impl PicturePrimitive {
|
|||||||
PictureCompositeMode::Filter(..) => {
|
PictureCompositeMode::Filter(..) => {
|
||||||
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
||||||
|
|
||||||
let is_opaque = false; // TODO
|
let render_task_id = frame_state.rg_builder.add().init(
|
||||||
let render_task_id = request_render_task(
|
RenderTask::new_dynamic(
|
||||||
frame_state,
|
surface_rects.task_size,
|
||||||
&self.snapshot,
|
RenderTaskKind::new_picture(
|
||||||
&surface_rects,
|
surface_rects.task_size,
|
||||||
is_opaque,
|
surface_rects.needs_scissor_rect,
|
||||||
&mut|rg_builder, _, _| {
|
surface_rects.clipped.min,
|
||||||
rg_builder.add().init(
|
surface_spatial_node_index,
|
||||||
RenderTask::new_dynamic(
|
raster_spatial_node_index,
|
||||||
surface_rects.task_size,
|
device_pixel_scale,
|
||||||
RenderTaskKind::new_picture(
|
None,
|
||||||
surface_rects.task_size,
|
None,
|
||||||
surface_rects.needs_scissor_rect,
|
None,
|
||||||
surface_rects.clipped.min,
|
cmd_buffer_index,
|
||||||
surface_spatial_node_index,
|
can_use_shared_surface,
|
||||||
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)
|
|
||||||
)
|
)
|
||||||
},
|
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||||
);
|
);
|
||||||
|
|
||||||
primary_render_task_id = render_task_id;
|
primary_render_task_id = render_task_id;
|
||||||
@@ -6170,32 +6133,23 @@ impl PicturePrimitive {
|
|||||||
PictureCompositeMode::ComponentTransferFilter(..) => {
|
PictureCompositeMode::ComponentTransferFilter(..) => {
|
||||||
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
||||||
|
|
||||||
let is_opaque = false; // TODO
|
let render_task_id = frame_state.rg_builder.add().init(
|
||||||
let render_task_id = request_render_task(
|
RenderTask::new_dynamic(
|
||||||
frame_state,
|
surface_rects.task_size,
|
||||||
&self.snapshot,
|
RenderTaskKind::new_picture(
|
||||||
&surface_rects,
|
surface_rects.task_size,
|
||||||
is_opaque,
|
surface_rects.needs_scissor_rect,
|
||||||
&mut|rg_builder, _, _| {
|
surface_rects.clipped.min,
|
||||||
rg_builder.add().init(
|
surface_spatial_node_index,
|
||||||
RenderTask::new_dynamic(
|
raster_spatial_node_index,
|
||||||
surface_rects.task_size,
|
device_pixel_scale,
|
||||||
RenderTaskKind::new_picture(
|
None,
|
||||||
surface_rects.task_size,
|
None,
|
||||||
surface_rects.needs_scissor_rect,
|
None,
|
||||||
surface_rects.clipped.min,
|
cmd_buffer_index,
|
||||||
surface_spatial_node_index,
|
can_use_shared_surface,
|
||||||
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)
|
|
||||||
)
|
)
|
||||||
}
|
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||||
);
|
);
|
||||||
|
|
||||||
primary_render_task_id = render_task_id;
|
primary_render_task_id = render_task_id;
|
||||||
@@ -6209,32 +6163,23 @@ impl PicturePrimitive {
|
|||||||
PictureCompositeMode::Blit(_) => {
|
PictureCompositeMode::Blit(_) => {
|
||||||
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
||||||
|
|
||||||
let is_opaque = false; // TODO
|
let render_task_id = frame_state.rg_builder.add().init(
|
||||||
let render_task_id = request_render_task(
|
RenderTask::new_dynamic(
|
||||||
frame_state,
|
surface_rects.task_size,
|
||||||
&self.snapshot,
|
RenderTaskKind::new_picture(
|
||||||
&surface_rects,
|
surface_rects.task_size,
|
||||||
is_opaque,
|
surface_rects.needs_scissor_rect,
|
||||||
&mut|rg_builder, _, _| {
|
surface_rects.clipped.min,
|
||||||
rg_builder.add().init(
|
surface_spatial_node_index,
|
||||||
RenderTask::new_dynamic(
|
raster_spatial_node_index,
|
||||||
surface_rects.task_size,
|
device_pixel_scale,
|
||||||
RenderTaskKind::new_picture(
|
None,
|
||||||
surface_rects.task_size,
|
None,
|
||||||
surface_rects.needs_scissor_rect,
|
None,
|
||||||
surface_rects.clipped.min,
|
cmd_buffer_index,
|
||||||
surface_spatial_node_index,
|
can_use_shared_surface,
|
||||||
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)
|
|
||||||
)
|
)
|
||||||
}
|
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||||
);
|
);
|
||||||
|
|
||||||
primary_render_task_id = render_task_id;
|
primary_render_task_id = render_task_id;
|
||||||
@@ -6253,32 +6198,23 @@ impl PicturePrimitive {
|
|||||||
// match cases (they used to be quite different).
|
// match cases (they used to be quite different).
|
||||||
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
let cmd_buffer_index = frame_state.cmd_buffers.create_cmd_buffer();
|
||||||
|
|
||||||
let is_opaque = false; // TODO
|
let render_task_id = frame_state.rg_builder.add().init(
|
||||||
let render_task_id = request_render_task(
|
RenderTask::new_dynamic(
|
||||||
frame_state,
|
surface_rects.task_size,
|
||||||
&self.snapshot,
|
RenderTaskKind::new_picture(
|
||||||
&surface_rects,
|
surface_rects.task_size,
|
||||||
is_opaque,
|
surface_rects.needs_scissor_rect,
|
||||||
&mut|rg_builder, _, _| {
|
surface_rects.clipped.min,
|
||||||
rg_builder.add().init(
|
surface_spatial_node_index,
|
||||||
RenderTask::new_dynamic(
|
raster_spatial_node_index,
|
||||||
surface_rects.task_size,
|
device_pixel_scale,
|
||||||
RenderTaskKind::new_picture(
|
None,
|
||||||
surface_rects.task_size,
|
None,
|
||||||
surface_rects.needs_scissor_rect,
|
None,
|
||||||
surface_rects.clipped.min,
|
cmd_buffer_index,
|
||||||
surface_spatial_node_index,
|
can_use_shared_surface,
|
||||||
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)
|
|
||||||
)
|
)
|
||||||
}
|
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||||
);
|
);
|
||||||
|
|
||||||
primary_render_task_id = render_task_id;
|
primary_render_task_id = render_task_id;
|
||||||
@@ -6310,23 +6246,14 @@ impl PicturePrimitive {
|
|||||||
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
).with_uv_rect_kind(surface_rects.uv_rect_kind)
|
||||||
);
|
);
|
||||||
|
|
||||||
let is_opaque = false; // TODO
|
let filter_task_id = RenderTask::new_svg_filter(
|
||||||
let filter_task_id = request_render_task(
|
primitives,
|
||||||
frame_state,
|
filter_datas,
|
||||||
&self.snapshot,
|
frame_state.rg_builder,
|
||||||
&surface_rects,
|
surface_rects.clipped.size().to_i32(),
|
||||||
is_opaque,
|
surface_rects.uv_rect_kind,
|
||||||
&mut|rg_builder, _, _| {
|
picture_task_id,
|
||||||
RenderTask::new_svg_filter(
|
device_pixel_scale,
|
||||||
primitives,
|
|
||||||
filter_datas,
|
|
||||||
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;
|
primary_render_task_id = filter_task_id;
|
||||||
@@ -6377,26 +6304,17 @@ impl PicturePrimitive {
|
|||||||
|
|
||||||
// Produce the target pixels, this is the result of the
|
// Produce the target pixels, this is the result of the
|
||||||
// composite op
|
// composite op
|
||||||
let filter_task_id = request_render_task(
|
let filter_task_id = RenderTask::new_svg_filter_graph(
|
||||||
|
filters,
|
||||||
frame_state,
|
frame_state,
|
||||||
&self.snapshot,
|
data_stores,
|
||||||
&surface_rects,
|
surface_rects.uv_rect_kind,
|
||||||
false,
|
picture_task_id,
|
||||||
&mut|rg_builder, _, gpu_cache| {
|
source_subregion.cast_unit(),
|
||||||
RenderTask::new_svg_filter_graph(
|
target_subregion.cast_unit(),
|
||||||
filters,
|
prim_subregion.cast_unit(),
|
||||||
rg_builder,
|
surface_rects.clipped.cast_unit(),
|
||||||
gpu_cache,
|
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;
|
primary_render_task_id = filter_task_id;
|
||||||
@@ -7081,7 +6999,7 @@ impl PicturePrimitive {
|
|||||||
}
|
}
|
||||||
PictureCompositeMode::ComponentTransferFilter(handle) => {
|
PictureCompositeMode::ComponentTransferFilter(handle) => {
|
||||||
let filter_data = &mut data_stores.filter_data[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::MixBlend(..) |
|
||||||
PictureCompositeMode::Blit(_) |
|
PictureCompositeMode::Blit(_) |
|
||||||
@@ -7093,7 +7011,7 @@ impl PicturePrimitive {
|
|||||||
match op {
|
match op {
|
||||||
FilterGraphOp::SVGFEComponentTransferInterned { handle, creates_pixels: _ } => {
|
FilterGraphOp::SVGFEComponentTransferInterned { handle, creates_pixels: _ } => {
|
||||||
let filter_data = &mut data_stores.filter_data[*handle];
|
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,
|
thickness,
|
||||||
color,
|
color,
|
||||||
ColorF::TRANSPARENT,
|
ColorF::TRANSPARENT,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7526,7 +7444,7 @@ impl TileNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calculate the four child rects for a given node
|
/// Calculate the four child rects for a given node
|
||||||
fn get_child_rects(
|
fn get_child_rects(
|
||||||
rect: &PictureBox2D,
|
rect: &PictureBox2D,
|
||||||
@@ -8324,51 +8242,3 @@ fn test_drop_filter_dirty_region_outside_prim() {
|
|||||||
).expect("No surface rect");
|
).expect("No surface rect");
|
||||||
assert_eq!(info.task_size, DeviceIntSize::new(432, 578));
|
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()
|
|
||||||
);
|
|
||||||
let task_id = 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
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO(bug 1929809): adding the dependency in the other branch causes
|
|
||||||
// a panic in reftests/blend/backdrop-filter-blend-container.yaml.
|
|
||||||
// Presumably if we use backdrop filters with snapshotting it will
|
|
||||||
// trigger the panic as well.
|
|
||||||
frame_state.surface_builder.add_child_render_task(
|
|
||||||
task_id,
|
|
||||||
frame_state.rg_builder,
|
|
||||||
);
|
|
||||||
|
|
||||||
task_id
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
f(
|
|
||||||
frame_state.rg_builder,
|
|
||||||
&mut frame_state.frame_gpu_data.f32,
|
|
||||||
frame_state.gpu_cache
|
|
||||||
)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
task_id
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ fn prepare_interned_prim_for_render(
|
|||||||
&mut frame_state.frame_gpu_data.f32,
|
&mut frame_state.frame_gpu_data.f32,
|
||||||
frame_state.rg_builder,
|
frame_state.rg_builder,
|
||||||
&mut frame_state.surface_builder,
|
&mut frame_state.surface_builder,
|
||||||
&mut |rg_builder, _, _| {
|
&mut |rg_builder, _| {
|
||||||
rg_builder.add().init(RenderTask::new_dynamic(
|
rg_builder.add().init(RenderTask::new_dynamic(
|
||||||
task_size,
|
task_size,
|
||||||
RenderTaskKind::new_line_decoration(
|
RenderTaskKind::new_line_decoration(
|
||||||
@@ -567,7 +567,7 @@ fn prepare_interned_prim_for_render(
|
|||||||
&mut frame_state.frame_gpu_data.f32,
|
&mut frame_state.frame_gpu_data.f32,
|
||||||
frame_state.rg_builder,
|
frame_state.rg_builder,
|
||||||
&mut frame_state.surface_builder,
|
&mut frame_state.surface_builder,
|
||||||
&mut |rg_builder, _, _| {
|
&mut |rg_builder, _| {
|
||||||
rg_builder.add().init(RenderTask::new_dynamic(
|
rg_builder.add().init(RenderTask::new_dynamic(
|
||||||
cache_size,
|
cache_size,
|
||||||
RenderTaskKind::new_border_segment(
|
RenderTaskKind::new_border_segment(
|
||||||
@@ -718,7 +718,7 @@ fn prepare_interned_prim_for_render(
|
|||||||
&mut scratch.segments,
|
&mut scratch.segments,
|
||||||
&mut scratch.segment_instances,
|
&mut scratch.segment_instances,
|
||||||
|request| {
|
|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,
|
&mut frame_state.frame_gpu_data.f32,
|
||||||
frame_state.rg_builder,
|
frame_state.rg_builder,
|
||||||
&mut frame_state.surface_builder,
|
&mut frame_state.surface_builder,
|
||||||
&mut |rg_builder, gpu_buffer_builder, _| {
|
&mut |rg_builder, gpu_buffer_builder| {
|
||||||
let stops = GradientGpuBlockBuilder::build(
|
let stops = GradientGpuBlockBuilder::build(
|
||||||
false,
|
false,
|
||||||
gpu_buffer_builder,
|
gpu_buffer_builder,
|
||||||
|
|||||||
@@ -525,7 +525,7 @@ impl LinearGradientTemplate {
|
|||||||
&mut frame_state.frame_gpu_data.f32,
|
&mut frame_state.frame_gpu_data.f32,
|
||||||
frame_state.rg_builder,
|
frame_state.rg_builder,
|
||||||
&mut frame_state.surface_builder,
|
&mut frame_state.surface_builder,
|
||||||
&mut |rg_builder, _, _| {
|
&mut |rg_builder, _| {
|
||||||
rg_builder.add().init(RenderTask::new_dynamic(
|
rg_builder.add().init(RenderTask::new_dynamic(
|
||||||
self.task_size,
|
self.task_size,
|
||||||
RenderTaskKind::FastLinearGradient(gradient),
|
RenderTaskKind::FastLinearGradient(gradient),
|
||||||
@@ -554,7 +554,7 @@ impl LinearGradientTemplate {
|
|||||||
&mut frame_state.frame_gpu_data.f32,
|
&mut frame_state.frame_gpu_data.f32,
|
||||||
frame_state.rg_builder,
|
frame_state.rg_builder,
|
||||||
&mut frame_state.surface_builder,
|
&mut frame_state.surface_builder,
|
||||||
&mut |rg_builder, gpu_buffer_builder, _| {
|
&mut |rg_builder, gpu_buffer_builder| {
|
||||||
let stops = Some(GradientGpuBlockBuilder::build(
|
let stops = Some(GradientGpuBlockBuilder::build(
|
||||||
self.reverse_stops,
|
self.reverse_stops,
|
||||||
gpu_buffer_builder,
|
gpu_buffer_builder,
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ impl RadialGradientTemplate {
|
|||||||
&mut frame_state.frame_gpu_data.f32,
|
&mut frame_state.frame_gpu_data.f32,
|
||||||
frame_state.rg_builder,
|
frame_state.rg_builder,
|
||||||
&mut frame_state.surface_builder,
|
&mut frame_state.surface_builder,
|
||||||
&mut |rg_builder, gpu_buffer_builder, _| {
|
&mut |rg_builder, gpu_buffer_builder| {
|
||||||
let stops = GradientGpuBlockBuilder::build(
|
let stops = GradientGpuBlockBuilder::build(
|
||||||
false,
|
false,
|
||||||
gpu_buffer_builder,
|
gpu_buffer_builder,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use api::{
|
|||||||
RasterSpace, Shadow, YuvColorSpace, ColorRange, YuvFormat,
|
RasterSpace, Shadow, YuvColorSpace, ColorRange, YuvFormat,
|
||||||
};
|
};
|
||||||
use api::units::*;
|
use api::units::*;
|
||||||
use euclid::point2;
|
|
||||||
use crate::composite::CompositorSurfaceKind;
|
use crate::composite::CompositorSurfaceKind;
|
||||||
use crate::scene_building::{CreateShadow, IsVisible};
|
use crate::scene_building::{CreateShadow, IsVisible};
|
||||||
use crate::frame_builder::{FrameBuildingContext, FrameBuildingState};
|
use crate::frame_builder::{FrameBuildingContext, FrameBuildingState};
|
||||||
@@ -73,7 +72,6 @@ pub struct ImageInstance {
|
|||||||
pub visible_tiles: Vec<VisibleImageTile>,
|
pub visible_tiles: Vec<VisibleImageTile>,
|
||||||
pub src_color: Option<RenderTaskId>,
|
pub src_color: Option<RenderTaskId>,
|
||||||
pub normalized_uvs: bool,
|
pub normalized_uvs: bool,
|
||||||
pub adjustment: AdjustedImageSource,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature = "capture", derive(Serialize))]
|
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||||
@@ -171,25 +169,9 @@ impl ImageData {
|
|||||||
tile: None,
|
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 {
|
match image_properties {
|
||||||
// Non-tiled (most common) path.
|
// Non-tiled (most common) path.
|
||||||
Some(ImageProperties { tiling: None, ref descriptor, ref external_image, adjustment, .. }) => {
|
Some(ImageProperties { tiling: None, ref descriptor, ref external_image, .. }) => {
|
||||||
image_instance.adjustment = adjustment;
|
|
||||||
|
|
||||||
let mut size = frame_state.resource_cache.request_image(
|
let mut size = frame_state.resource_cache.request_image(
|
||||||
request,
|
request,
|
||||||
frame_state.gpu_cache,
|
frame_state.gpu_cache,
|
||||||
@@ -278,7 +260,7 @@ impl ImageData {
|
|||||||
&mut frame_state.frame_gpu_data.f32,
|
&mut frame_state.frame_gpu_data.f32,
|
||||||
frame_state.rg_builder,
|
frame_state.rg_builder,
|
||||||
&mut frame_state.surface_builder,
|
&mut frame_state.surface_builder,
|
||||||
&mut |rg_builder, _, _| {
|
&mut |rg_builder, _| {
|
||||||
// Create a task to blit from the texture cache to
|
// Create a task to blit from the texture cache to
|
||||||
// a normal transient render task surface.
|
// a normal transient render task surface.
|
||||||
// TODO: figure out if/when we can do a blit instead.
|
// TODO: figure out if/when we can do a blit instead.
|
||||||
@@ -316,6 +298,15 @@ impl ImageData {
|
|||||||
// thing.
|
// thing.
|
||||||
let active_rect = visible_rect;
|
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(
|
let visible_rect = compute_conservative_visible_rect(
|
||||||
&visibility.clip_chain,
|
&visibility.clip_chain,
|
||||||
frame_state.current_dirty_region().combined,
|
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) {
|
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) {
|
pub fn write_prim_gpu_blocks(&self, request: &mut GpuDataRequest) {
|
||||||
let stretch_size = adjustment.map_stretch_size(self.stretch_size);
|
|
||||||
// Images are drawn as a white color, modulated by the total
|
// Images are drawn as a white color, modulated by the total
|
||||||
// opacity coming from any collapsed property bindings.
|
// opacity coming from any collapsed property bindings.
|
||||||
// Size has to match `VECS_PER_SPECIFIC_BRUSH` from `brush_image.glsl` exactly.
|
// Size has to match `VECS_PER_SPECIFIC_BRUSH` from `brush_image.glsl` exactly.
|
||||||
request.push(self.color.premultiplied());
|
request.push(self.color.premultiplied());
|
||||||
request.push(PremultipliedColorF::WHITE);
|
request.push(PremultipliedColorF::WHITE);
|
||||||
request.push([
|
request.push([
|
||||||
stretch_size.width + self.tile_spacing.width,
|
self.stretch_size.width + self.tile_spacing.width,
|
||||||
stretch_size.height + self.tile_spacing.height,
|
self.stretch_size.height + self.tile_spacing.height,
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
]);
|
]);
|
||||||
@@ -459,7 +449,6 @@ impl InternablePrimitive for Image {
|
|||||||
visible_tiles: Vec::new(),
|
visible_tiles: Vec::new(),
|
||||||
src_color: None,
|
src_color: None,
|
||||||
normalized_uvs: false,
|
normalized_uvs: false,
|
||||||
adjustment: AdjustedImageSource::new(),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
PrimitiveInstanceKind::Image {
|
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:
|
|
||||||
///
|
|
||||||
/// ```ignore
|
|
||||||
/// 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))]
|
#[cfg_attr(feature = "capture", derive(Serialize))]
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use std::marker::PhantomData;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
use api::{MinimapData, SnapshotImageKey};
|
use api::MinimapData;
|
||||||
use time::precise_time_ns;
|
use time::precise_time_ns;
|
||||||
use crate::api::channel::{Sender, single_msg_channel, unbounded_channel};
|
use crate::api::channel::{Sender, single_msg_channel, unbounded_channel};
|
||||||
use crate::api::{BuiltDisplayList, IdNamespace, ExternalScrollId, Parameter, BoolParameter};
|
use crate::api::{BuiltDisplayList, IdNamespace, ExternalScrollId, Parameter, BoolParameter};
|
||||||
@@ -59,10 +59,6 @@ pub enum ResourceUpdate {
|
|||||||
DeleteBlobImage(BlobImageKey),
|
DeleteBlobImage(BlobImageKey),
|
||||||
/// See `AddBlobImage::visible_area`.
|
/// See `AddBlobImage::visible_area`.
|
||||||
SetBlobImageVisibleArea(BlobImageKey, DeviceIntRect),
|
SetBlobImageVisibleArea(BlobImageKey, DeviceIntRect),
|
||||||
/// See `AddSnapshotImage`.
|
|
||||||
AddSnapshotImage(AddSnapshotImage),
|
|
||||||
/// See `AddSnapshotImage`.
|
|
||||||
DeleteSnapshotImage(SnapshotImageKey),
|
|
||||||
/// See `AddFont`.
|
/// See `AddFont`.
|
||||||
AddFont(AddFont),
|
AddFont(AddFont),
|
||||||
/// Deletes an already existing font resource.
|
/// Deletes an already existing font resource.
|
||||||
@@ -103,8 +99,6 @@ impl fmt::Debug for ResourceUpdate {
|
|||||||
ResourceUpdate::DeleteImage(..) => f.write_str("ResourceUpdate::DeleteImage"),
|
ResourceUpdate::DeleteImage(..) => f.write_str("ResourceUpdate::DeleteImage"),
|
||||||
ResourceUpdate::DeleteBlobImage(..) => f.write_str("ResourceUpdate::DeleteBlobImage"),
|
ResourceUpdate::DeleteBlobImage(..) => f.write_str("ResourceUpdate::DeleteBlobImage"),
|
||||||
ResourceUpdate::SetBlobImageVisibleArea(..) => f.write_str("ResourceUpdate::SetBlobImageVisibleArea"),
|
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::AddFont(..) => f.write_str("ResourceUpdate::AddFont"),
|
||||||
ResourceUpdate::DeleteFont(..) => f.write_str("ResourceUpdate::DeleteFont"),
|
ResourceUpdate::DeleteFont(..) => f.write_str("ResourceUpdate::DeleteFont"),
|
||||||
ResourceUpdate::AddFontInstance(..) => f.write_str("ResourceUpdate::AddFontInstance"),
|
ResourceUpdate::AddFontInstance(..) => f.write_str("ResourceUpdate::AddFontInstance"),
|
||||||
@@ -511,21 +505,6 @@ impl Transaction {
|
|||||||
self.resource_updates.push(ResourceUpdate::SetBlobImageVisibleArea(key, area));
|
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`.
|
/// See `ResourceUpdate::AddFont`.
|
||||||
pub fn add_raw_font(&mut self, key: FontKey, bytes: Vec<u8>, index: u32) {
|
pub fn add_raw_font(&mut self, key: FontKey, bytes: Vec<u8>, index: u32) {
|
||||||
self.resource_updates
|
self.resource_updates
|
||||||
@@ -745,16 +724,6 @@ pub struct UpdateBlobImage {
|
|||||||
pub dirty_rect: BlobDirtyRect,
|
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.
|
/// Creates a font resource.
|
||||||
///
|
///
|
||||||
/// Must be matched with a corresponding `ResourceUpdate::DeleteFont` at some point to prevent
|
/// 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::pattern::{PatternKind, PatternShaderInput};
|
||||||
use crate::spatial_tree::SpatialNodeIndex;
|
use crate::spatial_tree::SpatialNodeIndex;
|
||||||
use crate::filterdata::SFilterData;
|
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_cache::{GpuCache, GpuCacheAddress, GpuCacheHandle};
|
||||||
use crate::gpu_types::{BorderInstance, ImageSource, UvRectKind, TransformPaletteId};
|
use crate::gpu_types::{BorderInstance, ImageSource, UvRectKind, TransformPaletteId};
|
||||||
use crate::internal_types::{CacheTextureId, FastHashMap, FilterGraphNode, FilterGraphOp, FilterGraphPictureReference, SVGFE_CONVOLVE_VALUES_LIMIT, TextureSource, Swizzle};
|
use crate::internal_types::{CacheTextureId, FastHashMap, FilterGraphNode, FilterGraphOp, FilterGraphPictureReference, SVGFE_CONVOLVE_VALUES_LIMIT, TextureSource, Swizzle};
|
||||||
@@ -677,7 +677,7 @@ impl RenderTaskKind {
|
|||||||
gpu_buffer_builder,
|
gpu_buffer_builder,
|
||||||
rg_builder,
|
rg_builder,
|
||||||
surface_builder,
|
surface_builder,
|
||||||
&mut |rg_builder, _, _| {
|
&mut |rg_builder, _| {
|
||||||
let clip_data = ClipData::rounded_rect(
|
let clip_data = ClipData::rounded_rect(
|
||||||
source.minimal_shadow_rect.size(),
|
source.minimal_shadow_rect.size(),
|
||||||
&source.shadow_radius,
|
&source.shadow_radius,
|
||||||
@@ -1641,8 +1641,7 @@ impl RenderTask {
|
|||||||
/// * render_target.rs : add_svg_filter_node_instances
|
/// * render_target.rs : add_svg_filter_node_instances
|
||||||
pub fn new_svg_filter_graph(
|
pub fn new_svg_filter_graph(
|
||||||
filter_nodes: &[(FilterGraphNode, FilterGraphOp)],
|
filter_nodes: &[(FilterGraphNode, FilterGraphOp)],
|
||||||
rg_builder: &mut RenderTaskGraphBuilder,
|
frame_state: &mut FrameBuildingState,
|
||||||
gpu_cache: &mut GpuCache,
|
|
||||||
data_stores: &mut DataStores,
|
data_stores: &mut DataStores,
|
||||||
_uv_rect_kind: UvRectKind,
|
_uv_rect_kind: UvRectKind,
|
||||||
original_task_id: RenderTaskId,
|
original_task_id: RenderTaskId,
|
||||||
@@ -2336,7 +2335,7 @@ impl RenderTask {
|
|||||||
)
|
)
|
||||||
.scale(render_to_device_scale, render_to_device_scale);
|
.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(),
|
adjusted_blur_task_size.to_i32(),
|
||||||
RenderTaskKind::SVGFENode(
|
RenderTaskKind::SVGFENode(
|
||||||
SVGFEFilterTask{
|
SVGFEFilterTask{
|
||||||
@@ -2354,7 +2353,7 @@ impl RenderTask {
|
|||||||
),
|
),
|
||||||
).with_uv_rect_kind(UvRectKind::Rect));
|
).with_uv_rect_kind(UvRectKind::Rect));
|
||||||
// Adding the dependencies sets the inputs for this task
|
// 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
|
// TODO: We should do this blur in the correct
|
||||||
// colorspace, linear=true is the default in SVG and
|
// colorspace, linear=true is the default in SVG and
|
||||||
@@ -2365,13 +2364,13 @@ impl RenderTask {
|
|||||||
RenderTask::new_blur(
|
RenderTask::new_blur(
|
||||||
adjusted_blur_std_deviation,
|
adjusted_blur_std_deviation,
|
||||||
input_subregion_task_id,
|
input_subregion_task_id,
|
||||||
rg_builder,
|
frame_state.rg_builder,
|
||||||
RenderTargetKind::Color,
|
RenderTargetKind::Color,
|
||||||
None,
|
None,
|
||||||
adjusted_blur_task_size.to_i32(),
|
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,
|
node_task_size,
|
||||||
RenderTaskKind::SVGFENode(
|
RenderTaskKind::SVGFENode(
|
||||||
SVGFEFilterTask{
|
SVGFEFilterTask{
|
||||||
@@ -2397,7 +2396,7 @@ impl RenderTask {
|
|||||||
),
|
),
|
||||||
).with_uv_rect_kind(node_uv_rect_kind));
|
).with_uv_rect_kind(node_uv_rect_kind));
|
||||||
// Adding the dependencies sets the inputs for this task
|
// 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 } => {
|
FilterGraphOp::SVGFEDropShadow { color, dx, dy, std_deviation_x, std_deviation_y } => {
|
||||||
// Note: wrap_prim_with_filters copies the SourceGraphic to
|
// Note: wrap_prim_with_filters copies the SourceGraphic to
|
||||||
@@ -2454,7 +2453,7 @@ impl RenderTask {
|
|||||||
)
|
)
|
||||||
.scale(render_to_device_scale, render_to_device_scale);
|
.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(),
|
adjusted_blur_task_size.to_i32(),
|
||||||
RenderTaskKind::SVGFENode(
|
RenderTaskKind::SVGFENode(
|
||||||
SVGFEFilterTask{
|
SVGFEFilterTask{
|
||||||
@@ -2480,7 +2479,7 @@ impl RenderTask {
|
|||||||
),
|
),
|
||||||
).with_uv_rect_kind(UvRectKind::Rect));
|
).with_uv_rect_kind(UvRectKind::Rect));
|
||||||
// Adding the dependencies sets the inputs for this task
|
// 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
|
// The shadow compositing only cares about alpha channel
|
||||||
// which is always linear, so we can blur this in sRGB or
|
// which is always linear, so we can blur this in sRGB or
|
||||||
@@ -2490,7 +2489,7 @@ impl RenderTask {
|
|||||||
RenderTask::new_blur(
|
RenderTask::new_blur(
|
||||||
adjusted_blur_std_deviation,
|
adjusted_blur_std_deviation,
|
||||||
input_subregion_task_id,
|
input_subregion_task_id,
|
||||||
rg_builder,
|
frame_state.rg_builder,
|
||||||
RenderTargetKind::Color,
|
RenderTargetKind::Color,
|
||||||
None,
|
None,
|
||||||
adjusted_blur_task_size.to_i32(),
|
adjusted_blur_task_size.to_i32(),
|
||||||
@@ -2500,7 +2499,7 @@ impl RenderTask {
|
|||||||
// the blurred shadow image at the correct subregion offset
|
// the blurred shadow image at the correct subregion offset
|
||||||
let blur_subregion_translated = blur_subregion
|
let blur_subregion_translated = blur_subregion
|
||||||
.translate(LayoutVector2D::new(dx, dy));
|
.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,
|
node_task_size,
|
||||||
RenderTaskKind::SVGFENode(
|
RenderTaskKind::SVGFENode(
|
||||||
SVGFEFilterTask{
|
SVGFEFilterTask{
|
||||||
@@ -2534,8 +2533,8 @@ impl RenderTask {
|
|||||||
),
|
),
|
||||||
).with_uv_rect_kind(node_uv_rect_kind));
|
).with_uv_rect_kind(node_uv_rect_kind));
|
||||||
// Adding the dependencies sets the inputs for this task
|
// Adding the dependencies sets the inputs for this task
|
||||||
rg_builder.add_dependency(task_id, source_task_id);
|
frame_state.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, blur_task_id);
|
||||||
}
|
}
|
||||||
FilterGraphOp::SVGFESourceAlpha |
|
FilterGraphOp::SVGFESourceAlpha |
|
||||||
FilterGraphOp::SVGFESourceGraphic => {
|
FilterGraphOp::SVGFESourceGraphic => {
|
||||||
@@ -2543,7 +2542,7 @@ impl RenderTask {
|
|||||||
// a fake input binding to make the shader do the copy. In
|
// a fake input binding to make the shader do the copy. In
|
||||||
// the case of SourceAlpha the shader will zero the RGB but
|
// the case of SourceAlpha the shader will zero the RGB but
|
||||||
// we don't have to care about that distinction here.
|
// 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,
|
node_task_size,
|
||||||
RenderTaskKind::SVGFENode(
|
RenderTaskKind::SVGFENode(
|
||||||
SVGFEFilterTask{
|
SVGFEFilterTask{
|
||||||
@@ -2571,17 +2570,17 @@ impl RenderTask {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
).with_uv_rect_kind(node_uv_rect_kind));
|
).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;
|
made_dependency_on_source = true;
|
||||||
}
|
}
|
||||||
FilterGraphOp::SVGFEComponentTransferInterned { handle, creates_pixels: _ } => {
|
FilterGraphOp::SVGFEComponentTransferInterned { handle, creates_pixels: _ } => {
|
||||||
// FIXME: Doing this in prepare_interned_prim_for_render
|
// FIXME: Doing this in prepare_interned_prim_for_render
|
||||||
// doesn't seem to be enough, where should it be done?
|
// doesn't seem to be enough, where should it be done?
|
||||||
let filter_data = &mut data_stores.filter_data[handle];
|
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
|
// ComponentTransfer has a gpu_cache_handle that we need to
|
||||||
// pass along
|
// 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,
|
node_task_size,
|
||||||
RenderTaskKind::SVGFENode(
|
RenderTaskKind::SVGFENode(
|
||||||
SVGFEFilterTask{
|
SVGFEFilterTask{
|
||||||
@@ -2606,14 +2605,14 @@ impl RenderTask {
|
|||||||
made_dependency_on_source = true;
|
made_dependency_on_source = true;
|
||||||
}
|
}
|
||||||
if *input_task != RenderTaskId::INVALID {
|
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
|
// This is the usual case - zero, one or two inputs that
|
||||||
// reference earlier node results.
|
// 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,
|
node_task_size,
|
||||||
RenderTaskKind::SVGFENode(
|
RenderTaskKind::SVGFENode(
|
||||||
SVGFEFilterTask{
|
SVGFEFilterTask{
|
||||||
@@ -2638,7 +2637,7 @@ impl RenderTask {
|
|||||||
made_dependency_on_source = true;
|
made_dependency_on_source = true;
|
||||||
}
|
}
|
||||||
if *input_task != RenderTaskId::INVALID {
|
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
|
// If no tasks referenced the SourceGraphic, we actually have to create
|
||||||
// a fake dependency so that it does not leak.
|
// a fake dependency so that it does not leak.
|
||||||
if !made_dependency_on_source && output_task_id != original_task_id {
|
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
|
output_task_id
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* 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 api::units::*;
|
||||||
use crate::border::BorderSegmentCacheKey;
|
use crate::border::BorderSegmentCacheKey;
|
||||||
use crate::box_shadow::{BoxShadowCacheKey};
|
use crate::box_shadow::{BoxShadowCacheKey};
|
||||||
@@ -52,7 +52,6 @@ pub enum RenderTaskCacheKeyKind {
|
|||||||
LinearGradient(LinearGradientCacheKey),
|
LinearGradient(LinearGradientCacheKey),
|
||||||
RadialGradient(RadialGradientCacheKey),
|
RadialGradient(RadialGradientCacheKey),
|
||||||
ConicGradient(ConicGradientCacheKey),
|
ConicGradient(ConicGradientCacheKey),
|
||||||
Snapshot(SnapshotImageKey),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
|
||||||
@@ -233,13 +232,13 @@ impl RenderTaskCache {
|
|||||||
gpu_buffer_builder: &mut GpuBufferBuilderF,
|
gpu_buffer_builder: &mut GpuBufferBuilderF,
|
||||||
rg_builder: &mut RenderTaskGraphBuilder,
|
rg_builder: &mut RenderTaskGraphBuilder,
|
||||||
surface_builder: &mut SurfaceBuilder,
|
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 {
|
) -> RenderTaskId {
|
||||||
// If this render task cache is being drawn this frame, ensure we hook up the
|
// 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
|
// render task for it as a dependency of any render task that uses this as
|
||||||
// an input source.
|
// an input source.
|
||||||
let (task_id, rendered_this_frame) = match key {
|
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(
|
Some(key) => self.request_render_task_impl(
|
||||||
key,
|
key,
|
||||||
is_opaque,
|
is_opaque,
|
||||||
@@ -286,7 +285,7 @@ impl RenderTaskCache {
|
|||||||
gpu_cache: &mut GpuCache,
|
gpu_cache: &mut GpuCache,
|
||||||
gpu_buffer_builder: &mut GpuBufferBuilderF,
|
gpu_buffer_builder: &mut GpuBufferBuilderF,
|
||||||
rg_builder: &mut RenderTaskGraphBuilder,
|
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) {
|
) -> (RenderTaskId, bool) {
|
||||||
let frame_id = self.frame_id;
|
let frame_id = self.frame_id;
|
||||||
let size = key.size;
|
let size = key.size;
|
||||||
@@ -311,7 +310,7 @@ impl RenderTaskCache {
|
|||||||
if texture_cache.request(&cache_entry.handle, gpu_cache) {
|
if texture_cache.request(&cache_entry.handle, gpu_cache) {
|
||||||
// Invoke user closure to get render task chain
|
// Invoke user closure to get render task chain
|
||||||
// to draw this into the texture cache.
|
// 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.user_data = None;
|
||||||
cache_entry.is_opaque = is_opaque;
|
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
|
* 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/. */
|
* 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::{DebugFlags, FontInstanceKey, FontKey, FontTemplate, GlyphIndex};
|
||||||
use api::{ExternalImageData, ExternalImageType, ExternalImageId, BlobImageResult};
|
use api::{ExternalImageData, ExternalImageType, ExternalImageId, BlobImageResult};
|
||||||
use api::{DirtyRect, GlyphDimensions, IdNamespace, DEFAULT_TILE_SIZE};
|
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::{BlobImageHandler, BlobImageKey, VoidPtrToSizeFn};
|
||||||
use api::units::*;
|
use api::units::*;
|
||||||
use euclid::size2;
|
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::{render_api::{ClearCache, AddFont, ResourceUpdate, MemoryReport}, util::WeakTable};
|
||||||
use crate::prim_store::image::AdjustedImageSource;
|
|
||||||
use crate::image_tiling::{compute_tile_size, compute_tile_range};
|
use crate::image_tiling::{compute_tile_size, compute_tile_range};
|
||||||
#[cfg(feature = "capture")]
|
#[cfg(feature = "capture")]
|
||||||
use crate::capture::ExternalCaptureImage;
|
use crate::capture::ExternalCaptureImage;
|
||||||
@@ -116,11 +113,6 @@ pub enum CachedImageData {
|
|||||||
///
|
///
|
||||||
/// The commands are stored elsewhere and this variant is used as a placeholder.
|
/// The commands are stored elsewhere and this variant is used as a placeholder.
|
||||||
Blob,
|
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
|
/// An image owned by the embedding, and referenced by WebRender. This may
|
||||||
/// take the form of a texture or a heap-allocated buffer.
|
/// take the form of a texture or a heap-allocated buffer.
|
||||||
External(ExternalImageData),
|
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
|
/// Returns true if this variant of CachedImageData should go through the texture
|
||||||
/// cache.
|
/// cache.
|
||||||
#[inline]
|
#[inline]
|
||||||
@@ -164,7 +148,6 @@ impl CachedImageData {
|
|||||||
},
|
},
|
||||||
CachedImageData::Blob => true,
|
CachedImageData::Blob => true,
|
||||||
CachedImageData::Raw(_) => 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
|
// Potentially a subset of the image's total rectangle. This rectangle is what
|
||||||
// we map to the (layout space) display item bounds.
|
// we map to the (layout space) display item bounds.
|
||||||
pub visible_rect: DeviceIntRect,
|
pub visible_rect: DeviceIntRect,
|
||||||
pub adjustment: AdjustedImageSource,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||||
@@ -208,7 +190,6 @@ struct ImageResource {
|
|||||||
/// This is used to express images that are virtually very large
|
/// 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.
|
/// but with only a visible sub-set that is valid at a given time.
|
||||||
visible_rect: DeviceIntRect,
|
visible_rect: DeviceIntRect,
|
||||||
adjustment: AdjustedImageSource,
|
|
||||||
generation: ImageGeneration,
|
generation: ImageGeneration,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,7 +573,6 @@ impl ResourceCache {
|
|||||||
// not make sense to tile them into smaller ones.
|
// not make sense to tile them into smaller ones.
|
||||||
info.image_type == ExternalImageType::Buffer && size_check
|
info.image_type == ExternalImageType::Buffer && size_check
|
||||||
}
|
}
|
||||||
CachedImageData::Snapshot => false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,10 +596,10 @@ impl ResourceCache {
|
|||||||
gpu_buffer_builder: &mut GpuBufferBuilderF,
|
gpu_buffer_builder: &mut GpuBufferBuilderF,
|
||||||
rg_builder: &mut RenderTaskGraphBuilder,
|
rg_builder: &mut RenderTaskGraphBuilder,
|
||||||
surface_builder: &mut SurfaceBuilder,
|
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 {
|
) -> RenderTaskId {
|
||||||
self.cached_render_tasks.request_render_task(
|
self.cached_render_tasks.request_render_task(
|
||||||
key.clone(),
|
key,
|
||||||
&mut self.texture_cache,
|
&mut self.texture_cache,
|
||||||
is_opaque,
|
is_opaque,
|
||||||
parent,
|
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(
|
pub fn post_scene_building_update(
|
||||||
&mut self,
|
&mut self,
|
||||||
updates: Vec<ResourceUpdate>,
|
updates: Vec<ResourceUpdate>,
|
||||||
@@ -772,26 +673,6 @@ impl ResourceCache {
|
|||||||
ResourceUpdate::DeleteBlobImage(img) => {
|
ResourceUpdate::DeleteBlobImage(img) => {
|
||||||
self.delete_image_template(img.as_image());
|
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) => {
|
ResourceUpdate::DeleteFont(font) => {
|
||||||
if let Some(shared_key) = self.resources.fonts.font_keys.delete_key(&font) {
|
if let Some(shared_key) = self.resources.fonts.font_keys.delete_key(&font) {
|
||||||
self.delete_font_template(shared_key);
|
self.delete_font_template(shared_key);
|
||||||
@@ -933,7 +814,6 @@ impl ResourceCache {
|
|||||||
data,
|
data,
|
||||||
tiling,
|
tiling,
|
||||||
visible_rect: *visible_rect,
|
visible_rect: *visible_rect,
|
||||||
adjustment: AdjustedImageSource::new(),
|
|
||||||
generation: ImageGeneration(0),
|
generation: ImageGeneration(0),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1003,7 +883,6 @@ impl ResourceCache {
|
|||||||
data,
|
data,
|
||||||
tiling,
|
tiling,
|
||||||
visible_rect: descriptor.size.into(),
|
visible_rect: descriptor.size.into(),
|
||||||
adjustment: AdjustedImageSource::new(),
|
|
||||||
generation: ImageGeneration(image.generation.0 + 1),
|
generation: ImageGeneration(image.generation.0 + 1),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1373,10 +1252,7 @@ impl ResourceCache {
|
|||||||
ExternalImageType::Buffer => None,
|
ExternalImageType::Buffer => None,
|
||||||
},
|
},
|
||||||
// raw and blob image are all using resource_cache.
|
// raw and blob image are all using resource_cache.
|
||||||
CachedImageData::Raw(..)
|
CachedImageData::Raw(..) | CachedImageData::Blob => None,
|
||||||
| CachedImageData::Blob
|
|
||||||
| CachedImageData::Snapshot
|
|
||||||
=> None,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ImageProperties {
|
ImageProperties {
|
||||||
@@ -1384,7 +1260,6 @@ impl ResourceCache {
|
|||||||
external_image,
|
external_image,
|
||||||
tiling: image_template.tiling,
|
tiling: image_template.tiling,
|
||||||
visible_rect: image_template.visible_rect,
|
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();
|
let mut updates: SmallVec<[(CachedImageData, Option<DeviceIntRect>); 1]> = SmallVec::new();
|
||||||
|
|
||||||
match image_template.data {
|
match image_template.data {
|
||||||
CachedImageData::Snapshot => {
|
CachedImageData::Raw(..) | CachedImageData::External(..) => {
|
||||||
// The update is done in ResourceCache::render_as_image.
|
|
||||||
}
|
|
||||||
CachedImageData::Raw(..)
|
|
||||||
| CachedImageData::External(..) => {
|
|
||||||
// Safe to clone here since the Raw image data is an
|
// Safe to clone here since the Raw image data is an
|
||||||
// Arc, and the external image data is small.
|
// Arc, and the external image data is small.
|
||||||
updates.push((image_template.data.clone(), None));
|
updates.push((image_template.data.clone(), None));
|
||||||
@@ -1565,14 +1436,11 @@ impl ResourceCache {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let eviction = match &image_template.data {
|
let eviction = if image_template.data.is_blob() {
|
||||||
CachedImageData::Blob | CachedImageData::Snapshot => {
|
entry.manual_eviction = true;
|
||||||
entry.manual_eviction = true;
|
Eviction::Manual
|
||||||
Eviction::Manual
|
} else {
|
||||||
}
|
Eviction::Auto
|
||||||
_ => {
|
|
||||||
Eviction::Auto
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Note: at this point, the dirty rectangle is local to the descriptor space
|
//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() {
|
for (_, image) in self.resources.image_templates.images.iter() {
|
||||||
report.images += match image.data {
|
report.images += match image.data {
|
||||||
CachedImageData::Raw(ref v) => unsafe { op(v.as_ptr() as *const c_void) },
|
CachedImageData::Raw(ref v) => unsafe { op(v.as_ptr() as *const c_void) },
|
||||||
CachedImageData::Blob
|
CachedImageData::Blob | CachedImageData::External(..) => 0,
|
||||||
| CachedImageData::External(..)
|
|
||||||
| CachedImageData::Snapshot => 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2184,9 +2050,6 @@ impl ResourceCache {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
other_paths.insert(key, short_path);
|
other_paths.insert(key, short_path);
|
||||||
}
|
}
|
||||||
CachedImageData::Snapshot => {
|
|
||||||
unimplemented!();
|
|
||||||
}
|
|
||||||
CachedImageData::External(ref ext) => {
|
CachedImageData::External(ref ext) => {
|
||||||
let short_path = format!("externals/{}", external_images.len() + 1);
|
let short_path = format!("externals/{}", external_images.len() + 1);
|
||||||
other_paths.insert(key, short_path.clone());
|
other_paths.insert(key, short_path.clone());
|
||||||
@@ -2417,7 +2280,6 @@ impl ResourceCache {
|
|||||||
descriptor: template.descriptor,
|
descriptor: template.descriptor,
|
||||||
tiling: template.tiling,
|
tiling: template.tiling,
|
||||||
visible_rect: template.descriptor.size.into(),
|
visible_rect: template.descriptor.size.into(),
|
||||||
adjustment: AdjustedImageSource::new(), // TODO(nical)
|
|
||||||
generation: template.generation,
|
generation: template.generation,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
//! - backdrop filters (see add_backdrop_filter)
|
//! - 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::{ClipId, ColorF, CommonItemProperties, ComplexClipRegion, ComponentTransferFuncType, RasterSpace};
|
||||||
use api::{DebugFlags, DisplayItem, DisplayItemRef, ExtendMode, ExternalScrollId, FilterData};
|
use api::{DebugFlags, DisplayItem, DisplayItemRef, ExtendMode, ExternalScrollId, FilterData};
|
||||||
use api::{FilterOp, FilterPrimitive, FontInstanceKey, FontSize, GlyphInstance, GlyphOptions, GradientStop};
|
use api::{FilterOp, FilterPrimitive, FontInstanceKey, FontSize, GlyphInstance, GlyphOptions, GradientStop};
|
||||||
@@ -152,7 +152,6 @@ pub struct CompositeOps {
|
|||||||
pub filters: Vec<Filter>,
|
pub filters: Vec<Filter>,
|
||||||
pub filter_datas: Vec<FilterData>,
|
pub filter_datas: Vec<FilterData>,
|
||||||
pub filter_primitives: Vec<FilterPrimitive>,
|
pub filter_primitives: Vec<FilterPrimitive>,
|
||||||
pub snapshot: Option<SnapshotInfo>,
|
|
||||||
|
|
||||||
// Requires two source textures (e.g. mix-blend-mode)
|
// Requires two source textures (e.g. mix-blend-mode)
|
||||||
pub mix_blend_mode: Option<MixBlendMode>,
|
pub mix_blend_mode: Option<MixBlendMode>,
|
||||||
@@ -163,23 +162,20 @@ impl CompositeOps {
|
|||||||
filters: Vec<Filter>,
|
filters: Vec<Filter>,
|
||||||
filter_datas: Vec<FilterData>,
|
filter_datas: Vec<FilterData>,
|
||||||
filter_primitives: Vec<FilterPrimitive>,
|
filter_primitives: Vec<FilterPrimitive>,
|
||||||
mix_blend_mode: Option<MixBlendMode>,
|
mix_blend_mode: Option<MixBlendMode>
|
||||||
snapshot: Option<SnapshotInfo>,
|
|
||||||
) -> Self {
|
) -> Self {
|
||||||
CompositeOps {
|
CompositeOps {
|
||||||
filters,
|
filters,
|
||||||
filter_datas,
|
filter_datas,
|
||||||
filter_primitives,
|
filter_primitives,
|
||||||
mix_blend_mode,
|
mix_blend_mode,
|
||||||
snapshot,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
self.filters.is_empty() &&
|
self.filters.is_empty() &&
|
||||||
self.filter_primitives.is_empty() &&
|
self.filter_primitives.is_empty() &&
|
||||||
self.mix_blend_mode.is_none() &&
|
self.mix_blend_mode.is_none()
|
||||||
self.snapshot.is_none()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if this CompositeOps contains any filters that affect
|
/// Returns true if this CompositeOps contains any filters that affect
|
||||||
@@ -336,7 +332,6 @@ impl PictureChainBuilder {
|
|||||||
self.spatial_node_index,
|
self.spatial_node_index,
|
||||||
self.raster_space,
|
self.raster_space,
|
||||||
flags,
|
flags,
|
||||||
None,
|
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -369,7 +364,6 @@ impl PictureChainBuilder {
|
|||||||
interners: &mut Interners,
|
interners: &mut Interners,
|
||||||
prim_store: &mut PrimitiveStore,
|
prim_store: &mut PrimitiveStore,
|
||||||
clip_tree_builder: &mut ClipTreeBuilder,
|
clip_tree_builder: &mut ClipTreeBuilder,
|
||||||
snapshot: Option<SnapshotInfo>,
|
|
||||||
) -> PrimitiveInstance {
|
) -> PrimitiveInstance {
|
||||||
let mut flags = PictureFlags::empty();
|
let mut flags = PictureFlags::empty();
|
||||||
if self.establishes_sub_graph {
|
if self.establishes_sub_graph {
|
||||||
@@ -379,9 +373,7 @@ impl PictureChainBuilder {
|
|||||||
match self.current {
|
match self.current {
|
||||||
PictureSource::WrappedPicture { instance } => {
|
PictureSource::WrappedPicture { instance } => {
|
||||||
let pic_index = instance.kind.as_pic();
|
let pic_index = instance.kind.as_pic();
|
||||||
let picture = &mut prim_store.pictures[pic_index.0];
|
prim_store.pictures[pic_index.0].flags |= flags;
|
||||||
picture.flags |= flags;
|
|
||||||
picture.snapshot = snapshot;
|
|
||||||
|
|
||||||
instance
|
instance
|
||||||
}
|
}
|
||||||
@@ -403,7 +395,6 @@ impl PictureChainBuilder {
|
|||||||
self.spatial_node_index,
|
self.spatial_node_index,
|
||||||
self.raster_space,
|
self.raster_space,
|
||||||
flags,
|
flags,
|
||||||
snapshot,
|
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -946,7 +937,6 @@ impl<'a> SceneBuilder<'a> {
|
|||||||
filter_datas_for_compositing(item.filter_datas()),
|
filter_datas_for_compositing(item.filter_datas()),
|
||||||
filter_primitives_for_compositing(item.filter_primitives()),
|
filter_primitives_for_compositing(item.filter_primitives()),
|
||||||
info.stacking_context.mix_blend_mode_for_compositing(),
|
info.stacking_context.mix_blend_mode_for_compositing(),
|
||||||
info.snapshot,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let sc_info = self.push_stacking_context(
|
let sc_info = self.push_stacking_context(
|
||||||
@@ -2255,11 +2245,6 @@ impl<'a> SceneBuilder<'a> {
|
|||||||
// clip node doesn't affect the stacking context rect.
|
// clip node doesn't affect the stacking context rect.
|
||||||
let mut blit_reason = BlitReason::empty();
|
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
|
// If this stacking context has any complex clips, we need to draw it
|
||||||
// to an off-screen surface.
|
// to an off-screen surface.
|
||||||
if let Some(clip_chain_id) = clip_chain_id {
|
if let Some(clip_chain_id) = clip_chain_id {
|
||||||
@@ -2408,7 +2393,6 @@ impl<'a> SceneBuilder<'a> {
|
|||||||
stacking_context.spatial_node_index,
|
stacking_context.spatial_node_index,
|
||||||
stacking_context.raster_space,
|
stacking_context.raster_space,
|
||||||
PictureFlags::empty(),
|
PictureFlags::empty(),
|
||||||
None,
|
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2453,7 +2437,6 @@ impl<'a> SceneBuilder<'a> {
|
|||||||
stacking_context.spatial_node_index,
|
stacking_context.spatial_node_index,
|
||||||
stacking_context.raster_space,
|
stacking_context.raster_space,
|
||||||
PictureFlags::empty(),
|
PictureFlags::empty(),
|
||||||
None,
|
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2485,7 +2468,6 @@ impl<'a> SceneBuilder<'a> {
|
|||||||
&mut self.interners,
|
&mut self.interners,
|
||||||
&mut self.prim_store,
|
&mut self.prim_store,
|
||||||
&mut self.clip_tree_builder,
|
&mut self.clip_tree_builder,
|
||||||
None,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
prims.push(ExtendedPrimitiveInstance {
|
prims.push(ExtendedPrimitiveInstance {
|
||||||
@@ -2559,7 +2541,6 @@ impl<'a> SceneBuilder<'a> {
|
|||||||
stacking_context.spatial_node_index,
|
stacking_context.spatial_node_index,
|
||||||
stacking_context.raster_space,
|
stacking_context.raster_space,
|
||||||
PictureFlags::empty(),
|
PictureFlags::empty(),
|
||||||
None,
|
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2628,7 +2609,6 @@ impl<'a> SceneBuilder<'a> {
|
|||||||
&mut self.interners,
|
&mut self.interners,
|
||||||
&mut self.prim_store,
|
&mut self.prim_store,
|
||||||
&mut self.clip_tree_builder,
|
&mut self.clip_tree_builder,
|
||||||
stacking_context.composite_ops.snapshot,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// The primitive instance for the remainder of flat children of this SC
|
// 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,
|
pending_shadow.spatial_node_index,
|
||||||
raster_space,
|
raster_space,
|
||||||
PictureFlags::empty(),
|
PictureFlags::empty(),
|
||||||
None,
|
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -3763,7 +3742,6 @@ impl<'a> SceneBuilder<'a> {
|
|||||||
&mut self.interners,
|
&mut self.interners,
|
||||||
&mut self.prim_store,
|
&mut self.prim_store,
|
||||||
&mut self.clip_tree_builder,
|
&mut self.clip_tree_builder,
|
||||||
None,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Extract the pic index for the intermediate surface. We need to
|
// Extract the pic index for the intermediate surface. We need to
|
||||||
@@ -4598,7 +4576,6 @@ impl FlattenedStackingContext {
|
|||||||
self.spatial_node_index,
|
self.spatial_node_index,
|
||||||
self.raster_space,
|
self.raster_space,
|
||||||
PictureFlags::empty(),
|
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
|
/// A helper for reusing the scene builder's memory allocations and dropping
|
||||||
/// scene allocations on the scene builder thread to avoid lock contention in
|
/// scene allocations on the scene builder thread to avoid lock contention in
|
||||||
/// jemalloc.
|
/// jemalloc.
|
||||||
pub struct SceneRecycler {
|
pub struct SceneRecycler {
|
||||||
pub tx: Sender<BuiltScene>,
|
pub tx: Sender<BuiltScene>,
|
||||||
rx: Receiver<BuiltScene>,
|
rx: Receiver<BuiltScene>,
|
||||||
@@ -4852,7 +4829,7 @@ impl SceneRecycler {
|
|||||||
self.clip_store = scene.clip_store;
|
self.clip_store = scene.clip_store;
|
||||||
// We currently retain top-level allocations but don't attempt to retain leaf
|
// 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
|
// 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.prim_store.reset();
|
||||||
self.clip_store.reset();
|
self.clip_store.reset();
|
||||||
self.hit_testing_scene = Arc::try_unwrap(scene.hit_testing_scene).ok();
|
self.hit_testing_scene = Arc::try_unwrap(scene.hit_testing_scene).ok();
|
||||||
|
|||||||
@@ -1574,9 +1574,6 @@ impl TextureCacheUpdate {
|
|||||||
dirty_rect: &ImageDirtyRect,
|
dirty_rect: &ImageDirtyRect,
|
||||||
) -> TextureCacheUpdate {
|
) -> TextureCacheUpdate {
|
||||||
let source = match data {
|
let source = match data {
|
||||||
CachedImageData::Snapshot => {
|
|
||||||
panic!("Snapshots should not do texture uploads");
|
|
||||||
}
|
|
||||||
CachedImageData::Blob => {
|
CachedImageData::Blob => {
|
||||||
panic!("The vector image should have been rasterized.");
|
panic!("The vector image should have been rasterized.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -638,7 +638,6 @@ fn create_tile_cache(
|
|||||||
scroll_root,
|
scroll_root,
|
||||||
RasterSpace::Screen,
|
RasterSpace::Screen,
|
||||||
PictureFlags::empty(),
|
PictureFlags::empty(),
|
||||||
None,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
tile_cache_pictures.push(PictureIndex(pic_index));
|
tile_cache_pictures.push(PictureIndex(pic_index));
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use euclid::{SideOffsets2D, Angle};
|
|||||||
use peek_poke::PeekPoke;
|
use peek_poke::PeekPoke;
|
||||||
use std::ops::Not;
|
use std::ops::Not;
|
||||||
// local imports
|
// local imports
|
||||||
use crate::{font, SnapshotImageKey};
|
use crate::font;
|
||||||
use crate::{APZScrollGeneration, HasScrollLinkedEffect, PipelineId, PropertyBinding};
|
use crate::{APZScrollGeneration, HasScrollLinkedEffect, PipelineId, PropertyBinding};
|
||||||
use crate::serde::{Serialize, Deserialize};
|
use crate::serde::{Serialize, Deserialize};
|
||||||
use crate::color::ColorF;
|
use crate::color::ColorF;
|
||||||
@@ -876,17 +876,10 @@ pub struct ReferenceFrame {
|
|||||||
pub key: SpatialTreeItemKey,
|
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)]
|
#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)]
|
||||||
pub struct PushStackingContextDisplayItem {
|
pub struct PushStackingContextDisplayItem {
|
||||||
pub origin: LayoutPoint,
|
pub origin: LayoutPoint,
|
||||||
pub spatial_id: SpatialId,
|
pub spatial_id: SpatialId,
|
||||||
pub snapshot: Option<SnapshotInfo>,
|
|
||||||
pub prim_flags: PrimitiveFlags,
|
pub prim_flags: PrimitiveFlags,
|
||||||
pub ref_frame_offset: LayoutVector2D,
|
pub ref_frame_offset: LayoutVector2D,
|
||||||
pub stacking_context: StackingContext,
|
pub stacking_context: StackingContext,
|
||||||
|
|||||||
@@ -1795,7 +1795,6 @@ impl DisplayListBuilder {
|
|||||||
filter_primitives: &[di::FilterPrimitive],
|
filter_primitives: &[di::FilterPrimitive],
|
||||||
raster_space: di::RasterSpace,
|
raster_space: di::RasterSpace,
|
||||||
flags: di::StackingContextFlags,
|
flags: di::StackingContextFlags,
|
||||||
snapshot: Option<di::SnapshotInfo>
|
|
||||||
) {
|
) {
|
||||||
let ref_frame_offset = self.rf_mapper.current_offset();
|
let ref_frame_offset = self.rf_mapper.current_offset();
|
||||||
self.push_filters(filters, filter_datas, filter_primitives);
|
self.push_filters(filters, filter_datas, filter_primitives);
|
||||||
@@ -1803,7 +1802,6 @@ impl DisplayListBuilder {
|
|||||||
let item = di::DisplayItem::PushStackingContext(di::PushStackingContextDisplayItem {
|
let item = di::DisplayItem::PushStackingContext(di::PushStackingContextDisplayItem {
|
||||||
origin,
|
origin,
|
||||||
spatial_id,
|
spatial_id,
|
||||||
snapshot,
|
|
||||||
prim_flags,
|
prim_flags,
|
||||||
ref_frame_offset,
|
ref_frame_offset,
|
||||||
stacking_context: di::StackingContext {
|
stacking_context: di::StackingContext {
|
||||||
@@ -1858,7 +1856,6 @@ impl DisplayListBuilder {
|
|||||||
filter_primitives,
|
filter_primitives,
|
||||||
di::RasterSpace::Screen,
|
di::RasterSpace::Screen,
|
||||||
di::StackingContextFlags::empty(),
|
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
|
/// An arbitrary identifier for an external image provided by the
|
||||||
/// application. It must be a unique identifier for each external
|
/// application. It must be a unique identifier for each external
|
||||||
/// image.
|
/// image.
|
||||||
|
|||||||
@@ -312,11 +312,6 @@ fn is_image_opaque(format: ImageFormat, bytes: &[u8]) -> bool {
|
|||||||
|
|
||||||
struct IsRoot(bool);
|
struct IsRoot(bool);
|
||||||
|
|
||||||
pub struct Snapshot {
|
|
||||||
key: SnapshotImageKey,
|
|
||||||
size: LayoutSize,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct YamlFrameReader {
|
pub struct YamlFrameReader {
|
||||||
yaml_path: PathBuf,
|
yaml_path: PathBuf,
|
||||||
aux_dir: PathBuf,
|
aux_dir: PathBuf,
|
||||||
@@ -337,7 +332,6 @@ pub struct YamlFrameReader {
|
|||||||
fonts: HashMap<FontDescriptor, FontKey>,
|
fonts: HashMap<FontDescriptor, FontKey>,
|
||||||
font_instances: HashMap<(FontKey, FontSize, FontInstanceFlags, SyntheticItalics), FontInstanceKey>,
|
font_instances: HashMap<(FontKey, FontSize, FontInstanceFlags, SyntheticItalics), FontInstanceKey>,
|
||||||
font_render_mode: Option<FontRenderMode>,
|
font_render_mode: Option<FontRenderMode>,
|
||||||
snapshots: HashMap<String, Snapshot>,
|
|
||||||
allow_mipmaps: bool,
|
allow_mipmaps: bool,
|
||||||
|
|
||||||
/// A HashMap that allows specifying a numeric id for clip and clip chains in YAML
|
/// A HashMap that allows specifying a numeric id for clip and clip chains in YAML
|
||||||
@@ -372,7 +366,6 @@ impl YamlFrameReader {
|
|||||||
fonts: HashMap::new(),
|
fonts: HashMap::new(),
|
||||||
font_instances: HashMap::new(),
|
font_instances: HashMap::new(),
|
||||||
font_render_mode: None,
|
font_render_mode: None,
|
||||||
snapshots: HashMap::new(),
|
|
||||||
allow_mipmaps: false,
|
allow_mipmaps: false,
|
||||||
image_map: HashMap::new(),
|
image_map: HashMap::new(),
|
||||||
user_clip_id_map: HashMap::new(),
|
user_clip_id_map: HashMap::new(),
|
||||||
@@ -673,15 +666,6 @@ impl YamlFrameReader {
|
|||||||
kind,
|
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());
|
panic!("Failed to load image {:?}", file.to_str());
|
||||||
}
|
}
|
||||||
@@ -1302,7 +1286,6 @@ impl YamlFrameReader {
|
|||||||
"src"
|
"src"
|
||||||
}];
|
}];
|
||||||
let tiling = item["tile-size"].as_i64();
|
let tiling = item["tile-size"].as_i64();
|
||||||
|
|
||||||
let file = rsrc_path(filename, &self.aux_dir);
|
let file = rsrc_path(filename, &self.aux_dir);
|
||||||
let (image_key, image_dims) =
|
let (image_key, image_dims) =
|
||||||
self.add_or_get_image(&file, tiling, item, wrench);
|
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_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 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();
|
let mut flags = StackingContextFlags::empty();
|
||||||
flags.set(StackingContextFlags::IS_BLEND_CONTAINER, is_blend_container);
|
flags.set(StackingContextFlags::IS_BLEND_CONTAINER, is_blend_container);
|
||||||
flags.set(StackingContextFlags::WRAPS_BACKDROP_FILTER, wraps_backdrop_filter);
|
flags.set(StackingContextFlags::WRAPS_BACKDROP_FILTER, wraps_backdrop_filter);
|
||||||
@@ -2073,7 +2036,6 @@ impl YamlFrameReader {
|
|||||||
&filter_primitives,
|
&filter_primitives,
|
||||||
raster_space,
|
raster_space,
|
||||||
flags,
|
flags,
|
||||||
snapshot,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(yaml_items) = yaml["items"].as_vec() {
|
if let Some(yaml_items) = yaml["items"].as_vec() {
|
||||||
|
|||||||
Reference in New Issue
Block a user