summaryrefslogtreecommitdiffstats
path: root/examples/quick
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-09-13 18:19:06 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-09-13 19:15:12 +0200
commita99fc26faa21eca7921016ef7b399a2877a0652c (patch)
treed3ce0a94b31a1f86456cf8e946d4704c9db62d41 /examples/quick
parent33d8c8005f95e27760b9901bfd9f757a1cb1d664 (diff)
shadereffect example: remove unused legacy shader code
No point in exercising the file selector magic when there is only one possible path in Qt 6. Change-Id: I3b49b19d57a89855063e983ab0add13335840fb9 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'examples/quick')
-rw-r--r--examples/quick/shadereffects/CMakeLists.txt18
-rw-r--r--examples/quick/shadereffects/content/shaders/+qsb/blur.fragbin1811 -> 0 bytes
-rw-r--r--examples/quick/shadereffects/content/shaders/+qsb/colorize.fragbin1701 -> 0 bytes
-rw-r--r--examples/quick/shadereffects/content/shaders/+qsb/genie.vertbin2201 -> 0 bytes
-rw-r--r--examples/quick/shadereffects/content/shaders/+qsb/outline.fragbin2117 -> 0 bytes
-rw-r--r--examples/quick/shadereffects/content/shaders/+qsb/shadow.fragbin1745 -> 0 bytes
-rw-r--r--examples/quick/shadereffects/content/shaders/+qsb/wobble.fragbin1625 -> 0 bytes
-rw-r--r--examples/quick/shadereffects/content/shaders/blur.frag25
-rw-r--r--examples/quick/shadereffects/content/shaders/blur.frag.qsbbin0 -> 1922 bytes
-rw-r--r--examples/quick/shadereffects/content/shaders/colorize.frag26
-rw-r--r--examples/quick/shadereffects/content/shaders/colorize.frag.qsbbin0 -> 1732 bytes
-rwxr-xr-xexamples/quick/shadereffects/content/shaders/compile.bat (renamed from examples/quick/shadereffects/content/shaders/rhi/compile.bat)12
-rw-r--r--examples/quick/shadereffects/content/shaders/genie.vert38
-rw-r--r--examples/quick/shadereffects/content/shaders/genie.vert.qsbbin0 -> 2414 bytes
-rw-r--r--examples/quick/shadereffects/content/shaders/outline.frag34
-rw-r--r--examples/quick/shadereffects/content/shaders/outline.frag.qsbbin0 -> 2121 bytes
-rw-r--r--examples/quick/shadereffects/content/shaders/rhi/blur.frag21
-rw-r--r--examples/quick/shadereffects/content/shaders/rhi/colorize.frag20
-rw-r--r--examples/quick/shadereffects/content/shaders/rhi/genie.vert29
-rw-r--r--examples/quick/shadereffects/content/shaders/rhi/outline.frag24
-rw-r--r--examples/quick/shadereffects/content/shaders/rhi/shadow.frag21
-rw-r--r--examples/quick/shadereffects/content/shaders/rhi/wobble.frag20
-rw-r--r--examples/quick/shadereffects/content/shaders/shadow.frag33
-rw-r--r--examples/quick/shadereffects/content/shaders/shadow.frag.qsbbin0 -> 1845 bytes
-rw-r--r--examples/quick/shadereffects/content/shaders/wobble.frag23
-rw-r--r--examples/quick/shadereffects/content/shaders/wobble.frag.qsbbin0 -> 1709 bytes
-rw-r--r--examples/quick/shadereffects/shadereffects.qml14
-rw-r--r--examples/quick/shadereffects/shadereffects.qrc18
28 files changed, 137 insertions, 239 deletions
diff --git a/examples/quick/shadereffects/CMakeLists.txt b/examples/quick/shadereffects/CMakeLists.txt
index 31669c6156..aebc334a9d 100644
--- a/examples/quick/shadereffects/CMakeLists.txt
+++ b/examples/quick/shadereffects/CMakeLists.txt
@@ -36,18 +36,12 @@ set(shadereffects_resource_files
"content/Slider.qml"
"content/face-smile.png"
"content/qt-logo.png"
- "content/shaders/+qsb/blur.frag"
- "content/shaders/+qsb/colorize.frag"
- "content/shaders/+qsb/genie.vert"
- "content/shaders/+qsb/outline.frag"
- "content/shaders/+qsb/shadow.frag"
- "content/shaders/+qsb/wobble.frag"
- "content/shaders/blur.frag"
- "content/shaders/colorize.frag"
- "content/shaders/genie.vert"
- "content/shaders/outline.frag"
- "content/shaders/shadow.frag"
- "content/shaders/wobble.frag"
+ "content/shaders/blur.frag.qsb"
+ "content/shaders/colorize.frag.qsb"
+ "content/shaders/genie.vert.qsb"
+ "content/shaders/outline.frag.qsb"
+ "content/shaders/shadow.frag.qsb"
+ "content/shaders/wobble.frag.qsb"
"shadereffects.qml"
)
diff --git a/examples/quick/shadereffects/content/shaders/+qsb/blur.frag b/examples/quick/shadereffects/content/shaders/+qsb/blur.frag
deleted file mode 100644
index d29b2d4365..0000000000
--- a/examples/quick/shadereffects/content/shaders/+qsb/blur.frag
+++ /dev/null
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/+qsb/colorize.frag b/examples/quick/shadereffects/content/shaders/+qsb/colorize.frag
deleted file mode 100644
index 58bb5aaa8e..0000000000
--- a/examples/quick/shadereffects/content/shaders/+qsb/colorize.frag
+++ /dev/null
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/+qsb/genie.vert b/examples/quick/shadereffects/content/shaders/+qsb/genie.vert
deleted file mode 100644
index 540cb6a85b..0000000000
--- a/examples/quick/shadereffects/content/shaders/+qsb/genie.vert
+++ /dev/null
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/+qsb/outline.frag b/examples/quick/shadereffects/content/shaders/+qsb/outline.frag
deleted file mode 100644
index 633fe0f926..0000000000
--- a/examples/quick/shadereffects/content/shaders/+qsb/outline.frag
+++ /dev/null
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/+qsb/shadow.frag b/examples/quick/shadereffects/content/shaders/+qsb/shadow.frag
deleted file mode 100644
index 8059fab6ac..0000000000
--- a/examples/quick/shadereffects/content/shaders/+qsb/shadow.frag
+++ /dev/null
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/+qsb/wobble.frag b/examples/quick/shadereffects/content/shaders/+qsb/wobble.frag
deleted file mode 100644
index 85fb453659..0000000000
--- a/examples/quick/shadereffects/content/shaders/+qsb/wobble.frag
+++ /dev/null
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/blur.frag b/examples/quick/shadereffects/content/shaders/blur.frag
index 9173945eed..0c914d4244 100644
--- a/examples/quick/shadereffects/content/shaders/blur.frag
+++ b/examples/quick/shadereffects/content/shaders/blur.frag
@@ -1,14 +1,21 @@
-uniform lowp float qt_Opacity;
-uniform sampler2D source;
-uniform highp vec2 delta;
+#version 440
-varying highp vec2 qt_TexCoord0;
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(binding = 1) uniform sampler2D source;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec2 delta;
+} ubuf;
void main()
{
- gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
- + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
- + 0.2466 * texture2D(source, qt_TexCoord0)
- + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
- + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ fragColor =(0.0538 * texture(source, qt_TexCoord0 - 3.182 * ubuf.delta)
+ + 0.3229 * texture(source, qt_TexCoord0 - 1.364 * ubuf.delta)
+ + 0.2466 * texture(source, qt_TexCoord0)
+ + 0.3229 * texture(source, qt_TexCoord0 + 1.364 * ubuf.delta)
+ + 0.0538 * texture(source, qt_TexCoord0 + 3.182 * ubuf.delta)) * ubuf.qt_Opacity;
}
diff --git a/examples/quick/shadereffects/content/shaders/blur.frag.qsb b/examples/quick/shadereffects/content/shaders/blur.frag.qsb
new file mode 100644
index 0000000000..81dc4fed1c
--- /dev/null
+++ b/examples/quick/shadereffects/content/shaders/blur.frag.qsb
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/colorize.frag b/examples/quick/shadereffects/content/shaders/colorize.frag
index 1219ef2460..bc8067cc8c 100644
--- a/examples/quick/shadereffects/content/shaders/colorize.frag
+++ b/examples/quick/shadereffects/content/shaders/colorize.frag
@@ -1,12 +1,20 @@
-uniform sampler2D source;
-uniform lowp vec4 tint;
-uniform lowp float qt_Opacity;
+#version 440
-varying highp vec2 qt_TexCoord0;
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
-void main() {
- lowp vec4 c = texture2D(source, qt_TexCoord0);
- lowp float lo = min(min(c.x, c.y), c.z);
- lowp float hi = max(max(c.x, c.y), c.z);
- gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w);
+layout(binding = 1) uniform sampler2D source;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec4 tint;
+} ubuf;
+
+void main()
+{
+ vec4 c = texture(source, qt_TexCoord0);
+ float lo = min(min(c.x, c.y), c.z);
+ float hi = max(max(c.x, c.y), c.z);
+ fragColor = ubuf.qt_Opacity * vec4(mix(vec3(lo), vec3(hi), ubuf.tint.xyz), c.w);
}
diff --git a/examples/quick/shadereffects/content/shaders/colorize.frag.qsb b/examples/quick/shadereffects/content/shaders/colorize.frag.qsb
new file mode 100644
index 0000000000..e202768d90
--- /dev/null
+++ b/examples/quick/shadereffects/content/shaders/colorize.frag.qsb
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/rhi/compile.bat b/examples/quick/shadereffects/content/shaders/compile.bat
index 93dfb7b2a9..e03cfde8d2 100755
--- a/examples/quick/shadereffects/content/shaders/rhi/compile.bat
+++ b/examples/quick/shadereffects/content/shaders/compile.bat
@@ -48,9 +48,9 @@
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o ../+qsb/blur.frag blur.frag
-qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o ../+qsb/colorize.frag colorize.frag
-qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o ../+qsb/outline.frag outline.frag
-qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o ../+qsb/shadow.frag shadow.frag
-qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o ../+qsb/wobble.frag wobble.frag
-qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o ../+qsb/genie.vert genie.vert
+qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -c -O -o blur.frag.qsb blur.frag
+qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -c -O -o colorize.frag.qsb colorize.frag
+qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -c -O -o outline.frag.qsb outline.frag
+qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -c -O -o shadow.frag.qsb shadow.frag
+qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -c -O -o wobble.frag.qsb wobble.frag
+qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -c -O -o genie.vert.qsb genie.vert
diff --git a/examples/quick/shadereffects/content/shaders/genie.vert b/examples/quick/shadereffects/content/shaders/genie.vert
index 3ce371819f..2cb1e71046 100644
--- a/examples/quick/shadereffects/content/shaders/genie.vert
+++ b/examples/quick/shadereffects/content/shaders/genie.vert
@@ -1,21 +1,29 @@
-attribute highp vec4 qt_Vertex;
-attribute highp vec2 qt_MultiTexCoord0;
+#version 440
-uniform highp mat4 qt_Matrix;
-uniform highp float bend;
-uniform highp float minimize;
-uniform highp float side;
-uniform highp float width;
-uniform highp float height;
+layout(location = 0) in vec4 qt_Vertex;
+layout(location = 1) in vec2 qt_MultiTexCoord0;
-varying highp vec2 qt_TexCoord0;
+layout(location = 0) out vec2 qt_TexCoord0;
-void main() {
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float bend;
+ float minimize;
+ float side;
+ float width;
+ float height;
+} ubuf;
+
+out gl_PerVertex { vec4 gl_Position; };
+
+void main()
+{
qt_TexCoord0 = qt_MultiTexCoord0;
- highp vec4 pos = qt_Vertex;
- pos.y = mix(qt_Vertex.y, height, minimize);
- highp float t = pos.y / height;
+ vec4 pos = qt_Vertex;
+ pos.y = mix(qt_Vertex.y, ubuf.height, ubuf.minimize);
+ float t = pos.y / ubuf.height;
t = (3. - 2. * t) * t * t;
- pos.x = mix(qt_Vertex.x, side * width, t * bend);
- gl_Position = qt_Matrix * pos;
+ pos.x = mix(qt_Vertex.x, ubuf.side * ubuf.width, t * ubuf.bend);
+ gl_Position = ubuf.qt_Matrix * pos;
}
diff --git a/examples/quick/shadereffects/content/shaders/genie.vert.qsb b/examples/quick/shadereffects/content/shaders/genie.vert.qsb
new file mode 100644
index 0000000000..8aebcae273
--- /dev/null
+++ b/examples/quick/shadereffects/content/shaders/genie.vert.qsb
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/outline.frag b/examples/quick/shadereffects/content/shaders/outline.frag
index 9b46719873..26df69c5fe 100644
--- a/examples/quick/shadereffects/content/shaders/outline.frag
+++ b/examples/quick/shadereffects/content/shaders/outline.frag
@@ -1,16 +1,24 @@
-uniform sampler2D source;
-uniform highp vec2 delta;
-uniform highp float qt_Opacity;
+#version 440
-varying highp vec2 qt_TexCoord0;
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
-void main() {
- lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta);
- lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y));
- lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y));
- lowp vec4 br = texture2D(source, qt_TexCoord0 + delta);
- mediump vec4 gx = (tl + bl) - (tr + br);
- mediump vec4 gy = (tl + tr) - (bl + br);
- gl_FragColor.xyz = vec3(0.);
- gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity;
+layout(binding = 1) uniform sampler2D source;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ vec2 delta;
+} ubuf;
+
+void main()
+{
+ vec4 tl = texture(source, qt_TexCoord0 - ubuf.delta);
+ vec4 tr = texture(source, qt_TexCoord0 + vec2(ubuf.delta.x, -ubuf.delta.y));
+ vec4 bl = texture(source, qt_TexCoord0 - vec2(ubuf.delta.x, -ubuf.delta.y));
+ vec4 br = texture(source, qt_TexCoord0 + ubuf.delta);
+ vec4 gx = (tl + bl) - (tr + br);
+ vec4 gy = (tl + tr) - (bl + br);
+ fragColor.xyz = vec3(0.);
+ fragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * ubuf.qt_Opacity;
}
diff --git a/examples/quick/shadereffects/content/shaders/outline.frag.qsb b/examples/quick/shadereffects/content/shaders/outline.frag.qsb
new file mode 100644
index 0000000000..e6e0e14013
--- /dev/null
+++ b/examples/quick/shadereffects/content/shaders/outline.frag.qsb
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/rhi/blur.frag b/examples/quick/shadereffects/content/shaders/rhi/blur.frag
deleted file mode 100644
index 0c914d4244..0000000000
--- a/examples/quick/shadereffects/content/shaders/rhi/blur.frag
+++ /dev/null
@@ -1,21 +0,0 @@
-#version 440
-
-layout(location = 0) in vec2 qt_TexCoord0;
-layout(location = 0) out vec4 fragColor;
-
-layout(binding = 1) uniform sampler2D source;
-
-layout(std140, binding = 0) uniform buf {
- mat4 qt_Matrix;
- float qt_Opacity;
- vec2 delta;
-} ubuf;
-
-void main()
-{
- fragColor =(0.0538 * texture(source, qt_TexCoord0 - 3.182 * ubuf.delta)
- + 0.3229 * texture(source, qt_TexCoord0 - 1.364 * ubuf.delta)
- + 0.2466 * texture(source, qt_TexCoord0)
- + 0.3229 * texture(source, qt_TexCoord0 + 1.364 * ubuf.delta)
- + 0.0538 * texture(source, qt_TexCoord0 + 3.182 * ubuf.delta)) * ubuf.qt_Opacity;
-}
diff --git a/examples/quick/shadereffects/content/shaders/rhi/colorize.frag b/examples/quick/shadereffects/content/shaders/rhi/colorize.frag
deleted file mode 100644
index bc8067cc8c..0000000000
--- a/examples/quick/shadereffects/content/shaders/rhi/colorize.frag
+++ /dev/null
@@ -1,20 +0,0 @@
-#version 440
-
-layout(location = 0) in vec2 qt_TexCoord0;
-layout(location = 0) out vec4 fragColor;
-
-layout(binding = 1) uniform sampler2D source;
-
-layout(std140, binding = 0) uniform buf {
- mat4 qt_Matrix;
- float qt_Opacity;
- vec4 tint;
-} ubuf;
-
-void main()
-{
- vec4 c = texture(source, qt_TexCoord0);
- float lo = min(min(c.x, c.y), c.z);
- float hi = max(max(c.x, c.y), c.z);
- fragColor = ubuf.qt_Opacity * vec4(mix(vec3(lo), vec3(hi), ubuf.tint.xyz), c.w);
-}
diff --git a/examples/quick/shadereffects/content/shaders/rhi/genie.vert b/examples/quick/shadereffects/content/shaders/rhi/genie.vert
deleted file mode 100644
index 2cb1e71046..0000000000
--- a/examples/quick/shadereffects/content/shaders/rhi/genie.vert
+++ /dev/null
@@ -1,29 +0,0 @@
-#version 440
-
-layout(location = 0) in vec4 qt_Vertex;
-layout(location = 1) in vec2 qt_MultiTexCoord0;
-
-layout(location = 0) out vec2 qt_TexCoord0;
-
-layout(std140, binding = 0) uniform buf {
- mat4 qt_Matrix;
- float qt_Opacity;
- float bend;
- float minimize;
- float side;
- float width;
- float height;
-} ubuf;
-
-out gl_PerVertex { vec4 gl_Position; };
-
-void main()
-{
- qt_TexCoord0 = qt_MultiTexCoord0;
- vec4 pos = qt_Vertex;
- pos.y = mix(qt_Vertex.y, ubuf.height, ubuf.minimize);
- float t = pos.y / ubuf.height;
- t = (3. - 2. * t) * t * t;
- pos.x = mix(qt_Vertex.x, ubuf.side * ubuf.width, t * ubuf.bend);
- gl_Position = ubuf.qt_Matrix * pos;
-}
diff --git a/examples/quick/shadereffects/content/shaders/rhi/outline.frag b/examples/quick/shadereffects/content/shaders/rhi/outline.frag
deleted file mode 100644
index 26df69c5fe..0000000000
--- a/examples/quick/shadereffects/content/shaders/rhi/outline.frag
+++ /dev/null
@@ -1,24 +0,0 @@
-#version 440
-
-layout(location = 0) in vec2 qt_TexCoord0;
-layout(location = 0) out vec4 fragColor;
-
-layout(binding = 1) uniform sampler2D source;
-
-layout(std140, binding = 0) uniform buf {
- mat4 qt_Matrix;
- float qt_Opacity;
- vec2 delta;
-} ubuf;
-
-void main()
-{
- vec4 tl = texture(source, qt_TexCoord0 - ubuf.delta);
- vec4 tr = texture(source, qt_TexCoord0 + vec2(ubuf.delta.x, -ubuf.delta.y));
- vec4 bl = texture(source, qt_TexCoord0 - vec2(ubuf.delta.x, -ubuf.delta.y));
- vec4 br = texture(source, qt_TexCoord0 + ubuf.delta);
- vec4 gx = (tl + bl) - (tr + br);
- vec4 gy = (tl + tr) - (bl + br);
- fragColor.xyz = vec3(0.);
- fragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * ubuf.qt_Opacity;
-}
diff --git a/examples/quick/shadereffects/content/shaders/rhi/shadow.frag b/examples/quick/shadereffects/content/shaders/rhi/shadow.frag
deleted file mode 100644
index 8247517b6d..0000000000
--- a/examples/quick/shadereffects/content/shaders/rhi/shadow.frag
+++ /dev/null
@@ -1,21 +0,0 @@
-#version 440
-
-layout(location = 0) in vec2 qt_TexCoord0;
-layout(location = 0) out vec4 fragColor;
-
-layout(binding = 1) uniform sampler2D source;
-layout(binding = 2) uniform sampler2D shadow;
-
-layout(std140, binding = 0) uniform buf {
- mat4 qt_Matrix;
- float qt_Opacity;
- float darkness;
- vec2 delta;
-} ubuf;
-
-void main()
-{
- vec4 fg = texture(source, qt_TexCoord0);
- vec4 bg = texture(shadow, qt_TexCoord0 + ubuf.delta);
- fragColor = (fg + vec4(0., 0., 0., ubuf.darkness * bg.a) * (1. - fg.a)) * ubuf.qt_Opacity;
-}
diff --git a/examples/quick/shadereffects/content/shaders/rhi/wobble.frag b/examples/quick/shadereffects/content/shaders/rhi/wobble.frag
deleted file mode 100644
index a34481c2f2..0000000000
--- a/examples/quick/shadereffects/content/shaders/rhi/wobble.frag
+++ /dev/null
@@ -1,20 +0,0 @@
-#version 440
-
-layout(location = 0) in vec2 qt_TexCoord0;
-layout(location = 0) out vec4 fragColor;
-
-layout(binding = 1) uniform sampler2D source;
-
-layout(std140, binding = 0) uniform buf {
- mat4 qt_Matrix;
- float qt_Opacity;
- float amplitude;
- float frequency;
- float time;
-} ubuf;
-
-void main()
-{
- vec2 p = sin(ubuf.time + ubuf.frequency * qt_TexCoord0);
- fragColor = texture(source, qt_TexCoord0 + ubuf.amplitude * vec2(p.y, -p.x)) * ubuf.qt_Opacity;
-}
diff --git a/examples/quick/shadereffects/content/shaders/shadow.frag b/examples/quick/shadereffects/content/shaders/shadow.frag
index 8650ee4f4c..8247517b6d 100644
--- a/examples/quick/shadereffects/content/shaders/shadow.frag
+++ b/examples/quick/shadereffects/content/shaders/shadow.frag
@@ -1,14 +1,21 @@
-uniform lowp float qt_Opacity;
-uniform highp vec2 offset;
-uniform sampler2D source;
-uniform sampler2D shadow;
-uniform highp float darkness;
-uniform highp vec2 delta;
-
-varying highp vec2 qt_TexCoord0;
-
-void main() {
- lowp vec4 fg = texture2D(source, qt_TexCoord0);
- lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta);
- gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity;
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(binding = 1) uniform sampler2D source;
+layout(binding = 2) uniform sampler2D shadow;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float darkness;
+ vec2 delta;
+} ubuf;
+
+void main()
+{
+ vec4 fg = texture(source, qt_TexCoord0);
+ vec4 bg = texture(shadow, qt_TexCoord0 + ubuf.delta);
+ fragColor = (fg + vec4(0., 0., 0., ubuf.darkness * bg.a) * (1. - fg.a)) * ubuf.qt_Opacity;
}
diff --git a/examples/quick/shadereffects/content/shaders/shadow.frag.qsb b/examples/quick/shadereffects/content/shaders/shadow.frag.qsb
new file mode 100644
index 0000000000..ee4355b209
--- /dev/null
+++ b/examples/quick/shadereffects/content/shaders/shadow.frag.qsb
Binary files differ
diff --git a/examples/quick/shadereffects/content/shaders/wobble.frag b/examples/quick/shadereffects/content/shaders/wobble.frag
index fedbb68254..a34481c2f2 100644
--- a/examples/quick/shadereffects/content/shaders/wobble.frag
+++ b/examples/quick/shadereffects/content/shaders/wobble.frag
@@ -1,13 +1,20 @@
-uniform lowp float qt_Opacity;
-uniform highp float amplitude;
-uniform highp float frequency;
-uniform highp float time;
-uniform sampler2D source;
+#version 440
-varying highp vec2 qt_TexCoord0;
+layout(location = 0) in vec2 qt_TexCoord0;
+layout(location = 0) out vec4 fragColor;
+
+layout(binding = 1) uniform sampler2D source;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+ float amplitude;
+ float frequency;
+ float time;
+} ubuf;
void main()
{
- highp vec2 p = sin(time + frequency * qt_TexCoord0);
- gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;
+ vec2 p = sin(ubuf.time + ubuf.frequency * qt_TexCoord0);
+ fragColor = texture(source, qt_TexCoord0 + ubuf.amplitude * vec2(p.y, -p.x)) * ubuf.qt_Opacity;
}
diff --git a/examples/quick/shadereffects/content/shaders/wobble.frag.qsb b/examples/quick/shadereffects/content/shaders/wobble.frag.qsb
new file mode 100644
index 0000000000..248c00b526
--- /dev/null
+++ b/examples/quick/shadereffects/content/shaders/wobble.frag.qsb
Binary files differ
diff --git a/examples/quick/shadereffects/shadereffects.qml b/examples/quick/shadereffects/shadereffects.qml
index cf5cb351db..563a09c15d 100644
--- a/examples/quick/shadereffects/shadereffects.qml
+++ b/examples/quick/shadereffects/shadereffects.qml
@@ -128,7 +128,7 @@ Rectangle {
property real time: 0
NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 }
//! [fragment]
- fragmentShader: "content/shaders/wobble.frag"
+ fragmentShader: "content/shaders/wobble.frag.qsb"
//! [fragment]
Slider {
id: wobbleSlider
@@ -153,10 +153,10 @@ Rectangle {
height: theItem.height
property variant delta: Qt.size(1.0 / width, 0.0)
property variant source: theSource
- fragmentShader: "content/shaders/blur.frag"
+ fragmentShader: "content/shaders/blur.frag.qsb"
}
}
- fragmentShader: "content/shaders/blur.frag"
+ fragmentShader: "content/shaders/blur.frag.qsb"
}
}
property real angle: 0
@@ -164,7 +164,7 @@ Rectangle {
NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 }
property variant delta: Qt.size(offset.x / width, offset.y / height)
property real darkness: shadowSlider.value
- fragmentShader: "content/shaders/shadow.frag"
+ fragmentShader: "content/shaders/shadow.frag.qsb"
Slider {
id: shadowSlider
anchors.left: parent.left
@@ -178,14 +178,14 @@ Rectangle {
height: 160
property variant source: theSource
property variant delta: Qt.size(0.5 / width, 0.5 / height)
- fragmentShader: "content/shaders/outline.frag"
+ fragmentShader: "content/shaders/outline.frag.qsb"
}
ShaderEffect {
width: 160
height: 160
property variant source: theSource
property color tint: root.sliderToColor(colorizeSlider.value)
- fragmentShader: "content/shaders/colorize.frag"
+ fragmentShader: "content/shaders/colorize.frag.qsb"
Slider {
id: colorizeSlider
anchors.left: parent.left
@@ -220,7 +220,7 @@ Rectangle {
//! [properties]
//! [vertex]
mesh: Qt.size(10, 10)
- vertexShader: "content/shaders/genie.vert"
+ vertexShader: "content/shaders/genie.vert.qsb"
//! [vertex]
Slider {
id: genieSlider
diff --git a/examples/quick/shadereffects/shadereffects.qrc b/examples/quick/shadereffects/shadereffects.qrc
index 72ad2d9054..e6965d7674 100644
--- a/examples/quick/shadereffects/shadereffects.qrc
+++ b/examples/quick/shadereffects/shadereffects.qrc
@@ -4,17 +4,11 @@
<file>content/face-smile.png</file>
<file>content/qt-logo.png</file>
<file>content/Slider.qml</file>
- <file>content/shaders/wobble.frag</file>
- <file>content/shaders/+qsb/wobble.frag</file>
- <file>content/shaders/blur.frag</file>
- <file>content/shaders/+qsb/blur.frag</file>
- <file>content/shaders/shadow.frag</file>
- <file>content/shaders/+qsb/shadow.frag</file>
- <file>content/shaders/outline.frag</file>
- <file>content/shaders/+qsb/outline.frag</file>
- <file>content/shaders/colorize.frag</file>
- <file>content/shaders/+qsb/colorize.frag</file>
- <file>content/shaders/genie.vert</file>
- <file>content/shaders/+qsb/genie.vert</file>
+ <file>content/shaders/wobble.frag.qsb</file>
+ <file>content/shaders/blur.frag.qsb</file>
+ <file>content/shaders/shadow.frag.qsb</file>
+ <file>content/shaders/outline.frag.qsb</file>
+ <file>content/shaders/colorize.frag.qsb</file>
+ <file>content/shaders/genie.vert.qsb</file>
</qresource>
</RCC>