diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-03-25 17:18:18 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-04-07 12:25:03 +0000 |
commit | 0ce875a4e302afc5b67ec63d35051d90e486db79 (patch) | |
tree | d92029a2c9addfc96b7bc879adc7d0d8fe78930d /src/multimedia/shaders/yuv.vert | |
parent | 9e90ac3ce400df30217de98f0eb4e08f75e06cdf (diff) |
Move the shaders from the quick tools into QtMultimedia
The shader layout is pretty generic, and QVideoSurfaceFormat
can give us both the shaders and uniform data that we need
to render the video.
All the user needs to do then is to provide geometry with a
2D texture coordinate to render the video onto any surface.
Change-Id: I95006eaf4a6f039006b8a5da0f53143da03e1ecb
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/multimedia/shaders/yuv.vert')
-rw-r--r-- | src/multimedia/shaders/yuv.vert | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/multimedia/shaders/yuv.vert b/src/multimedia/shaders/yuv.vert new file mode 100644 index 000000000..6f103372f --- /dev/null +++ b/src/multimedia/shaders/yuv.vert @@ -0,0 +1,26 @@ +#version 440 + +layout(location = 0) in vec4 qt_VertexPosition; +layout(location = 1) in vec2 qt_VertexTexCoord; + +layout(location = 0) out vec2 plane1TexCoord; +layout(location = 1) out vec2 plane2TexCoord; +layout(location = 2) out vec2 plane3TexCoord; + +layout(std140, binding = 0) uniform buf { + mat4 matrix; + mat4 colorMatrix; + float opacity; + float plane1Width; + float plane2Width; + float plane3Width; +} ubuf; + +out gl_PerVertex { vec4 gl_Position; }; + +void main() { + plane1TexCoord = qt_VertexTexCoord * vec2(ubuf.plane1Width, 1); + plane2TexCoord = qt_VertexTexCoord * vec2(ubuf.plane2Width, 1); + plane3TexCoord = qt_VertexTexCoord * vec2(ubuf.plane3Width, 1); + gl_Position = ubuf.matrix * qt_VertexPosition; +} |