summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2017-09-15 13:45:45 -0400
committerLeo Liu <[email protected]>2017-09-25 09:42:13 -0400
commit4ef0828946c7d61130a4f71a9bc4685d7f29a1be (patch)
treecfd2e52da1633452d5199fd97aa32b7f3ae1b9b2
parenteb518387710e027a6f38f0e096f014b9db1db8a7 (diff)
vl/compositor: separate YUV part from shader video buffer function
So that it can be re-used Acked-by: Christian König <[email protected]>
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index 794c8b5b17c..714b894b29f 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -239,20 +239,13 @@ create_frag_shader_csc(struct ureg_program *shader, struct ureg_dst texel,
ureg_release_temporary(shader, temp[i]);
}
-static void *
-create_frag_shader_video_buffer(struct vl_compositor *c)
+static void
+create_frag_shader_yuv(struct ureg_program *shader, struct ureg_dst texel)
{
- struct ureg_program *shader;
struct ureg_src tc;
struct ureg_src sampler[3];
- struct ureg_dst texel;
- struct ureg_dst fragment;
unsigned i;
- shader = ureg_create(PIPE_SHADER_FRAGMENT);
- if (!shader)
- return false;
-
tc = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_VTEX, TGSI_INTERPOLATE_LINEAR);
for (i = 0; i < 3; ++i) {
sampler[i] = ureg_DECL_sampler(shader, i);
@@ -262,17 +255,29 @@ create_frag_shader_video_buffer(struct vl_compositor *c)
TGSI_RETURN_TYPE_FLOAT,
TGSI_RETURN_TYPE_FLOAT);
}
-
- texel = ureg_DECL_temporary(shader);
- fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0);
/*
* texel.xyz = tex(tc, sampler[i])
- * fragment = csc * texel
*/
for (i = 0; i < 3; ++i)
ureg_TEX(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i), TGSI_TEXTURE_2D_ARRAY, tc, sampler[i]);
+}
+
+static void *
+create_frag_shader_video_buffer(struct vl_compositor *c)
+{
+ struct ureg_program *shader;
+ struct ureg_dst texel;
+ struct ureg_dst fragment;
+
+ shader = ureg_create(PIPE_SHADER_FRAGMENT);
+ if (!shader)
+ return false;
+
+ texel = ureg_DECL_temporary(shader);
+ fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0);
+ create_frag_shader_yuv(shader, texel);
create_frag_shader_csc(shader, texel, fragment);
ureg_release_temporary(shader, texel);