From 8c1e26e552556e36a5c1fecd9558d9ab9dd3d454 Mon Sep 17 00:00:00 2001 From: ladevieq Date: Mon, 9 Aug 2021 22:41:03 +0200 Subject: Bindless graphics pipeline --- shaders/ui.frag | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'shaders/ui.frag') diff --git a/shaders/ui.frag b/shaders/ui.frag index 78833d1..c4e0150 100644 --- a/shaders/ui.frag +++ b/shaders/ui.frag @@ -1,3 +1,5 @@ +#extension GL_EXT_nonuniform_qualifier : require + layout(location = 0) out vec4 o_Color; layout(location = 0) in struct { @@ -5,8 +7,14 @@ layout(location = 0) in struct { vec4 color; } In; -layout(set = 0, binding = 2) uniform sampler2D atlas; +layout(set = 0, binding = 0) uniform sampler samplers[]; +layout(set = 0, binding = 1) uniform texture2D textures[]; + +layout(push_constant) uniform constants { + layout(offset = 56) uint texture_index; + uint sampler_index; +} consts; void main() { - o_Color = In.color * texture(atlas, In.uv.xy); + o_Color = In.color * texture(sampler2D(textures[consts.texture_index], samplers[consts.sampler_index]), In.uv.xy); } -- cgit v1.3