LumixEngine/data/pipelines/draw2d.shd
Mikulas Florek 36b114f4c4 cleanup
2019-08-11 20:32:21 +02:00

31 lines
No EOL
698 B
Text

vertex_shader [[
layout(location = 0) in vec2 a_position;
layout(location = 1) in vec2 a_uv;
layout(location = 2) in vec4 a_color;
layout(std140, binding = 4) uniform Bones {
vec2 u_canvas_size;
};
layout(location = 0) out vec4 v_color;
layout(location = 1) out vec2 v_uv;
void main() {
v_color = a_color;
vec2 pos = a_position / u_canvas_size * 2 - 1;
pos.y = - pos.y;
v_uv = a_uv;
gl_Position = vec4(pos, 0, 1);
}
]]
fragment_shader [[
layout (binding=0) uniform sampler2D u_texture;
layout(location = 0) in vec4 v_color;
layout(location = 1) in vec2 v_uv;
layout(location = 0) out vec4 o_color;
void main() {
o_color = v_color * texture(u_texture, v_uv);
}
]]