These are chat archives for AvaloniaUI/Avalonia

2nd
Nov 2015
Johan Larsson
@JohanLarsson
Nov 02 2015 06:38
8) rewrite the whole thing in Rust :)
Steven Kirk
@grokys
Nov 02 2015 08:22
what were your questions?
Visual brush (why don't we have them implemented in xplat way?) - using a RTB and ImageBrush? Yeah, that might work
VisualBrush was implemented before ImageBrush though which is why it wasn't done that way
bitmap/disposable: Perspex/Perspex#135
if you want to change the path api to make it more x-plat: go ahead. the api was copied verbatim from wpf
Nikita Tsukanov
@kekekeks
Nov 02 2015 09:49
The question is
Do we really need geometry and bitmap to be disposable
Or that can be managed by GC
Nikita Tsukanov
@kekekeks
Nov 02 2015 10:27
Considering arcTo. It seems that it's possible to draw ovals using both Cairo and Skia. But oval rotation support seems to be ms-specific
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 10:32

Do we really need geometry and bitmap to be disposable

Perspex/Perspex#264

In my app I am custom drawing a lot of geometry, the memory leaks are huge.
Also when you have a lot of UI changes the memory usage is huge.
I can hit easily 2GB of memory usage, comparing to similiar WPF app memory usage stays low and constant.
Nikita Tsukanov
@kekekeks
Nov 02 2015 10:34
Pespex is leaking memory
Steven Kirk
@grokys
Nov 02 2015 10:44
yeah, maybe i should investigate the leaking memory
i've been leaving perf stuff until later because so far features were more important, but maybe now perf/memory is getting more important as you can now do stuff ;)
Nikita Tsukanov
@kekekeks
Nov 02 2015 10:46
The leask is probably caused by some very stupid type
Steven Kirk
@grokys
Nov 02 2015 10:46
part of the problem is, we are using the WPF paradigm of "no dispose, finalizers take care of everything"
yeah, probably
@wieslawsoltes is the leak huge only when on GTK? or also when using the Direct2D backend?
Nikita Tsukanov
@kekekeks
Nov 02 2015 10:47

part of the problem is, we are using the WPF paradigm of "no dispose, finalizers take care of everything"

That's probably fine

Since we are disposing drawing contexts
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 10:48
The GTK message is from debug output, I did not check what memory usage was running under Linux/GTK
Steven Kirk
@grokys
Nov 02 2015 10:48
yeah, but i think it caused problems for @ncarrillo when he tried to remove the path leaks on gtk
so the huge leaking is happening on Direct2D?
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 10:48
But I did run memory profiler on VS2015 on Windows
and I get memory usage up to 2GB within very short time.
Steven Kirk
@grokys
Nov 02 2015 10:49
thing is, there are other really important things missing, like looking up controls by name!
my thinking is to prioritize features right now
did your profiling show up what was leaking?
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 10:53
I will run profiler in afternoon and post screenshots.
Przechwytywanie.PNG
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 10:59
This are results of CPU profiler done on my app.
Steven Kirk
@grokys
Nov 02 2015 11:00
there's a lot we can do to speed up CPU
but not worth doing it while stuff is changing all the time
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 11:02
I do not worry about CPU usage, this was done using Debug mode and under debugger, in release mode without debugger performance is ok.
But the memory usage is another story.
Steven Kirk
@grokys
Nov 02 2015 11:03
yeah, thing is - what is more important right now?
if you can't write useful apps then it doesn't matter how much memory is used
unless you wanted to try fixing the leaks?
i wonder if there's a way to unit test memory usage?
José Manuel Nieto
@SuperJMN
Nov 02 2015 11:19

but not worth doing it while stuff is changing all the time

I TOTALLY agree

don't optimize until you can identify bottlenecks
never ever
Nikita Tsukanov
@kekekeks
Nov 02 2015 11:21
Well, I've got someone who knows math to look at our arcTo problem
He says that he can probably implement WPF API using cubic bezier lines
BTW, skia uses quadratic beziers instead of proper ellipses anyway, so it should be fine
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 11:26

He says that he can probably implement WPF API using cubic bezier lines

WPF draws arcs using cubic beziers

Nikita Tsukanov
@kekekeks
Nov 02 2015 13:08
@grokys What's the purpose of IPlatformRenderingInterface::CreateBitmap?
It creates an empty bitmap
What would you need one for?
Nikita Tsukanov
@kekekeks
Nov 02 2015 13:16
Skia-backed rendertargetbitmap seems to be operational, yay
Eric Winnington
@ewinnington
Nov 02 2015 13:22
So skia would be a replacement for gtk as a backend?
Nikita Tsukanov
@kekekeks
Nov 02 2015 13:22
May be
For now I'm planning to use it for iOS/Android
They have less problems with fragmentation
Eric Winnington
@ewinnington
Nov 02 2015 13:22
Ah ok, right.
Nikita Tsukanov
@kekekeks
Nov 02 2015 13:23
It might be worth to replace cairo with skia, althrough
Since cairo is awful at scaling images
Eric Winnington
@ewinnington
Nov 02 2015 13:23
By the way, have you seen this WPF to JS implementation? https://github.com/yuvaltz/Granular
Nikita Tsukanov
@kekekeks
Nov 02 2015 13:24
Granular has one fatal flaw
it forces you to use JS
For now it's not using hw accel, since I was too lazy to setup things properly
Better get everything working with software renderer first
Eric Winnington
@ewinnington
Nov 02 2015 13:27
Yes. I would definitely prefer to stay in a single environment (C# / Mono / .NetCore with Perspex) than having to bundle HTML / JS with a QT5 webview or an Electron (nodeJS / Chromium) package. But it's great to see that a lot of people are working on solutions for WPF -> X. It means the demand for Perspex is there.
Nikita Tsukanov
@kekekeks
Nov 02 2015 13:28
@jakesays is working on Aura windowing backend
When he finishes it, perspex will have something a backend that is, essentially, chromium
Since skia and aura are chromium rendering and windowing subsystems
Steven Kirk
@grokys
Nov 02 2015 13:36
hmm, can't remember what creating empty bitmap was used for. seems its not used any more though anyway..
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:18
Perspex2.PNG
Perspex3.PNG
Perspex5.PNG
Perspex1.PNG
Perspex4.PNG
Weston
@ronnyek
Nov 02 2015 15:18
anyone alive?
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:18
Memory profiler result for Perspex (Windows 10 x64)
Weston
@ronnyek
Nov 02 2015 15:18
nice!
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:19
And for comparison same app but in WPF, please note that in WPF version I am rendering 10 000 shapes and in Perpex 1000
Lot of shapes
Weston
@ronnyek
Nov 02 2015 15:19
anyone here that could answer a few architectual questions?
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:20
Wpf2.PNG
Wpf1.PNG
Wpf4.PNG
Wpf3.PNG
Weston
@ronnyek
Nov 02 2015 15:20
eg, what ultimately does the drawing, skia or cairo or something liek that?
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:20
yep
On windows we use Direct2D by default
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:20
And this was for WPF version
Weston
@ronnyek
Nov 02 2015 15:20
interesting decision
I guess if you can eek a bit more performance out of it
better off
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:21
Well, we haven't done any performance optimizations yet
Weston
@ronnyek
Nov 02 2015 15:21
good
early optimization is bad bad
whats used in linux
for actual raw drawing
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:22
Cairo
Weston
@ronnyek
Nov 02 2015 15:22
nice
you guys use libcairo for mono, or built new interop packages?
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:22
Mono.Cairo
We may replace it with skia through
Weston
@ronnyek
Nov 02 2015 15:23
skia is a bitch and chrome engineers say they dont support and dont recommend wrapping up skia.dll
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:23
Ehm?
Weston
@ronnyek
Nov 02 2015 15:23
eg, a non statically linked library
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:23
We aren't wrapping it
Weston
@ronnyek
Nov 02 2015 15:23
I mean building interop around it
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:23
Currently I'm implementing perspex drawing API directly in C++
Weston
@ronnyek
Nov 02 2015 15:24
ahh
I was looking ot build drawing toolkit for a embedded engine I was building
I was playing wiht skia and cairo
and when I was talking to them about using skia by itself, they made it sound like that would be a bad idea
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:25
Hm
Haven't encountered any issues so far
Weston
@ronnyek
Nov 02 2015 15:25
cool
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:26
It's a bit complicated to get hw-accellerated canvas without using their window abstraction through
Weston
@ronnyek
Nov 02 2015 15:26
yeah
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:26
I still don't have that bit implemented
Weston
@ronnyek
Nov 02 2015 15:26
I was shooting to use it fb direct, or through wayland so it was kinda questionable in the first place
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:27
Well, Skia supports drawing on whatever OpenGL surface you can provide
And can use software rasterization
Weston
@ronnyek
Nov 02 2015 15:27
yeah
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:28
Currently I'm using SetDIBitsToDevice to draw render results to the screen
Weston
@ronnyek
Nov 02 2015 15:28
thats my goal, ui toolkit that sits on embedded linux using somethign lighter weight than xwindows
seems like you guys did the hard part already =)
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:28
Well, skia backend is still in development
Stable one uses Gtk+Cairo
Weston
@ronnyek
Nov 02 2015 15:29
oh so its not even raw cairo at that point
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:29
We also have some code for multiplexing windows on one surface
It's intended to be used on mobile devices
Weston
@ronnyek
Nov 02 2015 15:29
nice!
Weston
@ronnyek
Nov 02 2015 15:30
wow
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:30
No support for window decorations yet
Weston
@ronnyek
Nov 02 2015 15:31
for embedded shit I'd be doing, I wouldnt really want the decorations
Well, you might want them for dialogs
message boxes, etc
Weston
@ronnyek
Nov 02 2015 15:31
oh yeah I could see that
@kekekeks - this is really quite promising
I hope theres a way I could contribute back to these efforts one day
you guys have all that tinywm stuff actually running on mobile hardware presenting ui?
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:32
Not yet
It's platform-independent
Weston
@ronnyek
Nov 02 2015 15:32
sure
Steven Kirk
@grokys
Nov 02 2015 15:32
@wieslawsoltes so from your investigations do you have any idea what's leaking?
(hi @ronnyek !)
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:33
@grokys You can't properly investigate memory leaks using VS tools. You need something like dotMemory
Weston
@ronnyek
Nov 02 2015 15:33
and as far as runtime, is it mono only under linux or could we theoretically see this operational in core clr in the enar future?
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:33
Perspex itself is purely PCL
Weston
@ronnyek
Nov 02 2015 15:33
bitchin
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:34
Skia backend won't depend on mono-specific stuff, it only needs DllImport and some functions from System.Runtime.InteropServices.Marshal
The problem is windowing subsystem
Currently we depend on GTK# which depends on mono
Weston
@ronnyek
Nov 02 2015 15:34
yaeh you have to pull all that stuff from their windowing env that chrome os uses?
I cant remember the name of it
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:35
There is some guy who wanted to implement windowing backend on top of Aura
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:35
@grokys Not yet just did quick tests, but ITS seems that GC is not collecting a lot of stuff
Weston
@ronnyek
Nov 02 2015 15:35
@kekekeks I know someone that migh tbe
haha
was trying to talk me into doing that wiht my toolkit experiments
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:36
The heap just keeps groving
Weston
@ronnyek
Nov 02 2015 15:36
not a TON of people who know what aura is
Weston
@ronnyek
Nov 02 2015 15:38
wtf are ogv files
orgg?
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:38
Just open it with vlc
Eric Winnington
@ewinnington
Nov 02 2015 15:38
Video files, VLC
Weston
@ronnyek
Nov 02 2015 15:39
ahh
I wish my c++ was stronger, I'd love to be able to help out in some way shape or form
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:39
Well, the wrapper code isn't that big
Weston
@ronnyek
Nov 02 2015 15:44
any particular areas you guys need help?
I mean anywhere? xaml side, controls, designer, etc?
Steven Kirk
@grokys
Nov 02 2015 15:45
ha, everywhere! ;)
designer particularly
because it's something that i don't know anything about
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:48
PerspexTextRenderer.PNG
@grokys PerspexTextRenderer looks like leak source candidate
Steven Kirk
@grokys
Nov 02 2015 15:50
ah ok interesting
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:50
FormattedText isn't cached or something
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:53
PerspexTextRenderer2.PNG
Next snapshot, same scenario
Weston
@ronnyek
Nov 02 2015 15:53
for delcarative ui like xaml, designer SHOULD theoretically be pretty straightforward
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:53
I am setting contentcontrol content property based on selected shape object, this is same object all the time
Steven Kirk
@grokys
Nov 02 2015 15:54
so it's a dictionary mapping Guids to a CppObjectShadow
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:54
And same datatemplate used, looks like datatemplate is recreated each time
Nikita Tsukanov
@kekekeks
Nov 02 2015 15:54

