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

Conversation

Projects
3 participants
@grokys
Member

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 added some commits Nov 4, 2016

Initial implementation of low-level scene graph.
Whole tree is currently being updated and rendered still though and lots doesn't even build.
Removed duplicate TestRoot.
Use the one in Avalonia.UnitTests.
Merge branch 'remove-duplicate-testroot' into scenegraph
 Conflicts:
	tests/Avalonia.Visuals.UnitTests/TestRoot.cs
Initial implementation of scenegraph hit testing.
Based solely on control bounds as before.
Use scene geometry for hit-testing.
This means we now correctly hit test circles etc.
Fix hit testing on tab strip items.
Now that we use the scenegraph for hit testing. This fixes the tabs in
ControlCatalog.
Don't need the context.Render any more.
In hit testing unit tests.
Fix GeometryNode hit test.
And add to-do for RectangleNode geometry hit-test.
Fixed pointerover state.
And added a test for it.
Render child visual nodes explicitly.
Render them in DeferredRenderer rather than in VisualNode.
Special case for hit testing in unit tests.
When not in a unit test, only update the scene from the render loop.
Fixed a few things.
- 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
Simplification.
Previous code was me trying to work something out.
@danwalmsley

This comment has been minimized.

Member

danwalmsley commented Jul 12, 2017

This branch may also have the following issues:

  • Mouse transparency preventing context menu closing (command is initiated) (see #1063)
    this was not a scengraph issue and resolved by #1066
  • Mouse transparency preventing pointerover on drop down items, unless right over the textblock part. (can be reproduced in control catalog - open a drop down and move mouse over an option but not over text part)

grokys added some commits Jul 13, 2017

Fix ScrollViewer background.
It was being set twice.
Fixed ScrollViewer background correctly.
Removed it from the wrong place in the previous commit.
@danwalmsley

This comment has been minimized.

Member

danwalmsley commented Jul 20, 2017

image
Just got this exception on scenegraph :(

will keep an eye out for it.

grokys added some commits Aug 2, 2017

Use Vector for DPI.
Still needs changing in `IPlatformRenderInterface` but I'd prefer to make that change in a separate PR.
Throw NotSupportedException.
And add a description of why it's not supported.
Removed IRendererFactory.
Make the `ITopLevelImpl` create the renderer instead.
@grokys

This comment has been minimized.

Member

grokys commented Aug 4, 2017

@kekekeks how's this looking to you now?

@grokys grokys merged commit 8d68db8 into master Aug 5, 2017

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@grokys grokys deleted the scenegraph branch Aug 5, 2017

@kekekeks kekekeks moved this from In Progress to Done in 0.6.0 Sep 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment