From 324beb95f34b29b53c8863af5591fb90393a157e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 4 Sep 1999 14:40:49 +0000 Subject: fix for mga depthbuffer resize --- src/mesa/main/context.c | 50 ++++++++++++++++++++++++++++--------------------- src/mesa/main/dlist.c | 23 +++++++++++++---------- 2 files changed, 42 insertions(+), 31 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 329cb33647..f227c9f432 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.4 1999/09/02 13:16:17 keithw Exp $ */ +/* $Id: context.c,v 1.5 1999/09/04 14:40:49 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -1293,6 +1293,15 @@ GLcontext *gl_create_context( GLvisual *visual, ctx->Pixel.DriverReadBuffer = GL_FRONT_LEFT; } + + /* Fill in some driver defaults now. + */ + ctx->Driver.AllocDepthBuffer = gl_alloc_depth_buffer; + ctx->Driver.ReadDepthSpanFloat = gl_read_depth_span_float; + ctx->Driver.ReadDepthSpanInt = gl_read_depth_span_int; + + + #ifdef PROFILE init_timings( ctx ); #endif @@ -2173,31 +2182,30 @@ void gl_update_state( GLcontext *ctx ) } } - /* - * Update Device Driver interface + /* The driver isn't managing the depth buffer. */ - ctx->Driver.AllocDepthBuffer = gl_alloc_depth_buffer; - if (ctx->Depth.Mask) { - switch (ctx->Depth.Func) { - case GL_LESS: - ctx->Driver.DepthTestSpan = gl_depth_test_span_less; - ctx->Driver.DepthTestPixels = gl_depth_test_pixels_less; - break; - case GL_GREATER: - ctx->Driver.DepthTestSpan = gl_depth_test_span_greater; - ctx->Driver.DepthTestPixels = gl_depth_test_pixels_greater; - break; - default: + if (ctx->Driver.AllocDepthBuffer == gl_alloc_depth_buffer) + { + if (ctx->Depth.Mask) { + switch (ctx->Depth.Func) { + case GL_LESS: + ctx->Driver.DepthTestSpan = gl_depth_test_span_less; + ctx->Driver.DepthTestPixels = gl_depth_test_pixels_less; + break; + case GL_GREATER: + ctx->Driver.DepthTestSpan = gl_depth_test_span_greater; + ctx->Driver.DepthTestPixels = gl_depth_test_pixels_greater; + break; + default: + ctx->Driver.DepthTestSpan = gl_depth_test_span_generic; + ctx->Driver.DepthTestPixels = gl_depth_test_pixels_generic; + } + } + else { ctx->Driver.DepthTestSpan = gl_depth_test_span_generic; ctx->Driver.DepthTestPixels = gl_depth_test_pixels_generic; } } - else { - ctx->Driver.DepthTestSpan = gl_depth_test_span_generic; - ctx->Driver.DepthTestPixels = gl_depth_test_pixels_generic; - } - ctx->Driver.ReadDepthSpanFloat = gl_read_depth_span_float; - ctx->Driver.ReadDepthSpanInt = gl_read_depth_span_int; } if (ctx->NewState & NEW_LIGHTING) { diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 24266e3e42..f08b3b7fec 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.2 1999/08/26 14:50:49 keithw Exp $ */ +/* $Id: dlist.c,v 1.3 1999/09/04 14:40:49 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -271,6 +271,7 @@ union node { /* Number of nodes of storage needed for each instruction: */ static GLuint InstSize[ OPCODE_END_OF_LIST+1 ]; +void mesa_print_display_list( GLuint list ); /**********************************************************************/ @@ -2382,14 +2383,9 @@ void gl_compile_cassette( GLcontext *ctx ) return; } - /* Do some easy optimizations of the cassette. If current value of - * clip volume hint is GL_FASTEST, we are not clipping anyway, so - * don't calculate the bounds. But - they will not be calculated - * later even if the hint is changed, so this is a slightly odd - * behaviour. + /* Do some easy optimizations of the cassette. */ - if (ctx->Hint.ClipVolumeClipping != GL_FASTEST && - im->v.Obj.size < 4 && + if (im->v.Obj.size < 4 && im->Count > 15) { im->Bounds = (GLfloat (*)[3]) malloc(6 * sizeof(GLfloat)); @@ -3063,13 +3059,15 @@ void gl_EndList( GLcontext *ctx ) (void) alloc_instruction( ctx, OPCODE_END_OF_LIST, 0 ); - - /* Destroy old list, if any */ gl_destroy_list(ctx, ctx->CurrentListNum); /* Install the list */ HashInsert(ctx->Shared->DisplayList, ctx->CurrentListNum, ctx->CurrentListPtr); + + if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) + mesa_print_display_list(ctx->CurrentListNum); + ctx->CurrentListNum = 0; ctx->CurrentListPtr = NULL; ctx->ExecuteFlag = GL_TRUE; @@ -3080,6 +3078,11 @@ void gl_EndList( GLcontext *ctx ) */ free( ctx->input ); SET_IMMEDIATE( ctx, ctx->VB->IM ); + gl_reset_input( ctx ); + + /* Haven't tracked down why this is needed. + */ + ctx->NewState = ~0; ctx->API = ctx->Exec; /* Switch the API function pointers */ } -- cgit v1.2.3