| 1 | // The following defines a vertex shader main function |
| 2 | @vs vs |
| 3 | in vec4 position; |
| 4 | in vec4 color0; |
| 5 | |
| 6 | out vec4 color; |
| 7 | |
| 8 | // You can add more functions here |
| 9 | |
| 10 | void main() { |
| 11 | gl_Position = position; |
| 12 | color = color0; |
| 13 | } |
| 14 | @end |
| 15 | |
| 16 | // The following defines a fragment shader main function |
| 17 | @fs fs |
| 18 | in vec4 color; |
| 19 | out vec4 frag_color; |
| 20 | |
| 21 | // You can add more functions here |
| 22 | |
| 23 | void main() { |
| 24 | frag_color = color; |
| 25 | } |
| 26 | @end |
| 27 | |
| 28 | // The value after `@program` and before `vs fs` decide a part of the name |
| 29 | // of the C function you need to define in V. The value entered is suffixed `_shader_desc` |
| 30 | // in the generated C code. Thus the name for this becomes: `simple_shader_desc`. |
| 31 | // In V it's signature then need to be defined as: |
| 32 | // `fn C.simple_shader_desc(gfx.Backend) &gfx.ShaderDesc`. See `simple_shader.v` for the define. |
| 33 | // |
| 34 | // Running `v shader -v .` in this dir will also show you brief information |
| 35 | // about how to use the compiled shader. |
| 36 | @program simple vs fs |
| 37 | |