summaryrefslogtreecommitdiffstats
path: root/src/qtmultimediaquicktools/shaders/yuv_yv.frag
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2020-06-04 16:31:22 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2020-06-04 18:40:03 +0200
commitcf815557eef1d1d34e20d13df24baae5e2f138ac (patch)
tree6a96e21bef8ba08c08dac0be36dbc065bbaef4f7 /src/qtmultimediaquicktools/shaders/yuv_yv.frag
parent0e3b08d2b8cec6b6489cb99de3f58d1ccdb439d8 (diff)
RHI: Remove gl code from video nodes
Now QSGMaterialShader handles rhi textures too. Task-number: QTBUG-78678 Change-Id: I410185c80bd104741fd5b52deeb87eb97531410a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/qtmultimediaquicktools/shaders/yuv_yv.frag')
-rw-r--r--src/qtmultimediaquicktools/shaders/yuv_yv.frag28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/qtmultimediaquicktools/shaders/yuv_yv.frag b/src/qtmultimediaquicktools/shaders/yuv_yv.frag
new file mode 100644
index 000000000..07ea52aab
--- /dev/null
+++ b/src/qtmultimediaquicktools/shaders/yuv_yv.frag
@@ -0,0 +1,28 @@
+#version 440
+
+layout(location = 0) in vec2 plane1TexCoord;
+layout(location = 1) in vec2 plane2TexCoord;
+layout(location = 2) in vec2 plane3TexCoord;
+layout(location = 0) out vec4 fragColor;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 matrix;
+ mat4 colorMatrix;
+ float opacity;
+ float plane1Width;
+ float plane2Width;
+ float plane3Width;
+} ubuf;
+
+layout(binding = 1) uniform sampler2D plane1Texture;
+layout(binding = 2) uniform sampler2D plane2Texture;
+layout(binding = 3) uniform sampler2D plane3Texture;
+
+void main()
+{
+ float Y = texture(plane1Texture, plane1TexCoord).r;
+ float U = texture(plane2Texture, plane2TexCoord).r;
+ float V = texture(plane3Texture, plane3TexCoord).r;
+ vec4 color = vec4(Y, U, V, 1.);
+ fragColor = ubuf.colorMatrix * color * ubuf.opacity;
+}