These are chat archives for AvaloniaUI/Avalonia

19th
May 2018
Wiesław Šoltés
@wieslawsoltes
May 19 2018 10:37 UTC
@grokys Do we support Auto for Width and Height properties?
Portable.Xaml.XamlObjectWriterException
  HResult=0x80131500
  Message=Could not convert object 'Auto' (of type System.String) to {http://schemas.microsoft.com/winfx/2006/xaml}Double: Auto is not a valid value for Double.
  Source=Avalonia.Markup.Xaml
  StackTrace:
   at Portable.Xaml.XamlObjectWriterInternal.GetCorrectlyTypedValue(XamlMember xm, XamlType xt, Object value)
   at Portable.Xaml.XamlObjectWriterInternal.StoreAppropriatelyTypedValue(ObjectState state, MemberAndValue ms, Object obj, Object keyObj)
   at Portable.Xaml.XamlObjectWriterInternal.OnWriteValue(Object value)
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.LoadFromReader(XamlReader reader, AvaloniaXamlContext context, IAmbientProvider parentAmbientProvider)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Type type, Object rootInstance)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Object obj)
   at Core2D.Avalonia.Views.MainControl.InitializeComponent() in D:\DOWNLOADS\GitHub-Avalonia\Core2D\src\Core2D.Avalonia\Views\MainControl.xaml.cs:line 26
   at Core2D.Avalonia.Views.MainControl..ctor() in D:\DOWNLOADS\GitHub-Avalonia\Core2D\src\Core2D.Avalonia\Views\MainControl.xaml.cs:line 18

Inner Exception 1:
Exception: Auto is not a valid value for Double.

Inner Exception 2:
FormatException: Input string was not in a correct format.
My xaml:
<DockPanel LastChildFill="True" Background="Pink">
    <DockPanel LastChildFill="True" Width="180" DockPanel.Dock="Left">
        <Border Background="Red" Width="180" Height="250" DockPanel.Dock="Top"/>
        <Border Background="Blue" Width="180" Height="Auto" DockPanel.Dock="Bottom"/>
    </DockPanel>
    <DockPanel LastChildFill="True" Width="240" DockPanel.Dock="Right">
        <Border Background="Green" Width="240" Height="250" DockPanel.Dock="Top"/>
        <Border Background="Orange" Width="240" Height="Auto" DockPanel.Dock="Bottom"/>
    </DockPanel>
    <Grid>
        <Border Background="Gray" Width="300" Height="300"/>
    </Grid>
</DockPanel>
Wiesław Šoltés
@wieslawsoltes
May 19 2018 10:43 UTC
@grokys AvaloniaUI/Avalonia#1601
Dariusz Komosiński
@MarchingCube
May 19 2018 11:20 UTC
@danwalmsley I just checked the control catalog behavior with Avalonia D2D backend and it has the same issues (or even worse) as my Skia gpu backend. Seems the problems is on the higher level - in how we handle window resizing and render thread interaction.
danwalmsley
@danwalmsley
May 19 2018 11:27 UTC
@MarchingCube ok, good to know :) I will have a play around with it see if we can find out more about whats going on. Do you think the skia changes are almost ready?
Steven Kirk
@grokys
May 19 2018 11:31 UTC
@MarchingCube do you mean the way the D2D backend kind of "rubber band"s during resizing?
danwalmsley
@danwalmsley
May 19 2018 11:35 UTC
@grokys that was one of the issues we were seeing
any ideas whats going on there?
Steven Kirk
@grokys
May 19 2018 11:36 UTC
yeah, basically, windows scales whatever you draw to fill the window
Dariusz Komosiński
@MarchingCube
May 19 2018 11:36 UTC
@grokys This, but also window contents move a bit
Mostly apparent on Calendar page
Steven Kirk
@grokys
May 19 2018 11:36 UTC
and the problem is that because we're drawing on a thread, the window can resize while we're drawing
Dariusz Komosiński
@MarchingCube
May 19 2018 11:36 UTC
Exactly
danwalmsley
@danwalmsley
May 19 2018 11:36 UTC
ah ok
Steven Kirk
@grokys
May 19 2018 11:36 UTC
when we come to swap buffers the window is now a different size to what we drew
so Windows scales it
there's an option to not do that
which was what we originally used
but that isn't supported on win7
tbh i think we need to draw to an offscreen buffer in the rendering thread
and then render that on the main thread
Dariusz Komosiński
@MarchingCube
May 19 2018 11:37 UTC
Yeah, I was thinking about it as well
So all backend rendering goes to a offscreen target, and we just use that on main thread
I did some check with EGL, and window size is completely unreliable there. EGL reports one size, Window control other, and GetClientRect another one.
And sometimes as I resize the Skia surface, the window size is already different :smile:
But I am thinking - would this behavior be fine for the scope of my PR? I just want to avoid creating gargantuan PR that changes half the rendering pipeline.
Steven Kirk
@grokys
May 19 2018 11:45 UTC
yeah i think that should be a different PR
Dariusz Komosiński
@MarchingCube
May 19 2018 11:48 UTC
And currently by default the Cpu Skia renderer is used, that does not have this issue. (You have to opt in the gpu support)
danwalmsley
@danwalmsley
May 19 2018 11:55 UTC
Why does this issue only happen with gpu?
Sorien
@Sorien
May 19 2018 12:00 UTC
its just more visible i can see is with current skia backend in windows10 and linux as well
Dariusz Komosiński
@MarchingCube
May 19 2018 12:01 UTC
Yeah, gpus are asynchronous so all timing stuff gets extrapolated.
Dariusz Komosiński
@MarchingCube
May 19 2018 12:42 UTC
Have you found any other issues @danwalmsley ? If no, I would try to wrap up the PR and unmark it as wip.
danwalmsley
@danwalmsley
May 19 2018 14:48 UTC
Not really the only thing was maybe Use Platform Detect should select Skia with gpu when possible and cpu when gpu won't work or isn't available?
Sorien
@Sorien
May 19 2018 18:20 UTC
when you apply Sorien/Avalonia@c17174d you can visually see what is happening during resize :)
Sorien
@Sorien
May 19 2018 18:26 UTC
image.png
Sorien
@Sorien
May 19 2018 18:58 UTC
and version without flickering Sorien/Avalonia@9776336 that way you can set default window black color to another one
Sorien
@Sorien
May 19 2018 19:28 UTC
btw current master has some problems I can't run Control.CatalogDesktop it will just crash (win10 latest update) without any error and when i try to force skia backend it says 'AppBuilder' does not contain a definition for 'UseSkia' and no extension method 'UseSkia' accepting a first argument of type 'AppBuilder' could be found (are you missing a using directive or an assembly reference?) ... ControlCatalog.NetCore doen't have such problems
Dariusz Komosiński
@MarchingCube
May 19 2018 20:06 UTC
@danwalmsley Ok, I will take a look what I can do there.
Also other question - should I move the Win32 Natives package reference to some .props file, or is it fine to have a direct package reference in Avalonia.Win32 project?
Jeremy Koritzinsky
@jkoritzinsky
May 19 2018 21:03 UTC
@MarchingCube can you move it to a .props file and then edit the build scripts to add the dependency to the Avalonia.Win32 package?
Dariusz Komosiński
@MarchingCube
May 19 2018 21:19 UTC
@jkoritzinsky Yep, I already fixed the cake scripts - didn't push that yet.
Will create the props file and push that. Also for your change request - will that stuff living in Avalonia.Visuals.Gpu be fine?
Jeremy Koritzinsky
@jkoritzinsky
May 19 2018 22:05 UTC
That sounds good to me!