Bug 423812 - Kirigami ShadowedRectangle fails with KDeclarative's ForceGlCoreProfile=true setting
Summary: Kirigami ShadowedRectangle fails with KDeclarative's ForceGlCoreProfile=true ...
Status: REPORTED
Alias: None
Product: frameworks-kirigami
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: Master
Platform: Other Linux
: NOR normal
Target Milestone: Not decided
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-02 21:44 UTC by Friedrich W. H. Kossebau
Modified: 2020-07-03 09:56 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Friedrich W. H. Kossebau 2020-07-02 21:44:29 UTC
SUMMARY
The old developer setting "ForceGlCoreProfile=true" from KDeclarative triggers
--- 8< ---
    auto format = QSurfaceFormat::defaultFormat();
    if (s.forceGlCoreProfile()) {
        format.setVersion(3,2);
        format.setProfile(QSurfaceFormat::CoreProfile);
    }
    // [...]
    QSurfaceFormat::setDefaultFormat(format);
--- 8< ---
(see https://invent.kde.org/frameworks/kdeclarative/-/blob/master/src/quickaddons/qtquicksettings.cpp)
whereas Kirigami seems at least for ShadowedRectangle to rely on newer openGL versions being supported in the shader code.

STEPS TO REPRODUCE
1. Add this config entry to .config/kdeglobals
--- 8< ---
[QtQuickRendererSettings]
ForceGlCoreProfile=true
--- 8< ---
2. (Re)start systemsettings, open Colors, Plasma Style, App Style or any other config module using previews where selection is rendered with ShadowedRectangle

OBSERVED RESULT
Rectanlge is not painted, console log talks about shader not being compilable

EXPECTED RESULT
Rectangle painted

I had this flag set from some old experiments with custom openGL content in Plasma widgets, and so far never had seen visual glitches. This popped up only in a recent month.
Comment 1 Fabian Vogt 2020-07-02 22:04:42 UTC
CCing initial contributor of ShadowedRectangle.

There's also an issue with the QtQuick Software rendering backend, the rectangle doesn't render. The previews are empty here:
QMLSCENE_DEVICE=softwarecontext kcmshell5 lookandfeel
Though that's probably a separate issue.
Comment 2 Arjen Hiemstra 2020-07-03 09:31:06 UTC
The core profile shaders currently use version 450. You could try changing the #version directive to 320 in src/scenegraph/shaders/header_desktop_core.glsl. Though personally I think forcing the GL version like KDeclarative is doing here is wrong and it should default to whatever the highest version is that it can support.

For reference, this was tested using qmlscene --core-profile which also forces core profile but doesn't force a version.
Comment 3 Arjen Hiemstra 2020-07-03 09:35:14 UTC
(In reply to Fabian Vogt from comment #1)
> CCing initial contributor of ShadowedRectangle.
> 
> There's also an issue with the QtQuick Software rendering backend, the
> rectangle doesn't render. The previews are empty here:
> QMLSCENE_DEVICE=softwarecontext kcmshell5 lookandfeel
> Though that's probably a separate issue.

This seems to be unrelated and an issue with the preview rendering. As far as I can tell the actual rectangle is rendered correctly (it's responsible for rendering the highlight), it just doesn't have any contents.
Comment 4 Fabian Vogt 2020-07-03 09:56:13 UTC
(In reply to Arjen Hiemstra from comment #3)
> (In reply to Fabian Vogt from comment #1)
> > CCing initial contributor of ShadowedRectangle.
> > 
> > There's also an issue with the QtQuick Software rendering backend, the
> > rectangle doesn't render. The previews are empty here:
> > QMLSCENE_DEVICE=softwarecontext kcmshell5 lookandfeel
> > Though that's probably a separate issue.
> 
> This seems to be unrelated and an issue with the preview rendering. As far
> as I can tell the actual rectangle is rendered correctly (it's responsible
> for rendering the highlight), it just doesn't have any contents.

After replacing ShadowedRectangle with just Rectangle it appears fine.
By making PaintedRectangleItem::paint return early to not make it draw anything,
the previews appear correctly, so it appears like it's drawing on top of the previews.