From ddff2fa5d0cbae17cb819c91bad0a79105ba0ea7 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Tue, 31 Jan 2023 21:16:16 +0100 Subject: Graphics pipeline rendering --- shaders/api-test-ui.frag | 17 +++++++++-------- shaders/api-test-ui.vert | 21 ++++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) (limited to 'shaders') diff --git a/shaders/api-test-ui.frag b/shaders/api-test-ui.frag index 5c6a61f..0272ba2 100644 --- a/shaders/api-test-ui.frag +++ b/shaders/api-test-ui.frag @@ -7,14 +7,15 @@ layout(location = 0) in struct { vec4 color; } In; -layout(set = 0, binding = 0) uniform sampler samplers[]; -layout(set = 0, binding = 1) uniform texture2D textures[]; -layout(set = 0, binding = 2, rgba32f) uniform image2D images[]; -layout(set = 1, binding = 0) uniform parameters { - uint texture_index; - uint sampler_index; -} params; +// layout(set = 0, binding = 0) uniform sampler samplers[]; +// layout(set = 0, binding = 1) uniform texture2D textures[]; +// layout(set = 0, binding = 2, rgba32f) uniform image2D images[]; +// layout(set = 1, binding = 0) uniform parameters { +// uint texture_index; +// uint sampler_index; +// } params; void main() { - o_Color = In.color * texture(sampler2D(textures[params.texture_index], samplers[params.sampler_index]), In.uv.xy); + // o_Color = In.color * texture(sampler2D(textures[params.texture_index], samplers[params.sampler_index]), In.uv.xy); + o_Color = vec4(1, 0, 0, 1); } diff --git a/shaders/api-test-ui.vert b/shaders/api-test-ui.vert index 6a37abc..3b6d0b5 100644 --- a/shaders/api-test-ui.vert +++ b/shaders/api-test-ui.vert @@ -11,11 +11,11 @@ layout(buffer_reference) readonly buffer vertices { vertex vertices[]; }; -layout(set = 1, binding = 0) uniform parameters { - vertices vertex_buffer; - vec2 scale; - vec2 translate; -} params; +// layout(set = 1, binding = 0) uniform parameters { +// vertices vertex_buffer; +// vec2 scale; +// vec2 translate; +// } params; out gl_PerVertex { vec4 gl_Position; @@ -28,10 +28,13 @@ layout(location = 0) out struct { void main() { - vertex v = params.vertex_buffer.vertices[gl_VertexIndex]; + // vertex v = params.vertex_buffer.vertices[gl_VertexIndex]; - Out.color = unpackUnorm4x8(v.color); - Out.uv = v.uv; + // Out.color = unpackUnorm4x8(v.color); + // Out.uv = v.uv; - gl_Position = vec4(v.pos * params.scale + params.translate, 0.0, 1.0); + // gl_Position = vec4(v.pos * params.scale + params.translate, 0.0, 1.0); + + vec2 pos[3] = vec2[3]( vec2(-0.7, 0.7), vec2(0.7, 0.7), vec2(0.0, -0.7) ); + gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0); } -- cgit v1.3