aboutsummaryrefslogtreecommitdiff
path: root/src/draw/default.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/draw/default.glsl')
-rw-r--r--src/draw/default.glsl38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/draw/default.glsl b/src/draw/default.glsl
new file mode 100644
index 0000000..b45a1c9
--- /dev/null
+++ b/src/draw/default.glsl
@@ -0,0 +1,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