diff options
Diffstat (limited to 'gfx/wr/webrender/src/renderer/mod.rs')
-rw-r--r-- | gfx/wr/webrender/src/renderer/mod.rs | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/gfx/wr/webrender/src/renderer/mod.rs b/gfx/wr/webrender/src/renderer/mod.rs index a70d3eca18..ab3eb956b0 100644 --- a/gfx/wr/webrender/src/renderer/mod.rs +++ b/gfx/wr/webrender/src/renderer/mod.rs @@ -69,7 +69,7 @@ use crate::frame_builder::Frame; use glyph_rasterizer::GlyphFormat; use crate::gpu_cache::{GpuCacheUpdate, GpuCacheUpdateList}; use crate::gpu_cache::{GpuCacheDebugChunk, GpuCacheDebugCmd}; -use crate::gpu_types::{ScalingInstance, SvgFilterInstance, CopyInstance, PrimitiveInstanceData}; +use crate::gpu_types::{ScalingInstance, SvgFilterInstance, SVGFEFilterInstance, CopyInstance, PrimitiveInstanceData}; use crate::gpu_types::{BlurInstance, ClearInstance, CompositeInstance, CompositorTransform}; use crate::internal_types::{TextureSource, TextureCacheCategory, FrameId}; #[cfg(any(feature = "capture", feature = "replay"))] @@ -193,11 +193,11 @@ const GPU_TAG_CACHE_LINEAR_GRADIENT: GpuProfileTag = GpuProfileTag { label: "C_LinearGradient", color: debug_colors::BROWN, }; -const GPU_TAG_CACHE_RADIAL_GRADIENT: GpuProfileTag = GpuProfileTag { +const GPU_TAG_RADIAL_GRADIENT: GpuProfileTag = GpuProfileTag { label: "C_RadialGradient", color: debug_colors::BROWN, }; -const GPU_TAG_CACHE_CONIC_GRADIENT: GpuProfileTag = GpuProfileTag { +const GPU_TAG_CONIC_GRADIENT: GpuProfileTag = GpuProfileTag { label: "C_ConicGradient", color: debug_colors::BROWN, }; @@ -257,6 +257,10 @@ const GPU_TAG_SVG_FILTER: GpuProfileTag = GpuProfileTag { label: "SvgFilter", color: debug_colors::LEMONCHIFFON, }; +const GPU_TAG_SVG_FILTER_NODES: GpuProfileTag = GpuProfileTag { + label: "SvgFilterNodes", + color: debug_colors::LEMONCHIFFON, +}; const GPU_TAG_COMPOSITE: GpuProfileTag = GpuProfileTag { label: "Composite", color: debug_colors::TOMATO, @@ -288,6 +292,8 @@ impl BatchKind { } BatchKind::TextRun(_) => GPU_TAG_PRIM_TEXT_RUN, BatchKind::Quad(PatternKind::ColorOrTexture) => GPU_TAG_PRIMITIVE, + BatchKind::Quad(PatternKind::RadialGradient) => GPU_TAG_RADIAL_GRADIENT, + BatchKind::Quad(PatternKind::ConicGradient) => GPU_TAG_CONIC_GRADIENT, BatchKind::Quad(PatternKind::Mask) => GPU_TAG_INDIRECT_MASK, } } @@ -2527,6 +2533,35 @@ impl Renderer { ); } + fn handle_svg_nodes( + &mut self, + textures: &BatchTextures, + svg_filters: &[SVGFEFilterInstance], + projection: &default::Transform3D<f32>, + stats: &mut RendererStats, + ) { + if svg_filters.is_empty() { + return; + } + + let _timer = self.gpu_profiler.start_timer(GPU_TAG_SVG_FILTER_NODES); + + self.shaders.borrow_mut().cs_svg_filter_node.bind( + &mut self.device, + &projection, + None, + &mut self.renderer_errors, + &mut self.profile, + ); + + self.draw_instanced_batch( + &svg_filters, + VertexArrayKind::SvgFilterNode, + textures, + stats, + ); + } + fn handle_resolve( &mut self, resolve_op: &ResolveOp, @@ -3576,6 +3611,10 @@ impl Renderer { ); } + for (ref textures, ref filters) in &target.svg_nodes { + self.handle_svg_nodes(textures, filters, projection, stats); + } + for alpha_batch_container in &target.alpha_batch_containers { self.draw_alpha_batch_container( alpha_batch_container, @@ -4069,7 +4108,7 @@ impl Renderer { // Draw any radial gradients for this target. if !target.radial_gradients.is_empty() { - let _timer = self.gpu_profiler.start_timer(GPU_TAG_CACHE_RADIAL_GRADIENT); + let _timer = self.gpu_profiler.start_timer(GPU_TAG_RADIAL_GRADIENT); self.set_blend(false, FramebufferKind::Other); @@ -4095,7 +4134,7 @@ impl Renderer { // Draw any conic gradients for this target. if !target.conic_gradients.is_empty() { - let _timer = self.gpu_profiler.start_timer(GPU_TAG_CACHE_CONIC_GRADIENT); + let _timer = self.gpu_profiler.start_timer(GPU_TAG_CONIC_GRADIENT); self.set_blend(false, FramebufferKind::Other); |