37 lines
824 B
GLSL
37 lines
824 B
GLSL
|
/* enum wlr_gles2_shader_source */
|
||
|
#define SOURCE_TEXTURE_RGBA 1
|
||
|
#define SOURCE_TEXTURE_RGBX 2
|
||
|
#define SOURCE_TEXTURE_EXTERNAL 3
|
||
|
|
||
|
#if !defined(SOURCE)
|
||
|
#error "Missing shader preamble"
|
||
|
#endif
|
||
|
|
||
|
#if SOURCE == SOURCE_TEXTURE_EXTERNAL
|
||
|
#extension GL_OES_EGL_image_external : require
|
||
|
#endif
|
||
|
|
||
|
precision mediump float;
|
||
|
|
||
|
varying vec2 v_texcoord;
|
||
|
|
||
|
#if SOURCE == SOURCE_TEXTURE_EXTERNAL
|
||
|
uniform samplerExternalOES tex;
|
||
|
#elif SOURCE == SOURCE_TEXTURE_RGBA || SOURCE == SOURCE_TEXTURE_RGBX
|
||
|
uniform sampler2D tex;
|
||
|
#endif
|
||
|
|
||
|
uniform float alpha;
|
||
|
|
||
|
vec4 sample_texture() {
|
||
|
#if SOURCE == SOURCE_TEXTURE_RGBA || SOURCE == SOURCE_TEXTURE_EXTERNAL
|
||
|
return texture2D(tex, v_texcoord);
|
||
|
#elif SOURCE == SOURCE_TEXTURE_RGBX
|
||
|
return vec4(texture2D(tex, v_texcoord).rgb, 1.0);
|
||
|
#endif
|
||
|
}
|
||
|
|
||
|
void main() {
|
||
|
gl_FragColor = sample_texture() * alpha;
|
||
|
}
|