diff options
author | Alexander Larsson <alexl@redhat.com> | 2020-09-18 18:03:30 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2020-09-29 09:51:16 +0200 |
commit | 4d697283aeaaff0973120dc71aa8f3ae9337898c (patch) | |
tree | a1dc9827f545d8cc862cc3d9e86483213efa5497 /gsk/resources | |
parent | 950cc41e15cc8b92c75f49e5e31fbff5e6d6efa2 (diff) | |
download | gtk+-4d697283aeaaff0973120dc71aa8f3ae9337898c.tar.gz |
Support GLShaderNode in backends
For vulkan/broadway this just means to ignore it, but for the gl
backend we support (with up to 4 texture inputs, which is similar to
what shadertoy does, so should be widely supported).
Diffstat (limited to 'gsk/resources')
-rw-r--r-- | gsk/resources/glsl/custom.glsl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gsk/resources/glsl/custom.glsl b/gsk/resources/glsl/custom.glsl new file mode 100644 index 0000000000..d2aed97fc8 --- /dev/null +++ b/gsk/resources/glsl/custom.glsl @@ -0,0 +1,21 @@ +// VERTEX_SHADER: +void main() { + gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0); + vUv = vec2(aUv.x, aUv.y); +} + +// FRAGMENT_SHADER: +// The shader supplies: +void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv); + +uniform vec2 u_size; +uniform sampler2D u_source2; +uniform sampler2D u_source3; +uniform sampler2D u_source4; + +void main() { + vec4 fragColor; + vec2 fragCoord = vec2(vUv.x * u_size.x, (1.0-vUv.y) * u_size.y); + mainImage(fragColor, fragCoord, u_size, vUv); + gskSetOutputColor(fragColor); +} |