diff options
Diffstat (limited to 'src/quick/scenegraph/shaders_ng')
95 files changed, 1224 insertions, 0 deletions
diff --git a/src/quick/scenegraph/shaders_ng/24bittextmask.frag b/src/quick/scenegraph/shaders_ng/24bittextmask.frag new file mode 100644 index 0000000000..bc3826a924 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/24bittextmask.frag @@ -0,0 +1,19 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; // only alpha is used, but must be vec4 due to layout compat + vec2 textureScale; + float dpr; +} ubuf; + +void main() +{ + vec4 glyph = texture(_qt_texture, sampleCoord); + fragColor = vec4(glyph.rgb * ubuf.color.a, glyph.a); +} diff --git a/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb b/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb Binary files differnew file mode 100644 index 0000000000..b16da4d76a --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/24bittextmask.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/32bitcolortext.frag b/src/quick/scenegraph/shaders_ng/32bitcolortext.frag new file mode 100644 index 0000000000..63e445f90b --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/32bitcolortext.frag @@ -0,0 +1,18 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; // only alpha is used, but must be vec4 due to layout compat + vec2 textureScale; + float dpr; +} ubuf; + +void main() +{ + fragColor = texture(_qt_texture, sampleCoord) * ubuf.color.a; +} diff --git a/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb b/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb Binary files differnew file mode 100644 index 0000000000..1a12a35b49 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/32bitcolortext.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/8bittextmask.frag b/src/quick/scenegraph/shaders_ng/8bittextmask.frag new file mode 100644 index 0000000000..6304e821ff --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/8bittextmask.frag @@ -0,0 +1,18 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; + vec2 textureScale; + float dpr; +} ubuf; + +void main() +{ + fragColor = ubuf.color * texture(_qt_texture, sampleCoord).r; +} diff --git a/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb b/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb Binary files differnew file mode 100644 index 0000000000..2d0d23d813 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/8bittextmask.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag b/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag new file mode 100644 index 0000000000..0d0fa1cd3a --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag @@ -0,0 +1,18 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; + vec2 textureScale; + float dpr; +} ubuf; + +void main() +{ + fragColor = ubuf.color * texture(_qt_texture, sampleCoord).a; // take .a instead of .r +} diff --git a/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb b/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb Binary files differnew file mode 100644 index 0000000000..65d9af4736 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/8bittextmask_a.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/compile.bat b/src/quick/scenegraph/shaders_ng/compile.bat new file mode 100755 index 0000000000..a0c74c22c7 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/compile.bat @@ -0,0 +1,86 @@ +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: +:: Copyright (C) 2019 The Qt Company Ltd. +:: Contact: https://www.qt.io/licensing/ +:: +:: This file is part of the QtQuick module of the Qt Toolkit. +:: +:: $QT_BEGIN_LICENSE:LGPL$ +:: Commercial License Usage +:: Licensees holding valid commercial Qt licenses may use this file in +:: accordance with the commercial license agreement provided with the +:: Software or, alternatively, in accordance with the terms contained in +:: a written agreement between you and The Qt Company. For licensing terms +:: and conditions see https://www.qt.io/terms-conditions. For further +:: information use the contact form at https://www.qt.io/contact-us. +:: +:: GNU Lesser General Public License Usage +:: Alternatively, this file may be used under the terms of the GNU Lesser +:: General Public License version 3 as published by the Free Software +:: Foundation and appearing in the file LICENSE.LGPL3 included in the +:: packaging of this file. Please review the following information to +:: ensure the GNU Lesser General Public License version 3 requirements +:: will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +:: +:: GNU General Public License Usage +:: Alternatively, this file may be used under the terms of the GNU +:: General Public License version 2.0 or (at your option) the GNU General +:: Public license version 3 or any later version approved by the KDE Free +:: Qt Foundation. The licenses are as published by the Free Software +:: Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +:: included in the packaging of this file. Please review the following +:: information to ensure the GNU General Public License requirements will +:: be met: https://www.gnu.org/licenses/gpl-2.0.html and +:: https://www.gnu.org/licenses/gpl-3.0.html. +:: +:: $QT_END_LICENSE$ +:: +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o vertexcolor.vert.qsb vertexcolor.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o vertexcolor.frag.qsb vertexcolor.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o flatcolor.vert.qsb flatcolor.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o flatcolor.frag.qsb flatcolor.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o smoothcolor.vert.qsb smoothcolor.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o smoothcolor.frag.qsb smoothcolor.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o stencilclip.vert.qsb stencilclip.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o stencilclip.frag.qsb stencilclip.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o texture.vert.qsb texture.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o texture.frag.qsb texture.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o opaquetexture.vert.qsb opaquetexture.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o opaquetexture.frag.qsb opaquetexture.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o smoothtexture.vert.qsb smoothtexture.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o smoothtexture.frag.qsb smoothtexture.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o textmask.vert.qsb textmask.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o textmask.frag.qsb textmask.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o 8bittextmask.frag.qsb 8bittextmask.frag +qsb --glsl "150,120,100 es" -o 8bittextmask_a.frag.qsb 8bittextmask_a.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o 24bittextmask.frag.qsb 24bittextmask.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o 32bitcolortext.frag.qsb 32bitcolortext.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o outlinedtext.vert.qsb outlinedtext.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o outlinedtext.frag.qsb outlinedtext.frag +qsb --glsl "150,120,100 es" -o outlinedtext_a.frag.qsb outlinedtext_a.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o styledtext.vert.qsb styledtext.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o styledtext.frag.qsb styledtext.frag +qsb --glsl "150,120,100 es" -o styledtext_a.frag.qsb styledtext_a.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o distancefieldtext.vert.qsb distancefieldtext.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o distancefieldtext.frag.qsb distancefieldtext.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o distancefieldtext_a.frag.qsb distancefieldtext_a.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o distancefieldshiftedtext.vert.qsb distancefieldshiftedtext.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o distancefieldshiftedtext.frag.qsb distancefieldshiftedtext.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o distancefieldshiftedtext_a.frag.qsb distancefieldshiftedtext_a.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o distancefieldoutlinetext.vert.qsb distancefieldoutlinetext.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o distancefieldoutlinetext.frag.qsb distancefieldoutlinetext.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o distancefieldoutlinetext_a.frag.qsb distancefieldoutlinetext_a.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o hiqsubpixeldistancefieldtext.vert.qsb hiqsubpixeldistancefieldtext.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o hiqsubpixeldistancefieldtext.frag.qsb hiqsubpixeldistancefieldtext.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o hiqsubpixeldistancefieldtext_a.frag.qsb hiqsubpixeldistancefieldtext_a.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o loqsubpixeldistancefieldtext.vert.qsb loqsubpixeldistancefieldtext.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o loqsubpixeldistancefieldtext.frag.qsb loqsubpixeldistancefieldtext.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o loqsubpixeldistancefieldtext_a.frag.qsb loqsubpixeldistancefieldtext_a.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o shadereffect.vert.qsb shadereffect.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o shadereffect.frag.qsb shadereffect.frag +qsb -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -o sprite.vert.qsb sprite.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o sprite.frag.qsb sprite.frag +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o visualization.vert.qsb visualization.vert +qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o visualization.frag.qsb visualization.frag diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag new file mode 100644 index 0000000000..c8c1ac89dc --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag @@ -0,0 +1,25 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + vec4 styleColor; + float outlineAlphaMax0; + float outlineAlphaMax1; +} ubuf; + +void main() +{ + float d = texture(_qt_texture, sampleCoord).r; + fragColor = mix(ubuf.styleColor, ubuf.color, smoothstep(ubuf.alphaMin, ubuf.alphaMax, d)) + * smoothstep(ubuf.outlineAlphaMax0, ubuf.outlineAlphaMax1, d); +} diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb Binary files differnew file mode 100644 index 0000000000..5753794649 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert new file mode 100644 index 0000000000..8f0d618503 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert @@ -0,0 +1,26 @@ +#version 440 + +layout(location = 0) in vec4 vCoord; +layout(location = 1) in vec2 tCoord; + +layout(location = 0) out vec2 sampleCoord; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + vec4 styleColor; + float outlineAlphaMax0; + float outlineAlphaMax1; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + sampleCoord = tCoord * ubuf.textureScale; + gl_Position = ubuf.matrix * vCoord; +} diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert.qsb b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert.qsb Binary files differnew file mode 100644 index 0000000000..6026960d68 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag new file mode 100644 index 0000000000..70fb80852d --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag @@ -0,0 +1,25 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + vec4 styleColor; + float outlineAlphaMax0; + float outlineAlphaMax1; +} ubuf; + +void main() +{ + float d = texture(_qt_texture, sampleCoord).a; + fragColor = mix(ubuf.styleColor, ubuf.color, smoothstep(ubuf.alphaMin, ubuf.alphaMax, d)) + * smoothstep(ubuf.outlineAlphaMax0, ubuf.outlineAlphaMax1, d); +} diff --git a/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb Binary files differnew file mode 100644 index 0000000000..451ccbac5b --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldoutlinetext_a.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag new file mode 100644 index 0000000000..aa3390094b --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag @@ -0,0 +1,27 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 1) in vec2 shiftedSampleCoord; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + vec4 styleColor; + vec2 shift; +} ubuf; + +void main() +{ + float a = smoothstep(ubuf.alphaMin, ubuf.alphaMax, texture(_qt_texture, sampleCoord).r); + vec4 shifted = ubuf.styleColor * smoothstep(ubuf.alphaMin, ubuf.alphaMax, + texture(_qt_texture, shiftedSampleCoord).r); + fragColor = mix(shifted, ubuf.color, a); +} diff --git a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag.qsb Binary files differnew file mode 100644 index 0000000000..41ebc12abf --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert new file mode 100644 index 0000000000..f3a7671435 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert @@ -0,0 +1,27 @@ +#version 440 + +layout(location = 0) in vec4 vCoord; +layout(location = 1) in vec2 tCoord; + +layout(location = 0) out vec2 sampleCoord; +layout(location = 1) out vec2 shiftedSampleCoord; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + vec4 styleColor; + vec2 shift; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + sampleCoord = tCoord * ubuf.textureScale; + shiftedSampleCoord = (tCoord - ubuf.shift) * ubuf.textureScale; + gl_Position = ubuf.matrix * vCoord; +} diff --git a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert.qsb b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert.qsb Binary files differnew file mode 100644 index 0000000000..0c37ccb6ed --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag new file mode 100644 index 0000000000..ab3a5f63ff --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag @@ -0,0 +1,27 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 1) in vec2 shiftedSampleCoord; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + vec4 styleColor; + vec2 shift; +} ubuf; + +void main() +{ + float a = smoothstep(ubuf.alphaMin, ubuf.alphaMax, texture(_qt_texture, sampleCoord).a); + vec4 shifted = ubuf.styleColor * smoothstep(ubuf.alphaMin, ubuf.alphaMax, + texture(_qt_texture, shiftedSampleCoord).a); + fragColor = mix(shifted, ubuf.color, a); +} diff --git a/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag.qsb Binary files differnew file mode 100644 index 0000000000..b92235eec3 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldshiftedtext_a.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/distancefieldtext.frag b/src/quick/scenegraph/shaders_ng/distancefieldtext.frag new file mode 100644 index 0000000000..d594207567 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldtext.frag @@ -0,0 +1,20 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; +} ubuf; + +void main() +{ + fragColor = ubuf.color * smoothstep(ubuf.alphaMin, ubuf.alphaMax, + texture(_qt_texture, sampleCoord).r); +} diff --git a/src/quick/scenegraph/shaders_ng/distancefieldtext.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldtext.frag.qsb Binary files differnew file mode 100644 index 0000000000..28ba15e3de --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldtext.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/distancefieldtext.vert b/src/quick/scenegraph/shaders_ng/distancefieldtext.vert new file mode 100644 index 0000000000..d56ddddd24 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldtext.vert @@ -0,0 +1,22 @@ +#version 440 + +layout(location = 0) in vec4 vCoord; +layout(location = 1) in vec2 tCoord; + +layout(location = 0) out vec2 sampleCoord; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + sampleCoord = tCoord * ubuf.textureScale; + gl_Position = ubuf.matrix * vCoord; +} diff --git a/src/quick/scenegraph/shaders_ng/distancefieldtext.vert.qsb b/src/quick/scenegraph/shaders_ng/distancefieldtext.vert.qsb Binary files differnew file mode 100644 index 0000000000..2877ab92db --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldtext.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag b/src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag new file mode 100644 index 0000000000..bb807d86d8 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag @@ -0,0 +1,20 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; +} ubuf; + +void main() +{ + fragColor = ubuf.color * smoothstep(ubuf.alphaMin, ubuf.alphaMax, + texture(_qt_texture, sampleCoord).a); +} diff --git a/src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag.qsb Binary files differnew file mode 100644 index 0000000000..2e6085aa39 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/distancefieldtext_a.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/flatcolor.frag b/src/quick/scenegraph/shaders_ng/flatcolor.frag new file mode 100644 index 0000000000..3a677b7c93 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/flatcolor.frag @@ -0,0 +1,13 @@ +#version 440 + +layout(location = 0) out vec4 fragColor; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; +} ubuf; + +void main() +{ + fragColor = ubuf.color; +} diff --git a/src/quick/scenegraph/shaders_ng/flatcolor.frag.qsb b/src/quick/scenegraph/shaders_ng/flatcolor.frag.qsb Binary files differnew file mode 100644 index 0000000000..a528c667fd --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/flatcolor.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/flatcolor.vert b/src/quick/scenegraph/shaders_ng/flatcolor.vert new file mode 100644 index 0000000000..b5dfd32197 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/flatcolor.vert @@ -0,0 +1,15 @@ +#version 440 + +layout(location = 0) in vec4 vertexCoord; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + gl_Position = ubuf.matrix * vertexCoord; +} diff --git a/src/quick/scenegraph/shaders_ng/flatcolor.vert.qsb b/src/quick/scenegraph/shaders_ng/flatcolor.vert.qsb Binary files differnew file mode 100644 index 0000000000..e83de529e6 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/flatcolor.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag new file mode 100644 index 0000000000..723227a04d --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag @@ -0,0 +1,40 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 1) in vec3 sampleFarLeft; +layout(location = 2) in vec3 sampleNearLeft; +layout(location = 3) in vec3 sampleNearRight; +layout(location = 4) in vec3 sampleFarRight; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + float fontScale; + vec4 vecDelta; +} ubuf; + +void main() +{ + vec4 n; + n.x = textureProj(_qt_texture, sampleFarLeft).r; + n.y = textureProj(_qt_texture, sampleNearLeft).r; + float c = texture(_qt_texture, sampleCoord).r; + n.z = textureProj(_qt_texture, sampleNearRight).r; + n.w = textureProj(_qt_texture, sampleFarRight).r; + + vec2 d = min(abs(n.yw - n.xz) * 2., 0.67); + vec2 lo = mix(vec2(ubuf.alphaMin), vec2(0.5), d); + vec2 hi = mix(vec2(ubuf.alphaMax), vec2(0.5), d); + n = smoothstep(lo.xxyy, hi.xxyy, n); + c = smoothstep(lo.x + lo.y, hi.x + hi.y, 2. * c); + + fragColor = vec4(0.333 * (n.xyz + n.yzw + c), c) * ubuf.color.w; +} diff --git a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag.qsb b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag.qsb Binary files differnew file mode 100644 index 0000000000..81c51321bb --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert new file mode 100644 index 0000000000..9c7281c31c --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert @@ -0,0 +1,44 @@ +#version 440 + +layout(location = 0) in vec4 vCoord; +layout(location = 1) in vec2 tCoord; + +layout(location = 0) out vec2 sampleCoord; +layout(location = 1) out vec3 sampleFarLeft; +layout(location = 2) out vec3 sampleNearLeft; +layout(location = 3) out vec3 sampleNearRight; +layout(location = 4) out vec3 sampleFarRight; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + float fontScale; + vec4 vecDelta; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + sampleCoord = tCoord * ubuf.textureScale; + gl_Position = ubuf.matrix * vCoord; + + // Calculate neighbor pixel position in item space. + vec3 wDelta = gl_Position.w * ubuf.vecDelta.xyw; + vec3 farLeft = vCoord.xyw - 0.667 * wDelta; + vec3 nearLeft = vCoord.xyw - 0.333 * wDelta; + vec3 nearRight = vCoord.xyw + 0.333 * wDelta; + vec3 farRight = vCoord.xyw + 0.667 * wDelta; + + // Calculate neighbor texture coordinate. + vec2 scale = ubuf.textureScale / ubuf.fontScale; + vec2 base = sampleCoord - scale * vCoord.xy; + sampleFarLeft = vec3(base * farLeft.z + scale * farLeft.xy, farLeft.z); + sampleNearLeft = vec3(base * nearLeft.z + scale * nearLeft.xy, nearLeft.z); + sampleNearRight = vec3(base * nearRight.z + scale * nearRight.xy, nearRight.z); + sampleFarRight = vec3(base * farRight.z + scale * farRight.xy, farRight.z); +} diff --git a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert.qsb b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert.qsb Binary files differnew file mode 100644 index 0000000000..6bf01658a1 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag new file mode 100644 index 0000000000..a9d56f6380 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag @@ -0,0 +1,40 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 1) in vec3 sampleFarLeft; +layout(location = 2) in vec3 sampleNearLeft; +layout(location = 3) in vec3 sampleNearRight; +layout(location = 4) in vec3 sampleFarRight; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + float fontScale; + vec4 vecDelta; +} ubuf; + +void main() +{ + vec4 n; + n.x = textureProj(_qt_texture, sampleFarLeft).a; + n.y = textureProj(_qt_texture, sampleNearLeft).a; + float c = texture(_qt_texture, sampleCoord).a; + n.z = textureProj(_qt_texture, sampleNearRight).a; + n.w = textureProj(_qt_texture, sampleFarRight).a; + + vec2 d = min(abs(n.yw - n.xz) * 2., 0.67); + vec2 lo = mix(vec2(ubuf.alphaMin), vec2(0.5), d); + vec2 hi = mix(vec2(ubuf.alphaMax), vec2(0.5), d); + n = smoothstep(lo.xxyy, hi.xxyy, n); + c = smoothstep(lo.x + lo.y, hi.x + hi.y, 2. * c); + + fragColor = vec4(0.333 * (n.xyz + n.yzw + c), c) * ubuf.color.w; +} diff --git a/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag.qsb Binary files differnew file mode 100644 index 0000000000..4a9ac900a6 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/hiqsubpixeldistancefieldtext_a.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag new file mode 100644 index 0000000000..08b2ce5187 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag @@ -0,0 +1,29 @@ +#version 440 + +layout(location = 0) in vec3 sampleNearLeft; +layout(location = 1) in vec3 sampleNearRight; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + float fontScale; + vec4 vecDelta; +} ubuf; + +void main() +{ + vec2 n; + n.x = textureProj(_qt_texture, sampleNearLeft).r; + n.y = textureProj(_qt_texture, sampleNearRight).r; + n = smoothstep(ubuf.alphaMin, ubuf.alphaMax, n); + float c = 0.5 * (n.x + n.y); + fragColor = vec4(n.x, c, n.y, c) * ubuf.color.w; +} diff --git a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag.qsb b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag.qsb Binary files differnew file mode 100644 index 0000000000..76c2459edf --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert new file mode 100644 index 0000000000..187c384959 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert @@ -0,0 +1,37 @@ +#version 440 + +layout(location = 0) in vec4 vCoord; +layout(location = 1) in vec2 tCoord; + +layout(location = 0) out vec3 sampleNearLeft; +layout(location = 1) out vec3 sampleNearRight; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + float fontScale; + vec4 vecDelta; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + vec2 sampleCoord = tCoord * ubuf.textureScale; + gl_Position = ubuf.matrix * vCoord; + + // Calculate neighbor pixel position in item space. + vec3 wDelta = gl_Position.w * ubuf.vecDelta.xyw; + vec3 nearLeft = vCoord.xyw - 0.25 * wDelta; + vec3 nearRight = vCoord.xyw + 0.25 * wDelta; + + // Calculate neighbor texture coordinate. + vec2 scale = ubuf.textureScale / ubuf.fontScale; + vec2 base = sampleCoord - scale * vCoord.xy; + sampleNearLeft = vec3(base * nearLeft.z + scale * nearLeft.xy, nearLeft.z); + sampleNearRight = vec3(base * nearRight.z + scale * nearRight.xy, nearRight.z); +} diff --git a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert.qsb b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert.qsb Binary files differnew file mode 100644 index 0000000000..7bfa7ccd4a --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag new file mode 100644 index 0000000000..ef9407491b --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag @@ -0,0 +1,29 @@ +#version 440 + +layout(location = 0) in vec3 sampleNearLeft; +layout(location = 1) in vec3 sampleNearRight; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 textureScale; + vec4 color; + float alphaMin; + float alphaMax; + // up to this point it must match distancefieldtext + float fontScale; + vec4 vecDelta; +} ubuf; + +void main() +{ + vec2 n; + n.x = textureProj(_qt_texture, sampleNearLeft).a; + n.y = textureProj(_qt_texture, sampleNearRight).a; + n = smoothstep(ubuf.alphaMin, ubuf.alphaMax, n); + float c = 0.5 * (n.x + n.y); + fragColor = vec4(n.x, c, n.y, c) * ubuf.color.w; +} diff --git a/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag.qsb Binary files differnew file mode 100644 index 0000000000..8f8304fb49 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/loqsubpixeldistancefieldtext_a.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/opaquetexture.frag b/src/quick/scenegraph/shaders_ng/opaquetexture.frag new file mode 100644 index 0000000000..2cd2175f87 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/opaquetexture.frag @@ -0,0 +1,11 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D qt_Texture; + +void main() +{ + fragColor = texture(qt_Texture, qt_TexCoord); +} diff --git a/src/quick/scenegraph/shaders_ng/opaquetexture.frag.qsb b/src/quick/scenegraph/shaders_ng/opaquetexture.frag.qsb Binary files differnew file mode 100644 index 0000000000..0b4554568b --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/opaquetexture.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/opaquetexture.vert b/src/quick/scenegraph/shaders_ng/opaquetexture.vert new file mode 100644 index 0000000000..5b52a59004 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/opaquetexture.vert @@ -0,0 +1,18 @@ +#version 440 + +layout(location = 0) in vec4 qt_VertexPosition; +layout(location = 1) in vec2 qt_VertexTexCoord; + +layout(location = 0) out vec2 qt_TexCoord; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + qt_TexCoord = qt_VertexTexCoord; + gl_Position = ubuf.qt_Matrix * qt_VertexPosition; +} diff --git a/src/quick/scenegraph/shaders_ng/opaquetexture.vert.qsb b/src/quick/scenegraph/shaders_ng/opaquetexture.vert.qsb Binary files differnew file mode 100644 index 0000000000..2872af0200 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/opaquetexture.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.frag b/src/quick/scenegraph/shaders_ng/outlinedtext.frag new file mode 100644 index 0000000000..0023ed5467 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/outlinedtext.frag @@ -0,0 +1,33 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 1) in vec2 sCoordUp; +layout(location = 2) in vec2 sCoordDown; +layout(location = 3) in vec2 sCoordLeft; +layout(location = 4) in vec2 sCoordRight; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + // must match styledtext + mat4 matrix; + vec4 color; + vec2 textureScale; + float dpr; + vec4 styleColor; + vec2 shift; +} ubuf; + +void main() +{ + float glyph = texture(_qt_texture, sampleCoord).r; + float outline = clamp(clamp(texture(_qt_texture, sCoordUp).r + + texture(_qt_texture, sCoordDown).r + + texture(_qt_texture, sCoordLeft).r + + texture(_qt_texture, sCoordRight).r, + 0.0, 1.0) - glyph, + 0.0, 1.0); + fragColor = outline * ubuf.styleColor + glyph * ubuf.color; +} diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb Binary files differnew file mode 100644 index 0000000000..5ab92fecca --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/outlinedtext.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.vert b/src/quick/scenegraph/shaders_ng/outlinedtext.vert new file mode 100644 index 0000000000..c683a4273c --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/outlinedtext.vert @@ -0,0 +1,32 @@ +#version 440 + +layout(location = 0) in vec4 vCoord; +layout(location = 1) in vec2 tCoord; + +layout(location = 0) out vec2 sampleCoord; +layout(location = 1) out vec2 sCoordUp; +layout(location = 2) out vec2 sCoordDown; +layout(location = 3) out vec2 sCoordLeft; +layout(location = 4) out vec2 sCoordRight; + +layout(std140, binding = 0) uniform buf { + // must match styledtext + mat4 matrix; + vec4 color; + vec2 textureScale; + float dpr; + vec4 styleColor; + vec2 shift; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + sampleCoord = tCoord * ubuf.textureScale; + sCoordUp = (tCoord - vec2(0.0, -1.0)) * ubuf.textureScale; + sCoordDown = (tCoord - vec2(0.0, 1.0)) * ubuf.textureScale; + sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * ubuf.textureScale; + sCoordRight = (tCoord - vec2(1.0, 0.0)) * ubuf.textureScale; + gl_Position = ubuf.matrix * vCoord; +} diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb Binary files differnew file mode 100644 index 0000000000..6aee048faa --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/outlinedtext.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag new file mode 100644 index 0000000000..9a3d8cf5ed --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag @@ -0,0 +1,33 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 1) in vec2 sCoordUp; +layout(location = 2) in vec2 sCoordDown; +layout(location = 3) in vec2 sCoordLeft; +layout(location = 4) in vec2 sCoordRight; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + // must match styledtext + mat4 matrix; + vec4 color; + vec2 textureScale; + float dpr; + vec4 styleColor; + vec2 shift; +} ubuf; + +void main() +{ + float glyph = texture(_qt_texture, sampleCoord).a; // take .a instead of .r + float outline = clamp(clamp(texture(_qt_texture, sCoordUp).a + + texture(_qt_texture, sCoordDown).a + + texture(_qt_texture, sCoordLeft).a + + texture(_qt_texture, sCoordRight).a, + 0.0, 1.0) - glyph, + 0.0, 1.0); + fragColor = outline * ubuf.styleColor + glyph * ubuf.color; +} diff --git a/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb Binary files differnew file mode 100644 index 0000000000..6e6b1ab6c2 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/outlinedtext_a.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/shadereffect.frag b/src/quick/scenegraph/shaders_ng/shadereffect.frag new file mode 100644 index 0000000000..bde493f6ce --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/shadereffect.frag @@ -0,0 +1,16 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord0; +layout(location = 0) out vec4 fragColor; + +layout(std140, binding = 0) uniform qt_buf { + mat4 qt_Matrix; + float qt_Opacity; +} qt_ubuf; + +layout(binding = 1) uniform sampler2D source; + +void main() +{ + fragColor = texture(source, qt_TexCoord0) * qt_ubuf.qt_Opacity; +} diff --git a/src/quick/scenegraph/shaders_ng/shadereffect.frag.qsb b/src/quick/scenegraph/shaders_ng/shadereffect.frag.qsb Binary files differnew file mode 100644 index 0000000000..4b08ee2ce4 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/shadereffect.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/shadereffect.vert b/src/quick/scenegraph/shaders_ng/shadereffect.vert new file mode 100644 index 0000000000..ae65059f19 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/shadereffect.vert @@ -0,0 +1,19 @@ +#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 qt_buf { + mat4 qt_Matrix; + float qt_Opacity; +} qt_ubuf; // must use a name that does not clash with custom code when no uniform blocks + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + qt_TexCoord0 = qt_MultiTexCoord0; + gl_Position = qt_ubuf.qt_Matrix * qt_Vertex; +} diff --git a/src/quick/scenegraph/shaders_ng/shadereffect.vert.qsb b/src/quick/scenegraph/shaders_ng/shadereffect.vert.qsb Binary files differnew file mode 100644 index 0000000000..4a8c646a21 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/shadereffect.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/smoothcolor.frag b/src/quick/scenegraph/shaders_ng/smoothcolor.frag new file mode 100644 index 0000000000..ede283be0c --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/smoothcolor.frag @@ -0,0 +1,9 @@ +#version 440 + +layout(location = 0) in vec4 color; +layout(location = 0) out vec4 fragColor; + +void main() +{ + fragColor = color; +} diff --git a/src/quick/scenegraph/shaders_ng/smoothcolor.frag.qsb b/src/quick/scenegraph/shaders_ng/smoothcolor.frag.qsb Binary files differnew file mode 100644 index 0000000000..f99cdf1176 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/smoothcolor.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/smoothcolor.vert b/src/quick/scenegraph/shaders_ng/smoothcolor.vert new file mode 100644 index 0000000000..03a3ff8975 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/smoothcolor.vert @@ -0,0 +1,51 @@ +#version 440 + +layout(location = 0) in vec4 vertex; +layout(location = 1) in vec4 vertexColor; +layout(location = 2) in vec4 vertexOffset; + +layout(location = 0) out vec4 color; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec2 pixelSize; + float opacity; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + vec4 pos = ubuf.matrix * vertex; + gl_Position = pos; + + if (vertexOffset.x != 0.) { + vec4 delta = ubuf.matrix[0] * vertexOffset.x; + vec2 dir = delta.xy * pos.w - pos.xy * delta.w; + vec2 ndir = .5 * ubuf.pixelSize * normalize(dir / ubuf.pixelSize); + dir -= ndir * delta.w * pos.w; + float numerator = dot(dir, ndir * pos.w * pos.w); + float scale = 0.0; + if (numerator < 0.0) + scale = 1.0; + else + scale = min(1.0, numerator / dot(dir, dir)); + gl_Position += scale * delta; + } + + if (vertexOffset.y != 0.) { + vec4 delta = ubuf.matrix[1] * vertexOffset.y; + vec2 dir = delta.xy * pos.w - pos.xy * delta.w; + vec2 ndir = .5 * ubuf.pixelSize * normalize(dir / ubuf.pixelSize); + dir -= ndir * delta.w * pos.w; + float numerator = dot(dir, ndir * pos.w * pos.w); + float scale = 0.0; + if (numerator < 0.0) + scale = 1.0; + else + scale = min(1.0, numerator / dot(dir, dir)); + gl_Position += scale * delta; + } + + color = vertexColor * ubuf.opacity; +} diff --git a/src/quick/scenegraph/shaders_ng/smoothcolor.vert.qsb b/src/quick/scenegraph/shaders_ng/smoothcolor.vert.qsb Binary files differnew file mode 100644 index 0000000000..59c4104a2c --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/smoothcolor.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/smoothtexture.frag b/src/quick/scenegraph/shaders_ng/smoothtexture.frag new file mode 100644 index 0000000000..b06764ad95 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/smoothtexture.frag @@ -0,0 +1,13 @@ +#version 440 + +layout(location = 0) in vec2 texCoord; +layout(location = 1) in float vertexOpacity; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D qt_Texture; + +void main() +{ + fragColor = texture(qt_Texture, texCoord) * vertexOpacity; +} diff --git a/src/quick/scenegraph/shaders_ng/smoothtexture.frag.qsb b/src/quick/scenegraph/shaders_ng/smoothtexture.frag.qsb Binary files differnew file mode 100644 index 0000000000..ffaecbb56c --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/smoothtexture.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/smoothtexture.vert b/src/quick/scenegraph/shaders_ng/smoothtexture.vert new file mode 100644 index 0000000000..965c837852 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/smoothtexture.vert @@ -0,0 +1,61 @@ +#version 440 + +layout(location = 0) in vec4 vertex; +layout(location = 1) in vec2 multiTexCoord; +layout(location = 2) in vec2 vertexOffset; +layout(location = 3) in vec2 texCoordOffset; + +layout(location = 0) out vec2 texCoord; +layout(location = 1) out float vertexOpacity; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float opacity; + vec2 pixelSize; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + vec4 pos = ubuf.qt_Matrix * vertex; + gl_Position = pos; + texCoord = multiTexCoord; + + if (vertexOffset.x != 0.) { + vec4 delta = ubuf.qt_Matrix[0] * vertexOffset.x; + vec2 dir = delta.xy * pos.w - pos.xy * delta.w; + vec2 ndir = .5 * ubuf.pixelSize * normalize(dir / ubuf.pixelSize); + dir -= ndir * delta.w * pos.w; + float numerator = dot(dir, ndir * pos.w * pos.w); + float scale = 0.0; + if (numerator < 0.0) + scale = 1.0; + else + scale = min(1.0, numerator / dot(dir, dir)); + gl_Position += scale * delta; + texCoord.x += scale * texCoordOffset.x; + } + + if (vertexOffset.y != 0.) { + vec4 delta = ubuf.qt_Matrix[1] * vertexOffset.y; + vec2 dir = delta.xy * pos.w - pos.xy * delta.w; + vec2 ndir = .5 * ubuf.pixelSize * normalize(dir / ubuf.pixelSize); + dir -= ndir * delta.w * pos.w; + float numerator = dot(dir, ndir * pos.w * pos.w); + float scale = 0.0; + if (numerator < 0.0) + scale = 1.0; + else + scale = min(1.0, numerator / dot(dir, dir)); + gl_Position += scale * delta; + texCoord.y += scale * texCoordOffset.y; + } + + bool onEdge = any(notEqual(vertexOffset, vec2(0.))); + bool outerEdge = all(equal(texCoordOffset, vec2(0.))); + if (onEdge && outerEdge) + vertexOpacity = 0.; + else + vertexOpacity = ubuf.opacity; +} diff --git a/src/quick/scenegraph/shaders_ng/smoothtexture.vert.qsb b/src/quick/scenegraph/shaders_ng/smoothtexture.vert.qsb Binary files differnew file mode 100644 index 0000000000..b7715d4dd5 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/smoothtexture.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/sprite.frag b/src/quick/scenegraph/shaders_ng/sprite.frag new file mode 100644 index 0000000000..338f5e957e --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/sprite.frag @@ -0,0 +1,22 @@ +#version 440 + +layout(location = 0) in vec4 fTexS; +layout(location = 1) in float progress; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D tex; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 animPos; + vec3 animData; + float opacity; +} ubuf; + +void main() +{ + fragColor = mix(texture(tex, fTexS.xy), + texture(tex, fTexS.zw), + progress) * ubuf.opacity; +} diff --git a/src/quick/scenegraph/shaders_ng/sprite.frag.qsb b/src/quick/scenegraph/shaders_ng/sprite.frag.qsb Binary files differnew file mode 100644 index 0000000000..45d5bc14ee --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/sprite.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/sprite.vert b/src/quick/scenegraph/shaders_ng/sprite.vert new file mode 100644 index 0000000000..b76e2b206f --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/sprite.vert @@ -0,0 +1,29 @@ +#version 440 + +layout(location = 0) in vec2 vPos; +layout(location = 1) in vec2 vTex; + +layout(location = 0) out vec4 fTexS; +layout(location = 1) out float progress; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 animPos; // x,y, x,y (two frames for interpolation) + vec3 animData; // w,h(premultiplied of anim), interpolation progress + float opacity; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + progress = ubuf.animData.z; + + // Calculate frame location in texture + fTexS.xy = ubuf.animPos.xy + vTex.xy * ubuf.animData.xy; + + // Next frame is also passed, for interpolation + fTexS.zw = ubuf.animPos.zw + vTex.xy * ubuf.animData.xy; + + gl_Position = ubuf.matrix * vec4(vPos.x, vPos.y, 0, 1); +} diff --git a/src/quick/scenegraph/shaders_ng/sprite.vert.qsb b/src/quick/scenegraph/shaders_ng/sprite.vert.qsb Binary files differnew file mode 100644 index 0000000000..b55f881734 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/sprite.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/stencilclip.frag b/src/quick/scenegraph/shaders_ng/stencilclip.frag new file mode 100644 index 0000000000..3f6222389d --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/stencilclip.frag @@ -0,0 +1,8 @@ +#version 440 + +layout(location = 0) out vec4 fragColor; + +void main() +{ + fragColor = vec4(0.81, 0.83, 0.12, 1.0); // Trolltech green ftw! +} diff --git a/src/quick/scenegraph/shaders_ng/stencilclip.frag.qsb b/src/quick/scenegraph/shaders_ng/stencilclip.frag.qsb Binary files differnew file mode 100644 index 0000000000..6ae7a51f7a --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/stencilclip.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/stencilclip.vert b/src/quick/scenegraph/shaders_ng/stencilclip.vert new file mode 100644 index 0000000000..d8b491f775 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/stencilclip.vert @@ -0,0 +1,14 @@ +#version 440 + +layout(location = 0) in vec4 vCoord; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + gl_Position = ubuf.matrix * vCoord; +} diff --git a/src/quick/scenegraph/shaders_ng/stencilclip.vert.qsb b/src/quick/scenegraph/shaders_ng/stencilclip.vert.qsb Binary files differnew file mode 100644 index 0000000000..ce2ed3c5b3 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/stencilclip.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/styledtext.frag b/src/quick/scenegraph/shaders_ng/styledtext.frag new file mode 100644 index 0000000000..0b16396037 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/styledtext.frag @@ -0,0 +1,26 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 1) in vec2 shiftedSampleCoord; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; + vec2 textureScale; + float dpr; + // the above must stay compatible with textmask/8bittextmask + vec4 styleColor; + vec2 shift; +} ubuf; + +void main() +{ + float glyph = texture(_qt_texture, sampleCoord).r; + float style = clamp(texture(_qt_texture, shiftedSampleCoord).r - glyph, + 0.0, 1.0); + fragColor = style * ubuf.styleColor + glyph * ubuf.color; +} diff --git a/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb b/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb Binary files differnew file mode 100644 index 0000000000..66ebc5f827 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/styledtext.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/styledtext.vert b/src/quick/scenegraph/shaders_ng/styledtext.vert new file mode 100644 index 0000000000..10565107c6 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/styledtext.vert @@ -0,0 +1,26 @@ +#version 440 + +layout(location = 0) in vec4 vCoord; +layout(location = 1) in vec2 tCoord; + +layout(location = 0) out vec2 sampleCoord; +layout(location = 1) out vec2 shiftedSampleCoord; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; + vec2 textureScale; + float dpr; + // the above must stay compatible with textmask/8bittextmask + vec4 styleColor; + vec2 shift; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + sampleCoord = tCoord * ubuf.textureScale; + shiftedSampleCoord = (tCoord - ubuf.shift) * ubuf.textureScale; + gl_Position = ubuf.matrix * floor((vCoord * ubuf.dpr) + 0.5) / ubuf.dpr; +} diff --git a/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb b/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb Binary files differnew file mode 100644 index 0000000000..9a27ed0eb8 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/styledtext.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/styledtext_a.frag b/src/quick/scenegraph/shaders_ng/styledtext_a.frag new file mode 100644 index 0000000000..b673137895 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/styledtext_a.frag @@ -0,0 +1,26 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 1) in vec2 shiftedSampleCoord; + +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; + vec2 textureScale; + float dpr; + // the above must stay compatible with textmask/8bittextmask + vec4 styleColor; + vec2 shift; +} ubuf; + +void main() +{ + float glyph = texture(_qt_texture, sampleCoord).a; // take .a instead of .r + float style = clamp(texture(_qt_texture, shiftedSampleCoord).a - glyph, + 0.0, 1.0); + fragColor = style * ubuf.styleColor + glyph * ubuf.color; +} diff --git a/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb b/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb Binary files differnew file mode 100644 index 0000000000..9dd4137072 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/styledtext_a.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/textmask.frag b/src/quick/scenegraph/shaders_ng/textmask.frag new file mode 100644 index 0000000000..518d5c965f --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/textmask.frag @@ -0,0 +1,19 @@ +#version 440 + +layout(location = 0) in vec2 sampleCoord; +layout(location = 0) out vec4 fragColor; + +layout(binding = 1) uniform sampler2D _qt_texture; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; + vec2 textureScale; + float dpr; +} ubuf; + +void main() +{ + vec4 glyph = texture(_qt_texture, sampleCoord); + fragColor = vec4(glyph.rgb * ubuf.color.a, glyph.a); +} diff --git a/src/quick/scenegraph/shaders_ng/textmask.frag.qsb b/src/quick/scenegraph/shaders_ng/textmask.frag.qsb Binary files differnew file mode 100644 index 0000000000..b16da4d76a --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/textmask.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/textmask.vert b/src/quick/scenegraph/shaders_ng/textmask.vert new file mode 100644 index 0000000000..d7d3bf892e --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/textmask.vert @@ -0,0 +1,21 @@ +#version 440 + +layout(location = 0) in vec4 vCoord; +layout(location = 1) in vec2 tCoord; + +layout(location = 0) out vec2 sampleCoord; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + vec4 color; + vec2 textureScale; + float dpr; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + sampleCoord = tCoord * ubuf.textureScale; + gl_Position = ubuf.matrix * floor((vCoord * ubuf.dpr) + 0.5) / ubuf.dpr; +} diff --git a/src/quick/scenegraph/shaders_ng/textmask.vert.qsb b/src/quick/scenegraph/shaders_ng/textmask.vert.qsb Binary files differnew file mode 100644 index 0000000000..ae196ed0ad --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/textmask.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/texture.frag b/src/quick/scenegraph/shaders_ng/texture.frag new file mode 100644 index 0000000000..bd22f817e0 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/texture.frag @@ -0,0 +1,16 @@ +#version 440 + +layout(location = 0) in vec2 qt_TexCoord; +layout(location = 0) out vec4 fragColor; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float opacity; +} ubuf; + +layout(binding = 1) uniform sampler2D qt_Texture; + +void main() +{ + fragColor = texture(qt_Texture, qt_TexCoord) * ubuf.opacity; +} diff --git a/src/quick/scenegraph/shaders_ng/texture.frag.qsb b/src/quick/scenegraph/shaders_ng/texture.frag.qsb Binary files differnew file mode 100644 index 0000000000..3f4aa3713c --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/texture.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/texture.vert b/src/quick/scenegraph/shaders_ng/texture.vert new file mode 100644 index 0000000000..537852d2bd --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/texture.vert @@ -0,0 +1,19 @@ +#version 440 + +layout(location = 0) in vec4 qt_VertexPosition; +layout(location = 1) in vec2 qt_VertexTexCoord; + +layout(location = 0) out vec2 qt_TexCoord; + +layout(std140, binding = 0) uniform buf { + mat4 qt_Matrix; + float opacity; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + qt_TexCoord = qt_VertexTexCoord; + gl_Position = ubuf.qt_Matrix * qt_VertexPosition; +} diff --git a/src/quick/scenegraph/shaders_ng/texture.vert.qsb b/src/quick/scenegraph/shaders_ng/texture.vert.qsb Binary files differnew file mode 100644 index 0000000000..bf0bc7d9fa --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/texture.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/vertexcolor.frag b/src/quick/scenegraph/shaders_ng/vertexcolor.frag new file mode 100644 index 0000000000..ede283be0c --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/vertexcolor.frag @@ -0,0 +1,9 @@ +#version 440 + +layout(location = 0) in vec4 color; +layout(location = 0) out vec4 fragColor; + +void main() +{ + fragColor = color; +} diff --git a/src/quick/scenegraph/shaders_ng/vertexcolor.frag.qsb b/src/quick/scenegraph/shaders_ng/vertexcolor.frag.qsb Binary files differnew file mode 100644 index 0000000000..93965a55dd --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/vertexcolor.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/vertexcolor.vert b/src/quick/scenegraph/shaders_ng/vertexcolor.vert new file mode 100644 index 0000000000..bfb9a95073 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/vertexcolor.vert @@ -0,0 +1,19 @@ +#version 440 + +layout(location = 0) in vec4 vertexCoord; +layout(location = 1) in vec4 vertexColor; + +layout(location = 0) out vec4 color; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + float opacity; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() +{ + gl_Position = ubuf.matrix * vertexCoord; + color = vertexColor * ubuf.opacity; +} diff --git a/src/quick/scenegraph/shaders_ng/vertexcolor.vert.qsb b/src/quick/scenegraph/shaders_ng/vertexcolor.vert.qsb Binary files differnew file mode 100644 index 0000000000..98abe4ef6f --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/vertexcolor.vert.qsb diff --git a/src/quick/scenegraph/shaders_ng/visualization.frag b/src/quick/scenegraph/shaders_ng/visualization.frag new file mode 100644 index 0000000000..29f718fe5d --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/visualization.frag @@ -0,0 +1,19 @@ +#version 440 + +layout(location = 0) in vec2 pos; +layout(location = 0) out vec4 fragColor; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + mat4 rotation; + vec4 color; + float pattern; + int projection; +} ubuf; + +void main(void) +{ + vec4 c = ubuf.color; + c.xyz += pow(max(sin(pos.x + pos.y), 0.0), 2.0) * ubuf.pattern * 0.25; + fragColor = c; +} diff --git a/src/quick/scenegraph/shaders_ng/visualization.frag.qsb b/src/quick/scenegraph/shaders_ng/visualization.frag.qsb Binary files differnew file mode 100644 index 0000000000..eadad927dc --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/visualization.frag.qsb diff --git a/src/quick/scenegraph/shaders_ng/visualization.vert b/src/quick/scenegraph/shaders_ng/visualization.vert new file mode 100644 index 0000000000..e2447948c2 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/visualization.vert @@ -0,0 +1,30 @@ +#version 440 + +layout(location = 0) in vec4 v; +layout(location = 0) out vec2 pos; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + mat4 rotation; + vec4 color; + float pattern; + int projection; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; float gl_PointSize; }; + +void main() +{ + vec4 p = ubuf.matrix * v; + + if (ubuf.projection != 0) { + vec4 proj = ubuf.rotation * p; + gl_Position = vec4(proj.x, proj.y, 0, proj.z); + } else { + gl_Position = p; + } + + pos = v.xy * 1.37; + + gl_PointSize = 1.0; +} diff --git a/src/quick/scenegraph/shaders_ng/visualization.vert.qsb b/src/quick/scenegraph/shaders_ng/visualization.vert.qsb Binary files differnew file mode 100644 index 0000000000..7ba27cb4b5 --- /dev/null +++ b/src/quick/scenegraph/shaders_ng/visualization.vert.qsb |