DonkeyKong64 grind crash
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / blitcolour.h
1 #ifndef SHADER_blitcolour_H
2 #define SHADER_blitcolour_H
3 static void shader_blitcolour_link(void);
4 static void shader_blitcolour_register(void);
5 static struct vg_shader _shader_blitcolour = {
6 .name = "blitcolour",
7 .link = shader_blitcolour_link,
8 .vs =
9 {
10 .orig_file = "shaders/blit.vs",
11 .static_src =
12 "layout (location=0) in vec2 a_co;\n"
13 "out vec2 aUv;\n"
14 "\n"
15 "uniform vec2 uInverseRatio;\n"
16 "\n"
17 "void main()\n"
18 "{\n"
19 " gl_Position = vec4(a_co*2.0-1.0,0.0,1.0);\n"
20 " aUv = a_co * uInverseRatio;\n"
21 "}\n"
22 ""},
23 .fs =
24 {
25 .orig_file = "shaders/colour.fs",
26 .static_src =
27 "out vec4 FragColor;\n"
28 "uniform vec4 uColour;\n"
29 "\n"
30 "in vec2 aUv;\n"
31 "\n"
32 "void main()\n"
33 "{\n"
34 " FragColor = uColour;\n"
35 "}\n"
36 ""},
37 };
38
39 static GLuint _uniform_blitcolour_uInverseRatio;
40 static GLuint _uniform_blitcolour_uColour;
41 static void shader_blitcolour_uInverseRatio(v2f v){
42 glUniform2fv(_uniform_blitcolour_uInverseRatio,1,v);
43 }
44 static void shader_blitcolour_uColour(v4f v){
45 glUniform4fv(_uniform_blitcolour_uColour,1,v);
46 }
47 static void shader_blitcolour_register(void){
48 vg_shader_register( &_shader_blitcolour );
49 }
50 static void shader_blitcolour_use(void){ glUseProgram(_shader_blitcolour.id); }
51 static void shader_blitcolour_link(void){
52 _uniform_blitcolour_uInverseRatio = glGetUniformLocation( _shader_blitcolour.id, "uInverseRatio" );
53 _uniform_blitcolour_uColour = glGetUniformLocation( _shader_blitcolour.id, "uColour" );
54 }
55 #endif /* SHADER_blitcolour_H */