These are chat archives for AvaloniaUI/Avalonia

6th
Jun 2017
Steven Kirk
@grokys
Jun 06 2017 07:11
ok, it's much clearer this morning. yep the problem is that controls are being measured in the wrong order.
Nikita Tsukanov
@kekekeks
Jun 06 2017 07:14
If there is no order with hashset, how did it work before?
Steven Kirk
@grokys
Jun 06 2017 07:48
there must be partial ordering, i'm guessing
Wiesław Šoltés
@wieslawsoltes
Jun 06 2017 07:51

i've not seen that video before! is that using the immediate renderer? i wonder how it looks with the deferred renderer

@grokys The WPF renderer is caching Pen's and Brush's and freezes them, Avalonia renderer does not cache anything (except bitmaps if used). The video show rendering of UI + 10000 lines + when shapes are selected additional 20000 rectangles are drawn for points (line start and end).

Steven Kirk
@grokys
Jun 06 2017 07:52
yeah so it would be a lot faster if we weren't creating pens and brushes from scratch every time too
Wiesław Šoltés
@wieslawsoltes
Jun 06 2017 07:52
this would reduce memory usage I think and perf would be better I think
oh and its all done in Debug mode :smile:
Steven Kirk
@grokys
Jun 06 2017 08:18
have you managed to try the deferred renderer with Core2D?
danwalmsley
@danwalmsley
Jun 06 2017 08:23
@grokys I was wanting to try with Avalon studio, but not found a way to do it with new nuget system
did you find a way to do it?
Steven Kirk
@grokys
Jun 06 2017 08:24
ne neither :( the correct way to do it would be to build the avalonia nuget packages locally and add the output directory as a nuget source, but i can't build the packages locally
danwalmsley
@danwalmsley
Jun 06 2017 08:24
even if we run the cake build script locally?
Nikita Tsukanov
@kekekeks
Jun 06 2017 08:24
you can download them from appveyor
Steven Kirk
@grokys
Jun 06 2017 08:24
the cake script fails for me, locally
danwalmsley
@danwalmsley
Jun 06 2017 08:25
is it not possible to have each branch create a feed on myget?
or perhaps we have a feed for major branches like this one?
Packages are there
Steven Kirk
@grokys
Jun 06 2017 08:25
even like that, it's not very convenient - i want to be able to make changes and test them
Nikita Tsukanov
@kekekeks
Jun 06 2017 08:26
I guess we need to provide a props file with the list of PackageReferences
danwalmsley
@danwalmsley
Jun 06 2017 08:26
yeh that is true
Nikita Tsukanov
@kekekeks
Jun 06 2017 08:26
So it would be easier to reference avalonia from git submodule
Steven Kirk
@grokys
Jun 06 2017 08:28
has anyone tried referencing avalonia as a submodule since we moved to <PackageReference>
that should fix the problems we were having using avalonia as asubmodule before
danwalmsley
@danwalmsley
Jun 06 2017 08:30
would still need to update them all to project references?
i'll give it a try
Steven Kirk
@grokys
Jun 06 2017 08:36
@kekekeks it's going to take me a while to fix the layout stuff
i need to first write tests and fix existing tests to not be so fragile
Nikita Tsukanov
@kekekeks
Jun 06 2017 08:37
I'll use a private build with some duct tape measures (remeasure the whole tree if anything is queued)
I don't have a lot of stuff to layout, just tons of stuff to draw
Steven Kirk
@grokys
Jun 06 2017 08:38
that would be great
i'll start working on a PR which moves the layout manager to ILayoutRoot
Nikita Tsukanov
@kekekeks
Jun 06 2017 08:39
existing one?
I guess it's better to split stuff from mouse-device-nolocator and existing effort on extracting layoutmanager
and work from there
Steven Kirk
@grokys
Jun 06 2017 08:42
yeah a different PR - if we can merge mouse-device-nolocator without the layout manager changes
Nikita Tsukanov
@kekekeks
Jun 06 2017 08:47
#1014
Nikita Tsukanov
@kekekeks
Jun 06 2017 08:53
wtf, I was sure that I've fixed popup tests
danwalmsley
@danwalmsley
Jun 06 2017 08:59
@grokys added avalonia as a submodule
I guess I need to add quite a few avalonia projects to my solution then, whats the minimum I can get away with?
Nikita Tsukanov
@kekekeks
Jun 06 2017 08:59
everything from the root of src
+ win32 and direct2d
That's the bare minimum, I guess
You can probably exclude diagnostics, designer support and gtk/cairo
danwalmsley
@danwalmsley
Jun 06 2017 09:01
I'm wondering if I leave all my referenced projects on the nuget but make the main executable reference the projects direct
which will it use?
the locally built one or the nugets?
Nikita Tsukanov
@kekekeks
Jun 06 2017 09:05
There are 3 options
a) nuget
b) local
c) compilation error
I'd go with the third one
Since there will be basically two copies of each type from avalonia
available to the compiler
danwalmsley
@danwalmsley
Jun 06 2017 09:18
you were right...
CSC : error CS1704: An assembly with the same simple name 'Avalonia.Visuals' has already been imported. Try removing one of the references (e.g. 'C:\dev\repos\AvalonStudio\Avalonia\src\Avalonia.Visuals\bin\Debug\netstandard1.1\Avalonia.Visuals.dll') or sign them to enable side-by-side.
I think running as a submodule is not going to be a workable solution
Nikita Tsukanov
@kekekeks
Jun 06 2017 09:21
why not
just create a .props file with imports
and include it somewhere
danwalmsley
@danwalmsley
Jun 06 2017 09:22
at the moment I'm having to remove all the nuget packages for about 15 projects
then manually add about 10 or more project references to the avalonia ones
then id want to switch back when I'm not debugging avalonia
what does a .props file do?
Nikita Tsukanov
@kekekeks
Jun 06 2017 09:24
You can create an ItemGroup with all project references there
and then just include it
Or even better, you can have two item groups
one for nuget, another for submodule
and a conditional switch between them
@grokys I've cleaned the mess caused by me merging only the part of PR
#1014 should be ready now
You can continue from there, I think
danwalmsley
@danwalmsley
Jun 06 2017 09:25
why does it not work copying over the files and replacing the ones in the nuget folder anymore?
that was fairly easy to do
Nikita Tsukanov
@kekekeks
Jun 06 2017 09:25
LayoutManager already moved, tests fixed to use proper root, etc
So it's only virtualizer that's failing
@danwalmsley which nuget folder?
packages directory in the project root is ignored by .NET Core SDK
Steven Kirk
@grokys
Jun 06 2017 09:26
ok great - i'll probably start off on another branch by fixing existing tests and then i'll merge to that PR branch
danwalmsley
@danwalmsley
Jun 06 2017 09:27
%UserDir%/.nuget/Packages
if you replace these it should work in theory?
Nikita Tsukanov
@kekekeks
Jun 06 2017 09:27
no idea, still works for me
at least when I was debugging msbuild targets for skia native libs
Steven Kirk
@grokys
Jun 06 2017 09:27
maybe there's a hash check there or something?
danwalmsley
@danwalmsley
Jun 06 2017 09:28
are we signing the avalonia binaries?
Nikita Tsukanov
@kekekeks
Jun 06 2017 09:28
nope
why would we do that
danwalmsley
@danwalmsley
Jun 06 2017 09:28
perhaps iv mixed up the .net core compatible binaries with the .net framework ones
Nikita Tsukanov
@kekekeks
Jun 06 2017 09:28
Well, there is one specific purpose for strong naming
danwalmsley
@danwalmsley
Jun 06 2017 09:28
what I normally do is build the control catalog
then copy the dlls from there
Nikita Tsukanov
@kekekeks
Jun 06 2017 09:28
which is VS plugins
danwalmsley
@danwalmsley
Jun 06 2017 09:32
it works!
image.png
@grokys ok I can get it to render Avalon studio
and it would be fair to say there are a few issues.
Steven Kirk
@grokys
Jun 06 2017 09:35
heh, yeah i imagine!
danwalmsley
@danwalmsley
Jun 06 2017 09:35
firstly it loads and WindowFrameBuffer constructor is called many times with width and height 0, throwing argument exception
after that I get this...
(that argument exception is thrown 100s of times during load)
its then doing calls from invalid thread to draw text, which I think makes the text editor look a bit crazy!
image.png
Steven Kirk
@grokys
Jun 06 2017 09:38
ok, so it has some issues ;) i definitely expected that
could you push to a branch and i'll take a look
(later)
danwalmsley
@danwalmsley
Jun 06 2017 09:39
I think because the exceptions are getting thrown it probably stops things working correctly
sure Ill push now
i just built controlcatalog.netcore, and copyied the dlls into userprofile/.nuget/packages and replaces appropriately
this is the branch you can use...
Steven Kirk
@grokys
Jun 06 2017 09:42
thanks!
danwalmsley
@danwalmsley
Jun 06 2017 09:44
no problem, should be easy to find and fix some of the bugs now
i'll have a look at my graphics corruption on my intellisense ;)
Steven Kirk
@grokys
Jun 06 2017 09:55
@danwalmsley that branch doesn't build for me: 7399 errors
Nikita Tsukanov
@kekekeks
Jun 06 2017 09:56
you need .NET Core 2.0 SDK and VS2017.3
danwalmsley
@danwalmsley
Jun 06 2017 09:57
git submodule update --init?
and restore nuget packages?
does that fix it?
Steven Kirk
@grokys
Jun 06 2017 09:57
no, do i need .NET Core 2.0 SDK and VS2017.3?
danwalmsley
@danwalmsley
Jun 06 2017 09:58
oh yeah
Steven Kirk
@grokys
Jun 06 2017 09:58
ah
danwalmsley
@danwalmsley
Jun 06 2017 09:58
you need .net core 2 preview 1
Steven Kirk
@grokys
Jun 06 2017 09:58
ok, i won't be able to debug it until 2017.3 is released then
danwalmsley
@danwalmsley
Jun 06 2017 09:58
i think you can probably do without vs2017.3
if it wont build on current vs2017
there is a workaround
let me know if it builds or not with .net core 2.0 preview installed
and I can push the workaround if needed
Steven Kirk
@grokys
Jun 06 2017 09:59
ok, i will try that later
Nikita Tsukanov
@kekekeks
Jun 06 2017 09:59
VS2017.3 is installed separately
So it doesn't break existing installation
extra 4GB though :(
Steven Kirk
@grokys
Jun 06 2017 10:00
yeah, even so - i'm super wary after all the problems i've had with 2017, i don't trust pre-releases
danwalmsley
@danwalmsley
Jun 06 2017 10:05
ah true it can be installed side by side and uninstalled seamlessly
runs in totally seperate
but you are right to be cautious
Steven Kirk
@grokys
Jun 06 2017 10:10
is it any faster?
danwalmsley
@danwalmsley
Jun 06 2017 10:12
a lot!
i had to stop developing Avalon studio until that came out
it was completely unusable before
Nikita Tsukanov
@kekekeks
Jun 06 2017 10:14
BTW, @grokys is there any plans for immediate renderer that would also use all that fancy stuff with dirty rect tracking and layer infrastructure?
Steven Kirk
@grokys
Jun 06 2017 10:15
not currently, no - i've not really even thought about how that might work
Nikita Tsukanov
@kekekeks
Jun 06 2017 10:15
Or at least one that can run on UI thread
Steven Kirk
@grokys
Jun 06 2017 10:15
it'd be difficult because you can draw outside control bounds
Nikita Tsukanov
@kekekeks
Jun 06 2017 10:15
With manual render pass triggering, I guess
Steven Kirk
@grokys
Jun 06 2017 10:15
that would be possible
@danwalmsley good to know. maybe i need to YOLO it
Nikita Tsukanov
@kekekeks
Jun 06 2017 10:16
So it would be just regular deferred renderer, but with render loop running on ui thread
And managed by toplevel impl, I guess
Steven Kirk
@grokys
Jun 06 2017 10:18
yeah, we could do that i think
danwalmsley
@danwalmsley
Jun 06 2017 10:20
lifes faster on the edge mate ;)
Wiesław Šoltés
@wieslawsoltes
Jun 06 2017 13:11

