[Mesa-dev] [PATCH 02/14] vl/compositor: separate YUV part from shader video buffer function
Leo Liu
leo.liu at amd.com
Tue Sep 19 19:04:53 UTC 2017
So that it can be re-used
---
src/gallium/auxiliary/vl/vl_compositor.c | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index 794c8b5..714b894 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);
--
2.7.4
More information about the mesa-dev
mailing list