Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite of rendering stack #827

Merged
merged 211 commits into from
Aug 5, 2017
Merged

Rewrite of rendering stack #827

merged 211 commits into from
Aug 5, 2017

Conversation

grokys
Copy link
Member

@grokys grokys commented Dec 21, 2016

Previously we redrew everything on a window each time the window contents changed. This PR implements a new DeferredRenderer class (the previous renderer is still available as ImmediateRenderer) which renders to a low-level scenegraph on the UI thread which is then renderered to the window on a separate render thread.

This gives us:

  • The ability to only draw the controls that have changed
  • Proper hit-testing of geometry instead of control bounds
  • A dirty-rects debug overlay (currently enabled by default in ControlCatalog and RenderTests - this will be disabled when the PR is ready)

Things left to do:

  • VisualBrushes are currently broken (don't open the DropDown page in ControlCatalog!)
  • Fix DPI scaling on skia
  • Fix cairo
  • Fix opacity masks
  • Fix geometry clips
  • Embedding native widgets

Known problems that I'm going to punt to a later PR to prevent this one growing too huge:

  • Performance on D2D with controls with transparency is bad (such as disabled buttons). This is because we currently use RenderTargetBitmaps for render layers and in D2D they are backed with WIC bitmaps, which need to be format converted on every frame
  • All layers are still composited on every frame, whether there is something to draw or not. This is beacuse D2D is double buffered and we need to be sure both buffers are updated. We need to provide dirty rects when flipping the swap chain to fix this.

Fixes #201
Fixes #646

grokys and others added 30 commits November 5, 2016 19:36
Whole tree is currently being updated and rendered still though and lots doesn't even build.
Use the one in Avalonia.UnitTests.
 Conflicts:
	tests/Avalonia.Visuals.UnitTests/TestRoot.cs
Based solely on control bounds as before.
This means we now correctly hit test circles etc.
Now that we use the scenegraph for hit testing. This fixes the tabs in
ControlCatalog.
In hit testing unit tests.
And add to-do for RectangleNode geometry hit-test.
And added a test for it.
Render them in DeferredRenderer rather than in VisualNode.
When not in a unit test, only update the scene from the render loop.
- We don't need ConcurrentQueue in renderer
- DirtyRects coalescing was wrong
- Display number of updated rects for debug until we have dirty rect
rendering
- Animate 2 items at once in RenderTest
Previous code was me trying to work something out.
@danwalmsley
Copy link
Member

image
Just got this exception on scenegraph :(

will keep an eye out for it.

@grokys
Copy link
Member Author

grokys commented Aug 4, 2017

@kekekeks how's this looking to you now?

@grokys grokys merged commit 8d68db8 into master Aug 5, 2017
@grokys grokys deleted the scenegraph branch August 5, 2017 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't repaint window every frame Add support for mouse transparency
3 participants