have you managed to try the deferred renderer with Core2D?

@grokys I did try to get it running but failed to build the scenegraph branch, but it was some time ago :worried:

Actually I think I have build the branch but got a lot of exceptions
when running Avalonia+Core2D
Joel Day
@joelday
Jun 06 2017 20:41
Hi all!
I have a .NET Core based console graphics library that I’ve been working on. I’ve built some UI framework stuff, very WPF like, but I’d like to see about making this work as a surface for Avalonia’s core stuff as is applicable.
It’s different in that it has its own pixel format (console characters, bg, fg, for instance), so it isn’t really translatable there, but all of the core framework stuff would be great to use.
Currently trying to figure out what interfaces to implement and how to bootstrap it all.
Thoughts?
Nikita Tsukanov
@kekekeks
Jun 06 2017 20:45
You can probably use AvaloniaObject (properties/bindings) and xaml support without any changes
Controls have to be implemented from scratch, I'm afraid
Joel Day
@joelday
Jun 06 2017 20:46
No worries on controls. These would probably be totally different IVisuals, etc.
Nikita Tsukanov
@kekekeks
Jun 06 2017 20:47
You can try to use our template engine, but our templated control inherits from visual
Framework is structured in layers
Avalonia.Base can be used as is, I think
Joel Day
@joelday
Jun 06 2017 20:48
What I was hitting was where I needed DependencyProperties, etc. and the prospect of being able to use Xaml.
Also data binding.
Bindings, properties all live there
Avalonia.Styling depends on Avalonia.Visuals, unfortunately
Joel Day
@joelday
Jun 06 2017 20:49
Cool. So, what I wrote has an Application, which has its own dispatcher, so it has an event loop independent of yielding on Console.ReadKey, which dispatches keyboard events, etc.
Should I keep that around or use something from Avalonia?
Nikita Tsukanov
@kekekeks
Jun 06 2017 20:50
Well
The thing is that you can run avalonia with "headless" platforms
Joel Day
@joelday
Jun 06 2017 20:50
For all of the Properties, Bindings, etc. do I need to give it a dispatcher, etc?
Nikita Tsukanov
@kekekeks
Jun 06 2017 20:51
i. e. stubs instead of windowing/rendering platforms
Joel Day
@joelday
Jun 06 2017 20:51
Yeah, that’s what I’m excited about.
I’m fine with separate implementation of visuals and rendering.
I do want to try to get framework, properties, bindings, layout and events, though.
Nikita Tsukanov
@kekekeks
Jun 06 2017 20:52
That could be done, I think
Joel Day
@joelday
Jun 06 2017 20:53
The main wall I hit was where I need to do focus management, stateful property inheritance (disabled via parent beign disabled, etc.) and attached properties, ie. Grid.Column
Way too much wheel reinvention there.
Let me see how much I can use from Base and then resolve dependencies I have to implement as needed.
Glad to know this is remotely possible. :D
Nikita Tsukanov
@kekekeks
Jun 06 2017 20:54
I guess the easiest way would be to reuse existing infrastructure and just ignore the fact that IVisual has void Render(DrawingContext context); method
Joel Day
@joelday
Jun 06 2017 20:54
Thank you!
Hm. I can do my own render pass entirely.
I’ll see what I can get going there, but starting from the bottom.
Nikita Tsukanov
@kekekeks
Jun 06 2017 20:56
You could even reuse existing visuals and controls
By implementing custom handling for them in your renderer
So instead of calling Render on the visual
You could manually select appropriate implementation
Joel Day
@joelday
Jun 06 2017 20:56
Would be nice to reuse primitives
Panel/Grid/StackPanel, etc.
Alright, I’ll give it a shot. Thanks!
Nikita Tsukanov
@kekekeks
Jun 06 2017 20:58
The closest thing to what you are trying to do is our fbdev platform
You could probably even get previewer support
as long as your widgets actually implement Render(DrawingContext ctx)
Previewer will be able to show them
Nikita Tsukanov
@kekekeks
Jun 06 2017 21:03
So you could create some simulated console UI rendering
Joel Day
@joelday
Jun 06 2017 21:05
The main challenge of doing anything on the IVisual level is that my concept of a pixel format doesn’t translate well
Well, I might want to re-think that.
Nikita Tsukanov
@kekekeks
Jun 06 2017 21:05
I'm not sure if there even is a "pixel format" in terminal
Joel Day
@joelday
Jun 06 2017 21:06
My concept of a pixel is a character, background color, foreground color, along with additional attributes
I don’t think that’s actually a limiting factor, though
I can still implement text rendering where it is just blitted on top of what is in the render target
Nikita Tsukanov
@kekekeks
Jun 06 2017 21:11

concept of a pixel is a character, background color, foreground color

Does your engine have words "dwarf" or "fortress" in its name?

Joel Day
@joelday
Jun 06 2017 21:12
Haha, it probably should. ;)
Is the system responsible for actually rendering the text itself?
Nikita Tsukanov
@kekekeks
Jun 06 2017 21:13
Visuals are
Joel Day
@joelday
Jun 06 2017 21:14
I mean I already have all of that, but I have to control actually putting the characters onto the render target
I have a simple text and a Figlet text renderer