diff options
author | Keith Whitwell <[email protected]> | 2001-01-13 05:48:25 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2001-01-13 05:48:25 +0000 |
commit | 321f67c4729adeebd7aa9ef9e22c95e709952851 (patch) | |
tree | 8661da8a994f3c554c4428afdd53642c0814854b /src/mesa/tnl/t_vb_vertex.c | |
parent | a087c7421bef25747e1d692f62062393d849c501 (diff) |
Fix crash in book/stencil.
Allow drivers to perform the perspective divide themselves. Assembly
to do cliptesting without perspective divide for size-4 vectors.
Diffstat (limited to 'src/mesa/tnl/t_vb_vertex.c')
-rw-r--r-- | src/mesa/tnl/t_vb_vertex.c | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index 7667d423a8b..0c163ee4f31 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -1,4 +1,4 @@ -/* $Id: t_vb_vertex.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ +/* $Id: t_vb_vertex.c,v 1.2 2001/01/13 05:48:26 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -134,7 +134,8 @@ static GLboolean run_vertex_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) { struct vertex_stage_data *store = (struct vertex_stage_data *)stage->private; - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; if (stage->changed_inputs) { @@ -172,12 +173,36 @@ static GLboolean run_vertex_stage( GLcontext *ctx, store->ormask = 0; store->andmask = CLIP_ALL_BITS; - VB->ProjectedClipPtr = - gl_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, - &store->proj, - store->clipmask, - &store->ormask, - &store->andmask ); + if (tnl->NeedProjCoords) { + VB->ProjectedClipPtr = + gl_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, + &store->proj, + store->clipmask, + &store->ormask, + &store->andmask ); + + /* Drivers expect this to be size 4... + */ + if (VB->ProjectedClipPtr->size < 4) { + ASSERT(VB->ProjectedClipPtr == VB->ClipPtr); + if (VB->ProjectedClipPtr->flags & VEC_NOT_WRITEABLE) { + ASSERT(VB->ProjectedClipPtr == VB->ObjPtr); + VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE ); + VB->ProjectedClipPtr = VB->ClipPtr = VB->ObjPtr; + } + if (VB->ClipPtr->size == 2) + gl_vector4f_clean_elem( VB->ClipPtr, VB->Count, 2 ); + gl_vector4f_clean_elem( VB->ClipPtr, VB->Count, 3 ); + VB->ClipPtr->size = 4; + } + } else { + VB->ProjectedClipPtr = 0; + gl_clip_np_tab[VB->ClipPtr->size]( VB->ClipPtr, + 0, + store->clipmask, + &store->ormask, + &store->andmask ); + } if (store->andmask) return GL_FALSE; @@ -203,21 +228,6 @@ static GLboolean run_vertex_stage( GLcontext *ctx, if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_OBJ)) VB->importable_data |= VERT_CLIP; - /* Drivers expect this to be size 4... - */ - if (VB->ProjectedClipPtr->size < 4) { - ASSERT(VB->ProjectedClipPtr == VB->ClipPtr); - if (VB->ProjectedClipPtr->flags & VEC_NOT_WRITEABLE) { - ASSERT(VB->ProjectedClipPtr == VB->ObjPtr); - VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE ); - VB->ProjectedClipPtr = VB->ClipPtr = VB->ObjPtr; - } - if (VB->ClipPtr->size == 2) - gl_vector4f_clean_elem( VB->ClipPtr, VB->Count, 2 ); - gl_vector4f_clean_elem( VB->ClipPtr, VB->Count, 3 ); - VB->ClipPtr->size = 4; - } - store->save_eyeptr = VB->EyePtr; store->save_clipptr = VB->ClipPtr; store->save_projptr = VB->ProjectedClipPtr; |