Skip to content

qt: use non-branching fragment shader in window shadow effect if window is opaque

Fatih Uzunoğlu requested to merge fuzun/vlc:qt/hollowonlywhennecessary into master

The hollow shader discards the pixels that are in the interior area. It is known that branching in fragment shader should be avoided if possible.

By checking if the window is opaque, we can disable hollowing and use it only if the window is translucent or transparent (due to window backdrop blur effect).

The glow effect should not act as a filter for the window backdrop blur, it is only used for providing a glow effect around the edges. This was the reason of coming up with the possibility of hollowing.

Currently, areas of the interface that want to show the window backdrop effect use a hack to "punch a hole" as they are placed deep down in the scene graph hierarchy and in certain cases parent item(s) provide background color.

This hack is done by simply disabling blending but still painting with translucent colors (see ViewBlockingRectangle). In this case, it does not really matter if the glow effect here is hollow or not, because the areas that want to pass the backdrop effect disabling blending means that the glow effect would not be visible behind those areas anyway.

However, "punching hole" hack has been used as a convenience when it is necessary. In the future, the areas that want to pass the backdrop effect should placed in the scene graph hierarchy so that there is no item in beneath that is opaque. This is possibly impossible for the PIP player, but there are currently places in the interface that this can be done, such as the top bar. So, for these cases, we need hollowing so that the glow effect does not appear (and act as a filter) in the interface main area.

Request review @chub.

Edited by Fatih Uzunoğlu

Merge request reports

Loading