diff options
author | Keith Whitwell <[email protected]> | 2001-01-16 05:29:42 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2001-01-16 05:29:42 +0000 |
commit | d43a5943d8952367d9292653800b47a85f905343 (patch) | |
tree | a33ce0af1f3396c6921643f4662df2ad719a0a34 /src/mesa/swrast_setup/ss_context.c | |
parent | 230928ad5f325614288bc481d7135388c052f3ab (diff) |
Fix several conformance problems. Hack solution to line stipple problem.
Diffstat (limited to 'src/mesa/swrast_setup/ss_context.c')
-rw-r--r-- | src/mesa/swrast_setup/ss_context.c | 138 |
1 files changed, 40 insertions, 98 deletions
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index de3f36288a7..a6c7aa8740a 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -1,4 +1,4 @@ -/* $Id: ss_context.c,v 1.7 2001/01/08 04:09:41 keithw Exp $ */ +/* $Id: ss_context.c,v 1.8 2001/01/16 05:29:43 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -27,64 +27,17 @@ * Keith Whitwell <[email protected]> */ - #include "glheader.h" #include "mem.h" - - #include "ss_context.h" #include "ss_triangle.h" #include "ss_vb.h" - #include "swrast_setup.h" - #include "tnl/t_context.h" -/* Stub for swsetup->Triangle to select a true triangle function - * after a state change. - */ -static void -_swsetup_validate_quad( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint v3 ) -{ - _swsetup_choose_trifuncs( ctx ); - SWSETUP_CONTEXT(ctx)->Quad( ctx, v0, v1, v2, v3 ); -} - -static void -_swsetup_validate_triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2 ) -{ - _swsetup_choose_trifuncs( ctx ); - SWSETUP_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 ); -} - -static void -_swsetup_validate_line( GLcontext *ctx, GLuint v0, GLuint v1 ) -{ - _swsetup_choose_trifuncs( ctx ); - SWSETUP_CONTEXT(ctx)->Line( ctx, v0, v1 ); -} - - -static void -_swsetup_validate_points( GLcontext *ctx, GLuint first, GLuint last ) -{ - _swsetup_choose_trifuncs( ctx ); - SWSETUP_CONTEXT(ctx)->Points( ctx, first, last ); -} - - - -static void -_swsetup_validate_buildprojverts( GLcontext *ctx, - GLuint start, GLuint end, GLuint new_inputs ) -{ - _swsetup_choose_rastersetup_func( ctx ); - SWSETUP_CONTEXT(ctx)->BuildProjVerts( ctx, start, end, new_inputs ); -} - - + #define _SWSETUP_NEW_VERTS (_NEW_RENDERMODE| \ + _NEW_LIGHT| \ _NEW_TEXTURE| \ _NEW_COLOR| \ _NEW_FOG| \ @@ -93,38 +46,13 @@ _swsetup_validate_buildprojverts( GLcontext *ctx, #define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT) -#if 0 -/* TODO: sleep/wakeup mechanism - */ -static void -_swsetup_sleep( GLcontext *ctx, GLuint new_state ) -{ -} -#endif - -static void -_swsetup_invalidate_state( GLcontext *ctx, GLuint new_state ) -{ - SScontext *swsetup = SWSETUP_CONTEXT(ctx); - - swsetup->NewState |= new_state; - - if (new_state & _SWSETUP_NEW_RENDERINDEX) { - swsetup->Triangle = _swsetup_validate_triangle; - swsetup->Line = _swsetup_validate_line; - swsetup->Points = _swsetup_validate_points; - swsetup->Quad = _swsetup_validate_quad; - } - - if (new_state & _SWSETUP_NEW_VERTS) { - swsetup->BuildProjVerts = _swsetup_validate_buildprojverts; - } -} - - - /* Dispatch from these fixed entrypoints to the state-dependent - * functions: + * functions. + * + * The design of swsetup suggests that we could really program + * ctx->Driver.TriangleFunc directly from _swsetup_RenderStart, and + * avoid this second level of indirection. However, this is more + * convient for fallback cases in hardware rasterization drivers. */ void _swsetup_Quad( GLcontext *ctx, GLuint v0, GLuint v1, @@ -146,7 +74,6 @@ _swsetup_Line( GLcontext *ctx, GLuint v0, GLuint v1 ) SWSETUP_CONTEXT(ctx)->Line( ctx, v0, v1 ); } - void _swsetup_Points( GLcontext *ctx, GLuint first, GLuint last ) { @@ -160,12 +87,6 @@ _swsetup_BuildProjectedVertices( GLcontext *ctx, GLuint start, GLuint end, SWSETUP_CONTEXT(ctx)->BuildProjVerts( ctx, start, end, new_inputs ); } -void -_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ) -{ - SWSETUP_CONTEXT(ctx)->InvalidateState( ctx, new_state ); -} - GLboolean _swsetup_CreateContext( GLcontext *ctx ) @@ -185,13 +106,6 @@ _swsetup_CreateContext( GLcontext *ctx ) ctx->swsetup_context = swsetup; swsetup->NewState = ~0; - swsetup->InvalidateState = _swsetup_invalidate_state; - swsetup->Quad = _swsetup_validate_quad; - swsetup->Triangle = _swsetup_validate_triangle; - swsetup->Line = _swsetup_validate_line; - swsetup->Points = _swsetup_validate_points; - swsetup->BuildProjVerts = _swsetup_validate_buildprojverts; - _swsetup_vb_init( ctx ); _swsetup_trifuncs_init( ctx ); @@ -210,10 +124,38 @@ _swsetup_DestroyContext( GLcontext *ctx ) } } +void +_swsetup_RenderPrimitive( GLcontext *ctx, GLenum mode ) +{ + SWSETUP_CONTEXT(ctx)->render_prim = mode; +} + +void +_swsetup_RenderStart( GLcontext *ctx ) +{ + SScontext *swsetup = SWSETUP_CONTEXT(ctx); + GLuint new_state = swsetup->NewState; + + if (new_state & _SWSETUP_NEW_RENDERINDEX) { + _swsetup_choose_trifuncs( ctx ); + } + + if (new_state & _SWSETUP_NEW_VERTS) { + _swsetup_choose_rastersetup_func( ctx ); + } + + swsetup->NewState = 0; +} + +void +_swsetup_RenderFinish( GLcontext *ctx ) +{ + _swrast_flush( ctx ); +} void -_swsetup_RenderPrimNoop( GLcontext *ctx, GLenum mode ) +_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ) { - (void) ctx; - (void) mode; + SWSETUP_CONTEXT(ctx)->NewState |= new_state; } + |