From 82d4aa40551fe86a04346c3eea944f8ce7ae8d28 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 9 Oct 2007 14:14:59 +0800 Subject: [PATCH] shadow sampler fix. 1. spec requite result (0, 0, 0, 1) instead of (0, 0, 0, 0) 2. support shadow sampler in simd8 --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 2 ++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 5660b555162..1f7158f7a78 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -702,6 +702,8 @@ static void emit_tex( struct brw_wm_compile *c, msgLength, 0); + if (shadow) + brw_MOV(p, dst[3], brw_imm_f(1.0)); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 58cdf72e372..8133c384f38 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1027,8 +1027,10 @@ static void emit_tex(struct brw_wm_compile *c, GLuint msg_len; GLuint i, nr; GLuint emit; + GLboolean shadow = (c->key.shadowtex_mask & (1<TexSrcUnit)) ? 1 : 0; payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); + for (i = 0; i < 4; i++) dst[i] = get_dst_reg(c, inst, i, 1); for (i = 0; i < 4; i++) @@ -1061,6 +1063,11 @@ static void emit_tex(struct brw_wm_compile *c, msg_len += 1; } + if (shadow) { + brw_MOV(p, brw_message_reg(5), brw_imm_f(0)); + brw_MOV(p, brw_message_reg(6), src[2]); + } + brw_SAMPLE(p, retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), 1, @@ -1070,8 +1077,11 @@ static void emit_tex(struct brw_wm_compile *c, inst->DstReg.WriteMask, BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE, 4, - 4, + shadow ? 6 : 4, 0); + + if (shadow) + brw_MOV(p, dst[3], brw_imm_f(1.0)); } static void post_wm_emit( struct brw_wm_compile *c ) -- 2.30.2