summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_tgsi_insn.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2011-07-26 09:19:40 -0600
committerBrian Paul <brianp@vmware.com>2011-09-23 07:58:48 -0600
commit7d09df0cbc7e4524919a025cdd506b29e2d8b4f1 (patch)
tree59c7b6129d31079cd84b31a389057dc430b958fe /src/gallium/drivers/svga/svga_tgsi_insn.c
parent9bd15aef865352b9234fedae76617fc51c71e6d5 (diff)
downloadexternal_mesa3d-7d09df0cbc7e4524919a025cdd506b29e2d8b4f1.zip
external_mesa3d-7d09df0cbc7e4524919a025cdd506b29e2d8b4f1.tar.gz
external_mesa3d-7d09df0cbc7e4524919a025cdd506b29e2d8b4f1.tar.bz2
svga: fix depth/shadow compare for non-projected texcoords
We only need to do the divide by Q step for TXP instructions. This fixes the incorrectly rendered soft shadow test in Lightsmark. Along with the previous texture swizzle commit, this also fixes all the piglit glsl-fs-shadow2d-XX.shader_test failures.
Diffstat (limited to 'src/gallium/drivers/svga/svga_tgsi_insn.c')
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_insn.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c
index b93c0cb..91fd470 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -1658,25 +1658,33 @@ static boolean emit_tex(struct svga_shader_emitter *emit,
* the Y component.
*/
struct src_register tex_src_x = scalar(src(tex_result), TGSI_SWIZZLE_Y);
+ struct src_register r_coord;
- /* Divide texcoord R by Q */
- if (!submit_op1( emit, inst_token( SVGA3DOP_RCP ),
- writemask(src0_zdivw, TGSI_WRITEMASK_X),
- scalar(src0, TGSI_SWIZZLE_W) ))
- return FALSE;
+ if (insn->Instruction.Opcode == TGSI_OPCODE_TXP) {
+ /* Divide texcoord R by Q */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_RCP ),
+ writemask(src0_zdivw, TGSI_WRITEMASK_X),
+ scalar(src0, TGSI_SWIZZLE_W) ))
+ return FALSE;
- if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ),
- writemask(src0_zdivw, TGSI_WRITEMASK_X),
- scalar(src0, TGSI_SWIZZLE_Z),
- scalar(src(src0_zdivw), TGSI_SWIZZLE_X) ))
- return FALSE;
+ if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ),
+ writemask(src0_zdivw, TGSI_WRITEMASK_X),
+ scalar(src0, TGSI_SWIZZLE_Z),
+ scalar(src(src0_zdivw), TGSI_SWIZZLE_X) ))
+ return FALSE;
+
+ r_coord = scalar(src(src0_zdivw), TGSI_SWIZZLE_X);
+ }
+ else {
+ r_coord = scalar(src0, TGSI_SWIZZLE_Z);
+ }
- if (!emit_select(
- emit,
- emit->key.fkey.tex[unit].compare_func,
- writemask( dst2, TGSI_WRITEMASK_XYZ ),
- scalar(src(src0_zdivw), TGSI_SWIZZLE_X),
- tex_src_x))
+ /* Compare texture sample value against R component of texcoord */
+ if (!emit_select(emit,
+ emit->key.fkey.tex[unit].compare_func,
+ writemask( dst2, TGSI_WRITEMASK_XYZ ),
+ r_coord,
+ tex_src_x))
return FALSE;
}