From 7e572410bb95a46db3bd3955cc7689ea87973cea Mon Sep 17 00:00:00 2001 From: ladevieq Date: Fri, 5 Mar 2021 23:04:09 +0100 Subject: Working hardcoded imgui backend --- shaders/ui.frag | 4 ++-- shaders/ui.vert | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'shaders') diff --git a/shaders/ui.frag b/shaders/ui.frag index 99534aa..c9f0339 100644 --- a/shaders/ui.frag +++ b/shaders/ui.frag @@ -5,8 +5,8 @@ layout(location = 0) in struct { vec4 color; } In; -// layout(set = 0, binding = 1) uniform sampler2D atlas; +layout(set = 0, binding = 1) uniform sampler2D atlas; void main() { - o_Color = In.color; // * texture(atlas, In.uv.xy); + o_Color = In.color * texture(atlas, In.uv.xy); } diff --git a/shaders/ui.vert b/shaders/ui.vert index 36d3144..2e6862d 100644 --- a/shaders/ui.vert +++ b/shaders/ui.vert @@ -2,7 +2,6 @@ struct Vertex { vec2 pos; vec2 uv; uint color; - uint padding; }; layout(set = 0, binding = 0) uniform Vertices { @@ -18,11 +17,14 @@ layout(location = 0) out struct { vec4 color; } Out; +const vec2 scale = vec2(2.0 / 384.0, 2.0 / 186.0); +const vec2 translate = vec2(-1.0, -1.0); + void main() { Vertex v = vertices[gl_VertexIndex]; Out.color = unpackUnorm4x8(v.color); Out.uv = v.uv; - gl_Position = vec4(v.pos, 0.0, 1.0); + gl_Position = vec4(v.pos * scale + translate, 0.0, 1.0); } -- cgit v1.3