Low performance when using BackgroundEffectBehavior.BlurEffect on many elements
Hello! I noticed in RenderDoc how the background is rendered several times in the offscreen. Each background is rendered into its own separate offscreen texture. The number of textures corresponds to the number of elements with this effect. Is this behavior advisable and am I using this effect correctly? Why is the background re-rendered into a separate offscreen texture? Why can't I use the background texture directly?
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:noesis="clr-namespace:NoesisGUIExtensions;assembly=NoesisGUI.GUI.Extensions">
<Grid.Resources>
<ResourceDictionary>
<Style TargetType="Rectangle">
<Setter Property="Width" Value="100" />
<Setter Property="Height" Value="32" />
<Setter Property="Margin" Value="0 4 0 0" />
<Setter Property="Fill" Value="#40FFFFFF" />
<Setter Property="noesis:StyleInteraction.Behaviors">
<Setter.Value>
<noesis:StyleBehaviorCollection>
<noesis:BackgroundEffectBehavior Source="{Binding ElementName=BGImage}">
<BlurEffect Radius="10"/>
</noesis:BackgroundEffectBehavior>
</noesis:StyleBehaviorCollection>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Grid.Resources>
<Border>
<Image x:Name="BGImage" Source="Background.jpg" Stretch="Fill"/>
</Border>
<StackPanel Orientation="Horizontal">
<StackPanel>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
</StackPanel>
<Span Width="40" />
<StackPanel>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
</StackPanel>
<Span Width="40" />
<StackPanel>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
</StackPanel>
<Span Width="40" />
<StackPanel>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
</StackPanel>
<Span Width="40" />
<StackPanel>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
<Rectangle/>
</StackPanel>
</StackPanel>
</Grid>
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Re: Low performance when using BackgroundEffectBehavior.BlurEffect on many elements
Hi, this looks like something is wrong in our code because if the source of the behavior is always the same it should reuse the offscreen texture for all instances. Could you please report this in our bugtracker?
Re: Low performance when using BackgroundEffectBehavior.BlurEffect on many elements
I created a ticket #3161. Thanks for the feedback!Hi, this looks like something is wrong in our code because if the source of the behavior is always the same it should reuse the offscreen texture for all instances. Could you please report this in our bugtracker?
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Re: Low performance when using BackgroundEffectBehavior.BlurEffect on many elements
Thanks for the ticket, we've found the source of the problem and fixed it for the next release.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests