gstreamer/subprojects/gst-plugins-good/ext/qt6/RGBA_gles.frag
Michael Tretter ac393aa657 qml6glsink: add support for texture-target external-oes
In order to use oes-external, the qml6glsink needs a fragment shader that uses
the samplerExternalOES.

The qsb tool is not able to handle shaders that contain samplerExternalOES since
this feature is not supported by all target shading languages. The qsb tool is
able to replace a shader in the qsb file to handle this use case. Use it to
generate a shader variant that uses samplerExternalOES for OpenGL ES and select
that variant if the qml6glsink negotiated texture target oes-external.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7319>
2024-08-09 00:21:42 +00:00

31 lines
609 B
GLSL

#version 100
#extension GL_OES_EGL_image_external : require
precision highp float;
precision highp int;
struct buf
{
mat4 qt_Matrix;
ivec4 swizzle;
mat4 color_matrix;
float qt_Opacity;
};
uniform buf ubuf;
uniform samplerExternalOES tex;
varying vec2 vTexCoord;
vec4 swizzle(vec4 texel, ivec4 swizzle_1)
{
return vec4(texel[swizzle_1.x], texel[swizzle_1.y], texel[swizzle_1.z], texel[swizzle_1.w]);
}
void main()
{
vec4 param = texture2D(tex, vTexCoord);
ivec4 param_1 = ubuf.swizzle;
vec4 texel = swizzle(param, param_1);
gl_FragData[0] = texel * ubuf.qt_Opacity;
}