#version 450
#extension GL_EXT_nonuniform_qualifier : enable

layout(set = 0, binding = 1) uniform sampler2D texSampler[];

layout(location = 0) in vec3 fragColor;
layout(location = 1) in vec2 fragTexCoord;
layout(location = 2) in flat uint instanceTextureId;

layout(location = 0) out vec4 outColor;

void main() {
    vec4 texturePixels = texture(texSampler[instanceTextureId], fragTexCoord);
    outColor = vec4(fragColor * texturePixels.rgb, texturePixels.a);
}
