aboutsummaryrefslogtreecommitdiff
path: root/src/draw/default.glsl
blob: 15cb2e2722712a603c1d53ca2177b11d431deb33 (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
@header package draw
@header import sg "shared:sokol/gfx"

@vs vs
in vec2 vposition;
in vec2 vuv;
in vec4 vcolor;

out vec4 fcolor;
out vec2 fuv;

layout (binding = 0) uniform default_vs_params {
  mat4 projection;
};

void main() {
  gl_Position = projection * vec4(vposition, 0.0, 1.0);
  fcolor = vcolor;
  fuv = vuv;
}
@end

@fs fs
in vec4 fcolor;
in vec2 fuv;

out vec4 out_color;

layout (binding = 0) uniform texture2D tex;
layout (binding = 0) uniform sampler tex_samp;
#define tex sampler2D(tex, tex_samp)

void main() {
  out_color = texture(tex, fuv) * fcolor;
}
@end

@program default vs fs