[Mesa-dev] [PATCH] mesa: do not skip att and spot calculation for infinite light
Yuanhan Liu
yuanhan.liu at linux.intel.com
Tue Nov 15 19:33:57 PST 2011
On Tue, Nov 15, 2011 at 07:22:29AM -0700, Brian Paul wrote:
> On 11/15/2011 12:11 AM, Yuanhan Liu wrote:
> >glspec doesn't say that we should skip the attenuation and spot
> >calculation for infinite light(Ppli.w == 0). Instead, it gives a same
> >formula to do the light calculation for both finite light and infinite
> >light(see page 62 of glspec 2.1.pdf)
> >
> >Also from the formula (2.4) at page 62 of glspec 2.1.pdf, we can skip
> >attenuation calculation if Ppli.w == 0.
> >
> >This would fix all the intel oglc l_sed fail subcases and introduces no
> >intel oglc regressions.
> >
> >Signed-off-by: Yuanhan Liu<yuanhan.liu at linux.intel.com>
> >---
> > src/mesa/main/ffvertex_prog.c | 115 ++++++++++++++++++-----------------------
> > 1 files changed, 51 insertions(+), 64 deletions(-)
> >
> >diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
> >index 8469078..fd53bc4 100644
> >--- a/src/mesa/main/ffvertex_prog.c
> >+++ b/src/mesa/main/ffvertex_prog.c
[snip]..
> >+ /* Calculate viewer direction, or use infinite viewer:
> >+ */
> >+ if (!p->state->material_shininess_is_zero) {
> >+ 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 if (p->state->unit[i].light_eyepos3_is_zero) {
> >+ half = register_param3(p, STATE_INTERNAL,
> >+ STATE_LIGHT_HALF_VECTOR, i);
> >+ } else {
> >+ struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z);
> >+ half = get_temp(p);
> >+ emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir);
> > emit_normalize_vec3(p, half, half);
> > }
>
> The indentation of 'else' above looks wrong.
Oh, right. Fixed.
Thanks,
Yuanhan Liu
>
> >-
> >- release_temp(p, dist);
> > }
> >
> > /* Calculate dot products:
>
> Acked-by: Brian Paul <brianp at vmware.com>
More information about the mesa-dev
mailing list