diff options
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgacontext.h | 2 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgastate.c | 36 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgatris.c | 12 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgatris.h | 3 |
4 files changed, 27 insertions, 26 deletions
diff --git a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h index 193a1cefc..81d2a2c36 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h @@ -57,11 +57,13 @@ * - texture env GL_BLEND -- can be fixed * - 1D and 3D textures * - incomplete textures + * - GL_DEPTH_FUNC == GL_NEVER not in h/w */ #define MGA_FALLBACK_TEXTURE 0x1 #define MGA_FALLBACK_BUFFER 0x2 #define MGA_FALLBACK_LOGICOP 0x4 #define MGA_FALLBACK_STENCIL 0x8 +#define MGA_FALLBACK_DEPTH 0x10 /* For mgaCtx->new_state. diff --git a/xc/lib/GL/mesa/src/drv/mga/mgastate.c b/xc/lib/GL/mesa/src/drv/mga/mgastate.c index 2c8074257..cde89f271 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgastate.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgastate.c @@ -190,7 +190,9 @@ static void mgaUpdateZMode(const GLcontext *ctx) if (ctx->Depth.Test) { switch(ctx->Depth.Func) { case GL_NEVER: - zmode = DC_zmode_nozcmp; break; + /* can't do this in h/w, we'll use a s/w fallback */ + zmode = DC_zmode_nozcmp; + break; case GL_ALWAYS: zmode = DC_zmode_nozcmp; break; case GL_LESS: @@ -208,15 +210,17 @@ static void mgaUpdateZMode(const GLcontext *ctx) default: break; } - } else { + + if (ctx->Depth.Mask) + zmode |= DC_atype_zi; + else + zmode |= DC_atype_i; + } + else { zmode |= DC_zmode_nozcmp; + zmode |= DC_atype_i; /* don't write to zbuffer */ } - if (ctx->Depth.Mask) - zmode |= DC_atype_zi; - else - zmode |= DC_atype_i; - #if defined(ACCEL_ROP) mmesa->setup.dwgctl &= DC_bop_MASK; if (ctx->Color.ColorLogicOpEnabled) @@ -287,6 +291,10 @@ static void mgaDDDepthFunc(GLcontext *ctx, GLenum func) { FLUSH_BATCH( MGA_CONTEXT(ctx) ); MGA_CONTEXT(ctx)->new_state |= MGA_NEW_DEPTH; + if (func == GL_NEVER && ctx->Depth.Test) + MGA_CONTEXT(ctx)->Fallback |= MGA_FALLBACK_DEPTH; + else + MGA_CONTEXT(ctx)->Fallback &= ~MGA_FALLBACK_DEPTH; } static void mgaDDDepthMask(GLcontext *ctx, GLboolean flag) @@ -439,7 +447,10 @@ static void mgaUpdateAlphaMode(GLcontext *ctx) a |= AC_src_zero; break; case GL_SRC_ALPHA_SATURATE: - a |= AC_src_src_alpha_sat; + if (ctx->Visual->AlphaBits > 0) + a |= AC_src_src_alpha_sat; + else + a |= AC_src_zero; break; default: /* never happens */ break; @@ -827,6 +838,10 @@ static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state) case GL_DEPTH_TEST: FLUSH_BATCH( mmesa ); mmesa->new_state |= MGA_NEW_DEPTH; + if (ctx->Depth.Func == GL_NEVER && ctx->Depth.Test) + mmesa->Fallback |= MGA_FALLBACK_DEPTH; + else + mmesa->Fallback &= ~MGA_FALLBACK_DEPTH; break; case GL_SCISSOR_TEST: FLUSH_BATCH( mmesa ); @@ -973,11 +988,6 @@ void mgaDDUpdateHwState( GLcontext *ctx ) } - - - - - void mgaDDReducedPrimitiveChange( GLcontext *ctx, GLenum prim ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.c b/xc/lib/GL/mesa/src/drv/mga/mgatris.c index fb327e091..a0bac9a2a 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatris.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.c @@ -114,7 +114,6 @@ void mgaDDTrifuncInit() { int i; - init(); init_flat(); init_offset(); @@ -123,14 +122,6 @@ void mgaDDTrifuncInit() init_twoside_flat(); init_twoside_offset(); init_twoside_offset_flat(); - - for (i = 0 ; i < 0x20 ; i++) - if (i & MGA_NODRAW_BIT) { - quad_tab[i] = mga_null_quad; - tri_tab[i] = mga_null_triangle; - line_tab[i] = mga_null_line; - points_tab[i] = mga_null_points; - } } @@ -140,7 +131,7 @@ void mgaDDTrifuncInit() #define LINE_FALLBACK (ALL_FALLBACK | DD_LINE_SMOOTH | DD_LINE_STIPPLE) #define TRI_FALLBACK (ALL_FALLBACK | DD_TRI_SMOOTH | DD_TRI_UNFILLED) #define ANY_FALLBACK (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK|DD_TRI_STIPPLE) -#define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_Z_NEVER) +#define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET) /* Setup the Point, Line, Triangle and Quad functions based on the current rendering state. Wherever possible, use the hardware to @@ -160,7 +151,6 @@ void mgaDDChooseRenderState(GLcontext *ctx) if (flags & DD_FLATSHADE) index |= MGA_FLAT_BIT; if (flags & DD_TRI_LIGHT_TWOSIDE) index |= MGA_TWOSIDE_BIT; if (flags & DD_TRI_OFFSET) index |= MGA_OFFSET_BIT; - if (flags & DD_Z_NEVER) index |= MGA_NODRAW_BIT; } mmesa->PointsFunc = points_tab[index]; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.h b/xc/lib/GL/mesa/src/drv/mga/mgatris.h index 1fc1cad40..9880bbdf1 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatris.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.h @@ -38,8 +38,7 @@ extern void mgaDDTrifuncInit( void ); #define MGA_FLAT_BIT 0x1 #define MGA_OFFSET_BIT 0x2 #define MGA_TWOSIDE_BIT 0x4 -#define MGA_NODRAW_BIT 0x8 -#define MGA_FALLBACK_BIT 0x10 +#define MGA_FALLBACK_BIT 0x8 static __inline void mga_draw_triangle( mgaContextPtr mmesa, mgaVertex *v0, |