Files
ld58/code/vulkan/shaders/basic.vert

37 lines
622 B
GLSL
Raw Normal View History

#version 460 core
#extension GL_EXT_scalar_block_layout : enable
struct Vertex {
vec4 p;
vec2 uv;
uint c;
uint pad;
};
layout(push_constant, row_major)
uniform Global {
mat4 proj;
};
layout(binding = 0, scalar)
readonly buffer Vertices {
Vertex vtx[];
};
layout(location = 0) out vec2 frag_uv;
layout(location = 1) out vec4 frag_c;
layout(location = 2) out flat uint idx;
void main() {
Vertex v = vtx[gl_VertexIndex];
gl_Position = proj * v.p;
frag_uv = v.uv;
frag_c = vec4((v.c >> 24) & 0xFF, (v.c >> 16) & 0xFF, (v.c >> 8) & 0xFF, (v.c >> 0) & 0xFF) / 255.0f;
frag_c = frag_c.abgr;
idx = v.pad;
}