#version 450 #extension GL_EXT_nonuniform_qualifier : require #extension GL_EXT_debug_printf : require //shader input layout (location = 0) in vec4 in_color; layout (location = 1) in vec2 in_screen_uv; layout (location = 2) in flat uint texture_index; //output write layout (location = 0) out vec4 out_frag_color; layout(set = 0, binding = 0) uniform sampler2D textures[]; void main() { vec2 texture_size = textureSize(textures[texture_index], 0); //debugPrintfEXT("texture uv: (%f, %f)\n", in_screen_uv.x, in_screen_uv.y); vec2 uv = vec2(in_screen_uv.x / texture_size.x, in_screen_uv.y / texture_size.y); vec4 sampled = texture(textures[texture_index], uv); out_frag_color = in_color * sampled; }