diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2007-03-11 22:41:26 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2007-03-11 22:41:26 +0800 |
commit | 61ec23cc63a040a2edf1bc466917e85362514c89 (patch) | |
tree | ca11ecd261acbc4375145c118dd18a6898f6378f | |
parent | 69e57cf6ae0af823e903926bafa8daa46b11352c (diff) | |
download | external_mesa3d-61ec23cc63a040a2edf1bc466917e85362514c89.zip external_mesa3d-61ec23cc63a040a2edf1bc466917e85362514c89.tar.gz external_mesa3d-61ec23cc63a040a2edf1bc466917e85362514c89.tar.bz2 |
fix for bug#10196
Compute half if LOCAL_VIEWER is enabled and the light is
a directional source.
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs_tnl.c | 9 | ||||
-rw-r--r-- | src/mesa/tnl/t_vp_build.c | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs_tnl.c b/src/mesa/drivers/dri/i965/brw_vs_tnl.c index 0d61092..c05a9b5 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_tnl.c +++ b/src/mesa/drivers/dri/i965/brw_vs_tnl.c @@ -988,7 +988,14 @@ static void build_lighting( struct tnl_program *p ) */ VPpli = register_param3(p, STATE_LIGHT, i, STATE_POSITION_NORMALIZED); - half = register_param3(p, STATE_LIGHT, i, STATE_HALF); + if (p->state->light_local_viewer) { + struct ureg eye_hat = get_eye_position_normalized(p); + half = get_temp(p); + emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); + emit_normalize_vec3(p, half, half); + } else { + half = register_param3(p, STATE_LIGHT, i, STATE_HALF); + } } else { struct ureg Ppli = register_param3(p, STATE_LIGHT, i, diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 81266f3..2a97a1c 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -939,7 +939,14 @@ static void build_lighting( struct tnl_program *p ) */ VPpli = register_param3(p, STATE_LIGHT, i, STATE_POSITION_NORMALIZED); - half = register_param3(p, STATE_LIGHT, i, STATE_HALF); + if (p->state->light_local_viewer) { + struct ureg eye_hat = get_eye_position_normalized(p); + half = get_temp(p); + emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat); + emit_normalize_vec3(p, half, half); + } else { + half = register_param3(p, STATE_LIGHT, i, STATE_HALF); + } } else { struct ureg Ppli = register_param3(p, STATE_LIGHT, i, |