Controls: condition shaders at build time
The machinery inherited from Qt 5, with file selectors and whatnot, is simply not needed anymore. Pick-to: 6.5 Change-Id: If0728a4fa057335fe8471899da50b836f8d56d35 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
parent
4f5b4f81b0
commit
314f1cf8a4
|
@ -31,16 +31,13 @@ qt_internal_add_qml_module(qtquickcontrols2imaginestyleimplplugin
|
||||||
Qt::QuickTemplates2Private
|
Qt::QuickTemplates2Private
|
||||||
)
|
)
|
||||||
|
|
||||||
# Resources:
|
qt_internal_add_shaders(qtquickcontrols2imaginestyleimplplugin "qtquickcontrols2imaginestyleimplplugin_shaders"
|
||||||
set(qmake_qtquickcontrols2imaginestyleimplplugin_resource_files
|
SILENT
|
||||||
"shaders/+glslcore/OpacityMask.frag"
|
BATCHABLE
|
||||||
"shaders/+qsb/OpacityMask.frag"
|
PRECOMPILE
|
||||||
"shaders/OpacityMask.frag"
|
OPTIMIZED
|
||||||
)
|
|
||||||
|
|
||||||
qt_internal_add_resource(qtquickcontrols2imaginestyleimplplugin "qmake_qtquickcontrols2imaginestyleimplplugin"
|
|
||||||
PREFIX
|
PREFIX
|
||||||
"qt-project.org/imports/QtQuick/Controls/Imagine/impl"
|
"/qt-project.org/imports/QtQuick/Controls/Imagine/impl"
|
||||||
FILES
|
FILES
|
||||||
${qmake_qtquickcontrols2imaginestyleimplplugin_resource_files}
|
"shaders/OpacityMask.frag"
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,6 +30,6 @@ Item {
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
fragmentShader: "qrc:/qt-project.org/imports/QtQuick/Controls/Imagine/impl/shaders/OpacityMask.frag"
|
fragmentShader: "qrc:/qt-project.org/imports/QtQuick/Controls/Imagine/impl/shaders/OpacityMask.frag.qsb"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#version 150
|
|
||||||
|
|
||||||
uniform float qt_Opacity;
|
|
||||||
uniform sampler2D source;
|
|
||||||
uniform sampler2D maskSource;
|
|
||||||
|
|
||||||
in vec2 qt_TexCoord0;
|
|
||||||
out vec4 fragColor;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
fragColor = texture(source, qt_TexCoord0.st) * (texture(maskSource, qt_TexCoord0.st).a) * qt_Opacity;
|
|
||||||
}
|
|
Binary file not shown.
|
@ -1,7 +1,17 @@
|
||||||
varying highp vec2 qt_TexCoord0;
|
#version 440
|
||||||
uniform highp float qt_Opacity;
|
|
||||||
uniform lowp sampler2D source;
|
layout(location = 0) in vec2 qt_TexCoord0;
|
||||||
uniform lowp sampler2D maskSource;
|
layout(location = 0) out vec4 fragColor;
|
||||||
void main(void) {
|
|
||||||
gl_FragColor = texture2D(source, qt_TexCoord0.st) * (texture2D(maskSource, qt_TexCoord0.st).a) * qt_Opacity;
|
layout(std140, binding = 0) uniform buf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float qt_Opacity;
|
||||||
|
} ubuf;
|
||||||
|
|
||||||
|
layout(binding = 1) uniform sampler2D source;
|
||||||
|
layout(binding = 2) uniform sampler2D maskSource;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
fragColor = texture(source, qt_TexCoord0.st) * (texture(maskSource, qt_TexCoord0.st).a) * ubuf.qt_Opacity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
#version 440
|
|
||||||
|
|
||||||
layout(location = 0) in vec2 qt_TexCoord0;
|
|
||||||
layout(location = 0) out vec4 fragColor;
|
|
||||||
|
|
||||||
layout(std140, binding = 0) uniform buf {
|
|
||||||
mat4 qt_Matrix;
|
|
||||||
float qt_Opacity;
|
|
||||||
} ubuf;
|
|
||||||
|
|
||||||
layout(binding = 1) uniform sampler2D source;
|
|
||||||
layout(binding = 2) uniform sampler2D maskSource;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
fragColor = texture(source, qt_TexCoord0.st) * (texture(maskSource, qt_TexCoord0.st).a) * ubuf.qt_Opacity;
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
:: Copyright (C) 2020 The Qt Company Ltd.
|
|
||||||
:: SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
|
||||||
|
|
||||||
qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/OpacityMask.frag OpacityMask_rhi.frag
|
|
|
@ -141,9 +141,16 @@ qt_internal_add_resource(qtquickcontrols2materialstyleplugin "qtquickcontrols2ma
|
||||||
"images/drop-indicator@2x.png"
|
"images/drop-indicator@2x.png"
|
||||||
"images/drop-indicator@3x.png"
|
"images/drop-indicator@3x.png"
|
||||||
"images/drop-indicator@4x.png"
|
"images/drop-indicator@4x.png"
|
||||||
"shaders/+glslcore/RectangularGlow.frag"
|
)
|
||||||
"shaders/+hlsl/RectangularGlow.frag"
|
|
||||||
"shaders/+qsb/RectangularGlow.frag"
|
qt_internal_add_shaders(qtquickcontrols2materialstyleplugin "qtquickcontrols2materialstyleplugin_shaders"
|
||||||
|
SILENT
|
||||||
|
BATCHABLE
|
||||||
|
PRECOMPILE
|
||||||
|
OPTIMIZED
|
||||||
|
PREFIX
|
||||||
|
"/qt-project.org/imports/QtQuick/Controls/Material"
|
||||||
|
FILES
|
||||||
"shaders/RectangularGlow.frag"
|
"shaders/RectangularGlow.frag"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,6 @@ Item {
|
||||||
property real spread: rootItem.spread / 2.0
|
property real spread: rootItem.spread / 2.0
|
||||||
property real cornerRadius: clampedCornerRadius()
|
property real cornerRadius: clampedCornerRadius()
|
||||||
|
|
||||||
fragmentShader: "qrc:/qt-project.org/imports/QtQuick/Controls/Material/shaders/RectangularGlow.frag"
|
fragmentShader: "qrc:/qt-project.org/imports/QtQuick/Controls/Material/shaders/RectangularGlow.frag.qsb"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
#version 150
|
|
||||||
|
|
||||||
uniform float qt_Opacity;
|
|
||||||
uniform float relativeSizeX;
|
|
||||||
uniform float relativeSizeY;
|
|
||||||
uniform float spread;
|
|
||||||
uniform vec4 color;
|
|
||||||
|
|
||||||
in vec2 qt_TexCoord0;
|
|
||||||
out vec4 fragColor;
|
|
||||||
|
|
||||||
float linearstep(float e0, float e1, float x)
|
|
||||||
{
|
|
||||||
return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
float alpha =
|
|
||||||
smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
|
|
||||||
smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
|
|
||||||
|
|
||||||
float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
|
|
||||||
fragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier;
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
cbuffer ConstantBuffer : register(b0)
|
|
||||||
{
|
|
||||||
float4x4 qt_Matrix;
|
|
||||||
float qt_Opacity;
|
|
||||||
float relativeSizeX;
|
|
||||||
float relativeSizeY;
|
|
||||||
float spread;
|
|
||||||
float4 color;
|
|
||||||
}
|
|
||||||
|
|
||||||
float linearstep(float e0, float e1, float x) { return clamp((x - e0) / (e1 - e0), 0.0, 1.0); }
|
|
||||||
|
|
||||||
float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET
|
|
||||||
{
|
|
||||||
float alpha =
|
|
||||||
smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - coord.x)) *
|
|
||||||
smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - coord.y));
|
|
||||||
|
|
||||||
float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
|
|
||||||
return color * qt_Opacity * spreadMultiplier * spreadMultiplier;
|
|
||||||
}
|
|
Binary file not shown.
|
@ -1,19 +1,28 @@
|
||||||
uniform highp float qt_Opacity;
|
#version 440
|
||||||
uniform mediump float relativeSizeX;
|
|
||||||
uniform mediump float relativeSizeY;
|
|
||||||
uniform mediump float spread;
|
|
||||||
uniform lowp vec4 color;
|
|
||||||
varying highp vec2 qt_TexCoord0;
|
|
||||||
|
|
||||||
highp float linearstep(highp float e0, highp float e1, highp float x) {
|
layout(location = 0) in vec2 qt_TexCoord0;
|
||||||
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
||||||
|
layout(std140, binding = 0) uniform buf {
|
||||||
|
mat4 qt_Matrix;
|
||||||
|
float qt_Opacity;
|
||||||
|
float relativeSizeX;
|
||||||
|
float relativeSizeY;
|
||||||
|
float spread;
|
||||||
|
vec4 color;
|
||||||
|
} ubuf;
|
||||||
|
|
||||||
|
float linearstep(float e0, float e1, float x)
|
||||||
|
{
|
||||||
return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
|
return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main()
|
||||||
lowp float alpha =
|
{
|
||||||
smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
|
float alpha =
|
||||||
smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
|
smoothstep(0.0, ubuf.relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
|
||||||
|
smoothstep(0.0, ubuf.relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
|
||||||
|
|
||||||
highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
|
float spreadMultiplier = linearstep(ubuf.spread, 1.0 - ubuf.spread, alpha);
|
||||||
gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier;
|
fragColor = ubuf.color * ubuf.qt_Opacity * spreadMultiplier * spreadMultiplier;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
#version 440
|
|
||||||
|
|
||||||
layout(location = 0) in vec2 qt_TexCoord0;
|
|
||||||
layout(location = 0) out vec4 fragColor;
|
|
||||||
|
|
||||||
layout(std140, binding = 0) uniform buf {
|
|
||||||
mat4 qt_Matrix;
|
|
||||||
float qt_Opacity;
|
|
||||||
float relativeSizeX;
|
|
||||||
float relativeSizeY;
|
|
||||||
float spread;
|
|
||||||
vec4 color;
|
|
||||||
} ubuf;
|
|
||||||
|
|
||||||
float linearstep(float e0, float e1, float x)
|
|
||||||
{
|
|
||||||
return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
float alpha =
|
|
||||||
smoothstep(0.0, ubuf.relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
|
|
||||||
smoothstep(0.0, ubuf.relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
|
|
||||||
|
|
||||||
float spreadMultiplier = linearstep(ubuf.spread, 1.0 - ubuf.spread, alpha);
|
|
||||||
fragColor = ubuf.color * ubuf.qt_Opacity * spreadMultiplier * spreadMultiplier;
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
:: Copyright (C) 2019 The Qt Company Ltd.
|
|
||||||
:: SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
|
||||||
|
|
||||||
qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/RectangularGlow.frag RectangularGlow_rhi.frag
|
|
Loading…
Reference in New Issue