util: add lost code to util_make_fragment_tex_shader_writemask()
authorKeith Whitwell <keithw@vmware.com>
Mon, 5 Oct 2009 14:46:47 +0000 (15:46 +0100)
committerKeith Whitwell <keithw@vmware.com>
Mon, 5 Oct 2009 14:51:55 +0000 (15:51 +0100)
This got ported to ureg at some point, but lost the code that
distinguishes it from regular util_make_fragment_tex_shader().

src/gallium/auxiliary/util/u_simple_shaders.c

index 0d706f9449d9b0cd485126e538210c0537f29ef9..1c8b157d91fcd1ac9d21b00fa69b3d9c01fd4e53 100644 (file)
@@ -108,7 +108,15 @@ util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
                            TGSI_SEMANTIC_COLOR,
                            0 );
 
-   ureg_TEX( ureg, out, TGSI_TEXTURE_2D, tex, sampler );
+   if (writemask != TGSI_WRITEMASK_XYZW) {
+      struct ureg_src imm = ureg_imm4f( ureg, 0, 0, 0, 1 );
+
+      ureg_MOV( ureg, out, imm );
+   }
+
+   ureg_TEX( ureg, 
+             ureg_writemask(out, writemask),
+             TGSI_TEXTURE_2D, tex, sampler );
    ureg_END( ureg );
 
    return ureg_create_shader_and_destroy( ureg, pipe );