for delcarative ui like xaml, designer SHOULD theoretically be pretty straightforward

Good luck with "straightforward" intellisense support

Steven Kirk
@grokys
Nov 02 2015 15:55
i have no idea what a CppObjectShadow is
Wiesław Šoltés
@wieslawsoltes
Nov 02 2015 15:58
PerspexTextRenderer3.PNG
This is current heap
Steven Kirk
@grokys
Nov 02 2015 16:10
hmm still not sure what's causing it
Nikita Tsukanov
@kekekeks
Nov 02 2015 16:24
We can switch to skia, you know :)
Ein .NET, ein Perspex, ein Anzeigemodul
Weston
@ronnyek
Nov 02 2015 16:33
@kekekeks get her done
Weston
@ronnyek
Nov 02 2015 16:38
haha
Weston
@ronnyek
Nov 02 2015 17:10
@kekekeks when referring to skia drawign on opengl surface, do you mean drawign via bitmap, and rendering that to a opengl surface?
Nikita Tsukanov
@kekekeks
Nov 02 2015 19:39
Skia's canvas can use opengl functions to render stuff
that's called hardware-accellerated graphics
Johan Larsson
@JohanLarsson
Nov 02 2015 19:40
how does binding stuff in contextmenus and tooltips work in perspex?
Nikita Tsukanov
@kekekeks
Nov 02 2015 19:41
I thought it does inherit DataContext from its parent in original hierarchy. If it doesn't, we need to fix that
Johan Larsson
@JohanLarsson
Nov 02 2015 19:43
in wpf it does not
makes me write stuff like this
Nikita Tsukanov
@kekekeks
Nov 02 2015 19:44
Yep, that's horrible
Johan Larsson
@JohanLarsson
Nov 02 2015 19:44
very limited also, no element name etc
ad hoc horribleness
Steven Kirk
@grokys
Nov 02 2015 19:51
yep, popups inherit DataContext
Steven Kirk
@grokys
Nov 02 2015 19:55
should popups define their own name scope or not?
Johan Larsson
@JohanLarsson
Nov 02 2015 19:55
don't think so
feels so natural that they inherit from parent
Nikita Tsukanov
@kekekeks
Nov 02 2015 19:56
In WPF it was a bit nightmarish to bind to stuff from popups/tooltips
In most cases they are a part of something else
For cases when popup/tooltip is something standalone we can define some mode switcher
Johan Larsson
@JohanLarsson
Nov 02 2015 20:03
not sure how namescopes work but perhaps it can have a namescope but inherit from parent
search its own first and look in parent if not found