From ad643bfc12de13f78b86de15a9d44a91ffa93ce9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Sat, 11 Dec 2010 14:34:01 +0100 Subject: [PATCH] [g3dvl] remove "Nouveau can't writemask tex dst regs" workaround This now works with r600g, but will probably break Nouveau. It's just way faster on r600 hardware, so let's fix Nouveau. --- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 0ebb9c48c24..973a746d528 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -255,7 +255,7 @@ calc_field(struct ureg_program *shader) line = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_LINE, TGSI_INTERPOLATE_LINEAR); /* - * line.x going from 0 to 1 in steps of if not interlaced + * line.x going from 0 to 1 if not interlaced * line.x going from 0 to 8 in steps of 0.5 if interlaced * line.y going from 0 to 8 in steps of 0.5 * @@ -312,15 +312,13 @@ fetch_ycbcr(struct vl_mpeg12_mc_renderer *r, struct ureg_program *shader, struct for (i = 0; i < 3; ++i) { ureg_IF(shader, ureg_scalar(ureg_src(t_eb_info), TGSI_SWIZZLE_X + i), &label); - /* Nouveau and r600g can't writemask tex dst regs (yet?), do in two steps */ + /* Nouveau can't writemask tex dst regs (yet?), so this won't work anymore on nvidia hardware */ if(i==0 || r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444) { - ureg_TEX(shader, tmp, TGSI_TEXTURE_3D, ureg_src(t_tc), sampler[i]); + ureg_TEX(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i), TGSI_TEXTURE_3D, ureg_src(t_tc), sampler[i]); } else { - ureg_TEX(shader, tmp, TGSI_TEXTURE_3D, tc[2], sampler[i]); + ureg_TEX(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i), TGSI_TEXTURE_3D, tc[2], sampler[i]); } - ureg_MOV(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X)); - ureg_ENDIF(shader); } @@ -947,6 +945,10 @@ vl_mpeg12_mc_init_buffer(struct vl_mpeg12_mc_renderer *renderer, struct vl_mpeg1 u_sampler_view_default_template(&sampler_view, buffer->textures.all[i], buffer->textures.all[i]->format); + sampler_view.swizzle_r = i == 0 ? PIPE_SWIZZLE_RED : PIPE_SWIZZLE_ZERO; + sampler_view.swizzle_g = i == 1 ? PIPE_SWIZZLE_RED : PIPE_SWIZZLE_ZERO; + sampler_view.swizzle_b = i == 2 ? PIPE_SWIZZLE_RED : PIPE_SWIZZLE_ZERO; + sampler_view.swizzle_a = PIPE_SWIZZLE_ONE; buffer->sampler_views.all[i] = renderer->pipe->create_sampler_view( renderer->pipe, buffer->textures.all[i], &sampler_view); } -- 2.30.2