[g3dvl] remove "Nouveau can't writemask tex dst regs" workaround
authorChristian König <deathsimple@vodafone.de>
Sat, 11 Dec 2010 13:34:01 +0000 (14:34 +0100)
committerChristian König <deathsimple@vodafone.de>
Sat, 11 Dec 2010 13:34:01 +0000 (14:34 +0100)
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

index 0ebb9c48c2475bb268abd1159a087b0f77d10a1d..973a746d528ea28389d4e05b18451adf4d1e3847 100644 (file)
@@ -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);
    }