Merge lp://staging/~loic.molinari/qtmir/qtmir-custom-mirsurfacenode into lp://staging/qtmir

Proposed by Loïc Molinari
Status: Work in progress
Proposed branch: lp://staging/~loic.molinari/qtmir/qtmir-custom-mirsurfacenode
Merge into: lp://staging/qtmir
Diff against target: 1279 lines (+1095/-21)
13 files modified
CMakeLists.txt (+2/-1)
src/modules/Unity/Application/CMakeLists.txt (+2/-0)
src/modules/Unity/Application/mirsurfaceitem.cpp (+44/-20)
src/modules/Unity/Application/mirsurfaceitem.h (+11/-0)
src/modules/Unity/Application/mirsurfacenode.cpp (+736/-0)
src/modules/Unity/Application/mirsurfacenode.h (+55/-0)
src/modules/Unity/Application/resources.qrc (+10/-0)
src/modules/Unity/Application/shaders/edge.frag (+24/-0)
src/modules/Unity/Application/shaders/edge.vert (+74/-0)
src/modules/Unity/Application/shaders/fill.frag (+24/-0)
src/modules/Unity/Application/shaders/fill.vert (+26/-0)
src/modules/Unity/Application/shaders/offsetfill.vert (+64/-0)
src/modules/Unity/Application/shaders/opaquefill.frag (+23/-0)
To merge this branch: bzr merge lp://staging/~loic.molinari/qtmir/qtmir-custom-mirsurfacenode
Reviewer Review Type Date Requested Status
Mir development team Pending
Review via email: mp+274869@code.staging.launchpad.net

Commit message

Switched to a custom mir surface node.

MirSurfaceNode is a Qt scene graph node that renders a texture with a given filtering. It can be compared to the image node provided by QtQuick (although simpler) with the addition of a more efficient antialiasing technique that keeps the same quality.

QtQuick provides 2 different antialiasing techniques. The first one is called multisampling and is proposed by the underlying hardware. It can be enabled at window creation time by defining a number of samples on the QSurfaceFormat associated to the created QtQuick scene (window). The efficiency of that technique is highly dependent on the hardware and often not adapted. The second technique is called vertex antialiasing, when the antialiasing property is set to true on a QtQuick item, QtQuick switches to that technique which adds 4 new vertices with additional attributes and lets the vertex shader accurately set their position and opacity fall-off. The drawback of this technique is that it forces the whole node to be rendered in the translucent pass of the renderer even though the whole content of the node is opaque, another drawback is that it oten prevents batching.

The antialiasing technique provided by this node prevents both issues by creating 2 geometry nodes, a FillNode that is made to fill the content and an EdgeNode that is made to render the antialiased edge. The edge node uses exactly the same vertex-based algorithm than the default QtQuick nodes.

This technique is perfectly adapted to the rendering of the Spread, where there is quite a lot of overdraw, by bringing back the ability for GPUs to use early-Z cull optimisations.

This is a first step and the performance boost implied by that change can't be noticed directly since the surface nodes are currently always backing ARGB surfaces. This QtMir branch (lp:~unity-team/qtubuntu/requested-surface-format-fix) will fix that.

Description of the change

Switched to a custom mir surface node.

MirSurfaceNode is a Qt scene graph node that renders a texture with a given filtering. It can be compared to the image node provided by QtQuick (although simpler) with the addition of a more efficient antialiasing technique that keeps the same quality.

QtQuick provides 2 different antialiasing techniques. The first one is called multisampling and is proposed by the underlying hardware. It can be enabled at window creation time by defining a number of samples on the QSurfaceFormat associated to the created QtQuick scene (window). The efficiency of that technique is highly dependent on the hardware and often not adapted. The second technique is called vertex antialiasing, when the antialiasing property is set to true on a QtQuick item, QtQuick switches to that technique which adds 4 new vertices with additional attributes and lets the vertex shader accurately set their position and opacity fall-off. The drawback of this technique is that it forces the whole node to be rendered in the translucent pass of the renderer even though the whole content of the node is opaque, another drawback is that it oten prevents batching.

The antialiasing technique provided by this node prevents both issues by creating 2 geometry nodes, a FillNode that is made to fill the content and an EdgeNode that is made to render the antialiased edge. The edge node uses exactly the same vertex-based algorithm than the default QtQuick nodes.

This technique is perfectly adapted to the rendering of the Spread, where there is quite a lot of overdraw, by bringing back the ability for GPUs to use early-Z cull optimisations.

This is a first step and the performance boost implied by that change can't be noticed directly since the surface nodes are currently always backing ARGB surfaces. This QtMir branch (lp:~unity-team/qtubuntu/requested-surface-format-fix) will fix that.

To post a comment you must log in.
386. By Loïc Molinari

Converted comment to 80 chars line wrap as expected by Qt coding guidelines.

Unmerged revisions

386. By Loïc Molinari

Converted comment to 80 chars line wrap as expected by Qt coding guidelines.

385. By Loïc Molinari

Switched to a custom MirSurfaceNode.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches