summaryrefslogtreecommitdiffstats
path: root/src/compositor/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/shaders')
-rw-r--r--src/compositor/shaders/compile9
-rw-r--r--src/compositor/shaders/surface.vert28
-rw-r--r--src/compositor/shaders/surface.vert.qsbbin0 -> 1015 bytes
-rw-r--r--src/compositor/shaders/surface_oes_external.frag22
-rw-r--r--src/compositor/shaders/surface_rgba.frag22
-rw-r--r--src/compositor/shaders/surface_rgba.frag.qsbbin0 -> 773 bytes
-rw-r--r--src/compositor/shaders/surface_rgbx.frag24
-rw-r--r--src/compositor/shaders/surface_rgbx.frag.qsbbin0 -> 888 bytes
-rw-r--r--src/compositor/shaders/surface_y_u_v.frag44
-rw-r--r--src/compositor/shaders/surface_y_u_v.frag.qsbbin0 -> 1427 bytes
-rw-r--r--src/compositor/shaders/surface_y_uv.frag42
-rw-r--r--src/compositor/shaders/surface_y_uv.frag.qsbbin0 -> 1397 bytes
-rw-r--r--src/compositor/shaders/surface_y_xuxv.frag42
-rw-r--r--src/compositor/shaders/surface_y_xuxv.frag.qsbbin0 -> 1406 bytes
14 files changed, 162 insertions, 71 deletions
diff --git a/src/compositor/shaders/compile b/src/compositor/shaders/compile
new file mode 100644
index 000000000..33c2f34d5
--- /dev/null
+++ b/src/compositor/shaders/compile
@@ -0,0 +1,9 @@
+qsb -b --glsl "100 es,120,150" -o surface.vert.qsb surface.vert
+qsb --glsl "100 es,120,150" -o surface_rgba.frag.qsb surface_rgba.frag
+qsb --glsl "100 es,120,150" -o surface_rgbx.frag.qsb surface_rgbx.frag
+qsb --glsl "100 es,120,150" -o surface_y_uv.frag.qsb surface_y_uv.frag
+qsb --glsl "100 es,120,150" -o surface_y_u_v.frag.qsb surface_y_u_v.frag
+qsb --glsl "100 es,120,150" -o surface_y_xuxv.frag.qsb surface_y_xuxv.frag
+
+# Cannot be precompiled and is handled separately:
+# surface_oes_external.frag
diff --git a/src/compositor/shaders/surface.vert b/src/compositor/shaders/surface.vert
index 848b334f3..bd28d9bf8 100644
--- a/src/compositor/shaders/surface.vert
+++ b/src/compositor/shaders/surface.vert
@@ -1,9 +1,21 @@
-uniform highp mat4 qt_Matrix;
-attribute highp vec2 qt_VertexPosition;
-attribute highp vec2 qt_VertexTexCoord;
-varying highp vec2 v_texcoord;
-
-void main() {
- gl_Position = qt_Matrix * vec4(qt_VertexPosition, 0.0, 1.0);
- v_texcoord = qt_VertexTexCoord;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#version 440
+
+layout(location = 0) in vec2 qt_VertexPosition;
+layout(location = 1) in vec2 qt_VertexTexCoord;
+layout(location = 0) out vec2 v_texcoord;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+out gl_PerVertex { vec4 gl_Position; };
+
+void main()
+{
+ gl_Position = qt_Matrix * vec4(qt_VertexPosition, 0.0, 1.0);
+ v_texcoord = qt_VertexTexCoord;
}
diff --git a/src/compositor/shaders/surface.vert.qsb b/src/compositor/shaders/surface.vert.qsb
new file mode 100644
index 000000000..596dce513
--- /dev/null
+++ b/src/compositor/shaders/surface.vert.qsb
Binary files differ
diff --git a/src/compositor/shaders/surface_oes_external.frag b/src/compositor/shaders/surface_oes_external.frag
index 724d06a85..3064bf7b1 100644
--- a/src/compositor/shaders/surface_oes_external.frag
+++ b/src/compositor/shaders/surface_oes_external.frag
@@ -1,8 +1,18 @@
-#extension GL_OES_EGL_image_external : require
-varying highp vec2 v_texcoord;
-uniform highp samplerExternalOES tex0;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- gl_FragColor = qt_Opacity * texture2D(tex0, v_texcoord);
+// This shader stump cannot be precompiled and is compiled at run-time.
+// Appropriate target preamble added when it is loaded.
+
+varying vec2 v_texcoord;
+struct buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+uniform buf ubuf;
+uniform samplerExternalOES tex0;
+
+void main()
+{
+ gl_FragColor = ubuf.qt_Opacity * texture2D(tex0, v_texcoord);
}
diff --git a/src/compositor/shaders/surface_rgba.frag b/src/compositor/shaders/surface_rgba.frag
index f896051ba..8bb48dc15 100644
--- a/src/compositor/shaders/surface_rgba.frag
+++ b/src/compositor/shaders/surface_rgba.frag
@@ -1,7 +1,19 @@
-varying highp vec2 v_texcoord;
-uniform highp sampler2D tex0;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- gl_FragColor = qt_Opacity * texture2D(tex0, v_texcoord);
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D tex0;
+
+void main()
+{
+ fragColor = qt_Opacity * texture(tex0, v_texcoord);
}
diff --git a/src/compositor/shaders/surface_rgba.frag.qsb b/src/compositor/shaders/surface_rgba.frag.qsb
new file mode 100644
index 000000000..72abc0f1b
--- /dev/null
+++ b/src/compositor/shaders/surface_rgba.frag.qsb
Binary files differ
diff --git a/src/compositor/shaders/surface_rgbx.frag b/src/compositor/shaders/surface_rgbx.frag
index 8fb78498c..600c1beae 100644
--- a/src/compositor/shaders/surface_rgbx.frag
+++ b/src/compositor/shaders/surface_rgbx.frag
@@ -1,8 +1,20 @@
-varying highp vec2 v_texcoord;
-uniform highp sampler2D tex0;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- gl_FragColor.rgb = qt_Opacity * texture2D(tex0, v_texcoord).rgb;
- gl_FragColor.a = qt_Opacity;
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D tex0;
+
+void main()
+{
+ fragColor.rgb = qt_Opacity * texture(tex0, v_texcoord).rgb;
+ fragColor.a = qt_Opacity;
}
diff --git a/src/compositor/shaders/surface_rgbx.frag.qsb b/src/compositor/shaders/surface_rgbx.frag.qsb
new file mode 100644
index 000000000..5fd9a21ac
--- /dev/null
+++ b/src/compositor/shaders/surface_rgbx.frag.qsb
Binary files differ
diff --git a/src/compositor/shaders/surface_y_u_v.frag b/src/compositor/shaders/surface_y_u_v.frag
index e739f6fff..3c14036ef 100644
--- a/src/compositor/shaders/surface_y_u_v.frag
+++ b/src/compositor/shaders/surface_y_u_v.frag
@@ -1,18 +1,30 @@
-uniform highp sampler2D tex0;
-uniform highp sampler2D tex1;
-uniform highp sampler2D tex2;
-varying highp vec2 v_texcoord;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- float y = 1.16438356 * (texture2D(tex0, v_texcoord).x - 0.0625);
- float u = texture2D(tex1, v_texcoord).x - 0.5;
- float v = texture2D(tex2, v_texcoord).x - 0.5;
- y *= qt_Opacity;
- u *= qt_Opacity;
- v *= qt_Opacity;
- gl_FragColor.r = y + 1.59602678 * v;
- gl_FragColor.g = y - 0.39176229 * u - 0.81296764 * v;
- gl_FragColor.b = y + 2.01723214 * u;
- gl_FragColor.a = qt_Opacity;
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D tex0;
+layout(binding = 2) uniform sampler2D tex1;
+layout(binding = 3) uniform sampler2D tex2;
+
+void main()
+{
+ float y = 1.16438356 * (texture(tex0, v_texcoord).x - 0.0625);
+ float u = texture(tex1, v_texcoord).x - 0.5;
+ float v = texture(tex2, v_texcoord).x - 0.5;
+ y *= qt_Opacity;
+ u *= qt_Opacity;
+ v *= qt_Opacity;
+ fragColor.r = y + 1.59602678 * v;
+ fragColor.g = y - 0.39176229 * u - 0.81296764 * v;
+ fragColor.b = y + 2.01723214 * u;
+ fragColor.a = qt_Opacity;
}
diff --git a/src/compositor/shaders/surface_y_u_v.frag.qsb b/src/compositor/shaders/surface_y_u_v.frag.qsb
new file mode 100644
index 000000000..72da0fe85
--- /dev/null
+++ b/src/compositor/shaders/surface_y_u_v.frag.qsb
Binary files differ
diff --git a/src/compositor/shaders/surface_y_uv.frag b/src/compositor/shaders/surface_y_uv.frag
index e3fbcdf8d..42b614882 100644
--- a/src/compositor/shaders/surface_y_uv.frag
+++ b/src/compositor/shaders/surface_y_uv.frag
@@ -1,17 +1,29 @@
-uniform highp sampler2D tex0;
-uniform highp sampler2D tex1;
-varying highp vec2 v_texcoord;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- float y = 1.16438356 * (texture2D(tex0, v_texcoord).x - 0.0625);
- float u = texture2D(tex1, v_texcoord).r - 0.5;
- float v = texture2D(tex1, v_texcoord).g - 0.5;
- y *= qt_Opacity;
- u *= qt_Opacity;
- v *= qt_Opacity;
- gl_FragColor.r = y + 1.59602678 * v;
- gl_FragColor.g = y - 0.39176229 * u - 0.81296764 * v;
- gl_FragColor.b = y + 2.01723214 * u;
- gl_FragColor.a = qt_Opacity;
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D tex0;
+layout(binding = 2) uniform sampler2D tex1;
+
+void main()
+{
+ float y = 1.16438356 * (texture(tex0, v_texcoord).x - 0.0625);
+ float u = texture(tex1, v_texcoord).r - 0.5;
+ float v = texture(tex1, v_texcoord).g - 0.5;
+ y *= qt_Opacity;
+ u *= qt_Opacity;
+ v *= qt_Opacity;
+ fragColor.r = y + 1.59602678 * v;
+ fragColor.g = y - 0.39176229 * u - 0.81296764 * v;
+ fragColor.b = y + 2.01723214 * u;
+ fragColor.a = qt_Opacity;
}
diff --git a/src/compositor/shaders/surface_y_uv.frag.qsb b/src/compositor/shaders/surface_y_uv.frag.qsb
new file mode 100644
index 000000000..4cea4838d
--- /dev/null
+++ b/src/compositor/shaders/surface_y_uv.frag.qsb
Binary files differ
diff --git a/src/compositor/shaders/surface_y_xuxv.frag b/src/compositor/shaders/surface_y_xuxv.frag
index 79f8600e8..57609f4fd 100644
--- a/src/compositor/shaders/surface_y_xuxv.frag
+++ b/src/compositor/shaders/surface_y_xuxv.frag
@@ -1,17 +1,29 @@
-uniform highp sampler2D tex0;
-uniform highp sampler2D tex1;
-varying highp vec2 v_texcoord;
-uniform lowp float qt_Opacity;
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
-void main() {
- float y = 1.16438356 * (texture2D(tex0, v_texcoord).x - 0.0625);
- float u = texture2D(tex1, v_texcoord).g - 0.5;
- float v = texture2D(tex1, v_texcoord).a - 0.5;
- y *= qt_Opacity;
- u *= qt_Opacity;
- v *= qt_Opacity;
- gl_FragColor.r = y + 1.59602678 * v;
- gl_FragColor.g = y - 0.39176229 * u - 0.81296764 * v;
- gl_FragColor.b = y + 2.01723214 * u;
- gl_FragColor.a = qt_Opacity;
+#version 440
+
+layout(location = 0) in vec2 v_texcoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+};
+
+layout(binding = 1) uniform sampler2D tex0;
+layout(binding = 2) uniform sampler2D tex1;
+
+void main()
+{
+ float y = 1.16438356 * (texture(tex0, v_texcoord).x - 0.0625);
+ float u = texture(tex1, v_texcoord).g - 0.5;
+ float v = texture(tex1, v_texcoord).a - 0.5;
+ y *= qt_Opacity;
+ u *= qt_Opacity;
+ v *= qt_Opacity;
+ fragColor.r = y + 1.59602678 * v;
+ fragColor.g = y - 0.39176229 * u - 0.81296764 * v;
+ fragColor.b = y + 2.01723214 * u;
+ fragColor.a = qt_Opacity;
}
diff --git a/src/compositor/shaders/surface_y_xuxv.frag.qsb b/src/compositor/shaders/surface_y_xuxv.frag.qsb
new file mode 100644
index 000000000..5450935bd
--- /dev/null
+++ b/src/compositor/shaders/surface_y_xuxv.frag.qsb
Binary files differ