From aac212966314852936352b024bfd897485aa5e83 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 11 Jul 2007 13:02:03 -0600 Subject: [PATCH] Fix broken depth offset. The edge vectors were totally wrong. Need to multiply bias units by the min resolvable depth delta. --- src/mesa/pipe/draw/draw_offset.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mesa/pipe/draw/draw_offset.c b/src/mesa/pipe/draw/draw_offset.c index 62ab2e46430..1a412656179 100644 --- a/src/mesa/pipe/draw/draw_offset.c +++ b/src/mesa/pipe/draw/draw_offset.c @@ -54,8 +54,9 @@ static INLINE struct offset_stage *offset_stage( struct prim_stage *stage ) static void offset_begin( struct prim_stage *stage ) { struct offset_stage *offset = offset_stage(stage); + GLfloat mrd = 1.0 / 65535.0; /* XXX this depends on depthbuffer bits! */ - offset->units = stage->draw->setup.offset_units; + offset->units = stage->draw->setup.offset_units * mrd; offset->scale = stage->draw->setup.offset_scale; stage->next->begin( stage->next ); @@ -79,11 +80,11 @@ static void do_offset_tri( struct prim_stage *stage, GLfloat *v2 = header->v[2]->data[0]; /* edge vectors e = v0 - v2, f = v1 - v2 */ - GLfloat ex = v0[0] - v2[2]; - GLfloat ey = v0[1] - v2[2]; + GLfloat ex = v0[0] - v2[0]; + GLfloat ey = v0[1] - v2[1]; GLfloat ez = v0[2] - v2[2]; - GLfloat fx = v1[0] - v2[2]; - GLfloat fy = v1[1] - v2[2]; + GLfloat fx = v1[0] - v2[0]; + GLfloat fy = v1[1] - v2[1]; GLfloat fz = v1[2] - v2[2]; /* (a,b) = cross(e,f).xy */ -- 2.30.2