v/shaders/triangle.vert

29 lines
545 B
GLSL

#version 460
#extension GL_EXT_nonuniform_qualifier : require
struct Vertex {
vec2 pos;
vec2 uv;
vec4 color;
float alpha;
uint textureID;
};
layout(std430, set = 0, binding = 1) readonly buffer VertexBuffer {
Vertex vertices[];
} vBuf;
layout(location = 0) out vec2 uv;
layout(location = 1) out vec4 color;
layout(location = 2) out flat uint tex_id;
void main() {
Vertex v = vBuf.vertices[gl_VertexIndex];
uv = v.uv;
color = v.color;
tex_id = v.textureID;
gl_Position = vec4(v.pos, 0.0, 1.0);
}