1#version 450 2#extension GL_ARB_separate_shader_objects : enable 3 4layout(binding = 0) uniform sampler2D texSampler; 5layout(binding = 1) uniform UniformBufferObject { 6 mat4 posTransform; 7 mat4 texcoordTransform; 8 uvec4 mode; 9 vec4 alpha; 10 vec4 color; 11} ubo; 12 13layout(location = 0) in vec2 fragTexCoord; 14 15layout(location = 0) out vec4 outColor; 16 17void main() { 18 if (ubo.mode.x == 2) { 19 outColor = ubo.alpha * texture(texSampler, fragTexCoord); 20 } else if (ubo.mode.x == 3) { 21 outColor = ubo.alpha * ubo.color; 22 } else { 23 outColor = vec4(0.0, 1.0, 0.0, 1.0); 24 } 25} 26