From 2218ad410c01c8e3ea8416dd019d0c3072fbb1cf Mon Sep 17 00:00:00 2001 From: ladevieq Date: Fri, 5 Mar 2021 00:06:25 +0100 Subject: Fix imgui vertices rendering --- shaders/ui.frag | 9 ++++++++- shaders/ui.vert | 20 +++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'shaders') diff --git a/shaders/ui.frag b/shaders/ui.frag index e5a6aa3..99534aa 100644 --- a/shaders/ui.frag +++ b/shaders/ui.frag @@ -1,5 +1,12 @@ layout(location = 0) out vec4 o_Color; +layout(location = 0) in struct { + vec2 uv; + vec4 color; +} In; + +// layout(set = 0, binding = 1) uniform sampler2D atlas; + void main() { - o_Color = vec4(1.0, 0.0, 0.0, 1.0); + o_Color = In.color; // * texture(atlas, In.uv.xy); } diff --git a/shaders/ui.vert b/shaders/ui.vert index 020eabb..cc1091c 100644 --- a/shaders/ui.vert +++ b/shaders/ui.vert @@ -1,13 +1,27 @@ struct Vertex { vec2 pos; vec2 uv; - uint col; + vec4 color; }; layout(set = 0, binding = 0) uniform Vertices { - Vertex[158] vertices; + Vertex vertices[158]; }; +out gl_PerVertex { + vec4 gl_Position; +}; + +layout(location = 0) out struct { + vec2 uv; + vec4 color; +} Out; + void main() { - gl_Position = vec4(vertices[gl_VertexIndex].pos, 0.0, 1.0); + Vertex v = vertices[gl_VertexIndex]; + + Out.color = v.color; + Out.uv = v.uv; + + gl_Position = vec4(v.pos, 0.0, 1.0); } -- cgit v1.3