From 14940c4ffe066a8b85bc14274c19ad3d8e334d61 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 5 Nov 2000 18:40:57 +0000 Subject: [PATCH] - Changes for new software rasterizer modules - Remove support for choosing software fallbacks from core code - Remove partial fallback code from vbrender.c -- drivers are now expected to be able to find a triangle/quad function for every state, even if they have to use _swsetup_Triangle or _swsetup_Quad. - Marked derived variables in the GLcontext struct with a leading underscore '_'. --- src/mesa/Makefile.X11 | 37 ++-- src/mesa/drivers/d3d/D3Dvbrender.c | 14 +- src/mesa/drivers/ggi/default/stubs.c | 2 +- src/mesa/drivers/windows/wmesa.c | 20 +- src/mesa/drivers/windows/wmesaBackup.c | 27 ++- src/mesa/drivers/windows/wmesaOld.c | 25 ++- src/mesa/drivers/windows/wmesa_stereo.c | 16 +- src/mesa/main/Makefile.X11 | 37 ++-- src/mesa/main/attrib.c | 30 ++- src/mesa/main/blend.c | 5 +- src/mesa/main/clip.c | 42 ++--- src/mesa/main/context.c | 72 +++---- src/mesa/main/dd.h | 26 +-- src/mesa/main/depth.c | 6 +- src/mesa/main/enable.c | 44 ++--- src/mesa/main/feedback.c | 162 +--------------- src/mesa/main/feedback.h | 12 +- src/mesa/main/fog.c | 4 +- src/mesa/main/light.c | 240 ++++++++++++------------ src/mesa/main/lines.c | 6 +- src/mesa/main/macros.h | 8 +- src/mesa/main/matrix.c | 41 ++-- src/mesa/main/points.c | 20 +- src/mesa/main/polygon.c | 10 +- src/mesa/main/rastpos.c | 20 +- src/mesa/main/state.c | 236 +++++++---------------- src/mesa/main/teximage.c | 48 ++--- src/mesa/main/texobj.c | 17 +- src/mesa/main/texstate.c | 35 ++-- src/mesa/main/varray.c | 176 ++++++++--------- src/mesa/x86/mmx.h | 39 +--- 31 files changed, 573 insertions(+), 904 deletions(-) diff --git a/src/mesa/Makefile.X11 b/src/mesa/Makefile.X11 index 32326d6d5ed..4dbab5b4bea 100644 --- a/src/mesa/Makefile.X11 +++ b/src/mesa/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.27 2000/10/31 18:09:44 keithw Exp $ +# $Id: Makefile.X11,v 1.28 2000/11/05 18:40:57 keithw Exp $ # Mesa 3-D graphics library # Version: 3.5 @@ -108,6 +108,7 @@ CORE_SOURCES = \ swrast/s_context.c \ swrast/s_depth.c \ swrast/s_drawpix.c \ + swrast/s_feedback.c \ swrast/s_fog.c \ swrast/s_imaging.c \ swrast/s_lines.c \ @@ -123,11 +124,27 @@ CORE_SOURCES = \ swrast/s_stencil.c \ swrast/s_texture.c \ swrast/s_triangle.c \ - swrast/s_zoom.c + swrast/s_zoom.c \ + swrast_setup/ss_context.c \ + swrast_setup/ss_triangle.c \ + swrast_setup/ss_vb.c + + DRIVER_SOURCES = \ + FX/fxapi.c \ + FX/fxdd.c \ + FX/fxddspan.c \ + FX/fxddtex.c \ + FX/fxfastpath.c \ + FX/fxpipeline.c \ + FX/fxsetup.c \ + FX/fxtexman.c \ + FX/fxtrifuncs.c \ + FX/fxvsetup.c \ + FX/fxglidew.c \ X/glxapi.c \ X/fakeglx.c \ X/xfonts.c \ @@ -142,20 +159,6 @@ DRIVER_SOURCES = \ SVGA/svgamesa16.c \ SVGA/svgamesa24.c \ SVGA/svgamesa32.c \ - FX/fxapi.c \ - FX/fxclip.c \ - FX/fxdd.c \ - FX/fxddspan.c \ - FX/fxddtex.c \ - FX/fxfastpath.c \ - FX/fxpipeline.c \ - FX/fxrender.c \ - FX/fxsanity.c \ - FX/fxsetup.c \ - FX/fxtexman.c \ - FX/fxtrifuncs.c \ - FX/fxvsetup.c \ - FX/fxglidew.c \ Trace/tr_2string.c \ Trace/tr_attrib.c \ Trace/tr_context.c \ @@ -170,8 +173,8 @@ ASM_SOURCES = ADDITIONAL_OBJ = OBJECTS = $(ASM_SOURCES:.S=.o) \ - $(CORE_SOURCES:.c=.o) \ $(DRIVER_SOURCES:.c=.o) \ + $(CORE_SOURCES:.c=.o) \ $(ADDITIONAL_OBJ) diff --git a/src/mesa/drivers/d3d/D3Dvbrender.c b/src/mesa/drivers/d3d/D3Dvbrender.c index 0ef32e26ceb..852e6e56e74 100644 --- a/src/mesa/drivers/d3d/D3Dvbrender.c +++ b/src/mesa/drivers/d3d/D3Dvbrender.c @@ -428,7 +428,7 @@ static void RenderTriangleVB( GLcontext *ctx, GLuint start, GLuint end ) DPF(( DBG_FUNC, "RenderTriangleVB" )); - if ( (!(ctx->IndirectTriangles & DD_SW_SETUP)) && !VB->ClipOrMask ) + if ( !VB->ClipOrMask ) { DPF(( DBG_PRIM_INFO, "DirectTriangles( %d )", (end-start) )); for( index = start, cVertex = 0; index < end; ) @@ -602,7 +602,7 @@ static void RenderTriangleFanVB( GLcontext *ctx, GLuint start, GLuint end ) DPF(( DBG_FUNC, "RenderTriangleFanVB();" )); /* Special case that we can blast the fan without culling, offset, etc... */ - if ( (!(ctx->IndirectTriangles & DD_SW_SETUP)) && !VB->ClipOrMask && (ctx->Light.ShadeModel != GL_FLAT) ) + if ( !VB->ClipOrMask && (ctx->Light.ShadeModel != GL_FLAT) ) { DPF(( DBG_PRIM_INFO, "DirectTriangles( %d )", (end-start) )); @@ -760,7 +760,7 @@ static void RenderTriangleStripVB( GLcontext *ctx, GLuint start, GLuint end ) DPF(( DBG_FUNC, "RenderTriangleStripVB();" )); /* Special case that we can blast the fan without culling, offset, etc... */ - if ( (!(ctx->IndirectTriangles & DD_SW_SETUP)) && !VB->ClipOrMask && (ctx->Light.ShadeModel != GL_FLAT) ) + if ( !VB->ClipOrMask && (ctx->Light.ShadeModel != GL_FLAT) ) { DPF(( DBG_PRIM_PROFILE, "DirectTriangles" )); @@ -946,7 +946,7 @@ static void RenderQuadVB( GLcontext *ctx, GLuint start, GLuint end ) #define v3 (index+2) #define v4 (index+3) - if ( (!(ctx->IndirectTriangles & DD_SW_SETUP)) && !VB->ClipOrMask ) + if ( !VB->ClipOrMask ) { DPF(( DBG_PRIM_PROFILE, "DirectTriangles" )); @@ -1511,7 +1511,7 @@ static void SetRenderStates( GLcontext *ctx ) /*================================================*/ /* Check too see if there are new TEXTURE states. */ /*================================================*/ - if ( ctx->Texture.ReallyEnabled ) + if ( ctx->Texture._ReallyEnabled ) { switch( ctx->Texture.Set[ctx->Texture.CurrentSet].EnvMode ) { @@ -1871,9 +1871,9 @@ static void DebugRenderStates( GLcontext *ctx, BOOL bForce ) /*================================================*/ /* Check too see if there are new TEXTURE states. */ /*================================================*/ - if ( texture != ctx->Texture.ReallyEnabled ) + if ( texture != ctx->Texture._ReallyEnabled ) { - texture = ctx->Texture.ReallyEnabled; + texture = ctx->Texture._ReallyEnabled; DPF(( 0, "\tTexture\t\t%s", (texture) ? "ENABLED" : "--------" )); } diff --git a/src/mesa/drivers/ggi/default/stubs.c b/src/mesa/drivers/ggi/default/stubs.c index f9df294ee42..b1d915b2cb2 100644 --- a/src/mesa/drivers/ggi/default/stubs.c +++ b/src/mesa/drivers/ggi/default/stubs.c @@ -389,7 +389,7 @@ triangle_func ggiGetTriangleFunc(GLcontext *ctx) if (ctx->Stencil.Enabled) return NULL; if (ctx->Polygon.SmoothFlag) return NULL; if (ctx->Polygon.StippleFlag) return NULL; - if (ctx->Texture.ReallyEnabled) return NULL; + if (ctx->Texture._ReallyEnabled) return NULL; if (ctx->Light.ShadeModel==GL_SMOOTH) return NULL; if (ctx->Depth.Test && ctx->Depth.Func != GL_LESS) return NULL; diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c index 6b2b02bc357..aa0f58c5fcf 100644 --- a/src/mesa/drivers/windows/wmesa.c +++ b/src/mesa/drivers/windows/wmesa.c @@ -1,4 +1,4 @@ -/* $Id: wmesa.c,v 1.9 2000/09/28 22:44:32 brianp Exp $ */ +/* $Id: wmesa.c,v 1.10 2000/11/05 18:41:00 keithw Exp $ */ /* * Windows (Win32) device driver for Mesa 3.4 @@ -650,8 +650,8 @@ static void fast_rgb_points( GLcontext* ctx, GLuint first, GLuint last ) extern points_func choose_points_function( GLcontext* ctx ) { STARTPROFILE - if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->RasterMask==0 - && !ctx->Texture.ReallyEnabled && ctx->Visual->RGBAflag) { + if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->_RasterMask==0 + && !ctx->Texture._ReallyEnabled && ctx->Visual->RGBAflag) { ENDPROFILE(choose_points_function) return fast_rgb_points; } @@ -708,8 +708,8 @@ static line_func choose_line_function( GLcontext* ctx ) { STARTPROFILE if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag - && ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0 - && !ctx->Texture.ReallyEnabled && Current->rgb_flag) { + && ctx->Light.ShadeModel==GL_FLAT && ctx->_RasterMask==0 + && !ctx->Texture._ReallyEnabled && Current->rgb_flag) { ENDPROFILE(choose_line_function) return fast_flat_rgb_line; } @@ -2851,11 +2851,11 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) int depth = wmesa->cColorBits; if (ctx->Polygon.SmoothFlag) return NULL; - if (ctx->Texture.ReallyEnabled) return NULL; + if (ctx->Texture._ReallyEnabled) return NULL; if (!wmesa->db_flag) return NULL; /*if (wmesa->xm_buffer->buffer==XIMAGE)*/ { if ( ctx->Light.ShadeModel==GL_SMOOTH - && ctx->RasterMask==DEPTH_BIT + && ctx->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Polygon.StippleFlag==GL_FALSE) { @@ -2875,7 +2875,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) } } if ( ctx->Light.ShadeModel==GL_FLAT - && ctx->RasterMask==DEPTH_BIT + && ctx->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Polygon.StippleFlag==GL_FALSE) { @@ -2894,7 +2894,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) return NULL; } } - if ( ctx->RasterMask==0 /* no depth test */ + if ( ctx->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_SMOOTH && ctx->Polygon.StippleFlag==GL_FALSE) { switch (wmesa->pixelformat) { @@ -2913,7 +2913,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) } } - if ( ctx->RasterMask==0 /* no depth test */ + if ( ctx->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_FLAT && ctx->Polygon.StippleFlag==GL_FALSE) { switch (wmesa->pixelformat) { diff --git a/src/mesa/drivers/windows/wmesaBackup.c b/src/mesa/drivers/windows/wmesaBackup.c index 57269fbadb0..baa57a4ee4f 100644 --- a/src/mesa/drivers/windows/wmesaBackup.c +++ b/src/mesa/drivers/windows/wmesaBackup.c @@ -1,4 +1,4 @@ -/* $Id: wmesaBackup.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */ +/* $Id: wmesaBackup.c,v 1.2 2000/11/05 18:41:00 keithw Exp $ */ /* * File name : wmesa.c @@ -22,8 +22,17 @@ /* * $Log: wmesaBackup.c,v $ - * Revision 1.1 1999/08/19 00:55:42 jtg - * Initial revision + * Revision 1.2 2000/11/05 18:41:00 keithw + * - Changes for new software rasterizer modules + * - Remove support for choosing software fallbacks from core code + * - Remove partial fallback code from vbrender.c -- drivers are now + * expected to be able to find a triangle/quad function for every state, + * even if they have to use _swsetup_Triangle or _swsetup_Quad. + * - Marked derived variables in the GLcontext struct with a leading + * underscore '_'. + * + * Revision 1.1.1.1 1999/08/19 00:55:42 jtg + * Imported sources * * Revision 1.1 1999/01/03 03:08:57 brianp * Initial revision @@ -685,7 +694,7 @@ static void fast_rgb_points( GLcontext* ctx, GLuint first, GLuint last ) extern points_func choose_points_function( GLcontext* ctx ) { STARTPROFILE - if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->RasterMask==0 + if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->_RasterMask==0 && !ctx->Texture.Enabled && ctx->Visual->RGBAflag) { ENDPROFILE(choose_points_function) return fast_rgb_points; @@ -743,7 +752,7 @@ static line_func choose_line_function( GLcontext* ctx ) { STARTPROFILE if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag - && ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0 + && ctx->Light.ShadeModel==GL_FLAT && ctx->_RasterMask==0 && !ctx->Texture.Enabled && Current->rgb_flag) { ENDPROFILE(choose_line_function) return fast_flat_rgb_line; @@ -2777,7 +2786,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) if (!wmesa->db_flag) return NULL; /*if (wmesa->xm_buffer->buffer==XIMAGE)*/ { if ( ctx->Light.ShadeModel==GL_SMOOTH - && ctx->RasterMask==DEPTH_BIT + && ctx->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Polygon.StippleFlag==GL_FALSE) { @@ -2797,7 +2806,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) } } if ( ctx->Light.ShadeModel==GL_FLAT - && ctx->RasterMask==DEPTH_BIT + && ctx->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Polygon.StippleFlag==GL_FALSE) { @@ -2816,7 +2825,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) return NULL; } } - if ( ctx->RasterMask==0 /* no depth test */ + if ( ctx->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_SMOOTH && ctx->Polygon.StippleFlag==GL_FALSE) { switch (wmesa->pixelformat) { @@ -2835,7 +2844,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) } } - if ( ctx->RasterMask==0 /* no depth test */ + if ( ctx->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_FLAT && ctx->Polygon.StippleFlag==GL_FALSE) { switch (wmesa->pixelformat) { diff --git a/src/mesa/drivers/windows/wmesaOld.c b/src/mesa/drivers/windows/wmesaOld.c index afaeecebcf4..801d5724e7e 100644 --- a/src/mesa/drivers/windows/wmesaOld.c +++ b/src/mesa/drivers/windows/wmesaOld.c @@ -20,8 +20,17 @@ /* * $Log: wmesaOld.c,v $ - * Revision 1.1 1999/08/19 00:55:42 jtg - * Initial revision + * Revision 1.2 2000/11/05 18:41:00 keithw + * - Changes for new software rasterizer modules + * - Remove support for choosing software fallbacks from core code + * - Remove partial fallback code from vbrender.c -- drivers are now + * expected to be able to find a triangle/quad function for every state, + * even if they have to use _swsetup_Triangle or _swsetup_Quad. + * - Marked derived variables in the GLcontext struct with a leading + * underscore '_'. + * + * Revision 1.1.1.1 1999/08/19 00:55:42 jtg + * Imported sources * * Revision 1.2 1999/01/03 03:08:57 brianp * Ted Jump's changes @@ -668,7 +677,7 @@ static void fast_rgb_points( GLcontext* ctx, GLuint first, GLuint last ) extern points_func choose_points_function( GLcontext* ctx ) { STARTPROFILE - if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->RasterMask==0 + if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->_RasterMask==0 && !ctx->Texture.Enabled && ctx->Visual->RGBAflag) { ENDPROFILE(choose_points_function) return fast_rgb_points; @@ -726,7 +735,7 @@ static line_func choose_line_function( GLcontext* ctx ) { STARTPROFILE if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag - && ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0 + && ctx->Light.ShadeModel==GL_FLAT && ctx->_RasterMask==0 && !ctx->Texture.Enabled && Current->rgb_flag) { ENDPROFILE(choose_line_function) return fast_flat_rgb_line; @@ -2635,7 +2644,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) if (!wmesa->db_flag) return NULL; /*if (wmesa->xm_buffer->buffer==XIMAGE)*/ { if ( ctx->Light.ShadeModel==GL_SMOOTH - && ctx->RasterMask==DEPTH_BIT + && ctx->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Polygon.StippleFlag==GL_FALSE) { @@ -2655,7 +2664,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) } } if ( ctx->Light.ShadeModel==GL_FLAT - && ctx->RasterMask==DEPTH_BIT + && ctx->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Polygon.StippleFlag==GL_FALSE) { @@ -2674,7 +2683,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) return NULL; } } - if ( ctx->RasterMask==0 /* no depth test */ + if ( ctx->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_SMOOTH && ctx->Polygon.StippleFlag==GL_FALSE) { switch (wmesa->pixelformat) { @@ -2693,7 +2702,7 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) } } - if ( ctx->RasterMask==0 /* no depth test */ + if ( ctx->_RasterMask==0 /* no depth test */ && ctx->Light.ShadeModel==GL_FLAT && ctx->Polygon.StippleFlag==GL_FALSE) { switch (wmesa->pixelformat) { diff --git a/src/mesa/drivers/windows/wmesa_stereo.c b/src/mesa/drivers/windows/wmesa_stereo.c index 70251ae877e..d3787909ee9 100644 --- a/src/mesa/drivers/windows/wmesa_stereo.c +++ b/src/mesa/drivers/windows/wmesa_stereo.c @@ -419,8 +419,8 @@ static void fast_rgb_points( GLcontext* ctx, GLuint first, GLuint last ) extern points_func choose_points_function( GLcontext* ctx ) { STARTPROFILE - if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->RasterMask==0 - && !ctx->Texture.ReallyEnabled && ctx->Visual->RGBAflag) { + if (ctx->Point.Size==1.0 && !ctx->Point.SmoothFlag && ctx->_RasterMask==0 + && !ctx->Texture._ReallyEnabled && ctx->Visual->RGBAflag) { ENDPROFILE(choose_points_function) return fast_rgb_points; } @@ -477,8 +477,8 @@ static line_func choose_line_function( GLcontext* ctx ) { STARTPROFILE if (ctx->Line.Width==1.0 && !ctx->Line.SmoothFlag && !ctx->Line.StippleFlag - && ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0 - && !ctx->Texture.ReallyEnabled && Current->rgb_flag) { + && ctx->Light.ShadeModel==GL_FLAT && ctx->_RasterMask==0 + && !ctx->Texture._ReallyEnabled && Current->rgb_flag) { ENDPROFILE(choose_line_function) return fast_flat_rgb_line; } @@ -589,9 +589,9 @@ static triangle_func choose_triangle_function( GLcontext *ctx ) { if (ctx->Polygon.SmoothFlag) return NULL; if (ctx->Polygon.StippleFlag) return NULL; - if (ctx->Texture.ReallyEnabled) return NULL; + if (ctx->Texture._ReallyEnabled) return NULL; - if (ctx->RasterMask==DEPTH_BIT + if (ctx->_RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE && ctx->Visual->RGBAflag) { @@ -659,8 +659,8 @@ static polygon_func choose_polygon_function( GLcontext* ctx ) { STARTPROFILE if (!ctx->Polygon.SmoothFlag && !ctx->Polygon.StippleFlag - && ctx->Light.ShadeModel==GL_FLAT && ctx->RasterMask==0 - && !ctx->Texture.ReallyEnabled && Current->rgb_flag==GL_TRUE) { + && ctx->Light.ShadeModel==GL_FLAT && ctx->_RasterMask==0 + && !ctx->Texture._ReallyEnabled && Current->rgb_flag==GL_TRUE) { ENDPROFILE(choose_polygon_function) return fast_flat_rgb_polygon; } diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11 index 32326d6d5ed..4dbab5b4bea 100644 --- a/src/mesa/main/Makefile.X11 +++ b/src/mesa/main/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.27 2000/10/31 18:09:44 keithw Exp $ +# $Id: Makefile.X11,v 1.28 2000/11/05 18:40:57 keithw Exp $ # Mesa 3-D graphics library # Version: 3.5 @@ -108,6 +108,7 @@ CORE_SOURCES = \ swrast/s_context.c \ swrast/s_depth.c \ swrast/s_drawpix.c \ + swrast/s_feedback.c \ swrast/s_fog.c \ swrast/s_imaging.c \ swrast/s_lines.c \ @@ -123,11 +124,27 @@ CORE_SOURCES = \ swrast/s_stencil.c \ swrast/s_texture.c \ swrast/s_triangle.c \ - swrast/s_zoom.c + swrast/s_zoom.c \ + swrast_setup/ss_context.c \ + swrast_setup/ss_triangle.c \ + swrast_setup/ss_vb.c + + DRIVER_SOURCES = \ + FX/fxapi.c \ + FX/fxdd.c \ + FX/fxddspan.c \ + FX/fxddtex.c \ + FX/fxfastpath.c \ + FX/fxpipeline.c \ + FX/fxsetup.c \ + FX/fxtexman.c \ + FX/fxtrifuncs.c \ + FX/fxvsetup.c \ + FX/fxglidew.c \ X/glxapi.c \ X/fakeglx.c \ X/xfonts.c \ @@ -142,20 +159,6 @@ DRIVER_SOURCES = \ SVGA/svgamesa16.c \ SVGA/svgamesa24.c \ SVGA/svgamesa32.c \ - FX/fxapi.c \ - FX/fxclip.c \ - FX/fxdd.c \ - FX/fxddspan.c \ - FX/fxddtex.c \ - FX/fxfastpath.c \ - FX/fxpipeline.c \ - FX/fxrender.c \ - FX/fxsanity.c \ - FX/fxsetup.c \ - FX/fxtexman.c \ - FX/fxtrifuncs.c \ - FX/fxvsetup.c \ - FX/fxglidew.c \ Trace/tr_2string.c \ Trace/tr_attrib.c \ Trace/tr_context.c \ @@ -170,8 +173,8 @@ ASM_SOURCES = ADDITIONAL_OBJ = OBJECTS = $(ASM_SOURCES:.S=.o) \ - $(CORE_SOURCES:.c=.o) \ $(DRIVER_SOURCES:.c=.o) \ + $(CORE_SOURCES:.c=.o) \ $(ADDITIONAL_OBJ) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index cb894a86a9a..66557b1066b 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.32 2000/10/30 16:32:42 brianp Exp $ */ +/* $Id: attrib.c,v 1.33 2000/11/05 18:40:57 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -85,12 +85,10 @@ copy_texobj_state( struct gl_texture_object *dest, dest->MaxLod = src->MaxLod; dest->BaseLevel = src->BaseLevel; dest->MaxLevel = src->MaxLevel; - dest->P = src->P; - dest->M = src->M; - dest->MinMagThresh = src->MinMagThresh; + dest->_P = src->_P; + dest->_M = src->_M; dest->Palette = src->Palette; dest->Complete = src->Complete; - dest->SampleFunc = src->SampleFunc; } @@ -666,8 +664,8 @@ _mesa_PopAttrib(void) (*ctx->Driver.Fogfv)( ctx, GL_FOG_INDEX, &index ); (*ctx->Driver.Fogfv)( ctx, GL_FOG_COLOR, ctx->Fog.Color ); } - ctx->Enabled &= ~ENABLE_FOG; - if (ctx->Fog.Enabled) ctx->Enabled |= ENABLE_FOG; + ctx->_Enabled &= ~ENABLE_FOG; + if (ctx->Fog.Enabled) ctx->_Enabled |= ENABLE_FOG; } break; case GL_HINT_BIT: @@ -697,14 +695,14 @@ _mesa_PopAttrib(void) (*ctx->Driver.Enable)( ctx, GL_LIGHTING, ctx->Light.Enabled ); } if (ctx->Light.ShadeModel == GL_FLAT) - ctx->TriangleCaps |= DD_FLATSHADE; + ctx->_TriangleCaps |= DD_FLATSHADE; else - ctx->TriangleCaps &= ~DD_FLATSHADE; + ctx->_TriangleCaps &= ~DD_FLATSHADE; if (ctx->Driver.ShadeModel) (*ctx->Driver.ShadeModel)(ctx, ctx->Light.ShadeModel); - ctx->Enabled &= ~ENABLE_LIGHT; + ctx->_Enabled &= ~ENABLE_LIGHT; if (ctx->Light.Enabled && !is_empty_list(&ctx->Light.EnabledList)) - ctx->Enabled |= ENABLE_LIGHT; + ctx->_Enabled |= ENABLE_LIGHT; break; case GL_LINE_BIT: MEMCPY( &ctx->Line, attr->data, sizeof(struct gl_line_attrib) ); @@ -787,9 +785,9 @@ _mesa_PopAttrib(void) (*ctx->Driver.ClearStencil)( ctx, ctx->Stencil.Clear ); if (ctx->Driver.Enable) (*ctx->Driver.Enable)( ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled ); - ctx->TriangleCaps &= ~DD_STENCIL; + ctx->_TriangleCaps &= ~DD_STENCIL; if (ctx->Stencil.Enabled) - ctx->TriangleCaps |= DD_STENCIL; + ctx->_TriangleCaps |= DD_STENCIL; break; case GL_TRANSFORM_BIT: @@ -800,9 +798,9 @@ _mesa_PopAttrib(void) (*ctx->Driver.Enable)( ctx, GL_NORMALIZE, ctx->Transform.Normalize ); (*ctx->Driver.Enable)( ctx, GL_RESCALE_NORMAL_EXT, ctx->Transform.RescaleNormals ); } - ctx->Enabled &= ~(ENABLE_NORMALIZE|ENABLE_RESCALE); - if (ctx->Transform.Normalize) ctx->Enabled |= ENABLE_NORMALIZE; - if (ctx->Transform.RescaleNormals) ctx->Enabled |= ENABLE_RESCALE; + ctx->_Enabled &= ~(ENABLE_NORMALIZE|ENABLE_RESCALE); + if (ctx->Transform.Normalize) ctx->_Enabled |= ENABLE_NORMALIZE; + if (ctx->Transform.RescaleNormals) ctx->_Enabled |= ENABLE_RESCALE; break; case GL_TEXTURE_BIT: /* Take care of texture object reference counters */ diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 91267cda7f0..be7baf35470 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -1,4 +1,4 @@ -/* $Id: blend.c,v 1.24 2000/10/31 18:09:44 keithw Exp $ */ +/* $Id: blend.c,v 1.25 2000/11/05 18:40:57 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -108,7 +108,6 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) (*ctx->Driver.BlendFunc)( ctx, sfactor, dfactor ); } - ctx->Color.BlendFunc = NULL; ctx->NewState |= _NEW_COLOR; } @@ -238,7 +237,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, return; } - ctx->Color.BlendFunc = NULL; ctx->NewState |= _NEW_COLOR; if (ctx->Driver.BlendFuncSeparate) { @@ -299,7 +297,6 @@ _mesa_BlendEquation( GLenum mode ) ctx->Color.ColorLogicOpEnabled = GL_FALSE; } - ctx->Color.BlendFunc = NULL; ctx->NewState |= _NEW_COLOR; if (ctx->Driver.BlendEquation) diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c index 28d4e33daa1..19675552ab4 100644 --- a/src/mesa/main/clip.c +++ b/src/mesa/main/clip.c @@ -1,4 +1,4 @@ -/* $Id: clip.c,v 1.12 2000/10/30 13:31:59 keithw Exp $ */ +/* $Id: clip.c,v 1.13 2000/11/05 18:40:57 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -206,7 +206,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) if (ctx->ProjectionMatrix.flags & MAT_DIRTY_ALL_OVER) { gl_matrix_analyze( &ctx->ProjectionMatrix ); } - gl_transform_vector( ctx->Transform.ClipUserPlane[p], + gl_transform_vector( ctx->Transform._ClipUserPlane[p], ctx->Transform.EyeUserPlane[p], ctx->ProjectionMatrix.inv ); } @@ -221,7 +221,7 @@ void gl_update_userclip( GLcontext *ctx ) for (p = 0 ; p < MAX_CLIP_PLANES ; p++) { if (ctx->Transform.ClipEnabled[p]) { - gl_transform_vector( ctx->Transform.ClipUserPlane[p], + gl_transform_vector( ctx->Transform._ClipUserPlane[p], ctx->Transform.EyeUserPlane[p], ctx->ProjectionMatrix.inv ); } @@ -287,10 +287,10 @@ GLuint gl_userclip_point( GLcontext* ctx, const GLfloat v[] ) for (p=0;pTransform.ClipEnabled[p]) { - GLfloat dot = v[0] * ctx->Transform.ClipUserPlane[p][0] - + v[1] * ctx->Transform.ClipUserPlane[p][1] - + v[2] * ctx->Transform.ClipUserPlane[p][2] - + v[3] * ctx->Transform.ClipUserPlane[p][3]; + GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0] + + v[1] * ctx->Transform._ClipUserPlane[p][1] + + v[2] * ctx->Transform._ClipUserPlane[p][2] + + v[3] * ctx->Transform._ClipUserPlane[p][3]; if (dot < 0.0F) { return 0; } @@ -380,33 +380,33 @@ void gl_update_clipmask( GLcontext *ctx ) { mask |= CLIP_RGBA0; - if (ctx->TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_SEPERATE_SPECULAR)) + if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_SEPERATE_SPECULAR)) mask |= CLIP_RGBA1; - if (ctx->Texture.ReallyEnabled & 0xf0) + if (ctx->Texture._ReallyEnabled & 0xf0) mask |= CLIP_TEX1|CLIP_TEX0; - if (ctx->Texture.ReallyEnabled & 0xf) + if (ctx->Texture._ReallyEnabled & 0xf) mask |= CLIP_TEX0; } else if (ctx->Light.ShadeModel==GL_SMOOTH) { mask |= CLIP_INDEX0; - if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) + if (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) mask |= CLIP_INDEX1; } if (ctx->Fog.Enabled) mask |= CLIP_FOG_COORD; - ctx->ClipInterpFunc = clip_interp_tab[mask]; - ctx->poly_clip_tab = gl_poly_clip_tab[0]; - ctx->line_clip_tab = gl_line_clip_tab[0]; + ctx->_ClipInterpFunc = clip_interp_tab[mask]; + ctx->_poly_clip_tab = gl_poly_clip_tab[0]; + ctx->_line_clip_tab = gl_line_clip_tab[0]; - if (ctx->TriangleCaps & DD_TRI_UNFILLED) { - ctx->poly_clip_tab = gl_poly_clip_tab[1]; - ctx->line_clip_tab = gl_line_clip_tab[0]; + if (ctx->_TriangleCaps & DD_TRI_UNFILLED) { + ctx->_poly_clip_tab = gl_poly_clip_tab[1]; + ctx->_line_clip_tab = gl_line_clip_tab[0]; } } @@ -426,10 +426,10 @@ static void NAME( struct vertex_buffer *VB ) \ for (bit = 1, p = 0; p < MAX_CLIP_PLANES ; p++, bit *=2) \ if (ctx->Transform.ClipEnabled[p]) { \ GLuint nr = 0; \ - const GLfloat a = ctx->Transform.ClipUserPlane[p][0]; \ - const GLfloat b = ctx->Transform.ClipUserPlane[p][1]; \ - const GLfloat c = ctx->Transform.ClipUserPlane[p][2]; \ - const GLfloat d = ctx->Transform.ClipUserPlane[p][3]; \ + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; \ + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; \ + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; \ + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; \ GLfloat *coord = VB->ClipPtr->start; \ GLuint stride = VB->ClipPtr->stride; \ \ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 047858af1d0..363793a574c 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.102 2000/10/31 18:09:44 keithw Exp $ */ +/* $Id: context.c,v 1.103 2000/11/05 18:40:57 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -65,7 +65,6 @@ #include "vbxform.h" #include "vertices.h" #include "xform.h" -#include "swrast/swrast.h" #endif #if defined(MESA_TRACE) @@ -590,7 +589,7 @@ init_light( struct gl_light *l, GLuint n ) l->SpotExponent = 0.0; gl_compute_spot_exp_table( l ); l->SpotCutoff = 180.0; - l->CosCutoff = 0.0; /* KW: -ve values not admitted */ + l->_CosCutoff = 0.0; /* KW: -ve values not admitted */ l->ConstantAttenuation = 1.0; l->LinearAttenuation = 0.0; l->QuadraticAttenuation = 0.0; @@ -653,10 +652,10 @@ init_texture_unit( GLcontext *ctx, GLuint unit ) texUnit->GenModeT = GL_EYE_LINEAR; texUnit->GenModeR = GL_EYE_LINEAR; texUnit->GenModeQ = GL_EYE_LINEAR; - texUnit->GenBitS = TEXGEN_EYE_LINEAR; - texUnit->GenBitT = TEXGEN_EYE_LINEAR; - texUnit->GenBitR = TEXGEN_EYE_LINEAR; - texUnit->GenBitQ = TEXGEN_EYE_LINEAR; + texUnit->_GenBitS = TEXGEN_EYE_LINEAR; + texUnit->_GenBitT = TEXGEN_EYE_LINEAR; + texUnit->_GenBitR = TEXGEN_EYE_LINEAR; + texUnit->_GenBitQ = TEXGEN_EYE_LINEAR; /* Yes, these plane coefficients are correct! */ ASSIGN_4V( texUnit->ObjectPlaneS, 1.0, 0.0, 0.0, 0.0 ); @@ -823,7 +822,7 @@ init_attrib_groups( GLcontext *ctx ) gl_matrix_ctr( &ctx->ProjectionMatrix ); gl_matrix_alloc_inv( &ctx->ProjectionMatrix ); - gl_matrix_ctr( &ctx->ModelProjectMatrix ); + gl_matrix_ctr( &ctx->_ModelProjectMatrix ); ctx->ProjectionStackDepth = 0; ctx->NearFarStack[0][0] = 1.0; /* These values seem weird by make */ @@ -872,7 +871,6 @@ init_attrib_groups( GLcontext *ctx ) ctx->Color.BlendSrcA = GL_ONE; ctx->Color.BlendDstA = GL_ZERO; ctx->Color.BlendEquation = GL_FUNC_ADD_EXT; - ctx->Color.BlendFunc = NULL; /* this pointer set only when needed */ ASSIGN_4V( ctx->Color.BlendColor, 0.0, 0.0, 0.0, 0.0 ); ctx->Color.IndexLogicOpEnabled = GL_FALSE; ctx->Color.ColorLogicOpEnabled = GL_FALSE; @@ -1055,17 +1053,17 @@ init_attrib_groups( GLcontext *ctx ) ctx->Light.ColorMaterialEnabled = GL_FALSE; /* Lighting miscellaneous */ - ctx->ShineTabList = MALLOC_STRUCT( gl_shine_tab ); - make_empty_list( ctx->ShineTabList ); + ctx->_ShineTabList = MALLOC_STRUCT( gl_shine_tab ); + make_empty_list( ctx->_ShineTabList ); for (i = 0 ; i < 10 ; i++) { struct gl_shine_tab *s = MALLOC_STRUCT( gl_shine_tab ); s->shininess = -1; s->refcount = 0; - insert_at_tail( ctx->ShineTabList, s ); + insert_at_tail( ctx->_ShineTabList, s ); } for (i = 0 ; i < 4 ; i++) { - ctx->ShineTable[i] = ctx->ShineTabList->prev; - ctx->ShineTable[i]->refcount++; + ctx->_ShineTable[i] = ctx->_ShineTabList->prev; + ctx->_ShineTable[i]->refcount++; } gl_compute_shine_table( ctx, 0, ctx->Light.Material[0].Shininess ); @@ -1160,7 +1158,7 @@ init_attrib_groups( GLcontext *ctx ) ctx->Point.Params[0] = 1.0; ctx->Point.Params[1] = 0.0; ctx->Point.Params[2] = 0.0; - ctx->Point.Attenuated = GL_FALSE; + ctx->Point._Attenuated = GL_FALSE; ctx->Point.MinSize = 0.0; ctx->Point.MaxSize = (GLfloat) MAX_POINT_SIZE; ctx->Point.Threshold = 1.0; @@ -1172,7 +1170,7 @@ init_attrib_groups( GLcontext *ctx ) ctx->Polygon.FrontBit = 0; ctx->Polygon.FrontMode = GL_FILL; ctx->Polygon.BackMode = GL_FILL; - ctx->Polygon.Unfilled = GL_FALSE; + ctx->Polygon._Unfilled = GL_FALSE; ctx->Polygon.SmoothFlag = GL_FALSE; ctx->Polygon.StippleFlag = GL_FALSE; ctx->Polygon.OffsetFactor = 0.0F; @@ -1206,7 +1204,7 @@ init_attrib_groups( GLcontext *ctx ) /* Texture group */ ctx->Texture.CurrentUnit = 0; /* multitexture */ ctx->Texture.CurrentTransformUnit = 0; /* multitexture */ - ctx->Texture.ReallyEnabled = 0; + ctx->Texture._ReallyEnabled = 0; for (i=0; iTexture.SharedPalette = GL_FALSE; @@ -1220,7 +1218,7 @@ init_attrib_groups( GLcontext *ctx ) ctx->Transform.ClipEnabled[i] = GL_FALSE; ASSIGN_4V( ctx->Transform.EyeUserPlane[i], 0.0, 0.0, 0.0, 0.0 ); } - ctx->Transform.AnyClip = GL_FALSE; + ctx->Transform._AnyClip = GL_FALSE; /* Viewport group */ ctx->Viewport.X = 0; @@ -1229,17 +1227,17 @@ init_attrib_groups( GLcontext *ctx ) ctx->Viewport.Height = 0; ctx->Viewport.Near = 0.0; ctx->Viewport.Far = 1.0; - gl_matrix_ctr(&ctx->Viewport.WindowMap); + gl_matrix_ctr(&ctx->Viewport._WindowMap); #define Sz 10 #define Tz 14 - ctx->Viewport.WindowMap.m[Sz] = 0.5 * ctx->Visual.DepthMaxF; - ctx->Viewport.WindowMap.m[Tz] = 0.5 * ctx->Visual.DepthMaxF; + ctx->Viewport._WindowMap.m[Sz] = 0.5 * ctx->Visual.DepthMaxF; + ctx->Viewport._WindowMap.m[Tz] = 0.5 * ctx->Visual.DepthMaxF; #undef Sz #undef Tz - ctx->Viewport.WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION; - ctx->Viewport.WindowMap.type = MATRIX_3D_NO_ROT; + ctx->Viewport._WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION; + ctx->Viewport._WindowMap.type = MATRIX_3D_NO_ROT; /* Vertex arrays */ ctx->Array.Vertex.Size = 4; @@ -1338,14 +1336,12 @@ init_attrib_groups( GLcontext *ctx ) /* Miscellaneous */ ctx->NewState = _NEW_ALL; ctx->RenderMode = GL_RENDER; - ctx->StippleCounter = 0; - ctx->NeedNormals = GL_FALSE; - ctx->DoViewportMapping = GL_TRUE; - ctx->ImageTransferState = 0; + ctx->_NeedNormals = GL_FALSE; + ctx->_ImageTransferState = 0; - ctx->NeedEyeCoords = GL_FALSE; - ctx->NeedEyeNormals = GL_FALSE; - ctx->vb_proj_matrix = &ctx->ModelProjectMatrix; + ctx->_NeedEyeCoords = GL_FALSE; + ctx->_NeedEyeNormals = GL_FALSE; + ctx->_vb_proj_matrix = &ctx->_ModelProjectMatrix; ctx->ErrorValue = (GLenum) GL_NO_ERROR; @@ -1470,11 +1466,6 @@ _mesa_initialize_context( GLcontext *ctx, } ctx->input = ctx->VB->IM; - if (!_swrast_create_context( ctx )) { - ALIGN_FREE( ctx->VB ); - return GL_FALSE; - } - if (share_list) { /* share the group of display lists of another context */ ctx->Shared = share_list->Shared; @@ -1484,7 +1475,6 @@ _mesa_initialize_context( GLcontext *ctx, ctx->Shared = alloc_shared_state(); if (!ctx->Shared) { ALIGN_FREE( ctx->VB ); - _swrast_destroy_context( ctx ); return GL_FALSE; } } @@ -1515,7 +1505,6 @@ _mesa_initialize_context( GLcontext *ctx, if (!alloc_proxy_textures(ctx)) { free_shared_state(ctx, ctx->Shared); ALIGN_FREE( ctx->VB ); - _swrast_destroy_context( ctx ); return GL_FALSE; } @@ -1543,7 +1532,6 @@ _mesa_initialize_context( GLcontext *ctx, if (!ctx->Exec || !ctx->Save) { free_shared_state(ctx, ctx->Shared); ALIGN_FREE( ctx->VB ); - _swrast_destroy_context( ctx ); if (ctx->Exec) FREE( ctx->Exec ); } @@ -1559,7 +1547,6 @@ _mesa_initialize_context( GLcontext *ctx, if (!(ctx->TraceCtx)) { free_shared_state(ctx, ctx->Shared); ALIGN_FREE( ctx->VB ); - _swrast_destroy_context( ctx ); FREE( ctx->Exec ); FREE( ctx->Save ); return GL_FALSE; @@ -1573,7 +1560,6 @@ _mesa_initialize_context( GLcontext *ctx, if (!(ctx->TraceCtx)) { free_shared_state(ctx, ctx->Shared); ALIGN_FREE( ctx->VB ); - _swrast_destroy_context( ctx ); FREE( ctx->Exec ); FREE( ctx->Save ); FREE( ctx->TraceCtx ); @@ -1647,8 +1633,6 @@ _mesa_free_context_data( GLcontext *ctx ) } } - _swrast_destroy_context( ctx ); - if (ctx->input != ctx->VB->IM) gl_immediate_free( ctx->input ); @@ -1663,10 +1647,10 @@ _mesa_free_context_data( GLcontext *ctx ) free_shared_state( ctx, ctx->Shared ); } - foreach_s( s, tmps, ctx->ShineTabList ) { + foreach_s( s, tmps, ctx->_ShineTabList ) { FREE( s ); } - FREE( ctx->ShineTabList ); + FREE( ctx->_ShineTabList ); /* Free proxy texture objects */ gl_free_texture_object( NULL, ctx->Texture.Proxy1D ); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 1b0aa8bc9c8..d38510889e2 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,4 +1,4 @@ -/* $Id: dd.h,v 1.37 2000/10/31 18:09:44 keithw Exp $ */ +/* $Id: dd.h,v 1.38 2000/11/05 18:40:57 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -109,9 +109,6 @@ struct gl_pipeline_stage; -/* Used by the GetParameteri device driver function */ -#define DD_HAVE_HARDWARE_FOG 3 - /* Mask bits sent to the driver Clear() function */ @@ -351,20 +348,6 @@ struct dd_function_table { * uses this. */ - GLint (*GetParameteri)( const GLcontext *ctx, GLint param ); - /* Query the device driver to get an integer parameter. - * Current parameters: - * DD_MAX_TEXTURE_SIZE return maximum texture size - * - * DD_MAX_TEXTURES number of texture sets/stages, usually 1 - * - * DD_HAVE_HARDWARE_FOG the driver should return 1 (0 otherwise) - * when the hardware support per fragment - * fog for free (like the Voodoo Graphics) - * so the Mesa core will start to ever use - * per fragment fog - */ - /*** *** For supporting hardware Z buffers: @@ -847,13 +830,6 @@ struct dd_function_table { * triangles and quads or triangles and polygons. */ - GLuint TriangleCaps; - /* Holds a list of the reasons why we might normally want to call - * render_triangle, but which are in fact implemented by the - * driver. The FX driver sets this to DD_TRI_CULL, and will soon - * implement DD_TRI_OFFSET. - */ - GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno ); /* Driver may request additional render passes by returning GL_TRUE * when this function is called. This function will be called diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 9689b795f12..d9758c52f1c 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -1,4 +1,4 @@ -/* $Id: depth.c,v 1.22 2000/10/31 18:09:44 keithw Exp $ */ +/* $Id: depth.c,v 1.23 2000/11/05 18:40:57 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -78,7 +78,7 @@ _mesa_DepthFunc( GLenum func ) if (ctx->Depth.Func != func) { ctx->Depth.Func = func; ctx->NewState |= _NEW_DEPTH; - ctx->TriangleCaps &= ~DD_Z_NEVER; + ctx->_TriangleCaps &= ~DD_Z_NEVER; if (ctx->Driver.DepthFunc) { (*ctx->Driver.DepthFunc)( ctx, func ); } @@ -88,7 +88,7 @@ _mesa_DepthFunc( GLenum func ) if (ctx->Depth.Func != func) { ctx->Depth.Func = func; ctx->NewState |= _NEW_DEPTH; - ctx->TriangleCaps |= DD_Z_NEVER; + ctx->_TriangleCaps |= DD_Z_NEVER; if (ctx->Driver.DepthFunc) { (*ctx->Driver.DepthFunc)( ctx, func ); } diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 20e507a61d9..3d21f95bea1 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.30 2000/10/30 16:32:43 brianp Exp $ */ +/* $Id: enable.c,v 1.31 2000/11/05 18:40:57 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -95,19 +95,19 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->NewState |= _NEW_TRANSFORM; if (state) { - ctx->Enabled |= ENABLE_USERCLIP; - ctx->Transform.AnyClip++; + ctx->_Enabled |= ENABLE_USERCLIP; + ctx->Transform._AnyClip++; if (ctx->ProjectionMatrix.flags & MAT_DIRTY_ALL_OVER) { gl_matrix_analyze( &ctx->ProjectionMatrix ); } - gl_transform_vector( ctx->Transform.ClipUserPlane[p], + gl_transform_vector( ctx->Transform._ClipUserPlane[p], ctx->Transform.EyeUserPlane[p], ctx->ProjectionMatrix.inv ); } else { - if (--ctx->Transform.AnyClip == 0) - ctx->Enabled &= ~ENABLE_USERCLIP; + if (--ctx->Transform._AnyClip == 0) + ctx->_Enabled &= ~ENABLE_USERCLIP; } } break; @@ -122,7 +122,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_CULL_FACE: if (ctx->Polygon.CullFlag!=state) { ctx->Polygon.CullFlag = state; - ctx->TriangleCaps ^= DD_TRI_CULL; +/* ctx->_TriangleCaps ^= DD_TRI_CULL; */ ctx->NewState |= _NEW_POLYGON; } break; @@ -149,7 +149,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_FOG: if (ctx->Fog.Enabled!=state) { ctx->Fog.Enabled = state; - ctx->Enabled ^= ENABLE_FOG; + ctx->_Enabled ^= ENABLE_FOG; ctx->NewState |= _NEW_FOG; } break; @@ -178,11 +178,11 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) insert_at_tail(&ctx->Light.EnabledList, &ctx->Light.Light[cap-GL_LIGHT0]); if (ctx->Light.Enabled) - ctx->Enabled |= ENABLE_LIGHT; + ctx->_Enabled |= ENABLE_LIGHT; } else { remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); if (is_empty_list(&ctx->Light.EnabledList)) - ctx->Enabled &= ~ENABLE_LIGHT; + ctx->_Enabled &= ~ENABLE_LIGHT; } ctx->NewState |= _NEW_LIGHT; @@ -191,23 +191,23 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_LIGHTING: if (ctx->Light.Enabled!=state) { ctx->Light.Enabled = state; - ctx->Enabled &= ~ENABLE_LIGHT; + ctx->_Enabled &= ~ENABLE_LIGHT; if (state) - ctx->Enabled |= ENABLE_LIGHT; + ctx->_Enabled |= ENABLE_LIGHT; ctx->NewState |= _NEW_LIGHT; } break; case GL_LINE_SMOOTH: if (ctx->Line.SmoothFlag!=state) { ctx->Line.SmoothFlag = state; - ctx->TriangleCaps ^= DD_LINE_SMOOTH; + ctx->_TriangleCaps ^= DD_LINE_SMOOTH; ctx->NewState |= _NEW_LINE; } break; case GL_LINE_STIPPLE: if (ctx->Line.StippleFlag!=state) { ctx->Line.StippleFlag = state; - ctx->TriangleCaps ^= DD_LINE_STIPPLE; + ctx->_TriangleCaps ^= DD_LINE_STIPPLE; ctx->NewState |= _NEW_LINE; } break; @@ -303,27 +303,27 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) if (ctx->Transform.Normalize != state) { ctx->Transform.Normalize = state; ctx->NewState |= _NEW_TRANSFORM; - ctx->Enabled ^= ENABLE_NORMALIZE; + ctx->_Enabled ^= ENABLE_NORMALIZE; } break; case GL_POINT_SMOOTH: if (ctx->Point.SmoothFlag!=state) { ctx->Point.SmoothFlag = state; - ctx->TriangleCaps ^= DD_POINT_SMOOTH; + ctx->_TriangleCaps ^= DD_POINT_SMOOTH; ctx->NewState |= _NEW_POINT; } break; case GL_POLYGON_SMOOTH: if (ctx->Polygon.SmoothFlag!=state) { ctx->Polygon.SmoothFlag = state; - ctx->TriangleCaps ^= DD_TRI_SMOOTH; + ctx->_TriangleCaps ^= DD_TRI_SMOOTH; ctx->NewState |= _NEW_POLYGON; } break; case GL_POLYGON_STIPPLE: if (ctx->Polygon.StippleFlag!=state) { ctx->Polygon.StippleFlag = state; - ctx->TriangleCaps ^= DD_TRI_STIPPLE; + ctx->_TriangleCaps ^= DD_TRI_STIPPLE; ctx->NewState |= _NEW_POLYGON; } break; @@ -350,7 +350,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) if (ctx->Transform.RescaleNormals != state) { ctx->Transform.RescaleNormals = state; ctx->NewState |= _NEW_TRANSFORM; - ctx->Enabled ^= ENABLE_RESCALE; + ctx->_Enabled ^= ENABLE_RESCALE; } break; case GL_SCISSOR_TEST: @@ -371,7 +371,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) if (ctx->Stencil.Enabled!=state) { ctx->Stencil.Enabled = state; ctx->NewState |= _NEW_STENCIL; - ctx->TriangleCaps ^= DD_STENCIL; + ctx->_TriangleCaps ^= DD_STENCIL; } break; case GL_TEXTURE_1D: @@ -567,9 +567,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_COLOR_SUM_EXT: ctx->Fog.ColorSumEnabled = state; if (state) - SET_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR); + SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR) - CLEAR_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR); + CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); ctx->NewState |= _NEW_FOG; break; diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 438fbae4699..ea947e9fe49 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -1,4 +1,4 @@ -/* $Id: feedback.c,v 1.15 2000/10/31 18:09:44 keithw Exp $ */ +/* $Id: feedback.c,v 1.16 2000/11/05 18:40:57 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -156,123 +156,6 @@ void gl_feedback_vertex( GLcontext *ctx, } } - - -static void feedback_vertex( GLcontext *ctx, GLuint v, GLuint pv ) -{ - GLfloat win[4]; - GLfloat color[4]; - GLfloat tc[4]; - GLuint texUnit = ctx->Texture.CurrentTransformUnit; - const struct vertex_buffer *VB = ctx->VB; - GLuint index; - - win[0] = VB->Win.data[v][0]; - win[1] = VB->Win.data[v][1]; - win[2] = VB->Win.data[v][2] / ctx->Visual.DepthMaxF; - win[3] = 1.0 / VB->Win.data[v][3]; - - if (ctx->Light.ShadeModel == GL_SMOOTH) - pv = v; - - color[0] = CHAN_TO_FLOAT(VB->ColorPtr->data[pv][0]); - color[1] = CHAN_TO_FLOAT(VB->ColorPtr->data[pv][1]); - color[2] = CHAN_TO_FLOAT(VB->ColorPtr->data[pv][2]); - color[3] = CHAN_TO_FLOAT(VB->ColorPtr->data[pv][3]); - - if (VB->TexCoordPtr[texUnit]->size == 4 && - VB->TexCoordPtr[texUnit]->data[v][3] != 0.0) { - GLfloat invq = 1.0F / VB->TexCoordPtr[texUnit]->data[v][3]; - tc[0] = VB->TexCoordPtr[texUnit]->data[v][0] * invq; - tc[1] = VB->TexCoordPtr[texUnit]->data[v][1] * invq; - tc[2] = VB->TexCoordPtr[texUnit]->data[v][2] * invq; - tc[3] = VB->TexCoordPtr[texUnit]->data[v][3]; - } - else { - ASSIGN_4V(tc, 0,0,0,1); - COPY_SZ_4V(tc, - VB->TexCoordPtr[texUnit]->size, - VB->TexCoordPtr[texUnit]->data[v]); - } - - if (VB->IndexPtr) - index = VB->IndexPtr->data[v]; - else - index = 0; - - gl_feedback_vertex( ctx, win, color, index, tc ); -} - - -static GLboolean cull_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, GLuint pv ) -{ - struct vertex_buffer *VB = ctx->VB; - GLfloat (*win)[4] = VB->Win.data; - GLfloat ex = win[v1][0] - win[v0][0]; - GLfloat ey = win[v1][1] - win[v0][1]; - GLfloat fx = win[v2][0] - win[v0][0]; - GLfloat fy = win[v2][1] - win[v0][1]; - GLfloat c = ex*fy-ey*fx; - - if (c * ctx->backface_sign > 0) - return 0; - - return 1; -} - - - -/* - * Put triangle in feedback buffer. - */ -void gl_feedback_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, GLuint pv ) -{ - if (cull_triangle( ctx, v0, v1, v2, 0 )) { - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN ); - FEEDBACK_TOKEN( ctx, (GLfloat) 3 ); /* three vertices */ - - feedback_vertex( ctx, v0, pv ); - feedback_vertex( ctx, v1, pv ); - feedback_vertex( ctx, v2, pv ); - } -} - - -void gl_feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ) -{ - GLenum token = GL_LINE_TOKEN; - - if (ctx->StippleCounter==0) - token = GL_LINE_RESET_TOKEN; - - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) token ); - - feedback_vertex( ctx, v1, pv ); - feedback_vertex( ctx, v2, pv ); - - ctx->StippleCounter++; -} - - -void gl_feedback_points( GLcontext *ctx, GLuint first, GLuint last ) -{ - const struct vertex_buffer *VB = ctx->VB; - GLuint i; - - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN ); - feedback_vertex( ctx, i, i ); - } - } -} - - - - - /**********************************************************************/ /* Selection */ /**********************************************************************/ @@ -320,43 +203,6 @@ void gl_update_hitflag( GLcontext *ctx, GLfloat z ) } } -void gl_select_triangle( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint v2, GLuint pv ) -{ - const struct vertex_buffer *VB = ctx->VB; - - if (cull_triangle( ctx, v0, v1, v2, 0 )) { - const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF; - gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs ); - gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs ); - gl_update_hitflag( ctx, VB->Win.data[v2][2] * zs ); - } -} - - -void gl_select_line( GLcontext *ctx, - GLuint v0, GLuint v1, GLuint pv ) -{ - const struct vertex_buffer *VB = ctx->VB; - const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF; - gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs ); - gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs ); -} - - -void gl_select_points( GLcontext *ctx, GLuint first, GLuint last ) -{ - struct vertex_buffer *VB = ctx->VB; - const GLfloat zs = 1.0F / ctx->Visual.DepthMaxF; - GLuint i; - - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - gl_update_hitflag( ctx, VB->Win.data[i][2] * zs ); - } - } -} - static void write_hit_record( GLcontext *ctx ) { @@ -494,7 +340,7 @@ _mesa_RenderMode( GLenum mode ) if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glRenderMode %s\n", gl_lookup_enum_by_nr(mode)); - ctx->TriangleCaps &= ~(DD_FEEDBACK|DD_SELECT); + ctx->_TriangleCaps &= ~(DD_FEEDBACK|DD_SELECT); switch (ctx->RenderMode) { case GL_RENDER: @@ -539,14 +385,14 @@ _mesa_RenderMode( GLenum mode ) case GL_RENDER: break; case GL_SELECT: - ctx->TriangleCaps |= DD_SELECT; + ctx->_TriangleCaps |= DD_SELECT; if (ctx->Select.BufferSize==0) { /* haven't called glSelectBuffer yet */ gl_error( ctx, GL_INVALID_OPERATION, "glRenderMode" ); } break; case GL_FEEDBACK: - ctx->TriangleCaps |= DD_FEEDBACK; + ctx->_TriangleCaps |= DD_FEEDBACK; if (ctx->Feedback.BufferSize==0) { /* haven't called glFeedbackBuffer yet */ gl_error( ctx, GL_INVALID_OPERATION, "glRenderMode" ); diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h index 1909009b565..3e95bcb4e28 100644 --- a/src/mesa/main/feedback.h +++ b/src/mesa/main/feedback.h @@ -1,4 +1,4 @@ -/* $Id: feedback.h,v 1.3 1999/11/11 01:22:26 brianp Exp $ */ +/* $Id: feedback.h,v 1.4 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -74,15 +74,5 @@ extern GLint _mesa_RenderMode( GLenum mode ); -extern void gl_feedback_points( GLcontext *ctx, GLuint first, GLuint last ); -extern void gl_feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ); -extern void gl_feedback_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ); - -extern void gl_select_points( GLcontext *ctx, GLuint first, GLuint last ); -extern void gl_select_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ); -extern void gl_select_triangle( GLcontext *ctx, GLuint v0, GLuint v1, - GLuint v2, GLuint pv ); - #endif diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index b7795759f55..97bf52fc998 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -1,4 +1,4 @@ -/* $Id: fog.c,v 1.27 2000/10/31 18:09:44 keithw Exp $ */ +/* $Id: fog.c,v 1.28 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -154,7 +154,7 @@ static GLvector1f *get_fogcoord_ptr( GLcontext *ctx, GLvector1f *tmp ) struct vertex_buffer *VB = ctx->VB; if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) { - if (!ctx->NeedEyeCoords) { + if (!ctx->_NeedEyeCoords) { GLfloat *m = ctx->ModelView.m; GLfloat plane[4]; diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 710c90e0cd7..123ae89adee 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,4 +1,4 @@ -/* $Id: light.c,v 1.22 2000/10/30 13:32:00 keithw Exp $ */ +/* $Id: light.c,v 1.23 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -63,9 +63,9 @@ _mesa_ShadeModel( GLenum mode ) if (ctx->Light.ShadeModel != mode) { ctx->Light.ShadeModel = mode; if (ctx->Light.ShadeModel == GL_FLAT) - SET_BITS(ctx->TriangleCaps, DD_FLATSHADE); + SET_BITS(ctx->_TriangleCaps, DD_FLATSHADE); else - CLEAR_BITS(ctx->TriangleCaps, DD_FLATSHADE); + CLEAR_BITS(ctx->_TriangleCaps, DD_FLATSHADE); ctx->NewState |= _NEW_LIGHT; @@ -150,9 +150,9 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) return; } ctx->Light.Light[l].SpotCutoff = params[0]; - ctx->Light.Light[l].CosCutoff = cos(params[0]*DEG2RAD); - if (ctx->Light.Light[l].CosCutoff < 0) - ctx->Light.Light[l].CosCutoff = 0; + ctx->Light.Light[l]._CosCutoff = cos(params[0]*DEG2RAD); + if (ctx->Light.Light[l]._CosCutoff < 0) + ctx->Light.Light[l]._CosCutoff = 0; nParams = 1; break; case GL_CONSTANT_ATTENUATION: @@ -389,11 +389,11 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) if (params[0] == (GLfloat) GL_SINGLE_COLOR) { ctx->Light.Model.ColorControl = GL_SINGLE_COLOR; if (!ctx->Fog.ColorSumEnabled) - CLEAR_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR); + CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); } else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) { ctx->Light.Model.ColorControl = GL_SEPARATE_SPECULAR_COLOR; - SET_BITS(ctx->TriangleCaps, DD_SEPERATE_SPECULAR); + SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); } else { gl_error( ctx, GL_INVALID_ENUM, "glLightModel(param)" ); @@ -561,27 +561,27 @@ void gl_update_material( GLcontext *ctx, struct gl_material *mat = &ctx->Light.Material[0]; COPY_4FV( mat->Ambient, src[0].Ambient ); foreach (light, list) { - SCALE_3V( light->MatAmbient[0], light->Ambient, src[0].Ambient); + SCALE_3V( light->_MatAmbient[0], light->Ambient, src[0].Ambient); } } if (bitmask & BACK_AMBIENT_BIT) { struct gl_material *mat = &ctx->Light.Material[1]; COPY_4FV( mat->Ambient, src[1].Ambient ); foreach (light, list) { - SCALE_3V( light->MatAmbient[1], light->Ambient, src[1].Ambient); + SCALE_3V( light->_MatAmbient[1], light->Ambient, src[1].Ambient); } } /* update BaseColor = emission + scene's ambience * material's ambience */ if (bitmask & (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT)) { struct gl_material *mat = &ctx->Light.Material[0]; - COPY_3V( ctx->Light.BaseColor[0], mat->Emission ); - ACC_SCALE_3V( ctx->Light.BaseColor[0], mat->Ambient, ctx->Light.Model.Ambient ); + COPY_3V( ctx->Light._BaseColor[0], mat->Emission ); + ACC_SCALE_3V( ctx->Light._BaseColor[0], mat->Ambient, ctx->Light.Model.Ambient ); } if (bitmask & (BACK_EMISSION_BIT | BACK_AMBIENT_BIT)) { struct gl_material *mat = &ctx->Light.Material[1]; - COPY_3V( ctx->Light.BaseColor[1], mat->Emission ); - ACC_SCALE_3V( ctx->Light.BaseColor[1], mat->Ambient, ctx->Light.Model.Ambient ); + COPY_3V( ctx->Light._BaseColor[1], mat->Emission ); + ACC_SCALE_3V( ctx->Light._BaseColor[1], mat->Ambient, ctx->Light.Model.Ambient ); } /* update material diffuse values */ @@ -590,20 +590,20 @@ void gl_update_material( GLcontext *ctx, GLfloat tmp[4]; SUB_3V( tmp, src[0].Diffuse, mat->Diffuse ); foreach (light, list) { - ACC_SCALE_3V( light->MatDiffuse[0], light->Diffuse, tmp ); + ACC_SCALE_3V( light->_MatDiffuse[0], light->Diffuse, tmp ); } COPY_4FV( mat->Diffuse, src[0].Diffuse ); - FLOAT_COLOR_TO_CHAN(ctx->Light.BaseAlpha[0], mat->Diffuse[3]); + FLOAT_COLOR_TO_CHAN(ctx->Light._BaseAlpha[0], mat->Diffuse[3]); } if (bitmask & BACK_DIFFUSE_BIT) { struct gl_material *mat = &ctx->Light.Material[1]; GLfloat tmp[4]; SUB_3V( tmp, src[1].Diffuse, mat->Diffuse ); foreach (light, list) { - ACC_SCALE_3V( light->MatDiffuse[1], light->Diffuse, tmp ); + ACC_SCALE_3V( light->_MatDiffuse[1], light->Diffuse, tmp ); } COPY_4FV( mat->Diffuse, src[1].Diffuse ); - FLOAT_COLOR_TO_CHAN(ctx->Light.BaseAlpha[1], mat->Diffuse[3]); + FLOAT_COLOR_TO_CHAN(ctx->Light._BaseAlpha[1], mat->Diffuse[3]); } /* update material specular values */ @@ -612,10 +612,10 @@ void gl_update_material( GLcontext *ctx, GLfloat tmp[4]; SUB_3V( tmp, src[0].Specular, mat->Specular ); foreach (light, list) { - if (light->Flags & LIGHT_SPECULAR) { - ACC_SCALE_3V( light->MatSpecular[0], light->Specular, tmp ); - light->IsMatSpecular[0] = - (LEN_SQUARED_3FV(light->MatSpecular[0]) > 1e-16); + if (light->_Flags & LIGHT_SPECULAR) { + ACC_SCALE_3V( light->_MatSpecular[0], light->Specular, tmp ); + light->_IsMatSpecular[0] = + (LEN_SQUARED_3FV(light->_MatSpecular[0]) > 1e-16); } } COPY_4FV( mat->Specular, src[0].Specular ); @@ -625,10 +625,10 @@ void gl_update_material( GLcontext *ctx, GLfloat tmp[4]; SUB_3V( tmp, src[1].Specular, mat->Specular ); foreach (light, list) { - if (light->Flags & LIGHT_SPECULAR) { - ACC_SCALE_3V( light->MatSpecular[1], light->Specular, tmp ); - light->IsMatSpecular[1] = - (LEN_SQUARED_3FV(light->MatSpecular[1]) > 1e-16); + if (light->_Flags & LIGHT_SPECULAR) { + ACC_SCALE_3V( light->_MatSpecular[1], light->Specular, tmp ); + light->_IsMatSpecular[1] = + (LEN_SQUARED_3FV(light->_MatSpecular[1]) > 1e-16); } } COPY_4FV( mat->Specular, src[1].Specular ); @@ -712,11 +712,11 @@ void gl_update_color_material( GLcontext *ctx, COPY_4FV( mat->Emission, color ); } - /* update light->MatAmbient = light's ambient * material's ambient */ + /* update light->_MatAmbient = light's ambient * material's ambient */ if (bitmask & FRONT_AMBIENT_BIT) { struct gl_material *mat = &ctx->Light.Material[0]; foreach (light, list) { - SCALE_3V( light->MatAmbient[0], light->Ambient, color); + SCALE_3V( light->_MatAmbient[0], light->Ambient, color); } COPY_4FV( mat->Ambient, color ); } @@ -724,7 +724,7 @@ void gl_update_color_material( GLcontext *ctx, if (bitmask & BACK_AMBIENT_BIT) { struct gl_material *mat = &ctx->Light.Material[1]; foreach (light, list) { - SCALE_3V( light->MatAmbient[1], light->Ambient, color); + SCALE_3V( light->_MatAmbient[1], light->Ambient, color); } COPY_4FV( mat->Ambient, color ); } @@ -732,26 +732,26 @@ void gl_update_color_material( GLcontext *ctx, /* update BaseColor = emission + scene's ambience * material's ambience */ if (bitmask & (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT)) { struct gl_material *mat = &ctx->Light.Material[0]; - COPY_3V( ctx->Light.BaseColor[0], mat->Emission ); - ACC_SCALE_3V( ctx->Light.BaseColor[0], mat->Ambient, ctx->Light.Model.Ambient ); + COPY_3V( ctx->Light._BaseColor[0], mat->Emission ); + ACC_SCALE_3V( ctx->Light._BaseColor[0], mat->Ambient, ctx->Light.Model.Ambient ); } if (bitmask & (BACK_EMISSION_BIT | BACK_AMBIENT_BIT)) { struct gl_material *mat = &ctx->Light.Material[1]; - COPY_3V( ctx->Light.BaseColor[1], mat->Emission ); - ACC_SCALE_3V( ctx->Light.BaseColor[1], mat->Ambient, ctx->Light.Model.Ambient ); + COPY_3V( ctx->Light._BaseColor[1], mat->Emission ); + ACC_SCALE_3V( ctx->Light._BaseColor[1], mat->Ambient, ctx->Light.Model.Ambient ); } - /* update light->MatDiffuse = light's diffuse * material's diffuse */ + /* update light->_MatDiffuse = light's diffuse * material's diffuse */ if (bitmask & FRONT_DIFFUSE_BIT) { struct gl_material *mat = &ctx->Light.Material[0]; GLfloat tmp[4]; SUB_3V( tmp, color, mat->Diffuse ); foreach (light, list) { - ACC_SCALE_3V( light->MatDiffuse[0], light->Diffuse, tmp ); + ACC_SCALE_3V( light->_MatDiffuse[0], light->Diffuse, tmp ); } COPY_4FV( mat->Diffuse, color ); - FLOAT_COLOR_TO_CHAN(ctx->Light.BaseAlpha[0], mat->Diffuse[3]); + FLOAT_COLOR_TO_CHAN(ctx->Light._BaseAlpha[0], mat->Diffuse[3]); } if (bitmask & BACK_DIFFUSE_BIT) { @@ -759,22 +759,22 @@ void gl_update_color_material( GLcontext *ctx, GLfloat tmp[4]; SUB_3V( tmp, color, mat->Diffuse ); foreach (light, list) { - ACC_SCALE_3V( light->MatDiffuse[1], light->Diffuse, tmp ); + ACC_SCALE_3V( light->_MatDiffuse[1], light->Diffuse, tmp ); } COPY_4FV( mat->Diffuse, color ); - FLOAT_COLOR_TO_CHAN(ctx->Light.BaseAlpha[1], mat->Diffuse[3]); + FLOAT_COLOR_TO_CHAN(ctx->Light._BaseAlpha[1], mat->Diffuse[3]); } - /* update light->MatSpecular = light's specular * material's specular */ + /* update light->_MatSpecular = light's specular * material's specular */ if (bitmask & FRONT_SPECULAR_BIT) { struct gl_material *mat = &ctx->Light.Material[0]; GLfloat tmp[4]; SUB_3V( tmp, color, mat->Specular ); foreach (light, list) { - if (light->Flags & LIGHT_SPECULAR) { - ACC_SCALE_3V( light->MatSpecular[0], light->Specular, tmp ); - light->IsMatSpecular[0] = - (LEN_SQUARED_3FV(light->MatSpecular[0]) > 1e-16); + if (light->_Flags & LIGHT_SPECULAR) { + ACC_SCALE_3V( light->_MatSpecular[0], light->Specular, tmp ); + light->_IsMatSpecular[0] = + (LEN_SQUARED_3FV(light->_MatSpecular[0]) > 1e-16); } } COPY_4FV( mat->Specular, color ); @@ -785,10 +785,10 @@ void gl_update_color_material( GLcontext *ctx, GLfloat tmp[4]; SUB_3V( tmp, color, mat->Specular ); foreach (light, list) { - if (light->Flags & LIGHT_SPECULAR) { - ACC_SCALE_3V( light->MatSpecular[1], light->Specular, tmp ); - light->IsMatSpecular[1] = - (LEN_SQUARED_3FV(light->MatSpecular[1]) > 1e-16); + if (light->_Flags & LIGHT_SPECULAR) { + ACC_SCALE_3V( light->_MatSpecular[1], light->Specular, tmp ); + light->_IsMatSpecular[1] = + (LEN_SQUARED_3FV(light->_MatSpecular[1]) > 1e-16); } } COPY_4FV( mat->Specular, color ); @@ -1109,10 +1109,10 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) * IF P[3]==0 THEN * // light at infinity * IF local_viewer THEN - * VP_inf_norm = unit vector from V to P // Precompute + * _VP_inf_norm = unit vector from V to P // Precompute * ELSE * // eye at infinity - * h_inf_norm = Normalize( VP + <0,0,1> ) // Precompute + * _h_inf_norm = Normalize( VP + <0,0,1> ) // Precompute * ENDIF * ENDIF * @@ -1135,7 +1135,7 @@ gl_compute_spot_exp_table( struct gl_light *l ) GLdouble tmp = 0; GLint clamp = 0; - l->SpotExpTable[0][0] = 0.0; + l->_SpotExpTable[0][0] = 0.0; for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) { if (clamp == 0) { @@ -1145,12 +1145,12 @@ gl_compute_spot_exp_table( struct gl_light *l ) clamp = 1; } } - l->SpotExpTable[i][0] = tmp; + l->_SpotExpTable[i][0] = tmp; } for (i = 0; i < EXP_TABLE_SIZE - 1; i++) { - l->SpotExpTable[i][1] = l->SpotExpTable[i+1][0] - l->SpotExpTable[i][0]; + l->_SpotExpTable[i][1] = l->_SpotExpTable[i+1][0] - l->_SpotExpTable[i][0]; } - l->SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0; + l->_SpotExpTable[EXP_TABLE_SIZE-1][1] = 0.0; } @@ -1190,7 +1190,7 @@ void gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess ) { #define DISTSQR(a,b) ((a-b)*(a-b)) - struct gl_shine_tab *list = ctx->ShineTabList; + struct gl_shine_tab *list = ctx->_ShineTabList; struct gl_shine_tab *s; foreach(s, list) @@ -1205,8 +1205,8 @@ gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess ) compute_shine_table( s, shininess ); } - ctx->ShineTable[i]->refcount--; - ctx->ShineTable[i] = s; + ctx->_ShineTable[i]->refcount--; + ctx->_ShineTable[i] = s; move_to_tail( list, s ); s->refcount++; #undef DISTSQR @@ -1226,68 +1226,68 @@ gl_update_lighting( GLcontext *ctx ) { struct gl_light *light; - ctx->Light.Flags = 0; + ctx->Light._Flags = 0; foreach(light, &ctx->Light.EnabledList) { - light->Flags = 0; + light->_Flags = 0; if (light->EyePosition[3] != 0.0F) - light->Flags |= LIGHT_POSITIONAL; + light->_Flags |= LIGHT_POSITIONAL; if (LEN_SQUARED_3FV(light->Specular) > 1e-16) - light->Flags |= LIGHT_SPECULAR; + light->_Flags |= LIGHT_SPECULAR; if (light->SpotCutoff != 180.0F) - light->Flags |= LIGHT_SPOT; + light->_Flags |= LIGHT_SPOT; - ctx->Light.Flags |= light->Flags; + ctx->Light._Flags |= light->_Flags; } - ctx->Light.NeedVertices = - ((ctx->Light.Flags & (LIGHT_POSITIONAL|LIGHT_SPOT)) || + ctx->Light._NeedVertices = + ((ctx->Light._Flags & (LIGHT_POSITIONAL|LIGHT_SPOT)) || (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) || - (ctx->Light.Model.LocalViewer && (ctx->Light.Flags & LIGHT_SPECULAR))); + (ctx->Light.Model.LocalViewer && (ctx->Light._Flags & LIGHT_SPECULAR))); /* Precompute some shading values. */ if (ctx->Visual.RGBAflag) { - GLuint sides = ((ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) ? 2 : 1); + GLuint sides = ((ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE) ? 2 : 1); GLuint side; for (side=0; side < sides; side++) { struct gl_material *mat = &ctx->Light.Material[side]; - COPY_3V(ctx->Light.BaseColor[side], mat->Emission); - ACC_SCALE_3V(ctx->Light.BaseColor[side], + COPY_3V(ctx->Light._BaseColor[side], mat->Emission); + ACC_SCALE_3V(ctx->Light._BaseColor[side], ctx->Light.Model.Ambient, mat->Ambient); - FLOAT_COLOR_TO_CHAN(ctx->Light.BaseAlpha[side], + FLOAT_COLOR_TO_CHAN(ctx->Light._BaseAlpha[side], ctx->Light.Material[side].Diffuse[3] ); } foreach (light, &ctx->Light.EnabledList) { for (side=0; side< sides; side++) { const struct gl_material *mat = &ctx->Light.Material[side]; - SCALE_3V( light->MatDiffuse[side], light->Diffuse, mat->Diffuse ); - SCALE_3V( light->MatAmbient[side], light->Ambient, mat->Ambient ); - if (light->Flags & LIGHT_SPECULAR) { - SCALE_3V( light->MatSpecular[side], light->Specular, + SCALE_3V( light->_MatDiffuse[side], light->Diffuse, mat->Diffuse ); + SCALE_3V( light->_MatAmbient[side], light->Ambient, mat->Ambient ); + if (light->_Flags & LIGHT_SPECULAR) { + SCALE_3V( light->_MatSpecular[side], light->Specular, mat->Specular); - light->IsMatSpecular[side] = - (LEN_SQUARED_3FV(light->MatSpecular[side]) > 1e-16); + light->_IsMatSpecular[side] = + (LEN_SQUARED_3FV(light->_MatSpecular[side]) > 1e-16); } else - light->IsMatSpecular[side] = 0; + light->_IsMatSpecular[side] = 0; } } } else { static const GLfloat ci[3] = { .30, .59, .11 }; foreach(light, &ctx->Light.EnabledList) { - light->dli = DOT3(ci, light->Diffuse); - light->sli = DOT3(ci, light->Specular); + light->_dli = DOT3(ci, light->Diffuse); + light->_sli = DOT3(ci, light->Specular); } } } @@ -1304,65 +1304,65 @@ gl_compute_light_positions( GLcontext *ctx ) if (1 /*ctx->Light.NeedVertices && !ctx->Light.Model.LocalViewer*/) { static const GLfloat eye_z[3] = { 0, 0, 1 }; - if (ctx->NeedEyeCoords) { - COPY_3V( ctx->EyeZDir, eye_z ); + if (ctx->_NeedEyeCoords) { + COPY_3V( ctx->_EyeZDir, eye_z ); } else { - TRANSFORM_NORMAL( ctx->EyeZDir, eye_z, ctx->ModelView.m ); + TRANSFORM_NORMAL( ctx->_EyeZDir, eye_z, ctx->ModelView.m ); } } foreach (light, &ctx->Light.EnabledList) { - if (ctx->NeedEyeCoords) { - COPY_4FV( light->Position, light->EyePosition ); + if (ctx->_NeedEyeCoords) { + COPY_4FV( light->_Position, light->EyePosition ); } else { - TRANSFORM_POINT( light->Position, ctx->ModelView.inv, + TRANSFORM_POINT( light->_Position, ctx->ModelView.inv, light->EyePosition ); } - if (!(light->Flags & LIGHT_POSITIONAL)) { + if (!(light->_Flags & LIGHT_POSITIONAL)) { /* VP (VP) = Normalize( Position ) */ - COPY_3V( light->VP_inf_norm, light->Position ); - NORMALIZE_3FV( light->VP_inf_norm ); + COPY_3V( light->_VP_inf_norm, light->_Position ); + NORMALIZE_3FV( light->_VP_inf_norm ); if (!ctx->Light.Model.LocalViewer) { - /* h_inf_norm = Normalize( V_to_P + <0,0,1> ) */ - ADD_3V( light->h_inf_norm, light->VP_inf_norm, ctx->EyeZDir); - NORMALIZE_3FV( light->h_inf_norm ); + /* _h_inf_norm = Normalize( V_to_P + <0,0,1> ) */ + ADD_3V( light->_h_inf_norm, light->_VP_inf_norm, ctx->_EyeZDir); + NORMALIZE_3FV( light->_h_inf_norm ); } - light->VP_inf_spot_attenuation = 1.0; + light->_VP_inf_spot_attenuation = 1.0; } - if (light->Flags & LIGHT_SPOT) { - if (ctx->NeedEyeNormals) { - COPY_3V( light->NormDirection, light->EyeDirection ); + if (light->_Flags & LIGHT_SPOT) { + if (ctx->_NeedEyeNormals) { + COPY_3V( light->_NormDirection, light->EyeDirection ); } else { - TRANSFORM_NORMAL( light->NormDirection, + TRANSFORM_NORMAL( light->_NormDirection, light->EyeDirection, ctx->ModelView.m); } - NORMALIZE_3FV( light->NormDirection ); + NORMALIZE_3FV( light->_NormDirection ); /* Unlikely occurrance? */ - if (!(light->Flags & LIGHT_POSITIONAL)) { - GLfloat PV_dot_dir = - DOT3(light->VP_inf_norm, - light->NormDirection); + if (!(light->_Flags & LIGHT_POSITIONAL)) { + GLfloat PV_dot_dir = - DOT3(light->_VP_inf_norm, + light->_NormDirection); - if (PV_dot_dir > light->CosCutoff) { + if (PV_dot_dir > light->_CosCutoff) { double x = PV_dot_dir * (EXP_TABLE_SIZE-1); int k = (int) x; - light->VP_inf_spot_attenuation = - (light->SpotExpTable[k][0] + - (x-k)*light->SpotExpTable[k][1]); + light->_VP_inf_spot_attenuation = + (light->_SpotExpTable[k][0] + + (x-k)*light->_SpotExpTable[k][1]); } else { - light->VP_inf_spot_attenuation = 0; + light->_VP_inf_spot_attenuation = 0; } } } @@ -1373,10 +1373,10 @@ gl_compute_light_positions( GLcontext *ctx ) void gl_update_normal_transform( GLcontext *ctx ) { - ctx->vb_rescale_factor = 1.0; + ctx->_vb_rescale_factor = 1.0; - if (ctx->NeedEyeCoords) { - if (ctx->NeedNormals) { + if (ctx->_NeedEyeCoords) { + if (ctx->_NeedNormals) { GLuint transform = NORM_TRANSFORM_NO_ROT; if (ctx->ModelView.flags & (MAT_FLAG_GENERAL | @@ -1385,40 +1385,40 @@ gl_update_normal_transform( GLcontext *ctx ) MAT_FLAG_PERSPECTIVE)) transform = NORM_TRANSFORM; - ctx->vb_rescale_factor = ctx->rescale_factor; + ctx->_vb_rescale_factor = ctx->_rescale_factor; if (ctx->Transform.Normalize) { - ctx->NormalTransform = gl_normal_tab[transform | NORM_NORMALIZE]; + ctx->_NormalTransform = gl_normal_tab[transform | NORM_NORMALIZE]; } else if (ctx->Transform.RescaleNormals && - ctx->rescale_factor != 1.0) { - ctx->NormalTransform = gl_normal_tab[transform | NORM_RESCALE]; + ctx->_rescale_factor != 1.0) { + ctx->_NormalTransform = gl_normal_tab[transform | NORM_RESCALE]; } else { - ctx->NormalTransform = gl_normal_tab[transform]; + ctx->_NormalTransform = gl_normal_tab[transform]; } } else { - ctx->NormalTransform = 0; + ctx->_NormalTransform = 0; } } else { - if (ctx->NeedNormals) { - ctx->vb_rescale_factor = 1.0/ctx->rescale_factor; + if (ctx->_NeedNormals) { + ctx->_vb_rescale_factor = 1.0/ctx->_rescale_factor; if (ctx->Transform.Normalize) { - ctx->NormalTransform = gl_normal_tab[NORM_NORMALIZE]; + ctx->_NormalTransform = gl_normal_tab[NORM_NORMALIZE]; } else if (!ctx->Transform.RescaleNormals && - ctx->rescale_factor != 1.0) { - ctx->NormalTransform = gl_normal_tab[NORM_RESCALE]; + ctx->_rescale_factor != 1.0) { + ctx->_NormalTransform = gl_normal_tab[NORM_RESCALE]; } else { - ctx->NormalTransform = 0; + ctx->_NormalTransform = 0; } } else { - ctx->NormalTransform = 0; + ctx->_NormalTransform = 0; } } } diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index a3c49f1d121..2a86e09a54f 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -1,4 +1,4 @@ -/* $Id: lines.c,v 1.20 2000/10/31 18:09:44 keithw Exp $ */ +/* $Id: lines.c,v 1.21 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -54,8 +54,8 @@ _mesa_LineWidth( GLfloat width ) if (ctx->Line.Width != width) { ctx->Line.Width = width; - ctx->TriangleCaps &= ~DD_LINE_WIDTH; - if (width != 1.0) ctx->TriangleCaps |= DD_LINE_WIDTH; + ctx->_TriangleCaps &= ~DD_LINE_WIDTH; + if (width != 1.0) ctx->_TriangleCaps |= DD_LINE_WIDTH; ctx->NewState |= _NEW_LINE; diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 45bb9cd226f..d84d2edd7c8 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -1,4 +1,4 @@ -/* $Id: macros.h,v 1.12 2000/10/29 18:23:16 brianp Exp $ */ +/* $Id: macros.h,v 1.13 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -150,6 +150,12 @@ do { \ } \ } while(0) +#define COPY_CLEAN_4V(DST, SZ, SRC) \ +do { \ + ASSIGN_4V( DST, 0, 0, 0, 1 ); \ + COPY_SZ_4V( DST, SZ, SRC ); \ +} while (0) + #define SUB_4V( DST, SRCA, SRCB ) \ do { \ (DST)[0] = (SRCA)[0] - (SRCB)[0]; \ diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index df21d154fd2..c161e847eb3 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.23 2000/10/30 13:32:00 keithw Exp $ */ +/* $Id: matrix.c,v 1.24 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -514,8 +514,10 @@ static inv_mat_func inv_mat_tab[7] = { static GLboolean matrix_invert( GLmatrix *mat ) { if (inv_mat_tab[mat->type](mat)) { + mat->flags &= ~MAT_FLAG_SINGULAR; return GL_TRUE; } else { + mat->flags |= MAT_FLAG_SINGULAR; MEMCPY( mat->inv, Identity, sizeof(Identity) ); return GL_FALSE; } @@ -930,11 +932,11 @@ static void mat_mul_floats( GLmatrix *mat, const GLfloat *m, GLuint flags ) void gl_calculate_model_project_matrix( GLcontext *ctx ) { - gl_matrix_mul( &ctx->ModelProjectMatrix, + gl_matrix_mul( &ctx->_ModelProjectMatrix, &ctx->ProjectionMatrix, &ctx->ModelView ); - gl_matrix_analyze( &ctx->ModelProjectMatrix ); + gl_matrix_analyze( &ctx->_ModelProjectMatrix ); } @@ -1520,15 +1522,15 @@ gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) ctx->Viewport.Height = height; /* compute scale and bias values */ - ctx->Viewport.WindowMap.m[MAT_SX] = (GLfloat) width / 2.0F; - ctx->Viewport.WindowMap.m[MAT_TX] = ctx->Viewport.WindowMap.m[MAT_SX] + x; - ctx->Viewport.WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F; - ctx->Viewport.WindowMap.m[MAT_TY] = ctx->Viewport.WindowMap.m[MAT_SY] + y; - ctx->Viewport.WindowMap.m[MAT_SZ] = 0.5 * ctx->Visual.DepthMaxF; - ctx->Viewport.WindowMap.m[MAT_TZ] = 0.5 * ctx->Visual.DepthMaxF; - - ctx->Viewport.WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION; - ctx->Viewport.WindowMap.type = MATRIX_3D_NO_ROT; + ctx->Viewport._WindowMap.m[MAT_SX] = (GLfloat) width / 2.0F; + ctx->Viewport._WindowMap.m[MAT_TX] = ctx->Viewport._WindowMap.m[MAT_SX] + x; + ctx->Viewport._WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F; + ctx->Viewport._WindowMap.m[MAT_TY] = ctx->Viewport._WindowMap.m[MAT_SY] + y; + ctx->Viewport._WindowMap.m[MAT_SZ] = 0.5 * ctx->Visual.DepthMaxF; + ctx->Viewport._WindowMap.m[MAT_TZ] = 0.5 * ctx->Visual.DepthMaxF; + + ctx->Viewport._WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION; + ctx->Viewport._WindowMap.type = MATRIX_3D_NO_ROT; ctx->NewState |= _NEW_VIEWPORT; /* Check if window/buffer has been resized and if so, reallocate the @@ -1536,17 +1538,6 @@ gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) */ _mesa_ResizeBuffersMESA(); - - ctx->RasterMask &= ~WINCLIP_BIT; - - if ( ctx->Viewport.X<0 - || ctx->Viewport.X + ctx->Viewport.Width > ctx->DrawBuffer->Width - || ctx->Viewport.Y<0 - || ctx->Viewport.Y + ctx->Viewport.Height > ctx->DrawBuffer->Height) { - ctx->RasterMask |= WINCLIP_BIT; - } - - if (ctx->Driver.Viewport) { (*ctx->Driver.Viewport)( ctx, x, y, width, height ); } @@ -1580,8 +1571,8 @@ _mesa_DepthRange( GLclampd nearval, GLclampd farval ) ctx->Viewport.Near = n; ctx->Viewport.Far = f; - ctx->Viewport.WindowMap.m[MAT_SZ] = ctx->Visual.DepthMaxF * ((f - n) / 2.0); - ctx->Viewport.WindowMap.m[MAT_TZ] = ctx->Visual.DepthMaxF * ((f - n) / 2.0 + n); + ctx->Viewport._WindowMap.m[MAT_SZ] = ctx->Visual.DepthMaxF * ((f - n) / 2.0); + ctx->Viewport._WindowMap.m[MAT_TZ] = ctx->Visual.DepthMaxF * ((f - n) / 2.0 + n); ctx->NewState |= _NEW_VIEWPORT; if (ctx->Driver.DepthRange) { diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index ccac502ab16..27b9d8d77da 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -1,4 +1,4 @@ -/* $Id: points.c,v 1.19 2000/10/31 18:09:44 keithw Exp $ */ +/* $Id: points.c,v 1.20 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -55,9 +55,9 @@ _mesa_PointSize( GLfloat size ) if (ctx->Point.UserSize != size) { ctx->Point.UserSize = size; ctx->Point.Size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); - ctx->TriangleCaps &= ~DD_POINT_SIZE; + ctx->_TriangleCaps &= ~DD_POINT_SIZE; if (size != 1.0) - ctx->TriangleCaps |= DD_POINT_SIZE; + ctx->_TriangleCaps |= DD_POINT_SIZE; ctx->NewState |= _NEW_POINT; } } @@ -80,15 +80,15 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) switch (pname) { case GL_DISTANCE_ATTENUATION_EXT: { - const GLboolean tmp = ctx->Point.Attenuated; + const GLboolean tmp = ctx->Point._Attenuated; COPY_3V(ctx->Point.Params, params); - ctx->Point.Attenuated = (params[0] != 1.0 || - params[1] != 0.0 || - params[2] != 0.0); + ctx->Point._Attenuated = (params[0] != 1.0 || + params[1] != 0.0 || + params[2] != 0.0); - if (tmp != ctx->Point.Attenuated) { - ctx->Enabled ^= ENABLE_POINT_ATTEN; - ctx->TriangleCaps ^= DD_POINT_ATTEN; + if (tmp != ctx->Point._Attenuated) { + ctx->_Enabled ^= ENABLE_POINT_ATTEN; + ctx->_TriangleCaps ^= DD_POINT_ATTEN; } } break; diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index b4a7172dbd5..125804196ac 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -1,4 +1,4 @@ -/* $Id: polygon.c,v 1.14 2000/10/30 13:32:01 keithw Exp $ */ +/* $Id: polygon.c,v 1.15 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -115,12 +115,12 @@ _mesa_PolygonMode( GLenum face, GLenum mode ) } /* Compute a handy "shortcut" value: */ - ctx->TriangleCaps &= ~DD_TRI_UNFILLED; - ctx->Polygon.Unfilled = GL_FALSE; + ctx->_TriangleCaps &= ~DD_TRI_UNFILLED; + ctx->Polygon._Unfilled = GL_FALSE; if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL) { - ctx->Polygon.Unfilled = GL_TRUE; - ctx->TriangleCaps |= DD_TRI_UNFILLED; + ctx->Polygon._Unfilled = GL_TRUE; + ctx->_TriangleCaps |= DD_TRI_UNFILLED; } ctx->NewState |= _NEW_POLYGON; diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 1ba4695c6da..1610b025748 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -1,4 +1,4 @@ -/* $Id: rastpos.c,v 1.11 2000/10/29 19:02:23 brianp Exp $ */ +/* $Id: rastpos.c,v 1.12 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -73,10 +73,10 @@ static void raster_pos4f( GLcontext *ctx, GLfloat *objnorm = ctx->Current.Normal; /* Not needed??? - vert = (ctx->NeedEyeCoords ? eye : v); + vert = (ctx->_NeedEyeCoords ? eye : v); */ - if (ctx->NeedEyeNormals) { + if (ctx->_NeedEyeNormals) { GLfloat *inv = ctx->ModelView.inv; TRANSFORM_NORMAL( eyenorm, objnorm, inv ); norm = eyenorm; @@ -116,7 +116,7 @@ static void raster_pos4f( GLcontext *ctx, } /* clip to user clipping planes */ - if ( ctx->Transform.AnyClip && + if ( ctx->Transform._AnyClip && gl_userclip_point(ctx, clip) == 0) { ctx->Current.RasterPosValid = GL_FALSE; @@ -130,12 +130,12 @@ static void raster_pos4f( GLcontext *ctx, ndc[1] = clip[1] * d; ndc[2] = clip[2] * d; - ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport.WindowMap.m[MAT_SX] + - ctx->Viewport.WindowMap.m[MAT_TX]); - ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport.WindowMap.m[MAT_SY] + - ctx->Viewport.WindowMap.m[MAT_TY]); - ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport.WindowMap.m[MAT_SZ] + - ctx->Viewport.WindowMap.m[MAT_TZ]) / ctx->Visual.DepthMaxF; + ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport._WindowMap.m[MAT_SX] + + ctx->Viewport._WindowMap.m[MAT_TX]); + ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport._WindowMap.m[MAT_SY] + + ctx->Viewport._WindowMap.m[MAT_TY]); + ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport._WindowMap.m[MAT_SZ] + + ctx->Viewport._WindowMap.m[MAT_TZ]) / ctx->Visual.DepthMaxF; ctx->Current.RasterPos[3] = clip[3]; ctx->Current.RasterPosValid = GL_TRUE; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 600d4a2c5a1..42c4a0c87a3 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.39 2000/10/31 18:09:45 keithw Exp $ */ +/* $Id: state.c,v 1.40 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -690,72 +690,6 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) -/* - * Recompute the value of ctx->RasterMask, etc. according to - * the current context. - */ -static void update_rasterflags( GLcontext *ctx ) -{ - ctx->RasterMask = 0; - - if (ctx->Color.AlphaEnabled) ctx->RasterMask |= ALPHATEST_BIT; - if (ctx->Color.BlendEnabled) ctx->RasterMask |= BLEND_BIT; - if (ctx->Depth.Test) ctx->RasterMask |= DEPTH_BIT; - if (ctx->Fog.Enabled) ctx->RasterMask |= FOG_BIT; - if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT; - if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT; - if (ctx->Visual.RGBAflag) { - const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); - if (colorMask != 0xffffffff) ctx->RasterMask |= MASKING_BIT; - if (ctx->Color.ColorLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT; - if (ctx->Texture.ReallyEnabled) ctx->RasterMask |= TEXTURE_BIT; - } - else { - if (ctx->Color.IndexMask != 0xffffffff) ctx->RasterMask |= MASKING_BIT; - if (ctx->Color.IndexLogicOpEnabled) ctx->RasterMask |= LOGIC_OP_BIT; - } - - if (ctx->DrawBuffer->UseSoftwareAlphaBuffers - && ctx->Color.ColorMask[ACOMP] - && ctx->Color.DrawBuffer != GL_NONE) - ctx->RasterMask |= ALPHABUF_BIT; - - if ( ctx->Viewport.X < 0 - || ctx->Viewport.X + ctx->Viewport.Width > ctx->DrawBuffer->Width - || ctx->Viewport.Y < 0 - || ctx->Viewport.Y + ctx->Viewport.Height > ctx->DrawBuffer->Height) { - ctx->RasterMask |= WINCLIP_BIT; - } - - if (ctx->Depth.OcclusionTest) - ctx->RasterMask |= OCCLUSION_BIT; - - - /* If we're not drawing to exactly one color buffer set the - * MULTI_DRAW_BIT flag. Also set it if we're drawing to no - * buffers or the RGBA or CI mask disables all writes. - */ - ctx->TriangleCaps &= ~DD_MULTIDRAW; - - if (ctx->Color.MultiDrawBuffer) { - ctx->RasterMask |= MULTI_DRAW_BIT; - ctx->TriangleCaps |= DD_MULTIDRAW; - } - else if (ctx->Color.DrawBuffer==GL_NONE) { - ctx->RasterMask |= MULTI_DRAW_BIT; - ctx->TriangleCaps |= DD_MULTIDRAW; - } - else if (ctx->Visual.RGBAflag && *((GLuint *) ctx->Color.ColorMask) == 0) { - /* all RGBA channels disabled */ - ctx->RasterMask |= MULTI_DRAW_BIT; - ctx->TriangleCaps |= DD_MULTIDRAW; - } - else if (!ctx->Visual.RGBAflag && ctx->Color.IndexMask==0) { - /* all color index bits disabled */ - ctx->RasterMask |= MULTI_DRAW_BIT; - ctx->TriangleCaps |= DD_MULTIDRAW; - } -} void gl_print_state( const char *msg, GLuint state ) @@ -826,14 +760,14 @@ void gl_update_state( GLcontext *ctx ) if (MESA_VERBOSE & VERBOSE_STATE) gl_print_state("", ctx->NewState); - if (ctx->NewState & _NEW_PIXEL) + if (ctx->NewState & (_NEW_PIXEL|_NEW_COLOR_MATRIX)) _mesa_update_image_transfer_state(ctx); if (ctx->NewState & _NEW_ARRAY) gl_update_client_state( ctx ); if (ctx->NewState & _NEW_TEXTURE_MATRIX) { - ctx->Enabled &= ~(ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | ENABLE_TEXMAT2); + ctx->_Enabled &= ~(ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | ENABLE_TEXMAT2); for (i=0; i < ctx->Const.MaxTextureUnits; i++) { if (ctx->TextureMatrix[i].flags & MAT_DIRTY_ALL_OVER) { @@ -842,54 +776,52 @@ void gl_update_state( GLcontext *ctx ) if (ctx->Texture.Unit[i].Enabled && ctx->TextureMatrix[i].type != MATRIX_IDENTITY) - ctx->Enabled |= ENABLE_TEXMAT0 << i; + ctx->_Enabled |= ENABLE_TEXMAT0 << i; } } } if (ctx->NewState & _NEW_TEXTURE) { - ctx->Texture.MultiTextureEnabled = GL_FALSE; - ctx->Texture.NeedNormals = GL_FALSE; + ctx->Texture._MultiTextureEnabled = GL_FALSE; + ctx->Texture._NeedNormals = GL_FALSE; gl_update_dirty_texobjs(ctx); - ctx->Enabled &= ~(ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | ENABLE_TEXGEN2); - ctx->Texture.ReallyEnabled = 0; + ctx->_Enabled &= ~(ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | ENABLE_TEXGEN2); + ctx->Texture._ReallyEnabled = 0; for (i=0; i < ctx->Const.MaxTextureUnits; i++) { if (ctx->Texture.Unit[i].Enabled) { gl_update_texture_unit( ctx, &ctx->Texture.Unit[i] ); - ctx->Texture.ReallyEnabled |= - ctx->Texture.Unit[i].ReallyEnabled << (i * 4); + ctx->Texture._ReallyEnabled |= + ctx->Texture.Unit[i]._ReallyEnabled << (i * 4); - if (ctx->Texture.Unit[i].GenFlags != 0) { - ctx->Enabled |= ENABLE_TEXGEN0 << i; + if (ctx->Texture.Unit[i]._GenFlags != 0) { + ctx->_Enabled |= ENABLE_TEXGEN0 << i; - if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_NORMALS) { - ctx->Texture.NeedNormals = GL_TRUE; - ctx->Texture.NeedEyeCoords = GL_TRUE; + if (ctx->Texture.Unit[i]._GenFlags & TEXGEN_NEED_NORMALS) { + ctx->Texture._NeedNormals = GL_TRUE; + ctx->Texture._NeedEyeCoords = GL_TRUE; } - if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_EYE_COORD) { - ctx->Texture.NeedEyeCoords = GL_TRUE; + if (ctx->Texture.Unit[i]._GenFlags & TEXGEN_NEED_EYE_COORD) { + ctx->Texture._NeedEyeCoords = GL_TRUE; } } - if (i > 0 && ctx->Texture.Unit[i].ReallyEnabled) { - ctx->Texture.MultiTextureEnabled = GL_TRUE; + if (i > 0 && ctx->Texture.Unit[i]._ReallyEnabled) { + ctx->Texture._MultiTextureEnabled = GL_TRUE; } } else { - ctx->Texture.Unit[i].ReallyEnabled = 0; + ctx->Texture.Unit[i]._ReallyEnabled = 0; } } - ctx->Enabled = (ctx->Enabled & ~ENABLE_TEX_ANY) | ctx->Texture.ReallyEnabled; - ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals); + ctx->_Enabled = ((ctx->_Enabled & ~ENABLE_TEX_ANY) | + ctx->Texture._ReallyEnabled); + ctx->_NeedNormals = (ctx->Light.Enabled || ctx->Texture._NeedNormals); } - if (ctx->NewState & _SWRAST_NEW_RASTERMASK) - update_rasterflags(ctx); - if (ctx->NewState & (_NEW_BUFFERS|_NEW_SCISSOR)) { /* update scissor region */ ctx->DrawBuffer->Xmin = 0; @@ -913,53 +845,54 @@ void gl_update_state( GLcontext *ctx ) } if (ctx->NewState & _NEW_LIGHT) { - ctx->TriangleCaps &= ~(DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL); + ctx->_TriangleCaps &= ~(DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL); if (ctx->Light.Enabled) { if (ctx->Light.Model.TwoSide) - ctx->TriangleCaps |= (DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL); + ctx->_TriangleCaps |= (DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL); gl_update_lighting(ctx); } } if (ctx->NewState & (_NEW_POLYGON | _NEW_LIGHT)) { - ctx->TriangleCaps &= ~DD_TRI_CULL_FRONT_BACK; if (ctx->NewState & _NEW_POLYGON) { + ctx->_TriangleCaps &= ~DD_TRI_CULL_FRONT_BACK; + /* Setup CullBits bitmask */ if (ctx->Polygon.CullFlag) { - ctx->backface_sign = 1; + ctx->_backface_sign = 1; switch(ctx->Polygon.CullFaceMode) { case GL_BACK: if(ctx->Polygon.FrontFace==GL_CCW) - ctx->backface_sign = -1; - ctx->Polygon.CullBits = 1; + ctx->_backface_sign = -1; + ctx->Polygon._CullBits = 1; break; case GL_FRONT: if(ctx->Polygon.FrontFace!=GL_CCW) - ctx->backface_sign = -1; - ctx->Polygon.CullBits = 2; + ctx->_backface_sign = -1; + ctx->Polygon._CullBits = 2; break; default: case GL_FRONT_AND_BACK: - ctx->backface_sign = 0; - ctx->Polygon.CullBits = 0; - ctx->TriangleCaps |= DD_TRI_CULL_FRONT_BACK; + ctx->_backface_sign = 0; + ctx->Polygon._CullBits = 0; + ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK; break; } } else { - ctx->Polygon.CullBits = 3; - ctx->backface_sign = 0; + ctx->Polygon._CullBits = 3; + ctx->_backface_sign = 0; } /* Any Polygon offsets enabled? */ - ctx->TriangleCaps &= ~DD_TRI_OFFSET; + ctx->_TriangleCaps &= ~DD_TRI_OFFSET; if (ctx->Polygon.OffsetPoint || ctx->Polygon.OffsetLine || ctx->Polygon.OffsetFill) - ctx->TriangleCaps |= DD_TRI_OFFSET; + ctx->_TriangleCaps |= DD_TRI_OFFSET; } } @@ -971,51 +904,12 @@ void gl_update_state( GLcontext *ctx ) if (ctx->NewState & ctx->Driver.UpdateStateNotify) { - ctx->IndirectTriangles = ctx->TriangleCaps & ~ctx->Driver.TriangleCaps; - ctx->IndirectTriangles |= DD_SW_RASTERIZE; - - if (MESA_VERBOSE&VERBOSE_CULL) - gl_print_tri_caps("initial indirect tris", ctx->IndirectTriangles); - - ctx->Driver.PointsFunc = NULL; - ctx->Driver.LineFunc = NULL; - ctx->Driver.TriangleFunc = NULL; - ctx->Driver.QuadFunc = NULL; - ctx->Driver.RectFunc = NULL; - ctx->Driver.RenderVBClippedTab = NULL; - ctx->Driver.RenderVBCulledTab = NULL; - ctx->Driver.RenderVBRawTab = NULL; - /* * Here the driver sets up all the ctx->Driver function pointers to * it's specific, private functions. */ ctx->Driver.UpdateState(ctx); - - if (MESA_VERBOSE&VERBOSE_CULL) - gl_print_tri_caps("indirect tris", ctx->IndirectTriangles); - - /* - * In case the driver didn't hook in an optimized point, line or - * triangle function we'll now select "core/fallback" point, line - * and triangle functions. - */ - if (ctx->IndirectTriangles & DD_SW_RASTERIZE) { - _swrast_set_point_function(ctx); - _swrast_set_line_function(ctx); - _swrast_set_triangle_function(ctx); - _swrast_set_quad_function(ctx); - - if ((ctx->IndirectTriangles & - (DD_TRI_SW_RASTERIZE|DD_QUAD_SW_RASTERIZE|DD_TRI_CULL)) == - (DD_TRI_SW_RASTERIZE|DD_QUAD_SW_RASTERIZE|DD_TRI_CULL)) - ctx->IndirectTriangles &= ~DD_TRI_CULL; - } - - if (MESA_VERBOSE&VERBOSE_CULL) - gl_print_tri_caps("indirect tris 2", ctx->IndirectTriangles); - - gl_set_render_vb_function(ctx); + gl_set_render_vb_function(ctx); /* fix me */ } /* Should only be calc'd when !need_eye_coords and not culling. @@ -1030,7 +924,7 @@ void gl_update_state( GLcontext *ctx ) gl_matrix_analyze( &ctx->ProjectionMatrix ); ctx->ProjectionMatrix.flags &= ~MAT_DIRTY_DEPENDENTS; - if (ctx->Transform.AnyClip) { + if (ctx->Transform._AnyClip) { gl_update_userclip( ctx ); } } @@ -1045,7 +939,7 @@ void gl_update_state( GLcontext *ctx ) /* Figure out whether we can light in object space or not. If we * can, find the current positions of the lights in object space */ - if ((ctx->Enabled & (ENABLE_POINT_ATTEN | ENABLE_LIGHT | ENABLE_FOG | + if ((ctx->_Enabled & (ENABLE_POINT_ATTEN | ENABLE_LIGHT | ENABLE_FOG | ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | ENABLE_TEXGEN2)) && (ctx->NewState & (_NEW_LIGHT | _NEW_TEXTURE | @@ -1059,47 +953,47 @@ void gl_update_state( GLcontext *ctx ) { GLboolean oldcoord, oldnorm; - oldcoord = ctx->NeedEyeCoords; - oldnorm = ctx->NeedEyeNormals; + oldcoord = ctx->_NeedEyeCoords; + oldnorm = ctx->_NeedEyeNormals; - ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals); - ctx->NeedEyeCoords = (ctx->Fog.Enabled || ctx->Point.Attenuated); - ctx->NeedEyeNormals = GL_FALSE; + ctx->_NeedNormals = (ctx->Light.Enabled || ctx->Texture._NeedNormals); + ctx->_NeedEyeCoords = (ctx->Fog.Enabled || ctx->Point._Attenuated); + ctx->_NeedEyeNormals = GL_FALSE; if (ctx->Light.Enabled) { - if ((ctx->Light.Flags & LIGHT_POSITIONAL) || - ctx->Light.NeedVertices || + if ((ctx->Light._Flags & LIGHT_POSITIONAL) || + ctx->Light._NeedVertices || !TEST_MAT_FLAGS( &ctx->ModelView, MAT_FLAGS_LENGTH_PRESERVING)) { /* Need length for attenuation or need angle for spotlights * or non-uniform scale matrix */ - ctx->NeedEyeCoords = GL_TRUE; + ctx->_NeedEyeCoords = GL_TRUE; } - ctx->NeedEyeNormals = ctx->NeedEyeCoords; + ctx->_NeedEyeNormals = ctx->_NeedEyeCoords; } - if (ctx->Texture.ReallyEnabled || ctx->RenderMode==GL_FEEDBACK) { - if (ctx->Texture.NeedEyeCoords) ctx->NeedEyeCoords = GL_TRUE; - if (ctx->Texture.NeedNormals) - ctx->NeedNormals = ctx->NeedEyeNormals = GL_TRUE; + if (ctx->Texture._ReallyEnabled || ctx->RenderMode==GL_FEEDBACK) { + if (ctx->Texture._NeedEyeCoords) ctx->_NeedEyeCoords = GL_TRUE; + if (ctx->Texture._NeedNormals) + ctx->_NeedNormals = ctx->_NeedEyeNormals = GL_TRUE; } - ctx->vb_proj_matrix = &ctx->ModelProjectMatrix; - - if (ctx->NeedEyeCoords) - ctx->vb_proj_matrix = &ctx->ProjectionMatrix; + if (ctx->_NeedEyeCoords) + ctx->_vb_proj_matrix = &ctx->ProjectionMatrix; + else + ctx->_vb_proj_matrix = &ctx->_ModelProjectMatrix; if (ctx->Light.Enabled) { gl_update_lighting_function(ctx); if ( (ctx->NewState & _NEW_LIGHT) || ((ctx->NewState & (_NEW_MODELVIEW|_NEW_PROJECTION)) && - !ctx->NeedEyeCoords) || - oldcoord != ctx->NeedEyeCoords || - oldnorm != ctx->NeedEyeNormals) { + !ctx->_NeedEyeCoords) || + oldcoord != ctx->_NeedEyeCoords || + oldnorm != ctx->_NeedEyeNormals) { gl_compute_light_positions(ctx); } - ctx->rescale_factor = 1.0F; + ctx->_rescale_factor = 1.0F; if (ctx->ModelView.flags & (MAT_FLAG_UNIFORM_SCALE | MAT_FLAG_GENERAL_SCALE | MAT_FLAG_GENERAL_3D | @@ -1107,7 +1001,7 @@ void gl_update_state( GLcontext *ctx ) const GLfloat *m = ctx->ModelView.inv; const GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10]; if (f > 1e-12 && (f - 1.0) * (f - 1.0) > 1e-12) - ctx->rescale_factor = 1.0 / GL_SQRT(f); + ctx->_rescale_factor = 1.0 / GL_SQRT(f); } } @@ -1173,5 +1067,5 @@ _mesa_update_image_transfer_state(GLcontext *ctx) if (ctx->Pixel.MinMaxEnabled) mask |= IMAGE_MIN_MAX_BIT; - ctx->ImageTransferState = mask; + ctx->_ImageTransferState = mask; } diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index c3ca132f408..38b24dfe8b2 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.58 2000/10/31 18:09:45 keithw Exp $ */ +/* $Id: teximage.c,v 1.59 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -706,7 +706,7 @@ fill_texture_image( GLcontext *ctx, GLuint dimensions, texComponents = components_in_intformat(texFormat); /* try common 2D texture cases first */ - if (!ctx->ImageTransferState && dimensions == 2 + if (!ctx->_ImageTransferState && dimensions == 2 && srcType == GL_UNSIGNED_BYTE) { if (srcFormat == texFormat) { @@ -777,7 +777,7 @@ fill_texture_image( GLcontext *ctx, GLuint dimensions, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); _mesa_unpack_index_span(ctx, srcWidth, texType, destRow, srcType, src, srcPacking, - ctx->ImageTransferState); + ctx->_ImageTransferState); destRow += dstRowStride; } dest += dstImageStride; @@ -818,7 +818,7 @@ fill_texture_image( GLcontext *ctx, GLuint dimensions, srcFormat, srcType, img, row, 0); _mesa_unpack_float_color_span(ctx, srcWidth, GL_RGBA, dstf, srcFormat, srcType, src, srcPacking, - ctx->ImageTransferState & IMAGE_PRE_CONVOLUTION_BITS, + ctx->_ImageTransferState & IMAGE_PRE_CONVOLUTION_BITS, GL_TRUE); dstf += srcWidth * 4; } @@ -849,7 +849,7 @@ fill_texture_image( GLcontext *ctx, GLuint dimensions, (const GLfloat (*)[4]) srcf, texFormat, GL_UNSIGNED_BYTE, dest, &_mesa_native_packing, - ctx->ImageTransferState + ctx->_ImageTransferState & IMAGE_POST_CONVOLUTION_BITS); srcf += convWidth * 4; dest += dstRowStride; @@ -875,7 +875,7 @@ fill_texture_image( GLcontext *ctx, GLuint dimensions, srcFormat, srcType, img, row, 0); _mesa_unpack_chan_color_span(ctx, srcWidth, texFormat, destRow, srcFormat, srcType, srcRow, srcPacking, - ctx->ImageTransferState); + ctx->_ImageTransferState); destRow += dstRowStride; } dest += dstImageStride; @@ -926,7 +926,7 @@ make_texture_image( GLcontext *ctx, GLuint dimensions, if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); - if (ctx->ImageTransferState & IMAGE_CONVOLUTION_BIT) { + if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { adjust_texture_size_for_convolution(ctx, dimensions, &convWidth, &convHeight); } @@ -1664,7 +1664,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, if (pixels) { GLboolean retain = GL_TRUE; GLboolean success = GL_FALSE; - if (!ctx->ImageTransferState && ctx->Driver.TexImage1D) { + if (!ctx->_ImageTransferState && ctx->Driver.TexImage1D) { /* let device driver try to use raw image */ success = (*ctx->Driver.TexImage1D)( ctx, target, level, format, type, pixels, &ctx->Unpack, @@ -1803,7 +1803,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, if (pixels) { GLboolean retain = GL_TRUE; GLboolean success = GL_FALSE; - if (!ctx->ImageTransferState && ctx->Driver.TexImage2D) { + if (!ctx->_ImageTransferState && ctx->Driver.TexImage2D) { /* let device driver try to use raw image */ success = (*ctx->Driver.TexImage2D)( ctx, target, level, format, type, pixels, &ctx->Unpack, @@ -1946,7 +1946,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, if (pixels) { GLboolean retain = GL_TRUE; GLboolean success = GL_FALSE; - if (!ctx->ImageTransferState && ctx->Driver.TexImage3D) { + if (!ctx->_ImageTransferState && ctx->Driver.TexImage3D) { /* let device driver try to use raw image */ success = (*ctx->Driver.TexImage3D)( ctx, target, level, format, type, pixels, &ctx->Unpack, @@ -2140,7 +2140,7 @@ _mesa_get_teximages_from_driver(GLcontext *ctx, * all but this is easier. We're on a (slow) software path * anyway. */ - for (level = 0; level <= texObj->P; level++) { + for (level = 0; level <= texObj->_P; level++) { struct gl_texture_image *texImg = texObj->Image[level]; if (texImg && !texImg->Data) { _mesa_get_teximage_from_driver(ctx, target, level, texObj); @@ -2229,7 +2229,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); - if (ctx->ImageTransferState & IMAGE_CONVOLUTION_BIT) { + if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { /* convert texture image to GL_RGBA, GL_FLOAT */ GLfloat *tmpImage, *convImage; const GLint comps = components_in_intformat(texImage->Format); @@ -2257,7 +2257,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, _mesa_unpack_float_color_span(ctx, width, GL_RGBA, dst, texImage->Format, GL_UNSIGNED_BYTE, src, &_mesa_native_packing, - ctx->ImageTransferState & IMAGE_PRE_CONVOLUTION_BITS, + ctx->_ImageTransferState & IMAGE_PRE_CONVOLUTION_BITS, GL_FALSE); } @@ -2290,7 +2290,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, _mesa_pack_float_rgba_span(ctx, convWidth, (const GLfloat(*)[4]) src, format, type, dest, &ctx->Pack, - ctx->ImageTransferState & IMAGE_POST_CONVOLUTION_BITS); + ctx->_ImageTransferState & IMAGE_POST_CONVOLUTION_BITS); } } @@ -2311,7 +2311,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, + (img * height + row ) * width * 4; _mesa_pack_rgba_span( ctx, width, (CONST GLchan (*)[4]) src, format, type, dest, &ctx->Pack, - ctx->ImageTransferState ); + ctx->_ImageTransferState ); } else { /* general case: convert row to RGBA format */ @@ -2373,7 +2373,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, } _mesa_pack_rgba_span( ctx, width, (const GLchan (*)[4])rgba, format, type, dest, &ctx->Pack, - ctx->ImageTransferState ); + ctx->_ImageTransferState ); } /* format */ } /* row */ } /* img */ @@ -2421,7 +2421,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level, if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); - if (!ctx->ImageTransferState && ctx->Driver.TexSubImage1D) { + if (!ctx->_ImageTransferState && ctx->Driver.TexSubImage1D) { success = (*ctx->Driver.TexSubImage1D)( ctx, target, level, xoffset, width, format, type, pixels, &ctx->Unpack, texObj, texImage ); @@ -2492,7 +2492,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level, if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); - if (!ctx->ImageTransferState && ctx->Driver.TexSubImage2D) { + if (!ctx->_ImageTransferState && ctx->Driver.TexSubImage2D) { success = (*ctx->Driver.TexSubImage2D)( ctx, target, level, xoffset, yoffset, width, height, format, type, pixels, &ctx->Unpack, texObj, texImage ); @@ -2575,7 +2575,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level, if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); - if (!ctx->ImageTransferState && ctx->Driver.TexSubImage3D) { + if (!ctx->_ImageTransferState && ctx->Driver.TexSubImage3D) { success = (*ctx->Driver.TexSubImage3D)( ctx, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, &ctx->Unpack, texObj, texImage ); @@ -2673,7 +2673,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); - if (ctx->ImageTransferState || !ctx->Driver.CopyTexImage1D + if (ctx->_ImageTransferState || !ctx->Driver.CopyTexImage1D || !(*ctx->Driver.CopyTexImage1D)(ctx, target, level, internalFormat, x, y, width, border)) { struct gl_pixelstore_attrib unpackSave; @@ -2713,7 +2713,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); - if (ctx->ImageTransferState || !ctx->Driver.CopyTexImage2D + if (ctx->_ImageTransferState || !ctx->Driver.CopyTexImage2D || !(*ctx->Driver.CopyTexImage2D)(ctx, target, level, internalFormat, x, y, width, height, border)) { struct gl_pixelstore_attrib unpackSave; @@ -2752,7 +2752,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); - if (ctx->ImageTransferState || !ctx->Driver.CopyTexSubImage1D + if (ctx->_ImageTransferState || !ctx->Driver.CopyTexSubImage1D || !(*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, xoffset, x, y, width)) { struct gl_texture_unit *texUnit; @@ -2799,7 +2799,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); - if (ctx->ImageTransferState || !ctx->Driver.CopyTexSubImage2D + if (ctx->_ImageTransferState || !ctx->Driver.CopyTexSubImage2D || !(*ctx->Driver.CopyTexSubImage2D)(ctx, target, level, xoffset, yoffset, x, y, width, height )) { struct gl_texture_unit *texUnit; @@ -2846,7 +2846,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); - if (ctx->ImageTransferState || !ctx->Driver.CopyTexSubImage3D + if (ctx->_ImageTransferState || !ctx->Driver.CopyTexSubImage3D || !(*ctx->Driver.CopyTexSubImage3D)(ctx, target, level, xoffset, yoffset, zoffset, x, y, width, height )) { struct gl_texture_unit *texUnit; diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d8733516171..21f37e49bc7 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1,4 +1,4 @@ -/* $Id: texobj.c,v 1.31 2000/10/30 13:32:01 keithw Exp $ */ +/* $Id: texobj.c,v 1.32 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -77,7 +77,6 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name, obj->MaxLod = 1000.0; obj->BaseLevel = 0; obj->MaxLevel = 1000; - obj->MinMagThresh = 0.0F; _mesa_init_colortable(&obj->Palette); /* insert into linked list */ @@ -189,21 +188,21 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /* Compute number of mipmap levels */ if (t->Dimensions == 1) { - t->P = t->Image[baseLevel]->WidthLog2; + t->_P = t->Image[baseLevel]->WidthLog2; } else if (t->Dimensions == 2 || t->Dimensions == 6) { - t->P = MAX2(t->Image[baseLevel]->WidthLog2, - t->Image[baseLevel]->HeightLog2); + t->_P = MAX2(t->Image[baseLevel]->WidthLog2, + t->Image[baseLevel]->HeightLog2); } else if (t->Dimensions == 3) { GLint max = MAX2(t->Image[baseLevel]->WidthLog2, t->Image[baseLevel]->HeightLog2); max = MAX2(max, (GLint)(t->Image[baseLevel]->DepthLog2)); - t->P = max; + t->_P = max; } /* Compute M (see the 1.2 spec) used during mipmapping */ - t->M = (GLfloat) (MIN2(t->MaxLevel, t->P) - t->BaseLevel); + t->_M = (GLfloat) (MIN2(t->MaxLevel, t->_P) - t->BaseLevel); if (t->Dimensions == 6) { @@ -237,7 +236,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, */ GLint i; GLint minLevel = baseLevel; - GLint maxLevel = MIN2(t->P, ctx->Const.MaxTextureLevels-1); + GLint maxLevel = MIN2(t->_P, ctx->Const.MaxTextureLevels-1); maxLevel = MIN2(maxLevel, t->MaxLevel); if (minLevel > maxLevel) { @@ -597,7 +596,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) /* If we've changed the CurrentD[123] texture object then update the * ctx->Texture.Current pointer to point to the new texture object. */ - texUnit->Current = texUnit->CurrentD[texUnit->CurrentDimension]; + texUnit->_Current = texUnit->CurrentD[texUnit->_CurrentDimension]; ctx->NewState |= _NEW_TEXTURE; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index ed254e7fb83..45a39f61620 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.20 2000/10/31 18:09:45 keithw Exp $ */ +/* $Id: texstate.c,v 1.21 2000/11/05 18:40:58 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -1084,23 +1084,23 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) switch (mode) { case GL_OBJECT_LINEAR: texUnit->GenModeS = mode; - texUnit->GenBitS = TEXGEN_OBJ_LINEAR; + texUnit->_GenBitS = TEXGEN_OBJ_LINEAR; break; case GL_EYE_LINEAR: texUnit->GenModeS = mode; - texUnit->GenBitS = TEXGEN_EYE_LINEAR; + texUnit->_GenBitS = TEXGEN_EYE_LINEAR; break; case GL_REFLECTION_MAP_NV: texUnit->GenModeS = mode; - texUnit->GenBitS = TEXGEN_REFLECTION_MAP_NV; + texUnit->_GenBitS = TEXGEN_REFLECTION_MAP_NV; break; case GL_NORMAL_MAP_NV: texUnit->GenModeS = mode; - texUnit->GenBitS = TEXGEN_NORMAL_MAP_NV; + texUnit->_GenBitS = TEXGEN_NORMAL_MAP_NV; break; case GL_SPHERE_MAP: texUnit->GenModeS = mode; - texUnit->GenBitS = TEXGEN_SPHERE_MAP; + texUnit->_GenBitS = TEXGEN_SPHERE_MAP; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); @@ -1132,23 +1132,23 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) switch (mode) { case GL_OBJECT_LINEAR: texUnit->GenModeT = GL_OBJECT_LINEAR; - texUnit->GenBitT = TEXGEN_OBJ_LINEAR; + texUnit->_GenBitT = TEXGEN_OBJ_LINEAR; break; case GL_EYE_LINEAR: texUnit->GenModeT = GL_EYE_LINEAR; - texUnit->GenBitT = TEXGEN_EYE_LINEAR; + texUnit->_GenBitT = TEXGEN_EYE_LINEAR; break; case GL_REFLECTION_MAP_NV: texUnit->GenModeT = GL_REFLECTION_MAP_NV; - texUnit->GenBitT = TEXGEN_REFLECTION_MAP_NV; + texUnit->_GenBitT = TEXGEN_REFLECTION_MAP_NV; break; case GL_NORMAL_MAP_NV: texUnit->GenModeT = GL_NORMAL_MAP_NV; - texUnit->GenBitT = TEXGEN_NORMAL_MAP_NV; + texUnit->_GenBitT = TEXGEN_NORMAL_MAP_NV; break; case GL_SPHERE_MAP: texUnit->GenModeT = GL_SPHERE_MAP; - texUnit->GenBitT = TEXGEN_SPHERE_MAP; + texUnit->_GenBitT = TEXGEN_SPHERE_MAP; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); @@ -1180,19 +1180,19 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) switch (mode) { case GL_OBJECT_LINEAR: texUnit->GenModeR = GL_OBJECT_LINEAR; - texUnit->GenBitR = TEXGEN_OBJ_LINEAR; + texUnit->_GenBitR = TEXGEN_OBJ_LINEAR; break; case GL_REFLECTION_MAP_NV: texUnit->GenModeR = GL_REFLECTION_MAP_NV; - texUnit->GenBitR = TEXGEN_REFLECTION_MAP_NV; + texUnit->_GenBitR = TEXGEN_REFLECTION_MAP_NV; break; case GL_NORMAL_MAP_NV: texUnit->GenModeR = GL_NORMAL_MAP_NV; - texUnit->GenBitR = TEXGEN_NORMAL_MAP_NV; + texUnit->_GenBitR = TEXGEN_NORMAL_MAP_NV; break; case GL_EYE_LINEAR: texUnit->GenModeR = GL_EYE_LINEAR; - texUnit->GenBitR = TEXGEN_EYE_LINEAR; + texUnit->_GenBitR = TEXGEN_EYE_LINEAR; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); @@ -1224,11 +1224,11 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) switch (mode) { case GL_OBJECT_LINEAR: texUnit->GenModeQ = GL_OBJECT_LINEAR; - texUnit->GenBitQ = TEXGEN_OBJ_LINEAR; + texUnit->_GenBitQ = TEXGEN_OBJ_LINEAR; break; case GL_EYE_LINEAR: texUnit->GenModeQ = GL_EYE_LINEAR; - texUnit->GenBitQ = TEXGEN_EYE_LINEAR; + texUnit->_GenBitQ = TEXGEN_EYE_LINEAR; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); @@ -1684,7 +1684,6 @@ void gl_update_dirty_texobjs( GLcontext *ctx ) for (t = ctx->Shared->DirtyTexObjList; t; t = next) { next = t->NextDirty; _mesa_test_texobj_completeness(ctx, t); - _swrast_set_texture_sampler(t); /* swrast should do this internally */ t->NextDirty = NULL; t->Dirty = GL_FALSE; } diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 96b15c27f07..d604beb9dde 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,4 +1,4 @@ -/* $Id: varray.c,v 1.29 2000/10/30 18:50:42 keithw Exp $ */ +/* $Id: varray.c,v 1.30 2000/11/05 18:40:59 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -95,9 +95,9 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) ctx->Array.Vertex.Type = type; ctx->Array.Vertex.Stride = stride; ctx->Array.Vertex.Ptr = (void *) ptr; - ctx->Array.VertexFunc = gl_trans_4f_tab[size][TYPE_IDX(type)]; - ctx->Array.VertexEltFunc = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; - ctx->Array.NewArrayState |= VERT_OBJ_ANY; + ctx->Array._VertexFunc = gl_trans_4f_tab[size][TYPE_IDX(type)]; + ctx->Array._VertexEltFunc = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; + ctx->Array._NewArrayState |= VERT_OBJ_ANY; ctx->NewState |= _NEW_ARRAY; } @@ -145,9 +145,9 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) ctx->Array.Normal.Type = type; ctx->Array.Normal.Stride = stride; ctx->Array.Normal.Ptr = (void *) ptr; - ctx->Array.NormalFunc = gl_trans_3f_tab[TYPE_IDX(type)]; - ctx->Array.NormalEltFunc = gl_trans_elt_3f_tab[TYPE_IDX(type)]; - ctx->Array.NewArrayState |= VERT_NORM; + ctx->Array._NormalFunc = gl_trans_3f_tab[TYPE_IDX(type)]; + ctx->Array._NormalEltFunc = gl_trans_elt_3f_tab[TYPE_IDX(type)]; + ctx->Array._NewArrayState |= VERT_NORM; ctx->NewState |= _NEW_ARRAY; } @@ -208,9 +208,9 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) ctx->Array.Color.Type = type; ctx->Array.Color.Stride = stride; ctx->Array.Color.Ptr = (void *) ptr; - ctx->Array.ColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)]; - ctx->Array.ColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)]; - ctx->Array.NewArrayState |= VERT_RGBA; + ctx->Array._ColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)]; + ctx->Array._ColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)]; + ctx->Array._NewArrayState |= VERT_RGBA; ctx->NewState |= _NEW_ARRAY; } @@ -243,9 +243,9 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) ctx->Array.FogCoord.Type = type; ctx->Array.FogCoord.Stride = stride; ctx->Array.FogCoord.Ptr = (void *) ptr; - ctx->Array.FogCoordFunc = gl_trans_1f_tab[TYPE_IDX(type)]; - ctx->Array.FogCoordEltFunc = gl_trans_elt_1f_tab[TYPE_IDX(type)]; - ctx->Array.NewArrayState |= VERT_FOG_COORD; + ctx->Array._FogCoordFunc = gl_trans_1f_tab[TYPE_IDX(type)]; + ctx->Array._FogCoordEltFunc = gl_trans_elt_1f_tab[TYPE_IDX(type)]; + ctx->Array._NewArrayState |= VERT_FOG_COORD; ctx->NewState |= _NEW_ARRAY; } @@ -286,9 +286,9 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) ctx->Array.Index.Type = type; ctx->Array.Index.Stride = stride; ctx->Array.Index.Ptr = (void *) ptr; - ctx->Array.IndexFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; - ctx->Array.IndexEltFunc = gl_trans_elt_1ui_tab[TYPE_IDX(type)]; - ctx->Array.NewArrayState |= VERT_INDEX; + ctx->Array._IndexFunc = gl_trans_1ui_tab[TYPE_IDX(type)]; + ctx->Array._IndexEltFunc = gl_trans_elt_1ui_tab[TYPE_IDX(type)]; + ctx->Array._NewArrayState |= VERT_INDEX; ctx->NewState |= _NEW_ARRAY; } @@ -349,9 +349,9 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, ctx->Array.SecondaryColor.Type = type; ctx->Array.SecondaryColor.Stride = stride; ctx->Array.SecondaryColor.Ptr = (void *) ptr; - ctx->Array.SecondaryColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)]; - ctx->Array.SecondaryColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)]; - ctx->Array.NewArrayState |= VERT_SPEC_RGB; + ctx->Array._SecondaryColorFunc = gl_trans_4ub_tab[size][TYPE_IDX(type)]; + ctx->Array._SecondaryColorEltFunc = gl_trans_elt_4ub_tab[size][TYPE_IDX(type)]; + ctx->Array._NewArrayState |= VERT_SPEC_RGB; ctx->NewState |= _NEW_ARRAY; } @@ -406,9 +406,9 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ctx->Array.TexCoord[texUnit].Stride = stride; ctx->Array.TexCoord[texUnit].Ptr = (void *) ptr; - ctx->Array.TexCoordFunc[texUnit] = gl_trans_4f_tab[size][TYPE_IDX(type)]; - ctx->Array.TexCoordEltFunc[texUnit] = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; - ctx->Array.NewArrayState |= VERT_TEX_ANY(texUnit); + ctx->Array._TexCoordFunc[texUnit] = gl_trans_4f_tab[size][TYPE_IDX(type)]; + ctx->Array._TexCoordEltFunc[texUnit] = gl_trans_elt_4f_tab[size][TYPE_IDX(type)]; + ctx->Array._NewArrayState |= VERT_TEX_ANY(texUnit); ctx->NewState |= _NEW_ARRAY; } @@ -429,12 +429,12 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr) ctx->Array.EdgeFlag.StrideB = stride ? stride : sizeof(GLboolean); ctx->Array.EdgeFlag.Ptr = (GLboolean *) ptr; if (stride != sizeof(GLboolean)) { - ctx->Array.EdgeFlagFunc = gl_trans_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; + ctx->Array._EdgeFlagFunc = gl_trans_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; } else { - ctx->Array.EdgeFlagFunc = 0; + ctx->Array._EdgeFlagFunc = 0; } - ctx->Array.EdgeFlagEltFunc = gl_trans_elt_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; - ctx->Array.NewArrayState |= VERT_EDGE; + ctx->Array._EdgeFlagEltFunc = gl_trans_elt_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; + ctx->Array._NewArrayState |= VERT_EDGE; ctx->NewState |= _NEW_ARRAY; } @@ -511,77 +511,77 @@ void gl_exec_array_elements( GLcontext *ctx, struct immediate *IM, { GLuint *flags = IM->Flag; GLuint *elts = IM->Elt; - GLuint translate = ctx->Array.Flags; + GLuint translate = ctx->Array._Flags; GLuint i; if (MESA_VERBOSE&VERBOSE_IMMEDIATE) fprintf(stderr, "exec_array_elements %d .. %d\n", start, count); if (translate & VERT_OBJ_ANY) - (ctx->Array.VertexEltFunc)( IM->Obj, + (ctx->Array._VertexEltFunc)( IM->Obj, &ctx->Array.Vertex, flags, elts, (VERT_ELT|VERT_OBJ_ANY), start, count); if (translate & VERT_NORM) - (ctx->Array.NormalEltFunc)( IM->Normal, + (ctx->Array._NormalEltFunc)( IM->Normal, &ctx->Array.Normal, flags, elts, (VERT_ELT|VERT_NORM), start, count); if (translate & VERT_EDGE) - (ctx->Array.EdgeFlagEltFunc)( IM->EdgeFlag, + (ctx->Array._EdgeFlagEltFunc)( IM->EdgeFlag, &ctx->Array.EdgeFlag, flags, elts, (VERT_ELT|VERT_EDGE), start, count); if (translate & VERT_RGBA) - (ctx->Array.ColorEltFunc)( IM->Color, + (ctx->Array._ColorEltFunc)( IM->Color, &ctx->Array.Color, flags, elts, (VERT_ELT|VERT_RGBA), start, count); if (translate & VERT_SPEC_RGB) - (ctx->Array.SecondaryColorEltFunc)( IM->SecondaryColor, + (ctx->Array._SecondaryColorEltFunc)( IM->SecondaryColor, &ctx->Array.SecondaryColor, flags, elts, (VERT_ELT|VERT_SPEC_RGB), start, count); if (translate & VERT_FOG_COORD) - (ctx->Array.FogCoordEltFunc)( IM->FogCoord, + (ctx->Array._FogCoordEltFunc)( IM->FogCoord, &ctx->Array.FogCoord, flags, elts, (VERT_ELT|VERT_FOG_COORD), start, count); if (translate & VERT_INDEX) - (ctx->Array.IndexEltFunc)( IM->Index, + (ctx->Array._IndexEltFunc)( IM->Index, &ctx->Array.Index, flags, elts, (VERT_ELT|VERT_INDEX), start, count); if (translate & VERT_TEX0_ANY) - (ctx->Array.TexCoordEltFunc[0])( IM->TexCoord[0], + (ctx->Array._TexCoordEltFunc[0])( IM->TexCoord[0], &ctx->Array.TexCoord[0], flags, elts, (VERT_ELT|VERT_TEX0_ANY), start, count); if (translate & VERT_TEX1_ANY) - (ctx->Array.TexCoordEltFunc[1])( IM->TexCoord[1], + (ctx->Array._TexCoordEltFunc[1])( IM->TexCoord[1], &ctx->Array.TexCoord[1], flags, elts, (VERT_ELT|VERT_TEX1_ANY), start, count); #if MAX_TEXTURE_UNITS > 2 if (translate & VERT_TEX2_ANY) - (ctx->Array.TexCoordEltFunc[2])( IM->TexCoord[2], + (ctx->Array._TexCoordEltFunc[2])( IM->TexCoord[2], &ctx->Array.TexCoord[2], flags, elts, (VERT_ELT|VERT_TEX2_ANY), start, count); #endif #if MAX_TEXTURE_UNITS > 3 if (translate & VERT_TEX3_ANY) - (ctx->Array.TexCoordEltFunc[3])( IM->TexCoord[3], + (ctx->Array._TexCoordEltFunc[3])( IM->TexCoord[3], &ctx->Array.TexCoord[3], flags, elts, (VERT_ELT|VERT_TEX3_ANY), start, count); @@ -674,7 +674,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) gl_build_immediate_pipeline( ctx ); required = elt->inputs; - fallback = (elt->inputs & ~ctx->Array.Summary); + fallback = (elt->inputs & ~ctx->Array._Summary); /* The translate function doesn't do anything about size. It * just ensures that type and stride come out right. @@ -685,7 +685,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) Color = &ctx->Array.Color; if (fallback & VERT_RGBA) { Color = &ctx->Fallback.Color; - ctx->Array.ColorFunc = + ctx->Array._ColorFunc = gl_trans_4ub_tab[4][TYPE_IDX(GL_UNSIGNED_BYTE)]; } } @@ -695,7 +695,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) SecondaryColor = &ctx->Array.SecondaryColor; if (fallback & VERT_SPEC_RGB) { SecondaryColor = &ctx->Fallback.SecondaryColor; - ctx->Array.SecondaryColorFunc = + ctx->Array._SecondaryColorFunc = gl_trans_4ub_tab[4][TYPE_IDX(GL_UNSIGNED_BYTE)]; } } @@ -705,7 +705,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) FogCoord = &ctx->Array.FogCoord; if (fallback & VERT_FOG_COORD) { FogCoord = &ctx->Fallback.FogCoord; - ctx->Array.FogCoordFunc = + ctx->Array._FogCoordFunc = gl_trans_1f_tab[TYPE_IDX(GL_FLOAT)]; } } @@ -714,7 +714,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) Index = &ctx->Array.Index; if (fallback & VERT_INDEX) { Index = &ctx->Fallback.Index; - ctx->Array.IndexFunc = gl_trans_1ui_tab[TYPE_IDX(GL_UNSIGNED_INT)]; + ctx->Array._IndexFunc = gl_trans_1ui_tab[TYPE_IDX(GL_UNSIGNED_INT)]; } } @@ -728,22 +728,22 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) TexCoord[i] = &ctx->Fallback.TexCoord[i]; TexCoord[i]->Size = gl_texcoord_size( ctx->Current.Flag, i ); - ctx->Array.TexCoordFunc[i] = + ctx->Array._TexCoordFunc[i] = gl_trans_4f_tab[TexCoord[i]->Size][TYPE_IDX(GL_FLOAT)]; } } } - if (ctx->Array.Flags != ctx->Array.Flag[0]) { + if (ctx->Array._Flags != ctx->Array._Flag[0]) { for (i = 0 ; i < VB_MAX ; i++) - ctx->Array.Flag[i] = ctx->Array.Flags; + ctx->Array._Flag[i] = ctx->Array._Flags; } if (required & VERT_NORM) { Normal = &ctx->Array.Normal; if (fallback & VERT_NORM) { Normal = &ctx->Fallback.Normal; - ctx->Array.NormalFunc = gl_trans_3f_tab[TYPE_IDX(GL_FLOAT)]; + ctx->Array._NormalFunc = gl_trans_3f_tab[TYPE_IDX(GL_FLOAT)]; } } @@ -754,7 +754,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) EdgeFlag = &ctx->Array.EdgeFlag; if (fallback & VERT_EDGE) { EdgeFlag = &ctx->Fallback.EdgeFlag; - ctx->Array.EdgeFlagFunc = + ctx->Array._EdgeFlagFunc = gl_trans_1ub_tab[TYPE_IDX(GL_UNSIGNED_BYTE)]; } } @@ -783,61 +783,61 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) VB->CullMode = 0; - ctx->Array.VertexFunc( IM->Obj + VB_START, + ctx->Array._VertexFunc( IM->Obj + VB_START, &ctx->Array.Vertex, start, n ); if (required & VERT_NORM) { - ctx->Array.NormalFunc( IM->Normal + VB_START, + ctx->Array._NormalFunc( IM->Normal + VB_START, Normal, start, n ); } if (required & VERT_EDGE) { - ctx->Array.EdgeFlagFunc( IM->EdgeFlag + VB_START, + ctx->Array._EdgeFlagFunc( IM->EdgeFlag + VB_START, EdgeFlag, start, n ); } if (required & VERT_RGBA) { - ctx->Array.ColorFunc( IM->Color + VB_START, + ctx->Array._ColorFunc( IM->Color + VB_START, Color, start, n ); } if (required & VERT_SPEC_RGB) { - ctx->Array.SecondaryColorFunc( IM->SecondaryColor + VB_START, + ctx->Array._SecondaryColorFunc( IM->SecondaryColor + VB_START, SecondaryColor, start, n ); } if (required & VERT_FOG_COORD) { - ctx->Array.FogCoordFunc( IM->FogCoord + VB_START, + ctx->Array._FogCoordFunc( IM->FogCoord + VB_START, FogCoord, start, n ); } if (required & VERT_INDEX) { - ctx->Array.IndexFunc( IM->Index + VB_START, + ctx->Array._IndexFunc( IM->Index + VB_START, Index, start, n ); } if (required & VERT_TEX0_ANY) { IM->v.TexCoord[0].size = TexCoord[0]->Size; - ctx->Array.TexCoordFunc[0]( IM->TexCoord[0] + VB_START, + ctx->Array._TexCoordFunc[0]( IM->TexCoord[0] + VB_START, TexCoord[0], start, n ); } if (required & VERT_TEX1_ANY) { IM->v.TexCoord[1].size = TexCoord[1]->Size; - ctx->Array.TexCoordFunc[1]( IM->TexCoord[1] + VB_START, + ctx->Array._TexCoordFunc[1]( IM->TexCoord[1] + VB_START, TexCoord[1], start, n ); } #if MAX_TEXTURE_UNITS > 2 if (required & VERT_TEX2_ANY) { IM->v.TexCoord[2].size = TexCoord[2]->Size; - ctx->Array.TexCoordFunc[2]( IM->TexCoord[2] + VB_START, + ctx->Array._TexCoordFunc[2]( IM->TexCoord[2] + VB_START, TexCoord[2], start, n ); } #endif #if MAX_TEXTURE_UNITS > 3 if (required & VERT_TEX3_ANY) { IM->v.TexCoord[3].size = TexCoord[3]->Size; - ctx->Array.TexCoordFunc[3]( IM->TexCoord[3] + VB_START, + ctx->Array._TexCoordFunc[3]( IM->TexCoord[3] + VB_START, TexCoord[3], start, n ); } #endif @@ -854,8 +854,8 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) VB->TexCoordPtr[i] = &IM->v.TexCoord[i]; } - VB->Flag = ctx->Array.Flag; - VB->OrFlag = ctx->Array.Flags; + VB->Flag = ctx->Array._Flag; + VB->OrFlag = ctx->Array._Flags; VB->Start = IM->Start = VB_START; count = VB->Count = IM->Count = VB_START + n; @@ -879,15 +879,17 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count) VB->NextPrimitive[VB->CopyStart] = VB->Count; VB->Primitive[VB->CopyStart] = mode; - ctx->Array.Flag[count] |= VERT_END_VB; + ctx->Array._Flag[count] |= VERT_END_VB; /* Transform and render. */ gl_run_pipeline( VB ); gl_reset_vb( VB ); - ctx->Array.Flag[count] = ctx->Array.Flags; - ctx->Array.Flag[VB_START] = ctx->Array.Flags; + /* Restore values: + */ + ctx->Array._Flag[count] = ctx->Array._Flags; + ctx->Array._Flag[VB_START] = ctx->Array._Flags; start += n; remaining -= n; @@ -1033,9 +1035,9 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice { /* Treat VERT_ELT like a special client array. */ - ctx->Array.NewArrayState |= VERT_ELT; - ctx->Array.Summary |= VERT_ELT; - ctx->Array.Flags |= VERT_ELT; + ctx->Array._NewArrayState |= VERT_ELT; + ctx->Array._Summary |= VERT_ELT; + ctx->Array._Flags |= VERT_ELT; cva->elt_mode = mode; cva->elt_count = count; @@ -1054,9 +1056,9 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice /* Did we 'precalculate' the render op? */ if (ctx->CVA.pre.ops & PIPE_OP_RENDER) { - ctx->Array.NewArrayState |= VERT_ELT; - ctx->Array.Summary &= ~VERT_ELT; - ctx->Array.Flags &= ~VERT_ELT; + ctx->Array._NewArrayState |= VERT_ELT; + ctx->Array._Summary &= ~VERT_ELT; + ctx->Array._Flags &= ~VERT_ELT; return; } @@ -1071,7 +1073,7 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice case GL_UNSIGNED_BYTE: { GLubyte *ub_indices = (GLubyte *) indices; - if (ctx->Array.Summary & VERT_OBJ_ANY) { + if (ctx->Array._Summary & VERT_OBJ_ANY) { draw_elt_ubyte( ctx, mode, ub_indices, count ); } else { gl_ArrayElement( ctx, (GLuint) ub_indices[count-1] ); @@ -1081,7 +1083,7 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice case GL_UNSIGNED_SHORT: { GLushort *us_indices = (GLushort *) indices; - if (ctx->Array.Summary & VERT_OBJ_ANY) { + if (ctx->Array._Summary & VERT_OBJ_ANY) { draw_elt_ushort( ctx, mode, us_indices, count ); } else { gl_ArrayElement( ctx, (GLuint) us_indices[count-1] ); @@ -1091,7 +1093,7 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice case GL_UNSIGNED_INT: { GLuint *ui_indices = (GLuint *) indices; - if (ctx->Array.Summary & VERT_OBJ_ANY) { + if (ctx->Array._Summary & VERT_OBJ_ANY) { draw_elt_uint( ctx, mode, ui_indices, count ); } else { gl_ArrayElement( ctx, ui_indices[count-1] ); @@ -1104,8 +1106,8 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice } if (ctx->CompileCVAFlag) { - ctx->Array.NewArrayState |= VERT_ELT; - ctx->Array.Summary &= ~VERT_ELT; + ctx->Array._NewArrayState |= VERT_ELT; + ctx->Array._Summary &= ~VERT_ELT; } } @@ -1356,30 +1358,30 @@ void gl_update_client_state( GLcontext *ctx ) }; GLint i; - ctx->Array.Flags = 0; - ctx->Array.Summary = 0; + ctx->Array._Flags = 0; + ctx->Array._Summary = 0; ctx->input->ArrayIncr = 0; - if (ctx->Array.Normal.Enabled) ctx->Array.Flags |= VERT_NORM; - if (ctx->Array.Color.Enabled) ctx->Array.Flags |= VERT_RGBA; - if (ctx->Array.SecondaryColor.Enabled) ctx->Array.Flags |= VERT_SPEC_RGB; - if (ctx->Array.FogCoord.Enabled) ctx->Array.Flags |= VERT_FOG_COORD; - if (ctx->Array.Index.Enabled) ctx->Array.Flags |= VERT_INDEX; - if (ctx->Array.EdgeFlag.Enabled) ctx->Array.Flags |= VERT_EDGE; + if (ctx->Array.Normal.Enabled) ctx->Array._Flags |= VERT_NORM; + if (ctx->Array.Color.Enabled) ctx->Array._Flags |= VERT_RGBA; + if (ctx->Array.SecondaryColor.Enabled) ctx->Array._Flags |= VERT_SPEC_RGB; + if (ctx->Array.FogCoord.Enabled) ctx->Array._Flags |= VERT_FOG_COORD; + if (ctx->Array.Index.Enabled) ctx->Array._Flags |= VERT_INDEX; + if (ctx->Array.EdgeFlag.Enabled) ctx->Array._Flags |= VERT_EDGE; if (ctx->Array.Vertex.Enabled) { - ctx->Array.Flags |= sz_flags[ctx->Array.Vertex.Size]; + ctx->Array._Flags |= sz_flags[ctx->Array.Vertex.Size]; ctx->input->ArrayIncr = 1; } for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (ctx->Array.TexCoord[i].Enabled) { - ctx->Array.Flags |= (tc_flags[ctx->Array.TexCoord[i].Size] << (i * NR_TEXSIZE_BITS)); + ctx->Array._Flags |= (tc_flags[ctx->Array.TexCoord[i].Size] << (i * NR_TEXSIZE_BITS)); } } /* Not really important any more: */ - ctx->Array.Summary = ctx->Array.Flags & VERT_DATA; - ctx->input->ArrayAndFlags = ~ctx->Array.Flags; + ctx->Array._Summary = ctx->Array._Flags & VERT_DATA; + ctx->input->ArrayAndFlags = ~ctx->Array._Flags; ctx->input->ArrayEltFlush = !(ctx->CompileCVAFlag); } diff --git a/src/mesa/x86/mmx.h b/src/mesa/x86/mmx.h index 0fad3988037..bc1abc152d3 100644 --- a/src/mesa/x86/mmx.h +++ b/src/mesa/x86/mmx.h @@ -1,4 +1,4 @@ -/* $Id: mmx.h,v 1.3 2000/10/23 00:16:28 gareth Exp $ */ +/* $Id: mmx.h,v 1.4 2000/11/05 18:41:00 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -37,42 +37,5 @@ gl_mmx_blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], GLubyte rgba[][4], const GLubyte dest[][4] ); -void gl_mmx_set_blend_function( GLcontext *ctx ) -{ - const GLenum eq = ctx->Color.BlendEquation; - const GLenum srcRGB = ctx->Color.BlendSrcRGB; - const GLenum dstRGB = ctx->Color.BlendDstRGB; - const GLenum srcA = ctx->Color.BlendSrcA; - const GLenum dstA = ctx->Color.BlendDstA; - - - if (srcRGB != srcA || dstRGB != dstA) { - ctx->Color.BlendFunc = blend_general; - } - else if (eq==GL_FUNC_ADD_EXT && srcRGB==GL_SRC_ALPHA - && dstRGB==GL_ONE_MINUS_SRC_ALPHA) { - ctx->Color.BlendFunc = gl_mmx_blend_transparency; - } - else if (eq==GL_FUNC_ADD_EXT && srcRGB==GL_ONE && dstRGB==GL_ONE) { - ctx->Color.BlendFunc = blend_add; - } - else if (((eq==GL_FUNC_ADD_EXT || eq==GL_FUNC_REVERSE_SUBTRACT_EXT) - && (srcRGB==GL_ZERO && dstRGB==GL_SRC_COLOR)) - || - ((eq==GL_FUNC_ADD_EXT || eq==GL_FUNC_SUBTRACT_EXT) - && (srcRGB==GL_DST_COLOR && dstRGB==GL_ZERO))) { - ctx->Color.BlendFunc = blend_modulate; - } - else if (eq==GL_MIN_EXT) { - ctx->Color.BlendFunc = blend_min; - } - else if (eq==GL_MAX_EXT) { - ctx->Color.BlendFunc = blend_max; - } - else { - ctx->Color.BlendFunc = blend_general; - } -} - #endif -- 2.30.2