summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-01-06 09:38:52 +0100
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-01-06 09:38:52 +0100
commit6cd3a7c29e2a53996a6ebee8bdfc2545a3e2ca65 (patch)
tree9059440c5e65b1c7e8b78723a92166e38cd722df
parentc6e8920370df5fbb033a1c6fc78d472a711248be (diff)
Testcase for shader effects where one source is used twice
-rw-r--r--tests/ShaderEffectTwiceOnSameSource.qml49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/ShaderEffectTwiceOnSameSource.qml b/tests/ShaderEffectTwiceOnSameSource.qml
new file mode 100644
index 0000000..2263dce
--- /dev/null
+++ b/tests/ShaderEffectTwiceOnSameSource.qml
@@ -0,0 +1,49 @@
+import QtQuick 2.0
+
+Item {
+ width: 400
+ height: 300
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ font.pixelSize: 80
+ text: "Shaderz!"
+ }
+
+ ShaderEffectSource {
+ id: source
+ sourceItem: text
+ }
+
+ ShaderEffectItem {
+ width: parent.width
+ height: parent.height / 2
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+
+ ShaderEffectItem {
+ width: parent.width
+ y: parent.height / 2
+ height: parent.height / 2
+
+ property variant source: source
+
+ fragmentShader: "
+ uniform lowp sampler2D source;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor = vec4(qt_TexCoord0.x, 1, 0, 1) * texture2D(source, qt_TexCoord0).a;
+ }
+ "
+ }
+}