aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/scenegraph/twotextureproviders/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/scenegraph/twotextureproviders/shaders')
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/+qsb/checker.fragbin0 -> 1824 bytes
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.fragbin0 -> 1941 bytes
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.vertbin0 -> 1815 bytes
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/checker.frag14
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/checker_rhi.frag25
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/xorblender.frag12
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert12
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.frag20
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.vert19
9 files changed, 102 insertions, 0 deletions
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/checker.frag b/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/checker.frag
new file mode 100644
index 0000000000..edcfad488b
--- /dev/null
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/checker.frag
Binary files differ
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.frag b/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.frag
new file mode 100644
index 0000000000..7a5280ba08
--- /dev/null
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.frag
Binary files differ
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.vert b/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.vert
new file mode 100644
index 0000000000..d643c7be6a
--- /dev/null
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.vert
Binary files differ
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/checker.frag b/examples/quick/scenegraph/twotextureproviders/shaders/checker.frag
new file mode 100644
index 0000000000..044b3bad58
--- /dev/null
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/checker.frag
@@ -0,0 +1,14 @@
+uniform lowp vec4 color1;
+uniform lowp vec4 color2;
+uniform highp vec2 pixelSize;
+
+varying highp vec2 qt_TexCoord0;
+
+void main()
+{
+ highp vec2 tc = sign(sin(3.14159265358979323846 * qt_TexCoord0 * pixelSize));
+ if (tc.x != tc.y)
+ gl_FragColor = color1;
+ else
+ gl_FragColor = color2;
+}
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/checker_rhi.frag b/examples/quick/scenegraph/twotextureproviders/shaders/checker_rhi.frag
new file mode 100644
index 0000000000..0932bc8c37
--- /dev/null
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/checker_rhi.frag
@@ -0,0 +1,25 @@
+#version 440
+
+layout(location = 0) in vec2 qt_TexCoord0;
+
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ // preamble as required by ShaderEffect
+ mat4 qt_Matrix;
+ float qt_Opacity;
+
+ // our custom members, connected automatically to QML object properties
+ vec4 color1;
+ vec4 color2;
+ vec2 pixelSize;
+} ubuf;
+
+void main()
+{
+ vec2 tc = sign(sin(3.14159265358979323846 * qt_TexCoord0 * ubuf.pixelSize));
+ if (tc.x != tc.y)
+ fragColor = ubuf.color1;
+ else
+ fragColor = ubuf.color2;
+}
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.frag b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.frag
new file mode 100644
index 0000000000..f67735312d
--- /dev/null
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.frag
@@ -0,0 +1,12 @@
+uniform lowp float qt_Opacity;
+uniform lowp sampler2D uSource1;
+uniform lowp sampler2D uSource2;
+
+varying highp vec2 vTexCoord;
+
+void main()
+{
+ lowp vec4 p1 = texture2D(uSource1, vTexCoord);
+ lowp vec4 p2 = texture2D(uSource2, vTexCoord);
+ gl_FragColor = (p1 * (1.0 - p2.a) + p2 * (1.0 - p1.a)) * qt_Opacity;
+}
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert
new file mode 100644
index 0000000000..ac9f1364d6
--- /dev/null
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert
@@ -0,0 +1,12 @@
+attribute highp vec4 aVertex;
+attribute highp vec2 aTexCoord;
+
+uniform highp mat4 qt_Matrix;
+
+varying highp vec2 vTexCoord;
+
+void main()
+{
+ gl_Position = qt_Matrix * aVertex;
+ vTexCoord = aTexCoord;
+}
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.frag b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.frag
new file mode 100644
index 0000000000..bc68160c1f
--- /dev/null
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.frag
@@ -0,0 +1,20 @@
+#version 440
+
+layout(location = 0) in vec2 vTexCoord;
+
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+} ubuf;
+
+layout(binding = 1) uniform sampler2D uSource1;
+layout(binding = 2) uniform sampler2D uSource2;
+
+void main()
+{
+ lowp vec4 p1 = texture(uSource1, vTexCoord);
+ lowp vec4 p2 = texture(uSource2, vTexCoord);
+ fragColor = (p1 * (1.0 - p2.a) + p2 * (1.0 - p1.a)) * ubuf.qt_Opacity;
+}
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.vert b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.vert
new file mode 100644
index 0000000000..41000bde04
--- /dev/null
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.vert
@@ -0,0 +1,19 @@
+#version 440
+
+layout(location = 0) in vec4 aVertex;
+layout(location = 1) in vec2 aTexCoord;
+
+layout(location = 0) out vec2 vTexCoord;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 qt_Matrix;
+ float qt_Opacity;
+} ubuf;
+
+out gl_PerVertex { vec4 gl_Position; };
+
+void main()
+{
+ gl_Position = ubuf.qt_Matrix * aVertex;
+ vTexCoord = aTexCoord;
+}