From ab2da985b67704ac556da591e227b41f3a2e1419 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 Nov 2013 19:47:13 -0700 Subject: [PATCH] osmesa: assorted code clean-ups --- src/mesa/drivers/osmesa/osmesa.c | 63 +++++++++++++++++++------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 6f6f824b462..97cd41c6031 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -205,26 +205,31 @@ osmesa_choose_line_function( struct gl_context *ctx ) return NULL; } - if (ctx->RenderMode != GL_RENDER) return NULL; - if (ctx->Line.SmoothFlag) return NULL; - if (ctx->Texture._EnabledUnits) return NULL; - if (ctx->Light.ShadeModel != GL_FLAT) return NULL; - if (ctx->Line.Width != 1.0F) return NULL; - if (ctx->Line.StippleFlag) return NULL; - if (ctx->Line.SmoothFlag) return NULL; + if (ctx->RenderMode != GL_RENDER || + ctx->Line.SmoothFlag || + ctx->Texture._EnabledUnits || + ctx->Light.ShadeModel != GL_FLAT || + ctx->Line.Width != 1.0F || + ctx->Line.StippleFlag || + ctx->Line.SmoothFlag) { + return NULL; + } + if (osmesa->format != OSMESA_RGBA && osmesa->format != OSMESA_BGRA && - osmesa->format != OSMESA_ARGB) return NULL; + osmesa->format != OSMESA_ARGB) { + return NULL; + } - if (swrast->_RasterMask==DEPTH_BIT - && ctx->Depth.Func==GL_LESS - && ctx->Depth.Mask==GL_TRUE + if (swrast->_RasterMask == DEPTH_BIT + && ctx->Depth.Func == GL_LESS + && ctx->Depth.Mask == GL_TRUE && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS) { - return (swrast_line_func) flat_rgba_z_line; + return flat_rgba_z_line; } if (swrast->_RasterMask == 0) { - return (swrast_line_func) flat_rgba_line; + return flat_rgba_line; } return (swrast_line_func) NULL; @@ -311,32 +316,40 @@ osmesa_choose_triangle_function( struct gl_context *ctx ) /* the special-case triangle functions in this file don't work * for float color channels. */ - return (swrast_tri_func) NULL; + return NULL; + } + + if (ctx->RenderMode != GL_RENDER || + ctx->Polygon.SmoothFlag || + ctx->Polygon.StippleFlag || + ctx->Texture._EnabledUnits) { + return NULL; } - if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL; - if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL; - if (ctx->Polygon.StippleFlag) return (swrast_tri_func) NULL; - if (ctx->Texture._EnabledUnits) return (swrast_tri_func) NULL; if (osmesa->format != OSMESA_RGBA && osmesa->format != OSMESA_BGRA && - osmesa->format != OSMESA_ARGB) return (swrast_tri_func) NULL; - if (ctx->Polygon.CullFlag && - ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) - return (swrast_tri_func) NULL; + osmesa->format != OSMESA_ARGB) { + return NULL; + } + + if (ctx->Polygon.CullFlag && + ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) { + return NULL; + } if (swrast->_RasterMask == DEPTH_BIT && ctx->Depth.Func == GL_LESS && ctx->Depth.Mask == GL_TRUE && ctx->Visual.depthBits == DEFAULT_SOFTWARE_DEPTH_BITS) { if (ctx->Light.ShadeModel == GL_SMOOTH) { - return (swrast_tri_func) smooth_rgba_z_triangle; + return smooth_rgba_z_triangle; } else { - return (swrast_tri_func) flat_rgba_z_triangle; + return flat_rgba_z_triangle; } } - return (swrast_tri_func) NULL; + + return NULL; } -- 2.30.2