diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2019-12-13 12:07:18 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2020-01-06 15:17:09 +0100 |
commit | 0c2eaad357e555ccaf4fecf42aef03576bbae133 (patch) | |
tree | ea115a0d3e4e2d3dbdea54ba4818b6d6a25c45fe /tests/manual | |
parent | cba6f48613fad1718edc5823b39bc4c7f7300dee (diff) |
Add RHI shaders to ShaderEffect test scenes
Add RHI versions of the fragment and vertex shaders in the lancelot
test scenes. Move all shaders into external files and include them as
resources, so that the automatic file selector mechanism will pick up
the right version at runtime.
Task-number: QTBUG-78683
Change-Id: I5eb1669d09a650301ac2a3012db8b3d1814c7bcb
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'tests/manual')
69 files changed, 360 insertions, 354 deletions
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml b/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml index d4ae526b5d..956b3d7d91 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/activity/activity.qml @@ -23,13 +23,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml b/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml index f1bb03a4a9..24aa5db5e8 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/basic/basic.qml @@ -6,12 +6,6 @@ Item { ShaderEffect { anchors.fill: parent; - fragmentShader: " - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1); - } - " + fragmentShader: "qrc:shaders/basic.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml index 76ce60fd7d..118de56098 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml @@ -72,16 +72,7 @@ Rectangle { cullMode: model.bar property variant frontSource: front property variant backSource: back - fragmentShader: " - varying highp vec2 qt_TexCoord0; - uniform sampler2D frontSource; - uniform sampler2D backSource; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = gl_FrontFacing - ? texture2D(frontSource, qt_TexCoord0) - : texture2D(backSource, qt_TexCoord0); - }" + fragmentShader: "qrc:shaders/culling.frag" transform: Rotation { origin.x: 200 origin.y: 180 - 120 * index diff --git a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml index 45f20dd5a4..7614451e05 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_2.qml @@ -72,16 +72,7 @@ Rectangle { cullMode: model.bar property variant frontSource: front property variant backSource: back - fragmentShader: " - varying highp vec2 qt_TexCoord0; - uniform sampler2D frontSource; - uniform sampler2D backSource; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = gl_FrontFacing - ? texture2D(frontSource, qt_TexCoord0) - : texture2D(backSource, qt_TexCoord0); - }" + fragmentShader: "qrc:shaders/culling.frag" transform: Rotation { origin.x: 100 origin.y: 180 - 120 * index diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml index ddea979124..7a743453ab 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_1.qml @@ -6,8 +6,8 @@ Rectangle { color: "skyblue" ShaderEffect { anchors.centerIn: parent - width: 16 * 16 - height: 24 * 16 + width: 22 * 12 + height: 16 * 12 property variant source: ShaderEffectSource { sourceItem: Rectangle { width: 22 * 20 @@ -40,18 +40,7 @@ Rectangle { } smooth: true } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - pos.x += sin(qt_Vertex.y * 0.02) * 20.; - pos.y += sin(qt_Vertex.x * 0.02) * 20.; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" + vertexShader: "qrc:shaders/wave.vert" mesh: GridMesh { property int r: 1 resolution: Qt.size(r, r) diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml index 971cda4f55..9e221d0887 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_16.qml @@ -6,8 +6,8 @@ Rectangle { color: "skyblue" ShaderEffect { anchors.centerIn: parent - width: 16 * 16 - height: 24 * 16 + width: 22 * 12 + height: 16 * 12 property variant source: ShaderEffectSource { sourceItem: Rectangle { width: 22 * 20 @@ -40,18 +40,7 @@ Rectangle { } smooth: true } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - pos.x += sin(qt_Vertex.y * 0.02) * 20.; - pos.y += sin(qt_Vertex.x * 0.02) * 20.; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" + vertexShader: "qrc:shaders/wave.vert" mesh: GridMesh { property int r: 16 resolution: Qt.size(r, r) diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml index d301ef089c..4dad42d182 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_2.qml @@ -4,10 +4,10 @@ Rectangle { width: 320 height: 480 color: "skyblue" - ShaderEffect{ + ShaderEffect { anchors.centerIn: parent - width: 16 * 16 - height: 24 * 16 + width: 22 * 12 + height: 16 * 12 property variant source: ShaderEffectSource { sourceItem: Rectangle { width: 22 * 20 @@ -40,18 +40,7 @@ Rectangle { } smooth: true } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - pos.x += sin(qt_Vertex.y * 0.02) * 20.; - pos.y += sin(qt_Vertex.x * 0.02) * 20.; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" + vertexShader: "qrc:shaders/wave.vert" mesh: GridMesh { property int r: 2 resolution: Qt.size(r, r) diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml index 0043282efd..9d91da0bb2 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_4.qml @@ -6,8 +6,8 @@ Rectangle { color: "skyblue" ShaderEffect { anchors.centerIn: parent - width: 16 * 16 - height: 24 * 16 + width: 22 * 12 + height: 16 * 12 property variant source: ShaderEffectSource { sourceItem: Rectangle { width: 22 * 20 @@ -40,18 +40,7 @@ Rectangle { } smooth: true } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - pos.x += sin(qt_Vertex.y * 0.02) * 20.; - pos.y += sin(qt_Vertex.x * 0.02) * 20.; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" + vertexShader: "qrc:shaders/wave.vert" mesh: GridMesh { property int r: 4 resolution: Qt.size(r, r) diff --git a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml index f9427a1f16..c436c0f8e4 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/gridmesh/resolution_8.qml @@ -6,8 +6,8 @@ Rectangle { color: "skyblue" ShaderEffect { anchors.centerIn: parent - width: 16 * 16 - height: 24 * 16 + width: 22 * 12 + height: 16 * 12 property variant source: ShaderEffectSource { sourceItem: Rectangle { width: 22 * 20 @@ -40,18 +40,7 @@ Rectangle { } smooth: true } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - pos.x += sin(qt_Vertex.y * 0.02) * 20.; - pos.y += sin(qt_Vertex.x * 0.02) * 20.; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" + vertexShader: "qrc:shaders/wave.vert" mesh: GridMesh { property int r: 8 resolution: Qt.size(r, r) diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml index 83469531b1..7c5b5efac5 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_1.qml @@ -43,22 +43,6 @@ Item { property variant offset: Qt.size(4 / width, 4 / height) property variant delta: Qt.size(0.5 / width, 0.5 / height) - fragmentShader: " - uniform lowp sampler2D source; - uniform highp vec2 offset; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - highp vec2 delta2 = vec2(delta.x, -delta.y); - lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a - + texture2D(source, qt_TexCoord0 - offset - delta).a - + texture2D(source, qt_TexCoord0 - offset + delta2).a - + texture2D(source, qt_TexCoord0 - offset - delta2).a); - lowp vec4 color = texture2D(source, qt_TexCoord0); - gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); - } - " + fragmentShader: "qrc:shaders/shadow.frag" } } - diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml index 160b89168e..64b950ace4 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/hiddensource_2.qml @@ -43,23 +43,6 @@ Item { property variant offset: Qt.size(4 / width, 4 / height) property variant delta: Qt.size(0.5 / width, 0.5 / height) - fragmentShader: " - uniform lowp sampler2D source; - uniform highp vec2 offset; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - highp vec2 delta2 = vec2(delta.x, -delta.y); - lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a - + texture2D(source, qt_TexCoord0 - offset - delta).a - + texture2D(source, qt_TexCoord0 - offset + delta2).a - + texture2D(source, qt_TexCoord0 - offset - delta2).a); - lowp vec4 color = texture2D(source, qt_TexCoord0); - gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); - } - " + fragmentShader: "qrc:shaders/shadow.frag" } } - - diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml index 566edddedb..b071715cf2 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_1.qml @@ -43,22 +43,6 @@ Item { property variant offset: Qt.size(4 / width, 4 / height) property variant delta: Qt.size(0.5 / width, 0.5 / height) - fragmentShader: " - uniform lowp sampler2D source; - uniform highp vec2 offset; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - highp vec2 delta2 = vec2(delta.x, -delta.y); - lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a - + texture2D(source, qt_TexCoord0 - offset - delta).a - + texture2D(source, qt_TexCoord0 - offset + delta2).a - + texture2D(source, qt_TexCoord0 - offset - delta2).a); - lowp vec4 color = texture2D(source, qt_TexCoord0); - gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); - } - " + fragmentShader: "qrc:shaders/shadow.frag" } } - diff --git a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml index 0b8038e9ee..02ac70e69c 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/hiddensource/unhidden_2.qml @@ -43,24 +43,6 @@ Item { property variant offset: Qt.size(4 / width, 4 / height) property variant delta: Qt.size(0.5 / width, 0.5 / height) - fragmentShader: " - uniform lowp sampler2D source; - uniform highp vec2 offset; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - highp vec2 delta2 = vec2(delta.x, -delta.y); - lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a - + texture2D(source, qt_TexCoord0 - offset - delta).a - + texture2D(source, qt_TexCoord0 - offset + delta2).a - + texture2D(source, qt_TexCoord0 - offset - delta2).a); - lowp vec4 color = texture2D(source, qt_TexCoord0); - gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); - } - " + fragmentShader: "qrc:shaders/shadow.frag" } } - - - diff --git a/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml b/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml index 132f160a26..c4cf4cc1e4 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/image/async.qml @@ -6,7 +6,7 @@ Item { Image { id: image; - source: "./face-smile.png" + source: "face-smile.png" visible: false asynchronous: true } @@ -14,15 +14,7 @@ Item { ShaderEffect { anchors.fill: image property variant source: image - - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 0, 1) + texture2D(source, qt_TexCoord0); - } - " + fragmentShader: "qrc:shaders/gradient2.frag" visible: image.status == Image.Ready } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml b/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml index 878eddeda5..04406829b3 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/image/source.qml @@ -13,14 +13,6 @@ Item { ShaderEffect { anchors.fill: image property variant source: image - - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 0, 1) + texture2D(source, qt_TexCoord0); - } - " + fragmentShader: "qrc:shaders/gradient2.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml index 0383feaf91..97b5760854 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_1.qml @@ -32,13 +32,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient3.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml index 2e7074c65d..ea3456838c 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/live/liveonce_2.qml @@ -32,13 +32,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient3.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml index 3793e655c7..9f0162ccd3 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_1.qml @@ -16,7 +16,7 @@ Item { height: 50 color: "red" anchors.centerIn: parent - transform: Rotation{ angle: 45} + transform: Rotation{ angle: 45 } } } @@ -38,14 +38,7 @@ Item { property variant source: source1 - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(1, qt_TexCoord0.y, 0, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient4.frag" } ShaderEffect { @@ -55,14 +48,7 @@ Item { property variant source: source2 - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient3.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml index 2d8a4b6c09..e0c218ca69 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/live/livetwice_2.qml @@ -16,7 +16,7 @@ Item { height: 50 color: "red" anchors.centerIn: parent - transform: Rotation{ angle: 90} + transform: Rotation{ angle: 90 } } } @@ -38,14 +38,7 @@ Item { property variant source: source1 - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(1, qt_TexCoord0.y, 0, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient4.frag" } ShaderEffect { @@ -55,14 +48,7 @@ Item { property variant source: source2 - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient3.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml b/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml index 67e0cc36ad..5b1f15c01c 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/live/samesource.qml @@ -24,14 +24,7 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient3.frag" } ShaderEffect { @@ -41,13 +34,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, 1, 0, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient5.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml index d57f7c5dfb..309db50ba2 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/one-source.qml @@ -23,13 +23,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml index e2a3ca7a0c..f473207235 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/rect.qml @@ -22,14 +22,7 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient.frag" } Rectangle { diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml index 9df6b13c1e..2b04b76482 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_1.qml @@ -47,14 +47,7 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient.frag" } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml index f997630d30..0ce09cda18 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/switch_2.qml @@ -47,14 +47,7 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " + fragmentShader: "qrc:shaders/gradient.frag" } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml index 1fadabe5b6..dbb82a278e 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/two-sources.qml @@ -44,14 +44,6 @@ Item { property variant colorSource: colorSource property variant maskSource: maskSource; - fragmentShader: " - uniform lowp sampler2D maskSource; - uniform lowp sampler2D colorSource; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = texture2D(maskSource, qt_TexCoord0).a * texture2D(colorSource, qt_TexCoord0.yx); - } - " + fragmentShader: "qrc:shaders/stencil.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml index 7a3bf9fd36..309028807f 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_1.qml @@ -27,14 +27,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " - + fragmentShader: "qrc:shaders/gradient.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml index d60dbaee3d..df05c8f087 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/source/visible_2.qml @@ -27,14 +27,6 @@ Item { property variant source: source - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; - } - " - + fragmentShader: "qrc:shaders/gradient.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml b/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml index ab8db47009..5738da5e8d 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/texture/size.qml @@ -18,22 +18,7 @@ Item { property variant textureSize: source.textureSize property color color: "black" - fragmentShader: " - uniform lowp sampler2D source; - varying highp vec2 qt_TexCoord0; - uniform highp vec2 textureSize; - uniform lowp vec4 color; - uniform lowp float qt_Opacity; - void main() { - highp vec2 dx = vec2(0.5 / textureSize.x, 0.); - highp vec2 dy = vec2(0., 0.5 / textureSize.y); - gl_FragColor = color * 0.25 - * (texture2D(source, qt_TexCoord0 + dx + dy).a - + texture2D(source, qt_TexCoord0 + dx - dy).a - + texture2D(source, qt_TexCoord0 - dx + dy).a - + texture2D(source, qt_TexCoord0 - dx - dy).a); - } - " + fragmentShader: "qrc:shaders/edge.frag" } Text { diff --git a/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml b/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml index c008114810..baa002dc50 100644 --- a/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml +++ b/tests/manual/scenegraph_lancelot/data/shaders/wrap/modes.qml @@ -48,21 +48,6 @@ Item { property variant yellow: repeat property variant black: clamp - fragmentShader: " - uniform lowp sampler2D cyan; - uniform lowp sampler2D magenta; - uniform lowp sampler2D yellow; - uniform lowp sampler2D black; - varying highp vec2 qt_TexCoord0; - uniform lowp float qt_Opacity; - void main() { - highp vec2 t = qt_TexCoord0 * 3. - 1.; - lowp float c = texture2D(cyan, t + vec2(.05, .09)).a; - lowp float m = texture2D(magenta, t + vec2(.04, -.10)).a; - lowp float y = texture2D(yellow, t + vec2(-.10, .01)).a; - lowp float k = texture2D(black, t).a; - gl_FragColor = 1. - vec4(c + k, m + k, y + k, 0.); - } - " + fragmentShader: "qrc:shaders/cmyk.frag" } } diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/basic.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/basic.frag Binary files differnew file mode 100644 index 0000000000..c6da52fd32 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/basic.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/cmyk.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/cmyk.frag Binary files differnew file mode 100644 index 0000000000..e9c48edbb9 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/cmyk.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/culling.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/culling.frag Binary files differnew file mode 100644 index 0000000000..6f44fff112 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/culling.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/edge.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/edge.frag Binary files differnew file mode 100644 index 0000000000..01a1d1cb3d --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/edge.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient.frag Binary files differnew file mode 100644 index 0000000000..78ac8a9c95 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient2.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient2.frag Binary files differnew file mode 100644 index 0000000000..364fffab52 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient2.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient3.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient3.frag Binary files differnew file mode 100644 index 0000000000..42bebf490a --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient3.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient4.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient4.frag Binary files differnew file mode 100644 index 0000000000..ed31582cf9 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient4.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient5.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient5.frag Binary files differnew file mode 100644 index 0000000000..7fe041f0ae --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/gradient5.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/shadow.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/shadow.frag Binary files differnew file mode 100644 index 0000000000..cb3428b75f --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/shadow.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/stencil.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/stencil.frag Binary files differnew file mode 100644 index 0000000000..ccf3633d64 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/stencil.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/wave.vert b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/wave.vert Binary files differnew file mode 100644 index 0000000000..04850feb27 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/+qsb/wave.vert diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/basic.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/basic.frag new file mode 100644 index 0000000000..6b3a881174 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/basic.frag @@ -0,0 +1,5 @@ +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/basic_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/basic_rhi.frag new file mode 100644 index 0000000000..aa850af449 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/basic_rhi.frag @@ -0,0 +1,8 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +void main() { + fragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk.frag new file mode 100644 index 0000000000..d63a0fa6ee --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk.frag @@ -0,0 +1,14 @@ +uniform lowp sampler2D cyan; +uniform lowp sampler2D magenta; +uniform lowp sampler2D yellow; +uniform lowp sampler2D black; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + highp vec2 t = qt_TexCoord0 * 3. - 1.; + lowp float c = texture2D(cyan, t + vec2(.05, .09)).a; + lowp float m = texture2D(magenta, t + vec2(.04, -.10)).a; + lowp float y = texture2D(yellow, t + vec2(-.10, .01)).a; + lowp float k = texture2D(black, t).a; + gl_FragColor = 1. - vec4(c + k, m + k, y + k, 0.); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk_rhi.frag new file mode 100644 index 0000000000..5d528e1d7a --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/cmyk_rhi.frag @@ -0,0 +1,18 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D cyan; +layout(binding = 2) uniform sampler2D magenta; +layout(binding = 3) uniform sampler2D yellow; +layout(binding = 4) uniform sampler2D black; + +void main() { + vec2 t = qt_TexCoord0 * 3. - 1.; + lowp float c = texture(cyan, t + vec2(.05, .09)).a; + lowp float m = texture(magenta, t + vec2(.04, -.10)).a; + lowp float y = texture(yellow, t + vec2(-.10, .01)).a; + lowp float k = texture(black, t).a; + fragColor = 1. - vec4(c + k, m + k, y + k, 0.); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/compile.bat b/tests/manual/scenegraph_lancelot/data/shared/shaders/compile.bat new file mode 100644 index 0000000000..13435f76b6 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/compile.bat @@ -0,0 +1,13 @@ +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/wave.vert wave_rhi.vert + +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/basic.frag basic_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/cmyk.frag cmyk_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/culling.frag culling_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/edge.frag edge_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/gradient.frag gradient_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/gradient2.frag gradient2_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/gradient3.frag gradient3_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/gradient4.frag gradient4_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/gradient5.frag gradient5_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/shadow.frag shadow_rhi.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/stencil.frag stencil_rhi.frag diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/culling.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/culling.frag new file mode 100644 index 0000000000..1b12df7c6d --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/culling.frag @@ -0,0 +1,9 @@ +varying highp vec2 qt_TexCoord0; +uniform sampler2D frontSource; +uniform sampler2D backSource; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = gl_FrontFacing + ? texture2D(frontSource, qt_TexCoord0) + : texture2D(backSource, qt_TexCoord0); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/culling_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/culling_rhi.frag new file mode 100644 index 0000000000..8399bc0282 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/culling_rhi.frag @@ -0,0 +1,13 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D frontSource; +layout(binding = 1) uniform sampler2D backSource; + +void main() { + fragColor = gl_FrontFacing + ? texture(frontSource, qt_TexCoord0) + : texture(backSource, qt_TexCoord0); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/edge.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/edge.frag new file mode 100644 index 0000000000..8cb616f3e0 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/edge.frag @@ -0,0 +1,14 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform highp vec2 textureSize; +uniform lowp vec4 color; +uniform lowp float qt_Opacity; +void main() { + highp vec2 dx = vec2(0.5 / textureSize.x, 0.); + highp vec2 dy = vec2(0., 0.5 / textureSize.y); + gl_FragColor = color * 0.25 + * (texture2D(source, qt_TexCoord0 + dx + dy).a + + texture2D(source, qt_TexCoord0 + dx - dy).a + + texture2D(source, qt_TexCoord0 - dx + dy).a + + texture2D(source, qt_TexCoord0 - dx - dy).a); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/edge_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/edge_rhi.frag new file mode 100644 index 0000000000..77d7b47499 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/edge_rhi.frag @@ -0,0 +1,23 @@ +#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 textureSize; + vec4 color; +} ubuf; + +void main() { + vec2 dx = vec2(0.5 / ubuf.textureSize.x, 0.); + vec2 dy = vec2(0., 0.5 / ubuf.textureSize.y); + fragColor = ubuf.color * 0.25 + * (texture(source, qt_TexCoord0 + dx + dy).a + + texture(source, qt_TexCoord0 + dx - dy).a + + texture(source, qt_TexCoord0 - dx + dy).a + + texture(source, qt_TexCoord0 - dx - dy).a); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient.frag new file mode 100644 index 0000000000..c581cc0c73 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient.frag @@ -0,0 +1,6 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2.frag new file mode 100644 index 0000000000..5f07e56d4a --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2.frag @@ -0,0 +1,6 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 0, 1) + texture2D(source, qt_TexCoord0); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2_rhi.frag new file mode 100644 index 0000000000..b08e6339b3 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient2_rhi.frag @@ -0,0 +1,10 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +void main() { + fragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 0, 1) + texture(source, qt_TexCoord0); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3.frag new file mode 100644 index 0000000000..61c9d46f94 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3.frag @@ -0,0 +1,6 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture2D(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3_rhi.frag new file mode 100644 index 0000000000..2e523c2879 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient3_rhi.frag @@ -0,0 +1,10 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +void main() { + fragColor = vec4(0, qt_TexCoord0.y, 1, 1) * texture(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4.frag new file mode 100644 index 0000000000..81d96ce126 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4.frag @@ -0,0 +1,6 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(1, qt_TexCoord0.y, 0, 1) * texture2D(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4_rhi.frag new file mode 100644 index 0000000000..a100ba2cd7 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient4_rhi.frag @@ -0,0 +1,10 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +void main() { + fragColor = vec4(1, qt_TexCoord0.y, 0, 1) * texture(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5.frag new file mode 100644 index 0000000000..33485542af --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5.frag @@ -0,0 +1,6 @@ +uniform lowp sampler2D source; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = vec4(qt_TexCoord0.x, 1, 0, 1) * texture2D(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5_rhi.frag new file mode 100644 index 0000000000..4ec104bd14 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient5_rhi.frag @@ -0,0 +1,10 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +void main() { + fragColor = vec4(qt_TexCoord0.x, 1, 0, 1) * texture(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient_rhi.frag new file mode 100644 index 0000000000..84eee1dbfe --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/gradient_rhi.frag @@ -0,0 +1,10 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D source; + +void main() { + fragColor = vec4(qt_TexCoord0.x, qt_TexCoord0.y, 1, 1) * texture(source, qt_TexCoord0).a; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow.frag new file mode 100644 index 0000000000..0a6cdf3044 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow.frag @@ -0,0 +1,14 @@ +uniform lowp sampler2D source; +uniform highp vec2 offset; +uniform highp vec2 delta; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + highp vec2 delta2 = vec2(delta.x, -delta.y); + lowp float shadow = 0.25 * (texture2D(source, qt_TexCoord0 - offset + delta).a + + texture2D(source, qt_TexCoord0 - offset - delta).a + + texture2D(source, qt_TexCoord0 - offset + delta2).a + + texture2D(source, qt_TexCoord0 - offset - delta2).a); + lowp vec4 color = texture2D(source, qt_TexCoord0); + gl_FragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow_rhi.frag new file mode 100644 index 0000000000..6a2d8dc122 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/shadow_rhi.frag @@ -0,0 +1,23 @@ +#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 offset; + vec2 delta; +} ubuf; + +void main() { + vec2 delta2 = vec2(ubuf.delta.x, -ubuf.delta.y); + float shadow = 0.25 * (texture(source, qt_TexCoord0 - ubuf.offset + ubuf.delta).a + + texture(source, qt_TexCoord0 - ubuf.offset - ubuf.delta).a + + texture(source, qt_TexCoord0 - ubuf.offset + delta2).a + + texture(source, qt_TexCoord0 - ubuf.offset - delta2).a); + vec4 color = texture(source, qt_TexCoord0); + fragColor = mix(vec4(vec3(0.), 0.5 * shadow), color, color.a); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil.frag new file mode 100644 index 0000000000..33c6cee064 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil.frag @@ -0,0 +1,7 @@ +uniform lowp sampler2D maskSource; +uniform lowp sampler2D colorSource; +varying highp vec2 qt_TexCoord0; +uniform lowp float qt_Opacity; +void main() { + gl_FragColor = texture2D(maskSource, qt_TexCoord0).a * texture2D(colorSource, qt_TexCoord0.yx); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil_rhi.frag b/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil_rhi.frag new file mode 100644 index 0000000000..734be73fdb --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/stencil_rhi.frag @@ -0,0 +1,11 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D maskSource; +layout(binding = 2) uniform sampler2D colorSource; + +void main() { + fragColor = texture(maskSource, qt_TexCoord0).a * texture(colorSource, qt_TexCoord0.yx); +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/wave.vert b/tests/manual/scenegraph_lancelot/data/shared/shaders/wave.vert new file mode 100644 index 0000000000..38e523c06b --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/wave.vert @@ -0,0 +1,12 @@ +uniform highp mat4 qt_Matrix; +attribute highp vec4 qt_Vertex; +attribute highp vec2 qt_MultiTexCoord0; +varying highp vec2 qt_TexCoord0; + +void main() { + highp vec4 pos = qt_Vertex; + pos.x += sin(qt_Vertex.y * 0.02) * 20.; + pos.y += sin(qt_Vertex.x * 0.02) * 20.; + gl_Position = qt_Matrix * pos; + qt_TexCoord0 = qt_MultiTexCoord0; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shaders/wave_rhi.vert b/tests/manual/scenegraph_lancelot/data/shared/shaders/wave_rhi.vert new file mode 100644 index 0000000000..38f6173773 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shaders/wave_rhi.vert @@ -0,0 +1,18 @@ +#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; +} ubuf; + +void main() { + vec4 pos = qt_Vertex; + pos.x += sin(qt_Vertex.y * 0.02) * 20.; + pos.y += sin(qt_Vertex.x * 0.02) * 20.; + gl_Position = ubuf.qt_Matrix * pos; + qt_TexCoord0 = qt_MultiTexCoord0; +} diff --git a/tests/manual/scenegraph_lancelot/data/shared/shared.qrc b/tests/manual/scenegraph_lancelot/data/shared/shared.qrc new file mode 100644 index 0000000000..3618fc8b94 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/shared/shared.qrc @@ -0,0 +1,28 @@ +<RCC> + <qresource prefix="/"> + <file>shaders/basic.frag</file> + <file>shaders/cmyk.frag</file> + <file>shaders/culling.frag</file> + <file>shaders/edge.frag</file> + <file>shaders/gradient.frag</file> + <file>shaders/gradient2.frag</file> + <file>shaders/gradient3.frag</file> + <file>shaders/gradient4.frag</file> + <file>shaders/gradient5.frag</file> + <file>shaders/shadow.frag</file> + <file>shaders/stencil.frag</file> + <file>shaders/wave.vert</file> + <file>shaders/+qsb/basic.frag</file> + <file>shaders/+qsb/cmyk.frag</file> + <file>shaders/+qsb/culling.frag</file> + <file>shaders/+qsb/edge.frag</file> + <file>shaders/+qsb/gradient.frag</file> + <file>shaders/+qsb/gradient2.frag</file> + <file>shaders/+qsb/gradient3.frag</file> + <file>shaders/+qsb/gradient4.frag</file> + <file>shaders/+qsb/gradient5.frag</file> + <file>shaders/+qsb/shadow.frag</file> + <file>shaders/+qsb/stencil.frag</file> + <file>shaders/+qsb/wave.vert</file> + </qresource> +</RCC> diff --git a/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro b/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro index 704acd0aca..3ecb1f8ac1 100644 --- a/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro +++ b/tests/manual/scenegraph_lancelot/scenegrabber/scenegrabber.pro @@ -5,3 +5,6 @@ CONFIG += console QT += quick SOURCES += main.cpp + +RESOURCES += \ + ../data/shared/shared.qrc diff --git a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp index 3cc83e94da..a65bde1002 100644 --- a/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp +++ b/tests/manual/scenegraph_lancelot/scenegraph/tst_scenegraph.cpp @@ -152,7 +152,7 @@ void tst_Scenegraph::testNoTextRendering() void tst_Scenegraph::testRendering_data() { - setupTestSuite(usingRhi ? "shaders/" : ""); // on RHI, skip shader effects tests for now + setupTestSuite(); consecutiveErrors = 0; aborted = false; } |