aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/scenegraph
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-04-07 17:01:07 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-04-29 08:42:17 +0200
commite25bd7a3b76107eb3da3e1eb4e8667ce99b4d20a (patch)
tree45dbfd25b89aa867d9913cb0bc477508f1997b0a /examples/quick/scenegraph
parent1465ca26c62605634afdf7b2c9e8ecbfc2397dae (diff)
Remove leftover legacy shader files in scenegraph example
Task-number: QTBUG-82997 Change-Id: Icc328394154d7b352c9f47184c2f906d5afa4d44 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'examples/quick/scenegraph')
-rw-r--r--examples/quick/scenegraph/twotextureproviders/CMakeLists.txt9
-rw-r--r--examples/quick/scenegraph/twotextureproviders/main.qml4
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/checker.frag25
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/checker.frag.qsb (renamed from examples/quick/scenegraph/twotextureproviders/shaders/+qsb/checker.frag)bin1824 -> 1824 bytes
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/checker_rhi.frag25
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/xorblender.frag22
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/xorblender.frag.qsb (renamed from examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.frag)bin1941 -> 1941 bytes
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert17
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert.qsb (renamed from examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.vert)bin1815 -> 1815 bytes
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.frag20
-rw-r--r--examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.vert19
-rw-r--r--examples/quick/scenegraph/twotextureproviders/twotextureproviders.qrc11
-rw-r--r--examples/quick/scenegraph/twotextureproviders/xorblender.cpp4
13 files changed, 54 insertions, 102 deletions
diff --git a/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt b/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt
index 0f6104ae40..37647082cc 100644
--- a/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt
+++ b/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt
@@ -31,12 +31,9 @@ target_link_libraries(twotextureproviders PUBLIC
# Resources:
set(twotextureproviders_resource_files
"main.qml"
- "shaders/+qsb/checker.frag"
- "shaders/+qsb/xorblender.frag"
- "shaders/+qsb/xorblender.vert"
- "shaders/checker.frag"
- "shaders/xorblender.frag"
- "shaders/xorblender.vert"
+ "shaders/checker.frag.qsb"
+ "shaders/xorblender.frag.qsb"
+ "shaders/xorblender.vert.qsb"
)
qt6_add_resources(twotextureproviders "twotextureproviders"
diff --git a/examples/quick/scenegraph/twotextureproviders/main.qml b/examples/quick/scenegraph/twotextureproviders/main.qml
index b9e516f4b7..e18cfd56e1 100644
--- a/examples/quick/scenegraph/twotextureproviders/main.qml
+++ b/examples/quick/scenegraph/twotextureproviders/main.qml
@@ -64,9 +64,7 @@ Item {
property size pixelSize: Qt.size(width / tileSize, height / tileSize);
- // Will automatically pick either checker.frag or +qsb/checker.frag
- // thanks to file selectors.
- fragmentShader: "qrc:/scenegraph/twotextureproviders/shaders/checker.frag"
+ fragmentShader: "qrc:/scenegraph/twotextureproviders/shaders/checker.frag.qsb"
}
width: 320
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/checker.frag b/examples/quick/scenegraph/twotextureproviders/shaders/checker.frag
index 044b3bad58..0932bc8c37 100644
--- a/examples/quick/scenegraph/twotextureproviders/shaders/checker.frag
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/checker.frag
@@ -1,14 +1,25 @@
-uniform lowp vec4 color1;
-uniform lowp vec4 color2;
-uniform highp vec2 pixelSize;
+#version 440
-varying highp vec2 qt_TexCoord0;
+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()
{
- highp vec2 tc = sign(sin(3.14159265358979323846 * qt_TexCoord0 * pixelSize));
+ vec2 tc = sign(sin(3.14159265358979323846 * qt_TexCoord0 * ubuf.pixelSize));
if (tc.x != tc.y)
- gl_FragColor = color1;
+ fragColor = ubuf.color1;
else
- gl_FragColor = color2;
+ fragColor = ubuf.color2;
}
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/checker.frag b/examples/quick/scenegraph/twotextureproviders/shaders/checker.frag.qsb
index edcfad488b..edcfad488b 100644
--- a/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/checker.frag
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/checker.frag.qsb
Binary files differ
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/checker_rhi.frag b/examples/quick/scenegraph/twotextureproviders/shaders/checker_rhi.frag
deleted file mode 100644
index 0932bc8c37..0000000000
--- a/examples/quick/scenegraph/twotextureproviders/shaders/checker_rhi.frag
+++ /dev/null
@@ -1,25 +0,0 @@
-#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
index f67735312d..bc68160c1f 100644
--- a/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.frag
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.frag
@@ -1,12 +1,20 @@
-uniform lowp float qt_Opacity;
-uniform lowp sampler2D uSource1;
-uniform lowp sampler2D uSource2;
+#version 440
-varying highp vec2 vTexCoord;
+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 = texture2D(uSource1, vTexCoord);
- lowp vec4 p2 = texture2D(uSource2, vTexCoord);
- gl_FragColor = (p1 * (1.0 - p2.a) + p2 * (1.0 - p1.a)) * qt_Opacity;
+ 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/+qsb/xorblender.frag b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.frag.qsb
index 7a5280ba08..7a5280ba08 100644
--- a/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.frag
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.frag.qsb
Binary files differ
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert
index ac9f1364d6..41000bde04 100644
--- a/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert
@@ -1,12 +1,19 @@
-attribute highp vec4 aVertex;
-attribute highp vec2 aTexCoord;
+#version 440
-uniform highp mat4 qt_Matrix;
+layout(location = 0) in vec4 aVertex;
+layout(location = 1) in vec2 aTexCoord;
-varying highp vec2 vTexCoord;
+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 = qt_Matrix * aVertex;
+ gl_Position = ubuf.qt_Matrix * aVertex;
vTexCoord = aTexCoord;
}
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.vert b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert.qsb
index d643c7be6a..d643c7be6a 100644
--- a/examples/quick/scenegraph/twotextureproviders/shaders/+qsb/xorblender.vert
+++ b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender.vert.qsb
Binary files differ
diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.frag b/examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.frag
deleted file mode 100644
index bc68160c1f..0000000000
--- a/examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.frag
+++ /dev/null
@@ -1,20 +0,0 @@
-#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
deleted file mode 100644
index 41000bde04..0000000000
--- a/examples/quick/scenegraph/twotextureproviders/shaders/xorblender_rhi.vert
+++ /dev/null
@@ -1,19 +0,0 @@
-#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;
-}
diff --git a/examples/quick/scenegraph/twotextureproviders/twotextureproviders.qrc b/examples/quick/scenegraph/twotextureproviders/twotextureproviders.qrc
index 8022a77a1e..751376a4d9 100644
--- a/examples/quick/scenegraph/twotextureproviders/twotextureproviders.qrc
+++ b/examples/quick/scenegraph/twotextureproviders/twotextureproviders.qrc
@@ -1,13 +1,8 @@
<RCC>
<qresource prefix="/scenegraph/twotextureproviders">
<file>main.qml</file>
-
- <file>shaders/checker.frag</file>
- <file>shaders/xorblender.vert</file>
- <file>shaders/xorblender.frag</file>
-
- <file>shaders/+qsb/checker.frag</file>
- <file>shaders/+qsb/xorblender.vert</file>
- <file>shaders/+qsb/xorblender.frag</file>
+ <file>shaders/checker.frag.qsb</file>
+ <file>shaders/xorblender.vert.qsb</file>
+ <file>shaders/xorblender.frag.qsb</file>
</qresource>
</RCC>
diff --git a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
index 5471cf733f..ad959b723d 100644
--- a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
+++ b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
@@ -128,8 +128,8 @@ int XorBlendMaterial::compare(const QSGMaterial *o) const
XorBlendRhiShader::XorBlendRhiShader()
{
- setShaderFileName(VertexStage, QLatin1String(":/scenegraph/twotextureproviders/shaders/+qsb/xorblender.vert"));
- setShaderFileName(FragmentStage, QLatin1String(":/scenegraph/twotextureproviders/shaders/+qsb/xorblender.frag"));
+ setShaderFileName(VertexStage, QLatin1String(":/scenegraph/twotextureproviders/shaders/xorblender.vert.qsb"));
+ setShaderFileName(FragmentStage, QLatin1String(":/scenegraph/twotextureproviders/shaders/xorblender.frag.qsb"));
}
bool XorBlendRhiShader::updateUniformData(RenderState &state, QSGMaterial *, QSGMaterial *)