summaryrefslogtreecommitdiff
path: root/data/shaders/path-fill-vert.glsl
blob: f8bcacef588e648cd865ba4bba65d566e73e8762 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// -*- mode: c -*-

#ifdef GLSL330
layout (location = 0) in vec2 position;
#elif defined(GLSL130)
in vec2 position;
#elif defined(GLSL120)
attribute vec2 position;
#endif

#ifdef GLSL120
varying vec2 fragPosition;
#else
out vec2 fragPosition;
#endif

#ifdef GLSL120
uniform mat4 mvp;
uniform vec4 color;
uniform mat3 gradientMatrix;
#else
layout (std140) uniform Fill
{
  mat4 mvp;
  vec4 color;
  int mode;
  vec4 endColor;
  mat3 gradientMatrix;
  vec2 gradientRange;
  float radialGradientRatio;
};
#endif

void main(void) {
  // Short-circuit because the fragments will just be discarded
  // anyway.
  if (color.a <= 0.0) {
    gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
  } else {
    fragPosition = (gradientMatrix * vec3(position, 1.0)).xy;
    gl_Position = mvp * vec4(position, 0.0, 1.0);
  }
}