From cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 26 Dec 2000 05:09:27 +0000 Subject: [PATCH] Major rework of tnl module New array_cache module Support 8 texture units in core mesa (now support 8 everywhere) Rework core mesa statechange operations to avoid flushing on many noop statechanges. --- src/mesa/Makefile.X11 | 78 +- src/mesa/drivers/ggi/ggimesa.c | 8 +- src/mesa/drivers/glide/fxapi.c | 61 +- src/mesa/drivers/glide/fxdd.c | 92 +- src/mesa/drivers/glide/fxddtex.c | 38 +- src/mesa/drivers/glide/fxdrv.h | 124 +- src/mesa/drivers/glide/fxsetup.c | 14 +- src/mesa/drivers/glide/fxtris.c | 568 +++++ src/mesa/drivers/glide/fxvb.c | 403 ++++ src/mesa/drivers/glide/fxvbtmp.h | 143 ++ src/mesa/drivers/osmesa/osmesa.c | 20 +- src/mesa/drivers/svga/svgamesa.c | 6 +- src/mesa/drivers/x11/xm_api.c | 6 +- src/mesa/drivers/x11/xm_dd.c | 18 +- src/mesa/drivers/x11/xmesaP.h | 4 +- src/mesa/glapi/glapitemp.h | 3223 +++++++++++++++----------- src/mesa/main/Makefile.X11 | 78 +- src/mesa/main/accum.c | 26 +- src/mesa/main/api_arrayelt.c | 284 +++ src/mesa/main/api_loopback.c | 5 +- src/mesa/main/api_noop.c | 56 +- src/mesa/main/api_noop.h | 11 + src/mesa/main/api_validate.c | 137 ++ src/mesa/main/api_validate.h | 50 + src/mesa/main/attrib.c | 23 +- src/mesa/main/blend.c | 88 +- src/mesa/main/buffers.c | 36 +- src/mesa/main/clip.c | 18 +- src/mesa/main/colortab.c | 23 +- src/mesa/main/config.h | 24 +- src/mesa/main/context.c | 29 +- src/mesa/main/convolve.c | 34 +- src/mesa/main/dd.h | 132 +- src/mesa/main/debug.c | 20 +- src/mesa/main/depth.c | 86 +- src/mesa/main/dispatch.c | 18 +- src/mesa/main/dlist.c | 1085 +++++++-- src/mesa/main/dlist.h | 26 +- src/mesa/main/drawpix.c | 7 +- src/mesa/main/enable.c | 1289 +++++----- src/mesa/main/eval.c | 357 +-- src/mesa/main/feedback.c | 106 +- src/mesa/main/fog.c | 50 +- src/mesa/main/get.c | 96 +- src/mesa/main/hint.c | 49 +- src/mesa/main/histogram.c | 50 +- src/mesa/main/light.c | 423 ++-- src/mesa/main/light.h | 9 +- src/mesa/main/lines.c | 34 +- src/mesa/main/macros.h | 20 +- src/mesa/main/matrix.c | 30 +- src/mesa/main/mtypes.h | 270 +-- src/mesa/main/pixel.c | 246 +- src/mesa/main/points.c | 44 +- src/mesa/main/polygon.c | 77 +- src/mesa/main/rastpos.c | 12 +- src/mesa/main/state.c | 72 +- src/mesa/main/stencil.c | 54 +- src/mesa/main/teximage.c | 28 +- src/mesa/main/texobj.c | 33 +- src/mesa/main/texstate.c | 739 +++--- src/mesa/main/texutil.c | 6 +- src/mesa/main/varray.c | 62 +- src/mesa/math/m_clip_tmp.h | 12 +- src/mesa/math/m_copy_tmp.h | 37 +- src/mesa/math/m_dotprod_tmp.h | 42 +- src/mesa/math/m_eval.c | 501 ++++ src/mesa/math/m_eval.h | 79 + src/mesa/math/m_translate.c | 130 +- src/mesa/math/m_translate.h | 106 +- src/mesa/math/m_vector.c | 26 +- src/mesa/math/m_vector.h | 13 +- src/mesa/math/m_xform.c | 4 +- src/mesa/math/m_xform.h | 68 +- src/mesa/math/m_xform_tmp.h | 7 +- src/mesa/swrast/s_context.c | 41 +- src/mesa/swrast/s_copypix.c | 6 +- src/mesa/swrast/s_drawpix.c | 6 +- src/mesa/swrast/swrast.h | 7 + src/mesa/swrast_setup/ss_context.c | 70 +- src/mesa/swrast_setup/ss_context.h | 12 +- src/mesa/swrast_setup/ss_triangle.c | 130 +- src/mesa/swrast_setup/ss_tritmp.h | 160 +- src/mesa/swrast_setup/ss_vb.c | 226 +- src/mesa/swrast_setup/ss_vbtmp.h | 99 +- src/mesa/swrast_setup/swrast_setup.h | 15 +- src/mesa/tnl/t_array_api.c | 355 +++ src/mesa/tnl/t_array_api.h | 47 + src/mesa/tnl/t_array_import.c | 521 +++++ src/mesa/tnl/t_array_import.h | 42 + src/mesa/tnl/t_context.c | 233 +- src/mesa/tnl/t_context.h | 729 +++--- src/mesa/tnl/t_eval_api.c | 209 ++ src/mesa/tnl/t_eval_api.h | 44 + src/mesa/tnl/t_imm_alloc.c | 104 + src/mesa/tnl/t_imm_alloc.h | 40 + src/mesa/tnl/t_imm_api.c | 1398 +++++++++++ src/mesa/tnl/t_imm_api.h | 50 + src/mesa/tnl/t_imm_debug.c | 169 ++ src/mesa/tnl/t_imm_debug.h | 11 + src/mesa/tnl/t_imm_dlist.c | 415 ++++ src/mesa/tnl/t_imm_dlist.h | 46 + src/mesa/tnl/t_imm_elt.c | 759 ++++++ src/mesa/tnl/t_imm_elt.h | 46 + src/mesa/tnl/t_imm_eval.c | 623 +++++ src/mesa/tnl/t_imm_eval.h | 40 + src/mesa/tnl/t_imm_exec.c | 507 ++++ src/mesa/tnl/t_imm_exec.h | 62 + src/mesa/tnl/t_imm_fixup.c | 811 +++++++ src/mesa/tnl/t_imm_fixup.h | 52 + src/mesa/tnl/t_pipeline.c | 501 +--- src/mesa/tnl/t_pipeline.h | 35 +- src/mesa/tnl/t_vb_cliptmp.h | 477 ++++ src/mesa/tnl/t_vb_fog.c | 201 ++ src/mesa/tnl/t_vb_light.c | 280 +++ src/mesa/tnl/t_vb_lighttmp.h | 965 ++++++++ src/mesa/tnl/t_vb_normals.c | 193 ++ src/mesa/tnl/t_vb_points.c | 124 + src/mesa/tnl/t_vb_render.c | 698 ++++++ src/mesa/tnl/t_vb_rendertmp.h | 452 ++++ src/mesa/tnl/t_vb_texgen.c | 685 ++++++ src/mesa/tnl/t_vb_texmat.c | 148 ++ src/mesa/tnl/t_vb_vertex.c | 311 +++ src/mesa/tnl/tnl.h | 17 +- src/mesa/x86/glapi_x86.S | 1240 ---------- src/mesa/x86/x86_cliptest.S | 4 +- 126 files changed, 19838 insertions(+), 6861 deletions(-) create mode 100644 src/mesa/drivers/glide/fxtris.c create mode 100644 src/mesa/drivers/glide/fxvb.c create mode 100644 src/mesa/drivers/glide/fxvbtmp.h create mode 100644 src/mesa/main/api_arrayelt.c create mode 100644 src/mesa/main/api_validate.c create mode 100644 src/mesa/main/api_validate.h create mode 100644 src/mesa/math/m_eval.c create mode 100644 src/mesa/math/m_eval.h create mode 100644 src/mesa/tnl/t_array_api.c create mode 100644 src/mesa/tnl/t_array_api.h create mode 100644 src/mesa/tnl/t_array_import.c create mode 100644 src/mesa/tnl/t_array_import.h create mode 100644 src/mesa/tnl/t_eval_api.c create mode 100644 src/mesa/tnl/t_eval_api.h create mode 100644 src/mesa/tnl/t_imm_alloc.c create mode 100644 src/mesa/tnl/t_imm_alloc.h create mode 100644 src/mesa/tnl/t_imm_api.c create mode 100644 src/mesa/tnl/t_imm_api.h create mode 100644 src/mesa/tnl/t_imm_debug.c create mode 100644 src/mesa/tnl/t_imm_debug.h create mode 100644 src/mesa/tnl/t_imm_dlist.c create mode 100644 src/mesa/tnl/t_imm_dlist.h create mode 100644 src/mesa/tnl/t_imm_elt.c create mode 100644 src/mesa/tnl/t_imm_elt.h create mode 100644 src/mesa/tnl/t_imm_eval.c create mode 100644 src/mesa/tnl/t_imm_eval.h create mode 100644 src/mesa/tnl/t_imm_exec.c create mode 100644 src/mesa/tnl/t_imm_exec.h create mode 100644 src/mesa/tnl/t_imm_fixup.c create mode 100644 src/mesa/tnl/t_imm_fixup.h create mode 100644 src/mesa/tnl/t_vb_cliptmp.h create mode 100644 src/mesa/tnl/t_vb_fog.c create mode 100644 src/mesa/tnl/t_vb_light.c create mode 100644 src/mesa/tnl/t_vb_lighttmp.h create mode 100644 src/mesa/tnl/t_vb_normals.c create mode 100644 src/mesa/tnl/t_vb_points.c create mode 100644 src/mesa/tnl/t_vb_render.c create mode 100644 src/mesa/tnl/t_vb_rendertmp.h create mode 100644 src/mesa/tnl/t_vb_texgen.c create mode 100644 src/mesa/tnl/t_vb_texmat.c create mode 100644 src/mesa/tnl/t_vb_vertex.c diff --git a/src/mesa/Makefile.X11 b/src/mesa/Makefile.X11 index 00debd391d1..9ea476376da 100644 --- a/src/mesa/Makefile.X11 +++ b/src/mesa/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.35 2000/11/24 15:21:59 keithw Exp $ +# $Id: Makefile.X11,v 1.36 2000/12/26 05:09:27 keithw Exp $ # Mesa 3-D graphics library # Version: 3.5 @@ -21,29 +21,9 @@ LIBDIR = ../lib CORE_SOURCES = \ - tnl/t_vtxfmt.c \ - tnl/t_bbox.c \ - tnl/t_clip.c \ - tnl/t_context.c \ - tnl/t_cva.c \ - tnl/t_debug.c \ - tnl/t_dlist.c \ - tnl/t_eval.c \ - tnl/t_fog.c \ - tnl/t_light.c \ - tnl/t_pipeline.c \ - tnl/t_shade.c \ - tnl/t_stages.c \ - tnl/t_texture.c \ - tnl/t_trans_elt.c \ - tnl/t_varray.c \ - tnl/t_vb.c \ - tnl/t_vbcull.c \ - tnl/t_vbindirect.c \ - tnl/t_vbrender.c \ - tnl/t_vbxform.c \ api_loopback.c \ api_noop.c \ + api_validate.c \ accum.c \ alpha.c \ attrib.c \ @@ -106,6 +86,40 @@ CORE_SOURCES = \ X86/common_x86.c \ X86/3dnow.c \ X86/katmai.c \ + swrast_setup/ss_context.c \ + swrast_setup/ss_triangle.c \ + swrast_setup/ss_vb.c \ + math/m_debug_xform.c \ + math/m_eval.c \ + math/m_matrix.c \ + math/m_translate.c \ + math/m_vector.c \ + math/m_vertices.c \ + math/m_xform.c \ + array_cache/ac_context.c \ + array_cache/ac_import.c \ + tnl/t_array_api.c \ + tnl/t_array_import.c \ + tnl/t_context.c \ + tnl/t_eval_api.c \ + tnl/t_imm_alloc.c \ + tnl/t_imm_api.c \ + tnl/t_imm_debug.c \ + tnl/t_imm_dlist.c \ + tnl/t_imm_elt.c \ + tnl/t_imm_eval.c \ + tnl/t_imm_exec.c \ + tnl/t_imm_fixup.c \ + tnl/t_pipeline.c \ + tnl/t_vb_fog.c \ + tnl/t_vb_light.c \ + tnl/t_vb_material.c \ + tnl/t_vb_normals.c \ + tnl/t_vb_points.c \ + tnl/t_vb_render.c \ + tnl/t_vb_texgen.c \ + tnl/t_vb_texmat.c \ + tnl/t_vb_vertex.c \ swrast/s_aaline.c \ swrast/s_aatriangle.c \ swrast/s_accum.c \ @@ -134,32 +148,18 @@ CORE_SOURCES = \ swrast/s_stencil.c \ swrast/s_texture.c \ swrast/s_triangle.c \ - swrast/s_zoom.c \ - swrast_setup/ss_context.c \ - swrast_setup/ss_triangle.c \ - swrast_setup/ss_vb.c \ - math/m_debug_xform.c \ - math/m_matrix.c \ - math/m_translate.c \ - math/m_vector.c \ - math/m_vertices.c \ - math/m_xform.c - + swrast/s_zoom.c DRIVER_SOURCES = \ - FX/fxvtxfmt.c \ - FX/fxvtxprims.c \ 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/fxtris.c \ + FX/fxvb.c \ FX/fxglidew.c \ X/glxapi.c \ X/fakeglx.c \ diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c index 6ba0d5db221..b10f74ec0cf 100644 --- a/src/mesa/drivers/ggi/ggimesa.c +++ b/src/mesa/drivers/ggi/ggimesa.c @@ -580,7 +580,7 @@ void GGIMesaSwapBuffers(void) } } -static void gl_ggiUpdateState(GLcontext *ctx) +static void gl_ggiUpdateState(GLcontext *ctx, GLuint new_state) { void *func; @@ -589,9 +589,9 @@ static void gl_ggiUpdateState(GLcontext *ctx) /* Propogate statechange information to swrast and swrast_setup * modules. The GGI driver has no internal GL-dependent state. */ - _swrast_InvalidateState(ctx, ctx->NewState); - _swsetup_InvalidateState(ctx, ctx->NewState); - _tnl_InvalidateState(ctx, ctx->NewState); + _swrast_InvalidateState(ctx, new_state); + _swsetup_InvalidateState(ctx, new_state); + _tnl_InvalidateState(ctx, new_state); func = (void *)CTX_OPMESA(ctx)->update_state; diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c index f3a6431aec5..6470affd9aa 100644 --- a/src/mesa/drivers/glide/fxapi.c +++ b/src/mesa/drivers/glide/fxapi.c @@ -581,55 +581,52 @@ void GLAPIENTRY fxMesaUpdateScreenSize(fxMesaContext fxMesa) */ void GLAPIENTRY fxMesaDestroyContext(fxMesaContext fxMesa) { - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxMesaDestroyContext()\n"); - } - - if(fxMesa) { - _mesa_destroy_visual(fxMesa->glVis); - _mesa_destroy_context(fxMesa->glCtx); - _mesa_destroy_framebuffer(fxMesa->glBuffer); - - glbTotNumCtx--; + if (MESA_VERBOSE&VERBOSE_DRIVER) { + fprintf(stderr,"fxmesa: fxMesaDestroyContext()\n"); + } - fxCloseHardware(); - FX_grSstWinClose(fxMesa->glideContext); + if(!fxMesa) + return; - if(fxMesa->verbose) { + if(fxMesa->verbose) { fprintf(stderr,"Misc Stats:\n"); fprintf(stderr," # swap buffer: %u\n",fxMesa->stats.swapBuffer); if(!fxMesa->stats.swapBuffer) - fxMesa->stats.swapBuffer=1; + fxMesa->stats.swapBuffer=1; fprintf(stderr,"Textures Stats:\n"); fprintf(stderr," Free texture memory on TMU0: %d:\n",fxMesa->freeTexMem[FX_TMU0]); if(fxMesa->haveTwoTMUs) - fprintf(stderr," Free texture memory on TMU1: %d:\n",fxMesa->freeTexMem[FX_TMU1]); + fprintf(stderr," Free texture memory on TMU1: %d:\n",fxMesa->freeTexMem[FX_TMU1]); fprintf(stderr," # request to TMM to upload a texture objects: %u\n", - fxMesa->stats.reqTexUpload); + fxMesa->stats.reqTexUpload); fprintf(stderr," # request to TMM to upload a texture objects per swapbuffer: %.2f\n", - fxMesa->stats.reqTexUpload/(float)fxMesa->stats.swapBuffer); + fxMesa->stats.reqTexUpload/(float)fxMesa->stats.swapBuffer); fprintf(stderr," # texture objects uploaded: %u\n", - fxMesa->stats.texUpload); + fxMesa->stats.texUpload); fprintf(stderr," # texture objects uploaded per swapbuffer: %.2f\n", - fxMesa->stats.texUpload/(float)fxMesa->stats.swapBuffer); + fxMesa->stats.texUpload/(float)fxMesa->stats.swapBuffer); fprintf(stderr," # MBs uploaded to texture memory: %.2f\n", - fxMesa->stats.memTexUpload/(float)(1<<20)); + fxMesa->stats.memTexUpload/(float)(1<<20)); fprintf(stderr," # MBs uploaded to texture memory per swapbuffer: %.2f\n", - (fxMesa->stats.memTexUpload/(float)fxMesa->stats.swapBuffer)/(float)(1<<20)); - } - if (fxMesa->state) - free(fxMesa->state); - if (fxMesa->fogTable) - free(fxMesa->fogTable); - fxTMClose(fxMesa); - - free(fxMesa); - } + (fxMesa->stats.memTexUpload/(float)fxMesa->stats.swapBuffer)/(float)(1<<20)); + } - if(fxMesa==fxMesaCurrentCtx) - fxMesaCurrentCtx=NULL; + glbTotNumCtx--; + + fxDDDestroyFxMesaContext(fxMesa); + _mesa_destroy_visual(fxMesa->glVis); + _mesa_destroy_context(fxMesa->glCtx); + _mesa_destroy_framebuffer(fxMesa->glBuffer); + + fxCloseHardware(); + FX_grSstWinClose(fxMesa->glideContext); + + free(fxMesa); + + if(fxMesa==fxMesaCurrentCtx) + fxMesaCurrentCtx=NULL; } diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index c7229561d7c..3bbe42328a9 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -59,6 +59,7 @@ #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" +#include "array_cache/acache.h" /* These lookup table are used to extract RGB values in [0,255] from * 16-bit pixel values. @@ -644,9 +645,38 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name) } } +#if 0 +static const struct gl_pipeline_stage * const fx_pipeline[] = { + &_tnl_update_material_stage, + &_tnl_vertex_transform_stage, + &_tnl_normal_transform_stage, + &_tnl_lighting_stage, /* OMIT: fog coordinate stage */ + &_tnl_texgen_stage, + &_tnl_texture_transform_stage, + &_tnl_point_attenuation_stage, + &_fx_fast_render_stage, /* ADD: the fastpath as a render stage */ + &_tnl_render_stage, /* KEEP: the old render stage for fallbacks */ + 0 +}; +#else +/* Need to turn off tnl fogging, both the stage and the clipping in + * _tnl_render_stage. Could insert a dummy stage that did nothing but + * provided storage that clipping could spin on? + */ +#endif + + int fxDDInitFxMesaContext( fxMesaContext fxMesa ) { + static int firsttime = 1; + + if (firsttime) { + fxDDSetupInit(); + fxDDTrifuncInit(); +/* fxDDFastPathInit(); */ + firsttime = 0; + } FX_setupGrVertexLayout(); @@ -734,18 +764,14 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) fxMesa->glCtx->Const.MaxTextureUnits=fxMesa->emulateTwoTMUs ? 2 : 1; fxMesa->new_state = _NEW_ALL; - fxDDSetupInit(); - fxDDTrifuncInit(); - fxDDFastPathInit(); - - /* Initialize the software rasterizer and helper modules. */ - fxMesa->glCtx->Driver.RegisterVB = fxDDRegisterVB; - _swrast_CreateContext( fxMesa->glCtx ); - _swsetup_CreateContext( fxMesa->glCtx ); + _ac_CreateContext( fxMesa->glCtx ); _tnl_CreateContext( fxMesa->glCtx ); + _swsetup_CreateContext( fxMesa->glCtx ); + + fxAllocVB( fxMesa->glCtx ); fxSetupDDPointers(fxMesa->glCtx); @@ -755,22 +781,36 @@ int fxDDInitFxMesaContext( fxMesaContext fxMesa ) _swrast_allow_pixel_fog( fxMesa->glCtx, GL_TRUE ); fxDDInitExtensions(fxMesa->glCtx); + +#ifdef FXVTXFMT fxDDInitVtxfmt(fxMesa->glCtx); +#endif FX_grGlideGetState((GrState*)fxMesa->state); - /* XXX Fix me too: need to have the 'struct dd' prepared prior to - * creating the context... The below is broken if you try to insert - * new stages. - */ - fxDDRegisterPipelineStages( fxMesa->glCtx ); - /* Run the config file */ _mesa_context_initialize( fxMesa->glCtx ); return 1; } +/* Undo the above. + */ +void fxDDDestroyFxMesaContext( fxMesaContext fxMesa ) +{ + _swsetup_DestroyContext( fxMesa->glCtx ); + _tnl_DestroyContext( fxMesa->glCtx ); + _ac_DestroyContext( fxMesa->glCtx ); + _swrast_DestroyContext( fxMesa->glCtx ); + + if (fxMesa->state) + free(fxMesa->state); + if (fxMesa->fogTable) + free(fxMesa->fogTable); + fxTMClose(fxMesa); + fxFreeVB(fxMesa->glCtx); +} + @@ -784,6 +824,9 @@ void fxDDInitExtensions( GLcontext *ctx ) gl_extensions_disable(ctx, "GL_EXT_blend_color"); gl_extensions_disable(ctx, "GL_EXT_fog_coord"); + if (1) + gl_extensions_disable(ctx, "GL_EXT_point_parameters"); + gl_extensions_add(ctx, GL_TRUE, "3DFX_set_global_palette", 0); if (!fxMesa->haveTwoTMUs) @@ -922,14 +965,14 @@ static void update_texture_scales( GLcontext *ctx ) } } -static void fxDDUpdateDDPointers(GLcontext *ctx) +static void fxDDUpdateDDPointers(GLcontext *ctx, GLuint new_state) { fxMesaContext fxMesa = FX_CONTEXT(ctx); - GLuint new_state = ctx->NewState; _swrast_InvalidateState( ctx, new_state ); - _swsetup_InvalidateState( ctx, new_state ); + _ac_InvalidateState( ctx, new_state ); _tnl_InvalidateState( ctx, new_state ); + _swsetup_InvalidateState( ctx, new_state ); /* Recalculate fog table on projection matrix changes. This used to * be triggered by the NearFar callback. @@ -954,22 +997,22 @@ static void fxDDUpdateDDPointers(GLcontext *ctx) fxDDChooseRenderState( ctx ); if (new_state & _FX_NEW_SETUP_FUNCTION) - ctx->Driver.RasterSetup = fxDDChooseSetupFunction(ctx); + ctx->Driver.BuildProjectedVertices = fx_validate_BuildProjVerts; if (new_state & _NEW_TEXTURE) update_texture_scales( ctx ); } +#ifdef FXVTXFMT if (fxMesa->allow_vfmt) { if (new_state & _NEW_LIGHT) fx_update_lighting( ctx ); if (new_state & _FX_NEW_VTXFMT) fxDDCheckVtxfmt( ctx ); - else if (fxMesa->vtxfmt_fallback_count > 1) - fxMesa->vtxfmt_fallback_count--; } +#endif } @@ -1006,6 +1049,7 @@ void fxSetupDDPointers(GLcontext *ctx) ctx->Driver.RenderStart=fxSetupFXUnits; ctx->Driver.RenderFinish=_swrast_flush; + ctx->Driver.ResetLineStipple=_swrast_ResetLineStipple; ctx->Driver.TexImage2D = fxDDTexImage2D; ctx->Driver.TexSubImage2D = fxDDTexSubImage2D; @@ -1028,14 +1072,10 @@ void fxSetupDDPointers(GLcontext *ctx) ctx->Driver.ShadeModel=fxDDShadeModel; ctx->Driver.Enable=fxDDEnable; - ctx->Driver.RegisterVB=fxDDRegisterVB; - ctx->Driver.UnregisterVB=fxDDUnregisterVB; - - if (!getenv("FX_NO_FAST")) - ctx->Driver.BuildPrecalcPipeline = fxDDBuildPrecalcPipeline; + fxSetupDDSpanPointers(ctx); - fxDDUpdateDDPointers(ctx); + fxDDUpdateDDPointers(ctx,~0); } diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index f7beaf7e34f..7c101e823d9 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -333,11 +333,6 @@ void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj) FREE(ti); tObj->DriverData = NULL; - -/* Pushed into core: Set _NEW_TEXTURE whenever a bound texture is - * deleted (changes bound texture id). - */ -/* ctx->NewState |= _NEW_TEXTURE; */ } @@ -824,6 +819,23 @@ static GLboolean fxIsTexSupported(GLenum target, GLint internalFormat, /**** NEW TEXTURE IMAGE FUNCTIONS ****/ /**********************************************************************/ + +static void PrintTexture(int w, int h, int c, const GLubyte *data) +{ + int i, j; + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + if (c==2) + printf("%02x %02x ", data[0], data[1]); + else if (c==3) + printf("%02x %02x %02x ", data[0], data[1], data[2]); + data += c; + } + printf("\n"); + } +} + + GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, @@ -960,6 +972,7 @@ GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level, return GL_FALSE; } + if (ti->validated && ti->isInTM) { /*printf("reloadmipmaplevels\n");*/ fxTMReloadMipMapLevel(fxMesa, texObj, level); @@ -1082,21 +1095,6 @@ GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, } -static void PrintTexture(int w, int h, int c, const GLubyte *data) -{ - int i, j; - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - if (c==2) - printf("%02x %02x ", data[0], data[1]); - else if (c==3) - printf("%02x %02x %02x ", data[0], data[1], data[2]); - data += c; - } - printf("\n"); - } -} - GLvoid *fxDDGetTexImage(GLcontext *ctx, GLenum target, GLint level, const struct gl_texture_object *texObj, diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h index 9146966c212..4e4eea96a3b 100644 --- a/src/mesa/drivers/glide/fxdrv.h +++ b/src/mesa/drivers/glide/fxdrv.h @@ -142,8 +142,9 @@ typedef void (*vfmt_interpolate_func)( GLfloat t, #define SETUP_TMU0 0x1 #define SETUP_TMU1 0x2 #define SETUP_RGBA 0x4 -#define SETUP_XYZW 0x8 -#define MAX_SETUP 0x10 +#define SETUP_SNAP 0x8 +#define SETUP_XYZW 0x10 +#define MAX_SETUP 0x20 #define FX_NUM_TMU 2 @@ -291,19 +292,7 @@ typedef struct { #define FX_NEW_COLOR_MASK 0x40 #define FX_NEW_CULL 0x80 -/* FX struct stored in VB->driver_data. - */ -struct tfxMesaVertexBuffer { - GLvector1ui clipped_elements; - - fxVertex *verts; - fxVertex *last_vert; - void *vert_store; - - GLuint size; -}; -#define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data)) #define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx)) #define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->_Current) @@ -350,10 +339,13 @@ struct tfxMesaVertexBuffer { /* Covers the state referenced in fxDDCheckVtxfmt. */ -#define _FX_NEW_VTXFMT (_NEW_TEXTURE | \ - _NEW_TEXTURE_MATRIX | \ - _NEW_TRANSFORM | \ - _NEW_LIGHT | \ +#define _FX_NEW_VTXFMT (_NEW_TEXTURE | \ + _NEW_TEXTURE_MATRIX | \ + _NEW_TRANSFORM | \ + _NEW_LIGHT | \ + _NEW_PROJECTION | \ + _NEW_MODELVIEW | \ + _TNL_NEW_NEED_EYE_COORDS | \ _FX_NEW_RENDERSTATE) @@ -365,10 +357,10 @@ extern GLubyte FX_PixelToG[0x10000]; extern GLubyte FX_PixelToB[0x10000]; -typedef void (*fx_tri_func)( GLcontext *, const fxVertex *, const fxVertex *, const fxVertex * ); +typedef void (*fx_tri_func)( GLcontext *, const fxVertex *, + const fxVertex *, const fxVertex * ); typedef void (*fx_line_func)( GLcontext *, const fxVertex *, const fxVertex * ); typedef void (*fx_point_func)( GLcontext *, const fxVertex * ); -typedef void (*fxRenderEltsFunc)( struct vertex_buffer * ); struct tfxMesaContext { GuTexPalette glbPalette; @@ -392,18 +384,11 @@ struct tfxMesaContext { tfxUnitsState unitsState; tfxUnitsState restoreUnitsState; /* saved during multipass */ - GLuint tmu_source[FX_NUM_TMU]; - GLuint tex_dest[MAX_TEXTURE_UNITS]; - GLuint render_index; - GLuint setupindex; - GLuint setupdone; - GLuint stw_hint_state; /* for grHints */ - GLuint is_in_hardware; - GLuint new_state; - GLuint using_fast_path, passes, multipass; - /* Texture Memory Manager Data */ + GLuint new_state; + /* Texture Memory Manager Data + */ GLuint texBindNumber; GLint tmuSrc; GLuint lastUnitsMode; @@ -417,14 +402,28 @@ struct tfxMesaContext { GrFog_t *fogTable; GLint textureAlign; - /* Acc. functions */ + /* Vertex building and storage: + */ + GLuint tmu_source[FX_NUM_TMU]; + GLuint tex_dest[MAX_TEXTURE_UNITS]; + GLuint setupindex; + GLuint setup_gone; /* for multipass */ + GLuint stw_hint_state; /* for grHints */ + fxVertex *verts; + + /* Rasterization: + */ + GLuint render_index; + GLuint passes, multipass; + GLuint is_in_hardware; + + /* Current rasterization functions + */ fx_point_func draw_point; fx_line_func draw_line; fx_tri_func draw_tri; - fxRenderEltsFunc RenderElementsRaw; - /* System to turn culling on/off for tris/lines/points. */ fx_point_func initial_point; @@ -435,6 +434,8 @@ struct tfxMesaContext { fx_line_func subsequent_line; fx_tri_func subsequent_tri; + /* Keep texture scales somewhere handy: + */ GLfloat s0scale; GLfloat s1scale; GLfloat t0scale; @@ -445,8 +446,9 @@ struct tfxMesaContext { GLfloat inv_t0scale; GLfloat inv_t1scale; + /* Glide stuff + */ tfxStats stats; - void *state; /* Options */ @@ -476,7 +478,6 @@ struct tfxMesaContext { GLboolean allow_vfmt; GLvertexformat vtxfmt; fxClipVertex current; - fxClipVertex verts[4]; fxClipVertex *vert; /* points into verts[] */ void (*fire_on_vertex)( GLcontext * ); void (*fire_on_end)( GLcontext * ); @@ -492,29 +493,42 @@ struct tfxMesaContext { GLuint accel_light; GLfloat basecolor[4]; + + + /* Projected vertices, fastpath data: + */ + GLvector1ui clipped_elements; + fxVertex *last_vert; + GLuint size; }; -typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint); +typedef void (*tfxSetupFunc)(GLcontext *ctx, GLuint, GLuint, GLuint); extern GrHwConfiguration glbHWConfig; extern int glbCurrentBoard; -extern void fxPrintSetupFlags( const char *msg, GLuint flags ); extern void fxSetupFXUnits(GLcontext *); extern void fxSetupDDPointers(GLcontext *); +/* fxvsetup: + */ extern void fxDDSetupInit(void); -extern void fxDDCvaInit(void); +extern void fxAllocVB( GLcontext *ctx ); +extern void fxFreeVB( GLcontext *ctx ); +extern void fxPrintSetupFlags( const char *msg, GLuint flags ); +extern void fx_BuildProjVerts( GLcontext *ctx, + GLuint start, GLuint count, + GLuint newinputs ); +extern void fx_validate_BuildProjVerts(GLcontext *ctx, + GLuint start, GLuint count, + GLuint newinputs ); + +/* fxtrifuncs: + */ extern void fxDDTrifuncInit(void); -extern void fxDDFastPathInit(void); - extern void fxDDChooseRenderState( GLcontext *ctx ); -extern tfxSetupFunc fxDDChooseSetupFunction(GLcontext *); - -extern void fxDDRenderInit(GLcontext *); - extern void fxUpdateDDSpanPointers(GLcontext *); extern void fxSetupDDSpanPointers(GLcontext *); @@ -550,18 +564,6 @@ extern void fxDDBlendFunc(GLcontext *, GLenum, GLenum); extern void fxDDDepthMask(GLcontext *, GLboolean); extern void fxDDDepthFunc(GLcontext *, GLenum); -extern void fxDDRegisterVB( struct vertex_buffer *VB ); -extern void fxDDUnregisterVB( struct vertex_buffer *VB ); -extern void fxDDResizeVB( struct vertex_buffer *VB, GLuint size ); - -extern void fxDDPartialRasterSetup( struct vertex_buffer *VB ); - -extern void fxDDDoRasterSetup( struct vertex_buffer *VB ); - -extern void fxDDRegisterPipelineStages( GLcontext *ctx ); - -extern GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx ); - extern void fxDDInitExtensions( GLcontext *ctx ); #define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData)) @@ -601,8 +603,6 @@ extern void fxDDReadDepthPixels(GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLdepth depth[]); -extern void fxDDFastPath( struct vertex_buffer *VB ); - extern void fxDDShadeModel(GLcontext *ctx, GLenum mode); extern void fxDDCullFace(GLcontext *ctx, GLenum mode); @@ -611,9 +611,10 @@ extern void fxDDFrontFace(GLcontext *ctx, GLenum mode); extern void fxPrintRenderState( const char *msg, GLuint state ); extern void fxPrintHintState( const char *msg, GLuint state ); -extern void fxDDDoRenderVB( struct vertex_buffer *VB ); - extern int fxDDInitFxMesaContext( fxMesaContext fxMesa ); +extern void fxDDDestroyFxMesaContext( fxMesaContext fxMesa ); + + extern void fxSetScissorValues(GLcontext *ctx); @@ -622,6 +623,9 @@ extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa, GLint where); extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder); + +/* fxvtxfmt: + */ extern void fxDDCheckVtxfmt( GLcontext *ctx ); extern void fx_update_lighting( GLcontext *ctx ); extern void fxDDInitVtxfmt( GLcontext *ctx ); diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index f4fde1214ef..5b768848ce2 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -71,7 +71,7 @@ static void fxSetupScissor(GLcontext *ctx); static void fxSetupCull(GLcontext *ctx); static void fx_print_state_flags( const char *msg, GLuint flags); /*static GLboolean fxMultipassBlend(struct vertex_buffer *, GLuint);*/ -static GLboolean fxMultipassTexture( struct vertex_buffer *, GLuint ); +static GLboolean fxMultipassTexture( GLcontext *, GLuint ); static void fxTexValidate(GLcontext *ctx, struct gl_texture_object *tObj) { @@ -1671,7 +1671,7 @@ static GLboolean fxMultipassBlend(struct vertex_buffer *VB, GLuint pass) case 2: /* Reset everything back to normal */ fxMesa->unitsState = fxMesa->restoreUnitsState; - fxMesa->setupdone &= XXX; + fxMesa->setup_gone |= XXX; fxSetupTextureSingleTMU(ctx, XXX); fxSetupBlend(ctx); fxSetupDepthTest(ctx); @@ -1694,12 +1694,12 @@ static GLboolean fxMultipassBlend(struct vertex_buffer *VB, GLuint pass) * voodoo 1. In all other cases for both voodoo 1 and 2, we fall back * to software rendering, satisfying the spec if not the user. */ -static GLboolean fxMultipassTexture( struct vertex_buffer *VB, GLuint pass ) +static GLboolean fxMultipassTexture( GLcontext *ctx, GLuint pass ) { - GLcontext *ctx = VB->ctx; - fxVertex *v = FX_DRIVER_DATA(VB)->verts; - fxVertex *last = FX_DRIVER_DATA(VB)->last_vert; fxMesaContext fxMesa = FX_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + fxVertex *v = fxMesa->verts; + fxVertex *last = fxMesa->verts + tnl->vb.Count; switch (pass) { case 1: @@ -1742,7 +1742,7 @@ static GLboolean fxMultipassTexture( struct vertex_buffer *VB, GLuint pass ) */ fxMesa->tmu_source[0] = 0; fxMesa->unitsState = fxMesa->restoreUnitsState; - fxMesa->setupdone &= ~SETUP_TMU0; + fxMesa->setup_gone |= SETUP_TMU0; fxSetupTextureSingleTMU( ctx, 0 ); fxSetupBlend( ctx ); fxSetupDepthTest( ctx ); diff --git a/src/mesa/drivers/glide/fxtris.c b/src/mesa/drivers/glide/fxtris.c new file mode 100644 index 00000000000..7d887133b61 --- /dev/null +++ b/src/mesa/drivers/glide/fxtris.c @@ -0,0 +1,568 @@ + + +#ifdef HAVE_CONFIG_H +#include "conf.h" +#endif + +#if defined(FX) + +#include "mmath.h" +#include "swrast/swrast.h" +#include "swrast_setup/swrast_setup.h" + +#include "tnl/t_context.h" + +#include "fxdrv.h" +#include "fxglidew.h" + + + + + + + + +static void +fx_draw_point( GLcontext *ctx, const fxVertex *v ) +{ + GLfloat sz = ctx->Point._Size; + + if ( sz <= 1.0 ) + { + grDrawPoint( &(v->v) ); + } + else + { + GrVertex verts[4]; + + sz *= .5; + + verts[0] = v->v; + verts[1] = v->v; + verts[2] = v->v; + verts[3] = v->v; + + verts[0].x = v->v.x - sz; + verts[0].y = v->v.y - sz; + + verts[1].x = v->v.x + sz; + verts[1].y = v->v.y - sz; + + verts[2].x = v->v.x + sz; + verts[2].y = v->v.y + sz; + + verts[3].x = v->v.x - sz; + verts[3].y = v->v.y + sz; + + grDrawTriangle( &verts[0], &verts[1], &verts[3] ); + grDrawTriangle( &verts[1], &verts[2], &verts[3] ); + } +} + + +static void +fx_draw_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 ) +{ + float width = ctx->Line.Width; + + if ( width <= 1.0 ) + { + grDrawLine( &(v0->v), &(v1->v) ); + } + else + { + GrVertex verts[4]; + float dx, dy, ix, iy; + + dx = v0->v.x - v1->v.x; + dy = v0->v.y - v1->v.y; + + if (dx * dx > dy * dy) { + iy = width * .5; + ix = 0; + } else { + iy = 0; + ix = width * .5; + } + + + verts[0] = v0->v; + verts[0].x -= ix; + verts[0].y -= iy; + + verts[1] = v0->v; + verts[1].x += ix; + verts[1].y += iy; + + verts[2] = v1->v; + verts[2].x += ix; + verts[2].y += iy; + + verts[3] = v1->v; + verts[3].x -= ix; + verts[3].y -= iy; + + grDrawTriangle( &verts[0], &verts[1], &verts[3] ); + grDrawTriangle( &verts[1], &verts[2], &verts[3] ); + } +} + +static void +fx_draw_tri( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1, + const fxVertex *v2 ) +{ + grDrawTriangle( &(v0->v), &(v1->v), &(v2->v) ); +} + + + +#define FX_COLOR(vert, c) { \ + GLubyte *col = c; \ + vert->v.r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \ + vert->v.g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \ + vert->v.b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \ + vert->v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \ +} + +#define FX_COPY_COLOR( dst, src ) { \ + dst->v.r = src->v.r; \ + dst->v.g = src->v.g; \ + dst->v.b = src->v.b; \ + dst->v.a = src->v.a; \ +} + + + +#define FX_FLAT_BIT 0x01 +#define FX_OFFSET_BIT 0x02 +#define FX_TWOSIDE_BIT 0x04 +#define FX_UNFILLED_BIT 0x10 +#define FX_FALLBACK_BIT 0x20 +#define FX_MAX_TRIFUNC 0x40 + +static struct { + points_func points; + line_func line; + triangle_func triangle; + quad_func quad; +} rast_tab[FX_MAX_TRIFUNC]; + + +#define IND (0) +#define TAG(x) x +#include "fxtritmp.h" + +#define IND (FX_FLAT_BIT) +#define TAG(x) x##_flat +#include "fxtritmp.h" + +#define IND (FX_OFFSET_BIT) +#define TAG(x) x##_offset +#include "fxtritmp.h" + +#define IND (FX_OFFSET_BIT | FX_FLAT_BIT) +#define TAG(x) x##_offset_flat +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT) +#define TAG(x) x##_twoside +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_FLAT_BIT) +#define TAG(x) x##_twoside_flat +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT) +#define TAG(x) x##_twoside_offset +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FLAT_BIT) +#define TAG(x) x##_twoside_offset_flat +#include "fxtritmp.h" + +#define IND (FX_FALLBACK_BIT) +#define TAG(x) x##_fallback +#include "fxtritmp.h" + +#define IND (FX_FLAT_BIT | FX_FALLBACK_BIT) +#define TAG(x) x##_flat_fallback +#include "fxtritmp.h" + +#define IND (FX_OFFSET_BIT | FX_FALLBACK_BIT) +#define TAG(x) x##_offset_fallback +#include "fxtritmp.h" + +#define IND (FX_OFFSET_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT) +#define TAG(x) x##_offset_flat_fallback +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_FALLBACK_BIT) +#define TAG(x) x##_twoside_fallback +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT) +#define TAG(x) x##_twoside_flat_fallback +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FALLBACK_BIT) +#define TAG(x) x##_twoside_offset_fallback +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT) +#define TAG(x) x##_twoside_offset_flat_fallback +#include "fxtritmp.h" + +#define IND (FX_UNFILLED_BIT) +#define TAG(x) x##_unfilled +#include "fxtritmp.h" + +#define IND (FX_FLAT_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_flat_unfilled +#include "fxtritmp.h" + +#define IND (FX_OFFSET_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_offset_unfilled +#include "fxtritmp.h" + +#define IND (FX_OFFSET_BIT | FX_FLAT_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_offset_flat_unfilled +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_twoside_unfilled +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_FLAT_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_twoside_flat_unfilled +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_twoside_offset_unfilled +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FLAT_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_twoside_offset_flat_unfilled +#include "fxtritmp.h" + +#define IND (FX_FALLBACK_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_fallback_unfilled +#include "fxtritmp.h" + +#define IND (FX_FLAT_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_flat_fallback_unfilled +#include "fxtritmp.h" + +#define IND (FX_OFFSET_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_offset_fallback_unfilled +#include "fxtritmp.h" + +#define IND (FX_OFFSET_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_offset_flat_fallback_unfilled +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_twoside_fallback_unfilled +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_twoside_flat_fallback_unfilled +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_twoside_offset_fallback_unfilled +#include "fxtritmp.h" + +#define IND (FX_TWOSIDE_BIT | FX_OFFSET_BIT | FX_FLAT_BIT | FX_FALLBACK_BIT | FX_UNFILLED_BIT) +#define TAG(x) x##_twoside_offset_flat_fallback_unfilled +#include "fxtritmp.h" + + + + + + +void fxDDTrifuncInit( void ) +{ + init(); + init_flat(); + init_offset(); + init_offset_flat(); + init_twoside(); + init_twoside_flat(); + init_twoside_offset(); + init_twoside_offset_flat(); + init_fallback(); + init_flat_fallback(); + init_offset_fallback(); + init_offset_flat_fallback(); + init_twoside_fallback(); + init_twoside_flat_fallback(); + init_twoside_offset_fallback(); + init_twoside_offset_flat_fallback(); + + init_unfilled(); + init_flat_unfilled(); + init_offset_unfilled(); + init_offset_flat_unfilled(); + init_twoside_unfilled(); + init_twoside_flat_unfilled(); + init_twoside_offset_unfilled(); + init_twoside_offset_flat_unfilled(); + init_fallback_unfilled(); + init_flat_fallback_unfilled(); + init_offset_fallback_unfilled(); + init_offset_flat_fallback_unfilled(); + init_twoside_fallback_unfilled(); + init_twoside_flat_fallback_unfilled(); + init_twoside_offset_fallback_unfilled(); + init_twoside_offset_flat_fallback_unfilled(); +} + + +/* Build an SWvertex from a GrVertex. This is workable because in + * states where the GrVertex is insufficent (eg seperate-specular), + * the driver initiates a total fallback, and builds SWvertices + * directly -- it recognizes that it will never have use for the + * GrVertex. + * + * This code is hit only when a mix of accelerated and unaccelerated + * primitives are being drawn, and only for the unaccelerated + * primitives. + */ +static void +fx_translate_vertex(GLcontext *ctx, const fxVertex *src, SWvertex *dst) +{ + fxMesaContext fxMesa = FX_CONTEXT( ctx ); + GLuint ts0 = fxMesa->tmu_source[0]; + GLuint ts1 = fxMesa->tmu_source[1]; + GLfloat w = 1.0 / src->v.oow; + + dst->win[0] = src->v.x; + dst->win[1] = src->v.y; + dst->win[2] = src->v.ooz; + dst->win[3] = src->v.oow; + + dst->color[0] = (GLubyte) src->v.r; + dst->color[1] = (GLubyte) src->v.g; + dst->color[2] = (GLubyte) src->v.b; + dst->color[3] = (GLubyte) src->v.a; + + dst->texcoord[ts0][0] = fxMesa->inv_s0scale * src->v.tmuvtx[0].sow * w; + dst->texcoord[ts0][1] = fxMesa->inv_t0scale * src->v.tmuvtx[0].tow * w; + + if (fxMesa->stw_hint_state & GR_STWHINT_W_DIFF_TMU0) + dst->texcoord[ts0][3] = src->v.tmuvtx[0].oow * w; + else + dst->texcoord[ts0][3] = 1.0; + + dst->texcoord[ts1][0] = fxMesa->inv_s1scale * src->v.tmuvtx[1].sow * w; + dst->texcoord[ts1][1] = fxMesa->inv_t1scale * src->v.tmuvtx[1].tow * w; + + if (fxMesa->stw_hint_state & GR_STWHINT_W_DIFF_TMU1) + dst->texcoord[ts1][3] = src->v.tmuvtx[1].oow * w; + else + dst->texcoord[ts1][3] = 1.0; +} + + +static void +fx_fallback_tri( GLcontext *ctx, + const fxVertex *v0, const fxVertex *v1, const fxVertex *v2 ) +{ + SWvertex v[3]; + fx_translate_vertex( ctx, v0, &v[0] ); + fx_translate_vertex( ctx, v1, &v[1] ); + fx_translate_vertex( ctx, v2, &v[2] ); + _swrast_Triangle( ctx, &v[0], &v[1], &v[2] ); +} + + +static void +fx_fallback_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 ) +{ + SWvertex v[2]; + fx_translate_vertex( ctx, v0, &v[0] ); + fx_translate_vertex( ctx, v1, &v[1] ); + _swrast_Line( ctx, &v[0], &v[1] ); +} + + +static void +fx_fallback_point( GLcontext *ctx, const fxVertex *v0 ) +{ + SWvertex v[1]; + fx_translate_vertex( ctx, v0, &v[0] ); + _swrast_Point( ctx, &v[0] ); +} + + +/* System to turn culling off for rasterized lines and points, and + * back on for rasterized triangles. + */ +static void +fx_cull_draw_tri( GLcontext *ctx, + const fxVertex *v0, const fxVertex *v1, const fxVertex *v2 ) +{ + fxMesaContext fxMesa = FX_CONTEXT( ctx ); + + FX_grCullMode(fxMesa->cullMode); + + fxMesa->draw_line = fxMesa->initial_line; + fxMesa->draw_point = fxMesa->initial_point; + fxMesa->draw_tri = fxMesa->subsequent_tri; + + fxMesa->draw_tri( ctx, v0, v1, v2 ); +} + + +static void +fx_cull_draw_line( GLcontext *ctx, const fxVertex *v0, const fxVertex *v1 ) +{ + fxMesaContext fxMesa = FX_CONTEXT( ctx ); + + FX_grCullMode( GR_CULL_DISABLE ); + + fxMesa->draw_point = fxMesa->initial_point; + fxMesa->draw_tri = fxMesa->initial_tri; + fxMesa->draw_line = fxMesa->subsequent_line; + + fxMesa->draw_line( ctx, v0, v1 ); +} + + +static void +fx_cull_draw_point( GLcontext *ctx, const fxVertex *v0 ) +{ + fxMesaContext fxMesa = FX_CONTEXT( ctx ); + + FX_grCullMode(GR_CULL_DISABLE); + + fxMesa->draw_line = fxMesa->initial_line; + fxMesa->draw_tri = fxMesa->initial_tri; + fxMesa->draw_point = fxMesa->subsequent_point; + + fxMesa->draw_point( ctx, v0 ); +} + + +static void +fx_null_tri( GLcontext *ctx, + const fxVertex *v0, const fxVertex *v1, const fxVertex *v2 ) +{ + (void) v0; + (void) v1; + (void) v2; +} + + + +#define POINT_FALLBACK (DD_POINT_SMOOTH ) +#define LINE_FALLBACK (DD_LINE_STIPPLE) +#define TRI_FALLBACK (DD_TRI_SMOOTH | DD_TRI_STIPPLE ) +#define ANY_FALLBACK (POINT_FALLBACK | LINE_FALLBACK | TRI_FALLBACK) + + +#define ANY_RENDER_FLAGS (DD_FLATSHADE | \ + DD_TRI_LIGHT_TWOSIDE | \ + DD_TRI_OFFSET | \ + DD_TRI_UNFILLED) + + + +/* Setup the Point, Line, Triangle and Quad functions based on the + * current rendering state. Wherever possible, use the hardware to + * render the primitive. Otherwise, fallback to software rendering. + */ +void fxDDChooseRenderState( GLcontext *ctx ) +{ + fxMesaContext fxMesa = FX_CONTEXT( ctx ); + GLuint flags = ctx->_TriangleCaps; + GLuint index = 0; + + if ( !fxMesa->is_in_hardware ) { + /* Build software vertices directly. No acceleration is + * possible. GrVertices may be insufficient for this mode. + */ + ctx->Driver.PointsFunc = _swsetup_Points; + ctx->Driver.LineFunc = _swsetup_Line; + ctx->Driver.TriangleFunc = _swsetup_Triangle; + ctx->Driver.QuadFunc = _swsetup_Quad; + + fxMesa->render_index = FX_FALLBACK_BIT; + return; + } + + if ( flags & ANY_RENDER_FLAGS ) { + if ( flags & DD_FLATSHADE ) index |= FX_FLAT_BIT; + if ( flags & DD_TRI_LIGHT_TWOSIDE ) index |= FX_TWOSIDE_BIT; + if ( flags & DD_TRI_OFFSET ) index |= FX_OFFSET_BIT; + if ( flags & DD_TRI_UNFILLED ) index |= FX_UNFILLED_BIT; + } + + if ( flags & (ANY_FALLBACK| + DD_LINE_WIDTH| + DD_POINT_SIZE| + DD_TRI_CULL_FRONT_BACK) ) { + + /* Hook in fallbacks for specific primitives. + * + * Set up a system to turn culling on/off for wide points and + * lines. Alternately: figure out what tris to send so that + * culling isn't a problem. + * + * This replaces the ReducedPrimitiveChange mechanism. + */ + index |= FX_FALLBACK_BIT; + fxMesa->initial_point = fx_cull_draw_point; + fxMesa->initial_line = fx_cull_draw_line; + fxMesa->initial_tri = fx_cull_draw_tri; + + fxMesa->subsequent_point = fx_draw_point; + fxMesa->subsequent_line = fx_draw_line; + fxMesa->subsequent_tri = fx_draw_tri; + + if ( flags & POINT_FALLBACK ) + fxMesa->initial_point = fx_fallback_point; + + if ( flags & LINE_FALLBACK ) + fxMesa->initial_line = fx_fallback_line; + + if ((flags & DD_LINE_SMOOTH) && ctx->Line.Width != 1.0) + fxMesa->initial_line = fx_fallback_line; + + if ( flags & TRI_FALLBACK ) + fxMesa->initial_tri = fx_fallback_tri; + + if ( flags & DD_TRI_CULL_FRONT_BACK ) + fxMesa->initial_tri = fx_null_tri; + + fxMesa->draw_point = fxMesa->initial_point; + fxMesa->draw_line = fxMesa->initial_line; + fxMesa->draw_tri = fxMesa->initial_tri; + } + else if (fxMesa->render_index & FX_FALLBACK_BIT) { + FX_grCullMode(fxMesa->cullMode); + } + + ctx->Driver.PointsFunc = rast_tab[index].points; + ctx->Driver.LineFunc = rast_tab[index].line; + ctx->Driver.TriangleFunc = rast_tab[index].triangle; + ctx->Driver.QuadFunc = rast_tab[index].quad; + fxMesa->render_index = index; +} + + +#else + + +/* + * Need this to provide at least one external definition. + */ + +extern int gl_fx_dummy_function_trifuncs(void); +int gl_fx_dummy_function_trifuncs(void) +{ + return 0; +} + +#endif /* FX */ diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c new file mode 100644 index 00000000000..22128e61f6b --- /dev/null +++ b/src/mesa/drivers/glide/fxvb.c @@ -0,0 +1,403 @@ + +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * + * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the + * terms stated above. + * + * Author: + * Keith Whitwell + */ + + +/* fxvsetup.c - 3Dfx VooDoo vertices setup functions */ + + +#ifdef HAVE_CONFIG_H +#include "conf.h" +#endif + +#if defined(FX) + +#include "fxdrv.h" +#include "mmath.h" +#include "swrast_setup/swrast_setup.h" + +#include "tnl/t_context.h" +#include "tnl/t_pipeline.h" + + +void fxPrintSetupFlags( const char *msg, GLuint flags ) +{ + fprintf(stderr, "%s: %d %s%s%s%s%s\n", + msg, + flags, + (flags & SETUP_XYZW) ? " xyzw," : "", + (flags & SETUP_SNAP) ? " snap," : "", + (flags & SETUP_RGBA) ? " rgba," : "", + (flags & SETUP_TMU0) ? " tmu0," : "", + (flags & SETUP_TMU1) ? " tmu1," : ""); +} + +static void project_texcoords( fxVertex *v, + struct vertex_buffer *VB, + GLuint tmu_nr, GLuint tc_nr, + GLuint start, GLuint count ) +{ + GrTmuVertex *tmu = &(v->v.tmuvtx[tmu_nr]); + GLvector4f *vec = VB->TexCoordPtr[tc_nr]; + + GLuint i; + GLuint stride = vec->stride; + GLfloat *data = VEC_ELT(vec, GLfloat, start); + + for (i = start ; i < count ; i++, STRIDE_F(data, stride), v++) { + tmu->oow = v->v.oow * data[3]; + tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex)); + } +} + + +static void copy_w( fxVertex *v, + struct vertex_buffer *VB, + GLuint tmu_nr, + GLuint start, GLuint count ) +{ + GrTmuVertex *tmu = &(v->v.tmuvtx[tmu_nr]); + GLuint i; + + for (i = start ; i < count ; i++, v++) { + tmu->oow = v->v.oow; + tmu = (GrTmuVertex *)((char *)tmu + sizeof(fxVertex)); + } +} + +/* need to compute W values for fogging purposes + */ +static void fx_fake_fog_w( GLcontext *ctx, + fxVertex *verts, + struct vertex_buffer *VB, + GLuint start, GLuint end ) +{ + const GLfloat m10 = ctx->ProjectionMatrix.m[10]; + const GLfloat m14 = ctx->ProjectionMatrix.m[14]; + GLfloat (*clip)[4] = VB->ClipPtr->data; + GLubyte *clipmask = VB->ClipMask; + GLuint i; + + for ( i = start ; i < end ; i++) { + if (clipmask[i] == 0) { + verts[i].v.oow = - m10 / (clip[i][2] - m14); /* -1/zEye */ + } + } +} + + + +static tfxSetupFunc setupfuncs[MAX_SETUP]; + + +#define IND (SETUP_XYZW) +#define INPUTS (VERT_CLIP) +#define NAME fxsetupXYZW +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_RGBA) +#define INPUTS (VERT_CLIP|VERT_RGBA) +#define NAME fxsetupXYZWRGBA +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_TMU0) +#define INPUTS (VERT_CLIP|VERT_TEX_ANY) +#define NAME fxsetupXYZWT0 +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_TMU1) +#define INPUTS (VERT_CLIP|VERT_TEX_ANY) +#define NAME fxsetupXYZWT1 +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_TMU1|SETUP_TMU0) +#define INPUTS (VERT_CLIP|VERT_TEX_ANY) +#define NAME fxsetupXYZWT0T1 +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_TMU0|SETUP_RGBA) +#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY) +#define NAME fxsetupXYZWRGBAT0 +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_TMU1|SETUP_RGBA) +#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY) +#define NAME fxsetupXYZWRGBAT1 +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA) +#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY) +#define NAME fxsetupXYZWRGBAT0T1 +#include "fxvbtmp.h" + + +#define IND (SETUP_XYZW|SETUP_SNAP) +#define INPUTS (VERT_CLIP) +#define NAME fxsetupXYZW_SNAP +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA) +#define INPUTS (VERT_CLIP|VERT_RGBA) +#define NAME fxsetupXYZW_SNAP_RGBA +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU0) +#define INPUTS (VERT_CLIP|VERT_TEX_ANY) +#define NAME fxsetupXYZW_SNAP_T0 +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU1) +#define INPUTS (VERT_CLIP|VERT_TEX_ANY) +#define NAME fxsetupXYZW_SNAP_T1 +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_TMU0) +#define INPUTS (VERT_CLIP|VERT_TEX_ANY) +#define NAME fxsetupXYZW_SNAP_T0T1 +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU0|SETUP_RGBA) +#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY) +#define NAME fxsetupXYZW_SNAP_RGBAT0 +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_RGBA) +#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY) +#define NAME fxsetupXYZW_SNAP_RGBAT1 +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA) +#define INPUTS (VERT_CLIP|VERT_RGBA|VERT_TEX_ANY) +#define NAME fxsetupXYZW_SNAP_RGBAT0T1 +#include "fxvbtmp.h" + + + +#define IND (SETUP_RGBA) +#define INPUTS (VERT_RGBA) +#define NAME fxsetupRGBA +#include "fxvbtmp.h" + +#define IND (SETUP_TMU0) +#define INPUTS (VERT_TEX_ANY) +#define NAME fxsetupT0 +#include "fxvbtmp.h" + +#define IND (SETUP_TMU1) +#define INPUTS (VERT_TEX_ANY) +#define NAME fxsetupT1 +#include "fxvbtmp.h" + +#define IND (SETUP_TMU1|SETUP_TMU0) +#define INPUTS (VERT_TEX_ANY) +#define NAME fxsetupT0T1 +#include "fxvbtmp.h" + +#define IND (SETUP_TMU0|SETUP_RGBA) +#define INPUTS (VERT_RGBA|VERT_TEX_ANY) +#define NAME fxsetupRGBAT0 +#include "fxvbtmp.h" + +#define IND (SETUP_TMU1|SETUP_RGBA) +#define INPUTS (VERT_RGBA|VERT_TEX_ANY) +#define NAME fxsetupRGBAT1 +#include "fxvbtmp.h" + +#define IND (SETUP_TMU1|SETUP_TMU0|SETUP_RGBA) +#define INPUTS (VERT_RGBA|VERT_TEX_ANY) +#define NAME fxsetupRGBAT0T1 +#include "fxvbtmp.h" + + +static void +fxsetup_invalid( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) +{ + fprintf(stderr, "fxMesa: invalid setup function\n"); + (void) (ctx && start && end && newinputs); +} + + +void fxDDSetupInit( void ) +{ + GLuint i; + for (i = 0 ; i < Elements(setupfuncs) ; i++) + setupfuncs[i] = fxsetup_invalid; + + setupfuncs[SETUP_XYZW] = fxsetupXYZW; + setupfuncs[SETUP_XYZW|SETUP_RGBA] = fxsetupXYZWRGBA; + setupfuncs[SETUP_XYZW|SETUP_TMU0] = fxsetupXYZWT0; + setupfuncs[SETUP_XYZW|SETUP_TMU1] = fxsetupXYZWT1; + setupfuncs[SETUP_XYZW|SETUP_TMU0|SETUP_RGBA] = fxsetupXYZWRGBAT0; + setupfuncs[SETUP_XYZW|SETUP_TMU1|SETUP_RGBA] = fxsetupXYZWRGBAT1; + setupfuncs[SETUP_XYZW|SETUP_TMU1|SETUP_TMU0] = fxsetupXYZWT0T1; + setupfuncs[SETUP_XYZW|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA] = + fxsetupXYZWRGBAT0T1; + + setupfuncs[SETUP_XYZW|SETUP_SNAP] = fxsetupXYZW_SNAP; + setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_RGBA] = fxsetupXYZW_SNAP_RGBA; + setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU0] = fxsetupXYZW_SNAP_T0; + setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1] = fxsetupXYZW_SNAP_T1; + setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU0|SETUP_RGBA] = + fxsetupXYZW_SNAP_RGBAT0; + setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_RGBA] = + fxsetupXYZW_SNAP_RGBAT1; + setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_TMU0] = + fxsetupXYZW_SNAP_T0T1; + setupfuncs[SETUP_XYZW|SETUP_SNAP|SETUP_TMU1|SETUP_TMU0|SETUP_RGBA] = + fxsetupXYZW_SNAP_RGBAT0T1; + + setupfuncs[SETUP_RGBA] = fxsetupRGBA; + setupfuncs[SETUP_TMU0] = fxsetupT0; + setupfuncs[SETUP_TMU1] = fxsetupT1; + setupfuncs[SETUP_TMU1|SETUP_TMU0] = fxsetupT0T1; + setupfuncs[SETUP_TMU0|SETUP_RGBA] = fxsetupRGBAT0; + setupfuncs[SETUP_TMU1|SETUP_RGBA] = fxsetupRGBAT1; + setupfuncs[SETUP_TMU1|SETUP_TMU0|SETUP_RGBA] = fxsetupRGBAT0T1; +} + + + +void fx_validate_BuildProjVerts(GLcontext *ctx, GLuint start, GLuint count, + GLuint newinputs ) +{ + GLuint setupindex = SETUP_XYZW; + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + + if (!fxMesa->is_in_hardware) + ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices; + else { + fxMesa->tmu_source[0] = 0; + fxMesa->tmu_source[1] = 1; + fxMesa->tex_dest[0] = SETUP_TMU0; + fxMesa->tex_dest[1] = SETUP_TMU1; + + /* For flat and two-side-lit triangles, colors will always be added + * to vertices in the triangle functions. Vertices will *always* + * have rbga values, but only sometimes will they come from here. + */ + if ((ctx->_TriangleCaps & (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE)) == 0) + setupindex |= SETUP_RGBA; + + if (ctx->Texture._ReallyEnabled & TEXTURE0_2D) + setupindex |= SETUP_TMU0; + + if (ctx->Texture._ReallyEnabled & TEXTURE1_2D) { + if ((ctx->Texture._ReallyEnabled & TEXTURE0_2D) == 0) { + fxMesa->tmu_source[0] = 1; fxMesa->tex_dest[0] = SETUP_TMU1; + fxMesa->tmu_source[1] = 0; fxMesa->tex_dest[1] = SETUP_TMU0; + setupindex |= SETUP_TMU0; + } else { + setupindex |= SETUP_TMU1; + } + } + + if (MESA_VERBOSE & (VERBOSE_DRIVER|VERBOSE_PIPELINE|VERBOSE_STATE)) + fxPrintSetupFlags("fxmesa: vertex setup function", setupindex); + + fxMesa->setupindex = setupindex; + ctx->Driver.BuildProjectedVertices = fx_BuildProjVerts; + } + ctx->Driver.BuildProjectedVertices( ctx, start, count, newinputs ); +} + + +void fx_BuildProjVerts( GLcontext *ctx, GLuint start, GLuint count, + GLuint newinputs ) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLuint ind = fxMesa->setup_gone; + + fxMesa->setup_gone = 0; + + if (newinputs & VERT_CLIP) + ind = fxMesa->setupindex; /* clipmask has changed - invalidated all */ + else { + if (newinputs & VERT_TEX0) + ind |= fxMesa->tex_dest[0]; + + if (newinputs & VERT_TEX1) + ind |= fxMesa->tex_dest[1]; + + if (newinputs & VERT_RGBA) + ind |= SETUP_RGBA; + + ind &= fxMesa->setupindex; + } + + if (0) { + _tnl_print_vert_flags("newinputs", newinputs); + fxPrintSetupFlags("setup function", ind); + } + + if (fxMesa->new_state) + fxSetupFXUnits( ctx ); + + if (VB->importable_data) + VB->import_data( ctx, VB->importable_data & newinputs, + (VB->ClipOrMask + ? VEC_NOT_WRITEABLE|VEC_BAD_STRIDE + : VEC_BAD_STRIDE)); + + setupfuncs[ind]( ctx, start, count, newinputs ); +} + + +void fxAllocVB( GLcontext *ctx ) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + fxMesa->verts = ALIGN_MALLOC( tnl->vb.Size * sizeof(fxMesa->verts[0]), 32 ); +} + +void fxFreeVB( GLcontext *ctx ) +{ + fxMesaContext fxMesa = FX_CONTEXT(ctx); + if (fxMesa->verts) + ALIGN_FREE( fxMesa->verts ); + fxMesa->verts = 0; +} + + +#else + + +/* + * Need this to provide at least one external definition. + */ + +extern int gl_fx_dummy_function_vsetup(void); +int gl_fx_dummy_function_vsetup(void) +{ + return 0; +} + +#endif /* FX */ diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h new file mode 100644 index 00000000000..5f3a293650a --- /dev/null +++ b/src/mesa/drivers/glide/fxvbtmp.h @@ -0,0 +1,143 @@ + +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + + +static void NAME(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs) +{ + fxMesaContext fxMesa = (fxMesaContext)ctx->DriverCtx; + fxVertex *verts = fxMesa->verts; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLuint tmu0_source = fxMesa->tmu_source[0]; + GLuint tmu1_source = fxMesa->tmu_source[1]; + GLfloat (*tmu0_data)[4]; + GLfloat (*tmu1_data)[4]; + GLubyte (*color)[4]; + GLfloat (*proj)[4] = VB->ProjectedClipPtr->data; + fxVertex *v = &verts[start]; + GLfloat sscale0 = fxMesa->s0scale; + GLfloat tscale0 = fxMesa->t0scale; + GLfloat sscale1 = fxMesa->s1scale; + GLfloat tscale1 = fxMesa->t1scale; + GLubyte *clipmask = VB->ClipMask; + GLuint i; + const GLfloat * const s = ctx->Viewport._WindowMap.m; + + if (IND & SETUP_TMU0) + tmu0_data = VB->TexCoordPtr[tmu0_source]->data; + + if (IND & SETUP_TMU1) + tmu1_data = VB->TexCoordPtr[tmu1_source]->data; + + if (IND & SETUP_RGBA) + color = VB->ColorPtr[0]->data; + + for (i = start ; i < end ; i++, v++) { + if (!clipmask[i]) { + if (IND & SETUP_XYZW) { + v->v.x = s[0] * proj[i][0] + s[12]; + v->v.y = s[5] * proj[i][1] + s[13]; + v->v.ooz = s[10] * proj[i][2] + s[14]; + v->v.oow = proj[i][3]; + + if (IND & SETUP_SNAP) { +#if defined(USE_IEEE) + const float snapper = (3L<<18); + v->v.x += snapper; + v->v.x -= snapper; + v->v.y += snapper; + v->v.y -= snapper; +#else + v->v.x = ((int)(v->v.x*16.0f)) * (1.0f/16.0f); + v->v.y = ((int)(v->v.y*16.0f)) * (1.0f/16.0f); +#endif + } + } + if (IND & SETUP_RGBA) { + UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.r, color[i][0]); + UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.g, color[i][1]); + UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.b, color[i][2]); + UBYTE_COLOR_TO_FLOAT_255_COLOR2(v->v.a, color[i][3]); + } + if (IND & SETUP_TMU0) { + v->v.tmuvtx[0].sow = sscale0*tmu0_data[i][0]*v->v.oow; + v->v.tmuvtx[0].tow = tscale0*tmu0_data[i][1]*v->v.oow; + } + if (IND & SETUP_TMU1) { + v->v.tmuvtx[1].sow = sscale1*tmu1_data[i][0]*v->v.oow; + v->v.tmuvtx[1].tow = tscale1*tmu1_data[i][1]*v->v.oow; + } + } + } + + if ((IND & SETUP_XYZW) && + ctx->ProjectionMatrix.m[15] != 0.0F && + ctx->Fog.Enabled) + { + fx_fake_fog_w( ctx, v, VB, start, end ); + } + + /* Check for and enable projective texturing in each texture unit. + */ + if (IND & (SETUP_TMU0|SETUP_TMU1)) { + GLuint tmu0_sz = 2; + GLuint tmu1_sz = 2; + GLuint hs = fxMesa->stw_hint_state & ~(GR_STWHINT_W_DIFF_TMU0 | + GR_STWHINT_W_DIFF_TMU1); + + if (VB->TexCoordPtr[tmu0_source]) + tmu0_sz = VB->TexCoordPtr[tmu0_source]->size; + + if (VB->TexCoordPtr[tmu1_source]) + tmu1_sz = VB->TexCoordPtr[tmu1_source]->size; + + if (tmu0_sz == 4) { + project_texcoords( v, VB, 0, tmu0_source, start, end ); + if (tmu1_sz == 4) + project_texcoords( v, VB, 1, tmu1_source, start, end ); + else + copy_w( v, VB, 1, start, end ); + hs |= (GR_STWHINT_W_DIFF_TMU0|GR_STWHINT_W_DIFF_TMU1); + } + else if (tmu1_sz == 4) { + project_texcoords( v, VB, 1, tmu1_source, start, end ); + hs |= GR_STWHINT_W_DIFF_TMU1; + } + + if (hs != fxMesa->stw_hint_state) { + fxMesa->stw_hint_state = hs; + FX_grHints(GR_HINT_STWHINT, hs); + } + } +} + + + + +#undef IND +#undef NAME +#undef INPUTS diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index bc45f3ee441..1349ceecb5a 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1,4 +1,4 @@ -/* $Id: osmesa.c,v 1.34 2000/11/22 08:55:52 joukj Exp $ */ +/* $Id: osmesa.c,v 1.35 2000/12/26 05:09:30 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -87,7 +87,7 @@ struct osmesa_context { /* A forward declaration: */ -static void osmesa_update_state( GLcontext *ctx ); +static void osmesa_update_state( GLcontext *ctx, GLuint newstate ); static void osmesa_register_swrast_functions( GLcontext *ctx ); @@ -311,11 +311,9 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, { GLcontext *ctx = &osmesa->gl_ctx; - ctx->Driver.RegisterVB = _swsetup_RegisterVB; - _swrast_CreateContext( ctx ); - _swsetup_CreateContext( ctx ); _tnl_CreateContext( ctx ); + _swsetup_CreateContext( ctx ); osmesa_register_swrast_functions( ctx ); } @@ -439,7 +437,7 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type, return GL_FALSE; } - osmesa_update_state( &ctx->gl_ctx ); + osmesa_update_state( &ctx->gl_ctx, 0 ); _mesa_make_current( &ctx->gl_ctx, ctx->gl_buffer ); ctx->buffer = buffer; @@ -1687,7 +1685,7 @@ static const GLubyte *get_string( GLcontext *ctx, GLenum name ) } -static void osmesa_update_state( GLcontext *ctx ) +static void osmesa_update_state( GLcontext *ctx, GLuint new_state ) { OSMesaContext osmesa = OSMESA_CONTEXT(ctx); @@ -1709,7 +1707,7 @@ static void osmesa_update_state( GLcontext *ctx ) ctx->Driver.LineFunc = _swsetup_Line; ctx->Driver.TriangleFunc = _swsetup_Triangle; ctx->Driver.QuadFunc = _swsetup_Quad; - ctx->Driver.RasterSetup = _swsetup_RasterSetup; + ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices; /* RGB(A) span/pixel functions */ @@ -1751,7 +1749,7 @@ static void osmesa_update_state( GLcontext *ctx ) ctx->Driver.ReadCI32Span = read_index_span; ctx->Driver.ReadCI32Pixels = read_index_pixels; - _swrast_InvalidateState( ctx, ctx->NewState ); - _swsetup_InvalidateState( ctx, ctx->NewState ); - _tnl_InvalidateState( ctx, ctx->NewState ); + _swrast_InvalidateState( ctx, new_state ); + _swsetup_InvalidateState( ctx, new_state ); + _tnl_InvalidateState( ctx, new_state ); } diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c index 23166f98193..2c6895abece 100644 --- a/src/mesa/drivers/svga/svgamesa.c +++ b/src/mesa/drivers/svga/svgamesa.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa.c,v 1.10 2000/11/22 08:55:53 joukj Exp $ */ +/* $Id: svgamesa.c,v 1.11 2000/12/26 05:09:30 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -274,7 +274,7 @@ static void set_read_buffer( GLcontext *ctx, GLframebuffer *colorBuffer, /***** *****/ /**********************************************************************/ -static void svgamesa_update_state( GLcontext *ctx ) +static void svgamesa_update_state( GLcontext *ctx, GLuint new_state ) { /* Initialize all the pointers in the DD struct. Do this whenever */ /* a new context is made current or we change buffers via set_buffer! */ @@ -457,7 +457,7 @@ void SVGAMesaMakeCurrent( SVGAMesaContext ctx ) { #ifndef DEV SVGAMesa = ctx; - svgamesa_update_state( ctx->gl_ctx ); + svgamesa_update_state( ctx->gl_ctx, ~0 ); _mesa_make_current( ctx->gl_ctx, ctx->gl_buffer ); if (ctx->width==0 || ctx->height==0) { diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 091e0770097..bff35d59dda 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1,4 +1,4 @@ -/* $Id: xm_api.c,v 1.12 2000/12/13 00:47:10 brianp Exp $ */ +/* $Id: xm_api.c,v 1.13 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -78,6 +78,7 @@ #include "macros.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" +#include "array_cache/acache.h" #include "tnl/tnl.h" #ifndef GLX_NONE_EXT @@ -1665,8 +1666,9 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext( ctx ); - _swsetup_CreateContext( ctx ); + _ac_CreateContext( ctx ); _tnl_CreateContext( ctx ); + _swsetup_CreateContext( ctx ); xmesa_register_swrast_functions( ctx ); diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index d03790be0b3..50700c66280 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1,4 +1,4 @@ -/* $Id: xm_dd.c,v 1.7 2000/11/22 07:32:18 joukj Exp $ */ +/* $Id: xm_dd.c,v 1.8 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -38,6 +38,7 @@ #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" +#include "array_cache/acache.h" /* * Return the size (width,height of the current color buffer. @@ -862,16 +863,17 @@ enable( GLcontext *ctx, GLenum pname, GLboolean state ) } -void xmesa_update_state( GLcontext *ctx ) +void xmesa_update_state( GLcontext *ctx, GLuint new_state ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; /* Propogate statechange information to swrast and swrast_setup * modules. The X11 driver has no internal GL-dependent state. */ - _swrast_InvalidateState( ctx, ctx->NewState ); - _swsetup_InvalidateState( ctx, ctx->NewState ); - _tnl_InvalidateState( ctx, ctx->NewState ); + _swrast_InvalidateState( ctx, new_state ); + _ac_InvalidateState( ctx, new_state ); + _tnl_InvalidateState( ctx, new_state ); + _swsetup_InvalidateState( ctx, new_state ); /* setup pointers to front and back buffer clear functions */ @@ -937,9 +939,7 @@ void xmesa_init_pointers( GLcontext *ctx ) ctx->Driver.LineFunc = _swsetup_Line; ctx->Driver.TriangleFunc = _swsetup_Triangle; ctx->Driver.QuadFunc = _swsetup_Quad; - ctx->Driver.RasterSetup = _swsetup_RasterSetup; - ctx->Driver.RegisterVB = _swsetup_RegisterVB; - ctx->Driver.UnregisterVB = _swsetup_UnregisterVB; - + ctx->Driver.BuildProjectedVertices = _swsetup_BuildProjectedVertices; + ctx->Driver.ResetLineStipple = _swrast_ResetLineStipple; (void) DitherValues; /* silenced unused var warning */ } diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 401fc7dda1d..a8f953963d0 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -1,4 +1,4 @@ -/* $Id: xmesaP.h,v 1.17 2000/11/22 08:55:53 joukj Exp $ */ +/* $Id: xmesaP.h,v 1.18 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -519,7 +519,7 @@ xmesa_color_to_pixel( XMesaContext xmesa, extern void xmesa_alloc_back_buffer( XMesaBuffer b ); extern void xmesa_init_pointers( GLcontext *ctx ); -extern void xmesa_update_state( GLcontext *ctx ); +extern void xmesa_update_state( GLcontext *ctx, GLuint new_state ); extern void xmesa_update_span_funcs( GLcontext *ctx ); diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h index 7186e5ef657..481949989ca 100644 --- a/src/mesa/glapi/glapitemp.h +++ b/src/mesa/glapi/glapitemp.h @@ -1,4 +1,4 @@ -/* $Id: glapitemp.h,v 1.23 2000/10/27 18:31:22 brianp Exp $ */ +/* $Id: glapitemp.h,v 1.24 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -35,10 +35,14 @@ * DISPATCH(func, args, msg) - code to do dispatch of named function. * msg is a printf-style debug message. * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value + * DO_GEOMETRY - if defined, build functions valid inside Begin/End + * DO_INIT - if defined, emit an init function. + * INIT - Macro invoked once per api function in the init function. * * Here's an example which generates the usual OpenGL functions: * #define KEYWORD1 * #define KEYWORD2 + * #define DO_GEOMETRY * #define NAME(func) gl##func * #define DISPATCH(func, args, msg) \ * struct _glapi_table *dispatch = CurrentDispatch; \ @@ -93,6 +97,7 @@ /* GL 1.0 */ + KEYWORD1 void KEYWORD2 NAME(Accum)(GLenum op, GLfloat value) { DISPATCH(Accum, (op, value), (F, "glAccum(0x%x, %g);", op, value)); @@ -103,11 +108,6 @@ KEYWORD1 void KEYWORD2 NAME(AlphaFunc)(GLenum func, GLclampf ref) DISPATCH(AlphaFunc, (func, ref), (F, "glAlphaFunc(0x%x, %g);", func, ref)); } -KEYWORD1 void KEYWORD2 NAME(Begin)(GLenum mode) -{ - DISPATCH(Begin, (mode), (F, "glBegin(0x%x);", mode)); -} - KEYWORD1 void KEYWORD2 NAME(Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) { DISPATCH(Bitmap, (width, height, xorig, yorig, xmove, ymove, bitmap), (F, "glBitmap(%d %d %g %g %g %g %p;", width, height, xorig, yorig, xmove, ymove, bitmap)); @@ -118,16 +118,6 @@ KEYWORD1 void KEYWORD2 NAME(BlendFunc)(GLenum sfactor, GLenum dfactor) DISPATCH(BlendFunc, (sfactor, dfactor), (F, "glBlendFunc(0x%x, 0x%x);", sfactor, dfactor)); } -KEYWORD1 void KEYWORD2 NAME(CallList)(GLuint list) -{ - DISPATCH(CallList, (list), (F, "glCallList(%u);", list)); -} - -KEYWORD1 void KEYWORD2 NAME(CallLists)(GLsizei n, GLenum type, const GLvoid *lists) -{ - DISPATCH(CallLists, (n, type, lists), (F, "glCallLists(%d, 0x%x, %p);", n, type, lists)); -} - KEYWORD1 void KEYWORD2 NAME(Clear)(GLbitfield mask) { DISPATCH(Clear, (mask), (F, "glClear(0x%x);", mask)); @@ -163,166 +153,6 @@ KEYWORD1 void KEYWORD2 NAME(ClipPlane)(GLenum plane, const GLdouble *equation) DISPATCH(ClipPlane, (plane, equation), (F, "glClipPlane(%p);", equation)); } -KEYWORD1 void KEYWORD2 NAME(Color3b)(GLbyte red, GLbyte green, GLbyte blue) -{ - DISPATCH(Color3b, (red, green, blue), (F, "glColor3b(%d, %d, %d);", red, green, blue)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3d)(GLdouble red, GLdouble green, GLdouble blue) -{ - DISPATCH(Color3d, (red, green, blue), (F, "glColor3d(%g, %g, %g);", red, green, blue)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3f)(GLfloat red, GLfloat green, GLfloat blue) -{ - DISPATCH(Color3f, (red, green, blue), (F, "glColor3f(%g, %g, %g);", red, green, blue)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3i)(GLint red, GLint green, GLint blue) -{ - DISPATCH(Color3i, (red, green, blue), (F, "glColor3i(%d, %d, %d);", red, green, blue)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3s)(GLshort red, GLshort green, GLshort blue) -{ - DISPATCH(Color3s, (red, green, blue), (F, "glColor3s(%d, %d, %d);", red, green, blue)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3ub)(GLubyte red, GLubyte green, GLubyte blue) -{ - DISPATCH(Color3ub, (red, green, blue), (F, "glColor3ub(%u, %u, %u);", red, green, blue)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3ui)(GLuint red, GLuint green, GLuint blue) -{ - DISPATCH(Color3ui, (red, green, blue), (F, "glColor3ui(%u, %u, %u);", red, green, blue)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3us)(GLushort red, GLushort green, GLushort blue) -{ - DISPATCH(Color3us, (red, green, blue), (F, "glColor3us(%u, %u, %u);", red, green, blue)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) -{ - DISPATCH(Color4b, (red, green, blue, alpha), (F, "glColor4b(%d, %d, %d, %d);", red, green, blue, alpha)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) -{ - DISPATCH(Color4d, (red, green, blue, alpha), (F, "glColor4d(%g, %g, %g, %g);", red, green, blue, alpha)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -{ - DISPATCH(Color4f, (red, green, blue, alpha), (F, "glColor4b(%g, %g, %g, %g);", red, green, blue, alpha)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4i)(GLint red, GLint green, GLint blue, GLint alpha) -{ - DISPATCH(Color4i, (red, green, blue, alpha), (F, "glColor4i(%d, %d, %d);", red, green, blue)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha) -{ - DISPATCH(Color4s, (red, green, blue, alpha), (F, "glColor4s(%d, %d, %d, %d);", red, green, blue, alpha)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) -{ - DISPATCH(Color4ub, (red, green, blue, alpha), (F, "glColor4ub(%u, %u, %u, %u);", red, green, blue, alpha)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha) -{ - DISPATCH(Color4ui, (red, green, blue, alpha), (F, "glColor4ui(%u, %u, %u, %u);", red, green, blue, alpha)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha) -{ - DISPATCH(Color4us, (red, green, blue, alpha), (F, "glColor4us(%u, %u, %u, %u);", red, green, blue, alpha)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3bv)(const GLbyte *v) -{ - DISPATCH(Color3bv, (v), (F, "glColor3bf(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3dv)(const GLdouble *v) -{ - DISPATCH(Color3dv, (v), (F, "glColor3dv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3fv)(const GLfloat *v) -{ - DISPATCH(Color3fv, (v), (F, "glColor3fv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3iv)(const GLint *v) -{ - DISPATCH(Color3iv, (v), (F, "glColor3iv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3sv)(const GLshort *v) -{ - DISPATCH(Color3sv, (v), (F, "glColor3sv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3ubv)(const GLubyte *v) -{ - DISPATCH(Color3ubv, (v), (F, "glColor3ubv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3uiv)(const GLuint *v) -{ - DISPATCH(Color3uiv, (v), (F, "glColor3uiv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color3usv)(const GLushort *v) -{ - DISPATCH(Color3usv, (v), (F, "glColor3usv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4bv)(const GLbyte *v) -{ - DISPATCH(Color4bv, (v), (F, "glColor3bv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4dv)(const GLdouble *v) -{ - DISPATCH(Color4dv, (v), (F, "glColor4dv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4fv)(const GLfloat *v) -{ - DISPATCH(Color4fv, (v), (F, "glColor4fv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4iv)(const GLint *v) -{ - DISPATCH(Color4iv, (v), (F, "glColor4iv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4sv)(const GLshort *v) -{ - DISPATCH(Color4sv, (v), (F, "glColor4sv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4ubv)(const GLubyte *v) -{ - DISPATCH(Color4ubv, (v), (F, "glColor4ubv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4uiv)(const GLuint *v) -{ - DISPATCH(Color4uiv, (v), (F, "glColor4uiv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Color4usv)(const GLushort *v) -{ - DISPATCH(Color4usv, (v), (F, "glColor4usv(%p);", v)); -} - KEYWORD1 void KEYWORD2 NAME(ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { DISPATCH(ColorMask, (red, green, blue, alpha), (F, "glColorMask(%d, %d, %d, %d);", red, green, blue, alpha)); @@ -388,81 +218,16 @@ KEYWORD1 void KEYWORD2 NAME(Enable)(GLenum cap) DISPATCH(Enable, (cap), (F, "glEnable(0x%x);", cap)); } -KEYWORD1 void KEYWORD2 NAME(End)(void) -{ - DISPATCH(End, (), (F, "glEnd();")); -} - KEYWORD1 void KEYWORD2 NAME(EndList)(void) { DISPATCH(EndList, (), (F, "glEndList();")); } -KEYWORD1 void KEYWORD2 NAME(EvalCoord1d)(GLdouble u) -{ - DISPATCH(EvalCoord1d, (u), (F, "glEvalCoord1d(%g);", u)); -} - -KEYWORD1 void KEYWORD2 NAME(EvalCoord1f)(GLfloat u) -{ - DISPATCH(EvalCoord1f, (u), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(EvalCoord1dv)(const GLdouble *u) -{ - DISPATCH(EvalCoord1dv, (u), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(EvalCoord1fv)(const GLfloat *u) -{ - DISPATCH(EvalCoord1fv, (u), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(EvalCoord2d)(GLdouble u, GLdouble v) -{ - DISPATCH(EvalCoord2d, (u, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(EvalCoord2f)(GLfloat u, GLfloat v) -{ - DISPATCH(EvalCoord2f, (u, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(EvalCoord2dv)(const GLdouble *u) -{ - DISPATCH(EvalCoord2dv, (u), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(EvalCoord2fv)(const GLfloat *u) -{ - DISPATCH(EvalCoord2fv, (u), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(EvalPoint1)(GLint i) -{ - DISPATCH(EvalPoint1, (i), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(EvalPoint2)(GLint i, GLint j) -{ - DISPATCH(EvalPoint2, (i, j), (F, ";")); -} - KEYWORD1 void KEYWORD2 NAME(EvalMesh1)(GLenum mode, GLint i1, GLint i2) { DISPATCH(EvalMesh1, (mode, i1, i2), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(EdgeFlag)(GLboolean flag) -{ - DISPATCH(EdgeFlag, (flag), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(EdgeFlagv)(const GLboolean *flag) -{ - DISPATCH(EdgeFlagv, (flag), (F, ";")); -} - KEYWORD1 void KEYWORD2 NAME(EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) { DISPATCH(EvalMesh2, (mode, i1, i2, j1, j2), (F, ";")); @@ -663,62 +428,22 @@ KEYWORD1 void KEYWORD2 NAME(Hint)(GLenum target, GLenum mode) DISPATCH(Hint, (target, mode), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Indexd)(GLdouble c) +KEYWORD1 void KEYWORD2 NAME(IndexMask)(GLuint mask) { - DISPATCH(Indexd, (c), (F, ";")); + DISPATCH(IndexMask, (mask), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Indexdv)(const GLdouble *c) +KEYWORD1 void KEYWORD2 NAME(InitNames)(void) { - DISPATCH(Indexdv, (c), (F, ";")); + DISPATCH(InitNames, (), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Indexf)(GLfloat c) +KEYWORD1 GLboolean KEYWORD2 NAME(IsEnabled)(GLenum cap) { - DISPATCH(Indexf, (c), (F, ";")); + RETURN_DISPATCH(IsEnabled, (cap), (F, "glIsEnabled(0x%x);", cap)); } -KEYWORD1 void KEYWORD2 NAME(Indexfv)(const GLfloat *c) -{ - DISPATCH(Indexfv, (c), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(Indexi)(GLint c) -{ - DISPATCH(Indexi, (c), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(Indexiv)(const GLint *c) -{ - DISPATCH(Indexiv, (c), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(Indexs)(GLshort c) -{ - DISPATCH(Indexs, (c), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(Indexsv)(const GLshort *c) -{ - DISPATCH(Indexsv, (c), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(IndexMask)(GLuint mask) -{ - DISPATCH(IndexMask, (mask), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(InitNames)(void) -{ - DISPATCH(InitNames, (), (F, ";")); -} - -KEYWORD1 GLboolean KEYWORD2 NAME(IsEnabled)(GLenum cap) -{ - RETURN_DISPATCH(IsEnabled, (cap), (F, "glIsEnabled(0x%x);", cap)); -} - -KEYWORD1 GLboolean KEYWORD2 NAME(IsList)(GLuint list) +KEYWORD1 GLboolean KEYWORD2 NAME(IsList)(GLuint list) { RETURN_DISPATCH(IsList, (list), (F, "glIsList(%u);", list)); } @@ -843,26 +568,6 @@ KEYWORD1 void KEYWORD2 NAME(MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint v DISPATCH(MapGrid2f, (un, u1, u2, vn, v1, v2), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Materialf)(GLenum face, GLenum pname, GLfloat param) -{ - DISPATCH(Materialf, (face, pname, param), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(Materiali)(GLenum face, GLenum pname, GLint param) -{ - DISPATCH(Materiali, (face, pname, param), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(Materialfv)(GLenum face, GLenum pname, const GLfloat *params) -{ - DISPATCH(Materialfv, (face, pname, params), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(Materialiv)(GLenum face, GLenum pname, const GLint *params) -{ - DISPATCH(Materialiv, (face, pname, params), (F, ";")); -} - KEYWORD1 void KEYWORD2 NAME(MatrixMode)(GLenum mode) { DISPATCH(MatrixMode, (mode), (F, ";")); @@ -883,56 +588,6 @@ KEYWORD1 void KEYWORD2 NAME(NewList)(GLuint list, GLenum mode) DISPATCH(NewList, (list, mode), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz) -{ - DISPATCH(Normal3b, (nx, ny, nz), (F, "glNormal3b(%d, %d, %d);", nx, ny, nz)); -} - -KEYWORD1 void KEYWORD2 NAME(Normal3bv)(const GLbyte *v) -{ - DISPATCH(Normal3bv, (v), (F, "glNormal3bv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz) -{ - DISPATCH(Normal3d, (nx, ny, nz), (F, "glNormal3d(%f, %f, %f);", nx, ny, nz)); -} - -KEYWORD1 void KEYWORD2 NAME(Normal3dv)(const GLdouble *v) -{ - DISPATCH(Normal3dv, (v), (F, "glNormal3dv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz) -{ - DISPATCH(Normal3f, (nx, ny, nz), (F, "glNormal3f(%g, %g, %g);", nx, ny, nz)); -} - -KEYWORD1 void KEYWORD2 NAME(Normal3fv)(const GLfloat *v) -{ - DISPATCH(Normal3fv, (v), (F, "glNormal3fv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Normal3i)(GLint nx, GLint ny, GLint nz) -{ - DISPATCH(Normal3i, (nx, ny, nz), (F, "glNormal3i(%d, %d, %d);", nx, ny, nz)); -} - -KEYWORD1 void KEYWORD2 NAME(Normal3iv)(const GLint *v) -{ - DISPATCH(Normal3iv, (v), (F, "glNormal3iv(%p);", v)); -} - -KEYWORD1 void KEYWORD2 NAME(Normal3s)(GLshort nx, GLshort ny, GLshort nz) -{ - DISPATCH(Normal3s, (nx, ny, nz), (F, "glNormal3s(%d, %d, %d);", nx, ny, nz)); -} - -KEYWORD1 void KEYWORD2 NAME(Normal3sv)(const GLshort *v) -{ - DISPATCH(Normal3sv, (v), (F, "glNormal3sv(%p);", v)); -} - KEYWORD1 void KEYWORD2 NAME(Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearval, GLdouble farval) { DISPATCH(Ortho, (left, right, bottom, top, nearval, farval), (F, "glOrtho(%f, %f, %f, %f, %f, %f);", left, right, bottom, top, nearval, farval)); @@ -1253,2009 +908,2353 @@ KEYWORD1 void KEYWORD2 NAME(StencilOp)(GLenum fail, GLenum zfail, GLenum zpass) DISPATCH(StencilOp, (fail, zfail, zpass), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1d)(GLdouble s) +KEYWORD1 void KEYWORD2 NAME(TexGend)(GLenum coord, GLenum pname, GLdouble param) { - DISPATCH(TexCoord1d, (s), (F, ";")); + DISPATCH(TexGend, (coord, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1f)(GLfloat s) +KEYWORD1 void KEYWORD2 NAME(TexGendv)(GLenum coord, GLenum pname, const GLdouble *params) { - DISPATCH(TexCoord1f, (s), (F, ";")); + DISPATCH(TexGendv, (coord, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1i)(GLint s) +KEYWORD1 void KEYWORD2 NAME(TexGenf)(GLenum coord, GLenum pname, GLfloat param) { - DISPATCH(TexCoord1i, (s), (F, ";")); + DISPATCH(TexGenf, (coord, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1s)(GLshort s) +KEYWORD1 void KEYWORD2 NAME(TexGenfv)(GLenum coord, GLenum pname, const GLfloat *params) { - DISPATCH(TexCoord1s, (s), (F, ";")); + DISPATCH(TexGenfv, (coord, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2d)(GLdouble s, GLdouble t) +KEYWORD1 void KEYWORD2 NAME(TexGeni)(GLenum coord, GLenum pname, GLint param) { - DISPATCH(TexCoord2d, (s, t), (F, ";")); + DISPATCH(TexGeni, (coord, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2f)(GLfloat s, GLfloat t) +KEYWORD1 void KEYWORD2 NAME(TexGeniv)(GLenum coord, GLenum pname, const GLint *params) { - DISPATCH(TexCoord2f, (s, t), (F, ";")); + DISPATCH(TexGeniv, (coord, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2s)(GLshort s, GLshort t) +KEYWORD1 void KEYWORD2 NAME(TexEnvf)(GLenum target, GLenum pname, GLfloat param) { - DISPATCH(TexCoord2s, (s, t), (F, ";")); + DISPATCH(TexEnvf, (target, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2i)(GLint s, GLint t) +KEYWORD1 void KEYWORD2 NAME(TexEnvfv)(GLenum target, GLenum pname, const GLfloat *param) { - DISPATCH(TexCoord2i, (s, t), (F, ";")); + DISPATCH(TexEnvfv, (target, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3d)(GLdouble s, GLdouble t, GLdouble r) +KEYWORD1 void KEYWORD2 NAME(TexEnvi)(GLenum target, GLenum pname, GLint param) { - DISPATCH(TexCoord3d, (s, t, r), (F, ";")); + DISPATCH(TexEnvi, (target, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3f)(GLfloat s, GLfloat t, GLfloat r) +KEYWORD1 void KEYWORD2 NAME(TexEnviv)(GLenum target, GLenum pname, const GLint *param) { - DISPATCH(TexCoord3f, (s, t, r), (F, ";")); + DISPATCH(TexEnviv, (target, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3i)(GLint s, GLint t, GLint r) +KEYWORD1 void KEYWORD2 NAME(TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { - DISPATCH(TexCoord3i, (s, t, r), (F, ";")); + DISPATCH(TexImage1D, (target, level, internalformat, width, border, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3s)(GLshort s, GLshort t, GLshort r) +KEYWORD1 void KEYWORD2 NAME(TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { - DISPATCH(TexCoord3s, (s, t, r), (F, ";")); + DISPATCH(TexImage2D, (target, level, internalformat, width, height, border, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q) +KEYWORD1 void KEYWORD2 NAME(TexParameterf)(GLenum target, GLenum pname, GLfloat param) { - DISPATCH(TexCoord4d, (s, t, r, q), (F, ";")); + DISPATCH(TexParameterf, (target, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q) +KEYWORD1 void KEYWORD2 NAME(TexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) { - DISPATCH(TexCoord4f, (s, t, r, q), (F, ";")); + DISPATCH(TexParameterfv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4i)(GLint s, GLint t, GLint r, GLint q) +KEYWORD1 void KEYWORD2 NAME(TexParameteri)(GLenum target, GLenum pname, GLint param) { - DISPATCH(TexCoord4i, (s, t, r, q), (F, ";")); + DISPATCH(TexParameteri, (target, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q) +KEYWORD1 void KEYWORD2 NAME(TexParameteriv)(GLenum target, GLenum pname, const GLint *params) { - DISPATCH(TexCoord4s, (s, t, r, q), (F, ";")); + DISPATCH(TexParameteriv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(Translated)(GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(TexCoord1dv, (v), (F, ";")); + DISPATCH(Translated, (x, y, z), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(Translatef)(GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(TexCoord1fv, (v), (F, ";")); + DISPATCH(Translatef, (x, y, z), (F, "glTranslatef(%g, %g, %g);", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(Viewport)(GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(TexCoord1iv, (v), (F, ";")); + DISPATCH(Viewport, (x, y, width, height), (F, "glViewport(%d, %d, %d, %d);", x, y, width, height)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord1sv)(const GLshort *v) -{ - DISPATCH(TexCoord1sv, (v), (F, ";")); -} -KEYWORD1 void KEYWORD2 NAME(TexCoord2dv)(const GLdouble *v) + +/* GL 1.1 */ + +KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences) { - DISPATCH(TexCoord2dv, (v), (F, ";")); + RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResident(%d, %p, %p);", n, textures, residences)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(ArrayElement)(GLint i) { - DISPATCH(TexCoord2fv, (v), (F, ";")); + DISPATCH(ArrayElement, (i), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(BindTexture)(GLenum target, GLuint texture) { - DISPATCH(TexCoord2iv, (v), (F, ";")); + DISPATCH(BindTexture, (target, texture), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord2sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - DISPATCH(TexCoord2sv, (v), (F, ";")); + DISPATCH(ColorPointer, (size, type, stride, ptr), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) { - DISPATCH(TexCoord3dv, (v), (F, ";")); + DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { - DISPATCH(TexCoord3fv, (v), (F, ";")); + DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { - DISPATCH(TexCoord3iv, (v), (F, ";")); + DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord3sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(TexCoord3sv, (v), (F, ";")); + DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(DeleteTextures)(GLsizei n, const GLuint *textures) { - DISPATCH(TexCoord4dv, (v), (F, ";")); + DISPATCH(DeleteTextures, (n, textures), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(DisableClientState)(GLenum cap) { - DISPATCH(TexCoord4fv, (v), (F, ";")); + DISPATCH(DisableClientState, (cap), (F, "glDisableClientState(0x%x);", cap)); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(DrawArrays)(GLenum mode, GLint first, GLsizei count) { - DISPATCH(TexCoord4iv, (v), (F, ";")); + DISPATCH(DrawArrays, (mode, first, count), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoord4sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointer)(GLsizei stride, const GLvoid *ptr) { - DISPATCH(TexCoord4sv, (v), (F, ";")); + DISPATCH(EdgeFlagPointer, (stride, ptr), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexGend)(GLenum coord, GLenum pname, GLdouble param) +KEYWORD1 void KEYWORD2 NAME(EnableClientState)(GLenum cap) { - DISPATCH(TexGend, (coord, pname, param), (F, ";")); + DISPATCH(EnableClientState, (cap), (F, "glEnableClientState(0x%x)", cap)); } -KEYWORD1 void KEYWORD2 NAME(TexGendv)(GLenum coord, GLenum pname, const GLdouble *params) +KEYWORD1 void KEYWORD2 NAME(GenTextures)(GLsizei n, GLuint *textures) { - DISPATCH(TexGendv, (coord, pname, params), (F, ";")); + DISPATCH(GenTextures, (n, textures), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexGenf)(GLenum coord, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(GetPointerv)(GLenum pname, GLvoid **params) { - DISPATCH(TexGenf, (coord, pname, param), (F, ";")); + DISPATCH(GetPointerv, (pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexGenfv)(GLenum coord, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(IndexPointer)(GLenum type, GLsizei stride, const GLvoid *ptr) { - DISPATCH(TexGenfv, (coord, pname, params), (F, ";")); + DISPATCH(IndexPointer, (type, stride, ptr), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexGeni)(GLenum coord, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer) { - DISPATCH(TexGeni, (coord, pname, param), (F, ";")); + DISPATCH(InterleavedArrays, (format, stride, pointer), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexGeniv)(GLenum coord, GLenum pname, const GLint *params) +KEYWORD1 GLboolean KEYWORD2 NAME(IsTexture)(GLuint texture) { - DISPATCH(TexGeniv, (coord, pname, params), (F, ";")); + RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTexture(%u);", texture)); } -KEYWORD1 void KEYWORD2 NAME(TexEnvf)(GLenum target, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(NormalPointer)(GLenum type, GLsizei stride, const GLvoid *ptr) { - DISPATCH(TexEnvf, (target, pname, param), (F, ";")); + DISPATCH(NormalPointer, (type, stride, ptr), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexEnvfv)(GLenum target, GLenum pname, const GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(PolygonOffset)(GLfloat factor, GLfloat units) { - DISPATCH(TexEnvfv, (target, pname, param), (F, ";")); + DISPATCH(PolygonOffset, (factor, units), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexEnvi)(GLenum target, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(PopClientAttrib)(void) { - DISPATCH(TexEnvi, (target, pname, param), (F, ";")); + DISPATCH(PopClientAttrib, (), (F, "glPopClientAttrib();")); } -KEYWORD1 void KEYWORD2 NAME(TexEnviv)(GLenum target, GLenum pname, const GLint *param) +KEYWORD1 void KEYWORD2 NAME(PrioritizeTextures)(GLsizei n, const GLuint *textures, const GLclampf *priorities) { - DISPATCH(TexEnviv, (target, pname, param), (F, ";")); + DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(PushClientAttrib)(GLbitfield mask) { - DISPATCH(TexImage1D, (target, level, internalformat, width, border, format, type, pixels), (F, ";")); + DISPATCH(PushClientAttrib, (mask), (F, "glPushClientAttrib(0x%x)", mask)); } -KEYWORD1 void KEYWORD2 NAME(TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - DISPATCH(TexImage2D, (target, level, internalformat, width, height, border, format, type, pixels), (F, ";")); + DISPATCH(TexCoordPointer, (size, type, stride, ptr), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexParameterf)(GLenum target, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels) { - DISPATCH(TexParameterf, (target, pname, param), (F, ";")); + DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) { - DISPATCH(TexParameterfv, (target, pname, params), (F, ";")); + DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexParameteri)(GLenum target, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { - DISPATCH(TexParameteri, (target, pname, param), (F, ";")); + DISPATCH(VertexPointer, (size, type, stride, ptr), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexParameteriv)(GLenum target, GLenum pname, const GLint *params) + +/* GL 1.2 */ + +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(TexParameteriv, (target, pname, params), (F, ";")); + DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Translated)(GLdouble x, GLdouble y, GLdouble z) +KEYWORD1 void KEYWORD2 NAME(DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) { - DISPATCH(Translated, (x, y, z), (F, ";")); + DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Translatef)(GLfloat x, GLfloat y, GLfloat z) +KEYWORD1 void KEYWORD2 NAME(TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { - DISPATCH(Translatef, (x, y, z), (F, "glTranslatef(%g, %g, %g);", x, y, z)); + DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex2d)(GLdouble x, GLdouble y) +KEYWORD1 void KEYWORD2 NAME(TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) { - DISPATCH(Vertex2d, (x, y), (F, "glVertex2d(%f, %f);", x, y)); + DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex2dv)(const GLdouble *v) +/* GL_ARB_imaging */ + +KEYWORD1 void KEYWORD2 NAME(BlendColor)(GLclampf r, GLclampf g, GLclampf b, GLclampf a) { - DISPATCH(Vertex2dv, (v), (F, "glVertex2dv(%p);", v)); + DISPATCH(BlendColor, (r, g, b, a), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex2f)(GLfloat x, GLfloat y) +KEYWORD1 void KEYWORD2 NAME(BlendEquation)(GLenum mode) { - DISPATCH(Vertex2f, (x, y), (F, "glVertex2f(%g, %g);", x, y)); + DISPATCH(BlendEquation, (mode), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex2fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data) { - DISPATCH(Vertex2fv, (v), (F, "glVertex2fv(%p);", v)); + DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex2i)(GLint x, GLint y) +KEYWORD1 void KEYWORD2 NAME(ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) { - DISPATCH(Vertex2i, (x, y), (F, "glVertex2i(%d, %d);", x, y)); + DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex2iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat *params) { - DISPATCH(Vertex2iv, (v), (F, "glVertex2iv(%p);", v)); + DISPATCH(ColorTableParameterfv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex2s)(GLshort x, GLshort y) +KEYWORD1 void KEYWORD2 NAME(ColorTableParameteriv)(GLenum target, GLenum pname, const GLint *params) { - DISPATCH(Vertex2s, (x, y), (F, "glVertex2s(%d, %d);", x, y)); + DISPATCH(ColorTableParameteriv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex2sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) { - DISPATCH(Vertex2sv, (v), (F, "glVertex2sv(%p);", v)); + DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex3d)(GLdouble x, GLdouble y, GLdouble z) +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) { - DISPATCH(Vertex3d, (x, y, z), (F, "glVertex3d(%f, %f, %f);", x, y, z)); + DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex3dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params) { - DISPATCH(Vertex3dv, (v), (F, "glVertex3dv(%p);", v)); + DISPATCH(ConvolutionParameterf, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex3f)(GLfloat x, GLfloat y, GLfloat z) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat *params) { - DISPATCH(Vertex3f, (x, y, z), (F, "glVertex3f(%g, %g, %g);", x, y, z)); + DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex3fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteri)(GLenum target, GLenum pname, GLint params) { - DISPATCH(Vertex3fv, (v), (F, "glVertex3fv(%p);", v)); + DISPATCH(ConvolutionParameteri, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex3i)(GLint x, GLint y, GLint z) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint *params) { - DISPATCH(Vertex3i, (x, y, z), (F, "glVertex3i(%d, %d, %d);", x, y, z)); + DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex3iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { - DISPATCH(Vertex3iv, (v), (F, "glVertex3iv(%p);", v)); + DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex3s)(GLshort x, GLshort y, GLshort z) +KEYWORD1 void KEYWORD2 NAME(CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { - DISPATCH(Vertex3s, (x, y, z), (F, "glVertex3s(%d, %d, %d);", x, y, z)); + DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex3sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { - DISPATCH(Vertex3sv, (v), (F, "glVertex3sv(%p);", v)); + DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(Vertex4d, (x, y, z, w), (F, "glVertex4d(%f, %f, %f, %f);", x, y, z, w)); + DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex4dv)(const GLdouble *v) +KEYWORD1 void KEYWORD2 NAME(GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid *table) { - DISPATCH(Vertex4dv, (v), (F, "glVertex4dv(%p);", v)); + DISPATCH(GetColorTable, (target, format, type, table), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat *params) { - DISPATCH(Vertex4f, (x, y, z, w), (F, "glVertex4f(%f, %f, %f, %f);", x, y, z, w)); + DISPATCH(GetColorTableParameterfv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex4fv)(const GLfloat *v) +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameteriv)(GLenum target, GLenum pname, GLint *params) { - DISPATCH(Vertex4fv, (v), (F, "glVertex4fv(%p);", v)); + DISPATCH(GetColorTableParameteriv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex4i)(GLint x, GLint y, GLint z, GLint w) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid *image) { - DISPATCH(Vertex4i, (x, y, z, w), (F, "glVertex4i(%d, %d, %d, %d);", x, y, z, w)); + DISPATCH(GetConvolutionFilter, (target, format, type, image), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex4iv)(const GLint *v) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat *params) { - DISPATCH(Vertex4iv, (v), (F, "glVertex4iv(%p);", v)); + DISPATCH(GetConvolutionParameterfv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint *params) { - DISPATCH(Vertex4s, (x, y, z, w), (F, "glVertex4s(%d, %d, %d, %d);", x, y, z, w)); + DISPATCH(GetConvolutionParameteriv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Vertex4sv)(const GLshort *v) +KEYWORD1 void KEYWORD2 NAME(GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { - DISPATCH(Vertex4sv, (v), (F, "glVertex4sv(%p);", v)); + DISPATCH(GetHistogram, (target, reset, format, type, values), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Viewport)(GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat *params) { - DISPATCH(Viewport, (x, y, width, height), (F, "glViewport(%d, %d, %d, %d);", x, y, width, height)); + DISPATCH(GetHistogramParameterfv, (target, pname, params), (F, ";")); } - - - -/* GL 1.1 */ - -KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResident)(GLsizei n, const GLuint *textures, GLboolean *residences) +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameteriv)(GLenum target, GLenum pname, GLint *params) { - RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResident(%d, %p, %p);", n, textures, residences)); + DISPATCH(GetHistogramParameteriv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ArrayElement)(GLint i) +KEYWORD1 void KEYWORD2 NAME(GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values) { - DISPATCH(ArrayElement, (i), (F, ";")); + DISPATCH(GetMinmax, (target, reset, format, types, values), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(BindTexture)(GLenum target, GLuint texture) +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat *params) { - DISPATCH(BindTexture, (target, texture), (F, ";")); + DISPATCH(GetMinmaxParameterfv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint *params) { - DISPATCH(ColorPointer, (size, type, stride, ptr), (F, ";")); + DISPATCH(GetMinmaxParameteriv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) +KEYWORD1 void KEYWORD2 NAME(GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { - DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, ";")); + DISPATCH(GetSeparableFilter, (target, format, type, row, column, span), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +KEYWORD1 void KEYWORD2 NAME(Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) { - DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, ";")); + DISPATCH(Histogram, (target, width, internalformat, sink), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(Minmax)(GLenum target, GLenum internalformat, GLboolean sink) { - DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, ";")); + DISPATCH(Minmax, (target, internalformat, sink), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(ResetMinmax)(GLenum target) { - DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, ";")); + DISPATCH(ResetMinmax, (target), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(DeleteTextures)(GLsizei n, const GLuint *textures) +KEYWORD1 void KEYWORD2 NAME(ResetHistogram)(GLenum target) { - DISPATCH(DeleteTextures, (n, textures), (F, ";")); + DISPATCH(ResetHistogram, (target), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(DisableClientState)(GLenum cap) +KEYWORD1 void KEYWORD2 NAME(SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) { - DISPATCH(DisableClientState, (cap), (F, "glDisableClientState(0x%x);", cap)); + DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(DrawArrays)(GLenum mode, GLint first, GLsizei count) +/*** + *** Extension functions + ***/ + +/* 2. GL_EXT_blend_color */ +KEYWORD1 void KEYWORD2 NAME(BlendColorEXT)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - DISPATCH(DrawArrays, (mode, first, count), (F, ";")); + DISPATCH(BlendColor, (red, green, blue, alpha), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointer)(GLsizei stride, const GLvoid *ptr) +/* 3. GL_EXT_polygon_offset */ +KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) { - DISPATCH(EdgeFlagPointer, (stride, ptr), (F, ";")); + DISPATCH(PolygonOffsetEXT, (factor, bias), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(EnableClientState)(GLenum cap) +/* 6. GL_EXT_texture3D */ + +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(EnableClientState, (cap), (F, "glEnableClientState(0x%x)", cap)); + DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GenTextures)(GLsizei n, GLuint *textures) +KEYWORD1 void KEYWORD2 NAME(TexImage3DEXT)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { - DISPATCH(GenTextures, (n, textures), (F, ";")); + DISPATCH(TexImage3D, (target, level, internalFormat, width, height, depth, border, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetPointerv)(GLenum pname, GLvoid **params) +KEYWORD1 void KEYWORD2 NAME(TexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) { - DISPATCH(GetPointerv, (pname, params), (F, ";")); + DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(IndexPointer)(GLenum type, GLsizei stride, const GLvoid *ptr) +/* 7. GL_SGI_texture_filter4 */ + +KEYWORD1 void KEYWORD2 NAME(GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat *weights) { - DISPATCH(IndexPointer, (type, stride, ptr), (F, ";")); + DISPATCH(GetTexFilterFuncSGIS, (target, filter, weights), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Indexub)(GLubyte c) +KEYWORD1 void KEYWORD2 NAME(TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat *weights) { - DISPATCH(Indexub, (c), (F, ";")); + DISPATCH(TexFilterFuncSGIS, (target, filter, n, weights), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Indexubv)(const GLubyte *c) +/* 9. GL_EXT_subtexture */ + +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { - DISPATCH(Indexubv, (c), (F, ";")); + DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer) +KEYWORD1 void KEYWORD2 NAME(TexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels) { - DISPATCH(InterleavedArrays, (format, stride, pointer), (F, ";")); + DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, ";")); } -KEYWORD1 GLboolean KEYWORD2 NAME(IsTexture)(GLuint texture) +KEYWORD1 void KEYWORD2 NAME(TexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) { - RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTexture(%u);", texture)); + DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(NormalPointer)(GLenum type, GLsizei stride, const GLvoid *ptr) +/* 10. GL_EXT_copy_texture */ + +KEYWORD1 void KEYWORD2 NAME(CopyTexImage1DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) { - DISPATCH(NormalPointer, (type, stride, ptr), (F, ";")); + DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PolygonOffset)(GLfloat factor, GLfloat units) +KEYWORD1 void KEYWORD2 NAME(CopyTexImage2DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { - DISPATCH(PolygonOffset, (factor, units), (F, ";")); + DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PopClientAttrib)(void) +KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(PopClientAttrib, (), (F, "glPopClientAttrib();")); + DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PrioritizeTextures)(GLsizei n, const GLuint *textures, const GLclampf *priorities) +/* 11. GL_EXT_histogram */ +KEYWORD1 void KEYWORD2 NAME(GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { - DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, ";")); + DISPATCH(GetHistogramEXT, (target, reset, format, type, values), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PushClientAttrib)(GLbitfield mask) +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) { - DISPATCH(PushClientAttrib, (mask), (F, "glPushClientAttrib(0x%x)", mask)); + DISPATCH(GetHistogramParameterfvEXT, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint *params) { - DISPATCH(TexCoordPointer, (size, type, stride, ptr), (F, ";")); + DISPATCH(GetHistogramParameterivEXT, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values) { - DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, ";")); + DISPATCH(GetMinmaxEXT, (target, reset, format, types, values), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) { - DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, ";")); + DISPATCH(GetMinmaxParameterfvEXT, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint *params) { - DISPATCH(VertexPointer, (size, type, stride, ptr), (F, ";")); + DISPATCH(GetMinmaxParameterivEXT, (target, pname, params), (F, ";")); } - - - -/* GL 1.2 */ - -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(HistogramEXT)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) { - DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, ";")); + DISPATCH(Histogram, (target, width, internalformat, sink), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) +KEYWORD1 void KEYWORD2 NAME(MinmaxEXT)(GLenum target, GLenum internalformat, GLboolean sink) { - DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, ";")); + DISPATCH(Minmax, (target, internalformat, sink), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(ResetHistogramEXT)(GLenum target) { - DISPATCH(TexImage3D, (target, level, internalformat, width, height, depth, border, format, type, pixels), (F, ";")); + DISPATCH(ResetHistogram, (target), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(ResetMinmaxEXT)(GLenum target) { - DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, ";")); + DISPATCH(ResetMinmax, (target), (F, ";")); } +/* 12. GL_EXT_convolution */ - -/* GL_ARB_imaging */ - -KEYWORD1 void KEYWORD2 NAME(BlendColor)(GLclampf r, GLclampf g, GLclampf b, GLclampf a) +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) { - DISPATCH(BlendColor, (r, g, b, a), (F, ";")); + DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(BlendEquation)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) { - DISPATCH(BlendEquation, (mode), (F, ";")); + DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfEXT)(GLenum target, GLenum pname, GLfloat params) { - DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, ";")); + DISPATCH(ConvolutionParameterf, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) { - DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, ";")); + DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriEXT)(GLenum target, GLenum pname, GLint params) { - DISPATCH(ColorTableParameterfv, (target, pname, params), (F, ";")); + DISPATCH(ConvolutionParameteri, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ColorTableParameteriv)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterivEXT)(GLenum target, GLenum pname, const GLint *params) { - DISPATCH(ColorTableParameteriv, (target, pname, params), (F, ";")); + DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { - DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, ";")); + DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) { - DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, ";")); + DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid *image) { - DISPATCH(ConvolutionParameterf, (target, pname, params), (F, ";")); + DISPATCH(GetConvolutionFilterEXT, (target, format, type, image), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) { - DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, ";")); + DISPATCH(GetConvolutionParameterfvEXT, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteri)(GLenum target, GLenum pname, GLint params) +KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint *params) { - DISPATCH(ConvolutionParameteri, (target, pname, params), (F, ";")); + DISPATCH(GetConvolutionParameterivEXT, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { - DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, ";")); + DISPATCH(GetSeparableFilterEXT, (target, format, type, row, column, span), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(SeparableFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) { - DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, ";")); + DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +/* 14. GL_SGI_color_table */ + +KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfvSGI)(GLenum target, GLenum pname, const GLfloat *params) { - DISPATCH(CopyColorTable, (target, internalformat, x, y, width), (F, ";")); + DISPATCH(ColorTableParameterfv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(ColorTableParameterivSGI)(GLenum target, GLenum pname, const GLint *params) { - DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, ";")); + DISPATCH(ColorTableParameteriv, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(ColorTableSGI)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) { - DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, ";")); + DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(CopyColorTableSGI)(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { - DISPATCH(GetColorTable, (target, format, type, table), (F, ";")); + DISPATCH(CopyColorTable, (target, internalFormat, x, y, width), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid *table) { - DISPATCH(GetColorTableParameterfv, (target, pname, params), (F, ";")); + DISPATCH(GetColorTableSGI, (target, format, type, table), (F, ";")); } - -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameteriv)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat *params) { - DISPATCH(GetColorTableParameteriv, (target, pname, params), (F, ";")); + DISPATCH(GetColorTableParameterfvSGI, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint *params) { - DISPATCH(GetConvolutionFilter, (target, format, type, image), (F, ";")); + DISPATCH(GetColorTableParameterivSGI, (target, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat *params) +/* ??. GL_SGIX_pixel_texture */ + +KEYWORD1 void KEYWORD2 NAME(PixelTexGenSGIX)(GLenum mode) { - DISPATCH(GetConvolutionParameterfv, (target, pname, params), (F, ";")); + DISPATCH(PixelTexGenSGIX, (mode), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint *params) +/* 15. GL_SGIS_pixel_texture */ + +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfSGIS)(GLenum target, GLfloat value) { - DISPATCH(GetConvolutionParameteriv, (target, pname, params), (F, ";")); + DISPATCH(PixelTexGenParameterfSGIS, (target, value), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfvSGIS)(GLenum target, const GLfloat *value) { - DISPATCH(GetHistogram, (target, reset, format, type, values), (F, ";")); + DISPATCH(PixelTexGenParameterfvSGIS, (target, value), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameteriSGIS)(GLenum target, GLint value) { - DISPATCH(GetHistogramParameterfv, (target, pname, params), (F, ";")); + DISPATCH(PixelTexGenParameteriSGIS, (target, value), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetHistogramParameteriv)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterivSGIS)(GLenum target, const GLint *value) { - DISPATCH(GetHistogramParameteriv, (target, pname, params), (F, ";")); + DISPATCH(PixelTexGenParameterivSGIS, (target, value), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values) +KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterfvSGIS)(GLenum target, GLfloat *value) { - DISPATCH(GetMinmax, (target, reset, format, types, values), (F, ";")); + DISPATCH(GetPixelTexGenParameterfvSGIS, (target, value), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterivSGIS)(GLenum target, GLint *value) { - DISPATCH(GetMinmaxParameterfv, (target, pname, params), (F, ";")); + DISPATCH(GetPixelTexGenParameterivSGIS, (target, value), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint *params) +/* 16. GL_SGIS_texture4D */ + +KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels) { - DISPATCH(GetMinmaxParameteriv, (target, pname, params), (F, ";")); + DISPATCH(TexImage4DSGIS, (target, level, internalFormat, width, height, depth, extent, border, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) +KEYWORD1 void KEYWORD2 NAME(TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void *pixels) { - DISPATCH(GetSeparableFilter, (target, format, type, row, column, span), (F, ";")); + DISPATCH(TexSubImage4DSGIS, (target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, extent, format, type, pixels), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) +/* 20. GL_EXT_texture_object */ + +KEYWORD1 void KEYWORD2 NAME(GenTexturesEXT)(GLsizei n, GLuint *textures) { - DISPATCH(Histogram, (target, width, internalformat, sink), (F, ";")); + DISPATCH(GenTextures, (n, textures), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(Minmax)(GLenum target, GLenum internalformat, GLboolean sink) +KEYWORD1 void KEYWORD2 NAME(DeleteTexturesEXT)(GLsizei n, const GLuint *texture) { - DISPATCH(Minmax, (target, internalformat, sink), (F, ";")); + DISPATCH(DeleteTextures, (n, texture), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ResetMinmax)(GLenum target) +KEYWORD1 void KEYWORD2 NAME(BindTextureEXT)(GLenum target, GLuint texture) { - DISPATCH(ResetMinmax, (target), (F, ";")); + DISPATCH(BindTexture, (target, texture), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ResetHistogram)(GLenum target) +KEYWORD1 void KEYWORD2 NAME(PrioritizeTexturesEXT)(GLsizei n, const GLuint *textures, const GLclampf *priorities) { - DISPATCH(ResetHistogram, (target), (F, ";")); + DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) +KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResidentEXT)(GLsizei n, const GLuint *textures, GLboolean *residences) { - DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, ";")); + RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResidentEXT(%d %p %p);", n, textures, residences)); } - - -/*** - *** Extension functions - ***/ - - -/* 2. GL_EXT_blend_color */ -KEYWORD1 void KEYWORD2 NAME(BlendColorEXT)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +KEYWORD1 GLboolean KEYWORD2 NAME(IsTextureEXT)(GLuint texture) { - DISPATCH(BlendColor, (red, green, blue, alpha), (F, ";")); + RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTextureEXT(%u);", texture)); } +/* 21. GL_SGIS_detail_texture */ - -/* 3. GL_EXT_polygon_offset */ -KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) +KEYWORD1 void KEYWORD2 NAME(DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat *points) { - DISPATCH(PolygonOffsetEXT, (factor, bias), (F, ";")); + DISPATCH(DetailTexFuncSGIS, (target, n, points), (F, ";")); } +KEYWORD1 void KEYWORD2 NAME(GetDetailTexFuncSGIS)(GLenum target, GLfloat *points) +{ + DISPATCH(GetDetailTexFuncSGIS, (target, points), (F, ";")); +} +/* 22. GL_SGIS_sharpen_texture */ -/* 6. GL_EXT_texture3D */ +KEYWORD1 void KEYWORD2 NAME(GetSharpenTexFuncSGIS)(GLenum target, GLfloat *points) +{ + DISPATCH(GetSharpenTexFuncSGIS, (target, points), (F, ";")); +} -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat *points) { - DISPATCH(CopyTexSubImage3D, (target, level, xoffset, yoffset, zoffset, x, y, width, height), (F, ";")); + DISPATCH(SharpenTexFuncSGIS, (target, n, points), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexImage3DEXT)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +/* 25. GL_SGIS_multisample */ + +KEYWORD1 void KEYWORD2 NAME(SampleMaskSGIS)(GLclampf value, GLboolean invert) { - DISPATCH(TexImage3D, (target, level, internalFormat, width, height, depth, border, format, type, pixels), (F, ";")); + DISPATCH(SampleMaskSGIS, (value, invert), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage3DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) +KEYWORD1 void KEYWORD2 NAME(SamplePatternSGIS)(GLenum pattern) { - DISPATCH(TexSubImage3D, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), (F, ";")); + DISPATCH(SamplePatternSGIS, (pattern), (F, ";")); } +/* 30. GL_EXT_vertex_array */ +KEYWORD1 void KEYWORD2 NAME(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +{ + DISPATCH(VertexPointerEXT, (size, type, stride, count, ptr), (F, ";")); +} -/* 7. GL_SGI_texture_filter4 */ +KEYWORD1 void KEYWORD2 NAME(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +{ + DISPATCH(NormalPointerEXT, (type, stride, count, ptr), (F, ";")); +} -KEYWORD1 void KEYWORD2 NAME(GetTexFilterFuncSGIS)(GLenum target, GLenum filter, GLfloat *weights) +KEYWORD1 void KEYWORD2 NAME(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { - DISPATCH(GetTexFilterFuncSGIS, (target, filter, weights), (F, ";")); + DISPATCH(ColorPointerEXT, (size, type, stride, count, ptr), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexFilterFuncSGIS)(GLenum target, GLenum filter, GLsizei n, const GLfloat *weights) +KEYWORD1 void KEYWORD2 NAME(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) { - DISPATCH(TexFilterFuncSGIS, (target, filter, n, weights), (F, ";")); + DISPATCH(IndexPointerEXT, (type, stride, count, ptr), (F, ";")); } +KEYWORD1 void KEYWORD2 NAME(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +{ + DISPATCH(ColorPointerEXT, (size, type, stride, count, ptr), (F, ";")); +} +KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean *ptr) +{ + DISPATCH(EdgeFlagPointerEXT, (stride, count, ptr), (F, ";")); +} -/* 9. GL_EXT_subtexture */ +KEYWORD1 void KEYWORD2 NAME(GetPointervEXT)(GLenum pname, void **params) +{ + DISPATCH(GetPointerv, (pname, params), (F, ";")); +} -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(DrawArraysEXT)(GLenum mode, GLint first, GLsizei count) { - DISPATCH(CopyTexSubImage1D, (target, level, xoffset, x, y, width), (F, ";")); + DISPATCH(DrawArrays, (mode, first, count), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage1DEXT)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels) +/* 37. GL_EXT_blend_minmax */ +KEYWORD1 void KEYWORD2 NAME(BlendEquationEXT)(GLenum mode) { - DISPATCH(TexSubImage1D, (target, level, xoffset, width, format, type, pixels), (F, ";")); + DISPATCH(BlendEquation, (mode), (F, "glBlendEquationEXT(0x%x);", mode)); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) +/* 52. GL_SGIX_sprite */ + +KEYWORD1 void KEYWORD2 NAME(SpriteParameterfSGIX)(GLenum pname, GLfloat param) { - DISPATCH(TexSubImage2D, (target, level, xoffset, yoffset, width, height, format, type, pixels), (F, ";")); + DISPATCH(SpriteParameterfSGIX, (pname, param), (F, ";")); } +KEYWORD1 void KEYWORD2 NAME(SpriteParameterfvSGIX)(GLenum pname, const GLfloat *param) +{ + DISPATCH(SpriteParameterfvSGIX, (pname, param), (F, ";")); +} -/* 10. GL_EXT_copy_texture */ +KEYWORD1 void KEYWORD2 NAME(SpriteParameteriSGIX)(GLenum pname, GLint param) +{ + DISPATCH(SpriteParameteriSGIX, (pname, param), (F, ";")); +} -KEYWORD1 void KEYWORD2 NAME(CopyTexImage1DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) +KEYWORD1 void KEYWORD2 NAME(SpriteParameterivSGIX)(GLenum pname, const GLint *param) { - DISPATCH(CopyTexImage1D, (target, level, internalformat, x, y, width, border), (F, ";")); + DISPATCH(SpriteParameterivSGIX, (pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyTexImage2DEXT)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +/* 54. GL_EXT_point_parameters */ + +KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum target, GLfloat param) { - DISPATCH(CopyTexImage2D, (target, level, internalformat, x, y, width, height, border), (F, ";")); + DISPATCH(PointParameterfEXT, (target, param), (F, ";")); } +KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum target, const GLfloat *param) +{ + DISPATCH(PointParameterfvEXT, (target, param), (F, ";")); +} -KEYWORD1 void KEYWORD2 NAME(CopyTexSubImage2DEXT)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +KEYWORD1 void KEYWORD2 NAME(PointParameterfSGIS)(GLenum target, GLfloat param) { - DISPATCH(CopyTexSubImage2D, (target, level, xoffset, yoffset, x, y, width, height), (F, ";")); + DISPATCH(PointParameterfEXT, (target, param), (F, ";")); } +KEYWORD1 void KEYWORD2 NAME(PointParameterfvSGIS)(GLenum target, const GLfloat *param) +{ + DISPATCH(PointParameterfvEXT, (target, param), (F, ";")); +} +/* 55. GL_SGIX_instruments */ +KEYWORD1 GLint KEYWORD2 NAME(GetInstrumentsSGIX)(void) +{ + RETURN_DISPATCH(GetInstrumentsSGIX, (), (F, ";")); +} -/* 11. GL_EXT_histogram */ -KEYWORD1 void KEYWORD2 NAME(GetHistogramEXT)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) +KEYWORD1 void KEYWORD2 NAME(InstrumentsBufferSGIX)(GLsizei size, GLint *buf) { - DISPATCH(GetHistogramEXT, (target, reset, format, type, values), (F, ";")); + DISPATCH(InstrumentsBufferSGIX, (size, buf), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 GLint KEYWORD2 NAME(PollInstrumentsSGIX)(GLint *markerp) { - DISPATCH(GetHistogramParameterfvEXT, (target, pname, params), (F, ";")); + RETURN_DISPATCH(PollInstrumentsSGIX, (markerp), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetHistogramParameterivEXT)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(ReadInstrumentsSGIX)(GLint marker) { - DISPATCH(GetHistogramParameterivEXT, (target, pname, params), (F, ";")); + DISPATCH(ReadInstrumentsSGIX, (marker), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetMinmaxEXT)(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values) +KEYWORD1 void KEYWORD2 NAME(StartInstrumentsSGIX)(void) { - DISPATCH(GetMinmaxEXT, (target, reset, format, types, values), (F, ";")); + DISPATCH(StartInstrumentsSGIX, (), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(StopInstrumentsSGIX)(GLint marker) { - DISPATCH(GetMinmaxParameterfvEXT, (target, pname, params), (F, ";")); + DISPATCH(StopInstrumentsSGIX, (marker), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetMinmaxParameterivEXT)(GLenum target, GLenum pname, GLint *params) +/* 57. GL_SGIX_framezoom */ +KEYWORD1 void KEYWORD2 NAME(FrameZoomSGIX)(GLint factor) { - DISPATCH(GetMinmaxParameterivEXT, (target, pname, params), (F, ";")); + DISPATCH(FrameZoomSGIX, (factor), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(HistogramEXT)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) +/* 58. GL_SGIX_tag_sample_buffer */ +KEYWORD1 void KEYWORD2 NAME(TagSampleBufferSGIX)(void) { - DISPATCH(Histogram, (target, width, internalformat, sink), (F, ";")); + DISPATCH(TagSampleBufferSGIX, (), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(MinmaxEXT)(GLenum target, GLenum internalformat, GLboolean sink) +/* 60. GL_SGIX_reference_plane */ +KEYWORD1 void KEYWORD2 NAME(ReferencePlaneSGIX)(const GLdouble *plane) { - DISPATCH(Minmax, (target, internalformat, sink), (F, ";")); + DISPATCH(ReferencePlaneSGIX, (plane), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ResetHistogramEXT)(GLenum target) +/* 61. GL_SGIX_flush_raster */ +KEYWORD1 void KEYWORD2 NAME(FlushRasterSGIX)(void) { - DISPATCH(ResetHistogram, (target), (F, ";")); + DISPATCH(FlushRasterSGIX, (), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ResetMinmaxEXT)(GLenum target) +/* 66. GL_HP_image_transform */ +#if 0 +KEYWORD1 void KEYWORD2 NAME(GetImageTransformParameterfvHP)(GLenum target, GLenum pname, GLfloat *param) { - DISPATCH(ResetMinmax, (target), (F, ";")); + DISPATCH(GetImageTransformParameterfvHP, (target, pname, param), (F, ";")); } +KEYWORD1 void KEYWORD2 NAME(GetImageTransformParameterivHP)(GLenum target, GLenum pname, GLint *param) +{ + DISPATCH(GetImageTransformParameterivHP, (target, pname, param), (F, ";")); +} +KEYWORD1 void KEYWORD2 NAME(ImageTransformParameterfHP)(GLenum target, GLenum pname, const GLfloat param) +{ + DISPATCH(ImageTransformParameterfHP, (target, pname, param), (F, ";")); +} -/* 12. GL_EXT_convolution */ +KEYWORD1 void KEYWORD2 NAME(ImageTransformParameterfvHP)(GLenum target, GLenum pname, const GLfloat *param) +{ + DISPATCH(ImageTransformParameterfvHP, (target, pname, param), (F, ";")); +} -KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(ImageTransformParameteriHP)(GLenum target, GLenum pname, const GLint param) { - DISPATCH(ConvolutionFilter1D, (target, internalformat, width, format, type, image), (F, ";")); + DISPATCH(ImageTransformParameteriHP, (target, pname, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(ImageTransformParameterivHP)(GLenum target, GLenum pname, const GLint *param) +{ + DISPATCH(ImageTransformParameterivHP, (target, pname, param), (F, ";")); +} +#endif + +/* 74. GL_EXT_color_subtable */ +KEYWORD1 void KEYWORD2 NAME(ColorSubTableEXT)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data) +{ + DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(CopyColorSubTableEXT)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +{ + DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, ";")); +} + +/* 77. GL_PGI_misc_hints */ +KEYWORD1 void KEYWORD2 NAME(HintPGI)(GLenum target, GLint mode) +{ + DISPATCH(HintPGI, (target, mode), (F, ";")); +} + +/* 78. GL_EXT_paletted_texture */ + +KEYWORD1 void KEYWORD2 NAME(ColorTableEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) +{ + DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid *table) +{ + DISPATCH(GetColorTableEXT, (target, format, type, table), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) +{ + DISPATCH(GetColorTableParameterfvEXT, (target, pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint *params) +{ + DISPATCH(GetColorTableParameterivEXT, (target, pname, params), (F, ";")); +} + +/* 80. GL_SGIX_list_priority */ + +KEYWORD1 void KEYWORD2 NAME(GetListParameterfvSGIX)(GLuint list, GLenum name, GLfloat *param) +{ + DISPATCH(GetListParameterfvSGIX, (list, name, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(GetListParameterivSGIX)(GLuint list, GLenum name, GLint *param) +{ + DISPATCH(GetListParameterivSGIX, (list, name, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(ListParameterfSGIX)(GLuint list, GLenum name, GLfloat param) +{ + DISPATCH(ListParameterfSGIX, (list, name, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(ListParameterfvSGIX)(GLuint list, GLenum name, const GLfloat *param) +{ + DISPATCH(ListParameterfvSGIX, (list, name, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(ListParameteriSGIX)(GLuint list, GLenum name, GLint param) +{ + DISPATCH(ListParameteriSGIX, (list, name, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(ListParameterivSGIX)(GLuint list, GLenum name, const GLint *param) +{ + DISPATCH(ListParameterivSGIX, (list, name, param), (F, ";")); +} + +/* 94. GL_EXT_index_material */ +KEYWORD1 void KEYWORD2 NAME(IndexMaterialEXT)(GLenum face, GLenum mode) +{ + DISPATCH(IndexMaterialEXT, (face, mode), (F, ";")); +} + +/* 95. GL_EXT_index_func */ +KEYWORD1 void KEYWORD2 NAME(IndexFuncEXT)(GLenum func, GLfloat ref) +{ + DISPATCH(IndexFuncEXT, (func, ref), (F, ";")); +} + +/* 97. GL_EXT_compiled_vertex_array */ +KEYWORD1 void KEYWORD2 NAME(LockArraysEXT)(GLint first, GLsizei count) +{ + DISPATCH(LockArraysEXT, (first, count), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) +{ + DISPATCH(UnlockArraysEXT, (), (F, ";")); +} + +/* 98. GL_EXT_cull_vertex */ +KEYWORD1 void KEYWORD2 NAME(CullParameterfvEXT)(GLenum pname, GLfloat *params) +{ + DISPATCH(CullParameterfvEXT, (pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(CullParameterdvEXT)(GLenum pname, GLdouble *params) +{ + DISPATCH(CullParameterdvEXT, (pname, params), (F, ";")); +} + +/* 102. GL_SGIX_fragment_lighting */ +KEYWORD1 void KEYWORD2 NAME(FragmentColorMaterialSGIX)(GLenum face, GLenum mode) +{ + DISPATCH(FragmentColorMaterialSGIX, (face, mode), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param) +{ + DISPATCH(FragmentLightfSGIX, (light, pname, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params) +{ + DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param) +{ + DISPATCH(FragmentLightiSGIX, (light, pname, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params) +{ + DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfSGIX)(GLenum pname, GLfloat param) +{ + DISPATCH(FragmentLightModelfSGIX, (pname, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params) +{ + DISPATCH(FragmentLightModelfvSGIX, (pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightModeliSGIX)(GLenum pname, GLint param) +{ + DISPATCH(FragmentLightModeliSGIX, (pname, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentLightModelivSGIX)(GLenum pname, const GLint * params) +{ + DISPATCH(FragmentLightModelivSGIX, (pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param) +{ + DISPATCH(FragmentMaterialfSGIX, (face, pname, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params) +{ + DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param) +{ + DISPATCH(FragmentMaterialiSGIX, (face, pname, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params) +{ + DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params) +{ + DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params) +{ + DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params) +{ + DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params) +{ + DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param) +{ + DISPATCH(LightEnviSGIX, (pname, param), (F, ";")); +} + +/* 112. GL_EXT_draw_range_elements */ +KEYWORD1 void KEYWORD2 NAME(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) +{ + DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElementsEXT(0x%x, %u %u %d 0x%x %p);", mode, start, end, count, type, indices)); +} + +/* 117. GL_EXT_light_texture */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(ApplyTextureEXT)(GLenum mode) +{ + DISPATCH(ApplyTextureEXT, (mode), (F, "glApplyTextureEXT(0x%x);", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(TextureLightEXT)(GLenum pname) +{ + DISPATCH(TextureLightEXT, (pname), (F, "glTextureLightEXT(0x%x);", pname)); +} + +KEYWORD1 void KEYWORD2 NAME(TextureMaterialEXT)(GLenum face, GLenum mode) +{ + DISPATCH(TextureMaterialEXT, (face, mode), (F, "glTextureMaterialEXT(0x%x, 0x%x);", face, mode)); +} +#endif + +/* 135. GL_INTEL_texture_scissor */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(TexScissorINTEL)(GLenum target, GLclampf tlow, GLclampf thigh) +{ + DISPATCH(TexScissorINTEL, (target, tlow, thigh), (F, "glTexScissorINTEL(0x%x %g %g);", target, tlow, thigh)); +} + +KEYWORD1 void KEYWORD2 NAME(TexScissorFuncINTEL)(GLenum target, GLenum lfunc, GLenum hfunc) +{ + DISPATCH(TexScissorFuncINTEL, (target, lfunc, hfunc), (F, "glTexScissorFuncINTEL(0x%x 0x%x 0x%x);", target, tlow, thigh)); +} +#endif + +/* 136. GL_INTEL_parallel_arrays */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(VertexPointervINTEL)(GLint size, GLenum type, const void ** pointer) +{ + DISPATCH(VertexPointervINTEL, (size, type, pointer), (F, "glVertexPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(NormalPointervINTEL)(GLenum type, const void** pointer) +{ + DISPATCH(NormalPointervINTEL, (size, pointer), (F, "glNormalPointervINTEL(%d, %p);", size, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorPointervINTEL)(GLint size, GLenum type, const void** pointer) +{ + DISPATCH(ColorPointervINTEL, (size, type, pointer), (F, "glColorPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoordPointervINTEL)(GLint size, GLenum type, const void** pointer) +{ + DISPATCH(TexCoordPointervINTEL, (size, type, pointer), (F, "glTexCoordPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} +#endif + +/* 138. GL_EXT_pixel_transform */ +#if 0 +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameteriEXT)(GLenum target, GLenum pname, const GLint param) +{ + DISPATCH(PixelTransformParameteriEXT, (target, pname, param), (F, "glPixelTransformParameteriEXT(0x%x, 0x%x, %d);", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfEXT)(GLenum target, GLenum pname, const GLfloat param) +{ + DISPATCH(PixelTransformParameterfEXT, (target, pname, param), (F, "glPixelTransformParameterfEXT(0x%x, 0x%x, %f);", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +{ + DISPATCH(PixelTransformParameterivEXT, (target, pname, params), (F, "glPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +{ + DISPATCH(PixelTransformParameterfvEXT, (target, pname, params), (F, "glPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +{ + DISPATCH(GetPixelTransformParameterivEXT, (target, pname, params), (F, "glGetPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +{ + DISPATCH(GetPixelTransformParameterfvEXT, (target, pname, params), (F, "glGetPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); +} +#endif + +/* 145. GL_EXT_secondary_color */ +KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLvoid * pointer) +{ + DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointerEXT(%d, 0x%x, %d, %p);", size, type, stride, pointer)); +} + +/* 149. GL_EXT_fog_coord */ +KEYWORD1 void KEYWORD2 NAME(FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer) +{ + DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointerEXT(0x%x, %d, %p);", type, stride, pointer)); +} + +/* 173. GL_EXT/INGR_blend_func_separate */ +KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +{ + DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateINGR)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +{ + DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, ";")); +} + +/* 190. GL_NV_vertex_array_range */ +KEYWORD1 void KEYWORD2 NAME(FlushVertexArrayRangeNV)(void) +{ + DISPATCH(FlushVertexArrayRangeNV, (), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(VertexArrayRangeNV)(GLsizei size, const GLvoid * pointer) +{ + DISPATCH(VertexArrayRangeNV, (size, pointer), (F, ";")); +} + +/* 191. GL_NV_register_combiners */ +KEYWORD1 void KEYWORD2 NAME(CombinerParameterfvNV)(GLenum pname, const GLfloat * params) +{ + DISPATCH(CombinerParameterfvNV, (pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerParameterfNV)(GLenum pname, GLfloat param) +{ + DISPATCH(CombinerParameterfNV, (pname, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerParameterivNV)(GLenum pname, const GLint * params) +{ + DISPATCH(CombinerParameterivNV, (pname, params), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerParameteriNV)(GLenum pname, GLint param) +{ + DISPATCH(CombinerParameteriNV, (pname, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) +{ + DISPATCH(CombinerInputNV, (stage, portion, variable, input, mapping, componentUsage), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum) +{ + DISPATCH(CombinerOutputNV, (stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) +{ + DISPATCH(FinalCombinerInputNV, (variable, input, mapping, componentUsage), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params) { - DISPATCH(ConvolutionFilter2D, (target, internalformat, width, height, format, type, image), (F, ";")); + DISPATCH(GetCombinerInputParameterfvNV, (stage, portion, variable, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfEXT)(GLenum target, GLenum pname, GLfloat params) +KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params) { - DISPATCH(ConvolutionParameterf, (target, pname, params), (F, ";")); + DISPATCH(GetCombinerInputParameterivNV, (stage, portion, variable, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params) { - DISPATCH(ConvolutionParameterfv, (target, pname, params), (F, ";")); + DISPATCH(GetCombinerOutputParameterfvNV, (stage, portion, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameteriEXT)(GLenum target, GLenum pname, GLint params) +KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params) { - DISPATCH(ConvolutionParameteri, (target, pname, params), (F, ";")); + DISPATCH(GetCombinerOutputParameterivNV, (stage, portion, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ConvolutionParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params) { - DISPATCH(ConvolutionParameteriv, (target, pname, params), (F, ";")); +DISPATCH(GetFinalCombinerInputParameterfvNV, (variable, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter1DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params) { - DISPATCH(CopyConvolutionFilter1D, (target, internalformat, x, y, width), (F, ";")); +DISPATCH(GetFinalCombinerInputParameterivNV, (variable, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyConvolutionFilter2DEXT)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) +/* 194. GL_EXT_vertex_weighting */ +KEYWORD1 void KEYWORD2 NAME(VertexWeightfEXT)(GLfloat weight) { - DISPATCH(CopyConvolutionFilter2D, (target, internalformat, x, y, width, height), (F, ";")); + DISPATCH(VertexWeightfEXT, (weight), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid *image) +KEYWORD1 void KEYWORD2 NAME(VertexWeightfvEXT)(const GLfloat * weight) { - DISPATCH(GetConvolutionFilterEXT, (target, format, type, image), (F, ";")); + DISPATCH(VertexWeightfvEXT, (weight), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer) { - DISPATCH(GetConvolutionParameterfvEXT, (target, pname, params), (F, ";")); + DISPATCH(VertexWeightPointerEXT, (size, type, stride, pointer), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetConvolutionParameterivEXT)(GLenum target, GLenum pname, GLint *params) +/* 196. GL_MESA_resize_buffers */ +KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void) { - DISPATCH(GetConvolutionParameterivEXT, (target, pname, params), (F, ";")); + DISPATCH(ResizeBuffersMESA, (), (F, "glResizeBuffersMESA();")); } -KEYWORD1 void KEYWORD2 NAME(GetSeparableFilterEXT)(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) +/* 197. GL_MESA_window_pos */ +KEYWORD1 void KEYWORD2 NAME(WindowPos2iMESA)(GLint x, GLint y) { - DISPATCH(GetSeparableFilterEXT, (target, format, type, row, column, span), (F, ";")); + DISPATCH(WindowPos2iMESA, (x, y), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SeparableFilter2DEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) +KEYWORD1 void KEYWORD2 NAME(WindowPos2sMESA)(GLshort x, GLshort y) { - DISPATCH(SeparableFilter2D, (target, internalformat, width, height, format, type, row, column), (F, ";")); + DISPATCH(WindowPos2sMESA, (x, y), (F, ";")); } - - -/* 14. GL_SGI_color_table */ - -KEYWORD1 void KEYWORD2 NAME(ColorTableParameterfvSGI)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(WindowPos2fMESA)(GLfloat x, GLfloat y) { - DISPATCH(ColorTableParameterfv, (target, pname, params), (F, ";")); + DISPATCH(WindowPos2fMESA, (x, y), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ColorTableParameterivSGI)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(WindowPos2dMESA)(GLdouble x, GLdouble y) { - DISPATCH(ColorTableParameteriv, (target, pname, params), (F, ";")); + DISPATCH(WindowPos2dMESA, (x, y), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(ColorTableSGI)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(WindowPos2ivMESA)(const GLint *p) { - DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, ";")); + DISPATCH(WindowPos2ivMESA, (p), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CopyColorTableSGI)(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(WindowPos2svMESA)(const GLshort *p) { - DISPATCH(CopyColorTable, (target, internalFormat, x, y, width), (F, ";")); + DISPATCH(WindowPos2svMESA, (p), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableSGI)(GLenum target, GLenum format, GLenum type, GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(WindowPos2fvMESA)(const GLfloat *p) { - DISPATCH(GetColorTableSGI, (target, format, type, table), (F, ";")); + DISPATCH(WindowPos2fvMESA, (p), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvSGI)(GLenum target, GLenum pname, GLfloat *params) + +KEYWORD1 void KEYWORD2 NAME(WindowPos2dvMESA)(const GLdouble *p) { - DISPATCH(GetColorTableParameterfvSGI, (target, pname, params), (F, ";")); + DISPATCH(WindowPos2dvMESA, (p), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivSGI)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(WindowPos3iMESA)(GLint x, GLint y, GLint z) { - DISPATCH(GetColorTableParameterivSGI, (target, pname, params), (F, ";")); + DISPATCH(WindowPos3iMESA, (x, y, z), (F, ";")); } - - -/* ??. GL_SGIX_pixel_texture */ - -KEYWORD1 void KEYWORD2 NAME(PixelTexGenSGIX)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z) { - DISPATCH(PixelTexGenSGIX, (mode), (F, ";")); + DISPATCH(WindowPos3sMESA, (x, y, z), (F, ";")); } - -/* 15. GL_SGIS_pixel_texture */ - -KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfSGIS)(GLenum target, GLfloat value) +KEYWORD1 void KEYWORD2 NAME(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(PixelTexGenParameterfSGIS, (target, value), (F, ";")); + DISPATCH(WindowPos3fMESA, (x, y, z), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterfvSGIS)(GLenum target, const GLfloat *value) +KEYWORD1 void KEYWORD2 NAME(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(PixelTexGenParameterfvSGIS, (target, value), (F, ";")); + DISPATCH(WindowPos3dMESA, (x, y, z), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameteriSGIS)(GLenum target, GLint value) +KEYWORD1 void KEYWORD2 NAME(WindowPos3ivMESA)(const GLint *p) { - DISPATCH(PixelTexGenParameteriSGIS, (target, value), (F, ";")); + DISPATCH(WindowPos3ivMESA, (p), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PixelTexGenParameterivSGIS)(GLenum target, const GLint *value) +KEYWORD1 void KEYWORD2 NAME(WindowPos3svMESA)(const GLshort *p) { - DISPATCH(PixelTexGenParameterivSGIS, (target, value), (F, ";")); + DISPATCH(WindowPos3svMESA, (p), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterfvSGIS)(GLenum target, GLfloat *value) +KEYWORD1 void KEYWORD2 NAME(WindowPos3fvMESA)(const GLfloat *p) { - DISPATCH(GetPixelTexGenParameterfvSGIS, (target, value), (F, ";")); + DISPATCH(WindowPos3fvMESA, (p), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterivSGIS)(GLenum target, GLint *value) +KEYWORD1 void KEYWORD2 NAME(WindowPos3dvMESA)(const GLdouble *p) { - DISPATCH(GetPixelTexGenParameterivSGIS, (target, value), (F, ";")); + DISPATCH(WindowPos3dvMESA, (p), (F, ";")); } - - -/* 16. GL_SGIS_texture4D */ - -KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels) +KEYWORD1 void KEYWORD2 NAME(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w) { - DISPATCH(TexImage4DSGIS, (target, level, internalFormat, width, height, depth, extent, border, format, type, pixels), (F, ";")); + DISPATCH(WindowPos4iMESA, (x, y, z, w), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void *pixels) +KEYWORD1 void KEYWORD2 NAME(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w) { - DISPATCH(TexSubImage4DSGIS, (target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, extent, format, type, pixels), (F, ";")); + DISPATCH(WindowPos4sMESA, (x, y, z, w), (F, ";")); } - - -/* 20. GL_EXT_texture_object */ - -KEYWORD1 void KEYWORD2 NAME(GenTexturesEXT)(GLsizei n, GLuint *textures) +KEYWORD1 void KEYWORD2 NAME(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - DISPATCH(GenTextures, (n, textures), (F, ";")); + DISPATCH(WindowPos4fMESA, (x, y, z, w), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(DeleteTexturesEXT)(GLsizei n, const GLuint *texture) +KEYWORD1 void KEYWORD2 NAME(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - DISPATCH(DeleteTextures, (n, texture), (F, ";")); + DISPATCH(WindowPos4dMESA, (x, y, z, w), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(BindTextureEXT)(GLenum target, GLuint texture) +KEYWORD1 void KEYWORD2 NAME(WindowPos4ivMESA)(const GLint *p) { - DISPATCH(BindTexture, (target, texture), (F, ";")); + DISPATCH(WindowPos4ivMESA, (p), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PrioritizeTexturesEXT)(GLsizei n, const GLuint *textures, const GLclampf *priorities) +KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort *p) { - DISPATCH(PrioritizeTextures, (n, textures, priorities), (F, ";")); + DISPATCH(WindowPos4svMESA, (p), (F, ";")); } -KEYWORD1 GLboolean KEYWORD2 NAME(AreTexturesResidentEXT)(GLsizei n, const GLuint *textures, GLboolean *residences) +KEYWORD1 void KEYWORD2 NAME(WindowPos4fvMESA)(const GLfloat *p) { - RETURN_DISPATCH(AreTexturesResident, (n, textures, residences), (F, "glAreTexturesResidentEXT(%d %p %p);", n, textures, residences)); + DISPATCH(WindowPos4fvMESA, (p), (F, ";")); } -KEYWORD1 GLboolean KEYWORD2 NAME(IsTextureEXT)(GLuint texture) +KEYWORD1 void KEYWORD2 NAME(WindowPos4dvMESA)(const GLdouble *p) { - RETURN_DISPATCH(IsTexture, (texture), (F, "glIsTextureEXT(%u);", texture)); + DISPATCH(WindowPos4dvMESA, (p), (F, ";")); } +/* 208. GL_3DFX_tbuffer */ +KEYWORD1 void KEYWORD2 NAME(TbufferMask3DFX)(GLuint mask) +{ + DISPATCH(TbufferMask3DFX, (mask), (F, "glTbufferMask3DFX(0x%x);", mask)); +} +/* 209. WGL_EXT_multisample */ -/* 21. GL_SGIS_detail_texture */ - -KEYWORD1 void KEYWORD2 NAME(DetailTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat *points) +KEYWORD1 void KEYWORD2 NAME(SampleMaskEXT)(GLclampf value, GLboolean invert) { - DISPATCH(DetailTexFuncSGIS, (target, n, points), (F, ";")); + DISPATCH(SampleMaskSGIS, (value, invert), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetDetailTexFuncSGIS)(GLenum target, GLfloat *points) +KEYWORD1 void KEYWORD2 NAME(SamplePatternEXT)(GLenum pattern) { - DISPATCH(GetDetailTexFuncSGIS, (target, points), (F, ";")); + DISPATCH(SamplePatternSGIS, (pattern), (F, ";")); } +/* ARB 1. GL_ARB_multitexture */ -/* 22. GL_SGIS_sharpen_texture */ - -KEYWORD1 void KEYWORD2 NAME(GetSharpenTexFuncSGIS)(GLenum target, GLfloat *points) +KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) { - DISPATCH(GetSharpenTexFuncSGIS, (target, points), (F, ";")); + DISPATCH(ActiveTextureARB, (texture), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SharpenTexFuncSGIS)(GLenum target, GLsizei n, const GLfloat *points) +KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) { - DISPATCH(SharpenTexFuncSGIS, (target, n, points), (F, ";")); + DISPATCH(ClientActiveTextureARB, (texture), (F, ";")); } -/* 25. GL_SGIS_multisample */ - -KEYWORD1 void KEYWORD2 NAME(SampleMaskSGIS)(GLclampf value, GLboolean invert) +/* ARB 3. GL_ARB_transpose_matrix */ +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble m[16]) { - DISPATCH(SampleMaskSGIS, (value, invert), (F, ";")); + DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixARB(%p);", m)); } -KEYWORD1 void KEYWORD2 NAME(SamplePatternSGIS)(GLenum pattern) +KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixfARB)(const GLfloat m[16]) { - DISPATCH(SamplePatternSGIS, (pattern), (F, ";")); + DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p)", m)); } - -/* 30. GL_EXT_vertex_array */ - -KEYWORD1 void KEYWORD2 NAME(VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixdARB)(const GLdouble m[16]) { - DISPATCH(VertexPointerEXT, (size, type, stride, count, ptr), (F, ";")); + DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixfARB(%p)", m)); } -KEYWORD1 void KEYWORD2 NAME(NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat m[16]) { - DISPATCH(NormalPointerEXT, (type, stride, count, ptr), (F, ";")); + DISPATCH(MultTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p)", m)); } -KEYWORD1 void KEYWORD2 NAME(ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +/* ARB 5. GL_ARB_multisample */ +KEYWORD1 void KEYWORD2 NAME(SampleCoverageARB)(GLclampf value, GLboolean invert) { - DISPATCH(ColorPointerEXT, (size, type, stride, count, ptr), (F, ";")); + DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);", value, invert)); } -KEYWORD1 void KEYWORD2 NAME(IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +KEYWORD1 void KEYWORD2 NAME(SamplePassARB)(GLenum pass) { - DISPATCH(IndexPointerEXT, (type, stride, count, ptr), (F, ";")); + DISPATCH(SamplePassARB, (pass), (F, "glSamplePassARB(0x%x);", pass)); } -KEYWORD1 void KEYWORD2 NAME(TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) +/* ARB 12. GL_ARB_texture_compression */ +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) { - DISPATCH(ColorPointerEXT, (size, type, stride, count, ptr), (F, ";")); + DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB();")); } -KEYWORD1 void KEYWORD2 NAME(EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean *ptr) +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) { - DISPATCH(EdgeFlagPointerEXT, (stride, count, ptr), (F, ";")); + DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB();")); } -KEYWORD1 void KEYWORD2 NAME(GetPointervEXT)(GLenum pname, void **params) +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) { - DISPATCH(GetPointerv, (pname, params), (F, ";")); + DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB();")); } -KEYWORD1 void KEYWORD2 NAME(ArrayElementEXT)(GLint i) +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) { - DISPATCH(ArrayElement, (i), (F, ";")); + DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB();")); } -KEYWORD1 void KEYWORD2 NAME(DrawArraysEXT)(GLenum mode, GLint first, GLsizei count) +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) { - DISPATCH(DrawArrays, (mode, first, count), (F, ";")); + DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB();")); } +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB();")); +} -/* 37. GL_EXT_blend_minmax */ -KEYWORD1 void KEYWORD2 NAME(BlendEquationEXT)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImageARB)(GLenum target, GLint lod, GLvoid *img) { - DISPATCH(BlendEquation, (mode), (F, "glBlendEquationEXT(0x%x);", mode)); + DISPATCH(GetCompressedTexImageARB, (target, lod, img), (F, "glGetCompressedTexImageARB();")); } -/* 52. GL_SGIX_sprite */ -KEYWORD1 void KEYWORD2 NAME(SpriteParameterfSGIX)(GLenum pname, GLfloat param) -{ - DISPATCH(SpriteParameterfSGIX, (pname, param), (F, ";")); -} -KEYWORD1 void KEYWORD2 NAME(SpriteParameterfvSGIX)(GLenum pname, const GLfloat *param) +/*** + *** Functions which are valid inside begin-end. These are optionally + *** generated according to 'DO_GEOMETRY'. + ***/ + + + +#ifdef DO_GEOMETRY + +KEYWORD1 void KEYWORD2 NAME(Begin)(GLenum mode) { - DISPATCH(SpriteParameterfvSGIX, (pname, param), (F, ";")); + DISPATCH(Begin, (mode), (F, "glBegin(0x%x);", mode)); } -KEYWORD1 void KEYWORD2 NAME(SpriteParameteriSGIX)(GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(CallList)(GLuint list) { - DISPATCH(SpriteParameteriSGIX, (pname, param), (F, ";")); + DISPATCH(CallList, (list), (F, "glCallList(%u);", list)); } -KEYWORD1 void KEYWORD2 NAME(SpriteParameterivSGIX)(GLenum pname, const GLint *param) +KEYWORD1 void KEYWORD2 NAME(CallLists)(GLsizei n, GLenum type, const GLvoid *lists) { - DISPATCH(SpriteParameterivSGIX, (pname, param), (F, ";")); + DISPATCH(CallLists, (n, type, lists), (F, "glCallLists(%d, 0x%x, %p);", n, type, lists)); } - - -/* 54. GL_EXT_point_parameters */ - -KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum target, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(Color3b)(GLbyte red, GLbyte green, GLbyte blue) { - DISPATCH(PointParameterfEXT, (target, param), (F, ";")); + DISPATCH(Color3b, (red, green, blue), (F, "glColor3b(%d, %d, %d);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum target, const GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(Color3d)(GLdouble red, GLdouble green, GLdouble blue) { - DISPATCH(PointParameterfvEXT, (target, param), (F, ";")); + DISPATCH(Color3d, (red, green, blue), (F, "glColor3d(%g, %g, %g);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(PointParameterfSGIS)(GLenum target, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(Color3f)(GLfloat red, GLfloat green, GLfloat blue) { - DISPATCH(PointParameterfEXT, (target, param), (F, ";")); + DISPATCH(Color3f, (red, green, blue), (F, "glColor3f(%g, %g, %g);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(PointParameterfvSGIS)(GLenum target, const GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(Color3i)(GLint red, GLint green, GLint blue) { - DISPATCH(PointParameterfvEXT, (target, param), (F, ";")); + DISPATCH(Color3i, (red, green, blue), (F, "glColor3i(%d, %d, %d);", red, green, blue)); } - - -/* 55. GL_SGIX_instruments */ -KEYWORD1 GLint KEYWORD2 NAME(GetInstrumentsSGIX)(void) +KEYWORD1 void KEYWORD2 NAME(Color3s)(GLshort red, GLshort green, GLshort blue) { - RETURN_DISPATCH(GetInstrumentsSGIX, (), (F, ";")); + DISPATCH(Color3s, (red, green, blue), (F, "glColor3s(%d, %d, %d);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(InstrumentsBufferSGIX)(GLsizei size, GLint *buf) +KEYWORD1 void KEYWORD2 NAME(Color3ub)(GLubyte red, GLubyte green, GLubyte blue) { - DISPATCH(InstrumentsBufferSGIX, (size, buf), (F, ";")); + DISPATCH(Color3ub, (red, green, blue), (F, "glColor3ub(%u, %u, %u);", red, green, blue)); } -KEYWORD1 GLint KEYWORD2 NAME(PollInstrumentsSGIX)(GLint *markerp) +KEYWORD1 void KEYWORD2 NAME(Color3ui)(GLuint red, GLuint green, GLuint blue) { - RETURN_DISPATCH(PollInstrumentsSGIX, (markerp), (F, ";")); + DISPATCH(Color3ui, (red, green, blue), (F, "glColor3ui(%u, %u, %u);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(ReadInstrumentsSGIX)(GLint marker) +KEYWORD1 void KEYWORD2 NAME(Color3us)(GLushort red, GLushort green, GLushort blue) { - DISPATCH(ReadInstrumentsSGIX, (marker), (F, ";")); + DISPATCH(Color3us, (red, green, blue), (F, "glColor3us(%u, %u, %u);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(StartInstrumentsSGIX)(void) +KEYWORD1 void KEYWORD2 NAME(Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) { - DISPATCH(StartInstrumentsSGIX, (), (F, ";")); + DISPATCH(Color4b, (red, green, blue, alpha), (F, "glColor4b(%d, %d, %d, %d);", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(StopInstrumentsSGIX)(GLint marker) +KEYWORD1 void KEYWORD2 NAME(Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) { - DISPATCH(StopInstrumentsSGIX, (marker), (F, ";")); + DISPATCH(Color4d, (red, green, blue, alpha), (F, "glColor4d(%g, %g, %g, %g);", red, green, blue, alpha)); } - - -/* 57. GL_SGIX_framezoom */ -KEYWORD1 void KEYWORD2 NAME(FrameZoomSGIX)(GLint factor) +KEYWORD1 void KEYWORD2 NAME(Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - DISPATCH(FrameZoomSGIX, (factor), (F, ";")); + DISPATCH(Color4f, (red, green, blue, alpha), (F, "glColor4b(%g, %g, %g, %g);", red, green, blue, alpha)); } - -/* 58. GL_SGIX_tag_sample_buffer */ -KEYWORD1 void KEYWORD2 NAME(TagSampleBufferSGIX)(void) +KEYWORD1 void KEYWORD2 NAME(Color4i)(GLint red, GLint green, GLint blue, GLint alpha) { - DISPATCH(TagSampleBufferSGIX, (), (F, ";")); + DISPATCH(Color4i, (red, green, blue, alpha), (F, "glColor4i(%d, %d, %d);", red, green, blue)); } - -/* 60. GL_SGIX_reference_plane */ -KEYWORD1 void KEYWORD2 NAME(ReferencePlaneSGIX)(const GLdouble *plane) +KEYWORD1 void KEYWORD2 NAME(Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha) { - DISPATCH(ReferencePlaneSGIX, (plane), (F, ";")); + DISPATCH(Color4s, (red, green, blue, alpha), (F, "glColor4s(%d, %d, %d, %d);", red, green, blue, alpha)); } - -/* 61. GL_SGIX_flush_raster */ -KEYWORD1 void KEYWORD2 NAME(FlushRasterSGIX)(void) +KEYWORD1 void KEYWORD2 NAME(Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { - DISPATCH(FlushRasterSGIX, (), (F, ";")); + DISPATCH(Color4ub, (red, green, blue, alpha), (F, "glColor4ub(%u, %u, %u, %u);", red, green, blue, alpha)); } - - -/* 66. GL_HP_image_transform */ -#if 0 -KEYWORD1 void KEYWORD2 NAME(GetImageTransformParameterfvHP)(GLenum target, GLenum pname, GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha) { - DISPATCH(GetImageTransformParameterfvHP, (target, pname, param), (F, ";")); + DISPATCH(Color4ui, (red, green, blue, alpha), (F, "glColor4ui(%u, %u, %u, %u);", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(GetImageTransformParameterivHP)(GLenum target, GLenum pname, GLint *param) +KEYWORD1 void KEYWORD2 NAME(Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha) { - DISPATCH(GetImageTransformParameterivHP, (target, pname, param), (F, ";")); + DISPATCH(Color4us, (red, green, blue, alpha), (F, "glColor4us(%u, %u, %u, %u);", red, green, blue, alpha)); } -KEYWORD1 void KEYWORD2 NAME(ImageTransformParameterfHP)(GLenum target, GLenum pname, const GLfloat param) +KEYWORD1 void KEYWORD2 NAME(Color3bv)(const GLbyte *v) { - DISPATCH(ImageTransformParameterfHP, (target, pname, param), (F, ";")); + DISPATCH(Color3bv, (v), (F, "glColor3bf(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(ImageTransformParameterfvHP)(GLenum target, GLenum pname, const GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(Color3dv)(const GLdouble *v) { - DISPATCH(ImageTransformParameterfvHP, (target, pname, param), (F, ";")); + DISPATCH(Color3dv, (v), (F, "glColor3dv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(ImageTransformParameteriHP)(GLenum target, GLenum pname, const GLint param) +KEYWORD1 void KEYWORD2 NAME(Color3fv)(const GLfloat *v) { - DISPATCH(ImageTransformParameteriHP, (target, pname, param), (F, ";")); + DISPATCH(Color3fv, (v), (F, "glColor3fv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(ImageTransformParameterivHP)(GLenum target, GLenum pname, const GLint *param) +KEYWORD1 void KEYWORD2 NAME(Color3iv)(const GLint *v) { - DISPATCH(ImageTransformParameterivHP, (target, pname, param), (F, ";")); + DISPATCH(Color3iv, (v), (F, "glColor3iv(%p);", v)); } -#endif - - -/* 74. GL_EXT_color_subtable */ -KEYWORD1 void KEYWORD2 NAME(ColorSubTableEXT)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data) +KEYWORD1 void KEYWORD2 NAME(Color3sv)(const GLshort *v) { - DISPATCH(ColorSubTable, (target, start, count, format, type, data), (F, ";")); + DISPATCH(Color3sv, (v), (F, "glColor3sv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(CopyColorSubTableEXT)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) +KEYWORD1 void KEYWORD2 NAME(Color3ubv)(const GLubyte *v) { - DISPATCH(CopyColorSubTable, (target, start, x, y, width), (F, ";")); + DISPATCH(Color3ubv, (v), (F, "glColor3ubv(%p);", v)); } - -/* 77. GL_PGI_misc_hints */ -KEYWORD1 void KEYWORD2 NAME(HintPGI)(GLenum target, GLint mode) +KEYWORD1 void KEYWORD2 NAME(Color3uiv)(const GLuint *v) { - DISPATCH(HintPGI, (target, mode), (F, ";")); + DISPATCH(Color3uiv, (v), (F, "glColor3uiv(%p);", v)); } - -/* 78. GL_EXT_paletted_texture */ - -KEYWORD1 void KEYWORD2 NAME(ColorTableEXT)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(Color3usv)(const GLushort *v) { - DISPATCH(ColorTable, (target, internalformat, width, format, type, table), (F, ";")); + DISPATCH(Color3usv, (v), (F, "glColor3usv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid *table) +KEYWORD1 void KEYWORD2 NAME(Color4bv)(const GLbyte *v) { - DISPATCH(GetColorTableEXT, (target, format, type, table), (F, ";")); + DISPATCH(Color4bv, (v), (F, "glColor3bv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(Color4dv)(const GLdouble *v) { - DISPATCH(GetColorTableParameterfvEXT, (target, pname, params), (F, ";")); + DISPATCH(Color4dv, (v), (F, "glColor4dv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint *params) +KEYWORD1 void KEYWORD2 NAME(Color4fv)(const GLfloat *v) { - DISPATCH(GetColorTableParameterivEXT, (target, pname, params), (F, ";")); + DISPATCH(Color4fv, (v), (F, "glColor4fv(%p);", v)); } - - -/* 80. GL_SGIX_list_priority */ - -KEYWORD1 void KEYWORD2 NAME(GetListParameterfvSGIX)(GLuint list, GLenum name, GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(Color4iv)(const GLint *v) { - DISPATCH(GetListParameterfvSGIX, (list, name, param), (F, ";")); + DISPATCH(Color4iv, (v), (F, "glColor4iv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(GetListParameterivSGIX)(GLuint list, GLenum name, GLint *param) +KEYWORD1 void KEYWORD2 NAME(Color4sv)(const GLshort *v) { - DISPATCH(GetListParameterivSGIX, (list, name, param), (F, ";")); + DISPATCH(Color4sv, (v), (F, "glColor4sv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(ListParameterfSGIX)(GLuint list, GLenum name, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(Color4ubv)(const GLubyte *v) { - DISPATCH(ListParameterfSGIX, (list, name, param), (F, ";")); + DISPATCH(Color4ubv, (v), (F, "glColor4ubv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(ListParameterfvSGIX)(GLuint list, GLenum name, const GLfloat *param) +KEYWORD1 void KEYWORD2 NAME(Color4uiv)(const GLuint *v) { - DISPATCH(ListParameterfvSGIX, (list, name, param), (F, ";")); + DISPATCH(Color4uiv, (v), (F, "glColor4uiv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(ListParameteriSGIX)(GLuint list, GLenum name, GLint param) +KEYWORD1 void KEYWORD2 NAME(Color4usv)(const GLushort *v) { - DISPATCH(ListParameteriSGIX, (list, name, param), (F, ";")); + DISPATCH(Color4usv, (v), (F, "glColor4usv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(ListParameterivSGIX)(GLuint list, GLenum name, const GLint *param) +KEYWORD1 void KEYWORD2 NAME(End)(void) { - DISPATCH(ListParameterivSGIX, (list, name, param), (F, ";")); + DISPATCH(End, (), (F, "glEnd();")); } - - -/* 94. GL_EXT_index_material */ -KEYWORD1 void KEYWORD2 NAME(IndexMaterialEXT)(GLenum face, GLenum mode) +KEYWORD1 void KEYWORD2 NAME(EvalCoord1d)(GLdouble u) { - DISPATCH(IndexMaterialEXT, (face, mode), (F, ";")); + DISPATCH(EvalCoord1d, (u), (F, "glEvalCoord1d(%g);", u)); } - -/* 95. GL_EXT_index_func */ -KEYWORD1 void KEYWORD2 NAME(IndexFuncEXT)(GLenum func, GLfloat ref) +KEYWORD1 void KEYWORD2 NAME(EvalCoord1f)(GLfloat u) { - DISPATCH(IndexFuncEXT, (func, ref), (F, ";")); + DISPATCH(EvalCoord1f, (u), (F, ";")); } - - -/* 97. GL_EXT_compiled_vertex_array */ -KEYWORD1 void KEYWORD2 NAME(LockArraysEXT)(GLint first, GLsizei count) +KEYWORD1 void KEYWORD2 NAME(EvalCoord1dv)(const GLdouble *u) { - DISPATCH(LockArraysEXT, (first, count), (F, ";")); + DISPATCH(EvalCoord1dv, (u), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) +KEYWORD1 void KEYWORD2 NAME(EvalCoord1fv)(const GLfloat *u) { - DISPATCH(UnlockArraysEXT, (), (F, ";")); + DISPATCH(EvalCoord1fv, (u), (F, ";")); } - -/* 98. GL_EXT_cull_vertex */ -KEYWORD1 void KEYWORD2 NAME(CullParameterfvEXT)(GLenum pname, GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(EvalCoord2d)(GLdouble u, GLdouble v) { - DISPATCH(CullParameterfvEXT, (pname, params), (F, ";")); + DISPATCH(EvalCoord2d, (u, v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(CullParameterdvEXT)(GLenum pname, GLdouble *params) +KEYWORD1 void KEYWORD2 NAME(EvalCoord2f)(GLfloat u, GLfloat v) { - DISPATCH(CullParameterdvEXT, (pname, params), (F, ";")); + DISPATCH(EvalCoord2f, (u, v), (F, ";")); } - - -/* 102. GL_SGIX_fragment_lighting */ -KEYWORD1 void KEYWORD2 NAME(FragmentColorMaterialSGIX)(GLenum face, GLenum mode) +KEYWORD1 void KEYWORD2 NAME(EvalCoord2dv)(const GLdouble *u) { - DISPATCH(FragmentColorMaterialSGIX, (face, mode), (F, ";")); + DISPATCH(EvalCoord2dv, (u), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightfSGIX)(GLenum light, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(EvalCoord2fv)(const GLfloat *u) { - DISPATCH(FragmentLightfSGIX, (light, pname, param), (F, ";")); + DISPATCH(EvalCoord2fv, (u), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightfvSGIX)(GLenum light, GLenum pname, const GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(EvalPoint1)(GLint i) { - DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, ";")); + DISPATCH(EvalPoint1, (i), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightiSGIX)(GLenum light, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(EvalPoint2)(GLint i, GLint j) { - DISPATCH(FragmentLightiSGIX, (light, pname, param), (F, ";")); + DISPATCH(EvalPoint2, (i, j), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightivSGIX)(GLenum light, GLenum pname, const GLint * params) +KEYWORD1 void KEYWORD2 NAME(EdgeFlag)(GLboolean flag) { - DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, ";")); + DISPATCH(EdgeFlag, (flag), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfSGIX)(GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(EdgeFlagv)(const GLboolean *flag) { - DISPATCH(FragmentLightModelfSGIX, (pname, param), (F, ";")); + DISPATCH(EdgeFlagv, (flag), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightModelfvSGIX)(GLenum pname, const GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(Indexd)(GLdouble c) { - DISPATCH(FragmentLightModelfvSGIX, (pname, params), (F, ";")); + DISPATCH(Indexd, (c), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightModeliSGIX)(GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(Indexdv)(const GLdouble *c) { - DISPATCH(FragmentLightModeliSGIX, (pname, param), (F, ";")); + DISPATCH(Indexdv, (c), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentLightModelivSGIX)(GLenum pname, const GLint * params) +KEYWORD1 void KEYWORD2 NAME(Indexf)(GLfloat c) { - DISPATCH(FragmentLightModelivSGIX, (pname, params), (F, ";")); + DISPATCH(Indexf, (c), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfSGIX)(GLenum face, GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(Indexfv)(const GLfloat *c) { - DISPATCH(FragmentMaterialfSGIX, (face, pname, param), (F, ";")); + DISPATCH(Indexfv, (c), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentMaterialfvSGIX)(GLenum face, GLenum pname, const GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(Indexi)(GLint c) { - DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, ";")); + DISPATCH(Indexi, (c), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentMaterialiSGIX)(GLenum face, GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(Indexiv)(const GLint *c) { - DISPATCH(FragmentMaterialiSGIX, (face, pname, param), (F, ";")); + DISPATCH(Indexiv, (c), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FragmentMaterialivSGIX)(GLenum face, GLenum pname, const GLint * params) +KEYWORD1 void KEYWORD2 NAME(Indexs)(GLshort c) { - DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, ";")); + DISPATCH(Indexs, (c), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetFragmentLightfvSGIX)(GLenum light, GLenum pname, GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(Indexsv)(const GLshort *c) { - DISPATCH(FragmentLightfvSGIX, (light, pname, params), (F, ";")); + DISPATCH(Indexsv, (c), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetFragmentLightivSGIX)(GLenum light, GLenum pname, GLint * params) +KEYWORD1 void KEYWORD2 NAME(Materialf)(GLenum face, GLenum pname, GLfloat param) { - DISPATCH(FragmentLightivSGIX, (light, pname, params), (F, ";")); + DISPATCH(Materialf, (face, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialfvSGIX)(GLenum face, GLenum pname, GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(Materiali)(GLenum face, GLenum pname, GLint param) { - DISPATCH(FragmentMaterialfvSGIX, (face, pname, params), (F, ";")); + DISPATCH(Materiali, (face, pname, param), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetFragmentMaterialivSGIX)(GLenum face, GLenum pname, GLint * params) +KEYWORD1 void KEYWORD2 NAME(Materialfv)(GLenum face, GLenum pname, const GLfloat *params) { - DISPATCH(FragmentMaterialivSGIX, (face, pname, params), (F, ";")); + DISPATCH(Materialfv, (face, pname, params), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(Materialiv)(GLenum face, GLenum pname, const GLint *params) { - DISPATCH(LightEnviSGIX, (pname, param), (F, ";")); + DISPATCH(Materialiv, (face, pname, params), (F, ";")); } - -/* 112. GL_EXT_draw_range_elements */ -KEYWORD1 void KEYWORD2 NAME(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) +KEYWORD1 void KEYWORD2 NAME(Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz) { - DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElementsEXT(0x%x, %u %u %d 0x%x %p);", mode, start, end, count, type, indices)); + DISPATCH(Normal3b, (nx, ny, nz), (F, "glNormal3b(%d, %d, %d);", nx, ny, nz)); } - -/* 117. GL_EXT_light_texture */ -#if 00 -KEYWORD1 void KEYWORD2 NAME(ApplyTextureEXT)(GLenum mode) +KEYWORD1 void KEYWORD2 NAME(Normal3bv)(const GLbyte *v) { - DISPATCH(ApplyTextureEXT, (mode), (F, "glApplyTextureEXT(0x%x);", mode)); + DISPATCH(Normal3bv, (v), (F, "glNormal3bv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(TextureLightEXT)(GLenum pname) +KEYWORD1 void KEYWORD2 NAME(Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz) { - DISPATCH(TextureLightEXT, (pname), (F, "glTextureLightEXT(0x%x);", pname)); + DISPATCH(Normal3d, (nx, ny, nz), (F, "glNormal3d(%f, %f, %f);", nx, ny, nz)); } -KEYWORD1 void KEYWORD2 NAME(TextureMaterialEXT)(GLenum face, GLenum mode) +KEYWORD1 void KEYWORD2 NAME(Normal3dv)(const GLdouble *v) { - DISPATCH(TextureMaterialEXT, (face, mode), (F, "glTextureMaterialEXT(0x%x, 0x%x);", face, mode)); + DISPATCH(Normal3dv, (v), (F, "glNormal3dv(%p);", v)); } -#endif - - -/* 135. GL_INTEL_texture_scissor */ -#if 00 -KEYWORD1 void KEYWORD2 NAME(TexScissorINTEL)(GLenum target, GLclampf tlow, GLclampf thigh) +KEYWORD1 void KEYWORD2 NAME(Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz) { - DISPATCH(TexScissorINTEL, (target, tlow, thigh), (F, "glTexScissorINTEL(0x%x %g %g);", target, tlow, thigh)); + DISPATCH(Normal3f, (nx, ny, nz), (F, "glNormal3f(%g, %g, %g);", nx, ny, nz)); } -KEYWORD1 void KEYWORD2 NAME(TexScissorFuncINTEL)(GLenum target, GLenum lfunc, GLenum hfunc) +KEYWORD1 void KEYWORD2 NAME(Normal3fv)(const GLfloat *v) { - DISPATCH(TexScissorFuncINTEL, (target, lfunc, hfunc), (F, "glTexScissorFuncINTEL(0x%x 0x%x 0x%x);", target, tlow, thigh)); + DISPATCH(Normal3fv, (v), (F, "glNormal3fv(%p);", v)); } -#endif - - -/* 136. GL_INTEL_parallel_arrays */ -#if 00 -KEYWORD1 void KEYWORD2 NAME(VertexPointervINTEL)(GLint size, GLenum type, const void ** pointer) +KEYWORD1 void KEYWORD2 NAME(Normal3i)(GLint nx, GLint ny, GLint nz) { - DISPATCH(VertexPointervINTEL, (size, type, pointer), (F, "glVertexPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); + DISPATCH(Normal3i, (nx, ny, nz), (F, "glNormal3i(%d, %d, %d);", nx, ny, nz)); } -KEYWORD1 void KEYWORD2 NAME(NormalPointervINTEL)(GLenum type, const void** pointer) +KEYWORD1 void KEYWORD2 NAME(Normal3iv)(const GLint *v) { - DISPATCH(NormalPointervINTEL, (size, pointer), (F, "glNormalPointervINTEL(%d, %p);", size, pointer)); + DISPATCH(Normal3iv, (v), (F, "glNormal3iv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(ColorPointervINTEL)(GLint size, GLenum type, const void** pointer) +KEYWORD1 void KEYWORD2 NAME(Normal3s)(GLshort nx, GLshort ny, GLshort nz) { - DISPATCH(ColorPointervINTEL, (size, type, pointer), (F, "glColorPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); + DISPATCH(Normal3s, (nx, ny, nz), (F, "glNormal3s(%d, %d, %d);", nx, ny, nz)); } -KEYWORD1 void KEYWORD2 NAME(TexCoordPointervINTEL)(GLint size, GLenum type, const void** pointer) +KEYWORD1 void KEYWORD2 NAME(Normal3sv)(const GLshort *v) { - DISPATCH(TexCoordPointervINTEL, (size, type, pointer), (F, "glTexCoordPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); + DISPATCH(Normal3sv, (v), (F, "glNormal3sv(%p);", v)); } -#endif - -/* 138. GL_EXT_pixel_transform */ -#if 0 -KEYWORD1 void KEYWORD2 NAME(PixelTransformParameteriEXT)(GLenum target, GLenum pname, const GLint param) +KEYWORD1 void KEYWORD2 NAME(TexCoord1d)(GLdouble s) { - DISPATCH(PixelTransformParameteriEXT, (target, pname, param), (F, "glPixelTransformParameteriEXT(0x%x, 0x%x, %d);", target, pname, param)); + DISPATCH(TexCoord1d, (s), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfEXT)(GLenum target, GLenum pname, const GLfloat param) +KEYWORD1 void KEYWORD2 NAME(TexCoord1f)(GLfloat s) { - DISPATCH(PixelTransformParameterfEXT, (target, pname, param), (F, "glPixelTransformParameterfEXT(0x%x, 0x%x, %f);", target, pname, param)); + DISPATCH(TexCoord1f, (s), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord1i)(GLint s) { - DISPATCH(PixelTransformParameterivEXT, (target, pname, params), (F, "glPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); + DISPATCH(TexCoord1i, (s), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord1s)(GLshort s) { - DISPATCH(PixelTransformParameterfvEXT, (target, pname, params), (F, "glPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); + DISPATCH(TexCoord1s, (s), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord2d)(GLdouble s, GLdouble t) { - DISPATCH(GetPixelTransformParameterivEXT, (target, pname, params), (F, "glGetPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); + DISPATCH(TexCoord2d, (s, t), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +KEYWORD1 void KEYWORD2 NAME(TexCoord2f)(GLfloat s, GLfloat t) { - DISPATCH(GetPixelTransformParameterfvEXT, (target, pname, params), (F, "glGetPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); + DISPATCH(TexCoord2f, (s, t), (F, ";")); } -#endif - - -/* 145. GL_EXT_secondary_color */ -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue) +KEYWORD1 void KEYWORD2 NAME(TexCoord2s)(GLshort s, GLshort t) { - DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3bEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(TexCoord2s, (s, t), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bvEXT)(const GLbyte *v) +KEYWORD1 void KEYWORD2 NAME(TexCoord2i)(GLint s, GLint t) { - DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bvEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(TexCoord2i, (s, t), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue) +KEYWORD1 void KEYWORD2 NAME(TexCoord3d)(GLdouble s, GLdouble t, GLdouble r) { - DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3dEXT(%g, %g, %g);", red, green, blue)); + DISPATCH(TexCoord3d, (s, t, r), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dvEXT)(const GLdouble * v) +KEYWORD1 void KEYWORD2 NAME(TexCoord3f)(GLfloat s, GLfloat t, GLfloat r) { - DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dvEXT(%g, %g, %g);", v[0], v[1], v[2])); + DISPATCH(TexCoord3f, (s, t, r), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue) +KEYWORD1 void KEYWORD2 NAME(TexCoord3i)(GLint s, GLint t, GLint r) { - DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3fEXT(%g, %g, %g);", red, green, blue)); + DISPATCH(TexCoord3i, (s, t, r), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fvEXT)(const GLfloat * v) +KEYWORD1 void KEYWORD2 NAME(TexCoord3s)(GLshort s, GLshort t, GLshort r) { - DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fvEXT(%g, %g, %g);", v[0], v[1], v[2])); + DISPATCH(TexCoord3s, (s, t, r), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iEXT)(GLint red, GLint green, GLint blue) +KEYWORD1 void KEYWORD2 NAME(TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q) { - DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3iEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(TexCoord4d, (s, t, r, q), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ivEXT)(const GLint * v) +KEYWORD1 void KEYWORD2 NAME(TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q) { - DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3ivEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(TexCoord4f, (s, t, r, q), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue) +KEYWORD1 void KEYWORD2 NAME(TexCoord4i)(GLint s, GLint t, GLint r, GLint q) { - DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3sEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(TexCoord4i, (s, t, r, q), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3svEXT)(const GLshort * v) +KEYWORD1 void KEYWORD2 NAME(TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q) { - DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3svEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(TexCoord4s, (s, t, r, q), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue) +KEYWORD1 void KEYWORD2 NAME(TexCoord1dv)(const GLdouble *v) { - DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ubEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(TexCoord1dv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubvEXT)(const GLubyte * v) +KEYWORD1 void KEYWORD2 NAME(TexCoord1fv)(const GLfloat *v) { - DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubvEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(TexCoord1fv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue) +KEYWORD1 void KEYWORD2 NAME(TexCoord1iv)(const GLint *v) { - DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3uiEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(TexCoord1iv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uivEXT)(const GLuint * v) +KEYWORD1 void KEYWORD2 NAME(TexCoord1sv)(const GLshort *v) { - DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uivEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(TexCoord1sv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue) +KEYWORD1 void KEYWORD2 NAME(TexCoord2dv)(const GLdouble *v) { - DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3usEXT(%d, %d, %d);", red, green, blue)); + DISPATCH(TexCoord2dv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usvEXT)(const GLushort * v) +KEYWORD1 void KEYWORD2 NAME(TexCoord2fv)(const GLfloat *v) { - DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usvEXT(%d, %d, %d);", v[0], v[1], v[2])); + DISPATCH(TexCoord2fv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLvoid * pointer) +KEYWORD1 void KEYWORD2 NAME(TexCoord2iv)(const GLint *v) { - DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointerEXT(%d, 0x%x, %d, %p);", size, type, stride, pointer)); + DISPATCH(TexCoord2iv, (v), (F, ";")); } - - -/* 149. GL_EXT_fog_coord */ -KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord) +KEYWORD1 void KEYWORD2 NAME(TexCoord2sv)(const GLshort *v) { - DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordfEXT(%g);", coord)); + DISPATCH(TexCoord2sv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord) +KEYWORD1 void KEYWORD2 NAME(TexCoord3dv)(const GLdouble *v) { - DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);", coord)); + DISPATCH(TexCoord3dv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FogCoorddEXT)(GLdouble coord) +KEYWORD1 void KEYWORD2 NAME(TexCoord3fv)(const GLfloat *v) { - DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoorddEXT(%g);", coord)); + DISPATCH(TexCoord3fv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FogCoorddvEXT)(const GLdouble * coord) +KEYWORD1 void KEYWORD2 NAME(TexCoord3iv)(const GLint *v) { - DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddvEXT(%p);", coord)); + DISPATCH(TexCoord3iv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer) +KEYWORD1 void KEYWORD2 NAME(TexCoord3sv)(const GLshort *v) { - DISPATCH(FogCoordPointerEXT, (type, stride, pointer), (F, "glFogCoordPointerEXT(0x%x, %d, %p);", type, stride, pointer)); + DISPATCH(TexCoord3sv, (v), (F, ";")); } - - -/* 173. GL_EXT/INGR_blend_func_separate */ -KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +KEYWORD1 void KEYWORD2 NAME(TexCoord4dv)(const GLdouble *v) { - DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, ";")); + DISPATCH(TexCoord4dv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateINGR)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +KEYWORD1 void KEYWORD2 NAME(TexCoord4fv)(const GLfloat *v) { - DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, ";")); + DISPATCH(TexCoord4fv, (v), (F, ";")); } - - -/* 190. GL_NV_vertex_array_range */ -KEYWORD1 void KEYWORD2 NAME(FlushVertexArrayRangeNV)(void) + +KEYWORD1 void KEYWORD2 NAME(TexCoord4iv)(const GLint *v) { - DISPATCH(FlushVertexArrayRangeNV, (), (F, ";")); + DISPATCH(TexCoord4iv, (v), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(VertexArrayRangeNV)(GLsizei size, const GLvoid * pointer) +KEYWORD1 void KEYWORD2 NAME(TexCoord4sv)(const GLshort *v) { - DISPATCH(VertexArrayRangeNV, (size, pointer), (F, ";")); + DISPATCH(TexCoord4sv, (v), (F, ";")); } +KEYWORD1 void KEYWORD2 NAME(Vertex2d)(GLdouble x, GLdouble y) +{ + DISPATCH(Vertex2d, (x, y), (F, "glVertex2d(%f, %f);", x, y)); +} -/* 191. GL_NV_register_combiners */ -KEYWORD1 void KEYWORD2 NAME(CombinerParameterfvNV)(GLenum pname, const GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(Vertex2dv)(const GLdouble *v) { - DISPATCH(CombinerParameterfvNV, (pname, params), (F, ";")); + DISPATCH(Vertex2dv, (v), (F, "glVertex2dv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(CombinerParameterfNV)(GLenum pname, GLfloat param) +KEYWORD1 void KEYWORD2 NAME(Vertex2f)(GLfloat x, GLfloat y) { - DISPATCH(CombinerParameterfNV, (pname, param), (F, ";")); + DISPATCH(Vertex2f, (x, y), (F, "glVertex2f(%g, %g);", x, y)); } -KEYWORD1 void KEYWORD2 NAME(CombinerParameterivNV)(GLenum pname, const GLint * params) +KEYWORD1 void KEYWORD2 NAME(Vertex2fv)(const GLfloat *v) { - DISPATCH(CombinerParameterivNV, (pname, params), (F, ";")); + DISPATCH(Vertex2fv, (v), (F, "glVertex2fv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(CombinerParameteriNV)(GLenum pname, GLint param) +KEYWORD1 void KEYWORD2 NAME(Vertex2i)(GLint x, GLint y) { - DISPATCH(CombinerParameteriNV, (pname, param), (F, ";")); + DISPATCH(Vertex2i, (x, y), (F, "glVertex2i(%d, %d);", x, y)); } -KEYWORD1 void KEYWORD2 NAME(CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) +KEYWORD1 void KEYWORD2 NAME(Vertex2iv)(const GLint *v) { - DISPATCH(CombinerInputNV, (stage, portion, variable, input, mapping, componentUsage), (F, ";")); + DISPATCH(Vertex2iv, (v), (F, "glVertex2iv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum) +KEYWORD1 void KEYWORD2 NAME(Vertex2s)(GLshort x, GLshort y) { - DISPATCH(CombinerOutputNV, (stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum), (F, ";")); + DISPATCH(Vertex2s, (x, y), (F, "glVertex2s(%d, %d);", x, y)); } -KEYWORD1 void KEYWORD2 NAME(FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage) +KEYWORD1 void KEYWORD2 NAME(Vertex2sv)(const GLshort *v) { - DISPATCH(FinalCombinerInputNV, (variable, input, mapping, componentUsage), (F, ";")); + DISPATCH(Vertex2sv, (v), (F, "glVertex2sv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(Vertex3d)(GLdouble x, GLdouble y, GLdouble z) { - DISPATCH(GetCombinerInputParameterfvNV, (stage, portion, variable, pname, params), (F, ";")); + DISPATCH(Vertex3d, (x, y, z), (F, "glVertex3d(%f, %f, %f);", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params) +KEYWORD1 void KEYWORD2 NAME(Vertex3dv)(const GLdouble *v) { - DISPATCH(GetCombinerInputParameterivNV, (stage, portion, variable, pname, params), (F, ";")); + DISPATCH(Vertex3dv, (v), (F, "glVertex3dv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(Vertex3f)(GLfloat x, GLfloat y, GLfloat z) { - DISPATCH(GetCombinerOutputParameterfvNV, (stage, portion, pname, params), (F, ";")); + DISPATCH(Vertex3f, (x, y, z), (F, "glVertex3f(%g, %g, %g);", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params) +KEYWORD1 void KEYWORD2 NAME(Vertex3fv)(const GLfloat *v) { - DISPATCH(GetCombinerOutputParameterivNV, (stage, portion, pname, params), (F, ";")); + DISPATCH(Vertex3fv, (v), (F, "glVertex3fv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params) +KEYWORD1 void KEYWORD2 NAME(Vertex3i)(GLint x, GLint y, GLint z) { -DISPATCH(GetFinalCombinerInputParameterfvNV, (variable, pname, params), (F, ";")); + DISPATCH(Vertex3i, (x, y, z), (F, "glVertex3i(%d, %d, %d);", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params) +KEYWORD1 void KEYWORD2 NAME(Vertex3iv)(const GLint *v) { -DISPATCH(GetFinalCombinerInputParameterivNV, (variable, pname, params), (F, ";")); + DISPATCH(Vertex3iv, (v), (F, "glVertex3iv(%p);", v)); } - - -/* 194. GL_EXT_vertex_weighting */ -KEYWORD1 void KEYWORD2 NAME(VertexWeightfEXT)(GLfloat weight) +KEYWORD1 void KEYWORD2 NAME(Vertex3s)(GLshort x, GLshort y, GLshort z) { - DISPATCH(VertexWeightfEXT, (weight), (F, ";")); + DISPATCH(Vertex3s, (x, y, z), (F, "glVertex3s(%d, %d, %d);", x, y, z)); } -KEYWORD1 void KEYWORD2 NAME(VertexWeightfvEXT)(const GLfloat * weight) +KEYWORD1 void KEYWORD2 NAME(Vertex3sv)(const GLshort *v) { - DISPATCH(VertexWeightfvEXT, (weight), (F, ";")); + DISPATCH(Vertex3sv, (v), (F, "glVertex3sv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(VertexWeightPointerEXT)(GLsizei size, GLenum type, GLsizei stride, const GLvoid * pointer) +KEYWORD1 void KEYWORD2 NAME(Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { - DISPATCH(VertexWeightPointerEXT, (size, type, stride, pointer), (F, ";")); + DISPATCH(Vertex4d, (x, y, z, w), (F, "glVertex4d(%f, %f, %f, %f);", x, y, z, w)); } - - -/* 196. GL_MESA_resize_buffers */ -KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void) +KEYWORD1 void KEYWORD2 NAME(Vertex4dv)(const GLdouble *v) { - DISPATCH(ResizeBuffersMESA, (), (F, "glResizeBuffersMESA();")); + DISPATCH(Vertex4dv, (v), (F, "glVertex4dv(%p);", v)); } - - -/* 197. GL_MESA_window_pos */ -KEYWORD1 void KEYWORD2 NAME(WindowPos2iMESA)(GLint x, GLint y) +KEYWORD1 void KEYWORD2 NAME(Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - DISPATCH(WindowPos2iMESA, (x, y), (F, ";")); + DISPATCH(Vertex4f, (x, y, z, w), (F, "glVertex4f(%f, %f, %f, %f);", x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2sMESA)(GLshort x, GLshort y) +KEYWORD1 void KEYWORD2 NAME(Vertex4fv)(const GLfloat *v) { - DISPATCH(WindowPos2sMESA, (x, y), (F, ";")); + DISPATCH(Vertex4fv, (v), (F, "glVertex4fv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2fMESA)(GLfloat x, GLfloat y) +KEYWORD1 void KEYWORD2 NAME(Vertex4i)(GLint x, GLint y, GLint z, GLint w) { - DISPATCH(WindowPos2fMESA, (x, y), (F, ";")); + DISPATCH(Vertex4i, (x, y, z, w), (F, "glVertex4i(%d, %d, %d, %d);", x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2dMESA)(GLdouble x, GLdouble y) +KEYWORD1 void KEYWORD2 NAME(Vertex4iv)(const GLint *v) { - DISPATCH(WindowPos2dMESA, (x, y), (F, ";")); + DISPATCH(Vertex4iv, (v), (F, "glVertex4iv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2ivMESA)(const GLint *p) +KEYWORD1 void KEYWORD2 NAME(Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w) { - DISPATCH(WindowPos2ivMESA, (p), (F, ";")); + DISPATCH(Vertex4s, (x, y, z, w), (F, "glVertex4s(%d, %d, %d, %d);", x, y, z, w)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2svMESA)(const GLshort *p) +KEYWORD1 void KEYWORD2 NAME(Vertex4sv)(const GLshort *v) { - DISPATCH(WindowPos2svMESA, (p), (F, ";")); + DISPATCH(Vertex4sv, (v), (F, "glVertex4sv(%p);", v)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2fvMESA)(const GLfloat *p) +KEYWORD1 void KEYWORD2 NAME(Indexub)(GLubyte c) { - DISPATCH(WindowPos2fvMESA, (p), (F, ";")); + DISPATCH(Indexub, (c), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(WindowPos2dvMESA)(const GLdouble *p) +KEYWORD1 void KEYWORD2 NAME(Indexubv)(const GLubyte *c) { - DISPATCH(WindowPos2dvMESA, (p), (F, ";")); + DISPATCH(Indexubv, (c), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3iMESA)(GLint x, GLint y, GLint z) +KEYWORD1 void KEYWORD2 NAME(ArrayElementEXT)(GLint i) { - DISPATCH(WindowPos3iMESA, (x, y, z), (F, ";")); + DISPATCH(ArrayElement, (i), (F, ";")); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3sMESA)(GLshort x, GLshort y, GLshort z) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue) { - DISPATCH(WindowPos3sMESA, (x, y, z), (F, ";")); + DISPATCH(SecondaryColor3bEXT, (red, green, blue), (F, "glSecondaryColor3bEXT(%d, %d, %d);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3bvEXT)(const GLbyte *v) { - DISPATCH(WindowPos3fMESA, (x, y, z), (F, ";")); + DISPATCH(SecondaryColor3bvEXT, (v), (F, "glSecondaryColor3bvEXT(%d, %d, %d);", v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue) { - DISPATCH(WindowPos3dMESA, (x, y, z), (F, ";")); + DISPATCH(SecondaryColor3dEXT, (red, green, blue), (F, "glSecondaryColor3dEXT(%g, %g, %g);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3ivMESA)(const GLint *p) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3dvEXT)(const GLdouble * v) { - DISPATCH(WindowPos3ivMESA, (p), (F, ";")); + DISPATCH(SecondaryColor3dvEXT, (v), (F, "glSecondaryColor3dvEXT(%g, %g, %g);", v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3svMESA)(const GLshort *p) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue) { - DISPATCH(WindowPos3svMESA, (p), (F, ";")); + DISPATCH(SecondaryColor3fEXT, (red, green, blue), (F, "glSecondaryColor3fEXT(%g, %g, %g);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3fvMESA)(const GLfloat *p) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3fvEXT)(const GLfloat * v) { - DISPATCH(WindowPos3fvMESA, (p), (F, ";")); + DISPATCH(SecondaryColor3fvEXT, (v), (F, "glSecondaryColor3fvEXT(%g, %g, %g);", v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(WindowPos3dvMESA)(const GLdouble *p) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3iEXT)(GLint red, GLint green, GLint blue) { - DISPATCH(WindowPos3dvMESA, (p), (F, ";")); + DISPATCH(SecondaryColor3iEXT, (red, green, blue), (F, "glSecondaryColor3iEXT(%d, %d, %d);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ivEXT)(const GLint * v) { - DISPATCH(WindowPos4iMESA, (x, y, z, w), (F, ";")); + DISPATCH(SecondaryColor3ivEXT, (v), (F, "glSecondaryColor3ivEXT(%d, %d, %d);", v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue) { - DISPATCH(WindowPos4sMESA, (x, y, z, w), (F, ";")); + DISPATCH(SecondaryColor3sEXT, (red, green, blue), (F, "glSecondaryColor3sEXT(%d, %d, %d);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3svEXT)(const GLshort * v) { - DISPATCH(WindowPos4fMESA, (x, y, z, w), (F, ";")); + DISPATCH(SecondaryColor3svEXT, (v), (F, "glSecondaryColor3svEXT(%d, %d, %d);", v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue) { - DISPATCH(WindowPos4dMESA, (x, y, z, w), (F, ";")); + DISPATCH(SecondaryColor3ubEXT, (red, green, blue), (F, "glSecondaryColor3ubEXT(%d, %d, %d);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4ivMESA)(const GLint *p) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3ubvEXT)(const GLubyte * v) { - DISPATCH(WindowPos4ivMESA, (p), (F, ";")); + DISPATCH(SecondaryColor3ubvEXT, (v), (F, "glSecondaryColor3ubvEXT(%d, %d, %d);", v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort *p) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue) { - DISPATCH(WindowPos4svMESA, (p), (F, ";")); + DISPATCH(SecondaryColor3uiEXT, (red, green, blue), (F, "glSecondaryColor3uiEXT(%d, %d, %d);", red, green, blue)); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4fvMESA)(const GLfloat *p) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3uivEXT)(const GLuint * v) { - DISPATCH(WindowPos4fvMESA, (p), (F, ";")); + DISPATCH(SecondaryColor3uivEXT, (v), (F, "glSecondaryColor3uivEXT(%d, %d, %d);", v[0], v[1], v[2])); } -KEYWORD1 void KEYWORD2 NAME(WindowPos4dvMESA)(const GLdouble *p) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue) { - DISPATCH(WindowPos4dvMESA, (p), (F, ";")); + DISPATCH(SecondaryColor3usEXT, (red, green, blue), (F, "glSecondaryColor3usEXT(%d, %d, %d);", red, green, blue)); } - -/* 208. GL_3DFX_tbuffer */ -KEYWORD1 void KEYWORD2 NAME(TbufferMask3DFX)(GLuint mask) +KEYWORD1 void KEYWORD2 NAME(SecondaryColor3usvEXT)(const GLushort * v) { - DISPATCH(TbufferMask3DFX, (mask), (F, "glTbufferMask3DFX(0x%x);", mask)); + DISPATCH(SecondaryColor3usvEXT, (v), (F, "glSecondaryColor3usvEXT(%d, %d, %d);", v[0], v[1], v[2])); } - -/* 209. WGL_EXT_multisample */ - -KEYWORD1 void KEYWORD2 NAME(SampleMaskEXT)(GLclampf value, GLboolean invert) +KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord) { - DISPATCH(SampleMaskSGIS, (value, invert), (F, ";")); + DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordfEXT(%g);", coord)); } -KEYWORD1 void KEYWORD2 NAME(SamplePatternEXT)(GLenum pattern) +KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord) { - DISPATCH(SamplePatternSGIS, (pattern), (F, ";")); + DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);", coord)); } - -/* ARB 1. GL_ARB_multitexture */ - -KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) +KEYWORD1 void KEYWORD2 NAME(FogCoorddEXT)(GLdouble coord) { - DISPATCH(ActiveTextureARB, (texture), (F, ";")); + DISPATCH(FogCoorddEXT, (coord), (F, "glFogCoorddEXT(%g);", coord)); } -KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) +KEYWORD1 void KEYWORD2 NAME(FogCoorddvEXT)(const GLdouble * coord) { - DISPATCH(ClientActiveTextureARB, (texture), (F, ";")); + DISPATCH(FogCoorddvEXT, (coord), (F, "glFogCoorddvEXT(%p);", coord)); } KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s) @@ -3418,81 +3417,667 @@ KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort *v DISPATCH(MultiTexCoord4svARB, (target, v), (F, ";")); } +#endif -/* ARB 3. GL_ARB_transpose_matrix */ -KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble m[16]) -{ - DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixARB(%p);", m)); -} - -KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixfARB)(const GLfloat m[16]) -{ - DISPATCH(LoadTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p)", m)); -} - -KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixdARB)(const GLdouble m[16]) -{ - DISPATCH(MultTransposeMatrixdARB, (m), (F, "glMultTransposeMatrixfARB(%p)", m)); -} - -KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat m[16]) -{ - DISPATCH(MultTransposeMatrixfARB, (m), (F, "glLoadTransposeMatrixfARB(%p)", m)); -} - - - -/* ARB 5. GL_ARB_multisample */ -KEYWORD1 void KEYWORD2 NAME(SampleCoverageARB)(GLclampf value, GLboolean invert) -{ - DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);", value, invert)); -} - -KEYWORD1 void KEYWORD2 NAME(SamplePassARB)(GLenum pass) -{ - DISPATCH(SamplePassARB, (pass), (F, "glSamplePassARB(0x%x);", pass)); -} - - - -/* ARB 12. GL_ARB_texture_compression */ -KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) -{ - DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB();")); -} - -KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) -{ - DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB();")); -} - -KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) -{ - DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB();")); -} - -KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) -{ - DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB();")); -} - -KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) -{ - DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB();")); -} - -KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) -{ - DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB();")); -} - -KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImageARB)(GLenum target, GLint lod, GLvoid *img) -{ - DISPATCH(GetCompressedTexImageARB, (target, lod, img), (F, "glGetCompressedTexImageARB();")); +/** + ** Optional initialization function, generated according to DO_INIT + **/ + +#ifdef DO_INIT + +static void NAME(InitDispatch)( void ) +{ + INITARGS; + INIT(GetCompressedTexImageARB); + INIT(Accum); + INIT(AlphaFunc); + INIT(Bitmap); + INIT(BlendFunc); + INIT(Clear); + INIT(ClearAccum); + INIT(ClearColor); + INIT(ClearDepth); + INIT(ClearIndex); + INIT(ClearStencil); + INIT(ClipPlane); + INIT(ColorMask); + INIT(ColorMaterial); + INIT(CopyPixels); + INIT(CullFace); + INIT(DepthFunc); + INIT(DepthMask); + INIT(DepthRange); + INIT(DeleteLists); + INIT(Disable); + INIT(DrawBuffer); + INIT(DrawElements); + INIT(DrawPixels); + INIT(EndList); + INIT(Enable); + INIT(EvalMesh1); + INIT(EvalMesh2); + INIT(FeedbackBuffer); + INIT(Finish); + INIT(Flush); + INIT(Fogf); + INIT(Fogi); + INIT(Fogfv); + INIT(Fogiv); + INIT(FrontFace); + INIT(Frustum); + INIT(GenLists); + INIT(GetBooleanv); + INIT(GetClipPlane); + INIT(GetDoublev); + INIT(GetError); + INIT(GetFloatv); + INIT(GetIntegerv); + INIT(GetLightfv); + INIT(GetLightiv); + INIT(GetMapdv); + INIT(GetMapfv); + INIT(GetMapiv); + INIT(GetMaterialfv); + INIT(GetMaterialiv); + INIT(GetPixelMapfv); + INIT(GetPixelMapuiv); + INIT(GetPixelMapusv); + INIT(GetPolygonStipple); + INIT(GetString); + INIT(GetTexEnvfv); + INIT(GetTexEnviv); + INIT(GetTexGeniv); + INIT(GetTexGendv); + INIT(GetTexGenfv); + INIT(GetTexImage); + INIT(GetTexLevelParameterfv); + INIT(GetTexLevelParameteriv); + INIT(GetTexParameterfv); + INIT(GetTexParameteriv); + INIT(Hint); + INIT(IndexMask); + INIT(InitNames); + INIT(IsEnabled); + INIT(IsList); + INIT(Lightf); + INIT(Lighti); + INIT(Lightfv); + INIT(Lightiv); + INIT(LightModelf); + INIT(LightModeli); + INIT(LightModelfv); + INIT(LightModeliv); + INIT(LineWidth); + INIT(LineStipple); + INIT(ListBase); + INIT(LoadIdentity); + INIT(LoadMatrixd); + INIT(LoadMatrixf); + INIT(LoadName); + INIT(LogicOp); + INIT(Map1d); + INIT(Map1f); + INIT(Map2d); + INIT(Map2f); + INIT(MapGrid1d); + INIT(MapGrid1f); + INIT(MapGrid2d); + INIT(MapGrid2f); + INIT(MatrixMode); + INIT(MultMatrixd); + INIT(MultMatrixf); + INIT(NewList); + INIT(Ortho); + INIT(PassThrough); + INIT(PixelMapfv); + INIT(PixelMapuiv); + INIT(PixelMapusv); + INIT(PixelStoref); + INIT(PixelStorei); + INIT(PixelTransferf); + INIT(PixelTransferi); + INIT(PixelZoom); + INIT(PointSize); + INIT(PolygonMode); + INIT(PolygonStipple); + INIT(PopAttrib); + INIT(PopMatrix); + INIT(PopName); + INIT(PushAttrib); + INIT(PushMatrix); + INIT(PushName); + INIT(RasterPos2d); + INIT(RasterPos2f); + INIT(RasterPos2i); + INIT(RasterPos2s); + INIT(RasterPos3d); + INIT(RasterPos3f); + INIT(RasterPos3i); + INIT(RasterPos3s); + INIT(RasterPos4d); + INIT(RasterPos4f); + INIT(RasterPos4i); + INIT(RasterPos4s); + INIT(RasterPos2dv); + INIT(RasterPos2fv); + INIT(RasterPos2iv); + INIT(RasterPos2sv); + INIT(RasterPos3dv); + INIT(RasterPos3fv); + INIT(RasterPos3iv); + INIT(RasterPos3sv); + INIT(RasterPos4dv); + INIT(RasterPos4fv); + INIT(RasterPos4iv); + INIT(RasterPos4sv); + INIT(ReadBuffer); + INIT(ReadPixels); + INIT(Rectd); + INIT(Rectdv); + INIT(Rectf); + INIT(Rectfv); + INIT(Recti); + INIT(Rectiv); + INIT(Rects); + INIT(Rectsv); + INIT(RenderMode); + INIT(Rotated); + INIT(Rotatef); + INIT(SelectBuffer); + INIT(Scaled); + INIT(Scalef); + INIT(Scissor); + INIT(ShadeModel); + INIT(StencilFunc); + INIT(StencilMask); + INIT(StencilOp); + INIT(TexGend); + INIT(TexGendv); + INIT(TexGenf); + INIT(TexGenfv); + INIT(TexGeni); + INIT(TexGeniv); + INIT(TexEnvf); + INIT(TexEnvfv); + INIT(TexEnvi); + INIT(TexEnviv); + INIT(TexImage1D); + INIT(TexImage2D); + INIT(TexParameterf); + INIT(TexParameterfv); + INIT(TexParameteri); + INIT(TexParameteriv); + INIT(Translated); + INIT(Translatef); + INIT(Viewport); + INIT(AreTexturesResident); + INIT(BindTexture); + INIT(ColorPointer); + INIT(CopyTexImage1D); + INIT(CopyTexImage2D); + INIT(CopyTexSubImage1D); + INIT(CopyTexSubImage2D); + INIT(DeleteTextures); + INIT(DisableClientState); + INIT(DrawArrays); + INIT(EdgeFlagPointer); + INIT(EnableClientState); + INIT(GenTextures); + INIT(GetPointerv); + INIT(IndexPointer); + INIT(InterleavedArrays); + INIT(IsTexture); + INIT(NormalPointer); + INIT(PolygonOffset); + INIT(PopClientAttrib); + INIT(PrioritizeTextures); + INIT(PushClientAttrib); + INIT(TexCoordPointer); + INIT(TexSubImage1D); + INIT(TexSubImage2D); + INIT(VertexPointer); + INIT(CopyTexSubImage3D); + INIT(DrawRangeElements); + INIT(TexImage3D); + INIT(TexSubImage3D); + INIT(BlendColor); + INIT(BlendEquation); + INIT(ColorSubTable); + INIT(ColorTable); + INIT(ColorTableParameterfv); + INIT(ColorTableParameteriv); + INIT(ConvolutionFilter1D); + INIT(ConvolutionFilter2D); + INIT(ConvolutionParameterf); + INIT(ConvolutionParameterfv); + INIT(ConvolutionParameteri); + INIT(ConvolutionParameteriv); + INIT(CopyColorSubTable); + INIT(CopyColorTable); + INIT(CopyConvolutionFilter1D); + INIT(CopyConvolutionFilter2D); + INIT(GetColorTable); + INIT(GetColorTableParameterfv); + INIT(GetColorTableParameteriv); + INIT(GetConvolutionFilter); + INIT(GetConvolutionParameterfv); + INIT(GetConvolutionParameteriv); + INIT(GetHistogram); + INIT(GetHistogramParameterfv); + INIT(GetHistogramParameteriv); + INIT(GetMinmax); + INIT(GetMinmaxParameterfv); + INIT(GetMinmaxParameteriv); + INIT(GetSeparableFilter); + INIT(Histogram); + INIT(Minmax); + INIT(ResetMinmax); + INIT(ResetHistogram); + INIT(SeparableFilter2D); + INIT(BlendColorEXT); + INIT(PolygonOffsetEXT); + INIT(CopyTexSubImage3DEXT); + INIT(TexImage3DEXT); + INIT(TexSubImage3DEXT); + INIT(GetTexFilterFuncSGIS); + INIT(TexFilterFuncSGIS); + INIT(CopyTexSubImage1DEXT); + INIT(TexSubImage1DEXT); + INIT(TexSubImage2DEXT); + INIT(CopyTexImage1DEXT); + INIT(CopyTexImage2DEXT); + INIT(CopyTexSubImage2DEXT); + INIT(GetHistogramEXT); + INIT(GetHistogramParameterfvEXT); + INIT(GetHistogramParameterivEXT); + INIT(GetMinmaxEXT); + INIT(GetMinmaxParameterfvEXT); + INIT(GetMinmaxParameterivEXT); + INIT(HistogramEXT); + INIT(MinmaxEXT); + INIT(ResetHistogramEXT); + INIT(ResetMinmaxEXT); + INIT(ConvolutionFilter1DEXT); + INIT(ConvolutionFilter2DEXT); + INIT(ConvolutionParameterfEXT); + INIT(ConvolutionParameterfvEXT); + INIT(ConvolutionParameteriEXT); + INIT(ConvolutionParameterivEXT); + INIT(CopyConvolutionFilter1DEXT); + INIT(CopyConvolutionFilter2DEXT); + INIT(GetConvolutionFilterEXT); + INIT(GetConvolutionParameterfvEXT); + INIT(GetConvolutionParameterivEXT); + INIT(GetSeparableFilterEXT); + INIT(SeparableFilter2DEXT); + INIT(ColorTableParameterfvSGI); + INIT(ColorTableParameterivSGI); + INIT(ColorTableSGI); + INIT(CopyColorTableSGI); + INIT(GetColorTableSGI); + INIT(GetColorTableParameterfvSGI); + INIT(GetColorTableParameterivSGI); + INIT(PixelTexGenSGIX); + INIT(PixelTexGenParameterfSGIS); + INIT(PixelTexGenParameterfvSGIS); + INIT(PixelTexGenParameteriSGIS); + INIT(PixelTexGenParameterivSGIS); + INIT(GetPixelTexGenParameterfvSGIS); + INIT(GetPixelTexGenParameterivSGIS); + INIT(TexImage4DSGIS); + INIT(TexSubImage4DSGIS); + INIT(GenTexturesEXT); + INIT(DeleteTexturesEXT); + INIT(BindTextureEXT); + INIT(PrioritizeTexturesEXT); + INIT(AreTexturesResidentEXT); + INIT(IsTextureEXT); + INIT(DetailTexFuncSGIS); + INIT(GetDetailTexFuncSGIS); + INIT(GetSharpenTexFuncSGIS); + INIT(SharpenTexFuncSGIS); + INIT(SampleMaskSGIS); + INIT(SamplePatternSGIS); + INIT(VertexPointerEXT); + INIT(NormalPointerEXT); + INIT(ColorPointerEXT); + INIT(IndexPointerEXT); + INIT(TexCoordPointerEXT); + INIT(EdgeFlagPointerEXT); + INIT(GetPointervEXT); + INIT(DrawArraysEXT); + INIT(BlendEquationEXT); + INIT(SpriteParameterfSGIX); + INIT(SpriteParameterfvSGIX); + INIT(SpriteParameteriSGIX); + INIT(SpriteParameterivSGIX); + INIT(PointParameterfEXT); + INIT(PointParameterfvEXT); + INIT(PointParameterfSGIS); + INIT(PointParameterfvSGIS); + INIT(GetInstrumentsSGIX); + INIT(InstrumentsBufferSGIX); + INIT(PollInstrumentsSGIX); + INIT(ReadInstrumentsSGIX); + INIT(StartInstrumentsSGIX); + INIT(StopInstrumentsSGIX); + INIT(FrameZoomSGIX); + INIT(TagSampleBufferSGIX); + INIT(ReferencePlaneSGIX); + INIT(FlushRasterSGIX); + INIT(GetImageTransformParameterfvHP); + INIT(GetImageTransformParameterivHP); + INIT(ImageTransformParameterfHP); + INIT(ImageTransformParameterfvHP); + INIT(ImageTransformParameteriHP); + INIT(ImageTransformParameterivHP); + INIT(ColorSubTableEXT); + INIT(CopyColorSubTableEXT); + INIT(HintPGI); + INIT(ColorTableEXT); + INIT(GetColorTableEXT); + INIT(GetColorTableParameterfvEXT); + INIT(GetColorTableParameterivEXT); + INIT(GetListParameterfvSGIX); + INIT(GetListParameterivSGIX); + INIT(ListParameterfSGIX); + INIT(ListParameterfvSGIX); + INIT(ListParameteriSGIX); + INIT(ListParameterivSGIX); + INIT(IndexMaterialEXT); + INIT(IndexFuncEXT); + INIT(LockArraysEXT); + INIT(UnlockArraysEXT); + INIT(CullParameterfvEXT); + INIT(CullParameterdvEXT); + INIT(FragmentColorMaterialSGIX); + INIT(FragmentLightfSGIX); + INIT(FragmentLightfvSGIX); + INIT(FragmentLightiSGIX); + INIT(FragmentLightivSGIX); + INIT(FragmentLightModelfSGIX); + INIT(FragmentLightModelfvSGIX); + INIT(FragmentLightModeliSGIX); + INIT(FragmentLightModelivSGIX); + INIT(FragmentMaterialfSGIX); + INIT(FragmentMaterialfvSGIX); + INIT(FragmentMaterialiSGIX); + INIT(FragmentMaterialivSGIX); + INIT(GetFragmentLightfvSGIX); + INIT(GetFragmentLightivSGIX); + INIT(GetFragmentMaterialfvSGIX); + INIT(GetFragmentMaterialivSGIX); + INIT(LightEnviSGIX); + INIT(DrawRangeElementsEXT); + INIT(ApplyTextureEXT); + INIT(TextureLightEXT); + INIT(TextureMaterialEXT); + INIT(TexScissorINTEL); + INIT(TexScissorFuncINTEL); + INIT(VertexPointervINTEL); + INIT(NormalPointervINTEL); + INIT(ColorPointervINTEL); + INIT(TexCoordPointervINTEL); + INIT(PixelTransformParameteriEXT); + INIT(PixelTransformParameterfEXT); + INIT(PixelTransformParameterivEXT); + INIT(PixelTransformParameterfvEXT); + INIT(GetPixelTransformParameterivEXT); + INIT(GetPixelTransformParameterfvEXT); + INIT(SecondaryColorPointerEXT); + INIT(FogCoordPointerEXT); + INIT(BlendFuncSeparateEXT); + INIT(BlendFuncSeparateINGR); + INIT(FlushVertexArrayRangeNV); + INIT(VertexArrayRangeNV); + INIT(CombinerParameterfvNV); + INIT(CombinerParameterfNV); + INIT(CombinerParameterivNV); + INIT(CombinerParameteriNV); + INIT(CombinerInputNV); + INIT(CombinerOutputNV); + INIT(FinalCombinerInputNV); + INIT(GetCombinerInputParameterfvNV); + INIT(GetCombinerInputParameterivNV); + INIT(GetCombinerOutputParameterfvNV); + INIT(GetCombinerOutputParameterivNV); + INIT(GetFinalCombinerInputParameterfvNV); + INIT(GetFinalCombinerInputParameterivNV); + INIT(VertexWeightfEXT); + INIT(VertexWeightfvEXT); + INIT(VertexWeightPointerEXT); + INIT(ResizeBuffersMESA); + INIT(WindowPos2iMESA); + INIT(WindowPos2sMESA); + INIT(WindowPos2fMESA); + INIT(WindowPos2dMESA); + INIT(WindowPos2ivMESA); + INIT(WindowPos2svMESA); + INIT(WindowPos2fvMESA); + INIT(WindowPos2dvMESA); + INIT(WindowPos3iMESA); + INIT(WindowPos3sMESA); + INIT(WindowPos3fMESA); + INIT(WindowPos3dMESA); + INIT(WindowPos3ivMESA); + INIT(WindowPos3svMESA); + INIT(WindowPos3fvMESA); + INIT(WindowPos3dvMESA); + INIT(WindowPos4iMESA); + INIT(WindowPos4sMESA); + INIT(WindowPos4fMESA); + INIT(WindowPos4dMESA); + INIT(WindowPos4ivMESA); + INIT(WindowPos4svMESA); + INIT(WindowPos4fvMESA); + INIT(WindowPos4dvMESA); + INIT(TbufferMask3DFX); + INIT(SampleMaskEXT); + INIT(SamplePatternEXT); + INIT(ActiveTextureARB); + INIT(ClientActiveTextureARB); + INIT(LoadTransposeMatrixdARB); + INIT(LoadTransposeMatrixfARB); + INIT(MultTransposeMatrixdARB); + INIT(MultTransposeMatrixfARB); + INIT(SampleCoverageARB); + INIT(SamplePassARB); + INIT(CompressedTexImage3DARB); + INIT(CompressedTexImage2DARB); + INIT(CompressedTexImage1DARB); + INIT(CompressedTexSubImage3DARB); + INIT(CompressedTexSubImage2DARB); + INIT(CompressedTexSubImage1DARB); + INIT(GetCompressedTexImageARB); + +#ifdef DO_GEOMETRY + INIT(Begin); + INIT(CallList); + INIT(CallLists); + INIT(Color3b); + INIT(Color3d); + INIT(Color3f); + INIT(Color3i); + INIT(Color3s); + INIT(Color3ub); + INIT(Color3ui); + INIT(Color3us); + INIT(Color4b); + INIT(Color4d); + INIT(Color4f); + INIT(Color4i); + INIT(Color4s); + INIT(Color4ub); + INIT(Color4ui); + INIT(Color4us); + INIT(Color3bv); + INIT(Color3dv); + INIT(Color3fv); + INIT(Color3iv); + INIT(Color3sv); + INIT(Color3ubv); + INIT(Color3uiv); + INIT(Color3usv); + INIT(Color4bv); + INIT(Color4dv); + INIT(Color4fv); + INIT(Color4iv); + INIT(Color4sv); + INIT(Color4ubv); + INIT(Color4uiv); + INIT(Color4usv); + INIT(End); + INIT(EdgeFlag); + INIT(EdgeFlagv); + INIT(EvalCoord1d); + INIT(EvalCoord1f); + INIT(EvalCoord1dv); + INIT(EvalCoord1fv); + INIT(EvalCoord2d); + INIT(EvalCoord2f); + INIT(EvalCoord2dv); + INIT(EvalCoord2fv); + INIT(EvalPoint1); + INIT(EvalPoint2); + INIT(Indexd); + INIT(Indexdv); + INIT(Indexf); + INIT(Indexfv); + INIT(Indexi); + INIT(Indexiv); + INIT(Indexs); + INIT(Indexsv); + INIT(Materialf); + INIT(Materiali); + INIT(Materialfv); + INIT(Materialiv); + INIT(Normal3b); + INIT(Normal3bv); + INIT(Normal3d); + INIT(Normal3dv); + INIT(Normal3f); + INIT(Normal3fv); + INIT(Normal3i); + INIT(Normal3iv); + INIT(Normal3s); + INIT(Normal3sv); + INIT(TexCoord1d); + INIT(TexCoord1f); + INIT(TexCoord1i); + INIT(TexCoord1s); + INIT(TexCoord2d); + INIT(TexCoord2f); + INIT(TexCoord2s); + INIT(TexCoord2i); + INIT(TexCoord3d); + INIT(TexCoord3f); + INIT(TexCoord3i); + INIT(TexCoord3s); + INIT(TexCoord4d); + INIT(TexCoord4f); + INIT(TexCoord4i); + INIT(TexCoord4s); + INIT(TexCoord1dv); + INIT(TexCoord1fv); + INIT(TexCoord1iv); + INIT(TexCoord1sv); + INIT(TexCoord2dv); + INIT(TexCoord2fv); + INIT(TexCoord2iv); + INIT(TexCoord2sv); + INIT(TexCoord3dv); + INIT(TexCoord3fv); + INIT(TexCoord3iv); + INIT(TexCoord3sv); + INIT(TexCoord4dv); + INIT(TexCoord4fv); + INIT(TexCoord4iv); + INIT(TexCoord4sv); + INIT(Vertex2d); + INIT(Vertex2dv); + INIT(Vertex2f); + INIT(Vertex2fv); + INIT(Vertex2i); + INIT(Vertex2iv); + INIT(Vertex2s); + INIT(Vertex2sv); + INIT(Vertex3d); + INIT(Vertex3dv); + INIT(Vertex3f); + INIT(Vertex3fv); + INIT(Vertex3i); + INIT(Vertex3iv); + INIT(Vertex3s); + INIT(Vertex3sv); + INIT(Vertex4d); + INIT(Vertex4dv); + INIT(Vertex4f); + INIT(Vertex4fv); + INIT(Vertex4i); + INIT(Vertex4iv); + INIT(Vertex4s); + INIT(Vertex4sv); + INIT(Indexub); + INIT(Indexubv); + INIT(ArrayElementEXT); + INIT(SecondaryColor3bEXT); + INIT(SecondaryColor3bvEXT); + INIT(SecondaryColor3dEXT); + INIT(SecondaryColor3dvEXT); + INIT(SecondaryColor3fEXT); + INIT(SecondaryColor3fvEXT); + INIT(SecondaryColor3iEXT); + INIT(SecondaryColor3ivEXT); + INIT(SecondaryColor3sEXT); + INIT(SecondaryColor3svEXT); + INIT(SecondaryColor3ubEXT); + INIT(SecondaryColor3ubvEXT); + INIT(SecondaryColor3uiEXT); + INIT(SecondaryColor3uivEXT); + INIT(SecondaryColor3usEXT); + INIT(SecondaryColor3usvEXT); + INIT(FogCoordfEXT); + INIT(FogCoordfvEXT); + INIT(FogCoorddEXT); + INIT(FogCoorddvEXT); + INIT(MultiTexCoord1dARB); + INIT(MultiTexCoord1dvARB); + INIT(MultiTexCoord1fARB); + INIT(MultiTexCoord1fvARB); + INIT(MultiTexCoord1iARB); + INIT(MultiTexCoord1ivARB); + INIT(MultiTexCoord1sARB); + INIT(MultiTexCoord1svARB); + INIT(MultiTexCoord2dARB); + INIT(MultiTexCoord2dvARB); + INIT(MultiTexCoord2fARB); + INIT(MultiTexCoord2fvARB); + INIT(MultiTexCoord2iARB); + INIT(MultiTexCoord2ivARB); + INIT(MultiTexCoord2sARB); + INIT(MultiTexCoord2svARB); + INIT(MultiTexCoord3dARB); + INIT(MultiTexCoord3dvARB); + INIT(MultiTexCoord3fARB); + INIT(MultiTexCoord3fvARB); + INIT(MultiTexCoord3iARB); + INIT(MultiTexCoord3ivARB); + INIT(MultiTexCoord3sARB); + INIT(MultiTexCoord3svARB); + INIT(MultiTexCoord4dARB); + INIT(MultiTexCoord4dvARB); + INIT(MultiTexCoord4fARB); + INIT(MultiTexCoord4fvARB); + INIT(MultiTexCoord4iARB); + INIT(MultiTexCoord4ivARB); + INIT(MultiTexCoord4sARB); + INIT(MultiTexCoord4svARB); + INIT(ArrayElement); +#endif } - +#endif #undef KEYWORD1 #undef KEYWORD2 diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11 index 00debd391d1..9ea476376da 100644 --- a/src/mesa/main/Makefile.X11 +++ b/src/mesa/main/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.35 2000/11/24 15:21:59 keithw Exp $ +# $Id: Makefile.X11,v 1.36 2000/12/26 05:09:27 keithw Exp $ # Mesa 3-D graphics library # Version: 3.5 @@ -21,29 +21,9 @@ LIBDIR = ../lib CORE_SOURCES = \ - tnl/t_vtxfmt.c \ - tnl/t_bbox.c \ - tnl/t_clip.c \ - tnl/t_context.c \ - tnl/t_cva.c \ - tnl/t_debug.c \ - tnl/t_dlist.c \ - tnl/t_eval.c \ - tnl/t_fog.c \ - tnl/t_light.c \ - tnl/t_pipeline.c \ - tnl/t_shade.c \ - tnl/t_stages.c \ - tnl/t_texture.c \ - tnl/t_trans_elt.c \ - tnl/t_varray.c \ - tnl/t_vb.c \ - tnl/t_vbcull.c \ - tnl/t_vbindirect.c \ - tnl/t_vbrender.c \ - tnl/t_vbxform.c \ api_loopback.c \ api_noop.c \ + api_validate.c \ accum.c \ alpha.c \ attrib.c \ @@ -106,6 +86,40 @@ CORE_SOURCES = \ X86/common_x86.c \ X86/3dnow.c \ X86/katmai.c \ + swrast_setup/ss_context.c \ + swrast_setup/ss_triangle.c \ + swrast_setup/ss_vb.c \ + math/m_debug_xform.c \ + math/m_eval.c \ + math/m_matrix.c \ + math/m_translate.c \ + math/m_vector.c \ + math/m_vertices.c \ + math/m_xform.c \ + array_cache/ac_context.c \ + array_cache/ac_import.c \ + tnl/t_array_api.c \ + tnl/t_array_import.c \ + tnl/t_context.c \ + tnl/t_eval_api.c \ + tnl/t_imm_alloc.c \ + tnl/t_imm_api.c \ + tnl/t_imm_debug.c \ + tnl/t_imm_dlist.c \ + tnl/t_imm_elt.c \ + tnl/t_imm_eval.c \ + tnl/t_imm_exec.c \ + tnl/t_imm_fixup.c \ + tnl/t_pipeline.c \ + tnl/t_vb_fog.c \ + tnl/t_vb_light.c \ + tnl/t_vb_material.c \ + tnl/t_vb_normals.c \ + tnl/t_vb_points.c \ + tnl/t_vb_render.c \ + tnl/t_vb_texgen.c \ + tnl/t_vb_texmat.c \ + tnl/t_vb_vertex.c \ swrast/s_aaline.c \ swrast/s_aatriangle.c \ swrast/s_accum.c \ @@ -134,32 +148,18 @@ CORE_SOURCES = \ swrast/s_stencil.c \ swrast/s_texture.c \ swrast/s_triangle.c \ - swrast/s_zoom.c \ - swrast_setup/ss_context.c \ - swrast_setup/ss_triangle.c \ - swrast_setup/ss_vb.c \ - math/m_debug_xform.c \ - math/m_matrix.c \ - math/m_translate.c \ - math/m_vector.c \ - math/m_vertices.c \ - math/m_xform.c - + swrast/s_zoom.c DRIVER_SOURCES = \ - FX/fxvtxfmt.c \ - FX/fxvtxprims.c \ 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/fxtris.c \ + FX/fxvb.c \ FX/fxglidew.c \ X/glxapi.c \ X/fakeglx.c \ diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 3f4c1f7d682..e8f9ca9f92a 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -1,4 +1,4 @@ -/* $Id: accum.c,v 1.32 2000/11/22 07:32:16 joukj Exp $ */ +/* $Id: accum.c,v 1.33 2000/12/26 05:09:27 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -44,24 +44,30 @@ void _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) { + GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum"); + ASSERT_OUTSIDE_BEGIN_END(ctx); - ctx->Accum.ClearColor[0] = CLAMP( red, -1.0, 1.0 ); - ctx->Accum.ClearColor[1] = CLAMP( green, -1.0, 1.0 ); - ctx->Accum.ClearColor[2] = CLAMP( blue, -1.0, 1.0 ); - ctx->Accum.ClearColor[3] = CLAMP( alpha, -1.0, 1.0 ); - ctx->NewState |= _NEW_ACCUM; -} + tmp[0] = CLAMP( red, -1.0, 1.0 ); + tmp[1] = CLAMP( green, -1.0, 1.0 ); + tmp[2] = CLAMP( blue, -1.0, 1.0 ); + tmp[3] = CLAMP( alpha, -1.0, 1.0 ); + + if (TEST_EQ_4V(tmp, ctx->Accum.ClearColor)) + return; + FLUSH_VERTICES(ctx, _NEW_ACCUM); + COPY_4FV( ctx->Accum.ClearColor, tmp ); +} +/* Should really be a driver-supplied function? + */ void _mesa_Accum( GLenum op, GLfloat value ) { GET_CURRENT_CONTEXT(ctx); GLuint xpos, ypos, width, height; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glAccum"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->Visual.AccumRedBits == 0 || ctx->DrawBuffer != ctx->ReadBuffer) { gl_error(ctx, GL_INVALID_OPERATION, "glAccum"); diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c new file mode 100644 index 00000000000..004977c36c9 --- /dev/null +++ b/src/mesa/main/api_arrayelt.c @@ -0,0 +1,284 @@ +#include "glheader.h" +#include "api_noop.h" +#include "context.h" +#include "colormac.h" +#include "light.h" +#include "macros.h" +#include "mmath.h" +#include "mtypes.h" + + +typedef struct { + GLint unit; + struct gl_client_array *array; + void *func; +} AAtexarray; + + +typedef struct { + struct gl_client_array *array; + void *func; +} AAarray; + +typedef struct { + AAtexarray texarrays[MAX_TEXTURE_UNITS+1]; + AAarray arrays[10]; + GLuint NewState; +} AAcontext; + + +static void *colorfuncs[2][7] = { + { glColor3bv, + glColor3ub, + glColor3sv, + glColor3usv, + glColor3iv, + glColor3fv, + glColor3dv }, + + { glColor4bv, + glColor4ub, + glColor4sv, + glColor4usv, + glColor4iv, + glColor4fv, + glColor4dv } +}; + +static void *vertexfuncs[3][7] = { + { glVertex3bv, + glVertex3ub, + glVertex3sv, + glVertex3usv, + glVertex3iv, + glVertex3fv, + glVertex3dv }, + + { glVertex3bv, + glVertex3ub, + glVertex3sv, + glVertex3usv, + glVertex3iv, + glVertex3fv, + glVertex3dv }, + + { glVertex4bv, + glVertex4ub, + glVertex4sv, + glVertex4usv, + glVertex4iv, + glVertex4fv, + glVertex4dv } +}; + + +static void *multitexfuncs[4][7] = { + { glMultiTexCoord1bv, + glMultiTexCoord1ub, + glMultiTexCoord1sv, + glMultiTexCoord1usv, + glMultiTexCoord1iv, + glMultiTexCoord1fv, + glMultiTexCoord1dv }, + + { glMultiTexCoord2bv, + glMultiTexCoord2ub, + glMultiTexCoord2sv, + glMultiTexCoord2usv, + glMultiTexCoord2iv, + glMultiTexCoord2fv, + glMultiTexCoord2dv }, + + { glMultiTexCoord3bv, + glMultiTexCoord3ub, + glMultiTexCoord3sv, + glMultiTexCoord3usv, + glMultiTexCoord3iv, + glMultiTexCoord3fv, + glMultiTexCoord3dv }, + + { glMultiTexCoord4bv, + glMultiTexCoord4ub, + glMultiTexCoord4sv, + glMultiTexCoord4usv, + glMultiTexCoord4iv, + glMultiTexCoord4fv, + glMultiTexCoord4dv } +}; + +static void *indexfuncs[7] = { + { glIndexbv, + glIndexub, + glIndexsv, + glIndexusv, + glIndexiv, + glIndexfv, + glIndexdv }, +}; + +static void *edgeflagfuncs[7] = { + { glEdgeFlagbv, + glEdgeFlagub, + glEdgeFlagsv, + glEdgeFlagusv, + glEdgeFlagiv, + glEdgeFlagfv, + glEdgeFlagdv }, +}; + +static void *normalfuncs[7] = { + { glNormal3bv, + glNormal3ub, + glNormal3sv, + glNormal3usv, + glNormal3iv, + glNormal3fv, + glNormal3dv }, +}; + +static void *fogcoordfuncs[7] = { + { glFogCoordbv, + glFogCoordub, + glFogCoordsv, + glFogCoordusv, + glFogCoordiv, + glFogCoordfv, + glFogCoorddv }, +}; + +static void *secondarycolorfuncs[7] = { + { glSecondaryColor3bv, + glSecondaryColor3ub, + glSecondaryColor3sv, + glSecondaryColor3usv, + glSecondaryColor3iv, + glSecondaryColor3fv, + glSecondaryColor3dv }, +}; + + +void _aa_create_context( GLcontext *ctx ) +{ + ctx->aa_context = MALLOC( sizeof(AAcontext) ); + AA_CONTEXT(ctx)->NewState = ~0; +} + +static void _aa_update_state( GLcontext *ctx ) +{ + AAcontext *actx = AA_CONTEXT(ctx); + AAtexarray *ta = actx->texarrays; + AAarray *aa = actx->arrays; + int i; + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + if (ctx->Array.TexCoord[i].Enabled) { + ta->unit = i; + ta->array = &ctx->Array.TexCoord[i]; + ta->func = multitexfuncs[ta->array->Size-1][TYPE_IDX(ta->array->Type)]; + ta++; + } + + ta->func = 0; + + if (ctx->Array.Color.Enabled) { + aa->array = &ctx->Array.Color; + aa->func = colorfuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; + aa++; + } + + if (ctx->Array.Normal.Enabled) { + aa->array = &ctx->Array.Normal; + aa->func = normalfuncs[TYPE_IDX(aa->array->Type)]; + aa++; + } + + if (ctx->Array.Index.Enabled) { + aa->array = &ctx->Array.Index; + aa->func = indexfuncs[TYPE_IDX(aa->array->Type)]; + aa++; + } + + if (ctx->Array.EdgeFlag.Enabled) { + aa->array = &ctx->Array.Edgeflag; + aa->func = edgeflagfuncs[TYPE_IDX(aa->array->Type)]; + aa++; + } + + if (ctx->Array.FogCoord.Enabled) { + aa->array = &ctx->Array.Fogcoord; + aa->func = fogcoordfuncs[TYPE_IDX(aa->array->Type)]; + aa++; + } + + if (ctx->Array.SecondaryColor.Enabled) { + aa->array = &ctx->Array.SecondaryColor; + aa->func = secondarycolorfuncs[TYPE_IDX(aa->array->Type)]; + aa++; + } + + /* Must be last + */ + if (ctx->Array.Vertex.Enabled) { + aa->array = &ctx->Array.Vertex; + aa->func = vertexfuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; + aa++; + } + + aa->func = 0; + actx->NewState = 0; +} + + +static void _aa_loopback_array_elt( GLint elt ) +{ + GET_CURRENT_CONTEXT(ctx); + AAcontext *actx = AA_CONTEXT(ctx); + AAtexarray *ta; + AAarray *aa; + + for (ta = actx->texarrays ; ta->func ; ta++) { + void (*func)( GLint, const void * ) = + (void (*)( GLint, const void * )) ta->func; + func( ta->unit, (char *)ta->array->Ptr + elt * ta->array->SizeB ); + } + + for (aa = actx->arrays ; aa->func ; aa++) { + void (*func)( GLint, const void * ) = + (void (*)( GLint, const void * )) aa->func; + func( (char *)aa->array->Ptr + elt * aa->array->SizeB ); + } +} + + +void _aa_exec_array_elt( GLint elt ) +{ + GET_CURRENT_CONTEXT(ctx); + AAcontext *actx = AA_CONTEXT(ctx); + + if (actx->NewState) + _aa_update_state( ctx ); + + ctx->Exec->ArrayElement = _aa_loopback_array_elt; + _aa_loopback_array_elt( elt ); +} + +/* This works for save as well: + */ +void _aa_save_array_elt( GLint elt ) +{ + GET_CURRENT_CONTEXT(ctx); + AAcontext *actx = AA_CONTEXT(ctx); + + if (actx->NewState) + _aa_update_state( ctx ); + + ctx->Save->ArrayElement = _aa_loopback_array_elt; + _aa_loopback_array_elt( elt ); +} + + +void aa_invalidate_state( GLcontext *ctx, GLuint new_state ) +{ + if (AA_CONTEXT(ctx)) + AA_CONTEXT(ctx)->NewState |= new_state; +} diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index 689b7855966..e8b642741f9 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -1,4 +1,4 @@ -/* $Id: api_loopback.c,v 1.3 2000/11/27 18:17:09 brianp Exp $ */ +/* $Id: api_loopback.c,v 1.4 2000/12/26 05:09:27 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -548,7 +548,7 @@ loopback_Indexd( GLdouble c ) static void loopback_Indexf( GLfloat c ) { - INDEX( (GLint) c ); + INDEX( (GLuint) (GLint) c ); } static void @@ -1362,6 +1362,7 @@ loopback_SecondaryColor3usvEXT_f( const GLushort *v ) } + void _mesa_loopback_prefer_float( struct _glapi_table *dest, GLboolean prefer_float_colors ) diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 031dde83c68..bd5c3cd3ea0 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -1,5 +1,6 @@ #include "glheader.h" #include "api_noop.h" +#include "api_validate.h" #include "context.h" #include "colormac.h" #include "light.h" @@ -468,7 +469,7 @@ void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) { { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx, "_mesa_noop_Rectf"); + ASSERT_OUTSIDE_BEGIN_END(ctx); } glBegin( GL_QUADS ); @@ -480,32 +481,22 @@ void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) } -#if 0 - /* Some very basic support for arrays. Drivers without explicit array - * support can hook these in, but it may be more efficient to fall - * back to swtnl. Particularly if the driver is implementing a - * software fastpath rather than driving a hardware t&l unit. - */ - -/* A codegen implementation of this which hardwires the multiplies and - * inlines the called functions would fly: + * support can hook these in, but still need to supply an array-elt + * implementation. */ -void _mesa_noop_ArrayElement( GLint elt ) -{ - GET_CURRENT_CONTEXT(ctx); - int i; - for (i = 0 ; i < ctx->Array._nr_enabled ; i++) { - struct gl_client_array *a = ctx->Array._enabled[i]; - a->_EltFunc( a->Data + elt * a->StrideB ); - } -} - void _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count) { + GET_CURRENT_CONTEXT(ctx); GLint i; + + if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) + return; + + glBegin(mode); for (i = start ; i <= count ; i++) glArrayElement( i ); + glEnd(); } @@ -515,12 +506,10 @@ void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, GET_CURRENT_CONTEXT(ctx); GLint i; - if (count <= 0) { - if (count < 0) { - gl_error( ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); - } + if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) return; - } + + glBegin(mode); switch (type) { case GL_UNSIGNED_BYTE: @@ -539,13 +528,20 @@ void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, gl_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); break; } + + glEnd(); } -void _mesa_noop_DrawRangeElements(GLenum mode, GLuint start, - GLuint end, GLsizei count, - GLenum type, const GLvoid *indices) +void _mesa_noop_DrawRangeElements(GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices) { - glDrawElements( mode, count, type, indices ); + GET_CURRENT_CONTEXT(ctx); + + if (_mesa_validate_DrawRangeElements( ctx, mode, + start, end, + count, type, indices )) + glDrawElements( mode, count, type, indices ); } -#endif diff --git a/src/mesa/main/api_noop.h b/src/mesa/main/api_noop.h index 9d6e67dbc53..b656ec6d442 100644 --- a/src/mesa/main/api_noop.h +++ b/src/mesa/main/api_noop.h @@ -98,4 +98,15 @@ extern void _mesa_noop_TexCoord4fv( GLfloat *v ); */ extern void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); + +extern void _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count); +extern void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); +extern void _mesa_noop_DrawRangeElements(GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices); + + + #endif diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c new file mode 100644 index 00000000000..931d5c65200 --- /dev/null +++ b/src/mesa/main/api_validate.c @@ -0,0 +1,137 @@ + +/* $Id: api_validate.c,v 1.1 2000/12/26 05:09:27 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "glheader.h" +#include "context.h" +#include "mtypes.h" +#include "api_validate.h" + +GLboolean +_mesa_validate_DrawElements(GLcontext *ctx, + GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) +{ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (count <= 0) { + if (count < 0) + gl_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); + return GL_FALSE; + } + + if (mode < 0 || + mode > GL_POLYGON) { + gl_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); + return GL_FALSE; + } + + if (type != GL_UNSIGNED_INT && + type != GL_UNSIGNED_BYTE && + type != GL_UNSIGNED_SHORT) + { + gl_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" ); + return GL_FALSE; + } + + if (ctx->NewState) + gl_update_state( ctx ); + + if (!ctx->Array.Vertex.Enabled) + return GL_FALSE; + + return GL_TRUE; +} + + +GLboolean +_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices) +{ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (count <= 0) { + if (count < 0) + gl_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" ); + return GL_FALSE; + } + + if (mode < 0 || mode > GL_POLYGON) { + gl_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); + return GL_FALSE; + } + + if (end < start) { + gl_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(endNewState) + gl_update_state( ctx ); + + if (!ctx->Array.Vertex.Enabled) + return GL_FALSE; + + return GL_TRUE; +} + + + +GLboolean +_mesa_validate_DrawArrays(GLcontext *ctx, + GLenum mode, GLint start, GLsizei count) +{ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (count<0) { + gl_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" ); + return GL_FALSE; + } + + if (mode < 0 || mode > GL_POLYGON) { + gl_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); + return GL_FALSE; + } + + if (ctx->NewState) + gl_update_state( ctx ); + + if (!ctx->Array.Vertex.Enabled) + return GL_FALSE; + + return GL_TRUE; +} + diff --git a/src/mesa/main/api_validate.h b/src/mesa/main/api_validate.h new file mode 100644 index 00000000000..7f381a04292 --- /dev/null +++ b/src/mesa/main/api_validate.h @@ -0,0 +1,50 @@ +/* $Id: api_validate.h,v 1.1 2000/12/26 05:09:27 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef API_VALIDATE_H +#define API_VALIDATE_H + + +#include "mtypes.h" + +extern GLboolean +_mesa_validate_DrawArrays(GLcontext *ctx, + GLenum mode, GLint start, GLsizei count); + +extern GLboolean +_mesa_validate_DrawElements(GLcontext *ctx, + GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); + +extern GLboolean +_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices); + + +#endif diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 3fab9416884..6158a64869c 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.38 2000/12/14 20:25:56 brianp Exp $ */ +/* $Id: attrib.c,v 1.39 2000/12/26 05:09:27 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -100,7 +100,7 @@ _mesa_PushAttrib(GLbitfield mask) struct gl_attrib_node *head; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushAttrib"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glPushAttrib %x\n", (int)mask); @@ -136,9 +136,7 @@ _mesa_PushAttrib(GLbitfield mask) if (mask & GL_CURRENT_BIT) { struct gl_current_attrib *attr; - - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); - + FLUSH_CURRENT( ctx, 0 ); attr = MALLOC_STRUCT( gl_current_attrib ); MEMCPY( attr, &ctx->Current, sizeof(struct gl_current_attrib) ); newnode = new_attrib_node( GL_CURRENT_BIT ); @@ -257,6 +255,7 @@ _mesa_PushAttrib(GLbitfield mask) if (mask & GL_LIGHTING_BIT) { struct gl_light_attrib *attr; + FLUSH_CURRENT(ctx, 0); /* flush material changes */ attr = MALLOC_STRUCT( gl_light_attrib ); MEMCPY( attr, &ctx->Light, sizeof(struct gl_light_attrib) ); newnode = new_attrib_node( GL_LIGHTING_BIT ); @@ -546,9 +545,7 @@ _mesa_PopAttrib(void) { struct gl_attrib_node *attr, *next; GET_CURRENT_CONTEXT(ctx); - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopAttrib"); - + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->AttribStackDepth==0) { gl_error( ctx, GL_STACK_UNDERFLOW, "glPopAttrib" ); @@ -616,7 +613,7 @@ _mesa_PopAttrib(void) } break; case GL_CURRENT_BIT: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT( ctx, 0 ); MEMCPY( &ctx->Current, attr->data, sizeof(struct gl_current_attrib) ); break; @@ -872,7 +869,7 @@ _mesa_PushClientAttrib(GLbitfield mask) struct gl_attrib_node *head; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushClientAttrib"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->ClientAttribStackDepth>=MAX_CLIENT_ATTRIB_STACK_DEPTH) { gl_error( ctx, GL_STACK_OVERFLOW, "glPushClientAttrib" ); @@ -923,7 +920,7 @@ _mesa_PopClientAttrib(void) struct gl_attrib_node *attr, *next; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopClientAttrib"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->ClientAttribStackDepth==0) { gl_error( ctx, GL_STACK_UNDERFLOW, "glPopClientAttrib" ); @@ -938,14 +935,17 @@ _mesa_PopClientAttrib(void) case GL_CLIENT_PACK_BIT: MEMCPY( &ctx->Pack, attr->data, sizeof(struct gl_pixelstore_attrib) ); + ctx->NewState = _NEW_PACKUNPACK; break; case GL_CLIENT_UNPACK_BIT: MEMCPY( &ctx->Unpack, attr->data, sizeof(struct gl_pixelstore_attrib) ); + ctx->NewState = _NEW_PACKUNPACK; break; case GL_CLIENT_VERTEX_ARRAY_BIT: MEMCPY( &ctx->Array, attr->data, sizeof(struct gl_array_attrib) ); + ctx->NewState = _NEW_ARRAY; break; default: gl_problem( ctx, "Bad attrib flag in PopClientAttrib"); @@ -958,7 +958,6 @@ _mesa_PopClientAttrib(void) attr = next; } - ctx->NewState = _NEW_ARRAY; } diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 621969de244..ef1ec85c910 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -1,4 +1,4 @@ -/* $Id: blend.c,v 1.26 2000/11/22 07:32:16 joukj Exp $ */ +/* $Id: blend.c,v 1.27 2000/12/26 05:09:27 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -41,8 +41,9 @@ void _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) { + GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFunc"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "glBlendFunc %s %s\n", @@ -70,7 +71,6 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: - ctx->Color.BlendSrcRGB = ctx->Color.BlendSrcA = sfactor; break; default: gl_error( ctx, GL_INVALID_ENUM, "glBlendFunc(sfactor)" ); @@ -97,18 +97,24 @@ _mesa_BlendFunc( GLenum sfactor, GLenum dfactor ) case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: - ctx->Color.BlendDstRGB = ctx->Color.BlendDstA = dfactor; break; default: gl_error( ctx, GL_INVALID_ENUM, "glBlendFunc(dfactor)" ); return; } - if (ctx->Driver.BlendFunc) { - (*ctx->Driver.BlendFunc)( ctx, sfactor, dfactor ); - } + if (ctx->Color.BlendDstRGB == dfactor && + ctx->Color.BlendSrcRGB == sfactor && + ctx->Color.BlendDstA == dfactor && + ctx->Color.BlendSrcA == sfactor) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.BlendDstRGB = ctx->Color.BlendDstA = dfactor; + ctx->Color.BlendSrcRGB = ctx->Color.BlendSrcA = sfactor; - ctx->NewState |= _NEW_COLOR; + if (ctx->Driver.BlendFunc) + ctx->Driver.BlendFunc( ctx, sfactor, dfactor ); } @@ -118,7 +124,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendFuncSeparate"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "glBlendFuncSeperate %s %s %s %s\n", @@ -148,7 +154,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: - ctx->Color.BlendSrcRGB = sfactorRGB; break; default: gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorRGB)"); @@ -175,7 +180,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: - ctx->Color.BlendDstRGB = dfactorRGB; break; default: gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorRGB)"); @@ -203,7 +207,6 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: - ctx->Color.BlendSrcA = sfactorA; break; default: gl_error(ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(sfactorA)"); @@ -230,14 +233,24 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: case GL_ONE_MINUS_CONSTANT_ALPHA: - ctx->Color.BlendDstA = dfactorA; break; default: gl_error( ctx, GL_INVALID_ENUM, "glBlendFuncSeparate(dfactorA)" ); return; } - ctx->NewState |= _NEW_COLOR; + if (ctx->Color.BlendSrcRGB == sfactorRGB && + ctx->Color.BlendDstRGB == dfactorRGB && + ctx->Color.BlendSrcA == sfactorA && + ctx->Color.BlendDstA == dfactorA) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + + ctx->Color.BlendSrcRGB = sfactorRGB; + ctx->Color.BlendDstRGB = dfactorRGB; + ctx->Color.BlendSrcA = sfactorA; + ctx->Color.BlendDstA = dfactorA; if (ctx->Driver.BlendFuncSeparate) { (*ctx->Driver.BlendFuncSeparate)( ctx, sfactorRGB, dfactorRGB, @@ -252,7 +265,7 @@ void _mesa_BlendEquation( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBlendEquation"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "glBlendEquation %s\n", @@ -262,22 +275,15 @@ _mesa_BlendEquation( GLenum mode ) case GL_MIN_EXT: case GL_MAX_EXT: case GL_FUNC_ADD_EXT: - if (ctx->Extensions.EXT_blend_minmax) { - ctx->Color.BlendEquation = mode; - } - else { + if (!ctx->Extensions.EXT_blend_minmax) { gl_error(ctx, GL_INVALID_ENUM, "glBlendEquation"); return; } case GL_LOGIC_OP: - ctx->Color.BlendEquation = mode; break; case GL_FUNC_SUBTRACT_EXT: case GL_FUNC_REVERSE_SUBTRACT_EXT: - if (ctx->Extensions.EXT_blend_subtract) { - ctx->Color.BlendEquation = mode; - } - else { + if (!ctx->Extensions.EXT_blend_subtract) { gl_error(ctx, GL_INVALID_ENUM, "glBlendEquation"); return; } @@ -287,17 +293,17 @@ _mesa_BlendEquation( GLenum mode ) return; } + if (ctx->Color.BlendEquation == mode) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.BlendEquation = mode; + /* This is needed to support 1.1's RGB logic ops AND * 1.0's blending logicops. */ - if (mode==GL_LOGIC_OP && ctx->Color.BlendEnabled) { - ctx->Color.ColorLogicOpEnabled = GL_TRUE; - } - else { - ctx->Color.ColorLogicOpEnabled = GL_FALSE; - } - - ctx->NewState |= _NEW_COLOR; + ctx->Color.ColorLogicOpEnabled = (mode==GL_LOGIC_OP && + ctx->Color.BlendEnabled); if (ctx->Driver.BlendEquation) ctx->Driver.BlendEquation( ctx, mode ); @@ -308,11 +314,19 @@ _mesa_BlendEquation( GLenum mode ) void _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { + GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); - ctx->Color.BlendColor[0] = CLAMP( red, 0.0F, 1.0F ); - ctx->Color.BlendColor[1] = CLAMP( green, 0.0F, 1.0F ); - ctx->Color.BlendColor[2] = CLAMP( blue, 0.0F, 1.0F ); - ctx->Color.BlendColor[3] = CLAMP( alpha, 0.0F, 1.0F ); - ctx->NewState |= _NEW_COLOR; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + tmp[0] = CLAMP( red, 0.0, 1.0 ); + tmp[1] = CLAMP( green, 0.0, 1.0 ); + tmp[2] = CLAMP( blue, 0.0, 1.0 ); + tmp[3] = CLAMP( alpha, 0.0, 1.0 ); + + if (TEST_EQ_4V(tmp, ctx->Color.BlendColor)) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + COPY_4FV( ctx->Color.BlendColor, tmp ); } diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index dc802d9e111..da1e6125c98 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -1,4 +1,4 @@ -/* $Id: buffers.c,v 1.20 2000/11/22 07:32:16 joukj Exp $ */ +/* $Id: buffers.c,v 1.21 2000/12/26 05:09:27 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -49,9 +49,14 @@ void _mesa_ClearIndex( GLfloat c ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearIndex"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Color.ClearIndex == (GLuint)c) + return; + + + FLUSH_VERTICES(ctx, _NEW_COLOR); ctx->Color.ClearIndex = (GLuint) c; - ctx->NewState |= _NEW_COLOR; if (!ctx->Visual.RGBAflag) { /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ @@ -65,14 +70,20 @@ void _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) { + GLfloat tmp[4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearColor"); + ASSERT_OUTSIDE_BEGIN_END(ctx); - ctx->Color.ClearColor[0] = CLAMP( red, 0.0F, 1.0F ); - ctx->Color.ClearColor[1] = CLAMP( green, 0.0F, 1.0F ); - ctx->Color.ClearColor[2] = CLAMP( blue, 0.0F, 1.0F ); - ctx->Color.ClearColor[3] = CLAMP( alpha, 0.0F, 1.0F ); - ctx->NewState |= _NEW_COLOR; + tmp[0] = CLAMP( red, 0.0, 1.0 ); + tmp[1] = CLAMP( green, 0.0, 1.0 ); + tmp[2] = CLAMP( blue, 0.0, 1.0 ); + tmp[3] = CLAMP( alpha, 0.0, 1.0 ); + + if (TEST_EQ_4V(tmp, ctx->Color.ClearColor)) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + COPY_4FV( ctx->Color.ClearColor, tmp ); if (ctx->Visual.RGBAflag) { GLchan r = (GLint) (ctx->Color.ClearColor[0] * CHAN_MAXF); @@ -92,7 +103,7 @@ void _mesa_Clear( GLbitfield mask ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClear"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glClear 0x%x\n", mask); @@ -149,7 +160,8 @@ void _mesa_DrawBuffer( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDrawBuffer"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */ + if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glDrawBuffer %s\n", gl_lookup_enum_by_nr(mode)); @@ -301,7 +313,7 @@ void _mesa_ReadBuffer( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glReadBuffer"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glReadBuffer %s\n", gl_lookup_enum_by_nr(mode)); diff --git a/src/mesa/main/clip.c b/src/mesa/main/clip.c index 131f3b60331..c2c7ec30093 100644 --- a/src/mesa/main/clip.c +++ b/src/mesa/main/clip.c @@ -1,4 +1,4 @@ -/* $Id: clip.c,v 1.18 2000/11/27 18:22:13 brianp Exp $ */ +/* $Id: clip.c,v 1.19 2000/12/26 05:09:27 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -56,7 +56,7 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) GET_CURRENT_CONTEXT(ctx); GLint p; GLfloat equation[4]; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClipPlane"); + ASSERT_OUTSIDE_BEGIN_END(ctx); p = (GLint) plane - (GLint) GL_CLIP_PLANE0; if (p < 0 || p >= ctx->Const.MaxClipPlanes) { @@ -80,9 +80,13 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) if (ctx->ModelView.flags & MAT_DIRTY) _math_matrix_analyse( &ctx->ModelView ); - gl_transform_vector( ctx->Transform.EyeUserPlane[p], equation, - ctx->ModelView.inv ); + gl_transform_vector( equation, equation, ctx->ModelView.inv ); + if (TEST_EQ_4V(ctx->Transform.EyeUserPlane[p], equation)) + return; + + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + COPY_4FV(ctx->Transform.EyeUserPlane[p], equation); /* Update derived state. This state also depends on the projection * matrix, and is recalculated on changes to the projection matrix by @@ -97,8 +101,6 @@ _mesa_ClipPlane( GLenum plane, const GLdouble *eq ) ctx->ProjectionMatrix.inv ); } - ctx->NewState |= _NEW_TRANSFORM; - if (ctx->Driver.ClipPlane) ctx->Driver.ClipPlane( ctx, plane, equation ); } @@ -109,9 +111,7 @@ _mesa_GetClipPlane( GLenum plane, GLdouble *equation ) { GET_CURRENT_CONTEXT(ctx); GLint p; - - ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetClipPlane"); - + ASSERT_OUTSIDE_BEGIN_END(ctx); p = (GLint) (plane - GL_CLIP_PLANE0); if (p < 0 || p >= ctx->Const.MaxClipPlanes) { diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 48072c8d7af..f063a697958 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -1,4 +1,4 @@ -/* $Id: colortab.c,v 1.32 2000/12/10 19:23:19 brianp Exp $ */ +/* $Id: colortab.c,v 1.33 2000/12/26 05:09:27 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -213,8 +213,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; GLboolean floatTable = GL_FALSE; GLint comps; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorTable"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */ switch (target) { case GL_TEXTURE_1D: @@ -460,8 +459,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0; GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; GLint comps; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorSubTable"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_TEXTURE_1D: @@ -630,7 +628,7 @@ _mesa_CopyColorTable(GLenum target, GLenum internalformat, { GLchan data[MAX_WIDTH][4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorTable"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* Select buffer to read from */ (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, @@ -661,7 +659,7 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start, { GLchan data[MAX_WIDTH][4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorSubTable"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* Select buffer to read from */ (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, @@ -693,8 +691,7 @@ _mesa_GetColorTable( GLenum target, GLenum format, struct gl_color_table *table = NULL; GLchan rgba[MAX_COLOR_TABLE_SIZE][4]; GLint i; - - ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTable"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState) { gl_update_state(ctx); @@ -865,7 +862,7 @@ void _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_COLOR_TABLE_SGI: @@ -960,8 +957,7 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_color_table *table = NULL; - - ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameterfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { case GL_TEXTURE_1D: @@ -1091,8 +1087,7 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_color_table *table = NULL; - - ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameteriv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { case GL_TEXTURE_1D: diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 95365d94d17..1b3c4f0f271 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -1,4 +1,4 @@ -/* $Id: config.h,v 1.24 2000/11/20 18:06:11 brianp Exp $ */ +/* $Id: config.h,v 1.25 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -175,28 +175,6 @@ -/* Vertex buffer size. KW: no restrictions on the divisibility of - * this number, though things may go better for you if you choose a - * value of 12n + 3. - */ -#define VB_START 3 - -#define VB_MAX (216 + VB_START) - - - -/* - * Actual vertex buffer size. - * - * Arrays must also accomodate new vertices from clipping, and - * potential overflow from primitives which don't fit into neatly into - * VB_MAX vertices. (This only happens when mixed primitives are - * sharing the vb). - */ -#define VB_MAX_CLIPPED_VERTS ((2 * (6 + MAX_CLIP_PLANES))+1) -#define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS) - - /* * Language/compiler stuff */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 2d5b6569cd1..12eb9b791af 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.113 2000/12/16 00:21:28 brianp Exp $ */ +/* $Id: context.c,v 1.114 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -77,7 +77,6 @@ int MESA_VERBOSE = 0 /* | VERBOSE_API */ /* | VERBOSE_DRIVER */ /* | VERBOSE_STATE */ -/* | VERBOSE_CULL */ /* | VERBOSE_DISPLAY_LIST */ ; #endif @@ -603,7 +602,7 @@ init_light( struct gl_light *l, GLuint n ) ASSIGN_4V( l->EyePosition, 0.0, 0.0, 1.0, 0.0 ); ASSIGN_3V( l->EyeDirection, 0.0, 0.0, -1.0 ); l->SpotExponent = 0.0; - gl_compute_spot_exp_table( l ); + gl_invalidate_spot_exp_table( l ); l->SpotCutoff = 180.0; l->_CosCutoff = 0.0; /* KW: -ve values not admitted */ l->ConstantAttenuation = 1.0; @@ -993,15 +992,6 @@ init_attrib_groups( GLcontext *ctx ) s->refcount = 0; insert_at_tail( ctx->_ShineTabList, s ); } - for (i = 0 ; i < 4 ; i++) { - ctx->_ShineTable[i] = ctx->_ShineTabList->prev; - ctx->_ShineTable[i]->refcount++; - } - - gl_compute_shine_table( ctx, 0, ctx->Light.Material[0].Shininess ); - gl_compute_shine_table( ctx, 2, ctx->Light.Material[0].Shininess * .5 ); - gl_compute_shine_table( ctx, 1, ctx->Light.Material[1].Shininess ); - gl_compute_shine_table( ctx, 3, ctx->Light.Material[1].Shininess * .5 ); /* Line group */ @@ -1105,10 +1095,9 @@ init_attrib_groups( GLcontext *ctx ) ctx->Polygon.CullFlag = GL_FALSE; ctx->Polygon.CullFaceMode = GL_BACK; ctx->Polygon.FrontFace = GL_CCW; - ctx->Polygon.FrontBit = 0; + ctx->Polygon._FrontBit = 0; ctx->Polygon.FrontMode = GL_FILL; ctx->Polygon.BackMode = GL_FILL; - ctx->Polygon._Unfilled = GL_FALSE; ctx->Polygon.SmoothFlag = GL_FALSE; ctx->Polygon.StippleFlag = GL_FALSE; ctx->Polygon.OffsetFactor = 0.0F; @@ -1848,7 +1837,7 @@ _mesa_get_current_context( void ) void _mesa_swapbuffers(GLcontext *ctx) { - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + FLUSH_VERTICES( ctx, 0 ); } @@ -1989,7 +1978,7 @@ void _mesa_Finish( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFinish"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->Driver.Finish) { (*ctx->Driver.Finish)( ctx ); } @@ -2001,7 +1990,7 @@ void _mesa_Flush( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFlush"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->Driver.Flush) { (*ctx->Driver.Flush)( ctx ); } @@ -2009,7 +1998,7 @@ _mesa_Flush( void ) -const char *_mesa_prim_name[GL_POLYGON+2] = { +const char *_mesa_prim_name[GL_POLYGON+4] = { "GL_POINTS", "GL_LINES", "GL_LINE_LOOP", @@ -2020,7 +2009,9 @@ const char *_mesa_prim_name[GL_POLYGON+2] = { "GL_QUADS", "GL_QUAD_STRIP", "GL_POLYGON", - "culled primitive" + "outside begin/end", + "inside unkown primitive", + "unknown state" }; diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index c496e6c8f55..24bdd9c4b0f 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -1,4 +1,4 @@ -/* $Id: convolve.c,v 1.16 2000/12/10 19:23:19 brianp Exp $ */ +/* $Id: convolve.c,v 1.17 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -112,7 +112,7 @@ _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, G { GLenum baseFormat; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionFilter1D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target != GL_CONVOLUTION_1D) { gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)"); @@ -186,7 +186,7 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G GLenum baseFormat; GLint i, components; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionFilter2D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target != GL_CONVOLUTION_2D) { gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)"); @@ -268,8 +268,7 @@ _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) { GET_CURRENT_CONTEXT(ctx); GLuint c; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameterf"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { case GL_CONVOLUTION_1D: @@ -313,8 +312,7 @@ _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); struct gl_convolution_attrib *conv; GLuint c; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameterfv"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_CONVOLUTION_1D: @@ -369,8 +367,7 @@ _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) { GET_CURRENT_CONTEXT(ctx); GLuint c; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameteri"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_CONVOLUTION_1D: @@ -414,8 +411,7 @@ _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) GET_CURRENT_CONTEXT(ctx); struct gl_convolution_attrib *conv; GLuint c; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameteriv"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (target) { case GL_CONVOLUTION_1D: @@ -474,7 +470,7 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi GLenum baseFormat; GLchan rgba[MAX_CONVOLUTION_WIDTH][4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter1D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target != GL_CONVOLUTION_1D) { gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)"); @@ -511,7 +507,7 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi struct gl_pixelstore_attrib packSave; GLchan rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4]; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter2D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target != GL_CONVOLUTION_2D) { gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)"); @@ -570,7 +566,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *im const struct gl_convolution_attrib *filter; GLint row; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionFilter"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->NewState) { gl_update_state(ctx); @@ -620,8 +616,7 @@ _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) GET_CURRENT_CONTEXT(ctx); const struct gl_convolution_attrib *conv; GLuint c; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionParameterfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { case GL_CONVOLUTION_1D: @@ -682,8 +677,7 @@ _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) GET_CURRENT_CONTEXT(ctx); const struct gl_convolution_attrib *conv; GLuint c; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionParameteriv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (target) { case GL_CONVOLUTION_1D: @@ -753,7 +747,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; const struct gl_convolution_attrib *filter; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetSeparableFilter"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->NewState) { gl_update_state(ctx); @@ -811,7 +805,7 @@ _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLs const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; GLenum baseFormat; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSeparableFilter2D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target != GL_SEPARABLE_2D) { gl_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)"); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 250c63d813f..cfac5f2ab22 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,4 +1,4 @@ -/* $Id: dd.h,v 1.43 2000/11/24 10:25:05 keithw Exp $ */ +/* $Id: dd.h,v 1.44 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -31,12 +31,7 @@ /* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */ - struct gl_pixelstore_attrib; -struct vertex_buffer; -struct gl_pipeline; -struct gl_pipeline_stage; - /* @@ -139,11 +134,6 @@ typedef void (*triangle_func)( GLcontext *ctx, typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4, GLuint pv ); -typedef void (*render_func)( struct vertex_buffer *VB, - GLuint start, - GLuint count, - GLuint parity ); - /* * Device Driver function table. @@ -161,7 +151,7 @@ struct dd_function_table { * NULL can be returned. */ - void (*UpdateState)( GLcontext *ctx ); + void (*UpdateState)( GLcontext *ctx, GLuint new_state ); /* * UpdateState() is called whenver Mesa thinks the device driver should * update its state and/or the other pointers (such as PointsFunc, @@ -752,49 +742,39 @@ struct dd_function_table { */ + void (*RenderStart)( GLcontext *ctx ); + void (*RenderFinish)( GLcontext *ctx ); + /* Wrap around all rendering functions. Suitable for + * grabbing/releasing hardware locks. + */ - /*** - *** Accelerated point, line, polygon and quad functions: - ***/ - points_func PointsFunc; - line_func LineFunc; - triangle_func TriangleFunc; - quad_func QuadFunc; - /*** - *** Transformation/Rendering functions + *** Parameters for _tnl_render_stage ***/ + points_func PointsFunc; /* must now respect vb->elts */ + line_func LineFunc; + triangle_func TriangleFunc; + quad_func QuadFunc; - void (*RenderStart)( GLcontext *ctx ); - void (*RenderFinish)( GLcontext *ctx ); - /* KW: These replace Begin and End, and have more relaxed semantics. - * They are called prior-to and after one or more vb flush, and are - * thus decoupled from the gl_begin/gl_end pairs, which are possibly - * more frequent. If a begin/end pair covers >1 vertex buffer, these - * are called at most once for the pair. (a bit broken at present) - */ - - void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end ); - /* This function, if not NULL, is called whenever new window coordinates - * are put in the vertex buffer. The vertices in question are those n - * such that start <= n < end. - * The device driver can convert the window coords to its own specialized - * format. The 3Dfx driver uses this. + void (*ResetLineStipple)( GLcontext *ctx ); + + + void (*BuildProjectedVertices)( GLcontext *ctx, + GLuint start, GLuint end, + GLuint new_inputs); + /* This function, if not NULL, is called whenever new vertices are + * required for rendering. The vertices in question are those n + * such that start <= n < end. The new_inputs parameter indicates + * those fields of the vertex which need to be updated, if only a + * partial repair of the vertex is required. * - * Note: Deprecated in favour of RegisterPipelineStages, below. + * This function is called only from _tnl_render_stage in tnl/t_render.c. */ - render_func *RenderVBClippedTab; - render_func *RenderVBCulledTab; - render_func *RenderVBRawTab; - /* These function tables allow the device driver to rasterize an - * entire begin/end group of primitives at once. See the - * gl_render_vb() function in vbrender.c for more details. - */ - GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno ); + GLboolean (*MultipassFunc)( GLcontext *ctx, GLuint passno ); /* Driver may request additional render passes by returning GL_TRUE * when this function is called. This function will be called * after the first pass, and passes will be made until the function @@ -804,51 +784,41 @@ struct dd_function_table { * This function will be first invoked with passno == 1. */ + /*** - *** NEW in Mesa 3.x + *** Support for multiple t&l engines ***/ +#define PRIM_OUTSIDE_BEGIN_END GL_POLYGON+1 +#define PRIM_INSIDE_UNKNOWN_PRIM GL_POLYGON+2 +#define PRIM_UNKNOWN GL_POLYGON+3 - void (*RegisterVB)( struct vertex_buffer *VB ); - void (*UnregisterVB)( struct vertex_buffer *VB ); - /* When Mesa creates a new vertex buffer it calls Driver.RegisterVB() - * so the device driver can allocate its own vertex buffer data and - * hook it to the VB->driver_data pointer. - * When Mesa destroys a vertex buffer it calls Driver.UnegisterVB() - * so the driver can deallocate its own data attached to VB->driver_data. + GLuint CurrentExecPrimitive; + /* Set by the driver-supplied t&l engine. Set to GL_POLYGON+1 when + * outside begin/end. */ - - - GLboolean (*BuildPrecalcPipeline)( GLcontext *ctx ); - GLboolean (*BuildEltPipeline)( GLcontext *ctx ); - /* Perform the full pipeline build, or return false. + GLuint CurrentSavePrimitive; + /* Current state of an inprogress compilation. */ + - /*** - *** Support for multiple t&l engines - ***/ - -#define FLUSH_INSIDE_BEGIN_END 0x1 -#define FLUSH_STORED_VERTICES 0x2 -#define FLUSH_UPDATE_CURRENT 0x4 - +#define FLUSH_STORED_VERTICES 0x1 +#define FLUSH_UPDATE_CURRENT 0x2 GLuint NeedFlush; - /* Set by the driver-supplied t&l engine. - * Bitflags defined above are set whenever - * - the engine *might* be inside a begin/end object. - * - there *might* be buffered vertices to be flushed. - * - the ctx->Current values *might* not be uptodate. + /* Set by the driver-supplied t&l engine whenever vertices are + * buffered between begin/end objects or ctx->Current is not uptodate. * * The FlushVertices() call below may be used to resolve - * these conditions. + * these conditions. */ - GLboolean (*FlushVertices)( GLcontext *ctx, GLuint flags ); - /* If inside begin/end, returns GL_FALSE. + void (*FlushVertices)( GLcontext *ctx, GLuint flags ); + /* If inside begin/end, ASSERT(0). * Otherwise, * if (flags & FLUSH_STORED_VERTICES) flushes any buffered vertices, - * if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current, + * if (flags & FLUSH_UPDATE_CURRENT) updates ctx->Current + * and ctx->Light.Material * returns GL_TRUE. * * Note that the default t&l engine never clears the @@ -866,6 +836,11 @@ struct dd_function_table { * in time to make changes to dispatch tables, etc. */ + void (*BeginCallList)( GLcontext *ctx, GLuint list ); + void (*EndCallList)( GLcontext *ctx ); + /* Notify the t&l component before and after calling a display list. + */ + void (*MakeCurrent)( GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ); /* Let the t&l component know when the context becomes current. @@ -973,7 +948,7 @@ typedef struct { void (*EdgeFlag)( GLboolean ); void (*EdgeFlagv)( const GLboolean * ); void (*EvalCoord1f)( GLfloat ); /* NOTE */ - void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */ + void (*EvalCoord1fv)( const GLfloat * ); /* NOTE */ void (*EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */ void (*EvalCoord2fv)( const GLfloat * ); /* NOTE */ void (*EvalPoint1)( GLint ); /* NOTE */ @@ -1053,7 +1028,10 @@ typedef struct { * provide partial t&l acceleration. * * Mesa will provide a set of helper functions to do eval within - * accelerated vertex formats, eventually... + * accelerated vertex formats, eventually... + * + * Update: There seem to be issues re. maintaining correct values + * for 'ctx->Current' in the face of Eval and T&L fallbacks... */ GLboolean prefer_float_colors; diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 072d6e526ca..83e3a8b86b9 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -4,7 +4,7 @@ void gl_print_state( const char *msg, GLuint state ) { fprintf(stderr, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, state, (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", @@ -19,7 +19,6 @@ void gl_print_state( const char *msg, GLuint state ) (state & _NEW_HINT) ? "ctx->Hint, " : "", (state & _NEW_LIGHT) ? "ctx->Light, " : "", (state & _NEW_LINE) ? "ctx->Line, " : "", - (state & _NEW_FEEDBACK_SELECT) ? "ctx->Feedback/Select, " : "", (state & _NEW_PIXEL) ? "ctx->Pixel, " : "", (state & _NEW_POINT) ? "ctx->Point, " : "", (state & _NEW_POLYGON) ? "ctx->Polygon, " : "", @@ -39,11 +38,9 @@ void gl_print_state( const char *msg, GLuint state ) void gl_print_enable_flags( const char *msg, GLuint flags ) { fprintf(stderr, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, flags, - (flags & ENABLE_TEX0) ? "tex-0, " : "", - (flags & ENABLE_TEX1) ? "tex-1, " : "", (flags & ENABLE_LIGHT) ? "light, " : "", (flags & ENABLE_FOG) ? "fog, " : "", (flags & ENABLE_USERCLIP) ? "userclip, " : "", @@ -51,10 +48,18 @@ void gl_print_enable_flags( const char *msg, GLuint flags ) (flags & ENABLE_TEXGEN1) ? "tex-gen-1, " : "", (flags & ENABLE_TEXGEN2) ? "tex-gen-2, " : "", (flags & ENABLE_TEXGEN3) ? "tex-gen-3, " : "", + (flags & ENABLE_TEXGEN4) ? "tex-gen-4, " : "", + (flags & ENABLE_TEXGEN5) ? "tex-gen-5, " : "", + (flags & ENABLE_TEXGEN6) ? "tex-gen-6, " : "", + (flags & ENABLE_TEXGEN7) ? "tex-gen-7, " : "", (flags & ENABLE_TEXMAT0) ? "tex-mat-0, " : "", (flags & ENABLE_TEXMAT1) ? "tex-mat-1, " : "", (flags & ENABLE_TEXMAT2) ? "tex-mat-2, " : "", (flags & ENABLE_TEXMAT3) ? "tex-mat-3, " : "", + (flags & ENABLE_TEXMAT4) ? "tex-mat-4, " : "", + (flags & ENABLE_TEXMAT5) ? "tex-mat-5, " : "", + (flags & ENABLE_TEXMAT6) ? "tex-mat-6, " : "", + (flags & ENABLE_TEXMAT7) ? "tex-mat-7, " : "", (flags & ENABLE_NORMALIZE) ? "normalize, " : "", (flags & ENABLE_RESCALE) ? "rescale, " : ""); } @@ -62,19 +67,17 @@ void gl_print_enable_flags( const char *msg, GLuint flags ) void gl_print_tri_caps( const char *name, GLuint flags ) { fprintf(stderr, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", name, flags, (flags & DD_FEEDBACK) ? "feedback, " : "", (flags & DD_SELECT) ? "select, " : "", (flags & DD_FLATSHADE) ? "flat-shade, " : "", - (flags & DD_MULTIDRAW) ? "multidraw, " : "", (flags & DD_SEPERATE_SPECULAR) ? "seperate-specular, " : "", (flags & DD_TRI_LIGHT_TWOSIDE) ? "tri-light-twoside, " : "", (flags & DD_TRI_UNFILLED) ? "tri-unfilled, " : "", (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "", (flags & DD_TRI_OFFSET) ? "tri-offset, " : "", - (flags & DD_TRI_CULL) ? "tri-bf-cull, " : "", (flags & DD_TRI_SMOOTH) ? "tri-smooth, " : "", (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "", (flags & DD_LINE_STIPPLE) ? "line-stipple, " : "", @@ -82,7 +85,6 @@ void gl_print_tri_caps( const char *name, GLuint flags ) (flags & DD_POINT_SMOOTH) ? "point-smooth, " : "", (flags & DD_POINT_SIZE) ? "point-size, " : "", (flags & DD_POINT_ATTEN) ? "point-atten, " : "", - (flags & DD_LIGHTING_CULL) ? "lighting-cull, " : "", (flags & DD_TRI_CULL_FRONT_BACK) ? "cull-all, " : "", (flags & DD_STENCIL) ? "stencil, " : "" ); diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 3660bd51ba6..789260b8605 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -1,4 +1,4 @@ -/* $Id: depth.c,v 1.24 2000/11/22 07:32:16 joukj Exp $ */ +/* $Id: depth.c,v 1.25 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -49,11 +49,16 @@ void _mesa_ClearDepth( GLclampd depth ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearDepth"); - ctx->Depth.Clear = (GLfloat) CLAMP( depth, 0.0, 1.0 ); + GLfloat tmp = (GLfloat) CLAMP( depth, 0.0, 1.0 ); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Depth.Clear == tmp) + return; + + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.Clear = tmp; if (ctx->Driver.ClearDepth) (*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear ); - ctx->NewState |= _NEW_DEPTH; } @@ -62,41 +67,39 @@ void _mesa_DepthFunc( GLenum func ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthFunc"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "glDepthFunc %s\n", gl_lookup_enum_by_nr(func)); switch (func) { - case GL_LESS: /* (default) pass if incoming z < stored z */ - case GL_GEQUAL: - case GL_LEQUAL: - case GL_GREATER: - case GL_NOTEQUAL: - case GL_EQUAL: - case GL_ALWAYS: - if (ctx->Depth.Func != func) { - ctx->Depth.Func = func; - ctx->NewState |= _NEW_DEPTH; - ctx->_TriangleCaps &= ~DD_Z_NEVER; - if (ctx->Driver.DepthFunc) { - (*ctx->Driver.DepthFunc)( ctx, func ); - } - } - break; - case GL_NEVER: - if (ctx->Depth.Func != func) { - ctx->Depth.Func = func; - ctx->NewState |= _NEW_DEPTH; - ctx->_TriangleCaps |= DD_Z_NEVER; - if (ctx->Driver.DepthFunc) { - (*ctx->Driver.DepthFunc)( ctx, func ); - } - } - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glDepth.Func" ); + case GL_LESS: /* (default) pass if incoming z < stored z */ + case GL_GEQUAL: + case GL_LEQUAL: + case GL_GREATER: + case GL_NOTEQUAL: + case GL_EQUAL: + case GL_ALWAYS: + case GL_NEVER: + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glDepth.Func" ); + return; } + + if (ctx->Depth.Func == func) + return; + + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.Func = func; + + if (func == GL_NEVER) + ctx->_TriangleCaps |= DD_Z_NEVER; + else + ctx->_TriangleCaps &= ~DD_Z_NEVER; + + if (ctx->Driver.DepthFunc) + ctx->Driver.DepthFunc( ctx, func ); } @@ -105,7 +108,7 @@ void _mesa_DepthMask( GLboolean flag ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthMask"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "glDepthMask %d\n", flag); @@ -114,13 +117,14 @@ _mesa_DepthMask( GLboolean flag ) * GL_TRUE indicates depth buffer writing is enabled (default) * GL_FALSE indicates depth buffer writing is disabled */ - if (ctx->Depth.Mask != flag) { - ctx->Depth.Mask = flag; - ctx->NewState |= _NEW_DEPTH; - if (ctx->Driver.DepthMask) { - (*ctx->Driver.DepthMask)( ctx, flag ); - } - } + if (ctx->Depth.Mask == flag) + return; + + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.Mask = flag; + + if (ctx->Driver.DepthMask) + ctx->Driver.DepthMask( ctx, flag ); } diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index a2198cb15f0..a2e411eb230 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -1,4 +1,4 @@ -/* $Id: dispatch.c,v 1.16 2000/09/05 20:17:37 brianp Exp $ */ +/* $Id: dispatch.c,v 1.17 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -97,6 +97,8 @@ trace(void) #else +#ifdef THREADS + #define DISPATCH(FUNC, ARGS, MESSAGE) \ const struct _glapi_table *dispatch; \ dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ @@ -107,6 +109,19 @@ trace(void) dispatch = _glapi_Dispatch ? _glapi_Dispatch : _glapi_get_dispatch();\ return (dispatch->FUNC) ARGS +#else + + +#define DISPATCH(FUNC, ARGS, MESSAGE) \ +__asm__ ("jmp *(%%eax) ;" : : "a" (&(_glapi_Dispatch->FUNC)) ) + +#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ + const struct _glapi_table *dispatch; \ + dispatch = _glapi_Dispatch;\ + return (dispatch->FUNC) ARGS + +#endif + #endif @@ -114,5 +129,6 @@ trace(void) #define GLAPIENTRY #endif +#define DO_GEOMETRY #include "glapitemp.h" diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 22779cc56a3..85bb2f93698 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.54 2000/11/24 15:21:59 keithw Exp $ */ +/* $Id: dlist.c,v 1.55 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -42,6 +42,7 @@ #include "convolve.h" #include "copypix.h" #include "depth.h" +#include "dlist.h" #include "enable.h" #include "enums.h" #include "eval.h" @@ -82,7 +83,7 @@ Functions which aren't compiled but executed immediately: glIsList glGenLists glDeleteLists - glEndList + glEndList --- BUT: call ctx->Driver.EndList at end of list execution? glFeedbackBuffer glSelectBuffer glRenderMode @@ -725,7 +726,7 @@ static void save_Accum( GLenum op, GLfloat value ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + FLUSH_VERTICES(ctx, 0); n = ALLOC_INSTRUCTION( ctx, OPCODE_ACCUM, 2 ); if (n) { n[1].e = op; @@ -741,7 +742,7 @@ static void save_AlphaFunc( GLenum func, GLclampf ref ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ALPHA_FUNC, 2 ); if (n) { n[1].e = func; @@ -757,7 +758,7 @@ static void save_BindTexture( GLenum target, GLuint texture ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_TEXTURE, 2 ); if (n) { n[1].e = target; @@ -777,7 +778,7 @@ static void save_Bitmap( GLsizei width, GLsizei height, GET_CURRENT_CONTEXT(ctx); GLvoid *image = _mesa_unpack_bitmap( width, height, pixels, &ctx->Unpack ); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BITMAP, 7 ); if (n) { n[1].i = (GLint) width; @@ -802,7 +803,7 @@ static void save_BlendEquation( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_EQUATION, 1 ); if (n) { n[1].e = mode; @@ -817,7 +818,7 @@ static void save_BlendFunc( GLenum sfactor, GLenum dfactor ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_FUNC, 2 ); if (n) { n[1].e = sfactor; @@ -834,7 +835,7 @@ static void save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_FUNC_SEPARATE, 4 ); if (n) { n[1].e = sfactorRGB; @@ -854,7 +855,7 @@ static void save_BlendColor( GLfloat red, GLfloat green, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_COLOR, 4 ); if (n) { n[1].f = red; @@ -872,7 +873,7 @@ static void save_CallList( GLuint list ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST, 1 ); if (n) { n[1].ui = list; @@ -887,7 +888,7 @@ static void save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) { GET_CURRENT_CONTEXT(ctx); GLint i; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); for (i=0;iUnpack); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE, 6 ); if (n) { n[1].e = target; @@ -1099,8 +1100,7 @@ save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); Node *n; - ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv"); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6 ); if (n) { @@ -1128,8 +1128,7 @@ save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) GET_CURRENT_CONTEXT(ctx); Node *n; - ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv"); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6 ); if (n) { @@ -1160,7 +1159,7 @@ static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLvoid *image = _mesa_unpack_image(count, 1, 1, format, type, table, &ctx->Unpack); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_SUB_TABLE, 6 ); if (n) { n[1].e = target; @@ -1186,7 +1185,7 @@ save_CopyColorSubTable(GLenum target, GLsizei start, GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_COLOR_SUB_TABLE, 6 ); if (n) { n[1].e = target; @@ -1208,7 +1207,7 @@ save_CopyColorTable(GLenum target, GLenum internalformat, GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_COLOR_TABLE, 6 ); if (n) { n[1].e = target; @@ -1231,7 +1230,7 @@ save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, filter, &ctx->Unpack); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_1D, 6 ); if (n) { n[1].e = target; @@ -1260,7 +1259,7 @@ save_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, filter, &ctx->Unpack); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_2D, 7 ); if (n) { n[1].e = target; @@ -1286,7 +1285,7 @@ save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3 ); if (n) { n[1].e = target; @@ -1304,7 +1303,7 @@ save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 ); if (n) { n[1].e = target; @@ -1332,7 +1331,7 @@ save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3 ); if (n) { n[1].e = target; @@ -1350,7 +1349,7 @@ save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 ); if (n) { n[1].e = target; @@ -1378,7 +1377,7 @@ static void save_CopyPixels( GLint x, GLint y, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_PIXELS, 5 ); if (n) { n[1].i = x; @@ -1400,7 +1399,7 @@ save_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_IMAGE1D, 7 ); if (n) { n[1].e = target; @@ -1426,7 +1425,7 @@ save_CopyTexImage2D( GLenum target, GLint level, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_IMAGE2D, 8 ); if (n) { n[1].e = target; @@ -1453,7 +1452,7 @@ save_CopyTexSubImage1D( GLenum target, GLint level, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6 ); if (n) { n[1].e = target; @@ -1477,7 +1476,7 @@ save_CopyTexSubImage2D( GLenum target, GLint level, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8 ); if (n) { n[1].e = target; @@ -1504,7 +1503,7 @@ save_CopyTexSubImage3D( GLenum target, GLint level, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9 ); if (n) { n[1].e = target; @@ -1529,7 +1528,7 @@ static void save_CullFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CULL_FACE, 1 ); if (n) { n[1].e = mode; @@ -1544,7 +1543,7 @@ static void save_DepthFunc( GLenum func ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_FUNC, 1 ); if (n) { n[1].e = func; @@ -1559,7 +1558,7 @@ static void save_DepthMask( GLboolean mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_MASK, 1 ); if (n) { n[1].b = mask; @@ -1574,7 +1573,7 @@ static void save_DepthRange( GLclampd nearval, GLclampd farval ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_RANGE, 2 ); if (n) { n[1].f = (GLfloat) nearval; @@ -1590,7 +1589,7 @@ static void save_Disable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DISABLE, 1 ); if (n) { n[1].e = cap; @@ -1605,7 +1604,7 @@ static void save_DrawBuffer( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_BUFFER, 1 ); if (n) { n[1].e = mode; @@ -1624,7 +1623,7 @@ static void save_DrawPixels( GLsizei width, GLsizei height, GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, pixels, &ctx->Unpack); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_PIXELS, 5 ); if (n) { n[1].i = width; @@ -1647,7 +1646,7 @@ static void save_Enable( GLenum cap ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ENABLE, 1 ); if (n) { n[1].e = cap; @@ -1663,7 +1662,7 @@ void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_EVALMESH1, 3 ); if (n) { n[1].e = mode; @@ -1680,7 +1679,7 @@ void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_EVALMESH2, 5 ); if (n) { n[1].e = mode; @@ -1701,7 +1700,7 @@ static void save_Fogfv( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_FOG, 5 ); if (n) { n[1].e = pname; @@ -1757,7 +1756,7 @@ static void save_FrontFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_FRONT_FACE, 1 ); if (n) { n[1].e = mode; @@ -1774,7 +1773,7 @@ static void save_Frustum( GLdouble left, GLdouble right, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_FRUSTUM, 6 ); if (n) { n[1].f = left; @@ -1794,7 +1793,7 @@ static void save_Hint( GLenum target, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_HINT, 2 ); if (n) { n[1].e = target; @@ -1811,7 +1810,7 @@ static void save_HintPGI( GLenum target, GLint mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_HINT_PGI, 2 ); if (n) { n[1].e = target; @@ -1829,7 +1828,7 @@ save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean si GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_HISTOGRAM, 4 ); if (n) { n[1].e = target; @@ -1847,7 +1846,7 @@ static void save_IndexMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_INDEX_MASK, 1 ); if (n) { n[1].ui = mask; @@ -1861,7 +1860,7 @@ static void save_IndexMask( GLuint mask ) static void save_InitNames( void ) { GET_CURRENT_CONTEXT(ctx); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_INIT_NAMES, 0 ); if (ctx->ExecuteFlag) { (*ctx->Exec->InitNames)(); @@ -1873,7 +1872,7 @@ static void save_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LIGHT, 6 ); if (OPCODE_LIGHT) { GLint i, nParams; @@ -1977,7 +1976,7 @@ static void save_LightModelfv( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LIGHT_MODEL, 5 ); if (n) { n[1].e = pname; @@ -2031,7 +2030,7 @@ static void save_LineStipple( GLint factor, GLushort pattern ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LINE_STIPPLE, 2 ); if (n) { n[1].i = factor; @@ -2047,7 +2046,7 @@ static void save_LineWidth( GLfloat width ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LINE_WIDTH, 1 ); if (n) { n[1].f = width; @@ -2062,7 +2061,7 @@ static void save_ListBase( GLuint base ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LIST_BASE, 1 ); if (n) { n[1].ui = base; @@ -2076,7 +2075,7 @@ static void save_ListBase( GLuint base ) static void save_LoadIdentity( void ) { GET_CURRENT_CONTEXT(ctx); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_IDENTITY, 0 ); if (ctx->ExecuteFlag) { (*ctx->Exec->LoadIdentity)(); @@ -2088,7 +2087,7 @@ static void save_LoadMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_MATRIX, 16 ); if (n) { GLuint i; @@ -2117,7 +2116,7 @@ static void save_LoadName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_NAME, 1 ); if (n) { n[1].ui = name; @@ -2132,7 +2131,7 @@ static void save_LogicOp( GLenum opcode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_LOGIC_OP, 1 ); if (n) { n[1].e = opcode; @@ -2148,7 +2147,7 @@ static void save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP1, 6 ); if (n) { GLfloat *pnts = gl_copy_map_points1d( target, stride, order, points ); @@ -2169,7 +2168,7 @@ static void save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP1, 6 ); if (n) { GLfloat *pnts = gl_copy_map_points1f( target, stride, order, points ); @@ -2193,7 +2192,7 @@ static void save_Map2d( GLenum target, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP2, 10 ); if (n) { GLfloat *pnts = gl_copy_map_points2d( target, ustride, uorder, @@ -2225,7 +2224,7 @@ static void save_Map2f( GLenum target, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAP2, 10 ); if (n) { GLfloat *pnts = gl_copy_map_points2f( target, ustride, uorder, @@ -2253,7 +2252,7 @@ static void save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAPGRID1, 3 ); if (n) { n[1].i = un; @@ -2277,7 +2276,7 @@ static void save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MAPGRID2, 6 ); if (n) { n[1].i = un; @@ -2305,7 +2304,7 @@ static void save_MatrixMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MATRIX_MODE, 1 ); if (n) { n[1].e = mode; @@ -2322,7 +2321,7 @@ save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MIN_MAX, 3 ); if (n) { n[1].e = target; @@ -2339,7 +2338,7 @@ static void save_MultMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_MULT_MATRIX, 16 ); if (n) { GLuint i; @@ -2381,7 +2380,7 @@ static void save_Ortho( GLdouble left, GLdouble right, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ORTHO, 6 ); if (n) { n[1].f = left; @@ -2401,7 +2400,7 @@ static void save_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_MAP, 3 ); if (n) { n[1].e = map; @@ -2455,7 +2454,7 @@ static void save_PixelTransferf( GLenum pname, GLfloat param ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TRANSFER, 2 ); if (n) { n[1].e = pname; @@ -2477,7 +2476,7 @@ static void save_PixelZoom( GLfloat xfactor, GLfloat yfactor ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_ZOOM, 2 ); if (n) { n[1].f = xfactor; @@ -2493,7 +2492,7 @@ static void save_PointParameterfvEXT( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_POINT_PARAMETERS, 4 ); if (n) { n[1].e = pname; @@ -2517,7 +2516,7 @@ static void save_PointSize( GLfloat size ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_POINT_SIZE, 1 ); if (n) { n[1].f = size; @@ -2532,7 +2531,7 @@ static void save_PolygonMode( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_MODE, 2 ); if (n) { n[1].e = face; @@ -2551,7 +2550,7 @@ static void save_PolygonStipple( const GLubyte *pattern ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_STIPPLE, 1 ); if (n) { void *data; @@ -2569,7 +2568,7 @@ static void save_PolygonOffset( GLfloat factor, GLfloat units ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_POLYGON_OFFSET, 2 ); if (n) { n[1].f = factor; @@ -2591,7 +2590,7 @@ static void save_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) static void save_PopAttrib( void ) { GET_CURRENT_CONTEXT(ctx); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_ATTRIB, 0 ); if (ctx->ExecuteFlag) { (*ctx->Exec->PopAttrib)(); @@ -2602,7 +2601,7 @@ static void save_PopAttrib( void ) static void save_PopMatrix( void ) { GET_CURRENT_CONTEXT(ctx); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_MATRIX, 0 ); if (ctx->ExecuteFlag) { (*ctx->Exec->PopMatrix)(); @@ -2613,7 +2612,7 @@ static void save_PopMatrix( void ) static void save_PopName( void ) { GET_CURRENT_CONTEXT(ctx); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_NAME, 0 ); if (ctx->ExecuteFlag) { (*ctx->Exec->PopName)(); @@ -2626,7 +2625,7 @@ static void save_PrioritizeTextures( GLsizei num, const GLuint *textures, { GET_CURRENT_CONTEXT(ctx); GLint i; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); for (i=0;iExecuteFlag) { (*ctx->Exec->PushMatrix)(); @@ -2672,7 +2671,7 @@ static void save_PushName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_NAME, 1 ); if (n) { n[1].ui = name; @@ -2687,7 +2686,7 @@ static void save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_RASTER_POS, 4 ); if (n) { n[1].f = x; @@ -2820,7 +2819,7 @@ static void save_PassThrough( GLfloat token ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PASSTHROUGH, 1 ); if (n) { n[1].f = token; @@ -2835,7 +2834,7 @@ static void save_ReadBuffer( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_READ_BUFFER, 1 ); if (n) { n[1].e = mode; @@ -2851,7 +2850,7 @@ save_ResetHistogram(GLenum target) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_RESET_HISTOGRAM, 1 ); if (n) { n[1].e = target; @@ -2867,7 +2866,7 @@ save_ResetMinmax(GLenum target) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_RESET_MIN_MAX, 1 ); if (n) { n[1].e = target; @@ -2882,7 +2881,7 @@ static void save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ROTATE, 4 ); if (n) { n[1].f = angle; @@ -2906,7 +2905,7 @@ static void save_Scalef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_SCALE, 3 ); if (n) { n[1].f = x; @@ -2929,7 +2928,7 @@ static void save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_SCISSOR, 4 ); if (n) { n[1].i = x; @@ -2947,7 +2946,7 @@ static void save_ShadeModel( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_SHADE_MODEL, 1 ); if (n) { n[1].e = mode; @@ -2962,7 +2961,7 @@ static void save_StencilFunc( GLenum func, GLint ref, GLuint mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_FUNC, 3 ); if (n) { n[1].e = func; @@ -2979,7 +2978,7 @@ static void save_StencilMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_MASK, 1 ); if (n) { n[1].ui = mask; @@ -2994,7 +2993,7 @@ static void save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_OP, 3 ); if (n) { n[1].e = fail; @@ -3011,7 +3010,7 @@ static void save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXENV, 6 ); if (n) { n[1].e = target; @@ -3057,7 +3056,7 @@ static void save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXGEN, 6 ); if (n) { n[1].e = coord; @@ -3119,7 +3118,7 @@ static void save_TexParameterfv( GLenum target, { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEXPARAMETER, 6 ); if (n) { n[1].e = target; @@ -3175,7 +3174,7 @@ static void save_TexImage1D( GLenum target, GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, pixels, &ctx->Unpack); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE1D, 8 ); if (n) { n[1].e = target; @@ -3214,7 +3213,7 @@ static void save_TexImage2D( GLenum target, GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, pixels, &ctx->Unpack); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE2D, 9 ); if (n) { n[1].e = target; @@ -3255,7 +3254,7 @@ static void save_TexImage3D( GLenum target, Node *n; GLvoid *image = _mesa_unpack_image(width, height, depth, format, type, pixels, &ctx->Unpack); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE3D, 10 ); if (n) { n[1].e = target; @@ -3288,7 +3287,7 @@ static void save_TexSubImage1D( GLenum target, GLint level, GLint xoffset, Node *n; GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, pixels, &ctx->Unpack); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE1D, 7 ); if (n) { n[1].e = target; @@ -3319,7 +3318,7 @@ static void save_TexSubImage2D( GLenum target, GLint level, Node *n; GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, pixels, &ctx->Unpack); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE2D, 9 ); if (n) { n[1].e = target; @@ -3352,7 +3351,7 @@ static void save_TexSubImage3D( GLenum target, GLint level, Node *n; GLvoid *image = _mesa_unpack_image(width, height, depth, format, type, pixels, &ctx->Unpack); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE3D, 11 ); if (n) { n[1].e = target; @@ -3382,7 +3381,7 @@ static void save_Translatef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_TRANSLATE, 3 ); if (n) { n[1].f = x; @@ -3406,7 +3405,7 @@ static void save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_VIEWPORT, 4 ); if (n) { n[1].i = x; @@ -3424,7 +3423,7 @@ static void save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_WINDOW_POS, 4 ); if (n) { n[1].f = x; @@ -3559,7 +3558,7 @@ static void save_ActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_TEXTURE, 1 ); if (n) { n[1].e = target; @@ -3575,7 +3574,7 @@ static void save_ClientActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_CLIENT_ACTIVE_TEXTURE, 1 ); if (n) { n[1].e = target; @@ -3625,7 +3624,7 @@ static void save_PixelTexGenSGIX(GLenum mode) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 ); if (n) { n[1].e = mode; @@ -3652,7 +3651,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level, else { Node *n; GLvoid *image; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); if (!image) { @@ -3696,7 +3695,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level, else { Node *n; GLvoid *image; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); if (!image) { @@ -3741,7 +3740,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level, else { Node *n; GLvoid *image; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); if (!image) { @@ -3781,7 +3780,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLvoid *image; GET_CURRENT_CONTEXT(ctx); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); @@ -3820,7 +3819,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLvoid *image; GET_CURRENT_CONTEXT(ctx); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); @@ -3861,7 +3860,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLvoid *image; GET_CURRENT_CONTEXT(ctx); - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* make copy of image */ image = MALLOC(imageSize); @@ -3900,7 +3899,7 @@ static void save_PixelTexGenParameteriSGIS(GLenum target, GLint value) { GET_CURRENT_CONTEXT(ctx); Node *n; - FLUSH_TNL( ctx, FLUSH_STORED_VERTICES ); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 ); if (n) { n[1].e = target; @@ -3979,6 +3978,9 @@ static void execute_list( GLcontext *ctx, GLuint list ) if (!islist(ctx,list)) return; + if (ctx->Driver.BeginCallList) + ctx->Driver.BeginCallList( ctx, list ); + /* mesa_print_display_list( list ); */ ctx->CallDepth++; @@ -4630,6 +4632,9 @@ static void execute_list( GLcontext *ctx, GLuint list ) } } ctx->CallDepth--; + + if (ctx->Driver.EndCallList) + ctx->Driver.EndCallList( ctx ); } @@ -4650,6 +4655,8 @@ GLboolean _mesa_IsList( GLuint list ) { GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); /* must be called before assert */ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); return islist(ctx, list); } @@ -4662,8 +4669,9 @@ _mesa_DeleteLists( GLuint list, GLsizei range ) { GET_CURRENT_CONTEXT(ctx); GLuint i; + FLUSH_VERTICES(ctx, 0); /* must be called before assert */ + ASSERT_OUTSIDE_BEGIN_END(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteLists"); if (range<0) { gl_error( ctx, GL_INVALID_VALUE, "glDeleteLists" ); return; @@ -4684,8 +4692,9 @@ _mesa_GenLists(GLsizei range ) { GET_CURRENT_CONTEXT(ctx); GLuint base; + FLUSH_VERTICES(ctx, 0); /* must be called before assert */ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGenLists", 0); if (range<0) { gl_error( ctx, GL_INVALID_VALUE, "glGenLists" ); return 0; @@ -4722,8 +4731,8 @@ void _mesa_NewList( GLuint list, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glNewList"); - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); /* must be called before assert */ + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glNewList %u %s\n", list, gl_lookup_enum_by_nr(mode)); @@ -4769,12 +4778,12 @@ void _mesa_EndList( void ) { GET_CURRENT_CONTEXT(ctx); + FLUSH_CURRENT(ctx, 0); /* must be called before assert */ + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glEndList\n"); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glEndList" ); - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); - + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); /* ??? */ /* Check that a list is under construction */ if (!ctx->CurrentListPtr) { @@ -4800,10 +4809,6 @@ _mesa_EndList( void ) ctx->Driver.EndList( ctx ); - /* Haven't tracked down why this is needed. - */ - ctx->NewState = ~0; - ctx->CurrentDispatch = ctx->Exec; _glapi_set_dispatch( ctx->CurrentDispatch ); } @@ -4824,9 +4829,10 @@ _mesa_CallList( GLuint list ) } save_compile_flag = ctx->CompileFlag; - ctx->CompileFlag = GL_FALSE; + if (save_compile_flag) { + ctx->CompileFlag = GL_FALSE; + } - FLUSH_TNL( ctx, (FLUSH_STORED_VERTICES | FLUSH_UPDATE_CURRENT) ); execute_list( ctx, list ); ctx->CompileFlag = save_compile_flag; @@ -4856,8 +4862,6 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) save_compile_flag = ctx->CompileFlag; ctx->CompileFlag = GL_FALSE; - FLUSH_TNL( ctx, (FLUSH_STORED_VERTICES | FLUSH_UPDATE_CURRENT) ); - for (i=0;iList.ListBase + list ); @@ -4881,11 +4885,634 @@ void _mesa_ListBase( GLuint base ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glListBase"); + FLUSH_VERTICES(ctx, 0); /* must be called before assert */ + ASSERT_OUTSIDE_BEGIN_END(ctx); ctx->List.ListBase = base; } +/* Can no longer assume ctx->Exec->Func is equal to _mesa_Func. + */ +static void exec_Finish( void ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->Finish(); +} + +static void exec_Flush( void ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->Flush( ); +} + +static void exec_GetBooleanv( GLenum pname, GLboolean *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetBooleanv( pname, params ); +} + +static void exec_GetClipPlane( GLenum plane, GLdouble *equation ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetClipPlane( plane, equation ); +} + +static void exec_GetDoublev( GLenum pname, GLdouble *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetDoublev( pname, params ); +} + +static GLenum exec_GetError( void ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return ctx->Exec->GetError( ); +} + +static void exec_GetFloatv( GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetFloatv( pname, params ); +} + +static void exec_GetIntegerv( GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetIntegerv( pname, params ); +} + +static void exec_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetLightfv( light, pname, params ); +} + +static void exec_GetLightiv( GLenum light, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetLightiv( light, pname, params ); +} + +static void exec_GetMapdv( GLenum target, GLenum query, GLdouble *v ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetMapdv( target, query, v ); +} + +static void exec_GetMapfv( GLenum target, GLenum query, GLfloat *v ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetMapfv( target, query, v ); +} + +static void exec_GetMapiv( GLenum target, GLenum query, GLint *v ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetMapiv( target, query, v ); +} + +static void exec_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetMaterialfv( face, pname, params ); +} + +static void exec_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetMaterialiv( face, pname, params ); +} + +static void exec_GetPixelMapfv( GLenum map, GLfloat *values ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetPixelMapfv( map, values ); +} + +static void exec_GetPixelMapuiv( GLenum map, GLuint *values ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetPixelMapuiv( map, values ); +} + +static void exec_GetPixelMapusv( GLenum map, GLushort *values ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetPixelMapusv( map, values ); +} + +static void exec_GetPolygonStipple( GLubyte *dest ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetPolygonStipple( dest ); +} + +static const GLubyte *exec_GetString( GLenum name ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return ctx->Exec->GetString( name ); +} + +static void exec_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetTexEnvfv( target, pname, params ); +} + +static void exec_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetTexEnviv( target, pname, params ); +} + +static void exec_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetTexGendv( coord, pname, params ); +} + +static void exec_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetTexGenfv( coord, pname, params ); +} + +static void exec_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetTexGeniv( coord, pname, params ); +} + +static void exec_GetTexImage( GLenum target, GLint level, GLenum format, + GLenum type, GLvoid *pixels ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetTexImage( target, level, format, type, pixels ); +} + +static void exec_GetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetTexLevelParameterfv( target, level, pname, params ); +} + +static void exec_GetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetTexLevelParameteriv( target, level, pname, params ); +} + +static void exec_GetTexParameterfv( GLenum target, GLenum pname, + GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetTexParameterfv( target, pname, params ); +} + +static void exec_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetTexParameteriv( target, pname, params ); +} + +static GLboolean exec_IsEnabled( GLenum cap ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return ctx->Exec->IsEnabled( cap ); +} + +static void exec_PixelStoref( GLenum pname, GLfloat param ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->PixelStoref( pname, param ); +} + +static void exec_PixelStorei( GLenum pname, GLint param ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->PixelStorei( pname, param ); +} + +static void exec_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid *pixels ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->ReadPixels( x, y, width, height, format, type, pixels ); +} + +static GLint exec_RenderMode( GLenum mode ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return ctx->Exec->RenderMode( mode ); +} + +static void exec_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->FeedbackBuffer( size, type, buffer ); +} + +static void exec_SelectBuffer( GLsizei size, GLuint *buffer ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->SelectBuffer( size, buffer ); +} + +static GLboolean exec_AreTexturesResident(GLsizei n, const GLuint *texName, + GLboolean *residences) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return ctx->Exec->AreTexturesResident( n, texName, residences); +} + +static void exec_ColorPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->ColorPointer( size, type, stride, ptr); +} + +static void exec_DeleteTextures( GLsizei n, const GLuint *texName) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->DeleteTextures( n, texName); +} + +static void exec_DisableClientState( GLenum cap ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->DisableClientState( cap ); +} + +static void exec_EdgeFlagPointer(GLsizei stride, const void *vptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->EdgeFlagPointer( stride, vptr); +} + +static void exec_EnableClientState( GLenum cap ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->EnableClientState( cap ); +} + +static void exec_GenTextures( GLsizei n, GLuint *texName ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GenTextures( n, texName ); +} + +static void exec_GetPointerv( GLenum pname, GLvoid **params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetPointerv( pname, params ); +} + +static void exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->IndexPointer( type, stride, ptr); +} + +static void exec_InterleavedArrays(GLenum format, GLsizei stride, + const GLvoid *pointer) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->InterleavedArrays( format, stride, pointer); +} + +static GLboolean exec_IsTexture( GLuint texture ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return ctx->Exec->IsTexture( texture ); +} + +static void exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->NormalPointer( type, stride, ptr ); +} + +static void exec_PopClientAttrib(void) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->PopClientAttrib(); +} + +static void exec_PushClientAttrib(GLbitfield mask) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->PushClientAttrib( mask); +} + +static void exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->TexCoordPointer( size, type, stride, ptr); +} + +static void exec_GetCompressedTexImageARB(GLenum target, GLint level, + GLvoid *img) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetCompressedTexImageARB( target, level, img); +} + +static void exec_VertexPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->VertexPointer( size, type, stride, ptr); +} + +static void exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, + GLint x, GLint y, GLsizei width) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->CopyConvolutionFilter1D( target, internalFormat, x, y, width); +} + +static void exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, + GLint x, GLint y, GLsizei width, + GLsizei height) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->CopyConvolutionFilter2D( target, internalFormat, x, y, width, + height); +} + +static void exec_GetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *data ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetColorTable( target, format, type, data ); +} + +static void exec_GetColorTableParameterfv( GLenum target, GLenum pname, + GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetColorTableParameterfv( target, pname, params ); +} + +static void exec_GetColorTableParameteriv( GLenum target, GLenum pname, + GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetColorTableParameteriv( target, pname, params ); +} + +static void exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, + GLvoid *image) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetConvolutionFilter( target, format, type, image); +} + +static void exec_GetConvolutionParameterfv(GLenum target, GLenum pname, + GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetConvolutionParameterfv( target, pname, params); +} + +static void exec_GetConvolutionParameteriv(GLenum target, GLenum pname, + GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetConvolutionParameteriv( target, pname, params); +} + +static void exec_GetHistogram(GLenum target, GLboolean reset, GLenum format, + GLenum type, GLvoid *values) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetHistogram( target, reset, format, type, values); +} + +static void exec_GetHistogramParameterfv(GLenum target, GLenum pname, + GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetHistogramParameterfv( target, pname, params); +} + +static void exec_GetHistogramParameteriv(GLenum target, GLenum pname, + GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetHistogramParameteriv( target, pname, params); +} + +static void exec_GetMinmax(GLenum target, GLboolean reset, GLenum format, + GLenum type, GLvoid *values) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetMinmax( target, reset, format, type, values); +} + +static void exec_GetMinmaxParameterfv(GLenum target, GLenum pname, + GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetMinmaxParameterfv( target, pname, params); +} + +static void exec_GetMinmaxParameteriv(GLenum target, GLenum pname, + GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetMinmaxParameteriv( target, pname, params); +} + +static void exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type, + GLvoid *row, GLvoid *column, GLvoid *span) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetSeparableFilter( target, format, type, row, column, span); +} + +static void exec_SeparableFilter2D(GLenum target, GLenum internalFormat, + GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, + const GLvoid *column) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->SeparableFilter2D( target, internalFormat, width, height, format, + type, row, column); +} + +static void exec_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetPixelTexGenParameterivSGIS( target, value); +} + +static void exec_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->GetPixelTexGenParameterfvSGIS( target, value); +} + +static void exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, + GLsizei count, const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->ColorPointerEXT( size, type, stride, count, ptr); +} + +static void exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, + const GLboolean *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->EdgeFlagPointerEXT( stride, count, ptr); +} + +static void exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, + const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->IndexPointerEXT( type, stride, count, ptr); +} + +static void exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, + const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->NormalPointerEXT( type, stride, count, ptr); +} + +static void exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, + GLsizei count, const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->TexCoordPointerEXT( size, type, stride, count, ptr); +} + +static void exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, + GLsizei count, const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->VertexPointerEXT( size, type, stride, count, ptr); +} + +static void exec_LockArraysEXT(GLint first, GLsizei count) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->LockArraysEXT( first, count); +} + +static void exec_UnlockArraysEXT( void ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->UnlockArraysEXT( ); +} + +static void exec_ResizeBuffersMESA( void ) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->ResizeBuffersMESA( ); +} + +static void exec_SecondaryColorPointerEXT(GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->SecondaryColorPointerEXT( size, type, stride, ptr); +} + +static void exec_FogCoordPointerEXT(GLenum type, GLsizei stride, + const GLvoid *ptr) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->FogCoordPointerEXT( type, stride, ptr); +} /* @@ -4932,8 +5559,8 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->EndList = _mesa_EndList; table->EvalMesh1 = _mesa_save_EvalMesh1; table->EvalMesh2 = _mesa_save_EvalMesh2; - table->Finish = _mesa_Finish; - table->Flush = _mesa_Flush; + table->Finish = exec_Finish; + table->Flush = exec_Flush; table->Fogf = save_Fogf; table->Fogfv = save_Fogfv; table->Fogi = save_Fogi; @@ -4941,38 +5568,38 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->FrontFace = save_FrontFace; table->Frustum = save_Frustum; table->GenLists = _mesa_GenLists; - table->GetBooleanv = _mesa_GetBooleanv; - table->GetClipPlane = _mesa_GetClipPlane; - table->GetDoublev = _mesa_GetDoublev; - table->GetError = _mesa_GetError; - table->GetFloatv = _mesa_GetFloatv; - table->GetIntegerv = _mesa_GetIntegerv; - table->GetLightfv = _mesa_GetLightfv; - table->GetLightiv = _mesa_GetLightiv; - table->GetMapdv = _mesa_GetMapdv; - table->GetMapfv = _mesa_GetMapfv; - table->GetMapiv = _mesa_GetMapiv; - table->GetMaterialfv = _mesa_GetMaterialfv; - table->GetMaterialiv = _mesa_GetMaterialiv; - table->GetPixelMapfv = _mesa_GetPixelMapfv; - table->GetPixelMapuiv = _mesa_GetPixelMapuiv; - table->GetPixelMapusv = _mesa_GetPixelMapusv; - table->GetPolygonStipple = _mesa_GetPolygonStipple; - table->GetString = _mesa_GetString; - table->GetTexEnvfv = _mesa_GetTexEnvfv; - table->GetTexEnviv = _mesa_GetTexEnviv; - table->GetTexGendv = _mesa_GetTexGendv; - table->GetTexGenfv = _mesa_GetTexGenfv; - table->GetTexGeniv = _mesa_GetTexGeniv; - table->GetTexImage = _mesa_GetTexImage; - table->GetTexLevelParameterfv = _mesa_GetTexLevelParameterfv; - table->GetTexLevelParameteriv = _mesa_GetTexLevelParameteriv; - table->GetTexParameterfv = _mesa_GetTexParameterfv; - table->GetTexParameteriv = _mesa_GetTexParameteriv; + table->GetBooleanv = exec_GetBooleanv; + table->GetClipPlane = exec_GetClipPlane; + table->GetDoublev = exec_GetDoublev; + table->GetError = exec_GetError; + table->GetFloatv = exec_GetFloatv; + table->GetIntegerv = exec_GetIntegerv; + table->GetLightfv = exec_GetLightfv; + table->GetLightiv = exec_GetLightiv; + table->GetMapdv = exec_GetMapdv; + table->GetMapfv = exec_GetMapfv; + table->GetMapiv = exec_GetMapiv; + table->GetMaterialfv = exec_GetMaterialfv; + table->GetMaterialiv = exec_GetMaterialiv; + table->GetPixelMapfv = exec_GetPixelMapfv; + table->GetPixelMapuiv = exec_GetPixelMapuiv; + table->GetPixelMapusv = exec_GetPixelMapusv; + table->GetPolygonStipple = exec_GetPolygonStipple; + table->GetString = exec_GetString; + table->GetTexEnvfv = exec_GetTexEnvfv; + table->GetTexEnviv = exec_GetTexEnviv; + table->GetTexGendv = exec_GetTexGendv; + table->GetTexGenfv = exec_GetTexGenfv; + table->GetTexGeniv = exec_GetTexGeniv; + table->GetTexImage = exec_GetTexImage; + table->GetTexLevelParameterfv = exec_GetTexLevelParameterfv; + table->GetTexLevelParameteriv = exec_GetTexLevelParameteriv; + table->GetTexParameterfv = exec_GetTexParameterfv; + table->GetTexParameteriv = exec_GetTexParameteriv; table->Hint = save_Hint; table->IndexMask = save_IndexMask; table->InitNames = save_InitNames; - table->IsEnabled = _mesa_IsEnabled; + table->IsEnabled = exec_IsEnabled; table->IsList = _mesa_IsList; table->LightModelf = save_LightModelf; table->LightModelfv = save_LightModelfv; @@ -5007,8 +5634,8 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->PixelMapfv = save_PixelMapfv; table->PixelMapuiv = save_PixelMapuiv; table->PixelMapusv = save_PixelMapusv; - table->PixelStoref = _mesa_PixelStoref; - table->PixelStorei = _mesa_PixelStorei; + table->PixelStoref = exec_PixelStoref; + table->PixelStorei = exec_PixelStorei; table->PixelTransferf = save_PixelTransferf; table->PixelTransferi = save_PixelTransferi; table->PixelZoom = save_PixelZoom; @@ -5047,15 +5674,15 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->RasterPos4s = save_RasterPos4s; table->RasterPos4sv = save_RasterPos4sv; table->ReadBuffer = save_ReadBuffer; - table->ReadPixels = _mesa_ReadPixels; - table->RenderMode = _mesa_RenderMode; + table->ReadPixels = exec_ReadPixels; + table->RenderMode = exec_RenderMode; table->Rotated = save_Rotated; table->Rotatef = save_Rotatef; table->Scaled = save_Scaled; table->Scalef = save_Scalef; table->Scissor = save_Scissor; - table->FeedbackBuffer = _mesa_FeedbackBuffer; - table->SelectBuffer = _mesa_SelectBuffer; + table->FeedbackBuffer = exec_FeedbackBuffer; + table->SelectBuffer = exec_SelectBuffer; table->ShadeModel = save_ShadeModel; table->StencilFunc = save_StencilFunc; table->StencilMask = save_StencilMask; @@ -5081,30 +5708,30 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->Viewport = save_Viewport; /* GL 1.1 */ - table->AreTexturesResident = _mesa_AreTexturesResident; + table->AreTexturesResident = exec_AreTexturesResident; table->BindTexture = save_BindTexture; - table->ColorPointer = _mesa_ColorPointer; + table->ColorPointer = exec_ColorPointer; table->CopyTexImage1D = save_CopyTexImage1D; table->CopyTexImage2D = save_CopyTexImage2D; table->CopyTexSubImage1D = save_CopyTexSubImage1D; table->CopyTexSubImage2D = save_CopyTexSubImage2D; - table->DeleteTextures = _mesa_DeleteTextures; - table->DisableClientState = _mesa_DisableClientState; - table->EdgeFlagPointer = _mesa_EdgeFlagPointer; - table->EnableClientState = _mesa_EnableClientState; - table->GenTextures = _mesa_GenTextures; - table->GetPointerv = _mesa_GetPointerv; - table->IndexPointer = _mesa_IndexPointer; - table->InterleavedArrays = _mesa_InterleavedArrays; - table->IsTexture = _mesa_IsTexture; - table->NormalPointer = _mesa_NormalPointer; - table->PopClientAttrib = _mesa_PopClientAttrib; + table->DeleteTextures = exec_DeleteTextures; + table->DisableClientState = exec_DisableClientState; + table->EdgeFlagPointer = exec_EdgeFlagPointer; + table->EnableClientState = exec_EnableClientState; + table->GenTextures = exec_GenTextures; + table->GetPointerv = exec_GetPointerv; + table->IndexPointer = exec_IndexPointer; + table->InterleavedArrays = exec_InterleavedArrays; + table->IsTexture = exec_IsTexture; + table->NormalPointer = exec_NormalPointer; + table->PopClientAttrib = exec_PopClientAttrib; table->PrioritizeTextures = save_PrioritizeTextures; - table->PushClientAttrib = _mesa_PushClientAttrib; - table->TexCoordPointer = _mesa_TexCoordPointer; + table->PushClientAttrib = exec_PushClientAttrib; + table->TexCoordPointer = exec_TexCoordPointer; table->TexSubImage1D = save_TexSubImage1D; table->TexSubImage2D = save_TexSubImage2D; - table->VertexPointer = _mesa_VertexPointer; + table->VertexPointer = exec_VertexPointer; /* GL 1.2 */ table->CopyTexSubImage3D = save_CopyTexSubImage3D; @@ -5127,26 +5754,26 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->ConvolutionParameteriv = save_ConvolutionParameteriv; table->CopyColorSubTable = save_CopyColorSubTable; table->CopyColorTable = save_CopyColorTable; - table->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D; - table->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D; - table->GetColorTable = _mesa_GetColorTable; - table->GetColorTableParameterfv = _mesa_GetColorTableParameterfv; - table->GetColorTableParameteriv = _mesa_GetColorTableParameteriv; - table->GetConvolutionFilter = _mesa_GetConvolutionFilter; - table->GetConvolutionParameterfv = _mesa_GetConvolutionParameterfv; - table->GetConvolutionParameteriv = _mesa_GetConvolutionParameteriv; - table->GetHistogram = _mesa_GetHistogram; - table->GetHistogramParameterfv = _mesa_GetHistogramParameterfv; - table->GetHistogramParameteriv = _mesa_GetHistogramParameteriv; - table->GetMinmax = _mesa_GetMinmax; - table->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv; - table->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv; - table->GetSeparableFilter = _mesa_GetSeparableFilter; + table->CopyConvolutionFilter1D = exec_CopyConvolutionFilter1D; + table->CopyConvolutionFilter2D = exec_CopyConvolutionFilter2D; + table->GetColorTable = exec_GetColorTable; + table->GetColorTableParameterfv = exec_GetColorTableParameterfv; + table->GetColorTableParameteriv = exec_GetColorTableParameteriv; + table->GetConvolutionFilter = exec_GetConvolutionFilter; + table->GetConvolutionParameterfv = exec_GetConvolutionParameterfv; + table->GetConvolutionParameteriv = exec_GetConvolutionParameteriv; + table->GetHistogram = exec_GetHistogram; + table->GetHistogramParameterfv = exec_GetHistogramParameterfv; + table->GetHistogramParameteriv = exec_GetHistogramParameteriv; + table->GetMinmax = exec_GetMinmax; + table->GetMinmaxParameterfv = exec_GetMinmaxParameterfv; + table->GetMinmaxParameteriv = exec_GetMinmaxParameteriv; + table->GetSeparableFilter = exec_GetSeparableFilter; table->Histogram = save_Histogram; table->Minmax = save_Minmax; table->ResetHistogram = save_ResetHistogram; table->ResetMinmax = save_ResetMinmax; - table->SeparableFilter2D = _mesa_SeparableFilter2D; + table->SeparableFilter2D = exec_SeparableFilter2D; /* 2. GL_EXT_blend_color */ #if 0 @@ -5171,16 +5798,16 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->PixelTexGenParameterfSGIS = save_PixelTexGenParameterfSGIS; table->PixelTexGenParameterivSGIS = save_PixelTexGenParameterivSGIS; table->PixelTexGenParameterfvSGIS = save_PixelTexGenParameterfvSGIS; - table->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS; - table->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS; + table->GetPixelTexGenParameterivSGIS = exec_GetPixelTexGenParameterivSGIS; + table->GetPixelTexGenParameterfvSGIS = exec_GetPixelTexGenParameterfvSGIS; /* 30. GL_EXT_vertex_array */ - table->ColorPointerEXT = _mesa_ColorPointerEXT; - table->EdgeFlagPointerEXT = _mesa_EdgeFlagPointerEXT; - table->IndexPointerEXT = _mesa_IndexPointerEXT; - table->NormalPointerEXT = _mesa_NormalPointerEXT; - table->TexCoordPointerEXT = _mesa_TexCoordPointerEXT; - table->VertexPointerEXT = _mesa_VertexPointerEXT; + table->ColorPointerEXT = exec_ColorPointerEXT; + table->EdgeFlagPointerEXT = exec_EdgeFlagPointerEXT; + table->IndexPointerEXT = exec_IndexPointerEXT; + table->NormalPointerEXT = exec_NormalPointerEXT; + table->TexCoordPointerEXT = exec_TexCoordPointerEXT; + table->VertexPointerEXT = exec_VertexPointerEXT; /* 37. GL_EXT_blend_minmax */ #if 0 @@ -5199,13 +5826,13 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->ColorTableEXT = save_ColorTable; table->ColorSubTableEXT = save_ColorSubTable; #endif - table->GetColorTableEXT = _mesa_GetColorTable; - table->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; - table->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; + table->GetColorTableEXT = exec_GetColorTable; + table->GetColorTableParameterfvEXT = exec_GetColorTableParameterfv; + table->GetColorTableParameterivEXT = exec_GetColorTableParameteriv; /* 97. GL_EXT_compiled_vertex_array */ - table->LockArraysEXT = _mesa_LockArraysEXT; - table->UnlockArraysEXT = _mesa_UnlockArraysEXT; + table->LockArraysEXT = exec_LockArraysEXT; + table->UnlockArraysEXT = exec_UnlockArraysEXT; /* GL_ARB_multitexture */ table->ActiveTextureARB = save_ActiveTextureARB; @@ -5241,7 +5868,7 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->WindowPos4svMESA = save_WindowPos4svMESA; /* GL_MESA_resize_buffers */ - table->ResizeBuffersMESA = _mesa_ResizeBuffersMESA; + table->ResizeBuffersMESA = exec_ResizeBuffersMESA; /* GL_ARB_transpose_matrix */ table->LoadTransposeMatrixdARB = save_LoadTransposeMatrixdARB; @@ -5256,13 +5883,13 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->CompressedTexSubImage3DARB = save_CompressedTexSubImage3DARB; table->CompressedTexSubImage2DARB = save_CompressedTexSubImage2DARB; table->CompressedTexSubImage1DARB = save_CompressedTexSubImage1DARB; - table->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB; + table->GetCompressedTexImageARB = exec_GetCompressedTexImageARB; /* GL_EXT_secondary_color */ - table->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT; + table->SecondaryColorPointerEXT = exec_SecondaryColorPointerEXT; /* GL_EXT_fog_coord */ - table->FogCoordPointerEXT = _mesa_FogCoordPointerEXT; + table->FogCoordPointerEXT = exec_FogCoordPointerEXT; } diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index 5d6faf97afa..a8cd34d6128 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -1,4 +1,4 @@ -/* $Id: dlist.h,v 1.9 2000/11/24 15:21:59 keithw Exp $ */ +/* $Id: dlist.h,v 1.10 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -32,6 +32,30 @@ #include "mtypes.h" +#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \ +do { \ + if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { \ + gl_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ + return retval; \ + } \ +} while (0) + +#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \ + ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx,) + +#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx) \ +do { \ + ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx); \ + FLUSH_VERTICES(ctx, 0); \ +} while (0) + +#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\ +do { \ + ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval); \ + FLUSH_VERTICES(ctx, 0); \ +} while (0) + + extern void gl_init_lists( void ); extern void gl_destroy_list( GLcontext *ctx, GLuint list ); diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 21c74ffdf08..661a41bc2cf 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,4 +1,4 @@ -/* $Id: drawpix.c,v 1.46 2000/11/22 07:32:16 joukj Exp $ */ +/* $Id: drawpix.c,v 1.47 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -53,7 +53,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "_mesa_DrawPixels" ); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->RenderMode==GL_RENDER) { GLint x, y; @@ -88,8 +88,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, GLfloat color[4]; GLfloat texcoord[4], invq; - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); - + FLUSH_CURRENT(ctx, 0); color[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]); color[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]); color[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]); diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index bbc5070d758..7b667600053 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.36 2000/12/08 00:20:15 brianp Exp $ */ +/* $Id: enable.c,v 1.37 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -44,14 +44,92 @@ #endif +static void +client_state( GLcontext *ctx, GLenum cap, GLboolean state ) +{ + GLuint flag; + GLboolean *var; + + switch (cap) { + case GL_VERTEX_ARRAY: + var = &ctx->Array.Vertex.Enabled; + flag = _NEW_ARRAY_VERTEX; + break; + case GL_NORMAL_ARRAY: + var = &ctx->Array.Normal.Enabled; + flag = _NEW_ARRAY_NORMAL; + break; + case GL_COLOR_ARRAY: + var = &ctx->Array.Color.Enabled; + flag = _NEW_ARRAY_COLOR; + break; + case GL_INDEX_ARRAY: + var = &ctx->Array.Index.Enabled; + flag = _NEW_ARRAY_INDEX; + break; + case GL_TEXTURE_COORD_ARRAY: + var = &ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; + flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); + break; + case GL_EDGE_FLAG_ARRAY: + var = &ctx->Array.EdgeFlag.Enabled; + flag = _NEW_ARRAY_EDGEFLAG; + break; + case GL_FOG_COORDINATE_ARRAY_EXT: + var = &ctx->Array.FogCoord.Enabled; + flag = _NEW_ARRAY_FOGCOORD; + break; + case GL_SECONDARY_COLOR_ARRAY_EXT: + var = &ctx->Array.SecondaryColor.Enabled; + flag = _NEW_ARRAY_SECONDARYCOLOR; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); + } + + if (*var == flag) + return; + + FLUSH_VERTICES(ctx, _NEW_ARRAY); + ctx->Array.NewState |= flag; + *var = state; + + if (state) + ctx->Array._Enabled |= flag; + else + ctx->Array._Enabled &= ~flag; + + if (ctx->Driver.Enable) { + (*ctx->Driver.Enable)( ctx, cap, state ); + } +} + + + +void +_mesa_EnableClientState( GLenum cap ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + client_state( ctx, cap, GL_TRUE ); +} + + + +void +_mesa_DisableClientState( GLenum cap ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + client_state( ctx, cap, GL_FALSE ); +} + /* * Perform glEnable and glDisable calls. */ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) { - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" ); - if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "%s %s (newstate is %x)\n", state ? "glEnable" : "glDisable", @@ -59,588 +137,610 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->NewState); switch (cap) { - case GL_ALPHA_TEST: - if (ctx->Color.AlphaEnabled!=state) { - ctx->Color.AlphaEnabled = state; - ctx->NewState |= _NEW_COLOR; - } - break; - case GL_AUTO_NORMAL: - ctx->Eval.AutoNormal = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_BLEND: - if (ctx->Color.BlendEnabled!=state) { - ctx->Color.BlendEnabled = state; - /* The following needed to accomodate 1.0 RGB logic op blending */ - if (ctx->Color.BlendEquation==GL_LOGIC_OP && state) { - ctx->Color.ColorLogicOpEnabled = GL_TRUE; - } - else { - ctx->Color.ColorLogicOpEnabled = GL_FALSE; - } - ctx->NewState |= _NEW_COLOR; - } - break; - case GL_CLIP_PLANE0: - case GL_CLIP_PLANE1: - case GL_CLIP_PLANE2: - case GL_CLIP_PLANE3: - case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: - if (ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0] != state) - { - GLuint p = cap-GL_CLIP_PLANE0; - - ctx->Transform.ClipEnabled[p] = state; - ctx->NewState |= _NEW_TRANSFORM; - - if (state) { - ctx->_Enabled |= ENABLE_USERCLIP; - ctx->Transform._AnyClip++; - - if (ctx->ProjectionMatrix.flags & MAT_DIRTY) { - _math_matrix_analyse( &ctx->ProjectionMatrix ); - } + case GL_ALPHA_TEST: + if (ctx->Color.AlphaEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.AlphaEnabled = state; + break; + case GL_AUTO_NORMAL: + if (ctx->Eval.AutoNormal == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.AutoNormal = state; + break; + case GL_BLEND: + if (ctx->Color.BlendEnabled == state) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.BlendEnabled = state; + /* The following needed to accomodate 1.0 RGB logic op blending */ + ctx->Color.ColorLogicOpEnabled = + (ctx->Color.BlendEquation == GL_LOGIC_OP && state); + break; + case GL_CLIP_PLANE0: + case GL_CLIP_PLANE1: + case GL_CLIP_PLANE2: + case GL_CLIP_PLANE3: + case GL_CLIP_PLANE4: + case GL_CLIP_PLANE5: { + GLuint p = cap-GL_CLIP_PLANE0; + + if (ctx->Transform.ClipEnabled[p] == state) + return; + + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.ClipEnabled[p] = state; + + if (state) { + ctx->_Enabled |= ENABLE_USERCLIP; + ctx->Transform._AnyClip++; - /* This derived state also calculated in clip.c and - * from gl_update_state() on changes to EyeUserPlane - * and ctx->ProjectionMatrix respectively. - */ - gl_transform_vector( ctx->Transform._ClipUserPlane[p], - ctx->Transform.EyeUserPlane[p], - ctx->ProjectionMatrix.inv ); - } else { - if (--ctx->Transform._AnyClip == 0) - ctx->_Enabled &= ~ENABLE_USERCLIP; - } - } - break; - case GL_COLOR_MATERIAL: - if (ctx->Light.ColorMaterialEnabled!=state) { - ctx->Light.ColorMaterialEnabled = state; - ctx->NewState |= _NEW_LIGHT; - - if (state) { - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); - gl_update_color_material( ctx, ctx->Current.Color ); - } - } - break; - case GL_CULL_FACE: - if (ctx->Polygon.CullFlag!=state) { - ctx->Polygon.CullFlag = state; -/* ctx->_TriangleCaps ^= DD_TRI_CULL; */ - ctx->NewState |= _NEW_POLYGON; - } - break; - case GL_DEPTH_TEST: - if (state && ctx->Visual.DepthBits==0) { - _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); - return; - } - if (ctx->Depth.Test!=state) { - ctx->Depth.Test = state; - ctx->NewState |= _NEW_DEPTH; - } - break; - case GL_DITHER: - if (ctx->NoDither) { - /* MESA_NO_DITHER env var */ - state = GL_FALSE; - } - if (ctx->Color.DitherFlag!=state) { - ctx->Color.DitherFlag = state; - ctx->NewState |= _NEW_COLOR; - } - break; - case GL_FOG: - if (ctx->Fog.Enabled!=state) { - ctx->Fog.Enabled = state; - ctx->_Enabled ^= ENABLE_FOG; - ctx->NewState |= _NEW_FOG; - } - break; - case GL_HISTOGRAM: - if (ctx->Extensions.EXT_histogram) { - ctx->Pixel.HistogramEnabled = state; - ctx->NewState |= _NEW_PIXEL; - } - else { - gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - break; - case GL_LIGHT0: - case GL_LIGHT1: - case GL_LIGHT2: - case GL_LIGHT3: - case GL_LIGHT4: - case GL_LIGHT5: - case GL_LIGHT6: - case GL_LIGHT7: - if (ctx->Light.Light[cap-GL_LIGHT0].Enabled != state) { - ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; - if (state) { - insert_at_tail(&ctx->Light.EnabledList, - &ctx->Light.Light[cap-GL_LIGHT0]); - } - else { - remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); - } - ctx->NewState |= _NEW_LIGHT; + if (ctx->ProjectionMatrix.flags & MAT_DIRTY) { + _math_matrix_analyse( &ctx->ProjectionMatrix ); } - break; - case GL_LIGHTING: - if (ctx->Light.Enabled!=state) { - ctx->Light.Enabled = state; - ctx->_Enabled &= ~ENABLE_LIGHT; - if (state) - 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->NewState |= _NEW_LINE; - } - break; - case GL_LINE_STIPPLE: - if (ctx->Line.StippleFlag!=state) { - ctx->Line.StippleFlag = state; - ctx->_TriangleCaps ^= DD_LINE_STIPPLE; - ctx->NewState |= _NEW_LINE; - } - break; - case GL_INDEX_LOGIC_OP: - if (ctx->Color.IndexLogicOpEnabled!=state) { - ctx->Color.IndexLogicOpEnabled = state; - ctx->NewState |= _NEW_COLOR; - } - break; - case GL_COLOR_LOGIC_OP: - if (ctx->Color.ColorLogicOpEnabled!=state) { - ctx->Color.ColorLogicOpEnabled = state; - ctx->NewState |= _NEW_COLOR; - } - break; - case GL_MAP1_COLOR_4: - ctx->Eval.Map1Color4 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP1_INDEX: - ctx->Eval.Map1Index = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP1_NORMAL: - ctx->Eval.Map1Normal = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP1_TEXTURE_COORD_1: - ctx->Eval.Map1TextureCoord1 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP1_TEXTURE_COORD_2: - ctx->Eval.Map1TextureCoord2 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP1_TEXTURE_COORD_3: - ctx->Eval.Map1TextureCoord3 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP1_TEXTURE_COORD_4: - ctx->Eval.Map1TextureCoord4 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP1_VERTEX_3: - ctx->Eval.Map1Vertex3 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP1_VERTEX_4: - ctx->Eval.Map1Vertex4 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP2_COLOR_4: - ctx->Eval.Map2Color4 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP2_INDEX: - ctx->Eval.Map2Index = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP2_NORMAL: - ctx->Eval.Map2Normal = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP2_TEXTURE_COORD_1: - ctx->Eval.Map2TextureCoord1 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP2_TEXTURE_COORD_2: - ctx->Eval.Map2TextureCoord2 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP2_TEXTURE_COORD_3: - ctx->Eval.Map2TextureCoord3 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP2_TEXTURE_COORD_4: - ctx->Eval.Map2TextureCoord4 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP2_VERTEX_3: - ctx->Eval.Map2Vertex3 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MAP2_VERTEX_4: - ctx->Eval.Map2Vertex4 = state; - ctx->NewState |= _NEW_EVAL; - break; - case GL_MINMAX: - ctx->Pixel.MinMaxEnabled = state; - ctx->NewState |= _NEW_PIXEL; - break; - case GL_NORMALIZE: - if (ctx->Transform.Normalize != state) { - ctx->Transform.Normalize = state; - ctx->NewState |= _NEW_TRANSFORM; - ctx->_Enabled ^= ENABLE_NORMALIZE; - } - break; - case GL_POINT_SMOOTH: - if (ctx->Point.SmoothFlag!=state) { - ctx->Point.SmoothFlag = state; - 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->NewState |= _NEW_POLYGON; - } - break; - case GL_POLYGON_STIPPLE: - if (ctx->Polygon.StippleFlag!=state) { - ctx->Polygon.StippleFlag = state; - ctx->_TriangleCaps ^= DD_TRI_STIPPLE; - ctx->NewState |= _NEW_POLYGON; - } - break; - case GL_POLYGON_OFFSET_POINT: - if (ctx->Polygon.OffsetPoint!=state) { - ctx->Polygon.OffsetPoint = state; - ctx->NewState |= _NEW_POLYGON; - } - break; - case GL_POLYGON_OFFSET_LINE: - if (ctx->Polygon.OffsetLine!=state) { - ctx->Polygon.OffsetLine = state; - ctx->NewState |= _NEW_POLYGON; - } - break; - case GL_POLYGON_OFFSET_FILL: + + /* This derived state also calculated in clip.c and + * from gl_update_state() on changes to EyeUserPlane + * and ctx->ProjectionMatrix respectively. + */ + gl_transform_vector( ctx->Transform._ClipUserPlane[p], + ctx->Transform.EyeUserPlane[p], + ctx->ProjectionMatrix.inv ); + } else { + if (--ctx->Transform._AnyClip == 0) + ctx->_Enabled &= ~ENABLE_USERCLIP; + } + } + break; + case GL_COLOR_MATERIAL: + if (ctx->Light.ColorMaterialEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.ColorMaterialEnabled = state; + if (state) { + FLUSH_CURRENT(ctx, 0); + gl_update_color_material( ctx, ctx->Current.Color ); + } + break; + case GL_CULL_FACE: + if (ctx->Polygon.CullFlag == state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.CullFlag = state; + break; + case GL_DEPTH_TEST: + if (state && ctx->Visual.DepthBits==0) { + _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); + return; + } + if (ctx->Depth.Test==state) + return; + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.Test = state; + break; + case GL_DITHER: + if (ctx->NoDither) { + state = GL_FALSE; /* MESA_NO_DITHER env var */ + } + if (ctx->Color.DitherFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.DitherFlag = state; + break; + case GL_FOG: + if (ctx->Fog.Enabled==state) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Enabled = state; + ctx->_Enabled ^= ENABLE_FOG; + break; + case GL_HISTOGRAM: + if (!ctx->Extensions.EXT_histogram) { + gl_error(ctx, GL_INVALID_ENUM, "enable GL_HISTOGRAM"); + return; + } + if (ctx->Pixel.HistogramEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.HistogramEnabled = state; + break; + case GL_LIGHT0: + case GL_LIGHT1: + case GL_LIGHT2: + case GL_LIGHT3: + case GL_LIGHT4: + case GL_LIGHT5: + case GL_LIGHT6: + case GL_LIGHT7: + if (ctx->Light.Light[cap-GL_LIGHT0].Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; + if (state) { + insert_at_tail(&ctx->Light.EnabledList, + &ctx->Light.Light[cap-GL_LIGHT0]); + } + else { + remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); + } + break; + case GL_LIGHTING: + if (ctx->Light.Enabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Enabled = state; + ctx->_Enabled ^= ENABLE_LIGHT; + break; + case GL_LINE_SMOOTH: + if (ctx->Line.SmoothFlag == state) + return; + FLUSH_VERTICES(ctx, _NEW_LINE); + ctx->Line.SmoothFlag = state; + ctx->_TriangleCaps ^= DD_LINE_SMOOTH; + break; + case GL_LINE_STIPPLE: + if (ctx->Line.StippleFlag == state) + return; + FLUSH_VERTICES(ctx, _NEW_LINE); + ctx->Line.StippleFlag = state; + ctx->_TriangleCaps ^= DD_LINE_STIPPLE; + break; + case GL_INDEX_LOGIC_OP: + if (ctx->Color.IndexLogicOpEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.IndexLogicOpEnabled = state; + break; + case GL_COLOR_LOGIC_OP: + if (ctx->Color.ColorLogicOpEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.ColorLogicOpEnabled = state; + break; + case GL_MAP1_COLOR_4: + if (ctx->Eval.Map1Color4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Color4 = state; + break; + case GL_MAP1_INDEX: + if (ctx->Eval.Map1Index == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Index = state; + break; + case GL_MAP1_NORMAL: + if (ctx->Eval.Map1Normal == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Normal = state; + break; + case GL_MAP1_TEXTURE_COORD_1: + if (ctx->Eval.Map1TextureCoord1 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord1 = state; + break; + case GL_MAP1_TEXTURE_COORD_2: + if (ctx->Eval.Map1TextureCoord2 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord2 = state; + break; + case GL_MAP1_TEXTURE_COORD_3: + if (ctx->Eval.Map1TextureCoord3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord3 = state; + break; + case GL_MAP1_TEXTURE_COORD_4: + if (ctx->Eval.Map1TextureCoord4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1TextureCoord4 = state; + break; + case GL_MAP1_VERTEX_3: + if (ctx->Eval.Map1Vertex3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Vertex3 = state; + break; + case GL_MAP1_VERTEX_4: + if (ctx->Eval.Map1Vertex4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map1Vertex4 = state; + break; + case GL_MAP2_COLOR_4: + if (ctx->Eval.Map2Color4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Color4 = state; + break; + case GL_MAP2_INDEX: + if (ctx->Eval.Map2Index == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Index = state; + break; + case GL_MAP2_NORMAL: + if (ctx->Eval.Map2Normal == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Normal = state; + break; + case GL_MAP2_TEXTURE_COORD_1: + if (ctx->Eval.Map2TextureCoord1 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord1 = state; + break; + case GL_MAP2_TEXTURE_COORD_2: + if (ctx->Eval.Map2TextureCoord2 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord2 = state; + break; + case GL_MAP2_TEXTURE_COORD_3: + if (ctx->Eval.Map2TextureCoord3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord3 = state; + break; + case GL_MAP2_TEXTURE_COORD_4: + if (ctx->Eval.Map2TextureCoord4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2TextureCoord4 = state; + break; + case GL_MAP2_VERTEX_3: + if (ctx->Eval.Map2Vertex3 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Vertex3 = state; + break; + case GL_MAP2_VERTEX_4: + if (ctx->Eval.Map2Vertex4 == state) + return; + FLUSH_VERTICES(ctx, _NEW_EVAL); + ctx->Eval.Map2Vertex4 = state; + break; + case GL_MINMAX: + if (ctx->Pixel.MinMaxEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.MinMaxEnabled = state; + break; + case GL_NORMALIZE: + if (ctx->Transform.Normalize == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.Normalize = state; + ctx->_Enabled ^= ENABLE_NORMALIZE; + break; + case GL_POINT_SMOOTH: + if (ctx->Point.SmoothFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.SmoothFlag = state; + ctx->_TriangleCaps ^= DD_POINT_SMOOTH; + break; + case GL_POLYGON_SMOOTH: + if (ctx->Polygon.SmoothFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.SmoothFlag = state; + ctx->_TriangleCaps ^= DD_TRI_SMOOTH; + break; + case GL_POLYGON_STIPPLE: + if (ctx->Polygon.StippleFlag==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.StippleFlag = state; + ctx->_TriangleCaps ^= DD_TRI_STIPPLE; + break; + case GL_POLYGON_OFFSET_POINT: + if (ctx->Polygon.OffsetPoint==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.OffsetPoint = state; + break; + case GL_POLYGON_OFFSET_LINE: + if (ctx->Polygon.OffsetLine==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.OffsetLine = state; + break; + case GL_POLYGON_OFFSET_FILL: /*case GL_POLYGON_OFFSET_EXT:*/ - if (ctx->Polygon.OffsetFill!=state) { - ctx->Polygon.OffsetFill = state; - ctx->NewState |= _NEW_POLYGON; - } - break; - case GL_RESCALE_NORMAL_EXT: - if (ctx->Transform.RescaleNormals != state) { - ctx->Transform.RescaleNormals = state; - ctx->NewState |= _NEW_TRANSFORM; - ctx->_Enabled ^= ENABLE_RESCALE; - } - break; - case GL_SCISSOR_TEST: - if (ctx->Scissor.Enabled!=state) { - ctx->Scissor.Enabled = state; - ctx->NewState |= _NEW_SCISSOR; - } - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - ctx->Texture.SharedPalette = state; - ctx->NewState |= _NEW_TEXTURE; - break; - case GL_STENCIL_TEST: - if (state && ctx->Visual.StencilBits==0) { - _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer"); - return; - } - if (ctx->Stencil.Enabled!=state) { - ctx->Stencil.Enabled = state; - ctx->NewState |= _NEW_STENCIL; - ctx->_TriangleCaps ^= DD_STENCIL; - } - break; - case GL_TEXTURE_1D: - if (ctx->Visual.RGBAflag) { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - ctx->NewState |= _NEW_TEXTURE; - if (state) { - texUnit->Enabled |= TEXTURE0_1D; - } - else { - texUnit->Enabled &= ~TEXTURE0_1D; - } - } - break; - case GL_TEXTURE_2D: - if (ctx->Visual.RGBAflag) { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - ctx->NewState |= _NEW_TEXTURE; - if (state) { - texUnit->Enabled |= TEXTURE0_2D; - } - else { - texUnit->Enabled &= ~TEXTURE0_2D; - } - } - break; - case GL_TEXTURE_3D: - if (ctx->Visual.RGBAflag) { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - ctx->NewState |= _NEW_TEXTURE; - if (state) { - texUnit->Enabled |= TEXTURE0_3D; - } - else { - texUnit->Enabled &= ~TEXTURE0_3D; - } - } - break; - case GL_TEXTURE_GEN_Q: - { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - if (state) - texUnit->TexGenEnabled |= Q_BIT; - else - texUnit->TexGenEnabled &= ~Q_BIT; - ctx->NewState |= _NEW_TEXTURE; - } - break; - case GL_TEXTURE_GEN_R: - { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - if (state) - texUnit->TexGenEnabled |= R_BIT; - else - texUnit->TexGenEnabled &= ~R_BIT; - ctx->NewState |= _NEW_TEXTURE; - } - break; - case GL_TEXTURE_GEN_S: - { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - if (state) - texUnit->TexGenEnabled |= S_BIT; - else - texUnit->TexGenEnabled &= ~S_BIT; - ctx->NewState |= _NEW_TEXTURE; - } - break; - case GL_TEXTURE_GEN_T: - { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - if (state) - texUnit->TexGenEnabled |= T_BIT; - else - texUnit->TexGenEnabled &= ~T_BIT; - ctx->NewState |= _NEW_TEXTURE; - } - break; - - /* - * CLIENT STATE!!! - */ - case GL_VERTEX_ARRAY: - ctx->Array.Vertex.Enabled = state; - ctx->NewState |= _NEW_ARRAY; - break; - case GL_NORMAL_ARRAY: - ctx->Array.Normal.Enabled = state; - ctx->NewState |= _NEW_ARRAY; - break; - case GL_COLOR_ARRAY: - ctx->Array.Color.Enabled = state; - ctx->NewState |= _NEW_ARRAY; - break; - case GL_INDEX_ARRAY: - ctx->Array.Index.Enabled = state; - ctx->NewState |= _NEW_ARRAY; - break; - case GL_TEXTURE_COORD_ARRAY: - ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state; - ctx->NewState |= _NEW_ARRAY; - break; - case GL_EDGE_FLAG_ARRAY: - ctx->Array.EdgeFlag.Enabled = state; - ctx->NewState |= _NEW_ARRAY; - break; + if (ctx->Polygon.OffsetFill==state) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.OffsetFill = state; + break; + case GL_RESCALE_NORMAL_EXT: + if (ctx->Transform.RescaleNormals == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.RescaleNormals = state; + ctx->_Enabled ^= ENABLE_RESCALE; + break; + case GL_SCISSOR_TEST: + if (ctx->Scissor.Enabled==state) + return; + FLUSH_VERTICES(ctx, _NEW_SCISSOR); + ctx->Scissor.Enabled = state; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + if (ctx->Texture.SharedPalette == state) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + ctx->Texture.SharedPalette = state; + break; + case GL_STENCIL_TEST: + if (state && ctx->Visual.StencilBits==0) { + _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer"); + return; + } + if (ctx->Stencil.Enabled==state) + return; + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.Enabled = state; + ctx->_TriangleCaps ^= DD_STENCIL; + break; + case GL_TEXTURE_1D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE0_1D; + if (state) + newenabled |= TEXTURE0_1D; + if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; + } + case GL_TEXTURE_2D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE0_2D; + if (state) + newenabled |= TEXTURE0_2D; + if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; + } + case GL_TEXTURE_3D: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE0_3D; + if (state) + newenabled |= TEXTURE0_3D; + if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; + } + case GL_TEXTURE_GEN_Q: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~Q_BIT; + if (state) + newenabled |= Q_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; + } + case GL_TEXTURE_GEN_R: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~R_BIT; + if (state) + newenabled |= R_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; + } + break; + case GL_TEXTURE_GEN_S: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~S_BIT; + if (state) + newenabled |= S_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; + } + break; + case GL_TEXTURE_GEN_T: { + GLuint unit = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint newenabled = texUnit->TexGenEnabled & ~T_BIT; + if (state) + newenabled |= T_BIT; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + break; + } + break; + + /* + * CLIENT STATE!!! + */ + case GL_VERTEX_ARRAY: + case GL_NORMAL_ARRAY: + case GL_COLOR_ARRAY: + case GL_INDEX_ARRAY: + case GL_TEXTURE_COORD_ARRAY: + case GL_EDGE_FLAG_ARRAY: + case GL_FOG_COORDINATE_ARRAY_EXT: + case GL_SECONDARY_COLOR_ARRAY_EXT: + client_state( ctx, cap, state ); + return; /* GL_HP_occlusion_test */ - case GL_OCCLUSION_TEST_HP: - if (ctx->Extensions.HP_occlusion_test) { - ctx->Depth.OcclusionTest = state; - ctx->NewState |= _NEW_DEPTH; - if (state) - ctx->OcclusionResult = ctx->OcclusionResultSaved; - else - ctx->OcclusionResultSaved = ctx->OcclusionResult; - } - else { - gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - break; + case GL_OCCLUSION_TEST_HP: + if (!ctx->Extensions.HP_occlusion_test) { + gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); + return; + } + if (ctx->Depth.OcclusionTest == state) + return; + FLUSH_VERTICES(ctx, _NEW_DEPTH); + ctx->Depth.OcclusionTest = state; + if (state) + ctx->OcclusionResult = ctx->OcclusionResultSaved; + else + ctx->OcclusionResultSaved = ctx->OcclusionResult; + break; /* GL_SGIS_pixel_texture */ - case GL_PIXEL_TEXTURE_SGIS: - if (ctx->Extensions.SGIS_pixel_texture) { - ctx->Pixel.PixelTextureEnabled = state; - ctx->NewState |= _NEW_PIXEL; - } - else { - gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - break; + case GL_PIXEL_TEXTURE_SGIS: + if (!ctx->Extensions.SGIS_pixel_texture) { + gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); + return; + } + if (ctx->Pixel.PixelTextureEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PixelTextureEnabled = state; + break; /* GL_SGIX_pixel_texture */ - case GL_PIXEL_TEX_GEN_SGIX: - if (ctx->Extensions.SGIX_pixel_texture) { - ctx->Pixel.PixelTextureEnabled = state; - ctx->NewState |= _NEW_PIXEL; - } - else { - gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - break; + case GL_PIXEL_TEX_GEN_SGIX: + if (!ctx->Extensions.SGIX_pixel_texture) { + gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); + return; + } + if (ctx->Pixel.PixelTextureEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PixelTextureEnabled = state; + break; /* GL_SGI_color_table */ - case GL_COLOR_TABLE_SGI: - if (ctx->Extensions.SGI_color_table) { - ctx->Pixel.ColorTableEnabled = state; - ctx->NewState |= _NEW_PIXEL; - } - else { - gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - if (ctx->Extensions.SGI_color_table) { - ctx->Pixel.PostConvolutionColorTableEnabled = state; - ctx->NewState |= _NEW_PIXEL; - } - else { - gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - if (ctx->Extensions.SGI_color_table) { - ctx->Pixel.PostColorMatrixColorTableEnabled = state; - ctx->NewState |= _NEW_PIXEL; - } - else { - gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); - return; - } - break; + case GL_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_color_table) { + gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); + return; + } + if (ctx->Pixel.ColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.ColorTableEnabled = state; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_color_table) { + gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); + return; + } + if (ctx->Pixel.PostConvolutionColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostConvolutionColorTableEnabled = state; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + if (!ctx->Extensions.SGI_color_table) { + gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); + return; + } + if (ctx->Pixel.PostColorMatrixColorTableEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.PostColorMatrixColorTableEnabled = state; + break; /* GL_EXT_convolution */ - case GL_CONVOLUTION_1D: - if (ctx->Extensions.EXT_convolution) { - ctx->Pixel.Convolution1DEnabled = state; - ctx->NewState |= _NEW_PIXEL; - } - else { - gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - break; - case GL_CONVOLUTION_2D: - if (ctx->Extensions.EXT_convolution) { - ctx->Pixel.Convolution2DEnabled = state; - ctx->NewState |= _NEW_PIXEL; - } - else { - gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - break; - case GL_SEPARABLE_2D: - if (ctx->Extensions.EXT_convolution) { - ctx->Pixel.Separable2DEnabled = state; - ctx->NewState |= _NEW_PIXEL; - } - else { - gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - break; + case GL_CONVOLUTION_1D: + if (!ctx->Extensions.EXT_convolution) { + gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; + } + if (ctx->Pixel.Convolution1DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Convolution1DEnabled = state; + break; + case GL_CONVOLUTION_2D: + if (!ctx->Extensions.EXT_convolution) { + gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; + } + if (ctx->Pixel.Convolution2DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Convolution2DEnabled = state; + break; + case GL_SEPARABLE_2D: + if (!ctx->Extensions.EXT_convolution) { + gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; + } + if (ctx->Pixel.Separable2DEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); + ctx->Pixel.Separable2DEnabled = state; + break; /* GL_ARB_texture_cube_map */ - case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) { - if (ctx->Visual.RGBAflag) { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - ctx->NewState |= _NEW_TEXTURE; - if (state) { - texUnit->Enabled |= TEXTURE0_CUBE; - } - else { - texUnit->Enabled &= ~TEXTURE0_CUBE; - } - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - break; - + case GL_TEXTURE_CUBE_MAP_ARB: { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE0_CUBE; + if (state) + newenabled |= TEXTURE0_CUBE; + if (!ctx->Extensions.ARB_texture_cube_map) { + gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; + } + if (!ctx->Visual.RGBAflag || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + break; + } /* GL_EXT_secondary_color */ - case GL_COLOR_SUM_EXT: - if (ctx->Extensions.EXT_secondary_color) { - ctx->Fog.ColorSumEnabled = state; - if (state) - SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); - else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR) - CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); - ctx->NewState |= _NEW_FOG; - } - else { - gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - break; + case GL_COLOR_SUM_EXT: + if (!ctx->Extensions.EXT_secondary_color) { + gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; + } + if (ctx->Fog.ColorSumEnabled == state) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.ColorSumEnabled = state; + ctx->_TriangleCaps ^= DD_SEPERATE_SPECULAR; + break; /* GL_MESA_sprite_point */ - case GL_SPRITE_POINT_MESA: - if (ctx->Extensions.MESA_sprite_point) { - ctx->Point.SpriteMode = state; - ctx->NewState |= _NEW_POINT; - } - else { - gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; - } - break; - - default: - gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); - return; + case GL_SPRITE_POINT_MESA: + if (!ctx->Extensions.MESA_sprite_point) { + gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; + } + if (ctx->Point.SpriteMode == state) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.SpriteMode = state; + break; + + default: + gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; } if (ctx->Driver.Enable) { @@ -895,61 +995,6 @@ _mesa_IsEnabled( GLenum cap ) -static void -client_state( GLcontext *ctx, GLenum cap, GLboolean state ) -{ - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, - (state - ? "glEnableClientState" - : "glDisableClientState") ); - - switch (cap) { - case GL_VERTEX_ARRAY: - ctx->Array.Vertex.Enabled = state; - break; - case GL_NORMAL_ARRAY: - ctx->Array.Normal.Enabled = state; - break; - case GL_COLOR_ARRAY: - ctx->Array.Color.Enabled = state; - break; - case GL_INDEX_ARRAY: - ctx->Array.Index.Enabled = state; - break; - case GL_TEXTURE_COORD_ARRAY: - ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state; - break; - case GL_EDGE_FLAG_ARRAY: - ctx->Array.EdgeFlag.Enabled = state; - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - ctx->Array.FogCoord.Enabled = state; - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - ctx->Array.SecondaryColor.Enabled = state; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); - } - - ctx->NewState |= _NEW_ARRAY; -} - -void -_mesa_EnableClientState( GLenum cap ) -{ - GET_CURRENT_CONTEXT(ctx); - client_state( ctx, cap, GL_TRUE ); -} - - - -void -_mesa_DisableClientState( GLenum cap ) -{ - GET_CURRENT_CONTEXT(ctx); - client_state( ctx, cap, GL_FALSE ); -} diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 8bf8929e78b..3d5e4c72050 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -1,4 +1,4 @@ -/* $Id: eval.c,v 1.16 2000/11/22 07:32:16 joukj Exp $ */ +/* $Id: eval.c,v 1.17 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -234,104 +234,6 @@ GLfloat *gl_copy_map_points2d(GLenum target, } -#if 00 -/* - * This function is called by the display list deallocator function to - * specify that a given set of control points are no longer needed. - */ -void gl_free_control_points( GLcontext* ctx, GLenum target, GLfloat *data ) -{ - struct gl_1d_map *map1 = NULL; - struct gl_2d_map *map2 = NULL; - - switch (target) { - case GL_MAP1_VERTEX_3: - map1 = &ctx->EvalMap.Map1Vertex3; - break; - case GL_MAP1_VERTEX_4: - map1 = &ctx->EvalMap.Map1Vertex4; - break; - case GL_MAP1_INDEX: - map1 = &ctx->EvalMap.Map1Index; - break; - case GL_MAP1_COLOR_4: - map1 = &ctx->EvalMap.Map1Color4; - break; - case GL_MAP1_NORMAL: - map1 = &ctx->EvalMap.Map1Normal; - break; - case GL_MAP1_TEXTURE_COORD_1: - map1 = &ctx->EvalMap.Map1Texture1; - break; - case GL_MAP1_TEXTURE_COORD_2: - map1 = &ctx->EvalMap.Map1Texture2; - break; - case GL_MAP1_TEXTURE_COORD_3: - map1 = &ctx->EvalMap.Map1Texture3; - break; - case GL_MAP1_TEXTURE_COORD_4: - map1 = &ctx->EvalMap.Map1Texture4; - break; - case GL_MAP2_VERTEX_3: - map2 = &ctx->EvalMap.Map2Vertex3; - break; - case GL_MAP2_VERTEX_4: - map2 = &ctx->EvalMap.Map2Vertex4; - break; - case GL_MAP2_INDEX: - map2 = &ctx->EvalMap.Map2Index; - break; - case GL_MAP2_COLOR_4: - map2 = &ctx->EvalMap.Map2Color4; - break; - case GL_MAP2_NORMAL: - map2 = &ctx->EvalMap.Map2Normal; - break; - case GL_MAP2_TEXTURE_COORD_1: - map2 = &ctx->EvalMap.Map2Texture1; - break; - case GL_MAP2_TEXTURE_COORD_2: - map2 = &ctx->EvalMap.Map2Texture2; - break; - case GL_MAP2_TEXTURE_COORD_3: - map2 = &ctx->EvalMap.Map2Texture3; - break; - case GL_MAP2_TEXTURE_COORD_4: - map2 = &ctx->EvalMap.Map2Texture4; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "gl_free_control_points" ); - return; - } - - if (map1) { - if (data==map1->Points) { - /* The control points in the display list are currently */ - /* being used so we can mark them as discard-able. */ - map1->Retain = GL_FALSE; - } - else { - /* The control points in the display list are not currently */ - /* being used. */ - FREE( data ); - } - } - if (map2) { - if (data==map2->Points) { - /* The control points in the display list are currently */ - /* being used so we can mark them as discard-able. */ - map2->Retain = GL_FALSE; - } - else { - /* The control points in the display list are not currently */ - /* being used. */ - FREE( data ); - } - } - -} -#endif - /**********************************************************************/ @@ -349,8 +251,8 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GET_CURRENT_CONTEXT(ctx); GLint k; GLfloat *pnts; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap1"); + struct gl_1d_map *map = 0; + ASSERT_OUTSIDE_BEGIN_END(ctx); assert(type == GL_FLOAT || type == GL_DOUBLE); @@ -377,99 +279,54 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, return; } - /* make copy of the control points */ - if (type == GL_FLOAT) - pnts = gl_copy_map_points1f(target, ustride, uorder, (GLfloat*) points); - else - pnts = gl_copy_map_points1d(target, ustride, uorder, (GLdouble*) points); - switch (target) { case GL_MAP1_VERTEX_3: - ctx->EvalMap.Map1Vertex3.Order = uorder; - ctx->EvalMap.Map1Vertex3.u1 = u1; - ctx->EvalMap.Map1Vertex3.u2 = u2; - ctx->EvalMap.Map1Vertex3.du = 1.0 / (u2 - u1); - if (ctx->EvalMap.Map1Vertex3.Points) - FREE( ctx->EvalMap.Map1Vertex3.Points ); - ctx->EvalMap.Map1Vertex3.Points = pnts; + map = &ctx->EvalMap.Map1Vertex3; break; case GL_MAP1_VERTEX_4: - ctx->EvalMap.Map1Vertex4.Order = uorder; - ctx->EvalMap.Map1Vertex4.u1 = u1; - ctx->EvalMap.Map1Vertex4.u2 = u2; - ctx->EvalMap.Map1Vertex4.du = 1.0 / (u2 - u1); - if (ctx->EvalMap.Map1Vertex4.Points) - FREE( ctx->EvalMap.Map1Vertex4.Points ); - ctx->EvalMap.Map1Vertex4.Points = pnts; + map = &ctx->EvalMap.Map1Vertex4; break; case GL_MAP1_INDEX: - ctx->EvalMap.Map1Index.Order = uorder; - ctx->EvalMap.Map1Index.u1 = u1; - ctx->EvalMap.Map1Index.u2 = u2; - ctx->EvalMap.Map1Index.du = 1.0 / (u2 - u1); - if (ctx->EvalMap.Map1Index.Points) - FREE( ctx->EvalMap.Map1Index.Points ); - ctx->EvalMap.Map1Index.Points = pnts; + map = &ctx->EvalMap.Map1Index; break; case GL_MAP1_COLOR_4: - ctx->EvalMap.Map1Color4.Order = uorder; - ctx->EvalMap.Map1Color4.u1 = u1; - ctx->EvalMap.Map1Color4.u2 = u2; - ctx->EvalMap.Map1Color4.du = 1.0 / (u2 - u1); - if (ctx->EvalMap.Map1Color4.Points) - FREE( ctx->EvalMap.Map1Color4.Points ); - ctx->EvalMap.Map1Color4.Points = pnts; + map = &ctx->EvalMap.Map1Color4; break; case GL_MAP1_NORMAL: - ctx->EvalMap.Map1Normal.Order = uorder; - ctx->EvalMap.Map1Normal.u1 = u1; - ctx->EvalMap.Map1Normal.u2 = u2; - ctx->EvalMap.Map1Normal.du = 1.0 / (u2 - u1); - if (ctx->EvalMap.Map1Normal.Points) - FREE( ctx->EvalMap.Map1Normal.Points ); - ctx->EvalMap.Map1Normal.Points = pnts; + map = &ctx->EvalMap.Map1Normal; break; case GL_MAP1_TEXTURE_COORD_1: - ctx->EvalMap.Map1Texture1.Order = uorder; - ctx->EvalMap.Map1Texture1.u1 = u1; - ctx->EvalMap.Map1Texture1.u2 = u2; - ctx->EvalMap.Map1Texture1.du = 1.0 / (u2 - u1); - if (ctx->EvalMap.Map1Texture1.Points) - FREE( ctx->EvalMap.Map1Texture1.Points ); - ctx->EvalMap.Map1Texture1.Points = pnts; + map = &ctx->EvalMap.Map1Texture1; break; case GL_MAP1_TEXTURE_COORD_2: - ctx->EvalMap.Map1Texture2.Order = uorder; - ctx->EvalMap.Map1Texture2.u1 = u1; - ctx->EvalMap.Map1Texture2.u2 = u2; - ctx->EvalMap.Map1Texture2.du = 1.0 / (u2 - u1); - if (ctx->EvalMap.Map1Texture2.Points) - FREE( ctx->EvalMap.Map1Texture2.Points ); - ctx->EvalMap.Map1Texture2.Points = pnts; + map = &ctx->EvalMap.Map1Texture2; break; case GL_MAP1_TEXTURE_COORD_3: - ctx->EvalMap.Map1Texture3.Order = uorder; - ctx->EvalMap.Map1Texture3.u1 = u1; - ctx->EvalMap.Map1Texture3.u2 = u2; - ctx->EvalMap.Map1Texture3.du = 1.0 / (u2 - u1); - if (ctx->EvalMap.Map1Texture3.Points) - FREE( ctx->EvalMap.Map1Texture3.Points ); - ctx->EvalMap.Map1Texture3.Points = pnts; + map = &ctx->EvalMap.Map1Texture3; break; case GL_MAP1_TEXTURE_COORD_4: - ctx->EvalMap.Map1Texture4.Order = uorder; - ctx->EvalMap.Map1Texture4.u1 = u1; - ctx->EvalMap.Map1Texture4.u2 = u2; - ctx->EvalMap.Map1Texture4.du = 1.0 / (u2 - u1); - if (ctx->EvalMap.Map1Texture4.Points) - FREE( ctx->EvalMap.Map1Texture4.Points ); - ctx->EvalMap.Map1Texture4.Points = pnts; + map = &ctx->EvalMap.Map1Texture4; break; default: gl_error( ctx, GL_INVALID_ENUM, "glMap1(target)" ); + return; } - ctx->NewState |= _NEW_EVAL; + /* make copy of the control points */ + if (type == GL_FLOAT) + pnts = gl_copy_map_points1f(target, ustride, uorder, (GLfloat*) points); + else + pnts = gl_copy_map_points1d(target, ustride, uorder, (GLdouble*) points); + + + FLUSH_VERTICES(ctx, _NEW_EVAL); + map->Order = uorder; + map->u1 = u1; + map->u2 = u2; + map->du = 1.0 / (u2 - u1); + if (map->Points) + FREE( map->Points ); + map->Points = pnts; } @@ -498,8 +355,8 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GET_CURRENT_CONTEXT(ctx); GLint k; GLfloat *pnts; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMap2"); + struct gl_2d_map *map = 0; + ASSERT_OUTSIDE_BEGIN_END(ctx); if (u1==u2) { gl_error( ctx, GL_INVALID_VALUE, "glMap2(u1,u2)" ); @@ -535,137 +392,60 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, return; } - /* make copy of the control points */ - if (type == GL_FLOAT) - pnts = gl_copy_map_points2f(target, ustride, uorder, - vstride, vorder, (GLfloat*) points); - else - pnts = gl_copy_map_points2d(target, ustride, uorder, - vstride, vorder, (GLdouble*) points); - switch (target) { case GL_MAP2_VERTEX_3: - ctx->EvalMap.Map2Vertex3.Uorder = uorder; - ctx->EvalMap.Map2Vertex3.u1 = u1; - ctx->EvalMap.Map2Vertex3.u2 = u2; - ctx->EvalMap.Map2Vertex3.du = 1.0 / (u2 - u1); - ctx->EvalMap.Map2Vertex3.Vorder = vorder; - ctx->EvalMap.Map2Vertex3.v1 = v1; - ctx->EvalMap.Map2Vertex3.v2 = v2; - ctx->EvalMap.Map2Vertex3.dv = 1.0 / (v2 - v1); - if (ctx->EvalMap.Map2Vertex3.Points) - FREE( ctx->EvalMap.Map2Vertex3.Points ); - ctx->EvalMap.Map2Vertex3.Points = pnts; + map = &ctx->EvalMap.Map2Vertex3; break; case GL_MAP2_VERTEX_4: - ctx->EvalMap.Map2Vertex4.Uorder = uorder; - ctx->EvalMap.Map2Vertex4.u1 = u1; - ctx->EvalMap.Map2Vertex4.u2 = u2; - ctx->EvalMap.Map2Vertex4.du = 1.0 / (u2 - u1); - ctx->EvalMap.Map2Vertex4.Vorder = vorder; - ctx->EvalMap.Map2Vertex4.v1 = v1; - ctx->EvalMap.Map2Vertex4.v2 = v2; - ctx->EvalMap.Map2Vertex4.dv = 1.0 / (v2 - v1); - if (ctx->EvalMap.Map2Vertex4.Points) - FREE( ctx->EvalMap.Map2Vertex4.Points ); - ctx->EvalMap.Map2Vertex4.Points = pnts; + map = &ctx->EvalMap.Map2Vertex4; break; case GL_MAP2_INDEX: - ctx->EvalMap.Map2Index.Uorder = uorder; - ctx->EvalMap.Map2Index.u1 = u1; - ctx->EvalMap.Map2Index.u2 = u2; - ctx->EvalMap.Map2Index.du = 1.0 / (u2 - u1); - ctx->EvalMap.Map2Index.Vorder = vorder; - ctx->EvalMap.Map2Index.v1 = v1; - ctx->EvalMap.Map2Index.v2 = v2; - ctx->EvalMap.Map2Index.dv = 1.0 / (v2 - v1); - if (ctx->EvalMap.Map2Index.Points) - FREE( ctx->EvalMap.Map2Index.Points ); - ctx->EvalMap.Map2Index.Points = pnts; + map = &ctx->EvalMap.Map2Index; break; case GL_MAP2_COLOR_4: - ctx->EvalMap.Map2Color4.Uorder = uorder; - ctx->EvalMap.Map2Color4.u1 = u1; - ctx->EvalMap.Map2Color4.u2 = u2; - ctx->EvalMap.Map2Color4.du = 1.0 / (u2 - u1); - ctx->EvalMap.Map2Color4.Vorder = vorder; - ctx->EvalMap.Map2Color4.v1 = v1; - ctx->EvalMap.Map2Color4.v2 = v2; - ctx->EvalMap.Map2Color4.dv = 1.0 / (v2 - v1); - if (ctx->EvalMap.Map2Color4.Points) - FREE( ctx->EvalMap.Map2Color4.Points ); - ctx->EvalMap.Map2Color4.Points = pnts; + map = &ctx->EvalMap.Map2Color4; break; case GL_MAP2_NORMAL: - ctx->EvalMap.Map2Normal.Uorder = uorder; - ctx->EvalMap.Map2Normal.u1 = u1; - ctx->EvalMap.Map2Normal.u2 = u2; - ctx->EvalMap.Map2Normal.du = 1.0 / (u2 - u1); - ctx->EvalMap.Map2Normal.Vorder = vorder; - ctx->EvalMap.Map2Normal.v1 = v1; - ctx->EvalMap.Map2Normal.v2 = v2; - ctx->EvalMap.Map2Normal.dv = 1.0 / (v2 - v1); - if (ctx->EvalMap.Map2Normal.Points) - FREE( ctx->EvalMap.Map2Normal.Points ); - ctx->EvalMap.Map2Normal.Points = pnts; + map = &ctx->EvalMap.Map2Normal; break; case GL_MAP2_TEXTURE_COORD_1: - ctx->EvalMap.Map2Texture1.Uorder = uorder; - ctx->EvalMap.Map2Texture1.u1 = u1; - ctx->EvalMap.Map2Texture1.u2 = u2; - ctx->EvalMap.Map2Texture1.du = 1.0 / (u2 - u1); - ctx->EvalMap.Map2Texture1.Vorder = vorder; - ctx->EvalMap.Map2Texture1.v1 = v1; - ctx->EvalMap.Map2Texture1.v2 = v2; - ctx->EvalMap.Map2Texture1.dv = 1.0 / (v2 - v1); - if (ctx->EvalMap.Map2Texture1.Points) - FREE( ctx->EvalMap.Map2Texture1.Points ); - ctx->EvalMap.Map2Texture1.Points = pnts; + map = &ctx->EvalMap.Map2Texture1; break; case GL_MAP2_TEXTURE_COORD_2: - ctx->EvalMap.Map2Texture2.Uorder = uorder; - ctx->EvalMap.Map2Texture2.u1 = u1; - ctx->EvalMap.Map2Texture2.u2 = u2; - ctx->EvalMap.Map2Texture2.du = 1.0 / (u2 - u1); - ctx->EvalMap.Map2Texture2.Vorder = vorder; - ctx->EvalMap.Map2Texture2.v1 = v1; - ctx->EvalMap.Map2Texture2.v2 = v2; - ctx->EvalMap.Map2Texture2.dv = 1.0 / (v2 - v1); - if (ctx->EvalMap.Map2Texture2.Points) - FREE( ctx->EvalMap.Map2Texture2.Points ); - ctx->EvalMap.Map2Texture2.Points = pnts; + map = &ctx->EvalMap.Map2Texture2; break; case GL_MAP2_TEXTURE_COORD_3: - ctx->EvalMap.Map2Texture3.Uorder = uorder; - ctx->EvalMap.Map2Texture3.u1 = u1; - ctx->EvalMap.Map2Texture3.u2 = u2; - ctx->EvalMap.Map2Texture3.du = 1.0 / (u2 - u1); - ctx->EvalMap.Map2Texture3.Vorder = vorder; - ctx->EvalMap.Map2Texture3.v1 = v1; - ctx->EvalMap.Map2Texture3.v2 = v2; - ctx->EvalMap.Map2Texture3.dv = 1.0 / (v2 - v1); - if (ctx->EvalMap.Map2Texture3.Points) - FREE( ctx->EvalMap.Map2Texture3.Points ); - ctx->EvalMap.Map2Texture3.Points = pnts; + map = &ctx->EvalMap.Map2Texture3; break; case GL_MAP2_TEXTURE_COORD_4: - ctx->EvalMap.Map2Texture4.Uorder = uorder; - ctx->EvalMap.Map2Texture4.u1 = u1; - ctx->EvalMap.Map2Texture4.u2 = u2; - ctx->EvalMap.Map2Texture4.du = 1.0 / (u2 - u1); - ctx->EvalMap.Map2Texture4.Vorder = vorder; - ctx->EvalMap.Map2Texture4.v1 = v1; - ctx->EvalMap.Map2Texture4.v2 = v2; - ctx->EvalMap.Map2Texture4.dv = 1.0 / (v2 - v1); - if (ctx->EvalMap.Map2Texture4.Points) - FREE( ctx->EvalMap.Map2Texture4.Points ); - ctx->EvalMap.Map2Texture4.Points = pnts; + map = &ctx->EvalMap.Map2Texture4; break; default: gl_error( ctx, GL_INVALID_ENUM, "glMap2(target)" ); + return; } - ctx->NewState |= _NEW_EVAL; + /* make copy of the control points */ + if (type == GL_FLOAT) + pnts = gl_copy_map_points2f(target, ustride, uorder, + vstride, vorder, (GLfloat*) points); + else + pnts = gl_copy_map_points2d(target, ustride, uorder, + vstride, vorder, (GLdouble*) points); + + + FLUSH_VERTICES(ctx, _NEW_EVAL); + map->Uorder = uorder; + map->u1 = u1; + map->u2 = u2; + map->du = 1.0 / (u2 - u1); + map->Vorder = vorder; + map->v1 = v1; + map->v2 = v2; + map->dv = 1.0 / (v2 - v1); + if (map->Points) + FREE( map->Points ); + map->Points = pnts; } @@ -698,6 +478,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) GET_CURRENT_CONTEXT(ctx); GLint i, n; GLfloat *data; + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (query) { case GL_COEFF: @@ -971,6 +752,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) GET_CURRENT_CONTEXT(ctx); GLint i, n; GLfloat *data; + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (query) { case GL_COEFF: @@ -1244,6 +1026,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) GET_CURRENT_CONTEXT(ctx); GLuint i, n; GLfloat *data; + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (query) { case GL_COEFF: @@ -1516,18 +1299,17 @@ void _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid1f"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (un<1) { gl_error( ctx, GL_INVALID_VALUE, "glMapGrid1f" ); return; } + FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.MapGrid1un = un; ctx->Eval.MapGrid1u1 = u1; ctx->Eval.MapGrid1u2 = u2; ctx->Eval.MapGrid1du = (u2 - u1) / (GLfloat) un; - - ctx->NewState |= _NEW_EVAL; } @@ -1543,7 +1325,8 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMapGrid2f"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + if (un<1) { gl_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(un)" ); return; @@ -1552,6 +1335,8 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, gl_error( ctx, GL_INVALID_VALUE, "glMapGrid2f(vn)" ); return; } + + FLUSH_VERTICES(ctx, _NEW_EVAL); ctx->Eval.MapGrid2un = un; ctx->Eval.MapGrid2u1 = u1; ctx->Eval.MapGrid2u2 = u2; @@ -1560,8 +1345,6 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, ctx->Eval.MapGrid2v1 = v1; ctx->Eval.MapGrid2v2 = v2; ctx->Eval.MapGrid2dv = (v2 - v1) / (GLfloat) vn; - - ctx->NewState |= _NEW_EVAL; } diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index d9ed6a51734..4a1ebe0b97e 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -1,4 +1,4 @@ -/* $Id: feedback.c,v 1.17 2000/11/22 07:32:17 joukj Exp $ */ +/* $Id: feedback.c,v 1.18 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -52,7 +52,7 @@ void _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glFeedbackBuffer" ); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode==GL_FEEDBACK) { gl_error( ctx, GL_INVALID_OPERATION, "glFeedbackBuffer" ); @@ -65,45 +65,41 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) } if (!buffer) { gl_error( ctx, GL_INVALID_VALUE, "glFeedbackBuffer(buffer==NULL)" ); - ctx->Feedback.BufferSize = 0; + ctx->Feedback.BufferSize = 0; /* XXX -- Sould this be here??? */ return; } switch (type) { case GL_2D: - ctx->Feedback.Mask = 0; - ctx->Feedback.Type = type; + ctx->Feedback._Mask = 0; break; case GL_3D: - ctx->Feedback.Mask = FB_3D; - ctx->Feedback.Type = type; + ctx->Feedback._Mask = FB_3D; break; case GL_3D_COLOR: - ctx->Feedback.Mask = FB_3D - | (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX); - ctx->Feedback.Type = type; + ctx->Feedback._Mask = (FB_3D | + (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX)); break; case GL_3D_COLOR_TEXTURE: - ctx->Feedback.Mask = FB_3D - | (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX) - | FB_TEXTURE; - ctx->Feedback.Type = type; + ctx->Feedback._Mask = (FB_3D | + (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX) | + FB_TEXTURE); break; case GL_4D_COLOR_TEXTURE: - ctx->Feedback.Mask = FB_3D | FB_4D - | (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX) - | FB_TEXTURE; - ctx->Feedback.Type = type; + ctx->Feedback._Mask = (FB_3D | FB_4D | + (ctx->Visual.RGBAflag ? FB_COLOR : FB_INDEX) | + FB_TEXTURE); break; default: - ctx->Feedback.Mask = 0; gl_error( ctx, GL_INVALID_ENUM, "glFeedbackBuffer" ); + return; } + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); /* Always flush */ + ctx->Feedback.Type = type; ctx->Feedback.BufferSize = size; ctx->Feedback.Buffer = buffer; - ctx->Feedback.Count = 0; - ctx->NewState |= _NEW_FEEDBACK_SELECT; + ctx->Feedback.Count = 0; /* Becaues of this. */ } @@ -112,9 +108,10 @@ void _mesa_PassThrough( GLfloat token ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPassThrough"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->RenderMode==GL_FEEDBACK) { + FLUSH_VERTICES(ctx, 0); FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN ); FEEDBACK_TOKEN( ctx, token ); } @@ -133,22 +130,22 @@ void gl_feedback_vertex( GLcontext *ctx, { FEEDBACK_TOKEN( ctx, win[0] ); FEEDBACK_TOKEN( ctx, win[1] ); - if (ctx->Feedback.Mask & FB_3D) { + if (ctx->Feedback._Mask & FB_3D) { FEEDBACK_TOKEN( ctx, win[2] ); } - if (ctx->Feedback.Mask & FB_4D) { + if (ctx->Feedback._Mask & FB_4D) { FEEDBACK_TOKEN( ctx, win[3] ); } - if (ctx->Feedback.Mask & FB_INDEX) { + if (ctx->Feedback._Mask & FB_INDEX) { FEEDBACK_TOKEN( ctx, (GLfloat) index ); } - if (ctx->Feedback.Mask & FB_COLOR) { + if (ctx->Feedback._Mask & FB_COLOR) { FEEDBACK_TOKEN( ctx, color[0] ); FEEDBACK_TOKEN( ctx, color[1] ); FEEDBACK_TOKEN( ctx, color[2] ); FEEDBACK_TOKEN( ctx, color[3] ); } - if (ctx->Feedback.Mask & FB_TEXTURE) { + if (ctx->Feedback._Mask & FB_TEXTURE) { FEEDBACK_TOKEN( ctx, texcoord[0] ); FEEDBACK_TOKEN( ctx, texcoord[1] ); FEEDBACK_TOKEN( ctx, texcoord[2] ); @@ -168,19 +165,20 @@ void _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSelectBuffer"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + if (ctx->RenderMode==GL_SELECT) { gl_error( ctx, GL_INVALID_OPERATION, "glSelectBuffer" ); + return; /* KW: added return */ } + + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); /* why bother? */ ctx->Select.Buffer = buffer; ctx->Select.BufferSize = size; ctx->Select.BufferCount = 0; - ctx->Select.HitFlag = GL_FALSE; ctx->Select.HitMinZ = 1.0; ctx->Select.HitMaxZ = 0.0; - - ctx->NewState |= _NEW_FEEDBACK_SELECT; } @@ -235,7 +233,8 @@ void _mesa_InitNames( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glInitNames"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + /* Record the hit before the HitFlag is wiped out again. */ if (ctx->RenderMode == GL_SELECT) { if (ctx->Select.HitFlag) { @@ -246,7 +245,7 @@ _mesa_InitNames( void ) ctx->Select.HitFlag = GL_FALSE; ctx->Select.HitMinZ = 1.0; ctx->Select.HitMaxZ = 0.0; - ctx->NewState |= _NEW_FEEDBACK_SELECT; + ctx->NewState |= _NEW_RENDERMODE; } @@ -255,7 +254,8 @@ void _mesa_LoadName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLoadName"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + if (ctx->RenderMode != GL_SELECT) { return; } @@ -263,6 +263,9 @@ _mesa_LoadName( GLuint name ) gl_error( ctx, GL_INVALID_OPERATION, "glLoadName" ); return; } + + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); + if (ctx->Select.HitFlag) { write_hit_record( ctx ); } @@ -272,7 +275,6 @@ _mesa_LoadName( GLuint name ) else { ctx->Select.NameStack[MAX_NAME_STACK_DEPTH-1] = name; } - ctx->NewState |= _NEW_FEEDBACK_SELECT; } @@ -280,20 +282,21 @@ void _mesa_PushName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushName"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + if (ctx->RenderMode != GL_SELECT) { return; } + + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); if (ctx->Select.HitFlag) { write_hit_record( ctx ); } - if (ctx->Select.NameStackDepth < MAX_NAME_STACK_DEPTH) { - ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name; - } - else { + if (ctx->Select.NameStackDepth >= MAX_NAME_STACK_DEPTH) { gl_error( ctx, GL_STACK_OVERFLOW, "glPushName" ); } - ctx->NewState |= _NEW_FEEDBACK_SELECT; + else + ctx->Select.NameStack[ctx->Select.NameStackDepth++] = name; } @@ -302,20 +305,21 @@ void _mesa_PopName( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopName"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + if (ctx->RenderMode != GL_SELECT) { return; } + + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); if (ctx->Select.HitFlag) { write_hit_record( ctx ); } - if (ctx->Select.NameStackDepth > 0) { - ctx->Select.NameStackDepth--; - } - else { + if (ctx->Select.NameStackDepth == 0) { gl_error( ctx, GL_STACK_UNDERFLOW, "glPopName" ); } - ctx->NewState |= _NEW_FEEDBACK_SELECT; + else + ctx->Select.NameStackDepth--; } @@ -334,12 +338,12 @@ _mesa_RenderMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); GLint result; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glRenderMode", 0); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glRenderMode %s\n", gl_lookup_enum_by_nr(mode)); + FLUSH_VERTICES(ctx, _NEW_RENDERMODE); ctx->_TriangleCaps &= ~(DD_FEEDBACK|DD_SELECT); switch (ctx->RenderMode) { @@ -363,7 +367,6 @@ _mesa_RenderMode( GLenum mode ) ctx->Select.BufferCount = 0; ctx->Select.Hits = 0; ctx->Select.NameStackDepth = 0; - ctx->NewState |= _NEW_FEEDBACK_SELECT; break; case GL_FEEDBACK: if (ctx->Feedback.Count > ctx->Feedback.BufferSize) { @@ -374,7 +377,6 @@ _mesa_RenderMode( GLenum mode ) result = ctx->Feedback.Count; } ctx->Feedback.Count = 0; - ctx->NewState |= _NEW_FEEDBACK_SELECT; break; default: gl_error( ctx, GL_INVALID_ENUM, "glRenderMode" ); @@ -404,8 +406,6 @@ _mesa_RenderMode( GLenum mode ) } ctx->RenderMode = mode; - ctx->NewState |= _NEW_RENDERMODE; - return result; } diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index 0bf0f4824e2..2a225d4d876 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -1,4 +1,4 @@ -/* $Id: fog.c,v 1.30 2000/11/22 07:32:17 joukj Exp $ */ +/* $Id: fog.c,v 1.31 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -84,39 +84,57 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLenum m; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFog"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_FOG_MODE: m = (GLenum) (GLint) *params; - if (m==GL_LINEAR || m==GL_EXP || m==GL_EXP2) { - ctx->Fog.Mode = m; - } - else { + if (ctx->Fog.Mode == m) + return; + switch (m) { + case GL_LINEAR: + case GL_EXP: + case GL_EXP2: + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glFog" ); return; } + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Mode = m; break; case GL_FOG_DENSITY: if (*params<0.0) { gl_error( ctx, GL_INVALID_VALUE, "glFog" ); return; } - else { - ctx->Fog.Density = *params; - } + if (ctx->Fog.Density == *params) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Density = *params; break; case GL_FOG_START: + if (ctx->Fog.Start == *params) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.Start = *params; break; case GL_FOG_END: + if (ctx->Fog.End == *params) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.End = *params; break; case GL_FOG_INDEX: - ctx->Fog.Index = *params; + if (ctx->Fog.Index == *params) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.Index = *params; break; case GL_FOG_COLOR: + if (TEST_EQ_4V(ctx->Fog.Color, params)) + return; + FLUSH_VERTICES(ctx, _NEW_FOG); ctx->Fog.Color[0] = params[0]; ctx->Fog.Color[1] = params[1]; ctx->Fog.Color[2] = params[2]; @@ -124,10 +142,14 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) break; case GL_FOG_COORDINATE_SOURCE_EXT: { GLenum p = (GLenum)(GLint) *params; - if (p == GL_FOG_COORDINATE_EXT || p == GL_FRAGMENT_DEPTH_EXT) - ctx->Fog.FogCoordinateSource = p; - else + if (ctx->Fog.FogCoordinateSource == p) + return; + if (p != GL_FOG_COORDINATE_EXT && p != GL_FRAGMENT_DEPTH_EXT) { gl_error( ctx, GL_INVALID_ENUM, "glFog" ); + return; + } + FLUSH_VERTICES(ctx, _NEW_FOG); + ctx->Fog.FogCoordinateSource = p; break; } default: diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 30097737904..0a697280623 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.47 2000/12/09 20:35:32 brianp Exp $ */ +/* $Id: get.c,v 1.48 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -91,8 +91,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) GLuint texUnit = ctx->Texture.CurrentUnit; GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit; const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetBooleanv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (!params) return; @@ -228,18 +227,18 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ENUM_TO_BOOL(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = INT_TO_BOOL(ctx->Current.Color[0]); params[1] = INT_TO_BOOL(ctx->Current.Color[1]); params[2] = INT_TO_BOOL(ctx->Current.Color[2]); params[3] = INT_TO_BOOL(ctx->Current.Color[3]); break; case GL_CURRENT_INDEX: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = INT_TO_BOOL(ctx->Current.Index); break; case GL_CURRENT_NORMAL: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOL(ctx->Current.Normal[0]); params[1] = FLOAT_TO_BOOL(ctx->Current.Normal[1]); params[2] = FLOAT_TO_BOOL(ctx->Current.Normal[2]); @@ -272,7 +271,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][0]); params[1] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][1]); params[2] = FLOAT_TO_BOOL(ctx->Current.Texcoord[texTransformUnit][2]); @@ -313,7 +312,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ENUM_TO_BOOL(ctx->Color.DrawBuffer); break; case GL_EDGE_FLAG: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = ctx->Current.EdgeFlag; break; case GL_FEEDBACK_BUFFER_SIZE: @@ -554,10 +553,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(ctx->Const.MaxClipPlanes); break; case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ - *params = INT_TO_BOOL(VB_MAX); + *params = INT_TO_BOOL(ctx->Const.MaxArrayLockSize); break; case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */ - *params = INT_TO_BOOL(VB_MAX); + *params = INT_TO_BOOL(ctx->Const.MaxArrayLockSize); break; case GL_MAX_EVAL_ORDER: *params = INT_TO_BOOL(MAX_EVAL_ORDER); @@ -1271,7 +1270,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = INT_TO_BOOL(ctx->Current.SecondaryColor[0]); params[1] = INT_TO_BOOL(ctx->Current.SecondaryColor[1]); params[2] = INT_TO_BOOL(ctx->Current.SecondaryColor[2]); @@ -1291,7 +1290,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = FLOAT_TO_BOOL(ctx->Current.FogCoord); break; case GL_FOG_COORDINATE_ARRAY_EXT: @@ -1331,8 +1330,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) GLuint texUnit = ctx->Texture.CurrentUnit; GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit; const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetDoublev"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (!params) return; @@ -1467,18 +1465,18 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = ENUM_TO_DOUBLE(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]); params[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]); params[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]); params[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]); break; case GL_CURRENT_INDEX: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = (GLdouble) ctx->Current.Index; break; case GL_CURRENT_NORMAL: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = (GLdouble) ctx->Current.Normal[0]; params[1] = (GLdouble) ctx->Current.Normal[1]; params[2] = (GLdouble) ctx->Current.Normal[2]; @@ -1511,7 +1509,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][0]; params[1] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][1]; params[2] = (GLdouble) ctx->Current.Texcoord[texTransformUnit][2]; @@ -1552,7 +1550,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer); break; case GL_EDGE_FLAG: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = (GLdouble) ctx->Current.EdgeFlag; break; case GL_FEEDBACK_BUFFER_SIZE: @@ -1793,10 +1791,10 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Const.MaxClipPlanes; break; case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ - *params = (GLdouble) VB_MAX; + *params = (GLdouble) ctx->Const.MaxArrayLockSize; break; case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */ - *params = (GLdouble) VB_MAX; + *params = (GLdouble) ctx->Const.MaxArrayLockSize; break; case GL_MAX_EVAL_ORDER: *params = (GLdouble) MAX_EVAL_ORDER; @@ -2510,7 +2508,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]); params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]); params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]); @@ -2530,7 +2528,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = (GLdouble) ctx->Current.FogCoord; break; case GL_FOG_COORDINATE_ARRAY_EXT: @@ -2570,8 +2568,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) GLuint texUnit = ctx->Texture.CurrentUnit; GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit; const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetFloatv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (!params) return; @@ -2706,18 +2703,18 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = CHAN_TO_FLOAT(ctx->Current.Color[0]); params[1] = CHAN_TO_FLOAT(ctx->Current.Color[1]); params[2] = CHAN_TO_FLOAT(ctx->Current.Color[2]); params[3] = CHAN_TO_FLOAT(ctx->Current.Color[3]); break; case GL_CURRENT_INDEX: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = (GLfloat) ctx->Current.Index; break; case GL_CURRENT_NORMAL: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Normal[0]; params[1] = ctx->Current.Normal[1]; params[2] = ctx->Current.Normal[2]; @@ -2750,7 +2747,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][0]; params[1] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][1]; params[2] = (GLfloat) ctx->Current.Texcoord[texTransformUnit][2]; @@ -2791,7 +2788,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer); break; case GL_EDGE_FLAG: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = (GLfloat) ctx->Current.EdgeFlag; break; case GL_FEEDBACK_BUFFER_SIZE: @@ -3032,10 +3029,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Const.MaxClipPlanes; break; case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ - *params = (GLfloat) VB_MAX; + *params = (GLfloat) ctx->Const.MaxArrayLockSize; break; case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */ - *params = (GLfloat) VB_MAX; + *params = (GLfloat) ctx->Const.MaxArrayLockSize; break; case GL_MAX_EVAL_ORDER: *params = (GLfloat) MAX_EVAL_ORDER; @@ -3723,7 +3720,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[0]); params[1] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[1]); params[2] = UBYTE_COLOR_TO_FLOAT_COLOR(ctx->Current.SecondaryColor[2]); @@ -3743,7 +3740,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = (GLfloat) ctx->Current.FogCoord; break; case GL_FOG_COORDINATE_ARRAY_EXT: @@ -3783,8 +3780,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) GLuint texUnit = ctx->Texture.CurrentUnit; GLuint texTransformUnit = ctx->Texture.CurrentTransformUnit; const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetIntegerv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (!params) return; @@ -3921,18 +3917,18 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Polygon.CullFaceMode; break; case GL_CURRENT_COLOR: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[0] ) ); params[1] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[1] ) ); params[2] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[2] ) ); params[3] = FLOAT_TO_INT( CHAN_TO_FLOAT( ctx->Current.Color[3] ) ); break; case GL_CURRENT_INDEX: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = (GLint) ctx->Current.Index; break; case GL_CURRENT_NORMAL: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT( ctx->Current.Normal[0] ); params[1] = FLOAT_TO_INT( ctx->Current.Normal[1] ); params[2] = FLOAT_TO_INT( ctx->Current.Normal[2] ); @@ -3965,7 +3961,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Current.RasterPosValid; break; case GL_CURRENT_TEXTURE_COORDS: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = (GLint) ctx->Current.Texcoord[texTransformUnit][0]; params[1] = (GLint) ctx->Current.Texcoord[texTransformUnit][1]; params[2] = (GLint) ctx->Current.Texcoord[texTransformUnit][2]; @@ -4006,7 +4002,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Color.DrawBuffer; break; case GL_EDGE_FLAG: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = (GLint) ctx->Current.EdgeFlag; break; case GL_FEEDBACK_BUFFER_SIZE: @@ -4247,10 +4243,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Const.MaxClipPlanes; break; case GL_MAX_ELEMENTS_VERTICES: /* GL_VERSION_1_2 */ - *params = VB_MAX; + *params = (GLint) ctx->Const.MaxArrayLockSize; break; case GL_MAX_ELEMENTS_INDICES: /* GL_VERSION_1_2 */ - *params = VB_MAX; + *params = (GLint) ctx->Const.MaxArrayLockSize; break; case GL_MAX_EVAL_ORDER: *params = (GLint) MAX_EVAL_ORDER; @@ -4965,7 +4961,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->Fog.ColorSumEnabled; break; case GL_CURRENT_SECONDARY_COLOR_EXT: - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[0] ) ); params[1] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[1] ) ); params[2] = FLOAT_TO_INT( UBYTE_COLOR_TO_FLOAT_COLOR( ctx->Current.SecondaryColor[2] ) ); @@ -4986,7 +4982,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_EXT_fog_coord */ case GL_CURRENT_FOG_COORDINATE_EXT: if (ctx->Extensions.EXT_fog_coord) { - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT(ctx, 0); *params = (GLint) ctx->Current.FogCoord; } else { @@ -5041,8 +5037,7 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) { GET_CURRENT_CONTEXT(ctx); GLuint texUnit = ctx->Texture.CurrentUnit; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetPointerv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (!params) return; @@ -5100,8 +5095,7 @@ _mesa_GetString( GLenum name ) static const char *vendor = "Brian Paul"; static const char *renderer = "Mesa"; static const char *version = "1.2 Mesa 3.5 beta"; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glGetString", 0); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); /* this is a required driver function */ assert(ctx->Driver.GetString); @@ -5134,10 +5128,8 @@ GLenum _mesa_GetError( void ) { GET_CURRENT_CONTEXT(ctx); - GLenum e = ctx->ErrorValue; - - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, "glGetError", (GLenum) 0); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glGetError <-- %s\n", gl_lookup_enum_by_nr(e)); diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index 577d320103e..88a15ca0f78 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -1,4 +1,4 @@ -/* $Id: hint.c,v 1.5 2000/10/30 13:32:00 keithw Exp $ */ +/* $Id: hint.c,v 1.6 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -41,6 +41,7 @@ void _mesa_Hint( GLenum target, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); (void) _mesa_try_Hint( ctx, target, mode ); } @@ -48,8 +49,6 @@ _mesa_Hint( GLenum target, GLenum mode ) GLboolean _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) { - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glHint", GL_FALSE); - if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glHint %s %d\n", gl_lookup_enum_by_nr(target), mode); @@ -60,24 +59,42 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) switch (target) { case GL_FOG_HINT: + if (ctx->Hint.Fog == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.Fog = mode; break; case GL_LINE_SMOOTH_HINT: + if (ctx->Hint.LineSmooth == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.LineSmooth = mode; break; case GL_PERSPECTIVE_CORRECTION_HINT: + if (ctx->Hint.PerspectiveCorrection == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.PerspectiveCorrection = mode; break; case GL_POINT_SMOOTH_HINT: + if (ctx->Hint.PointSmooth == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.PointSmooth = mode; break; case GL_POLYGON_SMOOTH_HINT: + if (ctx->Hint.PolygonSmooth == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.PolygonSmooth = mode; break; case GL_PREFER_DOUBLEBUFFER_HINT_PGI: case GL_STRICT_DEPTHFUNC_HINT_PGI: break; case GL_STRICT_LIGHTING_HINT_PGI: + if (ctx->Hint.StrictLighting == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.StrictLighting = mode; break; case GL_STRICT_SCISSOR_HINT_PGI: @@ -88,6 +105,7 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) case GL_RECLAIM_MEMORY_HINT_PGI: break; case GL_ALWAYS_FAST_HINT_PGI: + FLUSH_VERTICES(ctx, _NEW_HINT); if (mode) { ctx->Hint.AllowDrawWin = GL_TRUE; ctx->Hint.AllowDrawFrg = GL_FALSE; @@ -99,6 +117,7 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) } break; case GL_ALWAYS_SOFT_HINT_PGI: + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.AllowDrawWin = GL_TRUE; ctx->Hint.AllowDrawFrg = GL_TRUE; ctx->Hint.AllowDrawMem = GL_TRUE; @@ -106,12 +125,21 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) case GL_ALLOW_DRAW_OBJ_HINT_PGI: break; case GL_ALLOW_DRAW_WIN_HINT_PGI: + if (ctx->Hint.AllowDrawWin == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.AllowDrawWin = mode; break; case GL_ALLOW_DRAW_FRG_HINT_PGI: + if (ctx->Hint.AllowDrawFrg == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.AllowDrawFrg = mode; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: + if (ctx->Hint.AllowDrawMem == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.AllowDrawMem = mode; break; case GL_CLIP_NEAR_HINT_PGI: @@ -123,17 +151,22 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) /* GL_EXT_clip_volume_hint */ case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: + if (ctx->Hint.ClipVolumeClipping == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); ctx->Hint.ClipVolumeClipping = mode; break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSION_HINT_ARB: if (ctx->Extensions.ARB_texture_compression) { - ctx->Hint.TextureCompression = mode; - } - else { gl_error(ctx, GL_INVALID_ENUM, "glHint(target)"); + return GL_TRUE; } + if (ctx->Hint.TextureCompression == mode) + return GL_TRUE; + FLUSH_VERTICES(ctx, _NEW_HINT); + ctx->Hint.TextureCompression = mode; break; default: @@ -141,8 +174,6 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) return GL_FALSE; } - ctx->NewState |= _NEW_HINT; - if (ctx->Driver.Hint) { (*ctx->Driver.Hint)( ctx, target, mode ); } @@ -155,7 +186,7 @@ void _mesa_HintPGI( GLenum target, GLint mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glHintPGI"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glHintPGI %s %d\n", gl_lookup_enum_by_nr(target), mode); diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index ef98e519639..80ed72b6dbe 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -1,4 +1,4 @@ -/* $Id: histogram.c,v 1.4 2000/12/13 23:13:45 brianp Exp $ */ +/* $Id: histogram.c,v 1.5 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -600,7 +600,7 @@ void _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmax"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (!ctx->Extensions.EXT_histogram) { gl_error(ctx, GL_INVALID_OPERATION, "glGetMinmax"); @@ -617,6 +617,17 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo return; } + if (type != GL_UNSIGNED_BYTE && + type != GL_BYTE && + type != GL_UNSIGNED_SHORT && + type != GL_SHORT && + type != GL_UNSIGNED_INT && + type != GL_INT && + type != GL_FLOAT) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(type)"); + return; + } + if (!values) return; @@ -644,7 +655,7 @@ void _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogram"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (!ctx->Extensions.EXT_histogram) { gl_error(ctx, GL_INVALID_OPERATION, "glGetHistogram"); @@ -661,6 +672,17 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G return; } + if (type != GL_UNSIGNED_BYTE && + type != GL_BYTE && + type != GL_UNSIGNED_SHORT && + type != GL_SHORT && + type != GL_UNSIGNED_INT && + type != GL_INT && + type != GL_FLOAT) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(type)"); + return; + } + if (!values) return; @@ -684,7 +706,7 @@ void _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameterfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.EXT_histogram) { gl_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv"); @@ -731,7 +753,7 @@ void _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameteriv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.EXT_histogram) { gl_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv"); @@ -778,7 +800,7 @@ void _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameterfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.EXT_histogram) { gl_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv"); @@ -804,7 +826,7 @@ void _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameteriv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.EXT_histogram) { gl_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv"); @@ -832,7 +854,7 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s GLuint i; GLboolean error = GL_FALSE; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glHistogram"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ if (!ctx->Extensions.EXT_histogram) { gl_error(ctx, GL_INVALID_OPERATION, "glHistogram"); @@ -913,7 +935,7 @@ void _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMinmax"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (!ctx->Extensions.EXT_histogram) { gl_error(ctx, GL_INVALID_OPERATION, "glMinmax"); @@ -929,9 +951,11 @@ _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) gl_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)"); return; } - + + if (ctx->MinMax.Sink == sink) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->MinMax.Sink = sink; - ctx->NewState |= _NEW_PIXEL; } @@ -940,7 +964,7 @@ _mesa_ResetHistogram(GLenum target) { GLuint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetHistogram"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* sideeffects */ if (!ctx->Extensions.EXT_histogram) { gl_error(ctx, GL_INVALID_OPERATION, "glResetHistogram"); @@ -967,7 +991,7 @@ void _mesa_ResetMinmax(GLenum target) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetMinmax"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (!ctx->Extensions.EXT_histogram) { gl_error(ctx, GL_INVALID_OPERATION, "glResetMinmax"); diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 4f8bdd2ce1b..e1a1b96e192 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,4 +1,4 @@ -/* $Id: light.c,v 1.30 2000/11/27 18:22:13 brianp Exp $ */ +/* $Id: light.c,v 1.31 2000/12/26 05:09:28 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -54,28 +54,24 @@ void _mesa_ShadeModel( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glShadeModel"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glShadeModel %s\n", gl_lookup_enum_by_nr(mode)); - if (mode == GL_FLAT || mode == GL_SMOOTH) { - if (ctx->Light.ShadeModel != mode) { - ctx->Light.ShadeModel = mode; - if (ctx->Light.ShadeModel == GL_FLAT) - SET_BITS(ctx->_TriangleCaps, DD_FLATSHADE); - else - CLEAR_BITS(ctx->_TriangleCaps, DD_FLATSHADE); - - ctx->NewState |= _NEW_LIGHT; - - if (ctx->Driver.ShadeModel) - (*ctx->Driver.ShadeModel)( ctx, mode ); - } - } - else { + if (mode != GL_FLAT && mode != GL_SMOOTH) { gl_error( ctx, GL_INVALID_ENUM, "glShadeModel" ); + return; } + + if (ctx->Light.ShadeModel == mode) + return; + + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.ShadeModel = mode; + ctx->_TriangleCaps ^= DD_FLATSHADE; + if (ctx->Driver.ShadeModel) + (*ctx->Driver.ShadeModel)( ctx, mode ); } @@ -94,92 +90,122 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) GLint i = (GLint) (light - GL_LIGHT0); struct gl_light *l = &ctx->Light.Light[i]; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLight"); - if (i < 0 || i >= ctx->Const.MaxLights) { gl_error( ctx, GL_INVALID_ENUM, "glLight" ); return; } switch (pname) { - case GL_AMBIENT: - COPY_4V( l->Ambient, params ); - break; - case GL_DIFFUSE: - COPY_4V( l->Diffuse, params ); - break; - case GL_SPECULAR: - COPY_4V( l->Specular, params ); - break; - case GL_POSITION: - /* transform position by ModelView matrix */ - TRANSFORM_POINT( l->EyePosition, ctx->ModelView.m, params ); - if (l->EyePosition[3] != 0.0F) - l->_Flags |= LIGHT_POSITIONAL; - else - l->_Flags &= ~LIGHT_POSITIONAL; - break; - case GL_SPOT_DIRECTION: - /* transform direction by inverse modelview */ - if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { - _math_matrix_analyse( &ctx->ModelView ); - } - TRANSFORM_NORMAL( l->EyeDirection, params, ctx->ModelView.inv ); - break; - case GL_SPOT_EXPONENT: - if (params[0]<0.0 || params[0]>128.0) { - gl_error( ctx, GL_INVALID_VALUE, "glLight" ); - return; - } - if (l->SpotExponent != params[0]) { - l->SpotExponent = params[0]; - gl_compute_spot_exp_table( l ); - } - break; - case GL_SPOT_CUTOFF: - if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) { - gl_error( ctx, GL_INVALID_VALUE, "glLight" ); - return; - } - l->SpotCutoff = params[0]; - l->_CosCutoff = cos(params[0]*DEG2RAD); - if (l->_CosCutoff < 0) - l->_CosCutoff = 0; - if (l->SpotCutoff != 180.0F) - l->_Flags |= LIGHT_SPOT; - else - l->_Flags &= ~LIGHT_SPOT; - break; - case GL_CONSTANT_ATTENUATION: - if (params[0]<0.0) { - gl_error( ctx, GL_INVALID_VALUE, "glLight" ); - return; - } - l->ConstantAttenuation = params[0]; - break; - case GL_LINEAR_ATTENUATION: - if (params[0]<0.0) { - gl_error( ctx, GL_INVALID_VALUE, "glLight" ); - return; - } - l->LinearAttenuation = params[0]; - break; - case GL_QUADRATIC_ATTENUATION: - if (params[0]<0.0) { - gl_error( ctx, GL_INVALID_VALUE, "glLight" ); - return; - } - l->QuadraticAttenuation = params[0]; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glLight" ); - return; + case GL_AMBIENT: + if (TEST_EQ_4V(l->Ambient, params)) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_4V( l->Ambient, params ); + break; + case GL_DIFFUSE: + if (TEST_EQ_4V(l->Diffuse, params)) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_4V( l->Diffuse, params ); + break; + case GL_SPECULAR: + if (TEST_EQ_4V(l->Specular, params)) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_4V( l->Specular, params ); + break; + case GL_POSITION: { + GLfloat tmp[4]; + /* transform position by ModelView matrix */ + TRANSFORM_POINT( tmp, ctx->ModelView.m, params ); + if (TEST_EQ_4V(l->EyePosition, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_4V(l->EyePosition, tmp); + if (l->EyePosition[3] != 0.0F) + l->_Flags |= LIGHT_POSITIONAL; + else + l->_Flags &= ~LIGHT_POSITIONAL; + break; + } + case GL_SPOT_DIRECTION: { + GLfloat tmp[4]; + /* transform direction by inverse modelview */ + if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { + _math_matrix_analyse( &ctx->ModelView ); + } + TRANSFORM_NORMAL( tmp, params, ctx->ModelView.inv ); + if (TEST_EQ_3V(l->EyeDirection, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + COPY_3V(l->EyeDirection, tmp); + break; + } + case GL_SPOT_EXPONENT: + if (params[0]<0.0 || params[0]>128.0) { + gl_error( ctx, GL_INVALID_VALUE, "glLight" ); + return; + } + if (l->SpotExponent == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + l->SpotExponent = params[0]; + gl_invalidate_spot_exp_table( l ); + break; + case GL_SPOT_CUTOFF: + if ((params[0]<0.0 || params[0]>90.0) && params[0]!=180.0) { + gl_error( ctx, GL_INVALID_VALUE, "glLight" ); + return; + } + if (l->SpotCutoff == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + l->SpotCutoff = params[0]; + l->_CosCutoff = cos(params[0]*DEG2RAD); + if (l->_CosCutoff < 0) + l->_CosCutoff = 0; + if (l->SpotCutoff != 180.0F) + l->_Flags |= LIGHT_SPOT; + else + l->_Flags &= ~LIGHT_SPOT; + break; + case GL_CONSTANT_ATTENUATION: + if (params[0]<0.0) { + gl_error( ctx, GL_INVALID_VALUE, "glLight" ); + return; + } + if (l->ConstantAttenuation == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + l->ConstantAttenuation = params[0]; + break; + case GL_LINEAR_ATTENUATION: + if (params[0]<0.0) { + gl_error( ctx, GL_INVALID_VALUE, "glLight" ); + return; + } + if (l->LinearAttenuation == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + l->LinearAttenuation = params[0]; + break; + case GL_QUADRATIC_ATTENUATION: + if (params[0]<0.0) { + gl_error( ctx, GL_INVALID_VALUE, "glLight" ); + return; + } + if (l->QuadraticAttenuation == params[0]) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + l->QuadraticAttenuation = params[0]; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glLight" ); + return; } if (ctx->Driver.Lightfv) ctx->Driver.Lightfv( ctx, light, pname, params ); - - ctx->NewState |= _NEW_LIGHT; } @@ -237,8 +263,7 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLint l = (GLint) (light - GL_LIGHT0); - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (l < 0 || l >= ctx->Const.MaxLights) { gl_error( ctx, GL_INVALID_ENUM, "glGetLightfv" ); @@ -289,8 +314,7 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); GLint l = (GLint) (light - GL_LIGHT0); - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetLight"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (l < 0 || l >= ctx->Const.MaxLights) { gl_error( ctx, GL_INVALID_ENUM, "glGetLightiv" ); @@ -358,38 +382,46 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ) void _mesa_LightModelfv( GLenum pname, const GLfloat *params ) { + GLenum newenum; + GLboolean newbool; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModelfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_LIGHT_MODEL_AMBIENT: + if (TEST_EQ_4V( ctx->Light.Model.Ambient, params )) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); COPY_4V( ctx->Light.Model.Ambient, params ); break; case GL_LIGHT_MODEL_LOCAL_VIEWER: - if (params[0]==0.0) - ctx->Light.Model.LocalViewer = GL_FALSE; - else - ctx->Light.Model.LocalViewer = GL_TRUE; + newbool = (params[0]!=0.0); + if (ctx->Light.Model.LocalViewer == newbool) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Model.LocalViewer = newbool; break; case GL_LIGHT_MODEL_TWO_SIDE: - if (params[0]==0.0) - ctx->Light.Model.TwoSide = GL_FALSE; - else - ctx->Light.Model.TwoSide = GL_TRUE; + newbool = (params[0]!=0.0); + if (ctx->Light.Model.TwoSide == newbool) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Model.TwoSide = newbool; break; case GL_LIGHT_MODEL_COLOR_CONTROL: - 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); - } - else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) { - ctx->Light.Model.ColorControl = GL_SEPARATE_SPECULAR_COLOR; - SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); - } - else { + if (params[0] == (GLfloat) GL_SINGLE_COLOR) + newenum = GL_SINGLE_COLOR; + else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR) + newenum = GL_SEPARATE_SPECULAR_COLOR; + else { gl_error( ctx, GL_INVALID_ENUM, "glLightModel(param)" ); + return; } + if (ctx->Light.Model.ColorControl == newenum) + return; + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.Model.ColorControl = newenum; + ctx->_TriangleCaps ^= DD_SEPERATE_SPECULAR; break; default: gl_error( ctx, GL_INVALID_ENUM, "glLightModel" ); @@ -398,8 +430,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params ) if (ctx->Driver.LightModelfv) ctx->Driver.LightModelfv( ctx, pname, params ); - - ctx->NewState |= _NEW_LIGHT; } @@ -407,8 +437,6 @@ void _mesa_LightModeliv( GLenum pname, const GLint *params ) { GLfloat fparam[4]; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLightModeliv"); switch (pname) { case GL_LIGHT_MODEL_AMBIENT: @@ -582,6 +610,9 @@ void gl_update_material( GLcontext *ctx, if (bitmask & FRONT_DIFFUSE_BIT) { struct gl_material *mat = &ctx->Light.Material[0]; COPY_4FV( mat->Diffuse, src[0].Diffuse ); +/* fprintf(stderr, "FRONT_DIFFUSE %f %f %f %f\n", */ +/* mat->Diffuse[0], mat->Diffuse[1], */ +/* mat->Diffuse[2], mat->Diffuse[3]); */ foreach (light, list) { SCALE_3V( light->_MatDiffuse[0], light->Diffuse, mat->Diffuse ); } @@ -590,6 +621,9 @@ void gl_update_material( GLcontext *ctx, if (bitmask & BACK_DIFFUSE_BIT) { struct gl_material *mat = &ctx->Light.Material[1]; COPY_4FV( mat->Diffuse, src[1].Diffuse ); +/* fprintf(stderr, "BACK_DIFFUSE %f %f %f %f\n", */ +/* mat->Diffuse[0], mat->Diffuse[1], */ +/* mat->Diffuse[2], mat->Diffuse[3]); */ foreach (light, list) { SCALE_3V( light->_MatDiffuse[1], light->Diffuse, mat->Diffuse ); } @@ -613,14 +647,13 @@ void gl_update_material( GLcontext *ctx, } if (bitmask & FRONT_SHININESS_BIT) { - GLfloat shininess = ctx->Light.Material[0].Shininess = src[0].Shininess; - gl_compute_shine_table( ctx, 0, shininess ); - gl_compute_shine_table( ctx, 2, shininess * .5 ); +/* fprintf(stderr, "FRONT_SHININESS_BIT %f\n", src[0].Shininess); */ + ctx->Light.Material[0].Shininess = src[0].Shininess; + gl_invalidate_shine_table( ctx, 0 ); } if (bitmask & BACK_SHININESS_BIT) { - GLfloat shininess = ctx->Light.Material[1].Shininess = src[1].Shininess; - gl_compute_shine_table( ctx, 1, shininess ); - gl_compute_shine_table( ctx, 3, shininess * .5 ); + ctx->Light.Material[1].Shininess = src[1].Shininess; + gl_invalidate_shine_table( ctx, 1 ); } if (bitmask & FRONT_INDEXES_BIT) { @@ -790,8 +823,7 @@ _mesa_ColorMaterial( GLenum face, GLenum mode ) FRONT_SPECULAR_BIT | BACK_SPECULAR_BIT | FRONT_DIFFUSE_BIT | BACK_DIFFUSE_BIT | FRONT_AMBIENT_BIT | BACK_AMBIENT_BIT); - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorMaterial"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glColorMaterial %s %s\n", @@ -800,18 +832,20 @@ _mesa_ColorMaterial( GLenum face, GLenum mode ) bitmask = gl_material_bitmask( ctx, face, mode, legal, "glColorMaterial" ); - if (bitmask != 0) { - ctx->Light.ColorMaterialBitmask = bitmask; - ctx->Light.ColorMaterialFace = face; - ctx->Light.ColorMaterialMode = mode; - } + if (ctx->Light.ColorMaterialBitmask == bitmask && + ctx->Light.ColorMaterialFace == face && + ctx->Light.ColorMaterialMode == mode) + return; + + FLUSH_VERTICES(ctx, _NEW_LIGHT); + ctx->Light.ColorMaterialBitmask = bitmask; + ctx->Light.ColorMaterialFace = face; + ctx->Light.ColorMaterialMode = mode; if (ctx->Light.ColorMaterialEnabled) { - FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); + FLUSH_CURRENT( ctx, 0 ); gl_update_color_material( ctx, ctx->Current.Color ); } - - ctx->NewState |= _NEW_LIGHT; } @@ -823,8 +857,7 @@ _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); GLuint f; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialfv"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */ if (face==GL_FRONT) { f = 0; @@ -869,8 +902,7 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); GLuint f; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMaterialiv"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* update materials */ if (face==GL_FRONT) { f = 0; @@ -967,7 +999,12 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params ) * this function to recompute the exponent lookup table. */ void -gl_compute_spot_exp_table( struct gl_light *l ) +gl_invalidate_spot_exp_table( struct gl_light *l ) +{ + l->_SpotExpTable[0][0] = -1; +} + +static void validate_spot_exp_table( struct gl_light *l ) { GLint i; GLdouble exponent = l->SpotExponent; @@ -978,16 +1015,17 @@ gl_compute_spot_exp_table( struct gl_light *l ) for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) { if (clamp == 0) { - tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent); - if (tmp < FLT_MIN * 100.0) { - tmp = 0.0; - clamp = 1; - } + tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent); + if (tmp < FLT_MIN * 100.0) { + tmp = 0.0; + clamp = 1; + } } 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; } @@ -999,56 +1037,76 @@ gl_compute_spot_exp_table( struct gl_light *l ) * lighting, and the cost of doing it early may be partially offset * by keeping a MRU cache of shine tables for various shine values. */ -static void -compute_shine_table( struct gl_shine_tab *tab, GLfloat shininess ) +void +gl_invalidate_shine_table( GLcontext *ctx, GLuint i ) { - GLint i; - GLfloat *m = tab->tab; - - m[0] = 0.0; - if (shininess == 0.0) { - for (i = 1 ; i <= SHINE_TABLE_SIZE ; i++) - m[i] = 1.0; - } - else { - for (i = 1 ; i < SHINE_TABLE_SIZE ; i++) { - GLdouble t = pow(i / (GLfloat) (SHINE_TABLE_SIZE - 1), shininess); - if (t > 1e-20) - m[i] = t; - else - m[i] = 0.0; - } - m[SHINE_TABLE_SIZE] = 1.0; - } - - tab->shininess = shininess; + if (ctx->_ShineTable[i]) + ctx->_ShineTable[i]->refcount--; + ctx->_ShineTable[i] = 0; } - -void -gl_compute_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess ) +static void validate_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 *s; +/* fprintf(stderr, "validate_shine_table %d, shininess %f\n", i, shininess); */ + foreach(s, list) - if ( DISTSQR(s->shininess, shininess) < 1e-4 ) + if ( s->shininess == shininess ) break; if (s == list) { + GLint i; + GLfloat *m; + foreach(s, list) if (s->refcount == 0) - break; + break; - compute_shine_table( s, shininess ); + m = s->tab; + m[0] = 0.0; + if (shininess == 0.0) { + for (i = 1 ; i <= SHINE_TABLE_SIZE ; i++) + m[i] = 1.0; + } + else { + for (i = 1 ; i < SHINE_TABLE_SIZE ; i++) { + GLdouble t = pow(i / (GLfloat)(SHINE_TABLE_SIZE-1), shininess); + if (t > 1e-20) + m[i] = t; + else + m[i] = 0.0; + } + m[SHINE_TABLE_SIZE] = 1.0; + } + + s->shininess = shininess; } - ctx->_ShineTable[i]->refcount--; + if (ctx->_ShineTable[i]) + ctx->_ShineTable[i]->refcount--; + ctx->_ShineTable[i] = s; move_to_tail( list, s ); s->refcount++; -#undef DISTSQR +} + +void +gl_validate_all_lighting_tables( GLcontext *ctx ) +{ + GLint i; + GLfloat shininess; + + shininess = ctx->Light.Material[0].Shininess; + if (!ctx->_ShineTable[0]) validate_shine_table( ctx, 0, shininess ); + + shininess = ctx->Light.Material[1].Shininess; + if (!ctx->_ShineTable[1]) validate_shine_table( ctx, 1, shininess ); + + for (i = 0 ; i < MAX_LIGHTS ; i++) + if (ctx->Light.Light[i]._SpotExpTable[0][0] == -1) + validate_spot_exp_table( &ctx->Light.Light[i] ); } @@ -1064,7 +1122,7 @@ void gl_update_lighting( GLcontext *ctx ) { struct gl_light *light; - ctx->_TriangleCaps &= ~(DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL); + ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE; ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT; ctx->_NeedNormals &= ~NEED_NORMALS_LIGHT; ctx->Light._Flags = 0; @@ -1075,7 +1133,7 @@ gl_update_lighting( GLcontext *ctx ) ctx->_NeedNormals |= NEED_NORMALS_LIGHT; if (ctx->Light.Model.TwoSide) - ctx->_TriangleCaps |= (DD_TRI_LIGHT_TWOSIDE|DD_LIGHTING_CULL); + ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE; foreach(light, &ctx->Light.EnabledList) { ctx->Light._Flags |= light->_Flags; @@ -1099,7 +1157,10 @@ gl_update_lighting( GLcontext *ctx ) ctx->_NeedEyeCoords |= NEED_EYE_LIGHT; - /* Precompute some shading values. + /* Precompute some shading values. Although we reference + * Light.Material here, we can get away without flushing + * FLUSH_UPDATE_CURRENT, as when any outstanding material changes + * are flushed, they will update the derived state at that time. */ if (ctx->Visual.RGBAflag) { GLuint sides = ctx->Light.Model.TwoSide ? 2 : 1; diff --git a/src/mesa/main/light.h b/src/mesa/main/light.h index 604e4d5806e..f737abf4e45 100644 --- a/src/mesa/main/light.h +++ b/src/mesa/main/light.h @@ -1,4 +1,4 @@ -/* $Id: light.h,v 1.7 2000/11/24 10:25:05 keithw Exp $ */ +/* $Id: light.h,v 1.8 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -101,10 +101,11 @@ extern GLuint gl_material_bitmask( GLcontext *ctx, extern void gl_set_material( GLcontext *ctx, GLuint bitmask, const GLfloat *params); -extern void gl_compute_spot_exp_table( struct gl_light *l ); -extern void gl_compute_shine_table( GLcontext *ctx, GLuint i, - GLfloat shininess ); +extern void gl_invalidate_spot_exp_table( struct gl_light *l ); +extern void gl_invalidate_shine_table( GLcontext *ctx, GLuint i ); +extern void gl_validate_all_lighting_tables( GLcontext *ctx ); + extern void gl_update_lighting( GLcontext *ctx ); diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index e23d8a4de2d..c54f108b237 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -1,4 +1,4 @@ -/* $Id: lines.c,v 1.23 2000/11/22 07:32:17 joukj Exp $ */ +/* $Id: lines.c,v 1.24 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -45,22 +45,26 @@ void _mesa_LineWidth( GLfloat width ) { GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + if (width<=0.0) { gl_error( ctx, GL_INVALID_VALUE, "glLineWidth" ); return; } - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineWidth"); - if (ctx->Line.Width != width) { - ctx->Line.Width = width; - ctx->_TriangleCaps &= ~DD_LINE_WIDTH; - if (width != 1.0) ctx->_TriangleCaps |= DD_LINE_WIDTH; + if (ctx->Line.Width == width) + return; - ctx->NewState |= _NEW_LINE; + FLUSH_VERTICES(ctx, _NEW_LINE); + ctx->Line.Width = width; - if (ctx->Driver.LineWidth) - (*ctx->Driver.LineWidth)(ctx, width); - } + if (width != 1.0) + ctx->_TriangleCaps |= DD_LINE_WIDTH; + else + ctx->_TriangleCaps &= ~DD_LINE_WIDTH; + + if (ctx->Driver.LineWidth) + (*ctx->Driver.LineWidth)(ctx, width); } @@ -69,12 +73,16 @@ void _mesa_LineStipple( GLint factor, GLushort pattern ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glLineStipple"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Line.StippleFactor == CLAMP( factor, 1, 256 ) && + ctx->Line.StipplePattern == pattern) + return; + + FLUSH_VERTICES(ctx, _NEW_LINE); ctx->Line.StippleFactor = CLAMP( factor, 1, 256 ); ctx->Line.StipplePattern = pattern; - ctx->NewState |= _NEW_LINE; - if (ctx->Driver.LineStipple) ctx->Driver.LineStipple( ctx, factor, pattern ); } diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 02121e3e120..a77e2fc65b2 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -1,4 +1,4 @@ -/* $Id: macros.h,v 1.15 2000/11/24 10:25:05 keithw Exp $ */ +/* $Id: macros.h,v 1.16 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -72,6 +72,7 @@ */ #define STRIDE_F(p, i) (p = (GLfloat *)((GLubyte *)p + i)) #define STRIDE_UI(p, i) (p = (GLuint *)((GLubyte *)p + i)) +#define STRIDE_4UB(p, i) (p = (GLubyte (*)[4])((GLubyte *)p + i)) #define STRIDE_T(p, t, i) (p = (t *)((GLubyte *)p + i)) @@ -80,6 +81,23 @@ #define ZERO_4V( DST ) (DST)[0] = (DST)[1] = (DST)[2] = (DST)[3] = 0 +#define TEST_EQ_4V(a,b) ((a)[0] == (b)[0] && \ + (a)[1] == (b)[1] && \ + (a)[2] == (b)[2] && \ + (a)[3] == (b)[3]) + +#define TEST_EQ_3V(a,b) ((a)[0] == (b)[0] && \ + (a)[1] == (b)[1] && \ + (a)[2] == (b)[2]) + +#if defined(__i386__) +#define TEST_EQ_4UBV(DST, SRC) *((GLuint*)(DST)) == *((GLuint*)(SRC)) +#else +#define TEST_EQ_4UBV(DST, SRC) TEST_EQ_4V(DST, SRC) +#endif + + + /* Copy short vectors: */ #define COPY_2V( DST, SRC ) \ do { \ diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 6106a80affe..2cd471f4e25 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.28 2000/11/24 10:25:05 keithw Exp $ */ +/* $Id: matrix.c,v 1.29 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -59,7 +59,6 @@ #define GET_ACTIVE_MATRIX(ctx, mat, flags, where) \ do { \ - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, where); \ if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "%s\n", where); \ switch (ctx->Transform.MatrixMode) { \ case GL_MODELVIEW: \ @@ -91,6 +90,7 @@ _mesa_Frustum( GLdouble left, GLdouble right, { GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glFrustrum" ); @@ -115,6 +115,7 @@ _mesa_Ortho( GLdouble left, GLdouble right, { GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glOrtho" ); @@ -134,13 +135,17 @@ void _mesa_MatrixMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMatrixMode"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + switch (mode) { case GL_MODELVIEW: case GL_PROJECTION: case GL_TEXTURE: case GL_COLOR: + if (ctx->Transform.MatrixMode == mode) + return; ctx->Transform.MatrixMode = mode; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); break; default: gl_error( ctx, GL_INVALID_ENUM, "glMatrixMode" ); @@ -153,7 +158,7 @@ void _mesa_PushMatrix( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushMatrix"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glPushMatrix %s\n", @@ -206,7 +211,7 @@ void _mesa_PopMatrix( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPopMatrix"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glPopMatrix %s\n", @@ -265,6 +270,7 @@ _mesa_LoadIdentity( void ) { GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadIdentity"); _math_matrix_set_identity( mat ); } @@ -275,6 +281,7 @@ _mesa_LoadMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glLoadMatrix"); _math_matrix_loadf( mat, m ); } @@ -300,6 +307,7 @@ _mesa_MultMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glMultMatrix" ); _math_matrix_mul_floats( mat, m ); } @@ -328,6 +336,7 @@ void _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (angle != 0.0F) { GLmatrix *mat = 0; GET_ACTIVE_MATRIX( ctx, mat, ctx->NewState, "glRotate" ); @@ -350,6 +359,7 @@ _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glScale"); _math_matrix_scale( mat, x, y, z ); } @@ -370,6 +380,7 @@ _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); GLmatrix *mat = 0; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); GET_ACTIVE_MATRIX(ctx, mat, ctx->NewState, "glTranslate"); _math_matrix_translate( mat, x, y, z ); } @@ -425,6 +436,7 @@ void _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) { GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); gl_Viewport(ctx, x, y, width, height); } @@ -441,8 +453,6 @@ _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height ) void gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) { - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glViewport"); - if (width<0 || height<0) { gl_error( ctx, GL_INVALID_VALUE, "glViewport" ); return; @@ -461,7 +471,9 @@ gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height ) ctx->Viewport.Y = y; ctx->Viewport.Height = height; - /* compute scale and bias values */ + /* compute scale and bias values :: This is really driver-specific + * and should be maintained elsewhere if at all. + */ 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; @@ -500,7 +512,7 @@ _mesa_DepthRange( GLclampd nearval, GLclampd farval ) */ GLfloat n, f; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDepthRange"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glDepthRange %f %f\n", nearval, farval); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index c6b4ac9180b..3a7c6b38821 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.6 2000/12/14 20:25:56 brianp Exp $ */ +/* $Id: mtypes.h,v 1.7 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -101,6 +101,11 @@ #endif +/* Maximum number of temporary vertices required for clipping. (Used + * in array_cache and tnl modules). + */ +#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1) + /* * Depth buffer data type: */ @@ -220,10 +225,6 @@ struct gl_lightmodel { }; -/* Move to using pointers to this struct in the immediate structs - - * this is too big to keep 94 unused copies (7K) lying around in - * display lists. - */ struct gl_material { GLfloat Ambient[4]; @@ -237,15 +238,11 @@ struct gl_material }; - - - /* * Attribute structures: * We define a struct for each attribute group to make pushing and * popping attributes easy. Also it's a good organization. */ - struct gl_accum_attrib { GLfloat ClearColor[4]; /* Accumulation buffer clear color */ }; @@ -296,8 +293,7 @@ struct gl_colorbuffer_attrib { struct gl_current_attrib { - /* These values valid only when FLUSH_TNL( FLUSH_UPDATE_CURRENT ) - * has been called. + /* These values valid only when FLUSH_VERTICES has been called. */ GLfloat Normal[3]; /* Current vertex normal */ GLchan Color[4]; /* Current RGBA color */ @@ -480,7 +476,11 @@ struct gl_convolution_attrib { struct gl_light_attrib { struct gl_light Light[MAX_LIGHTS]; /* Array of lights */ struct gl_lightmodel Model; /* Lighting model */ + + /* Must flush FLUSH_VERTICES before referencing: + */ struct gl_material Material[2]; /* Material 0=front, 1=back */ + GLboolean Enabled; /* Lighting enabled flag */ GLenum ShadeModel; /* GL_FLAT or GL_SMOOTH */ GLenum ColorMaterialFace; /* GL_FRONT, BACK or FRONT_AND_BACK */ @@ -492,7 +492,7 @@ struct gl_light_attrib { /* Derived for optimizations: */ GLboolean _NeedVertices; /* Use fast shader? */ - GLuint _Flags; /* State, see below */ + GLuint _Flags; /* LIGHT_* flags, see below */ GLfloat _BaseColor[2][3]; GLchan _BaseAlpha[2]; }; @@ -616,10 +616,8 @@ struct gl_polygon_attrib { GLenum FrontFace; /* Either GL_CW or GL_CCW */ GLenum FrontMode; /* Either GL_POINT, GL_LINE or GL_FILL */ GLenum BackMode; /* Either GL_POINT, GL_LINE or GL_FILL */ - GLboolean FrontBit; /* */ - GLboolean _Unfilled; /* True if back or front mode is not GL_FILL */ + GLboolean _FrontBit; /* */ GLboolean CullFlag; /* Culling on/off flag */ - GLubyte _CullBits; /* Used for cull testing */ GLboolean SmoothFlag; /* True if GL_POLYGON_SMOOTH is enabled */ GLboolean StippleFlag; /* True if GL_POLYGON_STIPPLE is enabled */ GLenum CullFaceMode; /* Culling mode GL_FRONT or GL_BACK */ @@ -680,6 +678,26 @@ struct gl_stencil_attrib { #define TEXTURE3_3D (TEXTURE0_3D << 12) #define TEXTURE3_CUBE (TEXTURE0_CUBE << 12) #define TEXTURE3_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE) +#define TEXTURE4_1D (TEXTURE0_1D << 16) /* Texture unit 3 */ +#define TEXTURE4_2D (TEXTURE0_2D << 16) +#define TEXTURE4_3D (TEXTURE0_3D << 16) +#define TEXTURE4_CUBE (TEXTURE0_CUBE << 16) +#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE) +#define TEXTURE5_1D (TEXTURE0_1D << 20) /* Texture unit 3 */ +#define TEXTURE5_2D (TEXTURE0_2D << 20) +#define TEXTURE5_3D (TEXTURE0_3D << 20) +#define TEXTURE5_CUBE (TEXTURE0_CUBE << 20) +#define TEXTURE5_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE) +#define TEXTURE6_1D (TEXTURE0_1D << 24) /* Texture unit 3 */ +#define TEXTURE6_2D (TEXTURE0_2D << 24) +#define TEXTURE6_3D (TEXTURE0_3D << 24) +#define TEXTURE6_CUBE (TEXTURE0_CUBE << 24) +#define TEXTURE6_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE) +#define TEXTURE7_1D (TEXTURE0_1D << 28) /* Texture unit 3 */ +#define TEXTURE7_2D (TEXTURE0_2D << 28) +#define TEXTURE7_3D (TEXTURE0_3D << 28) +#define TEXTURE7_CUBE (TEXTURE0_CUBE << 28) +#define TEXTURE7_ANY (TEXTURE3_1D | TEXTURE3_2D | TEXTURE3_3D | TEXTURE3_CUBE) /* Bitmap versions of the GL_ constants. */ @@ -708,33 +726,42 @@ struct gl_stencil_attrib { /* A selection of state flags to make driver and module's lives easier. */ -#define ENABLE_TEX0 0x000f /* TEXTURE0_ANY */ -#define ENABLE_TEX1 0x00f0 /* TEXTURE1_ANY */ -#define ENABLE_TEX2 0x0f00 /* TEXTURE2_ANY */ -#define ENABLE_TEX3 0xf000 /* TEXTURE3_ANY */ -#define ENABLE_TEXGEN0 0x10000 -#define ENABLE_TEXGEN1 0x20000 -#define ENABLE_TEXGEN2 0x40000 -#define ENABLE_TEXGEN3 0x80000 -#define ENABLE_TEXMAT0 0x100000 /* Ie. not the identity matrix */ -#define ENABLE_TEXMAT1 0x200000 -#define ENABLE_TEXMAT2 0x400000 -#define ENABLE_TEXMAT3 0x800000 -#define ENABLE_LIGHT 0x1000000 -#define ENABLE_FOG 0x2000000 -#define ENABLE_USERCLIP 0x4000000 -#define ENABLE_NORMALIZE 0x10000000 -#define ENABLE_RESCALE 0x20000000 -#define ENABLE_POINT_ATTEN 0x40000000 - - -#define ENABLE_TEX_ANY (ENABLE_TEX0 | ENABLE_TEX1 | \ - ENABLE_TEX2 | ENABLE_TEX3) +#define ENABLE_TEXGEN0 0x1 +#define ENABLE_TEXGEN1 0x2 +#define ENABLE_TEXGEN2 0x4 +#define ENABLE_TEXGEN3 0x8 +#define ENABLE_TEXGEN4 0x10 +#define ENABLE_TEXGEN5 0x20 +#define ENABLE_TEXGEN6 0x40 +#define ENABLE_TEXGEN7 0x80 +#define ENABLE_TEXMAT0 0x100 /* Ie. not the identity matrix */ +#define ENABLE_TEXMAT1 0x200 +#define ENABLE_TEXMAT2 0x400 +#define ENABLE_TEXMAT3 0x800 +#define ENABLE_TEXMAT4 0x1000 +#define ENABLE_TEXMAT5 0x2000 +#define ENABLE_TEXMAT6 0x4000 +#define ENABLE_TEXMAT7 0x8000 +#define ENABLE_LIGHT 0x10000 +#define ENABLE_FOG 0x20000 +#define ENABLE_USERCLIP 0x40000 +#define ENABLE_NORMALIZE 0x100000 +#define ENABLE_RESCALE 0x200000 +#define ENABLE_POINT_ATTEN 0x400000 + + #define ENABLE_TEXGEN_ANY (ENABLE_TEXGEN0 | ENABLE_TEXGEN1 | \ - ENABLE_TEXGEN2 | ENABLE_TEXGEN3) + ENABLE_TEXGEN2 | ENABLE_TEXGEN3 | \ + ENABLE_TEXGEN4 | ENABLE_TEXGEN5 | \ + ENABLE_TEXGEN6 | ENABLE_TEXGEN7) + #define ENABLE_TEXMAT_ANY (ENABLE_TEXMAT0 | ENABLE_TEXMAT1 | \ - ENABLE_TEXMAT2 | ENABLE_TEXMAT3) + ENABLE_TEXMAT2 | ENABLE_TEXMAT3 | \ + ENABLE_TEXMAT4 | ENABLE_TEXMAT5 | \ + ENABLE_TEXMAT6 | ENABLE_TEXMAT7) +#define ENABLE_TEXGEN(i) (ENABLE_TEXGEN0 << (i)) +#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i)) /* Texture image record */ struct gl_texture_image { @@ -889,9 +916,6 @@ struct gl_texture_attrib { }; - -/* KW: Renamed ClipEquation to avoid having 'ClipClipEquation' - */ struct gl_transform_attrib { GLenum MatrixMode; /* Matrix mode */ GLfloat EyeUserPlane[MAX_CLIP_PLANES][4]; @@ -960,20 +984,13 @@ struct gl_array_attrib { struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; struct gl_client_array EdgeFlag; - trans_4f_func _VertexFunc; /* conversion functions */ - trans_3f_func _NormalFunc; - trans_4ub_func _ColorFunc; - trans_1ui_func _IndexFunc; - trans_1f_func _FogCoordFunc; - trans_4ub_func _SecondaryColorFunc; - trans_4f_func _TexCoordFunc[MAX_TEXTURE_UNITS]; - trans_1ub_func _EdgeFlagFunc; - GLint TexCoordInterleaveFactor; GLint ActiveTexture; /* Client Active Texture */ - GLuint LockFirst; GLuint LockCount; + + GLuint _Enabled; /* _NEW_ARRAY_* - bit set if array enabled */ + GLuint NewState; /* _NEW_ARRAY_* */ }; @@ -981,7 +998,7 @@ struct gl_array_attrib { struct gl_feedback { GLenum Type; - GLuint Mask; + GLuint _Mask; /* FB_* bits */ GLfloat *Buffer; GLuint BufferSize; GLuint Count; @@ -1260,7 +1277,7 @@ struct gl_extensions { /* - * Bits to indicate what state has changed. + * Bits to indicate what state has changed. 6 unused flags. */ #define _NEW_MODELVIEW 0x1 /* ctx->ModelView */ #define _NEW_PROJECTION 0x2 /* ctx->Projection */ @@ -1272,11 +1289,11 @@ struct gl_extensions { #define _NEW_EVAL 0x80 /* ctx->Eval, ctx->EvalMap */ #define _NEW_FOG 0x100 /* ctx->Fog */ #define _NEW_HINT 0x200 /* ctx->Hint */ -#define _NEW_400 0x400 /* unused */ +#define _NEW_400 0x400 /* */ #define _NEW_LIGHT 0x800 /* ctx->Light */ -#define _NEW_1000 0x1000 /* unused */ +#define _NEW_1000 0x1000 /* */ #define _NEW_LINE 0x2000 /* ctx->Line */ -#define _NEW_FEEDBACK_SELECT 0x4000 /* ctx->Feedback, ctx->Select */ +#define _NEW_4000 0x4000 /* */ #define _NEW_PIXEL 0x8000 /* ctx->Pixel */ #define _NEW_POINT 0x10000 /* ctx->Point */ #define _NEW_POLYGON 0x20000 /* ctx->Polygon */ @@ -1289,36 +1306,53 @@ struct gl_extensions { #define _NEW_PACKUNPACK 0x1000000 /* ctx->Pack, ctx->Unpack */ #define _NEW_ARRAY 0x2000000 /* ctx->Array */ #define _NEW_COLORTABLE 0x4000000 /* ctx->{*}ColorTable */ -#define _NEW_RENDERMODE 0x8000000 /* ctx->RenderMode */ +#define _NEW_RENDERMODE 0x8000000 /* RenderMode, Feedback, Select */ #define _NEW_BUFFERS 0x10000000 /* ctx->Visual, ctx->DrawBuffer, */ #define _NEW_ALL ~0 -/* What can the driver do, what requires us to call render_triangle or - * a non-driver rasterize function? +/* Bits to track array state changes (also used to summarize array enabled) + */ +#define _NEW_ARRAY_VERTEX 0x1 +#define _NEW_ARRAY_COLOR 0x2 +#define _NEW_ARRAY_NORMAL 0x4 +#define _NEW_ARRAY_INDEX 0x8 +#define _NEW_ARRAY_EDGEFLAG 0x10 +#define _NEW_ARRAY_SECONDARYCOLOR 0x20 +#define _NEW_ARRAY_FOGCOORD 0x40 +#define _NEW_ARRAY_TEXCOORD_0 0x80 +#define _NEW_ARRAY_TEXCOORD_1 0x100 +#define _NEW_ARRAY_TEXCOORD_2 0x200 +#define _NEW_ARRAY_TEXCOORD_3 0x400 +#define _NEW_ARRAY_TEXCOORD_4 0x800 +#define _NEW_ARRAY_TEXCOORD_5 0x1000 +#define _NEW_ARRAY_TEXCOORD_6 0x2000 +#define _NEW_ARRAY_TEXCOORD_7 0x4000 +#define _NEW_ARRAY_ALL 0x7fff + +#define _NEW_ARRAY_TEXCOORD(i) (_NEW_ARRAY_TEXCOORD_0<<(i)) + +/* A bunch of flags that we think might be useful to drivers. */ #define DD_FEEDBACK 0x1 #define DD_SELECT 0x2 #define DD_FLATSHADE 0x4 -#define DD_MULTIDRAW 0x8 #define DD_SEPERATE_SPECULAR 0x10 #define DD_TRI_LIGHT_TWOSIDE 0x20 #define DD_TRI_UNFILLED 0x40 #define DD_TRI_SMOOTH 0x80 #define DD_TRI_STIPPLE 0x100 #define DD_TRI_OFFSET 0x200 -#define DD_TRI_CULL 0x400 #define DD_LINE_SMOOTH 0x800 #define DD_LINE_STIPPLE 0x1000 #define DD_LINE_WIDTH 0x2000 #define DD_POINT_SMOOTH 0x4000 #define DD_POINT_SIZE 0x8000 #define DD_POINT_ATTEN 0x10000 -#define DD_LIGHTING_CULL 0x20000 -#define DD_TRI_CULL_FRONT_BACK 0x400000 /* not supported by most drivers */ -#define DD_Z_NEVER 0x800000 +#define DD_TRI_CULL_FRONT_BACK 0x400000 /* special case on some hw */ +#define DD_Z_NEVER 0x800000 /* special case on some hw */ #define DD_STENCIL 0x1000000 /* Define the state changes under which each of these bits might change @@ -1333,7 +1367,6 @@ struct gl_extensions { #define _DD_NEW_TRI_SMOOTH _NEW_POLYGON #define _DD_NEW_TRI_STIPPLE _NEW_POLYGON #define _DD_NEW_TRI_OFFSET _NEW_POLYGON -#define _DD_NEW_TRI_CULL _NEW_POLYGON #define _DD_NEW_LINE_SMOOTH _NEW_LINE #define _DD_NEW_LINE_STIPPLE _NEW_LINE #define _DD_NEW_LINE_WIDTH _NEW_LINE @@ -1345,25 +1378,17 @@ struct gl_extensions { #define _DD_NEW_Z_NEVER _NEW_DEPTH #define _DD_NEW_STENCIL _NEW_STENCIL -#define _TNL_NEW_RENDERFLAGS (_NEW_TEXTURE | \ - _DD_NEW_SEPERATE_SPECULAR | \ - _NEW_POLYGON | \ - _NEW_FOG | \ - _NEW_RENDERMODE) -#define _TNL_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \ - _NEW_TEXTURE| \ - _NEW_POINT| \ - _NEW_MODELVIEW) - -#define _TNL_NEW_NEED_NORMALS (_NEW_LIGHT| \ - _NEW_TEXTURE) +#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT| \ + _NEW_TEXTURE| \ + _NEW_POINT| \ + _NEW_MODELVIEW) + +#define _MESA_NEW_NEED_NORMALS (_NEW_LIGHT| \ + _NEW_TEXTURE) -#define _TNL_NEW_NORMAL_TRANSFORM (_NEW_MODELVIEW|_NEW_TRANSFORM| \ - _TNL_NEW_NEED_NORMALS) +#define _IMAGE_NEW_TRANSFER_STATE (_NEW_PIXEL|_NEW_COLOR_MATRIX) -#define _TNL_NEW_SPACES (_TNL_NEW_NEED_NORMALS | \ - _TNL_NEW_NEED_EYE_COORDS ) #define NEED_NORMALS_TEXGEN 0x1 #define NEED_NORMALS_LIGHT 0x2 @@ -1375,15 +1400,6 @@ struct gl_extensions { -#define DD_ANY_CULL (DD_TRI_CULL_FRONT_BACK| \ - DD_TRI_CULL| \ - DD_LIGHTING_CULL) - - - - - - /* * Forward declaration of display list datatypes: */ @@ -1534,7 +1550,7 @@ struct __GLcontextRec { GLuint _NeedEyeCoords; GLuint _NeedNormals; /* Are vertex normal vectors needed? */ - struct gl_shine_tab *_ShineTable[4]; /* Active shine tables */ + struct gl_shine_tab *_ShineTable[2]; /* Active shine tables */ struct gl_shine_tab *_ShineTabList; /* Mru list of inactive shine tables */ struct gl_list_extensions listext; /* driver dlist extensions */ @@ -1568,13 +1584,14 @@ struct __GLcontextRec { void *swrast_context; void *swsetup_context; void *swtnl_context; - void *swtnl_vb; void *swtnl_im; + void *acache_context; + void *aelt_context; }; /* The string names for GL_POINT, GL_LINE_LOOP, etc */ -extern const char *_mesa_prim_name[GL_POLYGON+2]; +extern const char *_mesa_prim_name[GL_POLYGON+4]; extern GLenum gl_reduce_prim[]; @@ -1598,8 +1615,6 @@ enum _verbose { VERBOSE_DRIVER = 0x10, VERBOSE_STATE = 0x20, VERBOSE_API = 0x40, - VERBOSE_TRIANGLE_CHECKS = 0x80, - VERBOSE_CULL = 0x100, VERBOSE_DISPLAY_LIST = 0x200, VERBOSE_LIGHTING = 0x400 }; @@ -1614,50 +1629,45 @@ enum _debug { #define Elements(x) sizeof(x)/sizeof(*(x)) -#define FLUSH_TNL( ctx, flags ) \ -do { \ - if (ctx->Driver.NeedFlush & flags) \ - ctx->Driver.FlushVertices( ctx, flags ); \ -} while (0) -#define FLUSH_TNL_RETURN( ctx, flags, where ) \ +/* Eventually let the driver specify what statechanges require a flush: + */ +#define FLUSH_VERTICES(ctx, newstate) \ do { \ - if (ctx->Driver.NeedFlush & flags) { \ - if (!ctx->Driver.FlushVertices( ctx, flags )) { \ - gl_error( ctx, GL_INVALID_OPERATION, where ); \ - return; \ - } \ - } \ + if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ + ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \ + ctx->NewState |= newstate; \ } while (0) -#define FLUSH_TNL_RETVAL( ctx, flags, where, what ) \ +#define FLUSH_CURRENT(ctx, newstate) \ do { \ - if (ctx->Driver.NeedFlush & flags) { \ - if (!ctx->Driver.FlushVertices( ctx, flags )) { \ - gl_error( ctx, GL_INVALID_OPERATION, where ); \ - return what; \ - } \ - } \ + if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \ + ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \ + ctx->NewState |= newstate; \ } while (0) +#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \ +do { \ + if (ctx->Driver.CurrentExecPrimitive != GL_POLYGON+1) { \ + gl_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \ + return retval; \ + } \ +} while (0); FLUSH_VERTICES(ctx, 0) -#define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, where, what ) \ - FLUSH_TNL_RETVAL( ctx, \ - (FLUSH_INSIDE_BEGIN_END| \ - FLUSH_STORED_VERTICES), \ - where, what ) +#define ASSERT_OUTSIDE_BEGIN_END(ctx) \ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx,); FLUSH_VERTICES(ctx, 0) -#define ASSERT_OUTSIDE_BEGIN_END( ctx, where ) \ - FLUSH_TNL_RETURN( ctx, \ - (FLUSH_INSIDE_BEGIN_END| \ - FLUSH_STORED_VERTICES), \ - where ) +#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx) \ +do { \ + ASSERT_OUTSIDE_BEGIN_END(ctx); \ + FLUSH_VERTICES(ctx, 0); \ +} while (0) -#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, where ) \ - ASSERT_OUTSIDE_BEGIN_END( ctx, where ); - -#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL( ctx, where, what ) \ - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL( ctx, where, what ); +#define ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval) \ +do { \ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval); \ + FLUSH_VERTICES(ctx, 0); \ +} while (0) #ifdef DEBUG diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index cb0818c084d..6bbbbdfe3ec 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1,4 +1,4 @@ -/* $Id: pixel.c,v 1.21 2000/12/13 00:46:21 brianp Exp $ */ +/* $Id: pixel.c,v 1.22 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -49,11 +49,14 @@ void _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelZoom"); + if (ctx->Pixel.ZoomX == xfactor && + ctx->Pixel.ZoomY == yfactor) + return; + + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.ZoomX = xfactor; ctx->Pixel.ZoomY = yfactor; - ctx->NewState |= _NEW_PIXEL; } @@ -68,118 +71,162 @@ _mesa_PixelStorei( GLenum pname, GLint param ) { /* NOTE: this call can't be compiled into the display list */ GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelStore"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_PACK_SWAP_BYTES: + if (param == (GLint)ctx->Pack.SwapBytes) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.SwapBytes = param ? GL_TRUE : GL_FALSE; break; case GL_PACK_LSB_FIRST: + if (param == (GLint)ctx->Pack.LsbFirst) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Pack.LsbFirst = param ? GL_TRUE : GL_FALSE; break; case GL_PACK_ROW_LENGTH: if (param<0) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; } - else { - ctx->Pack.RowLength = param; - } + if (ctx->Pack.RowLength == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.RowLength = param; break; case GL_PACK_IMAGE_HEIGHT: - if (param<0) + if (param<0) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - else - ctx->Pack.ImageHeight = param; + return; + } + if (ctx->Pack.ImageHeight == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.ImageHeight = param; break; case GL_PACK_SKIP_PIXELS: if (param<0) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; } - else { - ctx->Pack.SkipPixels = param; - } + if (ctx->Pack.SkipPixels == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.SkipPixels = param; break; case GL_PACK_SKIP_ROWS: if (param<0) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; } - else { - ctx->Pack.SkipRows = param; - } + if (ctx->Pack.SkipRows == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.SkipRows = param; break; case GL_PACK_SKIP_IMAGES: if (param<0) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; } - else { - ctx->Pack.SkipImages = param; - } + if (ctx->Pack.SkipImages == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.SkipImages = param; break; case GL_PACK_ALIGNMENT: - if (param==1 || param==2 || param==4 || param==8) { - ctx->Pack.Alignment = param; - } - else { + if (param!=1 && param!=2 && param!=4 && param!=8) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; } + if (ctx->Pack.Alignment == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Pack.Alignment = param; break; case GL_UNPACK_SWAP_BYTES: + if (param == (GLint)ctx->Unpack.SwapBytes) + return; + if ((GLint)ctx->Unpack.SwapBytes == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.SwapBytes = param ? GL_TRUE : GL_FALSE; break; case GL_UNPACK_LSB_FIRST: + if (param == (GLint)ctx->Unpack.LsbFirst) + return; + if ((GLint)ctx->Unpack.LsbFirst == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); ctx->Unpack.LsbFirst = param ? GL_TRUE : GL_FALSE; break; case GL_UNPACK_ROW_LENGTH: if (param<0) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; } - else { - ctx->Unpack.RowLength = param; - } + if (ctx->Unpack.RowLength == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.RowLength = param; break; case GL_UNPACK_IMAGE_HEIGHT: - if (param<0) + if (param<0) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); - else - ctx->Unpack.ImageHeight = param; + return; + } + if (ctx->Unpack.ImageHeight == param) + return; + + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.ImageHeight = param; break; case GL_UNPACK_SKIP_PIXELS: if (param<0) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; } - else { - ctx->Unpack.SkipPixels = param; - } + if (ctx->Unpack.SkipPixels == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.SkipPixels = param; break; case GL_UNPACK_SKIP_ROWS: if (param<0) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; } - else { - ctx->Unpack.SkipRows = param; - } + if (ctx->Unpack.SkipRows == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.SkipRows = param; break; case GL_UNPACK_SKIP_IMAGES: if (param < 0) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore(param)" ); + return; } - else { - ctx->Unpack.SkipImages = param; - } + if (ctx->Unpack.SkipImages == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.SkipImages = param; break; case GL_UNPACK_ALIGNMENT: - if (param==1 || param==2 || param==4 || param==8) { - ctx->Unpack.Alignment = param; - } - else { + if (param!=1 && param!=2 && param!=4 && param!=8) { gl_error( ctx, GL_INVALID_VALUE, "glPixelStore" ); + return; } + if (ctx->Unpack.Alignment == param) + return; + FLUSH_VERTICES(ctx, _NEW_PACKUNPACK); + ctx->Unpack.Alignment = param; break; default: gl_error( ctx, GL_INVALID_ENUM, "glPixelStore" ); + return; } - - ctx->NewState |= _NEW_PACKUNPACK; } @@ -202,8 +249,7 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) { GLint i; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelMapfv"); - + ASSERT_OUTSIDE_BEGIN_END(ctx); if (mapsize<0 || mapsize>MAX_PIXEL_MAP_TABLE) { gl_error( ctx, GL_INVALID_VALUE, "glPixelMapfv(mapsize)" ); @@ -226,6 +272,8 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) } } + FLUSH_VERTICES(ctx, _NEW_PIXEL); + switch (map) { case GL_PIXEL_MAP_S_TO_S: ctx->Pixel.MapStoSsize = mapsize; @@ -298,7 +346,6 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values ) default: gl_error( ctx, GL_INVALID_ENUM, "glPixelMapfv(map)" ); } - ctx->NewState |= _NEW_PIXEL; } @@ -348,8 +395,7 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); GLint i; - - ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (map) { case GL_PIXEL_MAP_I_TO_I: @@ -397,8 +443,7 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values ) { GET_CURRENT_CONTEXT(ctx); GLint i; - - ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (map) { case GL_PIXEL_MAP_I_TO_I: @@ -458,8 +503,7 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values ) { GET_CURRENT_CONTEXT(ctx); GLint i; - - ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetPixelMapfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (map) { case GL_PIXEL_MAP_I_TO_I: @@ -532,107 +576,193 @@ void _mesa_PixelTransferf( GLenum pname, GLfloat param ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPixelTransfer"); - + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_MAP_COLOR: + if (ctx->Pixel.MapColorFlag == param ? GL_TRUE : GL_FALSE) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.MapColorFlag = param ? GL_TRUE : GL_FALSE; break; case GL_MAP_STENCIL: + if (ctx->Pixel.MapStencilFlag == param ? GL_TRUE : GL_FALSE) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.MapStencilFlag = param ? GL_TRUE : GL_FALSE; break; case GL_INDEX_SHIFT: + if (ctx->Pixel.IndexShift == (GLint) param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.IndexShift = (GLint) param; break; case GL_INDEX_OFFSET: + if (ctx->Pixel.IndexOffset == (GLint) param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.IndexOffset = (GLint) param; break; case GL_RED_SCALE: + if (ctx->Pixel.RedScale == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.RedScale = param; break; case GL_RED_BIAS: + if (ctx->Pixel.RedBias == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.RedBias = param; break; case GL_GREEN_SCALE: + if (ctx->Pixel.GreenScale == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.GreenScale = param; break; case GL_GREEN_BIAS: + if (ctx->Pixel.GreenBias == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.GreenBias = param; break; case GL_BLUE_SCALE: + if (ctx->Pixel.BlueScale == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.BlueScale = param; break; case GL_BLUE_BIAS: + if (ctx->Pixel.BlueBias == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.BlueBias = param; break; case GL_ALPHA_SCALE: + if (ctx->Pixel.AlphaScale == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.AlphaScale = param; break; case GL_ALPHA_BIAS: + if (ctx->Pixel.AlphaBias == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.AlphaBias = param; break; case GL_DEPTH_SCALE: + if (ctx->Pixel.DepthScale == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.DepthScale = param; break; case GL_DEPTH_BIAS: + if (ctx->Pixel.DepthBias == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.DepthBias = param; break; case GL_POST_COLOR_MATRIX_RED_SCALE: + if (ctx->Pixel.PostColorMatrixScale[0] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixScale[0] = param; break; case GL_POST_COLOR_MATRIX_RED_BIAS: + if (ctx->Pixel.PostColorMatrixBias[0] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixBias[0] = param; break; case GL_POST_COLOR_MATRIX_GREEN_SCALE: + if (ctx->Pixel.PostColorMatrixScale[1] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixScale[1] = param; break; case GL_POST_COLOR_MATRIX_GREEN_BIAS: + if (ctx->Pixel.PostColorMatrixBias[1] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixBias[1] = param; break; case GL_POST_COLOR_MATRIX_BLUE_SCALE: + if (ctx->Pixel.PostColorMatrixScale[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixScale[2] = param; break; case GL_POST_COLOR_MATRIX_BLUE_BIAS: + if (ctx->Pixel.PostColorMatrixBias[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixBias[2] = param; break; case GL_POST_COLOR_MATRIX_ALPHA_SCALE: + if (ctx->Pixel.PostColorMatrixScale[3] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixScale[3] = param; break; case GL_POST_COLOR_MATRIX_ALPHA_BIAS: + if (ctx->Pixel.PostColorMatrixBias[3] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostColorMatrixBias[3] = param; break; case GL_POST_CONVOLUTION_RED_SCALE: + if (ctx->Pixel.PostConvolutionScale[0] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionScale[0] = param; break; case GL_POST_CONVOLUTION_RED_BIAS: + if (ctx->Pixel.PostConvolutionBias[0] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionBias[0] = param; break; case GL_POST_CONVOLUTION_GREEN_SCALE: + if (ctx->Pixel.PostConvolutionScale[1] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionScale[1] = param; break; case GL_POST_CONVOLUTION_GREEN_BIAS: + if (ctx->Pixel.PostConvolutionBias[1] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionBias[1] = param; break; case GL_POST_CONVOLUTION_BLUE_SCALE: + if (ctx->Pixel.PostConvolutionScale[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionScale[2] = param; break; case GL_POST_CONVOLUTION_BLUE_BIAS: + if (ctx->Pixel.PostConvolutionBias[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionBias[2] = param; break; case GL_POST_CONVOLUTION_ALPHA_SCALE: + if (ctx->Pixel.PostConvolutionScale[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionScale[2] = param; break; case GL_POST_CONVOLUTION_ALPHA_BIAS: + if (ctx->Pixel.PostConvolutionBias[2] == param) + return; + FLUSH_VERTICES(ctx, _NEW_PIXEL); ctx->Pixel.PostConvolutionBias[2] = param; break; default: gl_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" ); return; } - - /* signal to recompute the bitmask */ - ctx->NewState |= _NEW_PIXEL; } diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index b70e5f05c47..3becddb34cc 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -1,4 +1,4 @@ -/* $Id: points.c,v 1.25 2000/12/08 00:20:15 brianp Exp $ */ +/* $Id: points.c,v 1.26 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -44,21 +44,22 @@ void _mesa_PointSize( GLfloat size ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointSize"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (size <= 0.0) { gl_error( ctx, GL_INVALID_VALUE, "glPointSize" ); return; } - if (ctx->Point.Size != size) { - ctx->Point.Size = size; - ctx->Point._Size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); - ctx->_TriangleCaps &= ~DD_POINT_SIZE; - if (size != 1.0) - ctx->_TriangleCaps |= DD_POINT_SIZE; - ctx->NewState |= _NEW_POINT; - } + if (ctx->Point.Size == size) + return; + + FLUSH_VERTICES(ctx, _NEW_POINT); + ctx->Point.Size = size; + ctx->Point._Size = CLAMP(size, + ctx->Const.MinPointSize, + ctx->Const.MaxPointSize); + ctx->_TriangleCaps ^= DD_POINT_SIZE; } @@ -74,13 +75,22 @@ void _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPointParameterfvEXT"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (pname) { case GL_DISTANCE_ATTENUATION_EXT: { const GLboolean tmp = ctx->Point._Attenuated; + if (TEST_EQ_3V(ctx->Point.Params, params)) + return; + + FLUSH_VERTICES(ctx, _NEW_POINT); COPY_3V(ctx->Point.Params, params); + + /* Update several derived values now. This likely to be + * more efficient than trying to catch this statechange in + * state.c. + */ ctx->Point._Attenuated = (params[0] != 1.0 || params[1] != 0.0 || params[2] != 0.0); @@ -88,7 +98,6 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) if (tmp != ctx->Point._Attenuated) { ctx->_Enabled ^= ENABLE_POINT_ATTEN; ctx->_TriangleCaps ^= DD_POINT_ATTEN; - /* XXX why is this here and not in state.c? */ ctx->_NeedEyeCoords ^= NEED_EYE_POINT_ATTEN; } } @@ -98,6 +107,9 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" ); return; } + if (ctx->Point.MinSize == *params) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.MinSize = *params; break; case GL_POINT_SIZE_MAX_EXT: @@ -105,6 +117,9 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" ); return; } + if (ctx->Point.MaxSize == *params) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.MaxSize = *params; break; case GL_POINT_FADE_THRESHOLD_SIZE_EXT: @@ -112,13 +127,14 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) gl_error( ctx, GL_INVALID_VALUE, "glPointParameterfvEXT" ); return; } + if (ctx->Point.Threshold == *params) + return; + FLUSH_VERTICES(ctx, _NEW_POINT); ctx->Point.Threshold = *params; break; default: gl_error( ctx, GL_INVALID_ENUM, "glPointParameterfvEXT" ); return; } - - ctx->NewState |= _NEW_POINT; } diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index b48d70eaf93..68bcbbe3b80 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -1,4 +1,4 @@ -/* $Id: polygon.c,v 1.16 2000/11/22 07:32:17 joukj Exp $ */ +/* $Id: polygon.c,v 1.17 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -44,7 +44,7 @@ void _mesa_CullFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCullFace"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glCullFace %s\n", gl_lookup_enum_by_nr(mode)); @@ -54,8 +54,11 @@ _mesa_CullFace( GLenum mode ) return; } + if (ctx->Polygon.CullFaceMode == mode) + return; + + FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.CullFaceMode = mode; - ctx->NewState |= _NEW_POLYGON; if (ctx->Driver.CullFace) ctx->Driver.CullFace( ctx, mode ); @@ -67,7 +70,7 @@ void _mesa_FrontFace( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFrontFace"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glFrontFace %s\n", gl_lookup_enum_by_nr(mode)); @@ -77,9 +80,13 @@ _mesa_FrontFace( GLenum mode ) return; } + if (ctx->Polygon.FrontFace == mode) + return; + + FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.FrontFace = mode; - ctx->Polygon.FrontBit = (GLboolean) (mode == GL_CW); - ctx->NewState |= _NEW_POLYGON; + + ctx->Polygon._FrontBit = (GLboolean) (mode == GL_CW); if (ctx->Driver.FrontFace) ctx->Driver.FrontFace( ctx, mode ); @@ -91,39 +98,47 @@ void _mesa_PolygonMode( GLenum face, GLenum mode ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonMode"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glPolygonMode %s %s\n", gl_lookup_enum_by_nr(face), gl_lookup_enum_by_nr(mode)); - if (face!=GL_FRONT && face!=GL_BACK && face!=GL_FRONT_AND_BACK) { - gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" ); - return; - } - else if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) { + if (mode!=GL_POINT && mode!=GL_LINE && mode!=GL_FILL) { gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(mode)" ); return; } - if (face==GL_FRONT || face==GL_FRONT_AND_BACK) { + switch (face) { + case GL_FRONT: + if (ctx->Polygon.FrontMode == mode) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.FrontMode = mode; + break; + case GL_FRONT_AND_BACK: + if (ctx->Polygon.FrontMode == mode && + ctx->Polygon.BackMode == mode) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.FrontMode = mode; - } - if (face==GL_BACK || face==GL_FRONT_AND_BACK) { ctx->Polygon.BackMode = mode; + break; + case GL_BACK: + if (ctx->Polygon.BackMode == mode) + return; + FLUSH_VERTICES(ctx, _NEW_POLYGON); + ctx->Polygon.BackMode = mode; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" ); + return; } - /* Compute a handy "shortcut" value: */ 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; + if (ctx->Polygon.FrontMode!=GL_FILL || ctx->Polygon.BackMode!=GL_FILL) ctx->_TriangleCaps |= DD_TRI_UNFILLED; - } - - ctx->NewState |= _NEW_POLYGON; if (ctx->Driver.PolygonMode) { (*ctx->Driver.PolygonMode)( ctx, face, mode ); @@ -136,15 +151,14 @@ void _mesa_PolygonStipple( const GLubyte *pattern ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonStipple"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glPolygonStipple\n"); + FLUSH_VERTICES(ctx, _NEW_POLYGONSTIPPLE); _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack); - ctx->NewState |= _NEW_POLYGONSTIPPLE; - if (ctx->Driver.PolygonStipple) ctx->Driver.PolygonStipple( ctx, (const GLubyte *) ctx->PolygonStipple ); } @@ -155,7 +169,7 @@ void _mesa_GetPolygonStipple( GLubyte *dest ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glGetPolygonStipple\n"); @@ -169,15 +183,19 @@ void _mesa_PolygonOffset( GLfloat factor, GLfloat units ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glPolygonOffset %f %f\n", factor, units); + if (ctx->Polygon.OffsetFactor == factor && + ctx->Polygon.OffsetUnits == units) + return; + + FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.OffsetFactor = factor; ctx->Polygon.OffsetUnits = units; ctx->Polygon.OffsetMRD = units * ctx->Visual.MRD; - ctx->NewState |= _NEW_POLYGON; } @@ -186,6 +204,5 @@ void _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffsetEXT"); _mesa_PolygonOffset(factor, bias * ctx->Visual.DepthMaxF ); } diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 2865e7e0d49..e0204523c41 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -1,4 +1,4 @@ -/* $Id: rastpos.c,v 1.17 2000/11/27 18:22:13 brianp Exp $ */ +/* $Id: rastpos.c,v 1.18 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -241,14 +241,8 @@ static void raster_pos4f( GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GLfloat v[4], eye[4], clip[4], ndc[3], d; - - /* KW: Added this test, which is in the spec. We can't do this - * inside begin/end any more because the ctx->Current values - * aren't uptodate during that period. - */ - FLUSH_TNL_RETURN(ctx, (FLUSH_INSIDE_BEGIN_END| - FLUSH_STORED_VERTICES| - FLUSH_UPDATE_CURRENT), "raster_pos4f"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + FLUSH_CURRENT(ctx, 0); if (ctx->NewState) gl_update_state( ctx ); diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index e5ca69ea614..43e4872d66f 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.52 2000/12/16 00:19:12 brianp Exp $ */ +/* $Id: state.c,v 1.53 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -26,8 +26,7 @@ /* - * This file initializes the immediate-mode dispatch table (which may - * be state-dependant) and manages internal Mesa state update. + * This file manages internal Mesa state update. */ @@ -80,13 +79,11 @@ #include "varray.h" #include "winpos.h" -#include "swrast/swrast.h" #include "math/m_matrix.h" #include "math/m_xform.h" #endif - static int generic_noop(void) { @@ -112,6 +109,7 @@ _mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize) } + /* * Initialize the given dispatch table with pointers to Mesa's * immediate-mode commands. @@ -501,27 +499,10 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) static void update_polygon( GLcontext *ctx ) { - ctx->_TriangleCaps &= ~DD_TRI_CULL_FRONT_BACK; - - /* Setup CullBits bitmask */ - if (ctx->Polygon.CullFlag) { - switch(ctx->Polygon.CullFaceMode) { - case GL_BACK: - ctx->Polygon._CullBits = 1; - break; - case GL_FRONT: - ctx->Polygon._CullBits = 2; - break; - default: - case GL_FRONT_AND_BACK: - ctx->Polygon._CullBits = 0; - ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK; - break; - } - } - else { - ctx->Polygon._CullBits = 3; - } + ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET); + +/* if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) */ +/* ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK; */ /* Any Polygon offsets enabled? */ ctx->Polygon._OffsetAny = GL_FALSE; @@ -587,8 +568,8 @@ update_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords ) else { GLuint new_state = ctx->NewState; - /* Recalculate that same state if and only if it has been - * invalidated by other statechanges. + /* Recalculate that same state only if it has been invalidated + * by other statechanges. */ if (new_state & _NEW_MODELVIEW) update_modelview_scale(ctx); @@ -652,7 +633,6 @@ update_projection( GLcontext *ctx ) } - /* * Return a bitmask of IMAGE_*_BIT flags which to indicate which * pixel transfer operations are enabled. @@ -725,13 +705,17 @@ update_image_transfer_state(GLcontext *ctx) * rendering any primitive. Basically, function pointers and miscellaneous * flags are updated to reflect the current state of the state machine. * - * Special care is taken with the derived value _NeedEyeCoords. These + * The above constraint is now maintained largely by the two Exec + * dispatch tables, which trigger the appropriate flush on transition + * between State and Geometry modes. + * + * Special care is taken with the derived value _NeedEyeCoords. This * is a bitflag which is updated with information from a number of * attribute groups (MODELVIEW, LIGHT, TEXTURE). A lot of derived * state references this value, and must be treated with care to * ensure that updates are done correctly. All state dependent on * _NeedEyeCoords is calculated from within _mesa_update_tnl_spaces(), - * and from nowhere else. + * and from nowhere else. */ void gl_update_state( GLcontext *ctx ) { @@ -755,7 +739,7 @@ void gl_update_state( GLcontext *ctx ) /* References ColorMatrix.type (derived above). */ - if (new_state & (_NEW_PIXEL|_NEW_COLOR_MATRIX)) + if (new_state & _IMAGE_NEW_TRANSFER_STATE) update_image_transfer_state(ctx); /* Contributes to NeedEyeCoords, NeedNormals. @@ -784,27 +768,20 @@ void gl_update_state( GLcontext *ctx ) ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW; } - /* point attenuation requires eye coords */ - if (new_state & _NEW_POINT) { - if (ctx->Point._Attenuated) { - ctx->_NeedEyeCoords |= NEED_EYE_POINT_ATTEN; - } - } - /* ctx->_NeedEyeCoords and ctx->_NeedEyeNormals are now uptodate. + /* ctx->_NeedEyeCoords is now uptodate. * - * If the truth value of either has changed, update for the new - * lighting space and recompute the positions of lights and the + * If the truth value of this variable has changed, update for the + * new lighting space and recompute the positions of lights and the * normal transform. * * If the lighting space hasn't changed, may still need to recompute - * light positions & normal transforms for other reasons. + * light positions & normal transforms for other reasons. */ if (new_state & (_NEW_MODELVIEW | _NEW_PROJECTION | - _TNL_NEW_NORMAL_TRANSFORM | _NEW_LIGHT | - _TNL_NEW_NEED_EYE_COORDS)) + _MESA_NEW_NEED_EYE_COORDS)) update_tnl_spaces( ctx, oldneedeyecoords ); /* @@ -812,7 +789,12 @@ void gl_update_state( GLcontext *ctx ) * to it's specific, private functions, and performs any * internal state management necessary, including invalidating * state of active modules. + * + * Set ctx->NewState to zero to avoid recursion if + * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?) */ - ctx->Driver.UpdateState(ctx); ctx->NewState = 0; + ctx->Driver.UpdateState(ctx, new_state); + + ctx->Array.NewState = 0; } diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index 6aed338eb97..6775d58677a 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -1,4 +1,4 @@ -/* $Id: stencil.c,v 1.23 2000/11/22 07:32:17 joukj Exp $ */ +/* $Id: stencil.c,v 1.24 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -45,9 +45,13 @@ void _mesa_ClearStencil( GLint s ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glClearStencil"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Stencil.Clear == (GLstencil) s) + return; + + FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.Clear = (GLstencil) s; - ctx->NewState |= _NEW_STENCIL; if (ctx->Driver.ClearStencil) { (*ctx->Driver.ClearStencil)( ctx, s ); @@ -61,8 +65,7 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) { GET_CURRENT_CONTEXT(ctx); GLint maxref; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilFunc"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (func) { case GL_NEVER: @@ -73,7 +76,6 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) case GL_EQUAL: case GL_NOTEQUAL: case GL_ALWAYS: - ctx->Stencil.Function = func; break; default: gl_error( ctx, GL_INVALID_ENUM, "glStencilFunc" ); @@ -81,9 +83,17 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) } maxref = (1 << STENCIL_BITS) - 1; - ctx->Stencil.Ref = (GLstencil) CLAMP( ref, 0, maxref ); + ref = (GLstencil) CLAMP( ref, 0, maxref ); + + if (ctx->Stencil.Function == func && + ctx->Stencil.ValueMask == (GLstencil) mask && + ctx->Stencil.Ref == ref) + return; + + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.Function = func; + ctx->Stencil.Ref = ref; ctx->Stencil.ValueMask = (GLstencil) mask; - ctx->NewState |= _NEW_STENCIL; if (ctx->Driver.StencilFunc) { (*ctx->Driver.StencilFunc)( ctx, func, ctx->Stencil.Ref, mask ); @@ -96,9 +106,13 @@ void _mesa_StencilMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilMask"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Stencil.WriteMask == (GLstencil) mask) + return; + + FLUSH_VERTICES(ctx, _NEW_STENCIL); ctx->Stencil.WriteMask = (GLstencil) mask; - ctx->NewState |= _NEW_STENCIL; if (ctx->Driver.StencilMask) { (*ctx->Driver.StencilMask)( ctx, mask ); @@ -111,7 +125,8 @@ void _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glStencilOp"); + ASSERT_OUTSIDE_BEGIN_END(ctx); + switch (fail) { case GL_KEEP: case GL_ZERO: @@ -123,8 +138,7 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - ctx->Stencil.FailFunc = fail; + if (!ctx->Extensions.EXT_stencil_wrap) { break; } /* FALL-THROUGH */ @@ -139,12 +153,10 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) case GL_INCR: case GL_DECR: case GL_INVERT: - ctx->Stencil.ZFailFunc = zfail; break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: if (ctx->Extensions.EXT_stencil_wrap) { - ctx->Stencil.ZFailFunc = zfail; break; } /* FALL-THROUGH */ @@ -159,12 +171,10 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) case GL_INCR: case GL_DECR: case GL_INVERT: - ctx->Stencil.ZPassFunc = zpass; break; case GL_INCR_WRAP_EXT: case GL_DECR_WRAP_EXT: if (ctx->Extensions.EXT_stencil_wrap) { - ctx->Stencil.ZPassFunc = zpass; break; } /* FALL-THROUGH */ @@ -173,7 +183,15 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) return; } - ctx->NewState |= _NEW_STENCIL; + if (ctx->Stencil.ZFailFunc == zfail && + ctx->Stencil.ZPassFunc == zpass && + ctx->Stencil.FailFunc == fail) + return; + + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ZFailFunc = zfail; + ctx->Stencil.ZPassFunc = zpass; + ctx->Stencil.FailFunc = fail; if (ctx->Driver.StencilOp) { (*ctx->Driver.StencilOp)(ctx, fail, zfail, zpass); diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 4b6e855abc4..253acf65dae 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.68 2000/12/14 20:25:56 brianp Exp $ */ +/* $Id: teximage.c,v 1.69 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -1612,7 +1612,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, { GLsizei postConvWidth = width; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage1D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); adjust_texture_size_for_convolution(ctx, 1, &postConvWidth, NULL); @@ -1743,7 +1743,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, { GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage2D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); adjust_texture_size_for_convolution(ctx, 2, &postConvWidth,&postConvHeight); @@ -1884,7 +1884,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage3D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (target==GL_TEXTURE_3D_EXT) { struct gl_texture_unit *texUnit; @@ -2169,7 +2169,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, struct gl_texture_image *texImage; GLboolean discardImage; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexImage"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (level < 0 || level >= ctx->Const.MaxTextureLevels) { gl_error( ctx, GL_INVALID_VALUE, "glGetTexImage(level)" ); @@ -2648,7 +2648,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, { GLsizei postConvWidth = width; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage1D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); @@ -2691,7 +2691,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, { GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage2D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); @@ -2733,7 +2733,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, { GLsizei postConvWidth = width; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage1D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); @@ -2783,7 +2783,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, { GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage2D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); @@ -2833,7 +2833,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, { GLsizei postConvWidth = width, postConvHeight = height; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage3D"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (ctx->NewState & _NEW_PIXEL) gl_update_state(ctx); @@ -2883,7 +2883,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, const GLvoid *data) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage1DARB"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (internalFormat) { case GL_COMPRESSED_ALPHA_ARB: @@ -3010,7 +3010,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, const GLvoid *data) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage2DARB"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (internalFormat) { case GL_COMPRESSED_ALPHA_ARB: @@ -3145,7 +3145,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, GLsizei imageSize, const GLvoid *data) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage3DARB"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); switch (internalFormat) { case GL_COMPRESSED_ALPHA_ARB: @@ -3386,7 +3386,7 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) const struct gl_texture_object *texObj; struct gl_texture_image *texImage; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetCompressedTexImageARB"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (level < 0 || level >= ctx->Const.MaxTextureLevels) { gl_error( ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)" ); diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 68ce55b738d..1204668dc35 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1,4 +1,4 @@ -/* $Id: texobj.c,v 1.36 2000/12/14 20:25:56 brianp Exp $ */ +/* $Id: texobj.c,v 1.37 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -420,8 +420,8 @@ _mesa_GenTextures( GLsizei n, GLuint *texName ) GET_CURRENT_CONTEXT(ctx); GLuint first; GLint i; + ASSERT_OUTSIDE_BEGIN_END(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGenTextures"); if (n < 0) { gl_error( ctx, GL_INVALID_VALUE, "glGenTextures" ); return; @@ -462,8 +462,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *texName) { GET_CURRENT_CONTEXT(ctx); GLint i; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glDeleteTextures"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex */ if (!texName) return; @@ -525,13 +524,12 @@ _mesa_BindTexture( GLenum target, GLuint texName ) struct gl_texture_object *oldTexObj; struct gl_texture_object *newTexObj; GLuint targetDim; + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "glBindTexture %s %d\n", gl_lookup_enum_by_nr(target), (GLint) texName); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBindTexture"); - switch (target) { case GL_TEXTURE_1D: targetDim = 1; @@ -607,7 +605,11 @@ _mesa_BindTexture( GLenum target, GLuint texName ) newTexObj->RefCount++; - /* do the actual binding */ + + /* do the actual binding, but first flush outstanding vertices: + */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + switch (target) { case GL_TEXTURE_1D: texUnit->Current1D = newTexObj; @@ -625,8 +627,6 @@ _mesa_BindTexture( GLenum target, GLuint texName ) gl_problem(ctx, "bad target in BindTexture"); } - ctx->NewState |= _NEW_TEXTURE; - /* Pass BindTexture call to device driver */ if (ctx->Driver.BindTexture) (*ctx->Driver.BindTexture)( ctx, target, newTexObj ); @@ -654,8 +654,8 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, { GET_CURRENT_CONTEXT(ctx); GLint i; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPrioritizeTextures"); if (n < 0) { gl_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" ); return; @@ -691,9 +691,8 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, GET_CURRENT_CONTEXT(ctx); GLboolean allResident = GL_TRUE; GLint i; + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, - "glAreTexturesResident", GL_FALSE); if (n < 0) { gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)"); return GL_FALSE; @@ -737,13 +736,7 @@ GLboolean _mesa_IsTexture( GLuint texture ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glIsTextures", - GL_FALSE); - if (texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture)) { - return GL_TRUE; - } - else { - return GL_FALSE; - } + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + return texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture); } diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index eee2a3a6ae6..a34d60653df 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.25 2000/11/24 10:25:06 keithw Exp $ */ +/* $Id: texstate.c,v 1.26 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -69,259 +69,294 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexEnv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (target==GL_TEXTURE_ENV) { switch (pname) { - case GL_TEXTURE_ENV_MODE: - { - GLenum mode = (GLenum) (GLint) *param; - switch (mode) { - case GL_MODULATE: - case GL_BLEND: - case GL_DECAL: - case GL_REPLACE: - case GL_ADD: - case GL_COMBINE_EXT: - if (mode == GL_ADD && - !ctx->Extensions.EXT_texture_env_add) { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); - return; - } - if (mode == GL_COMBINE_EXT && - !ctx->Extensions.EXT_texture_env_combine) { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); - return; - } - if (texUnit->EnvMode == mode) - return; /* no change */ - texUnit->EnvMode = mode; - break; - default: - gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); - return; - } - } - break; - case GL_TEXTURE_ENV_COLOR: - texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F ); - texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F ); - texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F ); - texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F ); - break; - case GL_COMBINE_RGB_EXT: - if (ctx->Extensions.EXT_texture_env_combine) { - GLenum mode = (GLenum) (GLint) *param; - switch (mode) { - case GL_REPLACE: - case GL_MODULATE: - case GL_ADD: - case GL_ADD_SIGNED_EXT: - case GL_INTERPOLATE_EXT: - if (texUnit->CombineModeRGB == mode) - return; /* no change */ - texUnit->CombineModeRGB = mode; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); - return; - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - break; - case GL_COMBINE_ALPHA_EXT: - if (ctx->Extensions.EXT_texture_env_combine) { - GLenum mode = (GLenum) (GLint) *param; - switch (mode) { - case GL_REPLACE: - case GL_MODULATE: - case GL_ADD: - case GL_ADD_SIGNED_EXT: - case GL_INTERPOLATE_EXT: - if (texUnit->CombineModeA == mode) - return; /* no change */ - texUnit->CombineModeA = mode; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); - return; - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - break; - case GL_SOURCE0_RGB_EXT: - case GL_SOURCE1_RGB_EXT: - case GL_SOURCE2_RGB_EXT: - if (ctx->Extensions.EXT_texture_env_combine) { - GLenum source = (GLenum) (GLint) *param; - GLuint s = pname - GL_SOURCE0_RGB_EXT; - switch (source) { - case GL_TEXTURE: - case GL_CONSTANT_EXT: - case GL_PRIMARY_COLOR_EXT: - case GL_PREVIOUS_EXT: - if (texUnit->CombineSourceRGB[s] == source) - return; /* no change */ - texUnit->CombineSourceRGB[s] = source; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); - return; - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - break; - case GL_SOURCE0_ALPHA_EXT: - case GL_SOURCE1_ALPHA_EXT: - case GL_SOURCE2_ALPHA_EXT: - if (ctx->Extensions.EXT_texture_env_combine) { - GLenum source = (GLenum) (GLint) *param; - GLuint s = pname - GL_SOURCE0_ALPHA_EXT; - switch (source) { - case GL_TEXTURE: - case GL_CONSTANT_EXT: - case GL_PRIMARY_COLOR_EXT: - case GL_PREVIOUS_EXT: - if (texUnit->CombineSourceA[s] == source) return; - texUnit->CombineSourceA[s] = source; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); - return; - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - break; - case GL_OPERAND0_RGB_EXT: - case GL_OPERAND1_RGB_EXT: - if (ctx->Extensions.EXT_texture_env_combine) { - GLenum operand = (GLenum) (GLint) *param; - GLuint s = pname - GL_OPERAND0_RGB_EXT; - switch (operand) { - case GL_SRC_COLOR: - case GL_ONE_MINUS_SRC_COLOR: - case GL_SRC_ALPHA: - case GL_ONE_MINUS_SRC_ALPHA: - texUnit->CombineOperandRGB[s] = operand; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); - return; - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - break; - case GL_OPERAND0_ALPHA_EXT: - case GL_OPERAND1_ALPHA_EXT: - if (ctx->Extensions.EXT_texture_env_combine) { - GLenum operand = (GLenum) (GLint) *param; - switch (operand) { - case GL_SRC_ALPHA: - case GL_ONE_MINUS_SRC_ALPHA: - texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] - = operand; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); - return; - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - break; - case GL_OPERAND2_RGB_EXT: - if (ctx->Extensions.EXT_texture_env_combine) { - if ((GLenum) (GLint) *param == GL_SRC_ALPHA) { - texUnit->CombineOperandRGB[2] = (GLenum) (GLint) *param; - } - else { - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); - return; - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - break; - case GL_OPERAND2_ALPHA_EXT: - if (ctx->Extensions.EXT_texture_env_combine) { - if ((GLenum) (GLint) *param == GL_SRC_ALPHA) { - texUnit->CombineOperandA[2] = (GLenum) (GLint) *param; - } - else { - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); - return; - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - break; - case GL_RGB_SCALE_EXT: - if (ctx->Extensions.EXT_texture_env_combine) { - if (*param == 1.0) { - texUnit->CombineScaleShiftRGB = 0; - } - else if (*param == 2.0) { - texUnit->CombineScaleShiftRGB = 1; - } - else if (*param == 4.0) { - texUnit->CombineScaleShiftRGB = 2; - } - else { - gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); - return; - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - break; - case GL_ALPHA_SCALE: - if (ctx->Extensions.EXT_texture_env_combine) { - if (*param == 1.0) { - texUnit->CombineScaleShiftA = 0; - } - else if (*param == 2.0) { - texUnit->CombineScaleShiftA = 1; - } - else if (*param == 4.0) { - texUnit->CombineScaleShiftA = 2; - } - else { - gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); - return; - } - } - else { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); - return; - } - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); - return; + case GL_TEXTURE_ENV_MODE: { + GLenum mode = (GLenum) (GLint) *param; + + switch (mode) { + case GL_ADD: + if (!ctx->Extensions.EXT_texture_env_add) { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); + return; + } + break; + case GL_COMBINE_EXT: + if (!ctx->Extensions.EXT_texture_env_combine) { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); + return; + } + break; + case GL_MODULATE: + case GL_BLEND: + case GL_DECAL: + case GL_REPLACE: + break; + default: + gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); + return; + } + + if (texUnit->EnvMode == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->EnvMode = mode; + break; + } + case GL_TEXTURE_ENV_COLOR: { + GLfloat tmp[4]; + tmp[0] = CLAMP( param[0], 0.0F, 1.0F ); + tmp[1] = CLAMP( param[1], 0.0F, 1.0F ); + tmp[2] = CLAMP( param[2], 0.0F, 1.0F ); + tmp[3] = CLAMP( param[3], 0.0F, 1.0F ); + if (TEST_EQ_4V(tmp, texUnit->EnvColor)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EnvColor, tmp); + break; + } + case GL_COMBINE_RGB_EXT: + if (ctx->Extensions.EXT_texture_env_combine) { + GLenum mode = (GLenum) (GLint) *param; + switch (mode) { + case GL_REPLACE: + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED_EXT: + case GL_INTERPOLATE_EXT: + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + return; + } + if (texUnit->CombineModeRGB == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineModeRGB = mode; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); + return; + } + case GL_COMBINE_ALPHA_EXT: + if (ctx->Extensions.EXT_texture_env_combine) { + GLenum mode = (GLenum) (GLint) *param; + switch (mode) { + case GL_REPLACE: + case GL_MODULATE: + case GL_ADD: + case GL_ADD_SIGNED_EXT: + case GL_INTERPOLATE_EXT: + if (texUnit->CombineModeA == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineModeA = mode; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + return; + } + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); + return; + } + break; + case GL_SOURCE0_RGB_EXT: + case GL_SOURCE1_RGB_EXT: + case GL_SOURCE2_RGB_EXT: + if (ctx->Extensions.EXT_texture_env_combine) { + GLenum source = (GLenum) (GLint) *param; + GLuint s = pname - GL_SOURCE0_RGB_EXT; + switch (source) { + case GL_TEXTURE: + case GL_CONSTANT_EXT: + case GL_PRIMARY_COLOR_EXT: + case GL_PREVIOUS_EXT: + if (texUnit->CombineSourceRGB[s] == source) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineSourceRGB[s] = source; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + return; + } + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); + return; + } + break; + case GL_SOURCE0_ALPHA_EXT: + case GL_SOURCE1_ALPHA_EXT: + case GL_SOURCE2_ALPHA_EXT: + if (ctx->Extensions.EXT_texture_env_combine) { + GLenum source = (GLenum) (GLint) *param; + GLuint s = pname - GL_SOURCE0_ALPHA_EXT; + switch (source) { + case GL_TEXTURE: + case GL_CONSTANT_EXT: + case GL_PRIMARY_COLOR_EXT: + case GL_PREVIOUS_EXT: + if (texUnit->CombineSourceA[s] == source) return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineSourceA[s] = source; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + return; + } + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); + return; + } + break; + case GL_OPERAND0_RGB_EXT: + case GL_OPERAND1_RGB_EXT: + if (ctx->Extensions.EXT_texture_env_combine) { + GLenum operand = (GLenum) (GLint) *param; + GLuint s = pname - GL_OPERAND0_RGB_EXT; + switch (operand) { + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + if (texUnit->CombineOperandRGB[s] == operand) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineOperandRGB[s] = operand; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + return; + } + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); + return; + } + break; + case GL_OPERAND0_ALPHA_EXT: + case GL_OPERAND1_ALPHA_EXT: + if (ctx->Extensions.EXT_texture_env_combine) { + GLenum operand = (GLenum) (GLint) *param; + switch (operand) { + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + if (texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] == + operand) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineOperandA[pname-GL_OPERAND0_ALPHA_EXT] = operand; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + return; + } + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); + return; + } + break; + case GL_OPERAND2_RGB_EXT: + if (ctx->Extensions.EXT_texture_env_combine) { + GLenum operand = (GLenum) (GLint) *param; + switch (operand) { + case GL_SRC_ALPHA: + if (texUnit->CombineOperandRGB[2] == operand) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineOperandRGB[2] = operand; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + return; + } + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); + return; + } + break; + case GL_OPERAND2_ALPHA_EXT: + if (ctx->Extensions.EXT_texture_env_combine) { + GLenum operand = (GLenum) (GLint) *param; + switch (operand) { + case GL_SRC_ALPHA: + if (texUnit->CombineOperandA[2] == operand) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineOperandA[2] = operand; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + return; + } + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); + return; + } + break; + case GL_RGB_SCALE_EXT: + if (ctx->Extensions.EXT_texture_env_combine) { + GLuint newshift; + if (*param == 1.0) { + newshift = 0; + } + else if (*param == 2.0) { + newshift = 1; + } + else if (*param == 4.0) { + newshift = 2; + } + else { + gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); + return; + } + if (texUnit->CombineScaleShiftRGB == newshift) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineScaleShiftRGB = newshift; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); + return; + } + break; + case GL_ALPHA_SCALE: + if (ctx->Extensions.EXT_texture_env_combine) { + GLuint newshift; + if (*param == 1.0) { + newshift = 0; + } + else if (*param == 2.0) { + newshift = 1; + } + else if (*param == 4.0) { + newshift = 2; + } + else { + gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); + return; + } + if (texUnit->CombineScaleShiftA == newshift) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->CombineScaleShiftA = newshift; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(pname)"); + return; + } + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); + return; } } else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) { @@ -329,10 +364,14 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); return; } - if (pname == GL_TEXTURE_LOD_BIAS_EXT) { + switch (pname) { + case GL_TEXTURE_LOD_BIAS_EXT: + if (texUnit->LodBias == param[0]) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->LodBias = param[0]; - } - else { + break; + default: gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); return; } @@ -353,8 +392,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) if (ctx->Driver.TexEnv) { (*ctx->Driver.TexEnv)( ctx, target, pname, param ); } - - ctx->NewState |= _NEW_TEXTURE; } @@ -393,8 +430,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexEnvfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (target!=GL_TEXTURE_ENV) { gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnvfv(target)" ); @@ -447,8 +483,7 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexEnviv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_TEXTURE_ENV) { gl_error( ctx, GL_INVALID_ENUM, "glGetTexEnviv(target)" ); @@ -604,8 +639,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; GLenum eparam = (GLenum) (GLint) params[0]; struct gl_texture_object *texObj; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexParameterfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "texPARAM %s %s %d...\n", @@ -806,8 +840,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, const struct gl_texture_image *img = NULL; GLuint dimensions; GLboolean isProxy; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexLevelParameter"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (level < 0 || level >= ctx->Const.MaxTextureLevels) { gl_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" ); @@ -919,8 +952,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_object *obj; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexParameterfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); obj = _mesa_select_tex_object(ctx, texUnit, target); if (!obj) { @@ -987,8 +1019,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_object *obj; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexParameteriv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); obj = _mesa_select_tex_object(ctx, texUnit, target); if (!obj) { @@ -1069,7 +1100,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) GET_CURRENT_CONTEXT(ctx); GLuint tUnit = ctx->Texture.CurrentTransformUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexGenfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "texGEN %s %s %x...\n", @@ -1081,45 +1112,54 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; + GLuint bits; switch (mode) { case GL_OBJECT_LINEAR: - texUnit->GenModeS = mode; - texUnit->_GenBitS = TEXGEN_OBJ_LINEAR; + bits = TEXGEN_OBJ_LINEAR; break; case GL_EYE_LINEAR: - texUnit->GenModeS = mode; - texUnit->_GenBitS = TEXGEN_EYE_LINEAR; + bits = TEXGEN_EYE_LINEAR; break; case GL_REFLECTION_MAP_NV: - texUnit->GenModeS = mode; - texUnit->_GenBitS = TEXGEN_REFLECTION_MAP_NV; + bits = TEXGEN_REFLECTION_MAP_NV; break; case GL_NORMAL_MAP_NV: - texUnit->GenModeS = mode; - texUnit->_GenBitS = TEXGEN_NORMAL_MAP_NV; + bits = TEXGEN_NORMAL_MAP_NV; break; case GL_SPHERE_MAP: - texUnit->GenModeS = mode; - texUnit->_GenBitS = TEXGEN_SPHERE_MAP; + bits = TEXGEN_SPHERE_MAP; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } + if (texUnit->GenModeS == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeS = mode; + texUnit->_GenBitS = bits; } else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneS, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->ObjectPlaneS[0] = params[0]; texUnit->ObjectPlaneS[1] = params[1]; texUnit->ObjectPlaneS[2] = params[2]; texUnit->ObjectPlaneS[3] = params[3]; } else if (pname==GL_EYE_PLANE) { + GLfloat tmp[4]; + /* Transform plane equation by the inverse modelview matrix */ if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { _math_matrix_analyse( &ctx->ModelView ); } - gl_transform_vector( texUnit->EyePlaneS, params, - ctx->ModelView.inv ); + gl_transform_vector( tmp, params, ctx->ModelView.inv ); + if (TEST_EQ_4V(texUnit->EyePlaneS, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneS, tmp); } else { gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); @@ -1129,45 +1169,53 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) case GL_T: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; + GLuint bitt; switch (mode) { case GL_OBJECT_LINEAR: - texUnit->GenModeT = GL_OBJECT_LINEAR; - texUnit->_GenBitT = TEXGEN_OBJ_LINEAR; + bitt = TEXGEN_OBJ_LINEAR; break; case GL_EYE_LINEAR: - texUnit->GenModeT = GL_EYE_LINEAR; - texUnit->_GenBitT = TEXGEN_EYE_LINEAR; + bitt = TEXGEN_EYE_LINEAR; break; case GL_REFLECTION_MAP_NV: - texUnit->GenModeT = GL_REFLECTION_MAP_NV; - texUnit->_GenBitT = TEXGEN_REFLECTION_MAP_NV; + bitt = TEXGEN_REFLECTION_MAP_NV; break; case GL_NORMAL_MAP_NV: - texUnit->GenModeT = GL_NORMAL_MAP_NV; - texUnit->_GenBitT = TEXGEN_NORMAL_MAP_NV; + bitt = TEXGEN_NORMAL_MAP_NV; break; case GL_SPHERE_MAP: - texUnit->GenModeT = GL_SPHERE_MAP; - texUnit->_GenBitT = TEXGEN_SPHERE_MAP; + bitt = TEXGEN_SPHERE_MAP; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } + if (texUnit->GenModeT == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeT = mode; + texUnit->_GenBitT = bitt; } else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneT, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->ObjectPlaneT[0] = params[0]; texUnit->ObjectPlaneT[1] = params[1]; texUnit->ObjectPlaneT[2] = params[2]; texUnit->ObjectPlaneT[3] = params[3]; } else if (pname==GL_EYE_PLANE) { + GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ - if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { + if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { _math_matrix_analyse( &ctx->ModelView ); } - gl_transform_vector( texUnit->EyePlaneT, params, - ctx->ModelView.inv ); + gl_transform_vector( tmp, params, ctx->ModelView.inv ); + if (TEST_EQ_4V(texUnit->EyePlaneT, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneT, tmp); } else { gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); @@ -1177,41 +1225,50 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) case GL_R: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; + GLuint bitr; switch (mode) { case GL_OBJECT_LINEAR: - texUnit->GenModeR = GL_OBJECT_LINEAR; - texUnit->_GenBitR = TEXGEN_OBJ_LINEAR; + bitr = TEXGEN_OBJ_LINEAR; break; case GL_REFLECTION_MAP_NV: - texUnit->GenModeR = GL_REFLECTION_MAP_NV; - texUnit->_GenBitR = TEXGEN_REFLECTION_MAP_NV; + bitr = TEXGEN_REFLECTION_MAP_NV; break; case GL_NORMAL_MAP_NV: - texUnit->GenModeR = GL_NORMAL_MAP_NV; - texUnit->_GenBitR = TEXGEN_NORMAL_MAP_NV; + bitr = TEXGEN_NORMAL_MAP_NV; break; case GL_EYE_LINEAR: - texUnit->GenModeR = GL_EYE_LINEAR; - texUnit->_GenBitR = TEXGEN_EYE_LINEAR; + bitr = TEXGEN_EYE_LINEAR; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } + if (texUnit->GenModeR == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeR = mode; + texUnit->_GenBitR = bitr; } else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneR, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->ObjectPlaneR[0] = params[0]; texUnit->ObjectPlaneR[1] = params[1]; texUnit->ObjectPlaneR[2] = params[2]; texUnit->ObjectPlaneR[3] = params[3]; } else if (pname==GL_EYE_PLANE) { + GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { _math_matrix_analyse( &ctx->ModelView ); } - gl_transform_vector( texUnit->EyePlaneR, params, - ctx->ModelView.inv ); + gl_transform_vector( tmp, params, ctx->ModelView.inv ); + if (TEST_EQ_4V(texUnit->EyePlaneR, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneR, tmp); } else { gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); @@ -1221,33 +1278,44 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) case GL_Q: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; + GLuint bitq; switch (mode) { case GL_OBJECT_LINEAR: - texUnit->GenModeQ = GL_OBJECT_LINEAR; - texUnit->_GenBitQ = TEXGEN_OBJ_LINEAR; + bitq = TEXGEN_OBJ_LINEAR; break; case GL_EYE_LINEAR: - texUnit->GenModeQ = GL_EYE_LINEAR; - texUnit->_GenBitQ = TEXGEN_EYE_LINEAR; + bitq = TEXGEN_EYE_LINEAR; break; default: gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } + if (texUnit->GenModeQ == mode) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->GenModeQ = mode; + texUnit->_GenBitQ = bitq; } else if (pname==GL_OBJECT_PLANE) { + if (TEST_EQ_4V(texUnit->ObjectPlaneQ, params)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); texUnit->ObjectPlaneQ[0] = params[0]; texUnit->ObjectPlaneQ[1] = params[1]; texUnit->ObjectPlaneQ[2] = params[2]; texUnit->ObjectPlaneQ[3] = params[3]; } else if (pname==GL_EYE_PLANE) { + GLfloat tmp[4]; /* Transform plane equation by the inverse modelview matrix */ if (ctx->ModelView.flags & MAT_DIRTY_INVERSE) { _math_matrix_analyse( &ctx->ModelView ); } - gl_transform_vector( texUnit->EyePlaneQ, params, - ctx->ModelView.inv ); + gl_transform_vector( tmp, params, ctx->ModelView.inv ); + if (TEST_EQ_4V(texUnit->EyePlaneQ, tmp)) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + COPY_4FV(texUnit->EyePlaneQ, tmp); } else { gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" ); @@ -1261,8 +1329,6 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) if (ctx->Driver.TexGen) ctx->Driver.TexGen( ctx, coord, pname, params ); - - ctx->NewState |= _NEW_TEXTURE; } @@ -1319,8 +1385,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) GET_CURRENT_CONTEXT(ctx); GLuint tUnit = ctx->Texture.CurrentTransformUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGendv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (coord) { case GL_S: @@ -1397,8 +1462,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) GET_CURRENT_CONTEXT(ctx); GLuint tUnit = ctx->Texture.CurrentTransformUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGenfv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (coord) { case GL_S: @@ -1475,8 +1539,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) GET_CURRENT_CONTEXT(ctx); GLuint tUnit = ctx->Texture.CurrentTransformUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[tUnit]; - - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGeniv"); + ASSERT_OUTSIDE_BEGIN_END(ctx); switch (coord) { case GL_S: @@ -1575,25 +1638,23 @@ void _mesa_ActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); - GLint maxUnits = ctx->Const.MaxTextureUnits; - - ASSERT_OUTSIDE_BEGIN_END( ctx, "glActiveTextureARB" ); + GLuint texUnit = target - GL_TEXTURE0_ARB; + ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) fprintf(stderr, "glActiveTexture %s\n", gl_lookup_enum_by_nr(target)); - if (target >= GL_TEXTURE0_ARB && target < GL_TEXTURE0_ARB + maxUnits) { - GLint texUnit = target - GL_TEXTURE0_ARB; - ctx->Texture.CurrentUnit = texUnit; - ctx->Texture.CurrentTransformUnit = texUnit; - if (ctx->Driver.ActiveTexture) { - (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit ); - } - ctx->NewState |= _NEW_TEXTURE; - } - else { + if (texUnit > ctx->Const.MaxTextureUnits) { gl_error(ctx, GL_INVALID_OPERATION, "glActiveTextureARB(target)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + ctx->Texture.CurrentUnit = texUnit; + ctx->Texture.CurrentTransformUnit = texUnit; + if (ctx->Driver.ActiveTexture) { + (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit ); } } @@ -1603,16 +1664,14 @@ void _mesa_ClientActiveTextureARB( GLenum target ) { GET_CURRENT_CONTEXT(ctx); - GLint maxUnits = ctx->Const.MaxTextureUnits; - - ASSERT_OUTSIDE_BEGIN_END( ctx, "glClientActiveTextureARB" ); + GLuint texUnit = target - GL_TEXTURE0_ARB; + ASSERT_OUTSIDE_BEGIN_END(ctx); - if (target >= GL_TEXTURE0_ARB && target < GL_TEXTURE0_ARB + maxUnits) { - GLint texUnit = target - GL_TEXTURE0_ARB; - ctx->Array.ActiveTexture = texUnit; - ctx->NewState |= _NEW_ARRAY; - } - else { + if (texUnit > ctx->Const.MaxTextureUnits) { gl_error(ctx, GL_INVALID_OPERATION, "glActiveTextureARB(target)"); + return; } + + FLUSH_VERTICES(ctx, _NEW_ARRAY); + ctx->Array.ActiveTexture = texUnit; } diff --git a/src/mesa/main/texutil.c b/src/mesa/main/texutil.c index 6ccc2f215a6..428af0384aa 100644 --- a/src/mesa/main/texutil.c +++ b/src/mesa/main/texutil.c @@ -1,4 +1,4 @@ -/* $Id: texutil.c,v 1.10 2000/11/22 07:32:17 joukj Exp $ */ +/* $Id: texutil.c,v 1.11 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -135,6 +135,10 @@ _mesa_convert_teximage(MesaIntTexFormat dstFormat, GLubyte *dst = (GLubyte *) dstImage; GLint row; for (row = 0; row < dstHeight; row++) { + GLuint i; + for (i = 0 ; i < dstWidth ; i++) + fprintf(stderr, "%02x ", src[i]); + fprintf(stderr, "\n"); MEMCPY(dst, src, dstWidth * sizeof(GLubyte)); dst += dstRowStride; src += srcStride; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 7b9b1052c21..9fa20997cf9 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,4 +1,4 @@ -/* $Id: varray.c,v 1.33 2000/11/24 10:25:06 keithw Exp $ */ +/* $Id: varray.c,v 1.34 2000/12/26 05:09:29 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -48,6 +48,7 @@ void _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (size<2 || size>4) { gl_error( ctx, GL_INVALID_VALUE, "glVertexPointer(size)" ); @@ -87,8 +88,8 @@ _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->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_VERTEX; if (ctx->Driver.VertexPointer) ctx->Driver.VertexPointer( ctx, size, type, stride, ptr ); @@ -101,6 +102,7 @@ void _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) { GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glNormalPointer(stride)" ); @@ -138,8 +140,8 @@ _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->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_VERTEX; if (ctx->Driver.NormalPointer) ctx->Driver.NormalPointer( ctx, type, stride, ptr ); @@ -151,6 +153,7 @@ void _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (size<3 || size>4) { gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); @@ -202,8 +205,8 @@ _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->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_VERTEX; if (ctx->Driver.ColorPointer) ctx->Driver.ColorPointer( ctx, size, type, stride, ptr ); @@ -215,6 +218,7 @@ void _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glFogCoordPointer(stride)" ); @@ -238,8 +242,8 @@ _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->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_VERTEX; if (ctx->Driver.FogCoordPointer) ctx->Driver.FogCoordPointer( ctx, type, stride, ptr ); @@ -250,6 +254,7 @@ void _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glIndexPointer(stride)" ); @@ -282,8 +287,8 @@ _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->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_VERTEX; if (ctx->Driver.IndexPointer) ctx->Driver.IndexPointer( ctx, type, stride, ptr ); @@ -295,6 +300,7 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (size != 3 && size != 4) { gl_error( ctx, GL_INVALID_VALUE, "glColorPointer(size)" ); @@ -346,8 +352,8 @@ _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->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_VERTEX; if (ctx->Driver.SecondaryColorPointer) ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr ); @@ -359,9 +365,8 @@ void _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) { GET_CURRENT_CONTEXT(ctx); - GLuint texUnit; - - texUnit = ctx->Array.ActiveTexture; + GLuint texUnit = ctx->Array.ActiveTexture; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (size<1 || size>4) { gl_error( ctx, GL_INVALID_VALUE, "glTexCoordPointer(size)" ); @@ -403,8 +408,8 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ctx->Array.TexCoord[texUnit].Type = type; 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->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_VERTEX; if (ctx->Driver.TexCoordPointer) ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr ); @@ -418,6 +423,7 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr) { GET_CURRENT_CONTEXT(ctx); const GLboolean *ptr = (GLboolean *)vptr; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (stride<0) { gl_error( ctx, GL_INVALID_VALUE, "glEdgeFlagPointer(stride)" ); @@ -426,12 +432,8 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr) ctx->Array.EdgeFlag.Stride = stride; 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)]; - } else { - ctx->Array._EdgeFlagFunc = 0; - } ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_VERTEX; if (ctx->Driver.EdgeFlagPointer) ctx->Driver.EdgeFlagPointer( ctx, stride, ptr ); @@ -511,6 +513,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) GLint c, f; GLint coordUnitSave; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + f = sizeof(GLfloat); c = f * ((4*sizeof(GLubyte) + (f-1)) / f); @@ -645,8 +649,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) for (i = 0; i < factor; i++) { _mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) ); _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY ); - glTexCoordPointer( tcomps, GL_FLOAT, stride, - (GLubyte *) pointer + i * coffset ); + _mesa_TexCoordPointer( tcomps, GL_FLOAT, stride, + (GLubyte *) pointer + i * coffset ); } for (i = factor; i < ctx->Const.MaxTextureUnits; i++) { _mesa_ClientActiveTextureARB( (GLenum) (GL_TEXTURE0_ARB + i) ); @@ -667,8 +671,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) /* Color */ if (cflag) { _mesa_EnableClientState( GL_COLOR_ARRAY ); - glColorPointer( ccomps, ctype, stride, - (GLubyte*) pointer + coffset ); + _mesa_ColorPointer( ccomps, ctype, stride, + (GLubyte*) pointer + coffset ); } else { _mesa_DisableClientState( GL_COLOR_ARRAY ); @@ -678,29 +682,25 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer) /* Normals */ if (nflag) { _mesa_EnableClientState( GL_NORMAL_ARRAY ); - glNormalPointer( GL_FLOAT, stride, - (GLubyte*) pointer + noffset ); + _mesa_NormalPointer( GL_FLOAT, stride, + (GLubyte*) pointer + noffset ); } else { _mesa_DisableClientState( GL_NORMAL_ARRAY ); } _mesa_EnableClientState( GL_VERTEX_ARRAY ); - glVertexPointer( vcomps, GL_FLOAT, stride, - (GLubyte *) pointer + voffset ); + _mesa_VertexPointer( vcomps, GL_FLOAT, stride, + (GLubyte *) pointer + voffset ); } -/* Transform the array components now, upto the setup call. When - * actual draw commands arrive, the data will be merged prior to - * calling render_vb. - */ void _mesa_LockArraysEXT(GLint first, GLsizei count) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glLockArraysEXT" ); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glLockArrays %d %d\n", first, count); @@ -715,6 +715,7 @@ _mesa_LockArraysEXT(GLint first, GLsizei count) } ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_ALL; if (ctx->Driver.LockArraysEXT) ctx->Driver.LockArraysEXT( ctx, first, count ); @@ -725,7 +726,7 @@ void _mesa_UnlockArraysEXT( void ) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glUnlockArraysEXT" ); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glUnlockArrays\n"); @@ -733,6 +734,7 @@ _mesa_UnlockArraysEXT( void ) ctx->Array.LockFirst = 0; ctx->Array.LockCount = 0; ctx->NewState |= _NEW_ARRAY; + ctx->Array.NewState |= _NEW_ARRAY_ALL; if (ctx->Driver.UnlockArraysEXT) ctx->Driver.UnlockArraysEXT( ctx ); diff --git a/src/mesa/math/m_clip_tmp.h b/src/mesa/math/m_clip_tmp.h index 321d3a9e616..d977698da57 100644 --- a/src/mesa/math/m_clip_tmp.h +++ b/src/mesa/math/m_clip_tmp.h @@ -1,4 +1,4 @@ -/* $Id: m_clip_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_clip_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -78,16 +78,16 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec, c++; tmpAndMask &= mask; tmpOrMask |= mask; - vProj[i][0] = 0; /* no longer required? */ + vProj[i][0] = 0; vProj[i][1] = 0; vProj[i][2] = 0; vProj[i][3] = 1; } else { GLfloat oow = 1.0F / cw; - vProj[i][3] = oow; vProj[i][0] = cx * oow; vProj[i][1] = cy * oow; vProj[i][2] = cz * oow; + vProj[i][3] = oow; } } @@ -95,7 +95,7 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points4)( GLvector4f *clip_vec, *andMask = (GLubyte) (c < count ? 0 : tmpAndMask); proj_vec->flags |= VEC_SIZE_4; - proj_vec->size = 3; + proj_vec->size = 4; proj_vec->count = clip_vec->count; return proj_vec; } @@ -127,8 +127,6 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points3)( GLvector4f *clip_vec, tmpAndMask &= mask; } - gl_vector4f_clean_elem(proj_vec, count, 3); - *orMask = tmpOrMask; *andMask = tmpAndMask; return clip_vec; @@ -159,8 +157,6 @@ static GLvector4f * _XFORMAPI TAG(cliptest_points2)( GLvector4f *clip_vec, tmpAndMask &= mask; } - gl_vector4f_clean_elem(proj_vec, count, 3); - *orMask = tmpOrMask; *andMask = tmpAndMask; return clip_vec; diff --git a/src/mesa/math/m_copy_tmp.h b/src/mesa/math/m_copy_tmp.h index b328537fafa..3119b95589b 100644 --- a/src/mesa/math/m_copy_tmp.h +++ b/src/mesa/math/m_copy_tmp.h @@ -1,4 +1,4 @@ -/* $Id: m_copy_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_copy_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -51,24 +51,6 @@ static void TAG2(copy, BITS)(GLvector4f *to, const GLvector4f *f, \ } \ } - - -/* static void TAG2(clean, BITS)(GLvector4f *to ) */ -/* { */ -/* GLfloat (*t)[4] = to->data; */ -/* GLuint i; */ - -/* if (BITS) */ -/* for (i = 0 ; i < VB_SIZE ; i++) { */ -/* if (BITS&1) t[i][0] = 0; */ -/* if (BITS&2) t[i][1] = 0; */ -/* if (BITS&4) t[i][2] = 0; */ -/* if (BITS&8) t[i][3] = 1; */ -/* } */ -/* to->flags &= ~BITS; */ -/* } */ - - /* We got them all here: */ COPY_FUNC( 0x0 ) /* noop */ @@ -106,21 +88,4 @@ static void TAG2(init_copy, 0 ) ( void ) gl_copy_tab[IDX][0xd] = TAG2(copy, 0xd); gl_copy_tab[IDX][0xe] = TAG2(copy, 0xe); gl_copy_tab[IDX][0xf] = TAG2(copy, 0xf); - -/* gl_clean_tab[IDX][0x0] = TAG2(clean, 0x0); */ -/* gl_clean_tab[IDX][0x1] = TAG2(clean, 0x1); */ -/* gl_clean_tab[IDX][0x2] = TAG2(clean, 0x2); */ -/* gl_clean_tab[IDX][0x3] = TAG2(clean, 0x3); */ -/* gl_clean_tab[IDX][0x4] = TAG2(clean, 0x4); */ -/* gl_clean_tab[IDX][0x5] = TAG2(clean, 0x5); */ -/* gl_clean_tab[IDX][0x6] = TAG2(clean, 0x6); */ -/* gl_clean_tab[IDX][0x7] = TAG2(clean, 0x7); */ -/* gl_clean_tab[IDX][0x8] = TAG2(clean, 0x8); */ -/* gl_clean_tab[IDX][0x9] = TAG2(clean, 0x9); */ -/* gl_clean_tab[IDX][0xa] = TAG2(clean, 0xa); */ -/* gl_clean_tab[IDX][0xb] = TAG2(clean, 0xb); */ -/* gl_clean_tab[IDX][0xc] = TAG2(clean, 0xc); */ -/* gl_clean_tab[IDX][0xd] = TAG2(clean, 0xd); */ -/* gl_clean_tab[IDX][0xe] = TAG2(clean, 0xe); */ -/* gl_clean_tab[IDX][0xf] = TAG2(clean, 0xf); */ } diff --git a/src/mesa/math/m_dotprod_tmp.h b/src/mesa/math/m_dotprod_tmp.h index 637e35fd587..4bd875c6813 100644 --- a/src/mesa/math/m_dotprod_tmp.h +++ b/src/mesa/math/m_dotprod_tmp.h @@ -1,4 +1,4 @@ -/* $Id: m_dotprod_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_dotprod_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -31,18 +31,16 @@ /* Note - respects the stride of the output vector. */ -static void TAG(dotprod_vec2)( GLvector4f *out_vec, - GLuint elt, - const GLvector4f *coord_vec, - const GLfloat plane[4], - const GLubyte mask[]) +static void TAG(dotprod_vec2)( GLfloat *out, + GLuint outstride, + const GLvector4f *coord_vec, + const GLfloat plane[4], + const GLubyte mask[]) { GLuint stride = coord_vec->stride; GLfloat *coord = coord_vec->start; GLuint count = coord_vec->count; - GLuint outstride = out_vec->stride; - GLfloat *out = out_vec->start + elt; GLuint i; const GLfloat plane0 = plane[0], plane1 = plane[1], plane3 = plane[3]; @@ -56,21 +54,18 @@ static void TAG(dotprod_vec2)( GLvector4f *out_vec, plane3); } } - out_vec->count = coord_vec->count; } -static void TAG(dotprod_vec3)( GLvector4f *out_vec, - GLuint elt, - const GLvector4f *coord_vec, - const GLfloat plane[4], - const GLubyte mask[]) +static void TAG(dotprod_vec3)( GLfloat *out, + GLuint outstride, + const GLvector4f *coord_vec, + const GLfloat plane[4], + const GLubyte mask[]) { GLuint stride = coord_vec->stride; GLfloat *coord = coord_vec->start; GLuint count = coord_vec->count; - GLuint outstride = out_vec->stride; - GLfloat *out = out_vec->start + elt; GLuint i; const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; @@ -86,21 +81,17 @@ static void TAG(dotprod_vec3)( GLvector4f *out_vec, plane3); } } - out_vec->count = coord_vec->count; } -static void TAG(dotprod_vec4)( GLvector4f *out_vec, - GLuint elt, - const GLvector4f *coord_vec, - const GLfloat plane[4], - const GLubyte mask[]) +static void TAG(dotprod_vec4)( GLfloat *out, + GLuint outstride, + const GLvector4f *coord_vec, + const GLfloat plane[4], + const GLubyte mask[]) { GLuint stride = coord_vec->stride; GLfloat *coord = coord_vec->start; GLuint count = coord_vec->count; - - GLuint outstride = out_vec->stride; - GLfloat *out = out_vec->start + elt; GLuint i; const GLfloat plane0 = plane[0], plane1 = plane[1], plane2 = plane[2]; @@ -116,7 +107,6 @@ static void TAG(dotprod_vec4)( GLvector4f *out_vec, coord[3] * plane3); } } - out_vec->count = coord_vec->count; } diff --git a/src/mesa/math/m_eval.c b/src/mesa/math/m_eval.c new file mode 100644 index 00000000000..a4ae0395cad --- /dev/null +++ b/src/mesa/math/m_eval.c @@ -0,0 +1,501 @@ +/* $Id: m_eval.c,v 1.1 2000/12/26 05:09:31 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * eval.c was written by + * Bernd Barsuhn (bdbarsuh@cip.informatik.uni-erlangen.de) and + * Volker Weiss (vrweiss@cip.informatik.uni-erlangen.de). + * + * My original implementation of evaluators was simplistic and didn't + * compute surface normal vectors properly. Bernd and Volker applied + * used more sophisticated methods to get better results. + * + * Thanks guys! + */ + + +#include "glheader.h" +#include "config.h" +#include "m_eval.h" + +static GLfloat inv_tab[MAX_EVAL_ORDER]; + + + +/* + * Horner scheme for Bezier curves + * + * Bezier curves can be computed via a Horner scheme. + * Horner is numerically less stable than the de Casteljau + * algorithm, but it is faster. For curves of degree n + * the complexity of Horner is O(n) and de Casteljau is O(n^2). + * Since stability is not important for displaying curve + * points I decided to use the Horner scheme. + * + * A cubic Bezier curve with control points b0, b1, b2, b3 can be + * written as + * + * (([3] [3] ) [3] ) [3] + * c(t) = (([0]*s*b0 + [1]*t*b1)*s + [2]*t^2*b2)*s + [3]*t^2*b3 + * + * [n] + * where s=1-t and the binomial coefficients [i]. These can + * be computed iteratively using the identity: + * + * [n] [n ] [n] + * [i] = (n-i+1)/i * [i-1] and [0] = 1 + */ + + +void +_math_horner_bezier_curve(const GLfloat *cp, GLfloat *out, GLfloat t, + GLuint dim, GLuint order) +{ + GLfloat s, powert; + GLuint i, k, bincoeff; + + if(order >= 2) + { + bincoeff = order-1; + s = 1.0-t; + + for(k=0; k constant curve */ + { + for(k=0; k uorder) + { + if(uorder >= 2) + { + GLfloat s, poweru; + GLuint j, k, bincoeff; + + /* Compute the control polygon for the surface-curve in u-direction */ + for(j=0; j cn defines a curve in v */ + _math_horner_bezier_curve(cn, out, v, dim, vorder); + } + else /* vorder <= uorder */ + { + if(vorder > 1) + { + GLuint i; + + /* Compute the control polygon for the surface-curve in u-direction */ + for(i=0; i cn defines a curve in u */ + _math_horner_bezier_curve(cn, out, u, dim, uorder); + } +} + +/* + * The direct de Casteljau algorithm is used when a point on the + * surface and the tangent directions spanning the tangent plane + * should be computed (this is needed to compute normals to the + * surface). In this case the de Casteljau algorithm approach is + * nicer because a point and the partial derivatives can be computed + * at the same time. To get the correct tangent length du and dv + * must be multiplied with the (u2-u1)/uorder-1 and (v2-v1)/vorder-1. + * Since only the directions are needed, this scaling step is omitted. + * + * De Casteljau needs additional storage for uorder*vorder + * values in the control net cn. + */ + +void +_math_de_casteljau_surf(GLfloat *cn, GLfloat *out, GLfloat *du, GLfloat *dv, + GLfloat u, GLfloat v, GLuint dim, + GLuint uorder, GLuint vorder) +{ + GLfloat *dcn = cn + uorder*vorder*dim; + GLfloat us = 1.0-u, vs = 1.0-v; + GLuint h, i, j, k; + GLuint minorder = uorder < vorder ? uorder : vorder; + GLuint uinc = vorder*dim; + GLuint dcuinc = vorder; + + /* Each component is evaluated separately to save buffer space */ + /* This does not drasticaly decrease the performance of the */ + /* algorithm. If additional storage for (uorder-1)*(vorder-1) */ + /* points would be available, the components could be accessed */ + /* in the innermost loop which could lead to less cache misses. */ + +#define CN(I,J,K) cn[(I)*uinc+(J)*dim+(K)] +#define DCN(I, J) dcn[(I)*dcuinc+(J)] + if(minorder < 3) + { + if(uorder==vorder) + { + for(k=0; kfloat or ubyte->ubyte, which are never used. - */ -extern trans_1f_func gl_trans_1f_tab[MAX_TYPES]; -extern trans_1ui_func gl_trans_1ui_tab[MAX_TYPES]; -extern trans_1ub_func gl_trans_1ub_tab[MAX_TYPES]; -extern trans_3f_func gl_trans_3f_tab[MAX_TYPES]; -extern trans_4ub_func gl_trans_4ub_tab[5][MAX_TYPES]; -extern trans_4f_func gl_trans_4f_tab[5][MAX_TYPES]; - - - -extern void -_math_init_translate( void ); +extern void _math_trans_1f(GLfloat *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_trans_1ui(GLuint *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_trans_1ub(GLubyte *to, + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_trans_4ub(GLubyte (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + +extern void _math_trans_4f(GLfloat (*to)[4], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint size, + GLuint start, + GLuint n ); + +extern void _math_trans_3f(GLfloat (*to)[3], + CONST void *ptr, + GLuint stride, + GLenum type, + GLuint start, + GLuint n ); + +extern void _math_init_translate( void ); #endif diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index 4dbf68f8e0f..e582ccce37e 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -1,4 +1,4 @@ -/* $Id: m_vector.c,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_vector.c,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -85,7 +85,7 @@ void gl_vector4f_init( GLvector4f *v, GLuint flags, GLfloat (*storage)[4] ) v->data = storage; v->start = (GLfloat *) storage; v->count = 0; - v->flags = size_bits[4] | flags | VEC_GOOD_STRIDE; + v->flags = size_bits[4] | flags ; } void gl_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*storage)[3] ) @@ -94,7 +94,7 @@ void gl_vector3f_init( GLvector3f *v, GLuint flags, GLfloat (*storage)[3] ) v->data = storage; v->start = (GLfloat *) storage; v->count = 0; - v->flags = flags | VEC_GOOD_STRIDE; + v->flags = flags ; } void gl_vector1f_init( GLvector1f *v, GLuint flags, GLfloat *storage ) @@ -103,7 +103,7 @@ void gl_vector1f_init( GLvector1f *v, GLuint flags, GLfloat *storage ) v->data = storage; v->start = (GLfloat *)storage; v->count = 0; - v->flags = flags | VEC_GOOD_STRIDE; + v->flags = flags ; } void gl_vector4ub_init( GLvector4ub *v, GLuint flags, GLubyte (*storage)[4] ) @@ -112,7 +112,7 @@ void gl_vector4ub_init( GLvector4ub *v, GLuint flags, GLubyte (*storage)[4] ) v->data = storage; v->start = (GLubyte *) storage; v->count = 0; - v->flags = flags | VEC_GOOD_STRIDE; + v->flags = flags ; } void gl_vector1ub_init( GLvector1ub *v, GLuint flags, GLubyte *storage ) @@ -121,7 +121,7 @@ void gl_vector1ub_init( GLvector1ub *v, GLuint flags, GLubyte *storage ) v->data = storage; v->start = (GLubyte *) storage; v->count = 0; - v->flags = flags | VEC_GOOD_STRIDE; + v->flags = flags ; } void gl_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage ) @@ -130,7 +130,7 @@ void gl_vector1ui_init( GLvector1ui *v, GLuint flags, GLuint *storage ) v->data = storage; v->start = (GLuint *) storage; v->count = 0; - v->flags = flags | VEC_GOOD_STRIDE; + v->flags = flags ; } @@ -153,7 +153,7 @@ void gl_vector4f_alloc( GLvector4f *v, GLuint flags, GLuint count, v->start = (GLfloat *) v->storage; v->data = (GLfloat (*)[4]) v->storage; v->count = 0; - v->flags = size_bits[4] | flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = size_bits[4] | flags | VEC_MALLOC ; } void gl_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count, @@ -164,7 +164,7 @@ void gl_vector3f_alloc( GLvector3f *v, GLuint flags, GLuint count, v->start = (GLfloat *) v->storage; v->data = (GLfloat (*)[3]) v->storage; v->count = 0; - v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = flags | VEC_MALLOC ; } void gl_vector1f_alloc( GLvector1f *v, GLuint flags, GLuint count, @@ -175,7 +175,7 @@ void gl_vector1f_alloc( GLvector1f *v, GLuint flags, GLuint count, ALIGN_MALLOC( count * sizeof(GLfloat), alignment ); v->data = v->start; v->count = 0; - v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = flags | VEC_MALLOC ; } void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count, @@ -186,7 +186,7 @@ void gl_vector4ub_alloc( GLvector4ub *v, GLuint flags, GLuint count, v->start = (GLubyte *) v->storage; v->data = (GLubyte (*)[4]) v->storage; v->count = 0; - v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = flags | VEC_MALLOC ; } void gl_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count, @@ -197,7 +197,7 @@ void gl_vector1ub_alloc( GLvector1ub *v, GLuint flags, GLuint count, v->start = (GLubyte *) v->storage; v->data = (GLubyte *) v->storage; v->count = 0; - v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = flags | VEC_MALLOC ; } void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count, @@ -208,7 +208,7 @@ void gl_vector1ui_alloc( GLvector1ui *v, GLuint flags, GLuint count, v->start = (GLuint *) v->storage; v->data = (GLuint *) v->storage; v->count = 0; - v->flags = flags | VEC_MALLOC | VEC_GOOD_STRIDE; + v->flags = flags | VEC_MALLOC ; } diff --git a/src/mesa/math/m_vector.h b/src/mesa/math/m_vector.h index c4af1eaade5..24a392a12b4 100644 --- a/src/mesa/math/m_vector.h +++ b/src/mesa/math/m_vector.h @@ -1,4 +1,4 @@ -/* $Id: m_vector.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_vector.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -35,18 +35,13 @@ #include "glheader.h" -#define VEC_DIRTY_0 0x1 /* dirty flags not really used any more */ +#define VEC_DIRTY_0 0x1 #define VEC_DIRTY_1 0x2 #define VEC_DIRTY_2 0x4 #define VEC_DIRTY_3 0x8 #define VEC_MALLOC 0x10 /* storage field points to self-allocated mem*/ -#define VEC_WRITABLE 0x20 /* keep both + and - bits for easy testing */ -#define VEC_NOT_WRITABLE 0x40 -#define VEC_GOOD_STRIDE 0x80 -#define VEC_BAD_STRIDE 0x100 - -#define VEC_WRITABLE_FLAGS (VEC_WRITABLE|VEC_NOT_WRITABLE) -#define VEC_STRIDE_FLAGS (VEC_GOOD_STRIDE|VEC_BAD_STRIDE) +#define VEC_NOT_WRITEABLE 0x40 /* writable elements to hold clipped data */ +#define VEC_BAD_STRIDE 0x100 /* matches tnl's prefered stride */ #define VEC_SIZE_1 VEC_DIRTY_0 diff --git a/src/mesa/math/m_xform.c b/src/mesa/math/m_xform.c index a6e34e9eb2b..72aec3a06ad 100644 --- a/src/mesa/math/m_xform.c +++ b/src/mesa/math/m_xform.c @@ -1,4 +1,4 @@ -/* $Id: m_xform.c,v 1.4 2000/11/24 10:25:11 keithw Exp $ */ +/* $Id: m_xform.c,v 1.5 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -41,6 +41,7 @@ #include "macros.h" #include "mmath.h" +#include "m_eval.h" #include "m_matrix.h" #include "m_translate.h" #include "m_xform.h" @@ -250,4 +251,5 @@ _math_init( void ) _math_init_transformation(); _math_init_translate(); _math_init_vertices(); + _math_init_eval(); } diff --git a/src/mesa/math/m_xform.h b/src/mesa/math/m_xform.h index 7fc5be3ab15..046fc3d9371 100644 --- a/src/mesa/math/m_xform.h +++ b/src/mesa/math/m_xform.h @@ -1,4 +1,4 @@ -/* $Id: m_xform.h,v 1.2 2000/11/17 21:01:49 brianp Exp $ */ +/* $Id: m_xform.h,v 1.3 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -75,8 +75,8 @@ do { \ extern void gl_transform_vector( GLfloat u[4], - const GLfloat v[4], - const GLfloat m[16] ); + CONST GLfloat v[4], + CONST GLfloat m[16] ); extern void @@ -132,37 +132,36 @@ _math_init_transformation( void ); #define CLIP_NEAR_BIT 0x10 #define CLIP_FAR_BIT 0x20 #define CLIP_USER_BIT 0x40 -#define CLIP_CULLED_BIT 0x80 /* Vertex has been culled */ #define CLIP_ALL_BITS 0x3f typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip, - GLvector4f *vProj, - GLubyte clipMask[], - GLubyte *orMask, - GLubyte *andMask ); + GLvector4f *vProj, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ); -typedef void (*dotprod_func)( GLvector4f *out_vec, - GLuint elt, - const GLvector4f *coord_vec, - const GLfloat plane[4], - const GLubyte mask[]); +typedef void (*dotprod_func)( GLfloat *out, + GLuint out_stride, + CONST GLvector4f *coord_vec, + CONST GLfloat plane[4], + CONST GLubyte mask[]); typedef void (*vec_copy_func)( GLvector4f *to, - const GLvector4f *from, - const GLubyte mask[]); + CONST GLvector4f *from, + CONST GLubyte mask[]); /* * Functions for transformation of normals in the VB. */ -typedef void (_NORMAPIP normal_func)( const GLmatrix *mat, - GLfloat scale, - const GLvector3f *in, - const GLfloat lengths[], - const GLubyte mask[], - GLvector3f *dest ); +typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat, + GLfloat scale, + CONST GLvector3f *in, + CONST GLfloat lengths[], + CONST GLubyte mask[], + GLvector3f *dest ); /* Flags for selecting a normal transformation function. @@ -181,26 +180,27 @@ typedef void (_NORMAPIP normal_func)( const GLmatrix *mat, * parameter, to allow a unified interface. */ typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec, - const GLfloat m[16], - const GLvector4f *from_vec, - const GLubyte *clipmask, - const GLubyte flag ); + CONST GLfloat m[16], + CONST GLvector4f *from_vec, + CONST GLubyte *clipmask, + CONST GLubyte flag ); extern GLvector4f *gl_project_points( GLvector4f *to, - const GLvector4f *from ); + CONST GLvector4f *from ); extern void gl_transform_bounds3( GLubyte *orMask, GLubyte *andMask, - const GLfloat m[16], - CONST GLfloat src[][3] ); + CONST GLfloat m[16], + CONST GLfloat src[][3] ); extern void gl_transform_bounds2( GLubyte *orMask, GLubyte *andMask, - const GLfloat m[16], - CONST GLfloat src[][3] ); + CONST GLfloat m[16], + CONST GLfloat src[][3] ); extern dotprod_func gl_dotprod_tab[2][5]; extern vec_copy_func gl_copy_tab[2][0x10]; +extern vec_copy_func gl_copy_clean_tab[2][5]; extern clip_func gl_clip_tab[5]; extern normal_func gl_normal_tab[0xf][0x4]; @@ -210,17 +210,13 @@ extern normal_func gl_normal_tab[0xf][0x4]; extern transform_func **(gl_transform_tab[2]); -extern void gl_transform_point_sz( GLfloat Q[4], const GLfloat M[16], - const GLfloat P[4], GLuint sz ); +extern void gl_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16], + CONST GLfloat P[4], GLuint sz ); #define TransformRaw( to, mat, from ) \ ( (*gl_transform_tab[0][(from)->size][(mat)->type])( to, (mat)->m, from, 0, 0 ), \ (to) ) -#define Transform( to, mat, from, mask, cull ) \ - ( (*gl_transform_tab[cull!=0][(from)->size][(mat)->type])( to, (mat)->m, from, mask, cull ), \ - (to) ) - #endif diff --git a/src/mesa/math/m_xform_tmp.h b/src/mesa/math/m_xform_tmp.h index 289255a9cf5..cb94f88ed1e 100644 --- a/src/mesa/math/m_xform_tmp.h +++ b/src/mesa/math/m_xform_tmp.h @@ -1,4 +1,4 @@ -/* $Id: m_xform_tmp.h,v 1.1 2000/11/16 21:05:41 keithw Exp $ */ +/* $Id: m_xform_tmp.h,v 1.2 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -457,10 +457,7 @@ TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec, to_vec->count = from_vec->count; } -/* This may not be called too often, but I wouldn't say it was dead - * code. It's also hard to remove any of these functions if you are - * attached to the assertions that have appeared in them. - */ + static void _XFORMAPI TAG(transform_points2_perspective)( GLvector4f *to_vec, const GLfloat m[16], diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 00177849477..63771d9b075 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -1,4 +1,4 @@ -/* $Id: s_context.c,v 1.7 2000/12/09 22:09:50 brianp Exp $ */ +/* $Id: s_context.c,v 1.8 2000/12/26 05:09:32 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -309,7 +309,7 @@ _swrast_invalidate_state( GLcontext *ctx, GLuint new_state ) swrast->BlendFunc = _swrast_validate_blend_func; if (new_state & _SWRAST_NEW_TEXTURE_SAMPLE_FUNC) - for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) swrast->TextureSample[i] = _swrast_validate_texture_sample; } @@ -326,8 +326,8 @@ _swrast_validate_derived( GLcontext *ctx ) _swrast_update_rasterflags( ctx ); if (swrast->NewState & _NEW_TEXTURE) - swrast->_MultiTextureEnabled = - (ctx->Texture._ReallyEnabled > ENABLE_TEX0); + swrast->_MultiTextureEnabled = (ctx->Texture._ReallyEnabled & + ~TEXTURE0_ANY); if (swrast->NewState & _NEW_POLYGON) _swrast_update_polygon( ctx ); @@ -357,6 +357,10 @@ void _swrast_Triangle( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2 ) { +/* fprintf(stderr, "%s\n", __FUNCTION__); */ +/* _swrast_print_vertex( ctx, v0 ); */ +/* _swrast_print_vertex( ctx, v1 ); */ +/* _swrast_print_vertex( ctx, v2 ); */ SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 ); } @@ -385,6 +389,12 @@ _swrast_get_stipple_counter_ref( GLcontext *ctx ) return &SWRAST_CONTEXT(ctx)->StippleCounter; } +void +_swrast_ResetLineStipple( GLcontext *ctx ) +{ + SWRAST_CONTEXT(ctx)->StippleCounter = 0; +} + void _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ) { @@ -459,3 +469,26 @@ _swrast_DestroyContext( GLcontext *ctx ) ctx->swrast_context = 0; } + +void +_swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) +{ + GLuint i; + fprintf(stderr, "\n"); + + fprintf(stderr, "win %f %f %f %f\n", + v->win[0], v->win[1], v->win[2], v->win[3]); + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + fprintf(stderr, "texcoord[%d] %f %f %f %f\n", i, + v->texcoord[i][0], v->texcoord[i][1], + v->texcoord[i][2], v->texcoord[i][3]); + + fprintf(stderr, "color %d %d %d %d\n", + v->color[0], v->color[1], v->color[2], v->color[3]); + fprintf(stderr, "spec %d %d %d %d\n", + v->specular[0], v->specular[1], v->specular[2], v->specular[3]); + fprintf(stderr, "fog %f\n", v->fog); + fprintf(stderr, "index %d\n", v->index); + fprintf(stderr, "pointsize %f\n", v->pointSize); +} diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index e1ae060ee2f..cf87b96bc08 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -1,4 +1,4 @@ -/* $Id: s_copypix.c,v 1.7 2000/11/28 22:34:46 brianp Exp $ */ +/* $Id: s_copypix.c,v 1.8 2000/12/26 05:09:32 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -244,7 +244,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan)); - for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) { + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba, s, t, r, q); gl_texture_pixels(ctx, unit, width, s, t, r, NULL, @@ -490,7 +490,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan)); - for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) { + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba, s, t, r, q); gl_texture_pixels(ctx, unit, width, s, t, r, NULL, diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index dc15e598f57..ccb48a7ef95 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -1,4 +1,4 @@ -/* $Id: s_drawpix.c,v 1.4 2000/11/13 20:02:57 keithw Exp $ */ +/* $Id: s_drawpix.c,v 1.5 2000/12/26 05:09:32 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -104,10 +104,6 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y, GLchan rgb[MAX_WIDTH][3]; GLchan rgba[MAX_WIDTH][4]; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, "glDrawPixels", - GL_FALSE); - - if (!ctx->Current.RasterPosValid) { return GL_TRUE; /* no-op */ } diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index f3820a68b88..d07f30a5ab6 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -124,6 +124,10 @@ _swrast_Accum( GLcontext *ctx, GLenum op, extern GLuint * _swrast_get_stipple_counter_ref( GLcontext *ctx ); +/* Reset the stipple pointer via a function call + */ +extern void +_swrast_ResetLineStipple( GLcontext *ctx ); /* These will always render the correct point/line/triangle for the * current state. @@ -160,4 +164,7 @@ _swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value ); extern void _swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value ); +extern void +_swrast_print_vertex( GLcontext *ctx, const SWvertex *v ); + #endif diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index e58abdc6c55..84c313db8eb 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -1,4 +1,4 @@ -/* $Id: ss_context.c,v 1.4 2000/11/16 21:05:42 keithw Exp $ */ +/* $Id: ss_context.c,v 1.5 2000/12/26 05:09:32 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -77,20 +77,19 @@ _swsetup_validate_points( GLcontext *ctx, GLuint first, GLuint last ) static void -_swsetup_validate_rastersetup( struct vertex_buffer *VB, - GLuint start, GLuint end ) +_swsetup_validate_buildprojverts( GLcontext *ctx, + GLuint start, GLuint end, GLuint new_inputs ) { - GLcontext *ctx = VB->ctx; _swsetup_choose_rastersetup_func( ctx ); - SWSETUP_CONTEXT(ctx)->RasterSetup( VB, start, end ); + SWSETUP_CONTEXT(ctx)->BuildProjVerts( ctx, start, end, new_inputs ); } -#define _SWSETUP_NEW_RASTERSETUP (_NEW_RENDERMODE| \ - _NEW_TEXTURE| \ - _NEW_COLOR| \ - _NEW_FOG| \ - _NEW_POINT) +#define _SWSETUP_NEW_VERTS (_NEW_RENDERMODE| \ + _NEW_TEXTURE| \ + _NEW_COLOR| \ + _NEW_FOG| \ + _NEW_POINT) #define _SWSETUP_NEW_RENDERINDEX (_NEW_POLYGON|_NEW_LIGHT) @@ -118,8 +117,8 @@ _swsetup_invalidate_state( GLcontext *ctx, GLuint new_state ) swsetup->Quad = _swsetup_validate_quad; } - if (new_state & _SWSETUP_NEW_RASTERSETUP) { - swsetup->RasterSetup = _swsetup_validate_rastersetup; + if (new_state & _SWSETUP_NEW_VERTS) { + swsetup->BuildProjVerts = _swsetup_validate_buildprojverts; } } @@ -156,9 +155,10 @@ _swsetup_Points( GLcontext *ctx, GLuint first, GLuint last ) } void -_swsetup_RasterSetup( struct vertex_buffer *VB, GLuint start, GLuint end ) +_swsetup_BuildProjectedVertices( GLcontext *ctx, GLuint start, GLuint end, + GLuint new_inputs ) { - SWSETUP_CONTEXT(VB->ctx)->RasterSetup( VB, start, end ); + SWSETUP_CONTEXT(ctx)->BuildProjVerts( ctx, start, end, new_inputs ); } void @@ -171,11 +171,18 @@ _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ) GLboolean _swsetup_CreateContext( GLcontext *ctx ) { + TNLcontext *tnl = TNL_CONTEXT(ctx); SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext)); - + if (!swsetup) return GL_FALSE; + swsetup->verts = ALIGN_MALLOC( sizeof(SWvertex) * tnl->vb.Size, 32); + if (!swsetup->verts) { + FREE(swsetup); + return GL_FALSE; + } + ctx->swsetup_context = swsetup; swsetup->NewState = ~0; @@ -184,11 +191,11 @@ _swsetup_CreateContext( GLcontext *ctx ) swsetup->Triangle = _swsetup_validate_triangle; swsetup->Line = _swsetup_validate_line; swsetup->Points = _swsetup_validate_points; - swsetup->RasterSetup = _swsetup_validate_rastersetup; + swsetup->BuildProjVerts = _swsetup_validate_buildprojverts; _swsetup_vb_init( ctx ); _swsetup_trifuncs_init( ctx ); - + return GL_TRUE; } @@ -196,35 +203,12 @@ void _swsetup_DestroyContext( GLcontext *ctx ) { if (SWSETUP_CONTEXT(ctx)) { + if (SWSETUP_CONTEXT(ctx)->verts) + ALIGN_FREE(SWSETUP_CONTEXT(ctx)->verts); + FREE(SWSETUP_CONTEXT(ctx)); ctx->swsetup_context = 0; } } -void -_swsetup_RegisterVB( struct vertex_buffer *VB ) -{ - SSvertexbuffer *ssvb = (SSvertexbuffer *)CALLOC(sizeof(SSvertexbuffer) ); - ssvb->verts = ALIGN_MALLOC( sizeof(SWvertex) * VB->Size, 32); - if (!ssvb->verts) { - FREE(ssvb); - /*return GL_FALSE;*/ - } - - VB->swsetup_vb = ssvb; - /*return GL_TRUE;*/ -} - - -void -_swsetup_UnregisterVB( struct vertex_buffer *VB ) -{ - SSvertexbuffer *ssvb = SWSETUP_VB(VB); - - if (ssvb) { - if (ssvb->verts) ALIGN_FREE(ssvb->verts); - FREE(ssvb); - VB->swsetup_vb = 0; - } -} diff --git a/src/mesa/swrast_setup/ss_context.h b/src/mesa/swrast_setup/ss_context.h index b9918137635..f4dcb4e7d10 100644 --- a/src/mesa/swrast_setup/ss_context.h +++ b/src/mesa/swrast_setup/ss_context.h @@ -40,7 +40,8 @@ typedef struct { */ void (*InvalidateState)( GLcontext *ctx, GLuint new_state ); - void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end ); + void (*BuildProjVerts)( GLcontext *ctx, + GLuint start, GLuint end, GLuint new_inputs ); void (*Quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv ); @@ -52,17 +53,10 @@ typedef struct { void (*Points)( GLcontext *ctx, GLuint first, GLuint last ); -} SScontext; - -typedef struct { - SWvertex *verts; -} SSvertexbuffer; - +} SScontext; #define SWSETUP_CONTEXT(ctx) ((SScontext *)ctx->swsetup_context) -#define SWSETUP_VB(VB) ((SSvertexbuffer *)VB->swsetup_vb) - #endif diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c index 962f811875c..a3f8cd6cec5 100644 --- a/src/mesa/swrast_setup/ss_triangle.c +++ b/src/mesa/swrast_setup/ss_triangle.c @@ -34,16 +34,15 @@ #include "ss_triangle.h" #include "ss_context.h" -#define SS_FLAT_BIT 0x1 +#define SS_FLAT_BIT 0x1 #define SS_OFFSET_BIT 0x2 #define SS_TWOSIDE_BIT 0x4 #define SS_UNFILLED_BIT 0x10 -#define SS_COPY_EXTRAS 0x20 /* optimization */ -#define SS_MAX_TRIFUNC 0x40 +#define SS_RGBA_BIT 0x20 +#define SS_MAX_TRIFUNC 0x80 static triangle_func tri_tab[SS_MAX_TRIFUNC]; static line_func line_tab[SS_MAX_TRIFUNC]; -static points_func points_tab[SS_MAX_TRIFUNC]; static quad_func quad_tab[SS_MAX_TRIFUNC]; @@ -115,68 +114,68 @@ static quad_func quad_tab[SS_MAX_TRIFUNC]; #define TAG(x) x##_flat_offset_twoside_unfilled #include "ss_tritmp.h" -#define IND (0|SS_COPY_EXTRAS) -#define TAG(x) x##_spec +#define IND (0|SS_RGBA_BIT) +#define TAG(x) x##_rgba #include "ss_tritmp.h" -#define IND (SS_FLAT_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_flat_spec +#define IND (SS_FLAT_BIT|SS_RGBA_BIT) +#define TAG(x) x##_flat_rgba #include "ss_tritmp.h" -#define IND (SS_OFFSET_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_offset_spec +#define IND (SS_OFFSET_BIT|SS_RGBA_BIT) +#define TAG(x) x##_offset_rgba #include "ss_tritmp.h" -#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_flat_offset_spec +#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_RGBA_BIT) +#define TAG(x) x##_flat_offset_rgba #include "ss_tritmp.h" -#define IND (SS_TWOSIDE_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_twoside_spec +#define IND (SS_TWOSIDE_BIT|SS_RGBA_BIT) +#define TAG(x) x##_twoside_rgba #include "ss_tritmp.h" -#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_flat_twoside_spec +#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT) +#define TAG(x) x##_flat_twoside_rgba #include "ss_tritmp.h" -#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_offset_twoside_spec +#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT) +#define TAG(x) x##_offset_twoside_rgba #include "ss_tritmp.h" -#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_flat_offset_twoside_spec +#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_RGBA_BIT) +#define TAG(x) x##_flat_offset_twoside_rgba #include "ss_tritmp.h" -#define IND (SS_UNFILLED_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_unfilled_spec +#define IND (SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_unfilled_rgba #include "ss_tritmp.h" -#define IND (SS_FLAT_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_flat_unfilled_spec +#define IND (SS_FLAT_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_flat_unfilled_rgba #include "ss_tritmp.h" -#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_offset_unfilled_spec +#define IND (SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_offset_unfilled_rgba #include "ss_tritmp.h" -#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_flat_offset_unfilled_spec +#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_flat_offset_unfilled_rgba #include "ss_tritmp.h" -#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_twoside_unfilled_spec +#define IND (SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_twoside_unfilled_rgba #include "ss_tritmp.h" -#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_flat_twoside_unfilled_spec +#define IND (SS_FLAT_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_flat_twoside_unfilled_rgba #include "ss_tritmp.h" -#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_offset_twoside_unfilled_spec +#define IND (SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_offset_twoside_unfilled_rgba #include "ss_tritmp.h" -#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_COPY_EXTRAS) -#define TAG(x) x##_flat_offset_twoside_unfilled_spec +#define IND (SS_FLAT_BIT|SS_OFFSET_BIT|SS_TWOSIDE_BIT|SS_UNFILLED_BIT|SS_RGBA_BIT) +#define TAG(x) x##_flat_offset_twoside_unfilled_rgba #include "ss_tritmp.h" @@ -201,25 +200,42 @@ void _swsetup_trifuncs_init( GLcontext *ctx ) init_offset_twoside_unfilled(); init_flat_offset_twoside_unfilled(); - init_spec(); - init_flat_spec(); - init_offset_spec(); - init_flat_offset_spec(); - init_twoside_spec(); - init_flat_twoside_spec(); - init_offset_twoside_spec(); - init_flat_offset_twoside_spec(); - init_unfilled_spec(); - init_flat_unfilled_spec(); - init_offset_unfilled_spec(); - init_flat_offset_unfilled_spec(); - init_twoside_unfilled_spec(); - init_flat_twoside_unfilled_spec(); - init_offset_twoside_unfilled_spec(); - init_flat_offset_twoside_unfilled_spec(); + init_rgba(); + init_flat_rgba(); + init_offset_rgba(); + init_flat_offset_rgba(); + init_twoside_rgba(); + init_flat_twoside_rgba(); + init_offset_twoside_rgba(); + init_flat_offset_twoside_rgba(); + init_unfilled_rgba(); + init_flat_unfilled_rgba(); + init_offset_unfilled_rgba(); + init_flat_offset_unfilled_rgba(); + init_twoside_unfilled_rgba(); + init_flat_twoside_unfilled_rgba(); + init_offset_twoside_unfilled_rgba(); + init_flat_offset_twoside_unfilled_rgba(); } +static void swsetup_points( GLcontext *ctx, GLuint first, GLuint last ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; + int i; + + if (VB->Elts) { + for(i=first;i<=last;i++) + if(VB->ClipMask[VB->Elts[i]]==0) + _swrast_Point( ctx, &verts[VB->Elts[i]] ); + } else { + for(i=first;i<=last;i++) + if(VB->ClipMask[i]==0) + _swrast_Point( ctx, &verts[i] ); + } +} + void _swsetup_choose_trifuncs( GLcontext *ctx ) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); @@ -234,17 +250,15 @@ void _swsetup_choose_trifuncs( GLcontext *ctx ) if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) ind |= SS_TWOSIDE_BIT; - if (ctx->Polygon._Unfilled) + if (ctx->_TriangleCaps & DD_TRI_UNFILLED) ind |= SS_UNFILLED_BIT; - if ((ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) || - ctx->RenderMode == GL_SELECT || - !ctx->Visual.RGBAflag) - ind |= SS_COPY_EXTRAS; + if (ctx->Visual.RGBAflag) + ind |= SS_RGBA_BIT; swsetup->Triangle = tri_tab[ind]; swsetup->Line = line_tab[ind]; - swsetup->Points = points_tab[ind]; swsetup->Quad = quad_tab[ind]; + swsetup->Points = swsetup_points; } diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index 054fcf9eb7f..d04a36b18b5 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -30,8 +30,8 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2, GLuint pv) { - struct vertex_buffer *VB = TNL_VB(ctx); - SWvertex *verts = SWSETUP_VB(VB)->verts; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; SWvertex *v[3]; GLfloat offset; GLfloat z[3]; @@ -44,22 +44,22 @@ static void TAG(triangle)(GLcontext *ctx, v[2] = &verts[e2]; if (IND & (SS_TWOSIDE_BIT | SS_FLAT_BIT)) { - SS_COLOR(c[0], v[0]->color); - - if (IND & SS_TWOSIDE_BIT) { - SS_COLOR(c[1], v[1]->color); - SS_COLOR(c[2], v[2]->color); - } - - if (IND & SS_COPY_EXTRAS) { + if (IND & SS_RGBA_BIT) { + SS_COLOR(c[0], v[0]->color); SS_SPEC(s[0], v[0]->specular); + + if (IND & SS_TWOSIDE_BIT) { + SS_COLOR(c[1], v[1]->color); + SS_COLOR(c[2], v[2]->color); + + SS_SPEC(s[1], v[1]->specular); + SS_SPEC(s[2], v[2]->specular); + } + } else { SS_IND(i[0], v[0]->index); if (IND & SS_TWOSIDE_BIT) { - SS_SPEC(s[1], v[1]->specular); SS_IND(i[1], v[1]->index); - - SS_SPEC(s[2], v[2]->specular); SS_IND(i[2], v[2]->index); } } @@ -75,39 +75,45 @@ static void TAG(triangle)(GLcontext *ctx, if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT)) { - GLuint facing = (cc < 0.0) ^ ctx->Polygon.FrontBit; + GLuint facing = (cc < 0.0) ^ ctx->Polygon._FrontBit; if (IND & SS_UNFILLED_BIT) mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode; if (IND & SS_TWOSIDE_BIT) { - GLubyte (*vbcolor)[4] = VB->Color[facing]->data; - GLubyte (*vbspec)[4] = VB->SecondaryColor[facing]->data; - GLuint *vbindex = VB->Index[facing]->data; - if (IND & SS_FLAT_BIT) { - SS_COLOR(v[0]->color, vbcolor[pv]); - SS_COLOR(v[1]->color, vbcolor[pv]); - SS_COLOR(v[2]->color, vbcolor[pv]); + if (IND & SS_RGBA_BIT) { + GLubyte (*vbcolor)[4] = VB->ColorPtr[facing]->data; + GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[facing]->data; + + SS_COLOR(v[0]->color, vbcolor[pv]); + SS_COLOR(v[1]->color, vbcolor[pv]); + SS_COLOR(v[2]->color, vbcolor[pv]); - if (IND & SS_COPY_EXTRAS) { SS_SPEC(v[0]->specular, vbspec[pv]); SS_SPEC(v[1]->specular, vbspec[pv]); SS_SPEC(v[2]->specular, vbspec[pv]); - + } else { + GLuint *vbindex = VB->IndexPtr[facing]->data; + SS_IND(v[0]->index, vbindex[pv]); SS_IND(v[1]->index, vbindex[pv]); SS_IND(v[2]->index, vbindex[pv]); } } else { - SS_COLOR(v[0]->color, vbcolor[e0]); - SS_COLOR(v[1]->color, vbcolor[e1]); - SS_COLOR(v[2]->color, vbcolor[e2]); + if (IND & SS_RGBA_BIT) { + GLubyte (*vbcolor)[4] = VB->ColorPtr[facing]->data; + GLubyte (*vbspec)[4] = VB->SecondaryColorPtr[facing]->data; + + SS_COLOR(v[0]->color, vbcolor[e0]); + SS_COLOR(v[1]->color, vbcolor[e1]); + SS_COLOR(v[2]->color, vbcolor[e2]); - if (IND & SS_COPY_EXTRAS) { SS_SPEC(v[0]->specular, vbspec[e0]); SS_SPEC(v[1]->specular, vbspec[e1]); SS_SPEC(v[2]->specular, vbspec[e2]); + } else { + GLuint *vbindex = VB->IndexPtr[facing]->data; SS_IND(v[0]->index, vbindex[e0]); SS_IND(v[1]->index, vbindex[e1]); @@ -139,14 +145,15 @@ static void TAG(triangle)(GLcontext *ctx, } else if (IND & SS_FLAT_BIT) { - GLubyte *color = VB->Color[0]->data[pv]; - GLubyte *spec = VB->SecondaryColor[0]->data[pv]; - GLuint index = VB->Index[0]->data[pv]; + if (IND & SS_RGBA_BIT) { + GLubyte *color = VB->ColorPtr[0]->data[pv]; + GLubyte *spec = VB->SecondaryColorPtr[0]->data[pv]; - SS_COLOR(v[0]->color, color); - - if (IND & SS_COPY_EXTRAS) { + SS_COLOR(v[0]->color, color); SS_SPEC(v[0]->specular, spec); + } + else { + GLuint index = VB->IndexPtr[0]->data[pv]; SS_IND(v[0]->index, index); } } @@ -158,9 +165,9 @@ static void TAG(triangle)(GLcontext *ctx, v[1]->win[2] += offset; v[2]->win[2] += offset; } - if (ef[e0]&0x1) { ef[e0] &= ~0x1; _swrast_Point( ctx, v[0] ); } - if (ef[e1]&0x1) { ef[e1] &= ~0x1; _swrast_Point( ctx, v[1] ); } - if (ef[e2]&0x2) { ef[e2] &= ~0x2; _swrast_Point( ctx, v[2] ); } + if (ef[e0]) _swrast_Point( ctx, v[0] ); + if (ef[e1]) _swrast_Point( ctx, v[1] ); + if (ef[e2]) _swrast_Point( ctx, v[2] ); } else if (mode == GL_LINE) { GLubyte *ef = VB->EdgeFlagPtr->data; if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) { @@ -168,9 +175,9 @@ static void TAG(triangle)(GLcontext *ctx, v[1]->win[2] += offset; v[2]->win[2] += offset; } - if (ef[e0]&0x1) { ef[e0] &= ~0x1; _swrast_Line( ctx, v[0], v[1] ); } - if (ef[e1]&0x1) { ef[e1] &= ~0x1; _swrast_Line( ctx, v[1], v[2] ); } - if (ef[e2]&0x2) { ef[e2] &= ~0x2; _swrast_Line( ctx, v[2], v[0] ); } + if (ef[e0]) _swrast_Line( ctx, v[0], v[1] ); + if (ef[e1]) _swrast_Line( ctx, v[1], v[2] ); + if (ef[e2]) _swrast_Line( ctx, v[2], v[0] ); } else { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) { v[0]->win[2] += offset; @@ -187,22 +194,22 @@ static void TAG(triangle)(GLcontext *ctx, } if (IND & (SS_FLAT_BIT | SS_TWOSIDE_BIT)) { - SS_COLOR(v[0]->color, c[0]); + if (IND & SS_RGBA_BIT) { + SS_COLOR(v[0]->color, c[0]); + SS_SPEC(v[0]->specular, s[0]); - if (IND & SS_TWOSIDE_BIT) { - SS_COLOR(v[1]->color, c[1]); - SS_COLOR(v[2]->color, c[2]); + if (IND & SS_TWOSIDE_BIT) { + SS_COLOR(v[1]->color, c[1]); + SS_COLOR(v[2]->color, c[2]); + SS_SPEC(v[1]->specular, s[1]); + SS_SPEC(v[2]->specular, s[2]); + } } - - if (IND & SS_COPY_EXTRAS) { - SS_SPEC(v[0]->specular, s[0]); + else { SS_IND(v[0]->index, i[0]); if (IND & SS_TWOSIDE_BIT) { - SS_SPEC(v[1]->specular, s[1]); SS_IND(v[1]->index, i[1]); - - SS_SPEC(v[2]->specular, s[2]); SS_IND(v[2]->index, i[2]); } } @@ -217,15 +224,27 @@ static void TAG(quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv ) { - TAG(triangle)( ctx, v0, v1, v3, pv ); - TAG(triangle)( ctx, v1, v2, v3, pv ); + if (IND & SS_UNFILLED_BIT) { + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte ef1 = VB->EdgeFlagPtr->data[v1]; + GLubyte ef3 = VB->EdgeFlagPtr->data[v3]; + VB->EdgeFlagPtr->data[v1] = 0; + TAG(triangle)( ctx, v0, v1, v3, pv ); + VB->EdgeFlagPtr->data[v1] = ef1; + VB->EdgeFlagPtr->data[v3] = 0; + TAG(triangle)( ctx, v1, v2, v3, pv ); + VB->EdgeFlagPtr->data[v3] = ef3; + } else { + TAG(triangle)( ctx, v0, v1, v3, pv ); + TAG(triangle)( ctx, v1, v2, v3, pv ); + } } static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv ) { - struct vertex_buffer *VB = TNL_VB(ctx); - SWvertex *verts = SWSETUP_VB(VB)->verts; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts; GLubyte c[2][4], s[2][4]; GLuint i[2]; SWvertex *vert0 = &verts[v0]; @@ -233,16 +252,18 @@ static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv ) if (IND & SS_FLAT_BIT) { - GLubyte *color = VB->Color[0]->data[pv]; - GLubyte *spec = VB->SecondaryColor[0]->data[pv]; - GLuint index = VB->Index[0]->data[pv]; + if (IND & SS_RGBA_BIT) { + GLubyte *color = VB->ColorPtr[0]->data[pv]; + GLubyte *spec = VB->SecondaryColorPtr[0]->data[pv]; - SS_COLOR(c[0], vert0->color); - SS_COLOR(vert0->color, color); + SS_COLOR(c[0], vert0->color); + SS_COLOR(vert0->color, color); - if (IND & SS_COPY_EXTRAS) { SS_SPEC(s[0], vert0->specular); SS_SPEC(vert0->specular, spec); + } + else { + GLuint index = VB->IndexPtr[0]->data[pv]; SS_IND(i[0], vert0->index); SS_IND(vert0->index, index); @@ -252,36 +273,23 @@ static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv ) _swrast_Line( ctx, vert0, vert1 ); if (IND & SS_FLAT_BIT) { - SS_COLOR(vert0->color, c[0]); - - if (IND & SS_COPY_EXTRAS) { + if (IND & SS_RGBA_BIT) { + SS_COLOR(vert0->color, c[0]); SS_SPEC(vert0->specular, s[0]); + } + else { SS_IND(vert0->index, i[0]); } } } -static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last ) -{ - struct vertex_buffer *VB = TNL_VB(ctx); - SWvertex *verts = SWSETUP_VB(VB)->verts; - int i; - - for(i=first;i<=last;i++) - if(VB->ClipMask[i]==0) - _swrast_Point( ctx, &verts[i] ); -} - - - static void TAG(init)( void ) { tri_tab[IND] = TAG(triangle); quad_tab[IND] = TAG(quad); line_tab[IND] = TAG(line); - points_tab[IND] = TAG(points); } diff --git a/src/mesa/swrast_setup/ss_vb.c b/src/mesa/swrast_setup/ss_vb.c index 25f2299f473..f6720dc2f7e 100644 --- a/src/mesa/swrast_setup/ss_vb.c +++ b/src/mesa/swrast_setup/ss_vb.c @@ -31,7 +31,6 @@ #include "swrast/swrast.h" #include "tnl/t_context.h" -#include "tnl/t_stages.h" #include "math/m_vector.h" #include "ss_context.h" @@ -44,8 +43,8 @@ * in this module, but not the rest of the swrast module. */ -typedef void (*SetupFunc)( struct vertex_buffer *VB, - GLuint start, GLuint end ); +typedef void (*SetupFunc)( GLcontext *ctx, + GLuint start, GLuint end, GLuint newinputs ); #define COLOR 0x1 #define INDEX 0x2 @@ -59,47 +58,145 @@ typedef void (*SetupFunc)( struct vertex_buffer *VB, static SetupFunc setup_func[MAX_SETUPFUNC]; +#define IND (0) +#define TAG(x) x##_none +#include "ss_vbtmp.h" + #define IND (COLOR) #define TAG(x) x##_color #include "ss_vbtmp.h" -#define IND (INDEX) -#define TAG(x) x##_index +#define IND (COLOR|SPEC) +#define TAG(x) x##_color_spec +#include "ss_vbtmp.h" + +#define IND (COLOR|FOG) +#define TAG(x) x##_color_fog +#include "ss_vbtmp.h" + +#define IND (COLOR|SPEC|FOG) +#define TAG(x) x##_color_spec_fog +#include "ss_vbtmp.h" + +#define IND (COLOR|TEX0) +#define TAG(x) x##_color_tex0 +#include "ss_vbtmp.h" + +#define IND (COLOR|TEX0|SPEC) +#define TAG(x) x##_color_tex0_spec +#include "ss_vbtmp.h" + +#define IND (COLOR|TEX0|FOG) +#define TAG(x) x##_color_tex0_fog #include "ss_vbtmp.h" -#define IND (TEX0|COLOR) -#define TAG(x) x##_tex0_color +#define IND (COLOR|TEX0|SPEC|FOG) +#define TAG(x) x##_color_tex0_spec_fog #include "ss_vbtmp.h" -#define IND (TEX0|COLOR|SPEC) -#define TAG(x) x##_tex0_color_spec +#define IND (COLOR|MULTITEX) +#define TAG(x) x##_color_multitex #include "ss_vbtmp.h" -#define IND (TEX0|COLOR|SPEC|FOG) -#define TAG(x) x##_tex0_color_spec_fog +#define IND (COLOR|MULTITEX|SPEC) +#define TAG(x) x##_color_multitex_spec #include "ss_vbtmp.h" -#define IND (MULTITEX|COLOR) -#define TAG(x) x##_multitex_color +#define IND (COLOR|MULTITEX|FOG) +#define TAG(x) x##_color_multitex_fog #include "ss_vbtmp.h" -#define IND (MULTITEX|COLOR|SPEC|FOG) -#define TAG(x) x##_multitex_color_spec_fog +#define IND (COLOR|MULTITEX|SPEC|FOG) +#define TAG(x) x##_color_multitex_spec_fog #include "ss_vbtmp.h" -#define IND (TEX0|COLOR|POINT) -#define TAG(x) x##_tex0_color_point +#define IND (COLOR|POINT) +#define TAG(x) x##_color_point #include "ss_vbtmp.h" -#define IND (MULTITEX|COLOR|SPEC|INDEX|POINT|FOG) -#define TAG(x) x##_multitex_color_spec_index_point_fog +#define IND (COLOR|SPEC|POINT) +#define TAG(x) x##_color_spec_point #include "ss_vbtmp.h" -#define IND (COLOR|INDEX|TEX0) -#define TAG(x) x##_selection_feedback +#define IND (COLOR|FOG|POINT) +#define TAG(x) x##_color_fog_point #include "ss_vbtmp.h" +#define IND (COLOR|SPEC|FOG|POINT) +#define TAG(x) x##_color_spec_fog_point +#include "ss_vbtmp.h" + +#define IND (COLOR|TEX0|POINT) +#define TAG(x) x##_color_tex0_point +#include "ss_vbtmp.h" + +#define IND (COLOR|TEX0|SPEC|POINT) +#define TAG(x) x##_color_tex0_spec_point +#include "ss_vbtmp.h" + +#define IND (COLOR|TEX0|FOG|POINT) +#define TAG(x) x##_color_tex0_fog_point +#include "ss_vbtmp.h" +#define IND (COLOR|TEX0|SPEC|FOG|POINT) +#define TAG(x) x##_color_tex0_spec_fog_point +#include "ss_vbtmp.h" + +#define IND (COLOR|MULTITEX|POINT) +#define TAG(x) x##_color_multitex_point +#include "ss_vbtmp.h" + +#define IND (COLOR|MULTITEX|SPEC|POINT) +#define TAG(x) x##_color_multitex_spec_point +#include "ss_vbtmp.h" + +#define IND (COLOR|MULTITEX|FOG|POINT) +#define TAG(x) x##_color_multitex_fog_point +#include "ss_vbtmp.h" + +#define IND (COLOR|MULTITEX|SPEC|FOG|POINT) +#define TAG(x) x##_color_multitex_spec_fog_point +#include "ss_vbtmp.h" + +#define IND (INDEX) +#define TAG(x) x##_index +#include "ss_vbtmp.h" + +#define IND (INDEX|TEX0) +#define TAG(x) x##_index_tex0 +#include "ss_vbtmp.h" + +#define IND (INDEX|FOG) +#define TAG(x) x##_index_fog +#include "ss_vbtmp.h" + +#define IND (INDEX|TEX0|FOG) +#define TAG(x) x##_index_tex0_fog +#include "ss_vbtmp.h" + +#define IND (INDEX|POINT) +#define TAG(x) x##_index_point +#include "ss_vbtmp.h" + +#define IND (INDEX|TEX0|POINT) +#define TAG(x) x##_index_tex0_point +#include "ss_vbtmp.h" + +#define IND (INDEX|FOG|POINT) +#define TAG(x) x##_index_fog_point +#include "ss_vbtmp.h" + +#define IND (INDEX|TEX0|FOG|POINT) +#define TAG(x) x##_index_tex0_fog_point +#include "ss_vbtmp.h" + + +static void +rs_invalid( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) +{ + fprintf(stderr, "swrast_setup: invalid setup function\n"); + (void) (ctx && start && end && newinputs); +} void _swsetup_vb_init( GLcontext *ctx ) @@ -108,45 +205,41 @@ _swsetup_vb_init( GLcontext *ctx ) (void) ctx; for (i = 0 ; i < Elements(setup_func) ; i++) - setup_func[i] = rs_multitex_color_spec_index_point_fog; + setup_func[i] = rs_invalid; - /* Some specialized cases: - */ - setup_func[0] = rs_color; + setup_func[0] = rs_none; setup_func[COLOR] = rs_color; - + setup_func[COLOR|SPEC] = rs_color_spec; + setup_func[COLOR|FOG] = rs_color_fog; + setup_func[COLOR|SPEC|FOG] = rs_color_spec_fog; + setup_func[COLOR|TEX0] = rs_color_tex0; + setup_func[COLOR|TEX0|SPEC] = rs_color_tex0_spec; + setup_func[COLOR|TEX0|FOG] = rs_color_tex0_fog; + setup_func[COLOR|TEX0|SPEC|FOG] = rs_color_tex0_spec_fog; + setup_func[COLOR|MULTITEX] = rs_color_multitex; + setup_func[COLOR|MULTITEX|SPEC] = rs_color_multitex_spec; + setup_func[COLOR|MULTITEX|FOG] = rs_color_multitex_fog; + setup_func[COLOR|MULTITEX|SPEC|FOG] = rs_color_multitex_spec_fog; + setup_func[COLOR|POINT] = rs_color_point; + setup_func[COLOR|SPEC|POINT] = rs_color_spec_point; + setup_func[COLOR|FOG|POINT] = rs_color_fog_point; + setup_func[COLOR|SPEC|FOG|POINT] = rs_color_spec_fog_point; + setup_func[COLOR|TEX0|POINT] = rs_color_tex0_point; + setup_func[COLOR|TEX0|SPEC|POINT] = rs_color_tex0_spec_point; + setup_func[COLOR|TEX0|FOG|POINT] = rs_color_tex0_fog_point; + setup_func[COLOR|TEX0|SPEC|FOG|POINT] = rs_color_tex0_spec_fog_point; + setup_func[COLOR|MULTITEX|POINT] = rs_color_multitex_point; + setup_func[COLOR|MULTITEX|SPEC|POINT] = rs_color_multitex_spec_point; + setup_func[COLOR|MULTITEX|FOG|POINT] = rs_color_multitex_fog_point; + setup_func[COLOR|MULTITEX|SPEC|FOG|POINT] = rs_color_multitex_spec_fog_point; setup_func[INDEX] = rs_index; - - setup_func[TEX0] = rs_tex0_color; - setup_func[TEX0|COLOR] = rs_tex0_color; - - setup_func[SPEC] = rs_tex0_color_spec; - setup_func[COLOR|SPEC] = rs_tex0_color_spec; - setup_func[TEX0|SPEC] = rs_tex0_color_spec; - setup_func[TEX0|COLOR|SPEC] = rs_tex0_color_spec; - - setup_func[MULTITEX] = rs_multitex_color; - setup_func[MULTITEX|COLOR] = rs_multitex_color; - - setup_func[FOG] = rs_tex0_color_spec_fog; - setup_func[COLOR|FOG] = rs_tex0_color_spec_fog; - setup_func[SPEC|FOG] = rs_tex0_color_spec_fog; - setup_func[COLOR|SPEC|FOG] = rs_tex0_color_spec_fog; - setup_func[TEX0|FOG] = rs_tex0_color_spec_fog; - setup_func[TEX0|COLOR|FOG] = rs_tex0_color_spec_fog; - setup_func[TEX0|SPEC|FOG] = rs_tex0_color_spec_fog; - setup_func[TEX0|COLOR|SPEC|FOG] = rs_tex0_color_spec_fog; - - setup_func[MULTITEX|SPEC] = rs_multitex_color_spec_fog; - setup_func[MULTITEX|COLOR|SPEC] = rs_multitex_color_spec_fog; - setup_func[MULTITEX|FOG] = rs_multitex_color_spec_fog; - setup_func[MULTITEX|SPEC|FOG] = rs_multitex_color_spec_fog; - setup_func[MULTITEX|COLOR|SPEC|FOG] = rs_multitex_color_spec_fog; - - setup_func[TEX0|POINT] = rs_tex0_color_point; - setup_func[TEX0|COLOR|POINT] = rs_tex0_color_point; - - setup_func[COLOR|INDEX|TEX0] = rs_selection_feedback; + setup_func[INDEX|TEX0] = rs_index_tex0; + setup_func[INDEX|FOG] = rs_index_fog; + setup_func[INDEX|TEX0|FOG] = rs_index_tex0_fog; + setup_func[INDEX|POINT] = rs_index_point; + setup_func[INDEX|TEX0|POINT] = rs_index_tex0_point; + setup_func[INDEX|FOG|POINT] = rs_index_fog_point; + setup_func[INDEX|TEX0|FOG|POINT] = rs_index_tex0_fog_point; } @@ -154,7 +247,7 @@ void _swsetup_choose_rastersetup_func(GLcontext *ctx) { SScontext *swsetup = SWSETUP_CONTEXT(ctx); - int funcindex; + int funcindex = 0; if (ctx->RenderMode == GL_RENDER) { if (ctx->Visual.RGBAflag) { @@ -179,11 +272,16 @@ _swsetup_choose_rastersetup_func(GLcontext *ctx) if (ctx->Fog.Enabled) funcindex |= FOG; } - else { - /* feedback or section */ - funcindex = (COLOR | INDEX | TEX0); - } - - swsetup->RasterSetup = setup_func[funcindex]; + else if (ctx->RenderMode == GL_FEEDBACK) { + if (ctx->Visual.RGBAflag) + funcindex = (COLOR | TEX0); /* is feedback color subject to fogging? */ + else + funcindex = (INDEX | TEX0); + } + else + funcindex = 0; + + swsetup->BuildProjVerts = setup_func[funcindex]; + ASSERT(setup_func[funcindex] != rs_invalid); } diff --git a/src/mesa/swrast_setup/ss_vbtmp.h b/src/mesa/swrast_setup/ss_vbtmp.h index 7ed4d514416..f5a4c449e74 100644 --- a/src/mesa/swrast_setup/ss_vbtmp.h +++ b/src/mesa/swrast_setup/ss_vbtmp.h @@ -26,80 +26,92 @@ */ -static void TAG(rs)(struct vertex_buffer *VB, GLuint start, GLuint end) +static void TAG(rs)(GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) { - GLcontext *ctx = VB->ctx; TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; SWvertex *v; - GLfloat (*eye)[4]; - GLfloat (*win)[4]; + GLfloat (*proj)[4]; /* projected clip coordinates */ GLfloat (*tc[MAX_TEXTURE_UNITS])[4]; GLubyte (*color)[4]; GLubyte (*spec)[4]; GLuint *index; GLfloat *fog; GLfloat *pointSize; - GLuint sz[MAX_TEXTURE_UNITS]; - GLuint szeye; + GLuint tsz[MAX_TEXTURE_UNITS]; int i; + GLfloat *m = ctx->Viewport._WindowMap.m; + const GLfloat sx = m[0]; + const GLfloat sy = m[5]; + const GLfloat sz = m[10]; + const GLfloat tx = m[12]; + const GLfloat ty = m[13]; + const GLfloat tz = m[14]; + GLuint maxtex = 0; - /* TODO: Do window map here. - */ -/* GLfloat *m = VB->ctx->Viewport.WindowMap.m; */ -/* const GLfloat sx = m[0]; */ -/* const GLfloat sy = m[5]; */ -/* const GLfloat sz = m[10] * ctx->Visual->DepthMaxF; */ -/* const GLfloat tx = m[12]; */ -/* const GLfloat ty = m[13]; */ -/* const GLfloat tz = m[14] * ctx->Visual->DepthMaxF; */ - +/* fprintf(stderr, "%s\n", __FUNCTION__); */ /* TODO: Get import_client_data to pad vectors out to 4 cleanly. */ - _tnl_import_client_data( VB, tnl->_RenderFlags, - (VB->ClipOrMask - ? /* VEC_CLEAN| */VEC_WRITABLE|VEC_GOOD_STRIDE - : /* VEC_CLEAN| */VEC_GOOD_STRIDE)); - + if (VB->importable_data) + VB->import_data( ctx, VB->importable_data & newinputs, + (VB->ClipOrMask + ? VEC_NOT_WRITEABLE|VEC_BAD_STRIDE + : VEC_BAD_STRIDE)); + if (IND & TEX0) { tc[0] = VB->TexCoordPtr[0]->data; - sz[0] = VB->TexCoordPtr[0]->size; + tsz[0] = VB->TexCoordPtr[0]->size; } if (IND & MULTITEX) { - for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) { - tc[i] = VB->TexCoordPtr[i]->data; - sz[i] = VB->TexCoordPtr[i]->size; + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { + if (VB->TexCoordPtr[i]) { + maxtex = i+1; + tc[i] = VB->TexCoordPtr[i]->data; + tsz[i] = VB->TexCoordPtr[i]->size; + } + else tc[i] = 0; } } - fog = VB->FogCoordPtr->data; - eye = VB->EyePtr->data; - szeye = VB->EyePtr->size; - win = VB->Win.data; - color = VB->Color[0]->data; - spec = VB->SecondaryColor[0]->data; - index = VB->Index[0]->data; - pointSize = VB->PointSize.data; + /* Tie up some dangling pointers for flat/twoside code in ss_tritmp.h + */ + if ((ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) == 0) { + VB->SecondaryColorPtr[0] = VB->ColorPtr[0]; + VB->SecondaryColorPtr[1] = VB->ColorPtr[1]; + } + + + proj = VB->ProjectedClipPtr->data; + if (IND & FOG) + fog = VB->FogCoordPtr->data; + if (IND & COLOR) + color = VB->ColorPtr[0]->data; + if (IND & SPEC) + spec = VB->SecondaryColorPtr[0]->data; + if (IND & INDEX) + index = VB->IndexPtr[0]->data; + if (IND & POINT) + pointSize = VB->PointSizePtr->data; - v = &(SWSETUP_VB(VB)->verts[start]); + v = &(SWSETUP_CONTEXT(ctx)->verts[start]); for (i=start; i < end; i++, v++) { if (VB->ClipMask[i] == 0) { - COPY_4FV( v->win, win[i] ); + v->win[0] = sx * proj[i][0] + tx; + v->win[1] = sy * proj[i][1] + ty; + v->win[2] = sz * proj[i][2] + tz; + v->win[3] = proj[i][3]; -#if 0 - if (IND & EYE) - COPY_4FV( v->eye, eye[i] ); -#endif if (IND & TEX0) - COPY_CLEAN_4V( v->texcoord[0], sz[0], tc[0][i] ); + COPY_CLEAN_4V( v->texcoord[0], tsz[0], tc[0][i] ); if (IND & MULTITEX) { GLuint u; - for (u = 0 ; u < MAX_TEXTURE_UNITS ; u++) - if (ctx->Texture.Unit[u]._ReallyEnabled) - COPY_CLEAN_4V( v->texcoord[u], sz[u], tc[u][i] ); + for (u = 0 ; u < maxtex ; u++) + if (tc[u]) + COPY_CLEAN_4V( v->texcoord[u], tsz[u], tc[u][i] ); } if (IND & COLOR) @@ -122,3 +134,4 @@ static void TAG(rs)(struct vertex_buffer *VB, GLuint start, GLuint end) #undef TAG #undef IND +#undef SETUP_FLAGS diff --git a/src/mesa/swrast_setup/swrast_setup.h b/src/mesa/swrast_setup/swrast_setup.h index aa32f06f24b..e5ea9668219 100644 --- a/src/mesa/swrast_setup/swrast_setup.h +++ b/src/mesa/swrast_setup/swrast_setup.h @@ -37,18 +37,14 @@ _swsetup_CreateContext( GLcontext *ctx ); extern void _swsetup_DestroyContext( GLcontext *ctx ); -extern void -_swsetup_RegisterVB( struct vertex_buffer *VB ); - -extern void -_swsetup_UnregisterVB( struct vertex_buffer *VB ); - extern void _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state ); extern void -_swsetup_RasterSetup( struct vertex_buffer *VB, - GLuint start, GLuint end ); +_swsetup_BuildProjectedVertices( GLcontext *ctx, + GLuint start, + GLuint end, + GLuint new_inputs ); extern void _swsetup_Quad( GLcontext *ctx, GLuint v0, GLuint v1, @@ -66,5 +62,8 @@ _swsetup_Line( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv ); extern void _swsetup_Points( GLcontext *ctx, GLuint first, GLuint last ); +extern void +_swsetup_IndexedPoints( GLcontext *ctx, GLuint first, GLuint last ); + #endif diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c new file mode 100644 index 00000000000..83d10337be3 --- /dev/null +++ b/src/mesa/tnl/t_array_api.c @@ -0,0 +1,355 @@ +/* $Id: t_array_api.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "api_validate.h" +#include "context.h" +#include "macros.h" +#include "mmath.h" +#include "mem.h" +#include "state.h" +#include "mtypes.h" + +#include "array_cache/acache.h" + +#include "t_array_api.h" +#include "t_array_import.h" +#include "t_imm_api.h" +#include "t_imm_exec.h" +#include "t_context.h" +#include "t_pipeline.h" + + + + + +void +_tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) +{ + GET_CURRENT_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + + /* Check arguments, etc. + */ + if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) + return; + + if (tnl->pipeline.build_state_changes) + _tnl_validate_pipeline( ctx ); + + if (!ctx->CompileFlag && count - start < ctx->Const.MaxArrayLockSize) { + FLUSH_CURRENT( ctx, 0 ); + + if (ctx->Array.LockCount) + { + if (start < ctx->Array.LockFirst) start = ctx->Array.LockFirst; + if (count > ctx->Array.LockCount) count = ctx->Array.LockCount; + if (start >= count) return; + + /* Locked drawarrays. Reuse any previously transformed data. + */ + _tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount ); + VB->FirstPrimitive = start; + VB->Primitive[start] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; + VB->PrimitiveLength[start] = count - start; + _tnl_run_pipeline( ctx ); + } else { + /* The arrays are small enough to fit in a single VB; just bind + * them and go. Any untransformed data will be copied on + * clipping. + * + * Invalidate any locked data dependent on these arrays. + */ + _tnl_vb_bind_arrays( ctx, start, count ); + VB->FirstPrimitive = 0; + VB->Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; + VB->PrimitiveLength[0] = count - start; + tnl->pipeline.run_input_changes |= ctx->Array._Enabled; + _tnl_run_pipeline( ctx ); + tnl->pipeline.run_input_changes |= ctx->Array._Enabled; + } + } + else { + /* Need to produce immediate structs, either for compiling or + * because the array range is too large to process in a single + * VB. In GL_EXECUTE mode, this introduces two redundant + * operations: producing the flag array and computing the orflag + * of the flag array. + */ +#if 0 + if (_tnl_hard_begin( ctx, mode )) { + GLuint j; + for (j = 0 ; j < count ; ) { + struct immediate *IM = TNL_CURRENT_IM(ctx); + GLuint nr = MIN2( IMM_MAXDATA - IM->Start, count - j ); + GLuint sf = IM->Flag[IM->Start]; + + _tnl_fill_immediate_drawarrays( ctx, IM, j, j+nr ); + + if (j == 0) IM->Flag[IM->Start] |= sf; + + IM->Count = IM->Start + nr; + j += nr; + + if (j == count) + _tnl_end( ctx ); + + _tnl_flush_immediate( IM ); + } + } +#else + /* Simple alternative to above code. + */ +/* if (_tnl_hard_begin( ctx, mode )) */ + _tnl_begin(ctx,mode); + { + GLuint i; + for (i=start;ivb.FirstPrimitive = 0; + tnl->vb.Primitive[0] = mode | PRIM_BEGIN | PRIM_END | PRIM_LAST; + tnl->vb.PrimitiveLength[0] = count; + tnl->vb.Elts = (GLuint *)indices; + + if (ctx->Array.LockCount) + _tnl_run_pipeline( ctx ); + else { + /* Note that arrays may have changed before/after execution. + */ + tnl->pipeline.run_input_changes |= ctx->Array._Enabled; + _tnl_run_pipeline( ctx ); + tnl->pipeline.run_input_changes |= ctx->Array._Enabled; + } +} + + + + +static void _tnl_draw_elements( GLcontext *ctx, GLenum mode, GLsizei count, + const GLuint *indices) +{ +#if 1 + /* Optimized code that fakes the effect of calling + * _tnl_array_element for each index in the list. + */ + if (_tnl_hard_begin( ctx, mode )) { + GLuint i,j; + for (j = 0 ; j < count ; ) { + struct immediate *IM = TNL_CURRENT_IM(ctx); + GLuint start = IM->Start; + GLuint nr = MIN2( IMM_MAXDATA - start, count - j ) + start; + GLuint sf = IM->Flag[start]; + IM->FlushElt |= 1; + + for (i = start ; i < nr ; i++) { + IM->Elt[i] = (GLuint) *indices++; + IM->Flag[i] = VERT_ELT; + } + + if (j == 0) IM->Flag[start] |= sf; + + IM->Count = nr; + j += nr - start; + + if (j == count) + _tnl_end( ctx ); + + _tnl_flush_immediate( IM ); + } + } +#else + /* Simple version of the above code. + */ + if (_tnl_hard_begin(ctx, mode)) { + GLuint i; + for (i = 0 ; i < count ; i++) + _tnl_array_element( ctx, indices[i] ); + _tnl_end( ctx ); + } +#endif +} + + +void +_tnl_DrawRangeElements(GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, const GLvoid *indices) +{ + GET_CURRENT_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint *ui_indices; + + /* Check arguments, etc. + */ + if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, + type, indices )) + return; + + if (tnl->pipeline.build_state_changes) + _tnl_validate_pipeline( ctx ); + + ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, + count, type, indices ); + + + if (ctx->Array.LockCount) { + /* Are the arrays already locked? If so we currently have to look + * at the whole locked range. + */ + if (start >= ctx->Array.LockFirst && end <= ctx->Array.LockCount) + _tnl_draw_range_elements( ctx, mode, + ctx->Array.LockFirst, + ctx->Array.LockCount, + count, ui_indices ); + else { + /* The spec says referencing elements outside the locked + * range is undefined. I'm going to make it a noop this time + * round, maybe come up with something beter before 3.6. + * + * May be able to get away with just setting LockCount==0, + * though this raises the problems of dependent state. May + * have to call glUnlockArrays() directly? + */ + gl_problem( ctx, + "DrawRangeElements references " + "elements outside locked range."); + } + } + else if (end - start < ctx->Const.MaxArrayLockSize) { + /* The arrays aren't locked but we can still fit them inside a single + * vertexbuffer. + */ + _tnl_draw_range_elements( ctx, mode, start, end, count, ui_indices ); + } else { + /* Range is too big to optimize: + */ + _tnl_draw_elements( ctx, mode, count, ui_indices ); + } +} + + + +void +_tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices) +{ + GET_CURRENT_CONTEXT(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint *ui_indices; + + /* Check arguments, etc. + */ + if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) + return; + + if (tnl->pipeline.build_state_changes) + _tnl_validate_pipeline( ctx ); + + ui_indices = (GLuint *)_ac_import_elements( ctx, GL_UNSIGNED_INT, + count, type, indices ); + + if (ctx->Array.LockCount) { + _tnl_draw_range_elements( ctx, mode, + ctx->Array.LockFirst, + ctx->Array.LockCount, + count, ui_indices ); + } + else { + /* Scan the index list and see if we can use the locked path anyway. + */ + GLuint max_elt = 0; + GLuint i; + + for (i = 0 ; i < count ; i++) + if (ui_indices[i] > max_elt) max_elt = ui_indices[i]; + + if (max_elt < ctx->Const.MaxArrayLockSize && /* can we use it? */ + max_elt < count) /* do we want to use it? */ + _tnl_draw_range_elements( ctx, mode, 0, max_elt, count, ui_indices ); + else + _tnl_draw_elements( ctx, mode, count, ui_indices ); + } +} + + +void _tnl_array_init( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_arrays *tmp = &tnl->array_inputs; + GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->vtxfmt); + GLuint i; + + vfmt->DrawArrays = _tnl_DrawArrays; + vfmt->DrawElements = _tnl_DrawElements; + vfmt->DrawRangeElements = _tnl_DrawRangeElements; + + /* Setup vector pointers that will be used to bind arrays to VB's. + */ + gl_vector4f_init( &tmp->Obj, 0, 0 ); + gl_vector3f_init( &tmp->Normal, 0, 0 ); + gl_vector4ub_init( &tmp->Color, 0, 0 ); + gl_vector4ub_init( &tmp->SecondaryColor, 0, 0 ); + gl_vector1f_init( &tmp->FogCoord, 0, 0 ); + gl_vector1ui_init( &tmp->Index, 0, 0 ); + gl_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); + + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) + gl_vector4f_init( &tmp->TexCoord[i], 0, 0); + + tnl->tmp_primitive = (GLuint *)MALLOC(sizeof(GLuint)*tnl->vb.Size); + tnl->tmp_primitive_length = (GLuint *)MALLOC(sizeof(GLuint)*tnl->vb.Size); +} + + +void _tnl_array_destroy( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + if (tnl->tmp_primitive_length) FREE(tnl->tmp_primitive_length); + if (tnl->tmp_primitive) FREE(tnl->tmp_primitive); +} diff --git a/src/mesa/tnl/t_array_api.h b/src/mesa/tnl/t_array_api.h new file mode 100644 index 00000000000..ebb99e78d6b --- /dev/null +++ b/src/mesa/tnl/t_array_api.h @@ -0,0 +1,47 @@ +/* $Id: t_array_api.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _T_VARRAY_H +#define _T_VARRAY_H + +#include "mtypes.h" +#include "t_context.h" + + +extern void _tnl_DrawArrays(GLenum mode, GLint first, GLsizei count); + +extern void _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); + +extern void _tnl_DrawRangeElements(GLenum mode, GLuint start, + GLuint end, GLsizei count, GLenum type, + const GLvoid *indices); + + +extern void _tnl_array_init( GLcontext *ctx ); +extern void _tnl_array_destroy( GLcontext *ctx ); + +#endif diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c new file mode 100644 index 00000000000..16a669dc287 --- /dev/null +++ b/src/mesa/tnl/t_array_import.c @@ -0,0 +1,521 @@ +/* $Id: t_array_import.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "context.h" +#include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "state.h" +#include "mtypes.h" + +#include "array_cache/acache.h" +#include "math/m_translate.h" + +#include "t_array_import.h" +#include "t_context.h" + + +static void _tnl_import_vertex( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + + tmp = _ac_import_vertex(ctx, + GL_FLOAT, + stride ? 4*sizeof(GLfloat) : 0, + 0, + writeable, + &is_writeable); + + inputs->Obj.data = tmp->Ptr; + inputs->Obj.start = (GLfloat *)tmp->Ptr; + inputs->Obj.stride = tmp->StrideB; + inputs->Obj.size = tmp->Size; + inputs->Obj.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); + if (stride != 4*sizeof(GLfloat)) + inputs->Obj.flags |= VEC_BAD_STRIDE; + if (!is_writeable) + inputs->Obj.flags |= VEC_NOT_WRITEABLE; +} + +static void _tnl_import_normal( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + + tmp = _ac_import_normal(ctx, GL_FLOAT, + stride ? 3*sizeof(GLfloat) : 0, writeable, + &is_writeable); + + inputs->Normal.data = tmp->Ptr; + inputs->Normal.start = (GLfloat *)tmp->Ptr; + inputs->Normal.stride = tmp->StrideB; + inputs->Normal.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); + if (stride != 3*sizeof(GLfloat)) + inputs->Normal.flags |= VEC_BAD_STRIDE; + if (!is_writeable) + inputs->Normal.flags |= VEC_NOT_WRITEABLE; +} + + +static void _tnl_import_color( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + + tmp = _ac_import_color(ctx, + GL_UNSIGNED_BYTE, + stride ? 4*sizeof(GLubyte) : 0, + 4, + writeable, + &is_writeable); + + inputs->Color.data = tmp->Ptr; + inputs->Color.start = (GLubyte *)tmp->Ptr; + inputs->Color.stride = tmp->StrideB; + inputs->Color.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); + if (stride != 4*sizeof(GLubyte)) + inputs->Color.flags |= VEC_BAD_STRIDE; + if (!is_writeable) + inputs->Color.flags |= VEC_NOT_WRITEABLE; +} + + +static void _tnl_import_secondarycolor( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + + tmp = _ac_import_secondarycolor(ctx, GL_UNSIGNED_BYTE, + stride ? 4*sizeof(GLubyte) : 0, + 4, + writeable, + &is_writeable); + + inputs->SecondaryColor.data = tmp->Ptr; + inputs->SecondaryColor.start = (GLubyte *)tmp->Ptr; + inputs->SecondaryColor.stride = tmp->StrideB; + inputs->SecondaryColor.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); + if (stride != 4*sizeof(GLubyte)) + inputs->SecondaryColor.flags |= VEC_BAD_STRIDE; + if (!is_writeable) + inputs->SecondaryColor.flags |= VEC_NOT_WRITEABLE; +} + +static void _tnl_import_fogcoord( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + + tmp = _ac_import_fogcoord(ctx, GL_FLOAT, + stride ? sizeof(GLfloat) : 0, writeable, + &is_writeable); + + inputs->FogCoord.data = tmp->Ptr; + inputs->FogCoord.start = (GLfloat *)tmp->Ptr; + inputs->FogCoord.stride = tmp->StrideB; + inputs->FogCoord.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); + if (stride != sizeof(GLfloat)) + inputs->FogCoord.flags |= VEC_BAD_STRIDE; + if (!is_writeable) + inputs->FogCoord.flags |= VEC_NOT_WRITEABLE; +} + +static void _tnl_import_index( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + + tmp = _ac_import_index(ctx, GL_UNSIGNED_INT, + stride ? sizeof(GLuint) : 0, writeable, + &is_writeable); + + inputs->Index.data = tmp->Ptr; + inputs->Index.start = (GLuint *)tmp->Ptr; + inputs->Index.stride = tmp->StrideB; + inputs->Index.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); + if (stride != sizeof(GLuint)) + inputs->Index.flags |= VEC_BAD_STRIDE; + if (!is_writeable) + inputs->Index.flags |= VEC_NOT_WRITEABLE; +} + + +static void _tnl_import_texcoord( GLcontext *ctx, + GLuint i, + GLboolean writeable, + GLboolean stride ) +{ + struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + + tmp = _ac_import_texcoord(ctx, i, GL_FLOAT, + stride ? 4*sizeof(GLfloat) : 0, + 0, + writeable, + &is_writeable); + + inputs->TexCoord[i].data = tmp->Ptr; + inputs->TexCoord[i].start = (GLfloat *)tmp->Ptr; + inputs->TexCoord[i].stride = tmp->StrideB; + inputs->TexCoord[i].size = tmp->Size; + inputs->TexCoord[i].flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); + if (stride != 4*sizeof(GLfloat)) + inputs->TexCoord[i].flags |= VEC_BAD_STRIDE; + if (!is_writeable) + inputs->TexCoord[i].flags |= VEC_NOT_WRITEABLE; +} + + +static void _tnl_import_edgeflag( GLcontext *ctx, + GLboolean writeable, + GLboolean stride ) +{ + struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + struct gl_client_array *tmp; + GLboolean is_writeable = 0; + + tmp = _ac_import_edgeflag(ctx, GL_UNSIGNED_BYTE, + stride ? sizeof(GLubyte) : 0, + 0, + &is_writeable); + + inputs->EdgeFlag.data = tmp->Ptr; + inputs->EdgeFlag.start = (GLubyte *)tmp->Ptr; + inputs->EdgeFlag.stride = tmp->StrideB; + inputs->EdgeFlag.flags &= ~(VEC_BAD_STRIDE|VEC_NOT_WRITEABLE); + if (stride != sizeof(GLubyte)) + inputs->EdgeFlag.flags |= VEC_BAD_STRIDE; + if (!is_writeable) + inputs->EdgeFlag.flags |= VEC_NOT_WRITEABLE; +} + + + +/* Callback for VB stages that need to improve the quality of arrays + * bound to the VB. This is only necessary for client arrays which + * have not been transformed at any point in the pipeline. + */ +static void _tnl_upgrade_client_data( GLcontext *ctx, + GLuint required, + GLuint flags ) +{ + GLuint i; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_arrays *inputs = &TNL_CONTEXT(ctx)->array_inputs; + GLboolean writeable = (flags & VEC_NOT_WRITEABLE) != 0; + GLboolean stride = (flags & VEC_BAD_STRIDE) != 0; + + if ((required & VERT_CLIP) && VB->ClipPtr == VB->ObjPtr) + required |= VERT_OBJ; + + if ((required & VERT_OBJ) && (VB->ObjPtr->flags & flags)) { + ASSERT(VB->ObjPtr == &inputs->Obj); + _tnl_import_vertex( ctx, writeable, stride ); + } + + if ((required & VERT_NORM) && (VB->NormalPtr->flags & flags)) { + ASSERT(VB->NormalPtr == &inputs->Normal); + _tnl_import_normal( ctx, writeable, stride ); + } + + if ((required & VERT_RGBA) && (VB->ColorPtr[0]->flags & flags)) { + ASSERT(VB->ColorPtr[0] == &inputs->Color); + _tnl_import_color( ctx, writeable, stride ); + } + + if ((required & VERT_SPEC_RGB) && (VB->SecondaryColorPtr[0]->flags&flags)) { + ASSERT(VB->SecondaryColorPtr[0] == &inputs->SecondaryColor); + _tnl_import_secondarycolor( ctx, writeable, stride ); + } + + if ((required & VERT_FOG_COORD) && (VB->FogCoordPtr->flags & flags)) { + ASSERT(VB->FogCoordPtr == &inputs->FogCoord); + _tnl_import_fogcoord( ctx, writeable, stride ); + } + + if ((required & VERT_INDEX) && (VB->IndexPtr[0]->flags & flags)) { + ASSERT(VB->IndexPtr[0] == &inputs->Index); + _tnl_import_index( ctx, writeable, stride ); + } + + if (required & VERT_TEX_ANY) + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + if ((required & VERT_TEX(i)) && (VB->TexCoordPtr[i]->flags & flags)) { + ASSERT(VB->TexCoordPtr[i] == &inputs->TexCoord[i]); + _tnl_import_texcoord( ctx, i, writeable, stride ); + } + + if ((required & VERT_EDGE) && (VB->EdgeFlagPtr->flags & flags)) { + ASSERT(VB->EdgeFlagPtr == &inputs->EdgeFlag); + _tnl_import_edgeflag( ctx, writeable, stride ); + } + + VB->importable_data &= ~required; +} + + + + + +void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLuint inputs = tnl->pipeline.inputs; + GLuint imports; + struct vertex_arrays *tmp = &tnl->array_inputs; + + if (ctx->Array.LockCount) { + ASSERT(start == ctx->Array.LockFirst); + ASSERT(count == ctx->Array.LockCount); + } + + imports = tnl->pipeline.inputs; + + _ac_import_range( ctx, start, count ); + + VB->Count = count - start; + VB->FirstClipped = VB->Count; + + VB->Elts = 0; + VB->MaterialMask = 0; + VB->Material = 0; + VB->Flag = 0; + +/* _tnl_print_vert_flags("_tnl_print_vert_flags: inputs", inputs); */ +/* _tnl_print_vert_flags("_tnl_print_vert_flags: imports", imports); */ +/* _tnl_print_vert_flags("_tnl_print_vert_flags: _Enabled", ctx->Array._Enabled); */ + + if (inputs & VERT_OBJ) { + if (imports & VERT_OBJ) { + _tnl_import_vertex( ctx, 0, 0 ); + tmp->Obj.count = VB->Count; + } + VB->ObjPtr = &tmp->Obj; + } + + if (inputs & VERT_NORM) { + if (imports & VERT_NORM) { + _tnl_import_normal( ctx, 0, 0 ); + tmp->Normal.count = VB->Count; + } + VB->NormalPtr = &tmp->Normal; + } + + if (inputs & VERT_RGBA) { + if (imports & VERT_RGBA) { + _tnl_import_color( ctx, 0, 0 ); + tmp->Color.count = VB->Count; + } + VB->ColorPtr[0] = &tmp->Color; + VB->ColorPtr[1] = 0; + } + + if (inputs & VERT_INDEX) { + if (imports & VERT_INDEX) { + _tnl_import_index( ctx, 0, 0 ); + tmp->Index.count = VB->Count; + } + VB->IndexPtr[0] = &tmp->Index; + VB->IndexPtr[1] = 0; + } + + + if (inputs & VERT_FOG_COORD) { + if (imports & VERT_FOG_COORD) { + _tnl_import_fogcoord( ctx, 0, 0 ); + tmp->FogCoord.count = VB->Count; + } + VB->FogCoordPtr = &tmp->FogCoord; + } + + if (inputs & VERT_EDGE) { + if (imports & VERT_EDGE) { + _tnl_import_edgeflag( ctx, 0, 0 ); + tmp->EdgeFlag.count = VB->Count; + } + VB->EdgeFlagPtr = &tmp->EdgeFlag; + } + + if (inputs & VERT_SPEC_RGB) { + if (imports & VERT_SPEC_RGB) { + _tnl_import_secondarycolor( ctx, 0, 0 ); + tmp->SecondaryColor.count = VB->Count; + } + VB->SecondaryColorPtr[0] = &tmp->SecondaryColor; + VB->SecondaryColorPtr[1] = 0; + } + + if (inputs & VERT_TEX_ANY) { + GLuint i; + for (i = 0; i < ctx->Const.MaxTextureUnits ; i++) + if (inputs & VERT_TEX(i)) { + if (imports & VERT_TEX(i)) { + _tnl_import_texcoord( ctx, i, 0, 0 ); + tmp->TexCoord[i].count = VB->Count; + } + VB->TexCoordPtr[i] = &tmp->TexCoord[i]; + } + } + + VB->Primitive = tnl->tmp_primitive; + VB->PrimitiveLength = tnl->tmp_primitive_length; + VB->import_data = _tnl_upgrade_client_data; + VB->importable_data = imports; +} + + + + +/* Function to fill an immediate struct with the effects of + * consecutive calls to ArrayElement with consecutive indices. + */ +void _tnl_fill_immediate_drawarrays( GLcontext *ctx, struct immediate *IM, + GLuint start, GLuint count ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint required = ctx->Array._Enabled; + GLuint n = count - start; + GLuint i; + + if (!ctx->CompileFlag) + required &= tnl->pipeline.inputs; + + if (MESA_VERBOSE&VERBOSE_IMMEDIATE) + fprintf(stderr, "exec_full_array_elements %d .. %d\n", start, count); + + _math_trans_4f( IM->Obj + IM->Start, + ctx->Array.Vertex.Ptr, + ctx->Array.Vertex.StrideB, + ctx->Array.Vertex.Type, + ctx->Array.Vertex.Size, + start, n ); + + if (ctx->Array.Vertex.Size == 4) + required |= VERT_OBJ_234; + else if (ctx->Array.Vertex.Size == 3) + required |= VERT_OBJ_23; + + + if (required & VERT_NORM) { + _math_trans_3f( IM->Normal + IM->Start, + ctx->Array.Normal.Ptr, + ctx->Array.Normal.StrideB, + ctx->Array.Normal.Type, + start, n ); + } + + if (required & VERT_EDGE) { + _math_trans_1ub( IM->EdgeFlag + IM->Start, + ctx->Array.EdgeFlag.Ptr, + ctx->Array.EdgeFlag.StrideB, + ctx->Array.EdgeFlag.Type, + start, n ); + } + + if (required & VERT_RGBA) { + _math_trans_4ub( IM->Color + IM->Start, + ctx->Array.Color.Ptr, + ctx->Array.Color.StrideB, + ctx->Array.Color.Type, + ctx->Array.Color.Size, + start, n ); + } + + if (required & VERT_SPEC_RGB) { + _math_trans_4ub( IM->SecondaryColor + IM->Start, + ctx->Array.SecondaryColor.Ptr, + ctx->Array.SecondaryColor.StrideB, + ctx->Array.SecondaryColor.Type, + ctx->Array.SecondaryColor.Size, + start, n ); + } + + if (required & VERT_FOG_COORD) { + _math_trans_1f( IM->FogCoord + IM->Start, + ctx->Array.FogCoord.Ptr, + ctx->Array.FogCoord.StrideB, + ctx->Array.FogCoord.Type, + start, n ); + } + + if (required & VERT_INDEX) { + _math_trans_1ui( IM->Index + IM->Start, + ctx->Array.Index.Ptr, + ctx->Array.Index.StrideB, + ctx->Array.Index.Type, + start, n ); + } + + if (required & VERT_TEX_ANY) { + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { + if (required & VERT_TEX(i)) { + _math_trans_4f( IM->TexCoord[i] + IM->Start, + ctx->Array.TexCoord[i].Ptr, + ctx->Array.TexCoord[i].StrideB, + ctx->Array.TexCoord[i].Size, + ctx->Array.TexCoord[i].Type, + start, n ); + + if (ctx->Array.TexCoord[i].Size == 4) + IM->TexSize |= TEX_SIZE_4(i); + else if (ctx->Array.TexCoord[i].Size == 3) + IM->TexSize |= TEX_SIZE_3(i); + } + } + } + + IM->Count = IM->Start + n; + IM->Flag[IM->Start] |= required; + for (i = IM->Start+1 ; i < IM->Count ; i++) + IM->Flag[i] = required; +} + + diff --git a/src/mesa/tnl/t_array_import.h b/src/mesa/tnl/t_array_import.h new file mode 100644 index 00000000000..c1b903e24a5 --- /dev/null +++ b/src/mesa/tnl/t_array_import.h @@ -0,0 +1,42 @@ +/* $Id: t_array_import.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _T_ARRAY_IMPORT_H +#define _T_ARRAY_IMPORT_H + +#include "mtypes.h" +#include "t_context.h" + +extern void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ); + +extern void _tnl_fill_immediate_drawarrays( GLcontext *ctx, + struct immediate *IM, + GLuint start, GLuint count ) ; + +extern void _tnl_array_import_init( GLcontext *ctx ); + + +#endif diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index d27a48b2960..5b879d8a831 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -1,101 +1,74 @@ +/* $Id: t_context.c,v 1.7 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "macros.h" #include "mtypes.h" #include "mem.h" #include "dlist.h" #include "vtxfmt.h" #include "t_context.h" -#include "t_clip.h" -#include "t_cva.h" -#include "t_dlist.h" -#include "t_eval.h" +#include "t_array_api.h" +#include "t_eval_api.h" +#include "t_imm_alloc.h" +#include "t_imm_exec.h" +#include "t_imm_dlist.h" #include "t_pipeline.h" -#include "t_shade.h" -#include "t_light.h" -#include "t_texture.h" -#include "t_stages.h" -#include "t_varray.h" -#include "t_vb.h" -#include "t_vbrender.h" -#include "t_vbxform.h" -#include "t_vtxfmt.h" #include "tnl.h" -#if !defined(THREADS) +#ifndef THREADS struct immediate *_tnl_CurrentInput = NULL; #endif -GLboolean -_tnl_flush_vertices( GLcontext *ctx, GLuint flush_flags ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct immediate *IM = TNL_CURRENT_IM(ctx); - - if ((IM->Flag[IM->Count] & (VERT_BEGIN|VERT_END)) != VERT_END || - (flush_flags & (FLUSH_STORED_VERTICES|FLUSH_UPDATE_CURRENT))) - { - if (IM->Flag[IM->Start]) - _tnl_maybe_transform_vb( IM ); - - /* Although this code updates the ctx->Current values, that bit - * is left set as there is no easy mechanism to set it - * elsewhere. This means that each time core wants to examine - * ctx->Current, this function will be called. After the first - * time, however, it will be a no-op. - */ - ctx->Driver.NeedFlush &= ~(FLUSH_STORED_VERTICES | - FLUSH_INSIDE_BEGIN_END); - - return (tnl->_CurrentPrimitive == GL_POLYGON+1); - } - else - return GL_TRUE; -} - - - - void +void _tnl_MakeCurrent( GLcontext *ctx, GLframebuffer *drawBuffer, GLframebuffer *readBuffer ) { #ifndef THREADS - SET_IMMEDIATE( ctx, TNL_VB(ctx)->IM ); + SET_IMMEDIATE( ctx, TNL_CURRENT_IM(ctx) ); #endif } -/* Update all state that references _NeedEyeCoords - */ - void -_tnl_LightingSpaceChange( GLcontext *ctx ) -{ - _tnl_update_normal_transform( ctx ); -} - - static void install_driver_callbacks( GLcontext *ctx ) { - ctx->Driver.RenderVBCulledTab = _tnl_render_tab_cull; - ctx->Driver.RenderVBClippedTab = _tnl_render_tab_clipped; - ctx->Driver.RenderVBRawTab = _tnl_render_tab_raw; ctx->Driver.NewList = _tnl_NewList; ctx->Driver.EndList = _tnl_EndList; ctx->Driver.FlushVertices = _tnl_flush_vertices; - ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT; - ctx->Driver.LightingSpaceChange = _tnl_LightingSpaceChange; ctx->Driver.MakeCurrent = _tnl_MakeCurrent; - ctx->Driver.VertexPointer = _tnl_VertexPointer; - ctx->Driver.NormalPointer = _tnl_NormalPointer; - ctx->Driver.ColorPointer = _tnl_ColorPointer; - ctx->Driver.FogCoordPointer = _tnl_FogCoordPointer; - ctx->Driver.IndexPointer = _tnl_IndexPointer; - ctx->Driver.SecondaryColorPointer = _tnl_SecondaryColorPointer; - ctx->Driver.TexCoordPointer = _tnl_TexCoordPointer; - ctx->Driver.EdgeFlagPointer = _tnl_EdgeFlagPointer; - ctx->Driver.LockArraysEXT = _tnl_LockArraysEXT; - ctx->Driver.UnlockArraysEXT = _tnl_UnlockArraysEXT; + ctx->Driver.BeginCallList = _tnl_BeginCallList; + ctx->Driver.EndCallList = _tnl_EndCallList; } @@ -104,21 +77,6 @@ GLboolean _tnl_CreateContext( GLcontext *ctx ) { TNLcontext *tnl; - static int firsttime = 1; - - /* Onetime initializations. Doesn't really matter if this gets - * done twice: no need for mutexes. - */ - if (firsttime) { - firsttime = 0; - _tnl_clip_init(); - _tnl_eval_init(); - _tnl_shade_init(); - _tnl_texture_init(); - _tnl_trans_elt_init(); - _tnl_vbrender_init(); - _tnl_stages_init(); - } /* Create the TNLcontext structure */ @@ -127,43 +85,35 @@ _tnl_CreateContext( GLcontext *ctx ) return GL_FALSE; } - /* Create and hook in the data structures available from ctx. + /* Initialize the VB. */ - ctx->swtnl_vb = (void *)_tnl_vb_create_for_immediate( ctx ); - if (!ctx->swtnl_vb) { - FREE(tnl); - ctx->swtnl_context = 0; - return GL_FALSE; - } + tnl->vb.Size = MAX2( IMM_SIZE, + ctx->Const.MaxArrayLockSize + MAX_CLIPPED_VERTICES); - ctx->swtnl_im = (void *)TNL_VB(ctx)->IM; - - /* Initialize tnl state. + /* Initialize tnl state and tnl->vtxfmt. */ _tnl_dlist_init( ctx ); - _tnl_pipeline_init( ctx ); - _tnl_vtxfmt_init( ctx ); - _tnl_cva_init( ctx ); - - _tnl_reset_vb( TNL_VB(ctx) ); - _tnl_reset_input( ctx, 0, 0 ); /* initially outside begin/end */ - - - tnl->_CurrentTex3Flag = 0; - tnl->_CurrentTex4Flag = 0; - tnl->_CurrentPrimitive = GL_POLYGON+1; + _tnl_array_init( ctx ); + _tnl_imm_init( ctx ); + _tnl_eval_init( ctx ); + _tnl_install_pipeline( ctx, _tnl_default_pipeline ); + /* Hook our functions into exec and compile dispatch tables. */ _mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); _mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt ); ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1; /* fixme */ ctx->Save->EvalMesh2 = _mesa_save_EvalMesh2; + ctx->Save->Begin = _tnl_save_Begin; /* Set a few default values in the driver struct. */ install_driver_callbacks(ctx); + ctx->Driver.NeedFlush = FLUSH_UPDATE_CURRENT|FLUSH_STORED_VERTICES; + ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; + ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; return GL_TRUE; } @@ -174,56 +124,45 @@ _tnl_DestroyContext( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); - if (TNL_CURRENT_IM(ctx) != TNL_VB(ctx)->IM) - _tnl_immediate_free( TNL_CURRENT_IM(ctx) ); - - _tnl_vb_free( TNL_VB(ctx) ); +/* _tnl_dlist_destroy( ctx ); */ + _tnl_array_destroy( ctx ); + _tnl_imm_destroy( ctx ); +/* _tnl_eval_destroy( ctx ); */ + _tnl_destroy_pipeline( ctx ); - /* Free cache of immediate buffers. */ - while (tnl->nr_im_queued-- > 0) { - struct immediate * next = tnl->freed_im_queue->next; - ALIGN_FREE( tnl->freed_im_queue ); - tnl->freed_im_queue = next; - } + FREE(tnl); + ctx->swtnl_context = 0; } - void _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) { - if (new_state & _NEW_LIGHT) - _tnl_update_lighting_function(ctx); - - if (new_state & _NEW_ARRAY) - _tnl_update_client_state( ctx ); - - if (new_state & _NEW_TEXTURE) - if (ctx->_Enabled & ENABLE_TEXGEN_ANY) - _tnl_update_texgen( ctx ); + TNLcontext *tnl = TNL_CONTEXT(ctx); - if (new_state & (_NEW_LIGHT|_NEW_TEXTURE|_NEW_FOG| - _DD_NEW_TRI_LIGHT_TWOSIDE | - _DD_NEW_SEPERATE_SPECULAR | - _DD_NEW_TRI_UNFILLED )) - _tnl_update_clipmask(ctx); + if (new_state & _NEW_ARRAY) { + struct immediate *IM = TNL_CURRENT_IM(ctx); + IM->ArrayEltFlags = ~ctx->Array._Enabled; + IM->ArrayEltFlush = !ctx->Array.LockCount; + IM->ArrayEltIncr = ctx->Array.Vertex.Enabled ? 1 : 0; + tnl->pipeline.run_input_changes |= ctx->Array.NewState; /* overkill */ + } - if (new_state & _TNL_NEW_NORMAL_TRANSFORM) - _tnl_update_normal_transform( ctx ); + tnl->pipeline.run_state_changes |= new_state; + tnl->pipeline.build_state_changes |= (new_state & + tnl->pipeline.build_state_trigger); - _tnl_update_pipelines(ctx); + tnl->eval.EvalNewState |= new_state; } + void _tnl_wakeup_exec( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); -#ifndef VMS - fprintf(stderr, "%s\n", __FUNCTION__); -#endif - install_driver_callbacks(ctx); + ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; /* Hook our functions into exec and compile dispatch tables. */ @@ -232,35 +171,23 @@ _tnl_wakeup_exec( GLcontext *ctx ) /* Call all appropriate driver callbacks to revive state. */ _tnl_MakeCurrent( ctx, ctx->DrawBuffer, ctx->ReadBuffer ); - _tnl_UnlockArraysEXT( ctx ); - _tnl_LockArraysEXT( ctx, ctx->Array.LockFirst, ctx->Array.LockCount ); - - /* Equivalent to calling all _tnl_*Pointer functions: - */ - tnl->_ArrayNewState = ~0; /* Assume we haven't been getting state updates either: */ - _tnl_InvalidateState( ctx, ~0 ); - - /* Special state not restored by other methods: - */ - _tnl_validate_current_tex_flags( ctx, ~0 ); - + _tnl_InvalidateState( ctx, ~0 ); + tnl->pipeline.run_input_changes = ~0; } + void _tnl_wakeup_save_exec( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); -#ifndef VMS - fprintf(stderr, "%s\n", __FUNCTION__); -#endif - _tnl_wakeup_exec( ctx ); _mesa_install_save_vtxfmt( ctx, &tnl->vtxfmt ); ctx->Save->EvalMesh1 = _mesa_save_EvalMesh1; /* fixme */ ctx->Save->EvalMesh2 = _mesa_save_EvalMesh2; + ctx->Save->Begin = _tnl_save_Begin; } diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index fb036b9f3d9..1a4ebb2170f 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -1,5 +1,4 @@ - -/* $Id: t_context.h,v 1.6 2000/12/08 00:18:39 brianp Exp $ */ +/* $Id: t_context.h,v 1.7 2000/12/26 05:09:32 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -23,6 +22,9 @@ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell */ #ifndef _T_CONTEXT_H @@ -35,99 +37,91 @@ #include "math/m_vector.h" #include "math/m_xform.h" -#include "t_trans_elt.h" +#define MAX_PIPELINE_STAGES 30 -/* - * Bits to indicate which faces a vertex participates in, - * what facing the primitive provoked by that vertex has, - * and some misc. flags. +/* Numbers for sizing immediate structs. */ -#define VERT_FACE_FRONT 0x1 /* is in a front-color primitive */ -#define VERT_FACE_REAR 0x2 /* is in a rear-color primitive */ -#define PRIM_FACE_FRONT 0x4 /* use front color */ -#define PRIM_FACE_REAR 0x8 /* use rear color */ -#define PRIM_CLIPPED 0x10 /* needs clipping */ -#define PRIM_USER_CLIPPED CLIP_USER_BIT /* 0x40 */ +#define IMM_MAX_COPIED_VERTS 3 +#define IMM_MAXDATA (216 + IMM_MAX_COPIED_VERTS) +#define IMM_SIZE (IMM_MAXDATA + MAX_CLIPPED_VERTICES) -#define PRIM_FLAG_SHIFT 2 -#define PRIM_FACE_FLAGS (PRIM_FACE_FRONT|PRIM_FACE_REAR) -#define VERT_FACE_FLAGS (VERT_FACE_FRONT|VERT_FACE_REAR) - -#define PRIM_ANY_CLIP (PRIM_CLIPPED|PRIM_USER_CLIPPED) -#define PRIM_NOT_CULLED (PRIM_ANY_CLIP|PRIM_FACE_FLAGS) - -/* Flags for VB->CullMode. +/* Values for IM->BeginState */ -#define CULL_MASK_ACTIVE 0x1 -#define COMPACTED_NORMALS 0x2 -#define CLIP_MASK_ACTIVE 0x4 +#define VERT_BEGIN_0 0x1 /* glBegin (if initially inside beg/end) */ +#define VERT_BEGIN_1 0x2 /* glBegin (if initially outside beg/end) */ +#define VERT_ERROR_0 0x4 /* invalid_operation in initial state 0 */ +#define VERT_ERROR_1 0x8 /* invalid_operation in initial state 1 */ -/* Flags for selecting a shading function. The first two bits are - * shared with the cull mode (ie. cull_mask_active and - * compacted_normals.) + +/* Flags to be added to the primitive enum in VB->Primitive. */ -#define SHADE_TWOSIDE 0x4 +#define PRIM_MODE_MASK 0xff /* Extract the actual primitive */ +#define PRIM_BEGIN 0x100 /* The prim starts here (not wrapped) */ +#define PRIM_END 0x200 /* The prim ends in this VB (does not wrap) */ +#define PRIM_PARITY 0x400 /* The prim wrapped on an odd number of verts */ +#define PRIM_LAST 0x800 /* No more prims in the VB */ -/* KW: Flags that describe the current vertex state, and the contents - * of a vertex in a vertex-cassette. +/* Flags that describe the inputs and outputs of pipeline stages, and + * the contents of a vertex-cassette. * - * For really major expansion, consider a 'VERT_ADDITIONAL_FLAGS' flag, - * which means there is data in another flags array (eg, extra_flags[]). + * 5 spare flags, rearrangement of eval flags can secure at least 3 + * more. + */ +#define VERT_OBJ _NEW_ARRAY_VERTEX +#define VERT_RGBA _NEW_ARRAY_COLOR +#define VERT_NORM _NEW_ARRAY_NORMAL +#define VERT_INDEX _NEW_ARRAY_INDEX +#define VERT_EDGE _NEW_ARRAY_EDGEFLAG +#define VERT_SPEC_RGB _NEW_ARRAY_SECONDARYCOLOR +#define VERT_FOG_COORD _NEW_ARRAY_FOGCOORD +#define VERT_TEX0 _NEW_ARRAY_TEXCOORD_0 +#define VERT_TEX1 _NEW_ARRAY_TEXCOORD_1 +#define VERT_TEX2 _NEW_ARRAY_TEXCOORD_2 +#define VERT_TEX3 _NEW_ARRAY_TEXCOORD_3 +#define VERT_TEX4 _NEW_ARRAY_TEXCOORD_4 +#define VERT_TEX5 _NEW_ARRAY_TEXCOORD_5 +#define VERT_TEX6 _NEW_ARRAY_TEXCOORD_6 +#define VERT_TEX7 _NEW_ARRAY_TEXCOORD_7 +#define VERT_EVAL_C1 0x8000 /* imm only */ +#define VERT_EVAL_C2 0x10000 /* imm only */ +#define VERT_EVAL_P1 0x20000 /* imm only */ +#define VERT_EVAL_P2 0x40000 /* imm only */ +#define VERT_OBJ_3 0x80000 /* imm only */ +#define VERT_OBJ_4 0x100000 /* imm only */ +#define VERT_MATERIAL 0x200000 /* imm only, but tested in vb code */ +#define VERT_ELT 0x400000 /* imm only */ +#define VERT_BEGIN 0x800000 /* imm only, but tested in vb code */ +#define VERT_END 0x1000000 /* imm only, but tested in vb code */ +#define VERT_END_VB 0x2000000 /* imm only, but tested in vb code */ +#define VERT_POINT_SIZE 0x4000000 /* vb only, could reuse a bit */ +#define VERT_EYE VERT_BEGIN /* vb only, reuse imm bit */ +#define VERT_CLIP VERT_END /* vb only, reuse imm bit*/ + + +/* Flags for IM->TexCoordSize. Enough flags for 16 units. */ +#define TEX_0_SIZE_3 0x1 +#define TEX_0_SIZE_4 0x1000 +#define TEX_SIZE_3(unit) (TEX_0_SIZE_3<Type */ -enum { - VB_IMMEDIATE, - VB_CVA_PRECALC -}; - - -/* Values for immediate->BeginState */ -#define VERT_BEGIN_0 0x1 /* glBegin (if initially inside beg/end) */ -#define VERT_BEGIN_1 0x2 /* glBegin (if initially outside beg/end) */ -#define VERT_ERROR_0 0x4 /* invalid_operation in initial state 0 */ -#define VERT_ERROR_1 0x8 /* invalid_operation in initial state 1 */ /* KW: Represents everything that can take place between a begin and - * end, and can represent multiple begin/end pairs. This plus *any* - * state variable (GLcontext) should be all you need to replay the - * represented begin/end pairs as if they took place in that state. - * - * Thus this is sufficient for both immediate and compiled modes, but - * we could/should throw some elements away for compiled mode if we - * know they were empty. + * end, and can represent multiple begin/end pairs. Can be used to + * losslessly encode this information in display lists. */ struct immediate { - struct immediate *next; /* for cache of free IM's */ + struct __GLcontextRec *backref; GLuint id, ref_count; /* This must be saved when immediates are shared in display lists. */ - GLuint Start, Count; + GLuint CopyStart, Start, Count; GLuint LastData; /* count or count+1 */ GLuint AndFlag, OrFlag; - GLuint Tex3Flag, Tex4Flag; /* keep track of texcoord sizes */ + GLuint TexSize; /* keep track of texcoord sizes */ GLuint BeginState, SavedBeginState; GLuint LastPrimitive; - GLuint ArrayAndFlags; /* precalc'ed for glArrayElt */ - GLuint ArrayIncr; + GLuint ArrayEltFlags; /* precalc'ed for glArrayElt */ + GLuint ArrayEltIncr; GLuint ArrayEltFlush; GLuint FlushElt; - GLuint Primitive[VB_SIZE]; /* GLubyte would do... */ - GLuint NextPrimitive[VB_SIZE]; + GLuint MaxTextureUnits; /* precalc'ed for glMultiTexCoordARB */ - /* allocate storage for these on demand: + /* Temporary values created when vertices are copied into the + * first 3 slots of the struct: */ - struct gl_material (*Material)[2]; - GLuint *MaterialMask; + GLuint CopyOrFlag; + GLuint CopyAndFlag; + GLuint CopyTexSize; + - GLfloat (*TexCoordPtr[MAX_TEXTURE_UNITS])[4]; + /* allocate storage for these on demand: + */ + struct gl_material (*Material)[2]; + GLuint *MaterialMask; + GLfloat *NormalLengths; + GLfloat (*TexCoord[MAX_TEXTURE_UNITS])[4]; - struct vertex_arrays v; + GLuint Primitive[IMM_SIZE]; /* BEGIN/END */ + GLuint PrimitiveLength[IMM_SIZE]; /* BEGIN/END */ + GLuint Flag[IMM_SIZE]; /* VERT_* flags */ + GLchan Color[IMM_SIZE][4]; + GLfloat Obj[IMM_SIZE][4]; + GLfloat Normal[IMM_SIZE][3]; + GLfloat TexCoord0[IMM_SIZE][4]; /* just VERT_TEX0 */ + GLuint Elt[IMM_SIZE]; + GLubyte EdgeFlag[IMM_SIZE]; + GLuint Index[IMM_SIZE]; + GLubyte SecondaryColor[IMM_SIZE][4]; + GLfloat FogCoord[IMM_SIZE]; +}; - struct __GLcontextRec *backref; - /* Normal lengths, zero if not available. - */ - GLfloat *NormalLengths; - GLuint LastCalcedLength; - - GLuint Flag[VB_SIZE]; /* bitwise-OR of VERT_ flags */ - GLchan Color[VB_SIZE][4]; - GLfloat Obj[VB_SIZE][4]; - GLfloat Normal[VB_SIZE][3]; - GLfloat TexCoord[MAX_TEXTURE_UNITS][VB_SIZE][4]; - GLuint Elt[VB_SIZE]; - GLubyte EdgeFlag[VB_SIZE]; - GLuint Index[VB_SIZE]; - GLubyte SecondaryColor[VB_SIZE][4]; - GLfloat FogCoord[VB_SIZE]; +struct vertex_arrays +{ + GLvector4f Obj; + GLvector3f Normal; + GLvector4ub Color; + GLvector1ui Index; + GLvector1ub EdgeFlag; + GLvector4f TexCoord[MAX_TEXTURE_UNITS]; + GLvector1ui Elt; + GLvector4ub SecondaryColor; + GLvector1f FogCoord; }; -/* Not so big on storage these days, although still has pointers to - * arrays used for temporary results. +typedef struct gl_material GLmaterial; + +/* Contains the current state of a running pipeline. */ typedef struct vertex_buffer { - /* Backpointers. + /* Constant over life of the vertex_buffer. */ - struct __GLcontextRec *ctx; - struct tnl_context *tnlctx; + GLuint Size; - /* Driver_data is allocated in Driver.RegisterVB(), if required. + /* Constant over the pipeline. */ - void *driver_data; + GLuint Count; /* for everything except Elts */ + GLuint FirstClipped; /* temp verts for clipping */ + GLuint FirstPrimitive; /* usually zero */ - /* List of operations to process vertices in current state. + /* Pointers to current data. */ - struct gl_pipeline *pipeline; - - /* Temporary storage used by immediate mode functions and various - * operations in the pipeline. + GLuint *Elts; /* VERT_ELT */ + GLvector4f *ObjPtr; /* VERT_OBJ */ + GLvector4f *EyePtr; /* VERT_EYE */ + GLvector4f *ClipPtr; /* VERT_CLIP */ + GLvector4f *ProjectedClipPtr; /* VERT_CLIP (2) */ + GLubyte ClipOrMask; /* VERT_CLIP (3) */ + GLubyte *ClipMask; /* VERT_CLIP (4) */ + GLvector3f *NormalPtr; /* VERT_NORM */ + GLfloat *NormalLengthPtr; /* VERT_NORM (optional) */ + GLvector1ub *EdgeFlagPtr; /* VERT_EDGE */ + GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; /* VERT_TEX_0..n */ + GLvector1ui *IndexPtr[2]; /* VERT_INDEX */ + GLvector4ub *ColorPtr[2]; /* VERT_RGBA */ + GLvector4ub *SecondaryColorPtr[2]; /* VERT_SPEC_RGB */ + GLvector1f *FogCoordPtr; /* VERT_FOG_COORD */ + GLvector1f *PointSizePtr; /* VERT_POINT_SIZE */ + GLmaterial (*Material)[2]; /* VERT_MATERIAL, optional */ + GLuint *MaterialMask; /* VERT_MATERIAL, optional */ + GLuint *Flag; /* VERT_* flags, optional */ + GLuint *Primitive; /* GL_(mode)|PRIM_* flags */ + GLuint *PrimitiveLength; /* integers */ + + + GLuint importable_data; + void (*import_data)( GLcontext *ctx, GLuint flags, GLuint vecflags ); + /* Callback to the provider of the untransformed input for the + * render stage (or other stages) to call if they need to write into + * write-protected arrays, or fixup the stride on input arrays. + * + * This is currently only necessary for client arrays that make it + * as far down the pipeline as the render stage. */ - struct immediate *IM; - struct vertex_array_pointers store; - /* Where to find outstanding untransformed vertices. - */ - struct immediate *prev_buffer; - - GLuint Type; /* Either VB_IMMEDIATE or VB_CVA_PRECALC */ - - GLuint Size, Start, Count; - GLuint Free, FirstFree; - GLuint CopyStart; - GLuint Parity, Ovf; - GLuint PurgeFlags; - GLuint IndirectCount; /* defaults to count */ - GLuint OrFlag, SavedOrFlag; - GLuint Tex3Flag, Tex4Flag; - GLuint SavedTex3Flag, SavedTex4Flag; - GLuint EarlyCull; - GLuint Culled, CullDone; - - /* Pointers to input data - default to buffers in 'im' above. - */ - GLvector4f *ObjPtr; - GLvector3f *NormalPtr; - GLvector4ub *ColorPtr; - GLvector1ui *IndexPtr; - GLvector1ub *EdgeFlagPtr; - GLvector4f *TexCoordPtr[MAX_TEXTURE_UNITS]; - GLvector1ui *EltPtr; - GLvector4ub *SecondaryColorPtr; - GLvector1f *FogCoordPtr; - GLuint *Flag, FlagMax; - struct gl_material (*Material)[2]; - GLuint *MaterialMask; - - GLuint *NextPrimitive; - GLuint *Primitive; - GLuint LastPrimitive; - - GLfloat (*BoundsPtr)[3]; /* Bounds for cull check */ - GLfloat *NormalLengthPtr; /* Array of precomputed inv. normal lengths */ - - /* Holds malloced storage for pipeline data not supplied by - * the immediate struct. - */ - GLvector4f Eye; - GLvector4f Clip; - GLvector4f Win; - GLvector1f PointSize; - GLvector4ub BColor; /* not used in cva vb's */ - GLvector1ui BIndex; /* not used in cva vb's */ - GLvector4ub BSecondary; /* not used in cva vb's */ - - /* Temporary storage - may point into IM, or be dynamically - * allocated (for cva). + GLuint LastClipped; + void *interpfunc; + /* Two pieces of private data from _tnl_render_stage that have no + * business being in this struct. */ - GLubyte *ClipMask; - GLubyte *UserClipMask; - /* Internal values. Where these point depends on whether - * there were any identity matrices defined as transformations - * in the pipeline. - */ - GLvector4f *EyePtr; - GLvector4f *ClipPtr; - GLvector4f *Unprojected; - GLvector4f *Projected; - GLvector4f *CurrentTexCoord; - GLuint *Indirect; /* For eval rescue and cva render */ - - /* Currently active colors - */ - GLvector4ub *Color[2]; - GLvector1ui *Index[2]; - GLvector4ub *SecondaryColor[2]; +} TNLvertexbuffer; - /* Storage for colors which have been lit but not yet fogged. - * Required for CVA, just point into store for normal VB's. - */ - GLvector4ub *LitColor[2]; - GLvector1ui *LitIndex[2]; - GLvector4ub *LitSecondary[2]; - /* Temporary values used in texgen. - */ - GLfloat (*tmp_f)[3]; - GLfloat *tmp_m; - /* Temporary values used in eval. - */ - GLuint *EvaluatedFlags; +/* Describes an individual operation on the pipeline. + */ +struct gl_pipeline_stage { + const char *name; + GLuint check_state; /* All state referenced in check() -- + * When is the pipeline_stage struct + * itself invalidated? Must be + * constant. + */ - /* Not used for cva: + /* Usually constant or set by the 'check' callback: */ - GLubyte *NormCullStart; - GLubyte *CullMask; /* Results of vertex culling */ - GLubyte *NormCullMask; /* Compressed onto shared normals */ - - GLubyte ClipOrMask; /* bitwise-OR of all ClipMask[] values */ - GLubyte ClipAndMask; /* bitwise-AND of all ClipMask[] values */ - GLubyte CullFlag[2]; - GLubyte CullMode; /* see flags below */ - - GLuint CopyCount; /* max 3 vertices to copy after transform */ - GLuint Copy[3]; - GLfloat CopyProj[3][4]; /* temporary store for projected clip coords */ - - /* Hooks for module private data + GLuint run_state; /* All state referenced in run() -- + * When is the cached output of the + * stage invalidated? + */ + + GLboolean active; /* True if runnable in current state */ + GLuint inputs; /* VERT_* inputs to the stage */ + GLuint outputs; /* VERT_* outputs of the stage */ + + /* Set in _tnl_run_pipeline(): */ - void *swsetup_vb; - -} TNLvertexbuffer; - - -typedef void (*shade_func)( struct vertex_buffer *VB ); - -typedef void (*clip_interp_func)( struct vertex_buffer *VB, GLuint dst, - GLfloat t, GLuint in, GLuint out ); - -typedef GLuint (*clip_line_func)( struct vertex_buffer *VB, - GLuint *i, GLuint *j, - GLubyte mask); - -typedef GLuint (*clip_poly_func)( struct vertex_buffer *VB, - GLuint n, GLuint vlist[], - GLubyte mask ); - + GLuint changed_inputs; /* Generated value -- inputs to the + * stage that have changed since last + * call to 'run'. + */ -#define MAX_PIPELINE_STAGES 30 - -#define PIPE_IMMEDIATE 0x1 -#define PIPE_PRECALC 0x2 - -#define PIPE_OP_VERT_XFORM 0x1 -#define PIPE_OP_NORM_XFORM 0x2 -#define PIPE_OP_LIGHT 0x4 -#define PIPE_OP_FOG 0x8 -#define PIPE_OP_TEX 0x10 -#define PIPE_OP_RAST_SETUP_0 0x100 -#define PIPE_OP_RAST_SETUP_1 0x200 -#define PIPE_OP_RENDER 0x400 -#define PIPE_OP_CVA_PREPARE 0x800 -#define PIPE_OP_POINT_SIZE 0x1000 + /* Private data for the pipeline stage: + */ + void *private; + /* Free private data. May not be null. + */ + void (*destroy)( struct gl_pipeline_stage * ); -struct gl_pipeline_stage { - const char *name; - GLuint ops; /* PIPE_OP flags */ - GLuint type; /* VERT flags */ - GLuint special; /* VERT flags - force update_inputs() */ - GLuint state_change; /* state flags - trigger update_inputs() */ - GLuint cva_state_change; /* state flags - recalc cva buffer */ - GLuint elt_forbidden_inputs; /* VERT flags - force a pipeline recalc */ - GLuint pre_forbidden_inputs; /* VERT flags - force a pipeline recalc */ - GLuint active; /* VERT flags */ - GLuint inputs; /* VERT flags */ - GLuint outputs; /* VERT flags */ + /* Called from _tnl_validate_pipeline(). Must update all fields in + * the pipeline_stage struct for the current state. + */ void (*check)( GLcontext *ctx, struct gl_pipeline_stage * ); - void (*run)( struct vertex_buffer *VB ); + + /* Called from _tnl_run_pipeline(). The stage.changed_inputs value + * encodes all inputs to thee struct which have changed. If + * non-zero, recompute all affected outputs of the stage, otherwise + * execute any 'sideeffects' of the stage. + * + * Return value: GL_TRUE - keep going + * GL_FALSE - finished pipeline + */ + GLboolean (*run)( GLcontext *ctx, struct gl_pipeline_stage * ); }; struct gl_pipeline { - GLuint state_change; /* state changes which require recalc */ - GLuint cva_state_change; /* ... which require re-run */ - GLuint forbidden_inputs; /* inputs which require recalc */ - GLuint ops; /* what gets done in this pipe */ - GLuint changed_ops; - GLuint inputs; - GLuint outputs; - GLuint new_inputs; - GLuint new_outputs; - GLuint fallback; - GLuint type; - GLuint pipeline_valid:1; - GLuint data_valid:1; - GLuint copy_transformed_data:1; - GLuint replay_copied_vertices:1; - GLuint new_state; /* state changes since last recalc */ - struct gl_pipeline_stage *stages[MAX_PIPELINE_STAGES]; + GLuint build_state_trigger; /* state changes which require build */ + GLuint build_state_changes; /* state changes since last build */ + GLuint run_state_changes; /* state changes since last run */ + GLuint run_input_changes; /* VERT_* changes since last run */ + GLuint inputs; /* VERT_* inputs to pipeline */ + struct gl_pipeline_stage stages[MAX_PIPELINE_STAGES]; + GLuint nr_stages; }; +struct tnl_eval_store { + GLuint EvalMap1Flags; + GLuint EvalMap2Flags; + GLuint EvalNewState; -/* All fields are derived. - */ -struct gl_cva { - struct gl_pipeline pre; - struct gl_pipeline elt; - - struct gl_client_array Elt; - trans_1ui_func EltFunc; - - struct vertex_buffer *VB; - struct vertex_arrays v; - struct vertex_data store; - - GLuint elt_count; - GLenum elt_mode; - GLuint elt_size; - - GLuint forbidden_inputs; - GLuint orflag; - GLuint merge; - - GLuint locked; - GLuint lock_changed; - GLuint last_orflag; - GLuint last_array_flags; - GLuint last_array_new_state; -}; - -/* These are used to make the ctx->Current values look like - * arrays (with zero StrideB). - */ -struct gl_fallback_arrays { - struct gl_client_array Normal; - struct gl_client_array Color; - struct gl_client_array SecondaryColor; - struct gl_client_array FogCoord; - struct gl_client_array Index; - struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; - struct gl_client_array EdgeFlag; + GLfloat Obj[IMM_SIZE][4]; + GLfloat TexCoord[IMM_SIZE][4]; + GLfloat Normal[IMM_SIZE][3]; + GLchan Color[IMM_SIZE][4]; + GLuint Index[IMM_SIZE]; + GLuint Flag[IMM_SIZE]; + GLuint Elts[IMM_SIZE]; }; +typedef struct { - -typedef void (*texgen_func)( struct vertex_buffer *VB, - GLuint textureSet); - - - -typedef struct tnl_context { - - GLuint _ArrayFlag[VB_SIZE]; /* crock */ - GLuint _ArrayFlags; - GLuint _ArraySummary; /* Like flags, but no size information */ - GLuint _ArrayNewState; /* Tracks which arrays have been changed. */ - GLuint _ArrayTex3Flag; - GLuint _ArrayTex4Flag; - - - /* Pipeline stages - shared between the two pipelines, - * which live in CVA. - */ - struct gl_pipeline_stage PipelineStage[MAX_PIPELINE_STAGES]; - GLuint NrPipelineStages; - - /* Per-texunit derived state. + /* Track whether the module is active. */ - GLuint _TexgenSize[MAX_TEXTURE_UNITS]; - GLuint _TexgenHoles[MAX_TEXTURE_UNITS]; - texgen_func *_TexgenFunc[MAX_TEXTURE_UNITS]; - + GLboolean bound_exec; /* Display list extensions */ GLuint opcode_vertex_cassette; - /* Cva + /* Pipeline */ - struct gl_cva CVA; - GLboolean CompileCVAFlag; + struct gl_pipeline pipeline; + struct vertex_buffer vb; - clip_poly_func *_poly_clip_tab; - clip_line_func *_line_clip_tab; - clip_interp_func _ClipInterpFunc; /* Clip interpolation function */ - normal_func *_NormalTransform; - shade_func *_shade_func_tab; /* Current shading function table */ - - GLenum _CurrentPrimitive; /* Prim or GL_POLYGON+1 */ - GLuint _CurrentTex3Flag; - GLuint _CurrentTex4Flag; + /* GLvectors for binding to vb: + */ + struct vertex_arrays imm_inputs; + struct vertex_arrays array_inputs; + GLuint *tmp_primitive; + GLuint *tmp_primitive_length; - GLboolean _ReplayHardBeginEnd; /* Display list execution of rect, etc */ + /* Set when executing an internally generated immediate. + */ + GLboolean ReplayHardBeginEnd; + GLenum CurrentPrimitive; - GLuint _RenderFlags; /* Active inputs to render stage */ + /* Note which vertices need copying over succesive immediates. + * Will add save versions to precompute vertex copying where + * possible. + */ + struct immediate *ExecCopySource; + GLuint ExecCopyCount; + GLuint ExecCopyElts[IMM_MAX_COPIED_VERTS]; + GLuint ExecCopyTexSize; + GLuint ExecParity; - /* Cache of unused immediate structs */ - struct immediate *freed_im_queue; - GLuint nr_im_queued; + GLuint DlistPrimitive; + GLuint DlistPrimitiveLength; + GLuint DlistLastPrimitive; - struct gl_fallback_arrays Fallback; + /* Derived state and storage for _tnl_eval_vb: + */ + struct tnl_eval_store eval; + /* Functions to be plugged into dispatch when tnl is active. + */ GLvertexformat vtxfmt; } TNLcontext; @@ -598,20 +418,16 @@ typedef struct tnl_context { #define TNL_CONTEXT(ctx) ((TNLcontext *)(ctx->swtnl_context)) #define TNL_CURRENT_IM(ctx) ((struct immediate *)(ctx->swtnl_im)) -#define TNL_VB(ctx) ((struct vertex_buffer *)(ctx->swtnl_vb)) -extern GLboolean _tnl_flush_vertices( GLcontext *ctx, GLuint flush_flags ); +#define TYPE_IDX(t) ((t) & 0xf) +#define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */ -extern void -_tnl_MakeCurrent( GLcontext *ctx, - GLframebuffer *drawBuffer, - GLframebuffer *readBuffer ); +extern void _tnl_MakeCurrent( GLcontext *ctx, + GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ); -extern void -_tnl_LightingSpaceChange( GLcontext *ctx ); - /* * Macros for fetching current input buffer. */ @@ -628,4 +444,5 @@ do { \ } while (0) #endif + #endif diff --git a/src/mesa/tnl/t_eval_api.c b/src/mesa/tnl/t_eval_api.c new file mode 100644 index 00000000000..efe78763337 --- /dev/null +++ b/src/mesa/tnl/t_eval_api.c @@ -0,0 +1,209 @@ +/* $Id: t_eval_api.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "mtypes.h" +#include "math/m_eval.h" + +#include "t_eval_api.h" +#include "t_imm_api.h" +#include "t_imm_alloc.h" +#include "t_imm_exec.h" + + + + + +/* KW: If are compiling, we don't know whether eval will produce a + * vertex when it is run in the future. If this is pure immediate + * mode, eval is a noop if neither vertex map is enabled. + * + * Thus we need to have a check in the display list code or + * elsewhere for eval(1,2) vertices in the case where + * map(1,2)_vertex is disabled, and to purge those vertices from + * the vb. + */ +void +_tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + GLfloat u, du; + GLenum prim; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (mode) { + case GL_POINT: + prim = GL_POINTS; + break; + case GL_LINE: + prim = GL_LINE_STRIP; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glEvalMesh1(mode)" ); + return; + } + + /* No effect if vertex maps disabled. + */ + if (!ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3) + return; + + du = ctx->Eval.MapGrid1du; + u = ctx->Eval.MapGrid1u1 + i1 * du; + + /* Need to turn off compilation -- this is already saved, and the + * coordinates generated and the test above depend on state that + * may change before the list is executed. + * + * TODO: Anaylse display lists to determine if this state is + * constant. + */ + { + GLboolean compiling = ctx->CompileFlag; + struct immediate *im = TNL_CURRENT_IM(ctx); + + if (compiling) { + FLUSH_VERTICES( ctx, 0 ); + SET_IMMEDIATE( ctx, _tnl_alloc_immediate( ctx ) ); + ctx->CompileFlag = GL_FALSE; + } + + _tnl_begin( ctx, prim ); + for (i=i1;i<=i2;i++,u+=du) { + _tnl_eval_coord1f( ctx, u ); + } + _tnl_end(ctx); + + if (compiling) { + FLUSH_VERTICES( ctx, 0 ); + ASSERT( TNL_CURRENT_IM(ctx)->ref_count == 0 ); + _tnl_free_immediate( TNL_CURRENT_IM(ctx) ); + SET_IMMEDIATE( ctx, im ); + ctx->CompileFlag = GL_TRUE; + } + } +} + + + +void +_tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i, j; + GLfloat u, du, v, dv, v1, u1; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + /* No effect if vertex maps disabled. + */ + if (!ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3) + return; + + + du = ctx->Eval.MapGrid2du; + dv = ctx->Eval.MapGrid2dv; + v1 = ctx->Eval.MapGrid2v1 + j1 * dv; + u1 = ctx->Eval.MapGrid2u1 + i1 * du; + + /* Need to turn off compilation -- this is already saved, and the + * coordinates generated and the test above depend on state that + * may change before the list is executed. + */ + { + GLboolean compiling = ctx->CompileFlag; + struct immediate *im = TNL_CURRENT_IM(ctx); + + if (compiling) { + FLUSH_VERTICES( ctx, 0 ); + SET_IMMEDIATE( ctx, _tnl_alloc_immediate( ctx ) ); + ctx->CompileFlag = GL_FALSE; + } + + switch (mode) { + case GL_POINT: + _tnl_begin( ctx, GL_POINTS ); + for (v=v1,j=j1;j<=j2;j++,v+=dv) { + for (u=u1,i=i1;i<=i2;i++,u+=du) { + _tnl_eval_coord2f( ctx, u, v ); + } + } + _tnl_end(ctx); + break; + case GL_LINE: + for (v=v1,j=j1;j<=j2;j++,v+=dv) { + _tnl_begin( ctx, GL_LINE_STRIP ); + for (u=u1,i=i1;i<=i2;i++,u+=du) { + _tnl_eval_coord2f( ctx, u, v ); + } + _tnl_end(ctx); + } + for (u=u1,i=i1;i<=i2;i++,u+=du) { + _tnl_begin( ctx, GL_LINE_STRIP ); + for (v=v1,j=j1;j<=j2;j++,v+=dv) { + _tnl_eval_coord2f( ctx, u, v ); + } + _tnl_end(ctx); + } + break; + case GL_FILL: + for (v=v1,j=j1;jCompileFlag = GL_TRUE; + } + } +} + + + +void _tnl_eval_init( GLcontext *ctx ) +{ + GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->vtxfmt); + vfmt->EvalMesh1 = _tnl_exec_EvalMesh1; + vfmt->EvalMesh2 = _tnl_exec_EvalMesh2; +} diff --git a/src/mesa/tnl/t_eval_api.h b/src/mesa/tnl/t_eval_api.h new file mode 100644 index 00000000000..fab6108c8da --- /dev/null +++ b/src/mesa/tnl/t_eval_api.h @@ -0,0 +1,44 @@ +/* $Id: t_eval_api.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef _T_EVAL_H +#define _T_EVAL_H + + +#include "mtypes.h" +#include "t_context.h" + +/* Use _mesa_save_EvalMesh{1,2} to save these to display lists. + */ +extern void _tnl_exec_EvalMesh1( GLenum mode, GLint i1, GLint i2 ); + +extern void _tnl_exec_EvalMesh2( GLenum mode, GLint i1, GLint i2, + GLint j1, GLint j2 ); + +void _tnl_eval_init( GLcontext *ctx ); + +#endif diff --git a/src/mesa/tnl/t_imm_alloc.c b/src/mesa/tnl/t_imm_alloc.c new file mode 100644 index 00000000000..44e3a598ecb --- /dev/null +++ b/src/mesa/tnl/t_imm_alloc.c @@ -0,0 +1,104 @@ +/* $Id: t_imm_alloc.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell + */ + +#include "glheader.h" +#include "mem.h" +#include "mtypes.h" + +#include "t_imm_alloc.h" + + + +struct immediate *_tnl_alloc_immediate( GLcontext *ctx ) +{ + static int id = 0; + struct immediate *IM = ALIGN_MALLOC_STRUCT( immediate, 32 ); + GLuint j; + + if (!IM) + return 0; + + IM->id = id++; + IM->ref_count = 0; + IM->backref = ctx; + IM->NormalLengths = 0; + IM->FlushElt = 0; + IM->LastPrimitive = IMM_MAX_COPIED_VERTS; + IM->Count = IMM_MAX_COPIED_VERTS; + IM->Start = IMM_MAX_COPIED_VERTS; + IM->Material = 0; + IM->MaterialMask = 0; + IM->MaxTextureUnits = ctx->Const.MaxTextureUnits; + IM->TexSize = 0; + + IM->CopyTexSize = 0; + IM->CopyStart = IM->Start; + + + /* TexCoord0 is special. + */ + IM->TexCoord[0] = IM->TexCoord0; + + for (j = 1; j < ctx->Const.MaxTextureUnits; j++) + IM->TexCoord[j] = ALIGN_MALLOC( IMM_SIZE * sizeof(GLfloat) * 4, 32 ); + + /* KW: Removed initialization of normals as these are now treated + * identically to all other data types. + */ + + MEMSET(IM->Flag, 0, sizeof(IM->Flag)); + + return IM; +} + + +void _tnl_free_immediate( struct immediate *IM ) +{ + GLuint j; + + if (IM->NormalLengths) { + FREE( IM->NormalLengths ); + IM->NormalLengths = 0; + } + + if (IM->Material) { + FREE( IM->Material ); + FREE( IM->MaterialMask ); + IM->Material = 0; + IM->MaterialMask = 0; + + for (j = 1; j < IM->MaxTextureUnits; j++) + ALIGN_FREE( IM->TexCoord[j] ); + } + + ALIGN_FREE( IM ); +} + + + diff --git a/src/mesa/tnl/t_imm_alloc.h b/src/mesa/tnl/t_imm_alloc.h new file mode 100644 index 00000000000..5640f80ceaa --- /dev/null +++ b/src/mesa/tnl/t_imm_alloc.h @@ -0,0 +1,40 @@ +/* $Id: t_imm_alloc.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef _T_IMM_ALLOC_H +#define _T_IMM_ALLOC_H + +#include "mtypes.h" +#include "t_context.h" + + +extern struct immediate *_tnl_alloc_immediate( GLcontext *ctx ); + +extern void _tnl_free_immediate( struct immediate *im ); + + +#endif diff --git a/src/mesa/tnl/t_imm_api.c b/src/mesa/tnl/t_imm_api.c new file mode 100644 index 00000000000..6224bff3cba --- /dev/null +++ b/src/mesa/tnl/t_imm_api.c @@ -0,0 +1,1398 @@ + +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + + + +#include "glheader.h" +#include "context.h" +#include "dlist.h" +#include "enums.h" +#include "light.h" +#include "mem.h" +#include "state.h" +#include "colormac.h" +#include "macros.h" + +#include "t_context.h" +#include "t_imm_api.h" +#include "t_imm_elt.h" +#include "t_imm_exec.h" +#include "t_imm_dlist.h" + + +/* A cassette is full or flushed on a statechange. + */ +void _tnl_flush_immediate( struct immediate *IM ) +{ + GLcontext *ctx = IM->backref; + + if (ctx->CompileFlag) + _tnl_compile_cassette( ctx, IM ); + else + _tnl_execute_cassette( ctx, IM ); +} + + +void _tnl_flush_vertices( GLcontext *ctx, GLuint flags ) +{ + struct immediate *IM = TNL_CURRENT_IM(ctx); + + if (IM->Flag[IM->Start]) + if ((flags & FLUSH_UPDATE_CURRENT) || IM->Count > IM->Start) + _tnl_flush_immediate( IM ); +} + + +void +_tnl_begin( GLcontext *ctx, GLenum p ) +{ + struct immediate *IM = TNL_CURRENT_IM(ctx); + GLuint inflags, state; + + if (MESA_VERBOSE&VERBOSE_API) + fprintf(stderr, "glBegin(IM %d) %s\n", IM->id, gl_lookup_enum_by_nr(p)); + + if (ctx->NewState) + gl_update_state(ctx); + + /* if only a very few slots left, might as well flush now + */ + if (IM->Count > IMM_MAXDATA-8) { + _tnl_flush_immediate( IM ); + IM = TNL_CURRENT_IM(ctx); + } + + /* Check for and flush buffered vertices from internal operations. + */ + if (IM->SavedBeginState) { + _tnl_flush_immediate( IM ); + IM = TNL_CURRENT_IM(ctx); + IM->BeginState = IM->SavedBeginState; + IM->SavedBeginState = 0; + } + + state = IM->BeginState; + inflags = state & (VERT_BEGIN_0|VERT_BEGIN_1); + state |= inflags << 2; /* set error conditions */ + + if (inflags != (VERT_BEGIN_0|VERT_BEGIN_1)) + { + GLuint count = IM->Count; + GLuint last = IM->LastPrimitive; + + ASSERT(IM->Primitive[IM->LastPrimitive] & PRIM_LAST); + + state |= (VERT_BEGIN_0|VERT_BEGIN_1); + IM->Flag[count] |= VERT_BEGIN; + IM->Primitive[IM->LastPrimitive] &= ~PRIM_LAST; + IM->Primitive[count] = p | PRIM_BEGIN | PRIM_LAST; + IM->PrimitiveLength[IM->LastPrimitive] = count - IM->LastPrimitive; + IM->LastPrimitive = count; + + /* Not quite right. Need to use the fallback '_aa_ArrayElement' + * when not known to be inside begin/end and arrays are unlocked. + */ + if (IM->FlushElt) { + _tnl_translate_array_elts( ctx, IM, last, count ); + IM->FlushElt = 0; + } + } + + ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; + IM->BeginState = state; +} + + + +static void +_tnl_Begin( GLenum mode ) +{ + GET_CURRENT_CONTEXT(ctx); + + if (mode > GL_POLYGON) { + _mesa_compile_error( ctx, GL_INVALID_ENUM, "glBegin" ); + return; + } + + _tnl_begin(ctx, mode); + + /* If compiling update SavePrimitive now. + * + * In compile_and_exec mode, exec_primitive will be updated when + * the cassette is finished. + * + * If not compiling, update exec_primitive now. + */ + if (ctx->CompileFlag) { + if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) + ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM; + else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) + ctx->Driver.CurrentSavePrimitive = mode; + } + else if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END) + ctx->Driver.CurrentExecPrimitive = mode; +} + + +GLboolean +_tnl_hard_begin( GLcontext *ctx, GLenum p ) +{ + struct immediate *IM = TNL_CURRENT_IM(ctx); + GLuint count, last; + + if (ctx->NewState) + gl_update_state(ctx); + + /* If not compiling, treat as a normal begin(). + */ + if (!ctx->CompileFlag) { + _tnl_begin( ctx, p ); + return GL_TRUE; + } + + if (IM->Count > IMM_MAXDATA-8) { + _tnl_flush_immediate( IM ); + IM = TNL_CURRENT_IM(ctx); + } + + switch (IM->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1)) { + case VERT_BEGIN_0|VERT_BEGIN_1: + /* In this case we know for sure that the list is going to be + * inside a begin/end object at this point when run. Rather + * than saving the redundant data, compile in an error and + * return. + */ + IM->BeginState |= (VERT_ERROR_1|VERT_ERROR_0); + return GL_FALSE; + + case VERT_BEGIN_0: + case VERT_BEGIN_1: + /* This is a normal (non-hard) immediate, in an unknown + * begin/end state. Assert it is empty and conviert it to a + * 'hard' one. + */ + ASSERT (IM->SavedBeginState == 0); + +/* ASSERT (ctx->Driver.CurrentSavePrimitive >= GL_POLYGON+1); */ + + /* Push current beginstate, to be restored later. Don't worry + * about raising errors. + */ + IM->SavedBeginState = IM->BeginState; + + /* FALLTHROUGH */ + case 0: + + IM->BeginState |= VERT_BEGIN_0|VERT_BEGIN_1; + + + count = IM->Count; + last = IM->LastPrimitive; + + ASSERT(IM->Primitive[IM->LastPrimitive] & PRIM_LAST); + + IM->Flag[count] |= VERT_BEGIN; + IM->Primitive[last] &= ~PRIM_LAST; + IM->Primitive[count] = p | PRIM_BEGIN | PRIM_LAST; + IM->PrimitiveLength[last] = count - last; + IM->LastPrimitive = count; + + ASSERT (!IM->FlushElt); + + /* This is necessary as this immediate will not be flushed in + * _tnl_end() -- we leave it active, hoping to pick up more + * vertices before the next state change. + */ + ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; + return GL_TRUE; + + default: + ASSERT (0); + return GL_TRUE; + } +} + +/* Note the continuation of a partially completed primitive. For + * driver t&l fallbacks between begin/end primitives. Has basically + * the same effects as a primitive wrapping onto a second immediate + * struct. + * + * ==> Can actually call this from _tnl_wakeup_exec, taking mode from + * ctx->Driver.CurrentExecPrimitive. + */ +#if 0 +void _tnl_fallback_begin( GLcontext *ctx, GLenum mode ) +{ + struct immediate *IM = TNL_CURRENT_IM(ctx); + ASSERT( IM->Count == IM->Start ); + ASSERT( IM->Flag[IM->Start] == 0 ); + ASSERT( mode < GL_POLYGON+1 ); + _tnl_begin( ctx, mode ); + IM->Primitive[IM->Start] &= ~PRIM_BEGIN; +} +#endif + + +/* Both streams now outside begin/end. + * + * Leave SavedBeginState untouched -- attempt to gather several + * rects/arrays together in a single immediate struct. + */ +void +_tnl_end( GLcontext *ctx ) +{ + struct immediate *IM = TNL_CURRENT_IM(ctx); + GLuint state = IM->BeginState; + GLuint inflags = (~state) & (VERT_BEGIN_0|VERT_BEGIN_1); + + state |= inflags << 2; /* errors */ + + if (inflags != (VERT_BEGIN_0|VERT_BEGIN_1)) + { + GLuint count = IM->Count; + GLuint last = IM->LastPrimitive; + + ASSERT(IM->Primitive[IM->LastPrimitive] & PRIM_LAST); + + state &= ~(VERT_BEGIN_0|VERT_BEGIN_1); /* update state */ + IM->Flag[count] |= VERT_END; + IM->Primitive[last] |= PRIM_END; + IM->Primitive[last] &= ~PRIM_LAST; + IM->PrimitiveLength[last] = count - last; + IM->Primitive[count] = (GL_POLYGON+1) | PRIM_LAST; + IM->LastPrimitive = count; + + if (IM->FlushElt) { + _tnl_translate_array_elts( ctx, IM, last, count ); + IM->FlushElt = 0; + } + + ctx->Driver.NeedFlush |= FLUSH_STORED_VERTICES; + } + + IM->BeginState = state; + + /* You can set this flag to get the old 'flush_vb on glEnd()' + * behaviour. + */ + if ((MESA_DEBUG_FLAGS&DEBUG_ALWAYS_FLUSH)) + _tnl_flush_immediate( IM ); +} + +static void +_tnl_End(void) +{ + GET_CURRENT_CONTEXT(ctx); + _tnl_end( ctx ); + + /* Need to keep save primitive uptodate in COMPILE and + * COMPILE_AND_EXEC modes, need to keep exec primitive uptodate + * otherwise. + */ + if (ctx->CompileFlag) + ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; + else + ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; + + +} + + +#define COLOR( IM, r, g, b, a ) \ +{ \ + GLuint count = IM->Count; \ + IM->Flag[count] |= VERT_RGBA; \ + IM->Color[count][0] = r; \ + IM->Color[count][1] = g; \ + IM->Color[count][2] = b; \ + IM->Color[count][3] = a; \ +} + +#define COLORV( IM, v ) \ +{ \ + GLuint count = IM->Count; \ + IM->Flag[count] |= VERT_RGBA; \ + COPY_CHAN4(IM->Color[count], v); \ +} + + +static void +_tnl_Color3f( GLfloat red, GLfloat green, GLfloat blue ) +{ +#if CHAN_BITS == 8 + GLubyte col[4]; + GET_IMMEDIATE; + FLOAT_COLOR_TO_UBYTE_COLOR(col[0], red); + FLOAT_COLOR_TO_UBYTE_COLOR(col[1], green); + FLOAT_COLOR_TO_UBYTE_COLOR(col[2], blue); + col[3] = CHAN_MAX; + COLORV( IM, col ); +#else + GET_IMMEDIATE; + COLOR(IM, + UNCLAMPED_FLOAT_TO_CHAN(red), + UNCLAMPED_FLOAT_TO_CHAN(green), + UNCLAMPED_FLOAT_TO_CHAN(blue), + CHAN_MAX); +#endif +} + + +static void +_tnl_Color3ub( GLubyte red, GLubyte green, GLubyte blue ) +{ +#if CHAN_BITS == 8 + GET_IMMEDIATE; + COLOR( IM, red, green, blue, CHAN_MAX ); +#else + GET_IMMEDIATE; + COLOR(IM, + UBYTE_TO_CHAN(red), + UBYTE_TO_CHAN(green), + UBYTE_TO_CHAN(blue), + CHAN_MAX); +#endif +} + + + + +static void +_tnl_Color4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) +{ +#if CHAN_BITS == 8 + GLubyte col[4]; + GET_IMMEDIATE; + FLOAT_COLOR_TO_UBYTE_COLOR(col[0], red); + FLOAT_COLOR_TO_UBYTE_COLOR(col[1], green); + FLOAT_COLOR_TO_UBYTE_COLOR(col[2], blue); + FLOAT_COLOR_TO_UBYTE_COLOR(col[3], alpha); + COLORV( IM, col ); +#else + GET_IMMEDIATE; + COLOR(IM, + UNCLAMPED_FLOAT_TO_CHAN(red), + UNCLAMPED_FLOAT_TO_CHAN(green), + UNCLAMPED_FLOAT_TO_CHAN(blue), + UNCLAMPED_FLOAT_TO_CHAN(alpha)); +#endif +} + +static void +_tnl_Color4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) +{ +#if CHAN_BITS == 8 + GET_IMMEDIATE; + COLOR( IM, red, green, blue, alpha ); +#else + GET_IMMEDIATE; + COLOR(IM, + UBYTE_TO_CHAN(red), + UBYTE_TO_CHAN(green), + UBYTE_TO_CHAN(blue), + UBYTE_TO_CHAN(alpha)); +#endif +} + + +static void +_tnl_Color3fv( const GLfloat *v ) +{ +#if CHAN_BITS == 8 + GLubyte col[4]; + GET_IMMEDIATE; + FLOAT_COLOR_TO_UBYTE_COLOR(col[0], v[0]); + FLOAT_COLOR_TO_UBYTE_COLOR(col[1], v[1]); + FLOAT_COLOR_TO_UBYTE_COLOR(col[2], v[2]); + col[3] = CHAN_MAX; + COLORV( IM, col ); +#else + GET_IMMEDIATE; + COLOR(IM, + UNCLAMPED_FLOAT_TO_CHAN(v[0]), + UNCLAMPED_FLOAT_TO_CHAN(v[1]), + UNCLAMPED_FLOAT_TO_CHAN(v[2]), + CHAN_MAX); + +#endif +} + + + +static void +_tnl_Color3ubv( const GLubyte *v ) +{ +#if CHAN_BITS == 8 + GET_IMMEDIATE; + COLOR( IM, v[0], v[1], v[2], CHAN_MAX ); +#else + GET_IMMEDIATE; + COLOR(IM, + UBYTE_TO_CHAN(v[0]), + UBYTE_TO_CHAN(v[1]), + UBYTE_TO_CHAN(v[2]), + CHAN_MAX); +#endif +} + +static void +_tnl_Color4fv( const GLfloat *v ) +{ +#if CHAN_BITS == 8 + GLubyte col[4]; + GET_IMMEDIATE; + FLOAT_COLOR_TO_UBYTE_COLOR(col[0], v[0]); + FLOAT_COLOR_TO_UBYTE_COLOR(col[1], v[1]); + FLOAT_COLOR_TO_UBYTE_COLOR(col[2], v[2]); + FLOAT_COLOR_TO_UBYTE_COLOR(col[3], v[3]); + COLORV( IM, col ); +#else + GET_IMMEDIATE; + COLOR(IM, + UNCLAMPED_FLOAT_TO_CHAN(v[0]), + UNCLAMPED_FLOAT_TO_CHAN(v[1]), + UNCLAMPED_FLOAT_TO_CHAN(v[2]), + UNCLAMPED_FLOAT_TO_CHAN(v[3])); +#endif +} + + + +static void +_tnl_Color4ubv( const GLubyte *v) +{ +#if CHAN_BITS == 8 + GET_IMMEDIATE; + COLORV( IM, v ); +#else + GET_IMMEDIATE; + COLOR(IM, + UBYTE_TO_CHAN(v[0]), + UBYTE_TO_CHAN(v[1]), + UBYTE_TO_CHAN(v[2]), + UBYTE_TO_CHAN(v[3])); +#endif +} + + + + +#define SECONDARY_COLOR( IM, r, g, b ) \ +{ \ + GLuint count = IM->Count; \ + IM->Flag[count] |= VERT_SPEC_RGB; \ + IM->SecondaryColor[count][0] = r; \ + IM->SecondaryColor[count][1] = g; \ + IM->SecondaryColor[count][2] = b; \ +} + +#define SECONDARY_COLORV( IM, v ) \ +{ \ + GLuint count = IM->Count; \ + IM->Flag[count] |= VERT_SPEC_RGB; \ + IM->SecondaryColor[count][0] = v[0]; \ + IM->SecondaryColor[count][1] = v[1]; \ + IM->SecondaryColor[count][2] = v[2]; \ +} + + + + +static void +_tnl_SecondaryColor3fEXT( GLfloat red, GLfloat green, GLfloat blue ) +{ +#if CHAN_BITS == 8 + GLubyte col[3]; + GET_IMMEDIATE; + FLOAT_COLOR_TO_UBYTE_COLOR(col[0], red); + FLOAT_COLOR_TO_UBYTE_COLOR(col[1], green); + FLOAT_COLOR_TO_UBYTE_COLOR(col[2], blue); + SECONDARY_COLORV( IM, col ); +#else + GET_IMMEDIATE; + SECONDARY_COLOR(IM, + UNCLAMPED_FLOAT_TO_CHAN(red), + UNCLAMPED_FLOAT_TO_CHAN(green), + UNCLAMPED_FLOAT_TO_CHAN(blue)); +#endif +} + + + +static void +_tnl_SecondaryColor3ubEXT( GLubyte red, GLubyte green, GLubyte blue ) +{ +#if CHAN_BITS == 8 + GET_IMMEDIATE; + SECONDARY_COLOR( IM, red, green, blue ); +#else + GET_IMMEDIATE; + SECONDARY_COLOR(IM, + UBYTE_TO_CHAN(red), + UBYTE_TO_CHAN(green), + UBYTE_TO_CHAN(blue)); +#endif +} + + + + +static void +_tnl_SecondaryColor3fvEXT( const GLfloat *v ) +{ +#if CHAN_BITS == 8 + GLubyte col[3]; + GET_IMMEDIATE; + FLOAT_COLOR_TO_UBYTE_COLOR(col[0], v[0]); + FLOAT_COLOR_TO_UBYTE_COLOR(col[1], v[1]); + FLOAT_COLOR_TO_UBYTE_COLOR(col[2], v[2]); + SECONDARY_COLORV( IM, col ); +#else + GET_IMMEDIATE; + SECONDARY_COLOR(IM, + UNCLAMPED_FLOAT_TO_CHAN(v[0]), + UNCLAMPED_FLOAT_TO_CHAN(v[1]), + UNCLAMPED_FLOAT_TO_CHAN(v[2])); +#endif +} + + + +static void +_tnl_SecondaryColor3ubvEXT( const GLubyte *v ) +{ +#if CHAN_BITS == 8 + GET_IMMEDIATE; + SECONDARY_COLOR( IM, v[0], v[1], v[2] ); +#else + GET_IMMEDIATE; + SECONDARY_COLOR(IM, + UBYTE_TO_CHAN(v[0]), + UBYTE_TO_CHAN(v[1]), + UBYTE_TO_CHAN(v[2])); +#endif +} + + + + +static void +_tnl_EdgeFlag( GLboolean flag ) +{ + GLuint count; + GET_IMMEDIATE; + count = IM->Count; + IM->EdgeFlag[count] = flag; + IM->Flag[count] |= VERT_EDGE; +} + + +static void +_tnl_EdgeFlagv( const GLboolean *flag ) +{ + GLuint count; + GET_IMMEDIATE; + count = IM->Count; + IM->EdgeFlag[count] = *flag; + IM->Flag[count] |= VERT_EDGE; +} + + +static void +_tnl_FogCoordfEXT( GLfloat f ) +{ + GLuint count; + GET_IMMEDIATE; + count = IM->Count; + IM->FogCoord[count] = f; + IM->Flag[count] |= VERT_FOG_COORD; +} + +static void +_tnl_FogCoordfvEXT( const GLfloat *v ) +{ + GLuint count; + GET_IMMEDIATE; + count = IM->Count; + IM->FogCoord[count] = v[0]; + IM->Flag[count] |= VERT_FOG_COORD; +} + + +static void +_tnl_Indexi( GLint c ) +{ + GLuint count; + GET_IMMEDIATE; + count = IM->Count; + IM->Index[count] = c; + IM->Flag[count] |= VERT_INDEX; +} + + +static void +_tnl_Indexiv( const GLint *c ) +{ + GLuint count; + GET_IMMEDIATE; + count = IM->Count; + IM->Index[count] = *c; + IM->Flag[count] |= VERT_INDEX; +} + + +#define NORMAL( x, y, z ) \ +{ \ + GLuint count; \ + GLfloat *normal; \ + GET_IMMEDIATE; \ + count = IM->Count; \ + IM->Flag[count] |= VERT_NORM; \ + normal = IM->Normal[count]; \ + ASSIGN_3V(normal, x,y,z); \ +} + +#if defined(USE_IEEE) +#define NORMALF( x, y, z ) \ +{ \ + GLuint count; \ + GLint *normal; \ + GET_IMMEDIATE; \ + count = IM->Count; \ + IM->Flag[count] |= VERT_NORM; \ + normal = (GLint *)IM->Normal[count]; \ + ASSIGN_3V(normal, *(int*)&(x), *(int*)&(y), *(int*)&(z)); \ +} +#else +#define NORMALF NORMAL +#endif + +static void +_tnl_Normal3f( GLfloat nx, GLfloat ny, GLfloat nz ) +{ + NORMALF(nx, ny, nz); +} + + +static void +_tnl_Normal3fv( const GLfloat *v ) +{ + NORMALF( v[0], v[1], v[2] ); +} + + + +#define TEXCOORD1(s) \ +{ \ + GLuint count; \ + GLfloat *tc; \ + GET_IMMEDIATE; \ + count = IM->Count; \ + IM->Flag[count] |= VERT_TEX0; \ + tc = IM->TexCoord0[count]; \ + ASSIGN_4V(tc,s,0,0,1); \ +} + +#define TEXCOORD2(s,t) \ +{ \ + GLuint count; \ + GLfloat *tc; \ + GET_IMMEDIATE; \ + count = IM->Count; \ + IM->Flag[count] |= VERT_TEX0; \ + tc = IM->TexCoord0[count]; \ + ASSIGN_4V(tc, s,t,0,1); \ +} + +#define TEXCOORD3(s,t,u) \ +{ \ + GLuint count; \ + GLfloat *tc; \ + GET_IMMEDIATE; \ + count = IM->Count; \ + IM->Flag[count] |= VERT_TEX0; \ + IM->TexSize |= TEX_0_SIZE_3; \ + tc = IM->TexCoord0[count]; \ + ASSIGN_4V(tc, s,t,u,1); \ +} + +#define TEXCOORD4(s,t,u,v) \ +{ \ + GLuint count; \ + GLfloat *tc; \ + GET_IMMEDIATE; \ + count = IM->Count; \ + IM->Flag[count] |= VERT_TEX0; \ + IM->TexSize |= TEX_0_SIZE_4; \ + tc = IM->TexCoord0[count]; \ + ASSIGN_4V(tc, s,t,u,v); \ +} + +#if defined(USE_IEEE) +#define TEXCOORD2F(s,t) \ +{ \ + GLuint count; \ + GLint *tc; \ + GET_IMMEDIATE; \ + count = IM->Count; \ + IM->Flag[count] |= VERT_TEX0; \ + tc = (GLint *)IM->TexCoord0[count]; \ + tc[0] = *(GLint *)&(s); \ + tc[1] = *(GLint *)&(t); \ + tc[2] = 0; \ + tc[3] = IEEE_ONE; \ +} +#else +#define TEXCOORD2F TEXCOORD2 +#endif + +static void +_tnl_TexCoord1f( GLfloat s ) +{ + TEXCOORD1(s); +} + + +static void +_tnl_TexCoord2f( GLfloat s, GLfloat t ) +{ + TEXCOORD2F(s,t); +} + + +static void +_tnl_TexCoord3f( GLfloat s, GLfloat t, GLfloat r ) +{ + TEXCOORD3(s,t,r); +} + +static void +_tnl_TexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) +{ + TEXCOORD4(s,t,r,q) +} + +static void +_tnl_TexCoord1fv( const GLfloat *v ) +{ + TEXCOORD1(v[0]); +} + +static void +_tnl_TexCoord2fv( const GLfloat *v ) +{ + TEXCOORD2F(v[0],v[1]); +} + +static void +_tnl_TexCoord3fv( const GLfloat *v ) +{ + TEXCOORD3(v[0],v[1],v[2]); +} + +static void +_tnl_TexCoord4fv( const GLfloat *v ) +{ + TEXCOORD4(v[0],v[1],v[2],v[3]); +} + + + +/* KW: Run into bad problems in vertex copying if we don't fully pad + * the incoming vertices. + */ +#define VERTEX2(IM, x,y) \ +{ \ + GLuint count = IM->Count++; \ + GLfloat *dest = IM->Obj[count]; \ + IM->Flag[count] |= VERT_OBJ; \ + ASSIGN_4V(dest, x, y, 0, 1); \ +/* ASSERT(IM->Flag[IM->Count]==0); */\ + if (count == IMM_MAXDATA - 1) \ + _tnl_flush_immediate( IM ); \ +} + +#define VERTEX3(IM,x,y,z) \ +{ \ + GLuint count = IM->Count++; \ + GLfloat *dest = IM->Obj[count]; \ + IM->Flag[count] |= VERT_OBJ_23; \ + ASSIGN_4V(dest, x, y, z, 1); \ +/* ASSERT(IM->Flag[IM->Count]==0); */ \ + if (count == IMM_MAXDATA - 1) \ + _tnl_flush_immediate( IM ); \ +} + +#define VERTEX4(IM, x,y,z,w) \ +{ \ + GLuint count = IM->Count++; \ + GLfloat *dest = IM->Obj[count]; \ + IM->Flag[count] |= VERT_OBJ_234; \ + ASSIGN_4V(dest, x, y, z, w); \ + if (count == IMM_MAXDATA - 1) \ + _tnl_flush_immediate( IM ); \ +} + +#if defined(USE_IEEE) +#define VERTEX2F(IM, x, y) \ +{ \ + GLuint count = IM->Count++; \ + GLint *dest = (GLint *)IM->Obj[count]; \ + IM->Flag[count] |= VERT_OBJ; \ + dest[0] = *(GLint *)&(x); \ + dest[1] = *(GLint *)&(y); \ + dest[2] = 0; \ + dest[3] = IEEE_ONE; \ +/* ASSERT(IM->Flag[IM->Count]==0); */ \ + if (count == IMM_MAXDATA - 1) \ + _tnl_flush_immediate( IM ); \ +} +#else +#define VERTEX2F VERTEX2 +#endif + +#if defined(USE_IEEE) +#define VERTEX3F(IM, x, y, z) \ +{ \ + GLuint count = IM->Count++; \ + GLint *dest = (GLint *)IM->Obj[count]; \ + IM->Flag[count] |= VERT_OBJ_23; \ + dest[0] = *(GLint *)&(x); \ + dest[1] = *(GLint *)&(y); \ + dest[2] = *(GLint *)&(z); \ + dest[3] = IEEE_ONE; \ +/* ASSERT(IM->Flag[IM->Count]==0); */ \ + if (count == IMM_MAXDATA - 1) \ + _tnl_flush_immediate( IM ); \ +} +#else +#define VERTEX3F VERTEX3 +#endif + +#if defined(USE_IEEE) +#define VERTEX4F(IM, x, y, z, w) \ +{ \ + GLuint count = IM->Count++; \ + GLint *dest = (GLint *)IM->Obj[count]; \ + IM->Flag[count] |= VERT_OBJ_234; \ + dest[0] = *(GLint *)&(x); \ + dest[1] = *(GLint *)&(y); \ + dest[2] = *(GLint *)&(z); \ + dest[3] = *(GLint *)&(w); \ + if (count == IMM_MAXDATA - 1) \ + _tnl_flush_immediate( IM ); \ +} +#else +#define VERTEX4F VERTEX4 +#endif + + + +static void +_tnl_Vertex2f( GLfloat x, GLfloat y ) +{ + GET_IMMEDIATE; + VERTEX2F( IM, x, y ); +} + +static void +_tnl_Vertex3f( GLfloat x, GLfloat y, GLfloat z ) +{ + GET_IMMEDIATE; + VERTEX3F( IM, x, y, z ); +} +static void +_tnl_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +{ + GET_IMMEDIATE; + VERTEX4F( IM, x, y, z, w ); +} + +static void +_tnl_Vertex2fv( const GLfloat *v ) +{ + GET_IMMEDIATE; + VERTEX2F( IM, v[0], v[1] ); +} + +static void +_tnl_Vertex3fv( const GLfloat *v ) +{ + GET_IMMEDIATE; + VERTEX3F( IM, v[0], v[1], v[2] ); +} + +static void +_tnl_Vertex4fv( const GLfloat *v ) +{ + GET_IMMEDIATE; + VERTEX4F( IM, v[0], v[1], v[2], v[3] ); +} + + + + +/* + * GL_ARB_multitexture + * + * Note: the multitexture spec says that specifying an invalid target + * has undefined results and does not have to generate an error. Just + * don't crash. We no-op on invalid targets. + */ + +#define MAX_TARGET (GL_TEXTURE0_ARB + MAX_TEXTURE_UNITS) + +#define MULTI_TEXCOORD1(target, s) \ +{ \ + GET_IMMEDIATE; \ + GLuint texunit = target - GL_TEXTURE0_ARB; \ + if (texunit < IM->MaxTextureUnits) { \ + GLuint count = IM->Count; \ + GLfloat *tc = IM->TexCoord[texunit][count]; \ + ASSIGN_4V(tc, s, 0.0F, 0.0F, 1.0F); \ + IM->Flag[count] |= VERT_TEX(texunit); \ + } \ +} + +#define MULTI_TEXCOORD2(target, s, t) \ +{ \ + GET_IMMEDIATE; \ + GLuint texunit = target - GL_TEXTURE0_ARB; \ + if (texunit < IM->MaxTextureUnits) { \ + GLuint count = IM->Count; \ + GLfloat *tc = IM->TexCoord[texunit][count]; \ + ASSIGN_4V(tc, s, t, 0.0F, 1.0F); \ + IM->Flag[count] |= VERT_TEX(texunit); \ + } \ +} + +#define MULTI_TEXCOORD3(target, s, t, u) \ +{ \ + GET_IMMEDIATE; \ + GLuint texunit = target - GL_TEXTURE0_ARB; \ + if (texunit < IM->MaxTextureUnits) { \ + GLuint count = IM->Count; \ + GLfloat *tc = IM->TexCoord[texunit][count]; \ + ASSIGN_4V(tc, s, t, u, 1.0F); \ + IM->Flag[count] |= VERT_TEX(texunit); \ + IM->TexSize |= TEX_SIZE_3(texunit); \ + } \ +} + +#define MULTI_TEXCOORD4(target, s, t, u, v) \ +{ \ + GET_IMMEDIATE; \ + GLuint texunit = target - GL_TEXTURE0_ARB; \ + if (texunit < IM->MaxTextureUnits) { \ + GLuint count = IM->Count; \ + GLfloat *tc = IM->TexCoord[texunit][count]; \ + ASSIGN_4V(tc, s, t, u, v); \ + IM->Flag[count] |= VERT_TEX(texunit); \ + IM->TexSize |= TEX_SIZE_4(texunit); \ + } \ +} + +#if defined(USE_IEEE) +#define MULTI_TEXCOORD2F(target, s, t) \ +{ \ + GET_IMMEDIATE; \ + GLuint texunit = target - GL_TEXTURE0_ARB; \ + if (texunit < IM->MaxTextureUnits) { \ + GLuint count = IM->Count; \ + GLint *tc = (GLint *)IM->TexCoord[texunit][count]; \ + IM->Flag[count] |= VERT_TEX(texunit); \ + tc[0] = *(int *)&(s); \ + tc[1] = *(int *)&(t); \ + tc[2] = 0; \ + tc[3] = IEEE_ONE; \ + } \ +} +#else +#define MULTI_TEXCOORD2F MULTI_TEXCOORD2 +#endif + +static void +_tnl_MultiTexCoord1fARB(GLenum target, GLfloat s) +{ + MULTI_TEXCOORD1( target, s ); +} + +static void +_tnl_MultiTexCoord1fvARB(GLenum target, const GLfloat *v) +{ + MULTI_TEXCOORD1( target, v[0] ); +} + +static void +_tnl_MultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) +{ + MULTI_TEXCOORD2F( target, s, t ); +} + +static void +_tnl_MultiTexCoord2fvARB(GLenum target, const GLfloat *v) +{ + MULTI_TEXCOORD2F( target, v[0], v[1] ); +} + +static void +_tnl_MultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r) +{ + MULTI_TEXCOORD3( target, s, t, r ); +} + +static void +_tnl_MultiTexCoord3fvARB(GLenum target, const GLfloat *v) +{ + MULTI_TEXCOORD3( target, v[0], v[1], v[2] ); +} + +static void +_tnl_MultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + MULTI_TEXCOORD4( target, s, t, r, q ); +} + +static void +_tnl_MultiTexCoord4fvARB(GLenum target, const GLfloat *v) +{ + MULTI_TEXCOORD4( target, v[0], v[1], v[2], v[3] ); +} + + + +/* KW: Because the eval values don't become 'current', fixup will flow + * through these vertices, and then evaluation will write on top + * of the fixup results. + * + * Note: using Obj to hold eval coord data. + */ +#define EVALCOORD1(IM, x) \ +{ \ + GLuint count = IM->Count++; \ + IM->Flag[count] |= VERT_EVAL_C1; \ + ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \ + if (count == IMM_MAXDATA-1) \ + _tnl_flush_immediate( IM ); \ +} + +#define EVALCOORD2(IM, x, y) \ +{ \ + GLuint count = IM->Count++; \ + IM->Flag[count] |= VERT_EVAL_C2; \ + ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \ + if (count == IMM_MAXDATA-1) \ + _tnl_flush_immediate( IM ); \ +} + +#define EVALPOINT1(IM, x) \ +{ \ + GLuint count = IM->Count++; \ + IM->Flag[count] |= VERT_EVAL_P1; \ + ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \ + if (count == IMM_MAXDATA-1) \ + _tnl_flush_immediate( IM ); \ +} + +#define EVALPOINT2(IM, x, y) \ +{ \ + GLuint count = IM->Count++; \ + IM->Flag[count] |= VERT_EVAL_P2; \ + ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \ + if (count == IMM_MAXDATA-1) \ + _tnl_flush_immediate( IM ); \ +} + +static void +_tnl_EvalCoord1f( GLfloat u ) +{ + GET_IMMEDIATE; + EVALCOORD1( IM, u ); +} + +static void +_tnl_EvalCoord1fv( const GLfloat *u ) +{ + GET_IMMEDIATE; + EVALCOORD1( IM, (GLfloat) *u ); +} + +static void +_tnl_EvalCoord2f( GLfloat u, GLfloat v ) +{ + GET_IMMEDIATE; + EVALCOORD2( IM, u, v ); +} + +static void +_tnl_EvalCoord2fv( const GLfloat *u ) +{ + GET_IMMEDIATE; + EVALCOORD2( IM, u[0], u[1] ); +} + + +static void +_tnl_EvalPoint1( GLint i ) +{ + GET_IMMEDIATE; + EVALPOINT1( IM, i ); +} + + +static void +_tnl_EvalPoint2( GLint i, GLint j ) +{ + GET_IMMEDIATE; + EVALPOINT2( IM, i, j ); +} + + +/* Need to use the default array-elt outside begin/end for strict + * conformance. + */ +#define ARRAY_ELT( IM, i ) \ +{ \ + GLuint count = IM->Count; \ + IM->Elt[count] = i; \ + IM->Flag[count] &= IM->ArrayEltFlags; \ + IM->Flag[count] |= VERT_ELT; \ + IM->FlushElt |= IM->ArrayEltFlush; \ + IM->Count += IM->ArrayEltIncr; \ + if (IM->Count == IMM_MAXDATA) \ + _tnl_flush_immediate( IM ); \ +} + + +static void +_tnl_ArrayElement( GLint i ) +{ + GET_IMMEDIATE; + ARRAY_ELT( IM, i ); +} + + +/* Internal functions. These are safe to use providing either: + * + * - It is determined that a display list is not being compiled, or + * if so that these commands won't be compiled into the list (see + * t_eval.c for an example). + * + * - _tnl_hard_begin() is used instead of _tnl_[bB]egin, and tested + * for a GL_TRUE return value. See _tnl_Rectf, below. + */ +void +_tnl_eval_coord1f( GLcontext *CC, GLfloat u ) +{ + struct immediate *i = TNL_CURRENT_IM(CC); + EVALCOORD1( i, u ); +} + +void +_tnl_eval_coord2f( GLcontext *CC, GLfloat u, GLfloat v ) +{ + struct immediate *i = TNL_CURRENT_IM(CC); + EVALCOORD2( i, u, v ); +} + +void +_tnl_array_element( GLcontext *CC, GLint i ) +{ + struct immediate *im = TNL_CURRENT_IM(CC); + ARRAY_ELT( im, i ); +} + +void +_tnl_vertex2f( GLcontext *ctx, GLfloat x, GLfloat y ) +{ + struct immediate *im = TNL_CURRENT_IM(ctx); + VERTEX2( im, x, y ); +} + + + + + +/* Execute a glRectf() function. _tnl_hard_begin() ensures the check + * on outside_begin_end is executed even in compiled lists. These + * vertices can now participate in the same VB as regular ones, even + * in most display lists. + */ +static void +_tnl_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) +{ + GET_CURRENT_CONTEXT(ctx); + + if (_tnl_hard_begin( ctx, GL_QUADS )) { + _tnl_vertex2f( ctx, x1, y1 ); + _tnl_vertex2f( ctx, x2, y1 ); + _tnl_vertex2f( ctx, x2, y2 ); + _tnl_vertex2f( ctx, x1, y2 ); + _tnl_end( ctx ); + } +} + +static void +_tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params ) +{ + GET_CURRENT_CONTEXT(ctx); + struct immediate *IM = TNL_CURRENT_IM(ctx); + GLuint count = IM->Count; + struct gl_material *mat; + GLuint bitmask = gl_material_bitmask( ctx, face, pname, ~0, "Materialfv" ); + + if (bitmask == 0) + return; + + if (!IM->Material) { + IM->Material = (GLmaterial (*)[2]) MALLOC( sizeof(GLmaterial) * + IMM_SIZE * 2 ); + IM->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE ); + } + + if (!(IM->Flag[count] & VERT_MATERIAL)) { + IM->Flag[count] |= VERT_MATERIAL; + IM->MaterialMask[count] = 0; + } + + IM->MaterialMask[count] |= bitmask; + mat = IM->Material[count]; + + if (bitmask & FRONT_AMBIENT_BIT) { + COPY_4FV( mat[0].Ambient, params ); + } + if (bitmask & BACK_AMBIENT_BIT) { + COPY_4FV( mat[1].Ambient, params ); + } + if (bitmask & FRONT_DIFFUSE_BIT) { + COPY_4FV( mat[0].Diffuse, params ); + } + if (bitmask & BACK_DIFFUSE_BIT) { + COPY_4FV( mat[1].Diffuse, params ); + } + if (bitmask & FRONT_SPECULAR_BIT) { + COPY_4FV( mat[0].Specular, params ); + } + if (bitmask & BACK_SPECULAR_BIT) { + COPY_4FV( mat[1].Specular, params ); + } + if (bitmask & FRONT_EMISSION_BIT) { + COPY_4FV( mat[0].Emission, params ); + } + if (bitmask & BACK_EMISSION_BIT) { + COPY_4FV( mat[1].Emission, params ); + } + if (bitmask & FRONT_SHININESS_BIT) { + GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F ); + mat[0].Shininess = shininess; + } + if (bitmask & BACK_SHININESS_BIT) { + GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F ); + mat[1].Shininess = shininess; + } + if (bitmask & FRONT_INDEXES_BIT) { + mat[0].AmbientIndex = params[0]; + mat[0].DiffuseIndex = params[1]; + mat[0].SpecularIndex = params[2]; + } + if (bitmask & BACK_INDEXES_BIT) { + mat[1].AmbientIndex = params[0]; + mat[1].DiffuseIndex = params[1]; + mat[1].SpecularIndex = params[2]; + } +} + +void _tnl_imm_vtxfmt_init( GLcontext *ctx ) +{ + GLvertexformat *vfmt = &(TNL_CONTEXT(ctx)->vtxfmt); + + /* All begin/end operations are handled by this vertex format: + */ + vfmt->ArrayElement = _tnl_ArrayElement; + vfmt->Begin = _tnl_Begin; + vfmt->Color3f = _tnl_Color3f; + vfmt->Color3fv = _tnl_Color3fv; + vfmt->Color3ub = _tnl_Color3ub; + vfmt->Color3ubv = _tnl_Color3ubv; + vfmt->Color4f = _tnl_Color4f; + vfmt->Color4fv = _tnl_Color4fv; + vfmt->Color4ub = _tnl_Color4ub; + vfmt->Color4ubv = _tnl_Color4ubv; + vfmt->EdgeFlag = _tnl_EdgeFlag; + vfmt->EdgeFlagv = _tnl_EdgeFlagv; + vfmt->End = _tnl_End; + vfmt->EvalCoord1f = _tnl_EvalCoord1f; + vfmt->EvalCoord1fv = _tnl_EvalCoord1fv; + vfmt->EvalCoord2f = _tnl_EvalCoord2f; + vfmt->EvalCoord2fv = _tnl_EvalCoord2fv; + vfmt->EvalPoint1 = _tnl_EvalPoint1; + vfmt->EvalPoint2 = _tnl_EvalPoint2; + vfmt->FogCoordfEXT = _tnl_FogCoordfEXT; + vfmt->FogCoordfvEXT = _tnl_FogCoordfvEXT; + vfmt->Indexi = _tnl_Indexi; + vfmt->Indexiv = _tnl_Indexiv; + vfmt->Materialfv = _tnl_Materialfv; + vfmt->MultiTexCoord1fARB = _tnl_MultiTexCoord1fARB; + vfmt->MultiTexCoord1fvARB = _tnl_MultiTexCoord1fvARB; + vfmt->MultiTexCoord2fARB = _tnl_MultiTexCoord2fARB; + vfmt->MultiTexCoord2fvARB = _tnl_MultiTexCoord2fvARB; + vfmt->MultiTexCoord3fARB = _tnl_MultiTexCoord3fARB; + vfmt->MultiTexCoord3fvARB = _tnl_MultiTexCoord3fvARB; + vfmt->MultiTexCoord4fARB = _tnl_MultiTexCoord4fARB; + vfmt->MultiTexCoord4fvARB = _tnl_MultiTexCoord4fvARB; + vfmt->Normal3f = _tnl_Normal3f; + vfmt->Normal3fv = _tnl_Normal3fv; + vfmt->SecondaryColor3fEXT = _tnl_SecondaryColor3fEXT; + vfmt->SecondaryColor3fvEXT = _tnl_SecondaryColor3fvEXT; + vfmt->SecondaryColor3ubEXT = _tnl_SecondaryColor3ubEXT; + vfmt->SecondaryColor3ubvEXT = _tnl_SecondaryColor3ubvEXT; + vfmt->TexCoord1f = _tnl_TexCoord1f; + vfmt->TexCoord1fv = _tnl_TexCoord1fv; + vfmt->TexCoord2f = _tnl_TexCoord2f; + vfmt->TexCoord2fv = _tnl_TexCoord2fv; + vfmt->TexCoord3f = _tnl_TexCoord3f; + vfmt->TexCoord3fv = _tnl_TexCoord3fv; + vfmt->TexCoord4f = _tnl_TexCoord4f; + vfmt->TexCoord4fv = _tnl_TexCoord4fv; + vfmt->Vertex2f = _tnl_Vertex2f; + vfmt->Vertex2fv = _tnl_Vertex2fv; + vfmt->Vertex3f = _tnl_Vertex3f; + vfmt->Vertex3fv = _tnl_Vertex3fv; + vfmt->Vertex4f = _tnl_Vertex4f; + vfmt->Vertex4fv = _tnl_Vertex4fv; + + /* Outside begin/end functions (from t_varray.c, t_eval.c, ...): + */ + vfmt->Rectf = _tnl_Rectf; + + /* Just use the core function: + */ + vfmt->CallList = _mesa_CallList; + + vfmt->prefer_float_colors = GL_FALSE; +} diff --git a/src/mesa/tnl/t_imm_api.h b/src/mesa/tnl/t_imm_api.h new file mode 100644 index 00000000000..8e4c9943d21 --- /dev/null +++ b/src/mesa/tnl/t_imm_api.h @@ -0,0 +1,50 @@ +/* $Id: t_imm_api.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef _T_VTXFMT_H +#define _T_VTXFMT_H + +#include "mtypes.h" +#include "t_context.h" + + +/* TNL-private internal functions for building higher-level operations: + */ +extern void _tnl_begin( GLcontext *ctx, GLenum p ); +extern GLboolean _tnl_hard_begin( GLcontext *ctx, GLenum p ); +extern void _tnl_end( GLcontext *ctx ); +extern void _tnl_vertex2f( GLcontext *ctx, GLfloat x, GLfloat y ); +extern void _tnl_eval_coord1f( GLcontext *CC, GLfloat u ); +extern void _tnl_eval_coord2f( GLcontext *CC, GLfloat u, GLfloat v ); +extern void _tnl_array_element( GLcontext *CC, GLint i ); + +/* Initialize our part of the vtxfmt struct: + */ +extern void _tnl_imm_vtxfmt_init( GLcontext *ctx ); + + +#endif diff --git a/src/mesa/tnl/t_imm_debug.c b/src/mesa/tnl/t_imm_debug.c new file mode 100644 index 00000000000..192259afcda --- /dev/null +++ b/src/mesa/tnl/t_imm_debug.c @@ -0,0 +1,169 @@ +/* $Id: t_imm_debug.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "mtypes.h" +#include "t_context.h" +#include "t_imm_debug.h" + +void _tnl_print_vert_flags( const char *name, GLuint flags ) +{ + fprintf(stderr, + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + name, + flags, + (flags & VERT_CLIP) ? "clip/proj-clip/glend, " : "", + (flags & VERT_EDGE) ? "edgeflag, " : "", + (flags & VERT_ELT) ? "array-elt, " : "", + (flags & VERT_END_VB) ? "end-vb, " : "", + (flags & VERT_EVAL_ANY) ? "eval-coord, " : "", + (flags & VERT_EYE) ? "eye/glbegin, " : "", + (flags & VERT_FOG_COORD) ? "fog-coord, " : "", + (flags & VERT_INDEX) ? "index, " : "", + (flags & VERT_MATERIAL) ? "material, " : "", + (flags & VERT_NORM) ? "normals, " : "", + (flags & VERT_OBJ) ? "obj, " : "", + (flags & VERT_OBJ_3) ? "obj-3, " : "", + (flags & VERT_OBJ_4) ? "obj-4, " : "", + (flags & VERT_POINT_SIZE) ? "point-size, " : "", + (flags & VERT_RGBA) ? "colors, " : "", + (flags & VERT_SPEC_RGB) ? "specular, " : "", + (flags & VERT_TEX0) ? "texcoord0, " : "", + (flags & VERT_TEX1) ? "texcoord1, " : "", + (flags & VERT_TEX2) ? "texcoord2, " : "", + (flags & VERT_TEX3) ? "texcoord3, " : "", + (flags & VERT_TEX4) ? "texcoord4, " : "", + (flags & VERT_TEX5) ? "texcoord5, " : "", + (flags & VERT_TEX6) ? "texcoord6, " : "", + (flags & VERT_TEX7) ? "texcoord7, " : "" + ); +} + +void _tnl_print_cassette( struct immediate *IM ) +{ + GLuint i; + GLuint *flags = IM->Flag; + GLuint andflag = IM->CopyAndFlag; + GLuint orflag = IM->CopyOrFlag; + GLuint state = IM->BeginState; + GLuint req = ~0; + + fprintf(stderr, "Cassette id %d, %u rows.\n", IM->id, + IM->Count - IM->CopyStart); + + _tnl_print_vert_flags("Contains at least one", orflag); + + if (IM->Count != IM->CopyStart) + { + _tnl_print_vert_flags("Contains a full complement of", andflag); + + fprintf(stderr, "Final begin/end state %s/%s, errors %s/%s\n", + (state & VERT_BEGIN_0) ? "in" : "out", + (state & VERT_BEGIN_1) ? "in" : "out", + (state & VERT_ERROR_0) ? "y" : "n", + (state & VERT_ERROR_1) ? "y" : "n"); + + } + + for (i = IM->CopyStart ; i <= IM->Count ; i++) { + fprintf(stderr, "%u: ", i); + if (req & VERT_OBJ_234) { + if (flags[i] & VERT_EVAL_C1) + fprintf(stderr, "EvalCoord %f ", IM->Obj[i][0]); + else if (flags[i] & VERT_EVAL_P1) + fprintf(stderr, "EvalPoint %.0f ", IM->Obj[i][0]); + else if (flags[i] & VERT_EVAL_C2) + fprintf(stderr, "EvalCoord %f %f ", IM->Obj[i][0], IM->Obj[i][1]); + else if (flags[i] & VERT_EVAL_P2) + fprintf(stderr, "EvalPoint %.0f %.0f ", IM->Obj[i][0], IM->Obj[i][1]); + else if (i < IM->Count && (flags[i]&VERT_OBJ_234)) { + fprintf(stderr, "Obj %f %f %f %f", + IM->Obj[i][0], IM->Obj[i][1], IM->Obj[i][2], IM->Obj[i][3]); + } + } + + if (req & flags[i] & VERT_ELT) + fprintf(stderr, " Elt %u\t", IM->Elt[i]); + + if (req & flags[i] & VERT_NORM) + fprintf(stderr, " Norm %f %f %f ", + IM->Normal[i][0], IM->Normal[i][1], IM->Normal[i][2]); + + if (req & flags[i] & VERT_TEX_ANY) { + GLuint j; + for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) { + if (req & flags[i] & VERT_TEX(j)) { + fprintf(stderr, + "TC%d %f %f %f %f", + j, + IM->TexCoord[j][i][0], IM->TexCoord[j][i][1], + IM->TexCoord[j][i][2], IM->TexCoord[j][i][2]); + } + } + } + + if (req & flags[i] & VERT_RGBA) + fprintf(stderr, " Rgba %d %d %d %d ", + IM->Color[i][0], IM->Color[i][1], + IM->Color[i][2], IM->Color[i][3]); + + if (req & flags[i] & VERT_SPEC_RGB) + fprintf(stderr, " Spec %d %d %d ", + IM->SecondaryColor[i][0], IM->SecondaryColor[i][1], + IM->SecondaryColor[i][2]); + + if (req & flags[i] & VERT_FOG_COORD) + fprintf(stderr, " Fog %f ", IM->FogCoord[i]); + + if (req & flags[i] & VERT_INDEX) + fprintf(stderr, " Index %u ", IM->Index[i]); + + if (req & flags[i] & VERT_EDGE) + fprintf(stderr, " Edgeflag %d ", IM->EdgeFlag[i]); + + if (req & flags[i] & VERT_MATERIAL) + fprintf(stderr, " Material "); + + + /* The order of these two is not easily knowable, but this is + * the usually correct way to look at them. + */ + if (req & flags[i] & VERT_END) + fprintf(stderr, " END "); + + if (req & flags[i] & VERT_BEGIN) + fprintf(stderr, " BEGIN(%s) (%s%s%s%s)", + _mesa_prim_name[IM->Primitive[i] & PRIM_MODE_MASK], + (IM->Primitive[i] & PRIM_LAST) ? "LAST," : "", + (IM->Primitive[i] & PRIM_BEGIN) ? "BEGIN," : "", + (IM->Primitive[i] & PRIM_END) ? "END," : "", + (IM->Primitive[i] & PRIM_PARITY) ? "PARITY," : ""); + + fprintf(stderr, "\n"); + } +} + + + diff --git a/src/mesa/tnl/t_imm_debug.h b/src/mesa/tnl/t_imm_debug.h new file mode 100644 index 00000000000..aaae5c11da3 --- /dev/null +++ b/src/mesa/tnl/t_imm_debug.h @@ -0,0 +1,11 @@ + +#ifndef _T_DEBUG_H +#define _T_DEBUG_H + +#include "mtypes.h" +#include "t_context.h" + +void _tnl_print_cassette( struct immediate *IM ); +void _tnl_print_vert_flags( const char *name, GLuint flags ); + +#endif diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c new file mode 100644 index 00000000000..f5f3bca5cd9 --- /dev/null +++ b/src/mesa/tnl/t_imm_dlist.c @@ -0,0 +1,415 @@ +/* $Id: t_imm_dlist.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "context.h" +#include "dlist.h" +#include "debug.h" +#include "mmath.h" +#include "mem.h" +#include "state.h" + +#include "t_context.h" +#include "t_imm_api.h" +#include "t_imm_elt.h" +#include "t_imm_alloc.h" +#include "t_imm_dlist.h" +#include "t_imm_debug.h" +#include "t_imm_exec.h" +#include "t_imm_fixup.h" +#include "t_pipeline.h" + +typedef struct { + struct immediate *IM; + GLuint Start; + GLuint Count; + GLuint BeginState; + GLuint SavedBeginState; + GLuint OrFlag; + GLuint AndFlag; + GLuint TexSize; + GLuint LastData; + GLuint LastPrimitive; + GLboolean have_normal_lengths; +} TNLvertexcassette; + +static void execute_compiled_cassette( GLcontext *ctx, void *data ); + + +/* Insert the active immediate struct onto the display list currently + * being built. + */ +void +_tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ) +{ + struct immediate *im = TNL_CURRENT_IM(ctx); + TNLcontext *tnl = TNL_CONTEXT(ctx); + TNLvertexcassette *node; + GLuint new_beginstate; + + + _tnl_compute_orflag( IM ); + + IM->CopyStart = IM->Start; + + if (IM->OrFlag & VERT_ELT) { + GLuint andflag = ~0; + GLuint i; + GLuint start = IM->FlushElt ? IM->LastPrimitive : IM->CopyStart; + _tnl_translate_array_elts( ctx, IM, start, IM->Count ); + + /* Need to recompute andflag. + */ + if (IM->AndFlag & VERT_ELT) + IM->CopyAndFlag = IM->AndFlag |= ctx->Array._Enabled; + else { + for (i = IM->CopyStart ; i < IM->Count ; i++) + andflag &= IM->Flag[i]; + IM->CopyAndFlag = IM->AndFlag = andflag; + } + } + + _tnl_fixup_input( ctx, IM ); + + /* Mark the last primitive: + */ + IM->PrimitiveLength[IM->LastPrimitive] = IM->Count - IM->LastPrimitive; + ASSERT(IM->Primitive[IM->LastPrimitive] & PRIM_LAST); + + + node = (TNLvertexcassette *) + _mesa_alloc_instruction(ctx, + tnl->opcode_vertex_cassette, + sizeof(TNLvertexcassette)); + if (!node) + return; + + node->IM = im; im->ref_count++; + node->Start = im->Start; + node->Count = im->Count; + node->BeginState = im->BeginState; + node->SavedBeginState = im->SavedBeginState; + node->OrFlag = im->OrFlag; + node->TexSize = im->TexSize; + node->AndFlag = im->AndFlag; + node->LastData = im->LastData; + node->LastPrimitive = im->LastPrimitive; + node->have_normal_lengths = GL_FALSE; + + if (ctx->ExecuteFlag) { + execute_compiled_cassette( ctx, (void *)node ); + } + + + /* Discard any errors raised in the last cassette. + */ + new_beginstate = node->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1); + + /* Decide whether this immediate struct is full, or can be used for + * the next batch of vertices as well. + */ + if (im->Count > IMM_MAXDATA - 16) { + /* Call it full... + */ + struct immediate *new_im = _tnl_alloc_immediate(ctx); + if (!new_im) return; + new_im->ref_count++; + im->ref_count--; /* remove CURRENT_IM reference */ + ASSERT(im->ref_count > 0); + SET_IMMEDIATE( ctx, new_im ); + _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, + new_beginstate, node->SavedBeginState ); + } else { + /* Still some room in the current immediate. + */ + _tnl_reset_input( ctx, im->Count+1+IMM_MAX_COPIED_VERTS, + new_beginstate, node->SavedBeginState); + } +} + + + +static void calc_normal_lengths( GLfloat *dest, + CONST GLfloat (*data)[3], + GLuint *flags, + GLuint count ) +{ + GLuint i; + GLint tmpflag = flags[0]; + + flags[0] |= VERT_NORM; + + for (i = 0 ; i < count ; i++ ) + if (flags[i] & VERT_NORM) { + GLfloat tmp = (GLfloat) LEN_3FV( data[i] ); + dest[i] = 0; + if (tmp > 0) + dest[i] = 1.0F / tmp; + } else + dest[i] = dest[i-1]; + + flags[0] = tmpflag; +} + + + +static void +execute_compiled_cassette( GLcontext *ctx, void *data ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + TNLvertexcassette *node = (TNLvertexcassette *)data; + struct immediate *IM = node->IM; + + FLUSH_VERTICES( ctx, 0 ); + + if (ctx->NewState) + gl_update_state(ctx); + + if (tnl->pipeline.build_state_changes) + _tnl_validate_pipeline( ctx ); + + IM->Start = node->Start; + IM->CopyStart = node->Start; + IM->Count = node->Count; + IM->BeginState = node->BeginState; + IM->SavedBeginState = node->SavedBeginState; + IM->OrFlag = node->OrFlag; + IM->TexSize = node->TexSize; + IM->AndFlag = node->AndFlag; + IM->LastData = node->LastData; + IM->LastPrimitive = node->LastPrimitive; + + if ((MESA_VERBOSE & VERBOSE_DISPLAY_LIST) && + (MESA_VERBOSE & VERBOSE_IMMEDIATE)) + _tnl_print_cassette( IM ); + + if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) { + fprintf(stderr, "Run cassette %d, rows %d..%d, beginstate %x ", + IM->id, + IM->Start, IM->Count, IM->BeginState); +/* _tnl_print_vert_flags("orflag", IM->OrFlag); */ + } + + if (IM->SavedBeginState) { + if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) + tnl->ReplayHardBeginEnd = 1; + if (!tnl->ReplayHardBeginEnd) { + gl_error(ctx, GL_INVALID_OPERATION, "hard replay"); + return; + } + } + + + + /* Lazy optimization of the cassette. + */ +/* if (ctx->Transform.Normalize && !node->have_normal_lengths) { */ + +/* if (!IM->NormalLengths) */ +/* IM->NormalLengths = (GLfloat *)MALLOC(sizeof(GLfloat) * IMM_SIZE); */ + +/* calc_normal_lengths( IM->NormalLengths + IM->Start, */ +/* (const GLfloat (*)[3])(IM->Normal + IM->Start), */ +/* IM->Flag + IM->Start, */ +/* IM->Count - IM->Start); */ + +/* node->have_normal_lengths = GL_TRUE; */ +/* } */ + + +#if 0 + if (0 && im->v.Obj.size < 4 && im->Count > 15) { + im->Bounds = (GLfloat (*)[3]) MALLOC(6 * sizeof(GLfloat)); + (_tnl_calc_bound_tab[im->v.Obj.size])( im->Bounds, &im->v.Obj ); + } +#endif + + + _tnl_fixup_compiled_cassette( ctx, IM ); + _tnl_get_exec_copy_verts( ctx, IM ); + _tnl_run_cassette( ctx, IM ); + _tnl_restore_compiled_cassette( ctx, IM ); + + if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) + tnl->ReplayHardBeginEnd = 0; +} + +static void +destroy_compiled_cassette( GLcontext *ctx, void *data ) +{ + TNLvertexcassette *node = (TNLvertexcassette *)data; + + if ( --node->IM->ref_count == 0 ) + _tnl_free_immediate( node->IM ); +} + + +static void +print_compiled_cassette( GLcontext *ctx, void *data ) +{ + TNLvertexcassette *node = (TNLvertexcassette *)data; + struct immediate *IM = node->IM; + + fprintf(stderr, "TNL-VERTEX-CASSETTE, id %u, rows %u..%u\n", + node->IM->id, node->Start, node->Count); + + IM->Start = node->Start; + IM->Count = node->Count; + IM->BeginState = node->BeginState; + IM->OrFlag = node->OrFlag; + IM->TexSize = node->TexSize; + IM->AndFlag = node->AndFlag; + IM->LastData = node->LastData; + IM->LastPrimitive = node->LastPrimitive; + + _tnl_print_cassette( node->IM ); +} + +void +_tnl_BeginCallList( GLcontext *ctx, GLuint list ) +{ + (void) ctx; + (void) list; + FLUSH_CURRENT(ctx, 0); +} + + +/* Called at the tail of a CallList. Copy vertices out of the display + * list if necessary. + */ +void +_tnl_EndCallList( GLcontext *ctx ) +{ + /* May have to copy vertices from a dangling begin/end inside the + * list to the current immediate. + */ + if (ctx->CallDepth == 0) { + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct immediate *IM = TNL_CURRENT_IM(ctx); + + if (tnl->ExecCopySource != IM) + _tnl_copy_immediate_vertices( ctx, IM ); + } +} + + +void +_tnl_EndList( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct immediate *IM = TNL_CURRENT_IM(ctx); + + IM->ref_count--; + if (IM == tnl->ExecCopySource) + IM->ref_count--; + + /* If this one isn't free, get a clean one. (Otherwise we'll be + * using one that's already half full). + */ + if (IM->ref_count != 0) + IM = _tnl_alloc_immediate( ctx ); + + ASSERT(IM->ref_count == 0); + + tnl->ExecCopySource = IM; + IM->ref_count++; + + SET_IMMEDIATE( ctx, IM ); + IM->ref_count++; + + _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 ); + + /* outside begin/end, even in COMPILE_AND_EXEC, + * so no vertices to copy, right? + */ + ASSERT(TNL_CONTEXT(ctx)->ExecCopyCount == 0); +} + + +void +_tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ) +{ + struct immediate *IM = TNL_CURRENT_IM(ctx); + + /* Use the installed immediate struct. No vertices in the current + * immediate, no copied vertices in the system. + */ + ASSERT(TNL_CURRENT_IM(ctx)); + ASSERT(TNL_CURRENT_IM(ctx)->Start == IMM_MAX_COPIED_VERTS); + ASSERT(TNL_CURRENT_IM(ctx)->Start == TNL_CURRENT_IM(ctx)->Count); + ASSERT(TNL_CONTEXT(ctx)->ExecCopyCount == 0); + + /* Set current Begin/End state to unknown: + */ + IM->BeginState = VERT_BEGIN_0; +} + + +void +_tnl_dlist_init( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + tnl->opcode_vertex_cassette = + _mesa_alloc_opcode( ctx, + sizeof(TNLvertexcassette), + execute_compiled_cassette, + destroy_compiled_cassette, + print_compiled_cassette ); +} + +/* Need to do this to get the correct begin/end error behaviour from + * functions like ColorPointerEXT which are still active in + * SAVE_AND_EXEC modes. + */ +void +_tnl_save_Begin( GLenum mode ) +{ + GET_CURRENT_CONTEXT(ctx); + + if (mode > GL_POLYGON) { + _mesa_compile_error( ctx, GL_INVALID_ENUM, "glBegin" ); + return; + } + + if (ctx->ExecuteFlag) { + /* Preserve vtxfmt invarient: + */ + if (ctx->NewState) + gl_update_state( ctx ); + + /* Slot in geomexec: No need to call setdispatch as we know + * CurrentDispatch is Save. + */ + ASSERT(ctx->CurrentDispatch == ctx->Save); + } + + _tnl_begin( ctx, mode ); +} diff --git a/src/mesa/tnl/t_imm_dlist.h b/src/mesa/tnl/t_imm_dlist.h new file mode 100644 index 00000000000..1b6c4a778ac --- /dev/null +++ b/src/mesa/tnl/t_imm_dlist.h @@ -0,0 +1,46 @@ +/* $Id: t_imm_dlist.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + +#ifndef _T_DLIST_H +#define _T_DLIST_H + +#include "mtypes.h" +#include "t_context.h" + +extern void _tnl_dlist_init( GLcontext *ctx ); + +extern void _tnl_compile_cassette( GLcontext *ctx, struct immediate *IM ); +extern void _tnl_EndList( GLcontext *ctx ); +extern void _tnl_NewList( GLcontext *ctx, GLuint list, GLenum mode ); +extern void _tnl_save_Begin( GLenum mode ); + +extern void _tnl_EndCallList( GLcontext *ctx ); +extern void _tnl_BeginCallList( GLcontext *ctx, GLuint list ); + +#endif diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c new file mode 100644 index 00000000000..67fbdbe907c --- /dev/null +++ b/src/mesa/tnl/t_imm_elt.c @@ -0,0 +1,759 @@ +/* $Id: t_imm_elt.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + +#include "glheader.h" +#include "colormac.h" +#include "mem.h" +#include "mmath.h" +#include "mtypes.h" + +#include "math/m_translate.h" + +#include "t_context.h" +#include "t_imm_elt.h" + + + +typedef void (*trans_elt_1f_func)(GLfloat *to, + CONST void *ptr, + GLuint stride, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ); + +typedef void (*trans_elt_1ui_func)(GLuint *to, + CONST void *ptr, + GLuint stride, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ); + +typedef void (*trans_elt_1ub_func)(GLubyte *to, + CONST void *ptr, + GLuint stride, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ); + +typedef void (*trans_elt_4ub_func)(GLubyte (*to)[4], + CONST void *ptr, + GLuint stride, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ); + +typedef void (*trans_elt_4f_func)(GLfloat (*to)[4], + CONST void *ptr, + GLuint stride, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ); + +typedef void (*trans_elt_3f_func)(GLfloat (*to)[3], + CONST void *ptr, + GLuint stride, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ); + + + + +static trans_elt_1f_func _tnl_trans_elt_1f_tab[MAX_TYPES]; +static trans_elt_1ui_func _tnl_trans_elt_1ui_tab[MAX_TYPES]; +static trans_elt_1ub_func _tnl_trans_elt_1ub_tab[MAX_TYPES]; +static trans_elt_3f_func _tnl_trans_elt_3f_tab[MAX_TYPES]; +static trans_elt_4ub_func _tnl_trans_elt_4ub_tab[5][MAX_TYPES]; +static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; + + +#define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt]) + + + + + +/* Code specific to array element implementation. There is a small + * subtlety in the bits CHECK() tests, and the way bits are set in + * glArrayElement which ensures that if, eg, in the case that the + * vertex array is disabled and normal array is enabled, and we get + * either sequence: + * + * ArrayElement() OR Normal() + * Normal() ArrayElement() + * Vertex() Vertex() + * + * That the correct value for normal is used. + */ +#define TAB(x) _tnl_trans_elt##x##_tab +#define ARGS GLuint *flags, GLuint *elts, GLuint match, \ + GLuint start, GLuint n +#define SRC_START 0 +#define DST_START start +#undef CHECK +#define CHECK if ((flags[i]&match) == VERT_ELT) +#define NEXT_F (void)1 +#define NEXT_F2 f = first + elts[i] * stride; + + +/* GL_BYTE + */ +#define SRC GLbyte +#define SRC_IDX TYPE_IDX(GL_BYTE) +#define TRX_3F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_UB(ub, f,n) ub = BYTE_TO_UBYTE( PTR_ELT(f,n) ) +#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) + + +#define SZ 4 +#define INIT init_trans_4_GLbyte_elt +#define DEST_4F trans_4_GLbyte_4f_elt +#define DEST_4UB trans_4_GLbyte_4ub_elt +#include "math/m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLbyte_elt +#define DEST_4F trans_3_GLbyte_4f_elt +#define DEST_4UB trans_3_GLbyte_4ub_elt +#define DEST_3F trans_3_GLbyte_3f_elt +#include "math/m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLbyte_elt +#define DEST_4F trans_2_GLbyte_4f_elt +#include "math/m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLbyte_elt +#define DEST_4F trans_1_GLbyte_4f_elt +#define DEST_1UB trans_1_GLbyte_1ub_elt +#define DEST_1UI trans_1_GLbyte_1ui_elt +#include "math/m_trans_tmp.h" + +#undef SRC +#undef TRX_3F +#undef TRX_4F +#undef TRX_UB +#undef TRX_UI +#undef SRC_IDX + +/* GL_UNSIGNED_BYTE + */ +#define SRC GLubyte +#define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE) +#define TRX_3F(f,n) /* unused */ +#define TRX_4F(f,n) /* unused */ +#define TRX_UB(ub, f,n) ub = PTR_ELT(f,n) +#define TRX_UI(f,n) (GLuint)PTR_ELT(f,n) + +/* 4ub->4ub handled in special case below. + */ + +#define SZ 3 +#define INIT init_trans_3_GLubyte_elt +#define DEST_4UB trans_3_GLubyte_4ub_elt +#include "math/m_trans_tmp.h" + + +#define SZ 1 +#define INIT init_trans_1_GLubyte_elt +#define DEST_1UI trans_1_GLubyte_1ui_elt +#define DEST_1UB trans_1_GLubyte_1ub_elt +#include "math/m_trans_tmp.h" + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_UB +#undef TRX_UI + + +/* GL_SHORT + */ +#define SRC GLshort +#define SRC_IDX TYPE_IDX(GL_SHORT) +#define TRX_3F(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_UB(ub, f,n) ub = SHORT_TO_UBYTE(PTR_ELT(f,n)) +#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) + + +#define SZ 4 +#define INIT init_trans_4_GLshort_elt +#define DEST_4F trans_4_GLshort_4f_elt +#define DEST_4UB trans_4_GLshort_4ub_elt +#include "math/m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLshort_elt +#define DEST_4F trans_3_GLshort_4f_elt +#define DEST_4UB trans_3_GLshort_4ub_elt +#define DEST_3F trans_3_GLshort_3f_elt +#include "math/m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLshort_elt +#define DEST_4F trans_2_GLshort_4f_elt +#include "math/m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLshort_elt +#define DEST_4F trans_1_GLshort_4f_elt +#define DEST_1UB trans_1_GLshort_1ub_elt +#define DEST_1UI trans_1_GLshort_1ui_elt +#include "math/m_trans_tmp.h" + + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_UB +#undef TRX_UI + + +/* GL_UNSIGNED_SHORT + */ +#define SRC GLushort +#define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT) +#define TRX_3F(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8) +#define TRX_UI(f,n) (GLuint) PTR_ELT(f,n) + + +#define SZ 4 +#define INIT init_trans_4_GLushort_elt +#define DEST_4F trans_4_GLushort_4f_elt +#define DEST_4UB trans_4_GLushort_4ub_elt +#include "math/m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLushort_elt +#define DEST_4F trans_3_GLushort_4f_elt +#define DEST_4UB trans_3_GLushort_4ub_elt +#define DEST_3F trans_3_GLushort_3f_elt +#include "math/m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLushort_elt +#define DEST_4F trans_2_GLushort_4f_elt +#include "math/m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLushort_elt +#define DEST_4F trans_1_GLushort_4f_elt +#define DEST_1UB trans_1_GLushort_1ub_elt +#define DEST_1UI trans_1_GLushort_1ui_elt +#include "math/m_trans_tmp.h" + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_UB +#undef TRX_UI + + +/* GL_INT + */ +#define SRC GLint +#define SRC_IDX TYPE_IDX(GL_INT) +#define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_UB(ub, f,n) ub = INT_TO_UBYTE(PTR_ELT(f,n)) +#define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) + + +#define SZ 4 +#define INIT init_trans_4_GLint_elt +#define DEST_4F trans_4_GLint_4f_elt +#define DEST_4UB trans_4_GLint_4ub_elt +#include "math/m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLint_elt +#define DEST_4F trans_3_GLint_4f_elt +#define DEST_4UB trans_3_GLint_4ub_elt +#define DEST_3F trans_3_GLint_3f_elt +#include "math/m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLint_elt +#define DEST_4F trans_2_GLint_4f_elt +#include "math/m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLint_elt +#define DEST_4F trans_1_GLint_4f_elt +#define DEST_1UB trans_1_GLint_1ub_elt +#define DEST_1UI trans_1_GLint_1ui_elt +#include "math/m_trans_tmp.h" + + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_UB +#undef TRX_UI + + +/* GL_UNSIGNED_INT + */ +#define SRC GLuint +#define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT) +#define TRX_3F(f,n) UINT_TO_FLOAT( PTR_ELT(f,n) ) +#define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) +#define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24) +#define TRX_UI(f,n) PTR_ELT(f,n) + + +#define SZ 4 +#define INIT init_trans_4_GLuint_elt +#define DEST_4F trans_4_GLuint_4f_elt +#define DEST_4UB trans_4_GLuint_4ub_elt +#include "math/m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLuint_elt +#define DEST_4F trans_3_GLuint_4f_elt +#define DEST_4UB trans_3_GLuint_4ub_elt +#define DEST_3F trans_3_GLuint_3f_elt +#include "math/m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLuint_elt +#define DEST_4F trans_2_GLuint_4f_elt +#include "math/m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLuint_elt +#define DEST_4F trans_1_GLuint_4f_elt +#define DEST_1UB trans_1_GLuint_1ub_elt +#define DEST_1UI trans_1_GLuint_1ui_elt +#include "math/m_trans_tmp.h" + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_UB +#undef TRX_UI + + +/* GL_DOUBLE + */ +#define SRC GLdouble +#define SRC_IDX TYPE_IDX(GL_DOUBLE) +#define TRX_3F(f,n) PTR_ELT(f,n) +#define TRX_4F(f,n) PTR_ELT(f,n) +#define TRX_UB(ub,f,n) FLOAT_COLOR_TO_CHAN(ub, PTR_ELT(f,n)) +#define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) +#define TRX_1F(f,n) PTR_ELT(f,n) + + +#define SZ 4 +#define INIT init_trans_4_GLdouble_elt +#define DEST_4F trans_4_GLdouble_4f_elt +#define DEST_4UB trans_4_GLdouble_4ub_elt +#include "math/m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLdouble_elt +#define DEST_4F trans_3_GLdouble_4f_elt +#define DEST_4UB trans_3_GLdouble_4ub_elt +#define DEST_3F trans_3_GLdouble_3f_elt +#include "math/m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLdouble_elt +#define DEST_4F trans_2_GLdouble_4f_elt +#include "math/m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLdouble_elt +#define DEST_4F trans_1_GLdouble_4f_elt +#define DEST_1UB trans_1_GLdouble_1ub_elt +#define DEST_1UI trans_1_GLdouble_1ui_elt +#define DEST_1F trans_1_GLdouble_1f_elt +#include "math/m_trans_tmp.h" + +#undef SRC +#undef SRC_IDX + +/* GL_FLOAT + */ +#define SRC GLfloat +#define SRC_IDX TYPE_IDX(GL_FLOAT) +#define SZ 4 +#define INIT init_trans_4_GLfloat_elt +#define DEST_4UB trans_4_GLfloat_4ub_elt +#define DEST_4F trans_4_GLfloat_4f_elt +#include "math/m_trans_tmp.h" + +#define SZ 3 +#define INIT init_trans_3_GLfloat_elt +#define DEST_4F trans_3_GLfloat_4f_elt +#define DEST_4UB trans_3_GLfloat_4ub_elt +#define DEST_3F trans_3_GLfloat_3f_elt +#include "math/m_trans_tmp.h" + +#define SZ 2 +#define INIT init_trans_2_GLfloat_elt +#define DEST_4F trans_2_GLfloat_4f_elt +#include "math/m_trans_tmp.h" + +#define SZ 1 +#define INIT init_trans_1_GLfloat_elt +#define DEST_4F trans_1_GLfloat_3f_elt +#define DEST_1UB trans_1_GLfloat_1ub_elt +#define DEST_1UI trans_1_GLfloat_1ui_elt +#define DEST_1F trans_1_GLfloat_1f_elt +#include "math/m_trans_tmp.h" + +#undef SRC +#undef SRC_IDX +#undef TRX_3F +#undef TRX_4F +#undef TRX_UB +#undef TRX_UI + + +static void trans_4_GLubyte_4ub(GLubyte (*t)[4], + CONST void *Ptr, + GLuint stride, + ARGS ) +{ + const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride; + const GLubyte *first = f; + GLuint i; + (void) start; + if (((((long) f | (long) stride)) & 3L) == 0L) { + /* Aligned. + */ + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + COPY_4UBV( t[i], f ); + } + } + } else { + for (i = DST_START ; i < n ; i++, NEXT_F) { + CHECK { + NEXT_F2; + t[i][0] = f[0]; + t[i][1] = f[1]; + t[i][2] = f[2]; + t[i][3] = f[3]; + } + } + } +} + + +static void init_translate_elt(void) +{ + MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) ); + MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) ); + MEMSET( TAB(_3f), 0, sizeof(TAB(_3f)) ); + MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) ); + MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) ); + + TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub; + + init_trans_4_GLbyte_elt(); + init_trans_3_GLbyte_elt(); + init_trans_2_GLbyte_elt(); + init_trans_1_GLbyte_elt(); + init_trans_1_GLubyte_elt(); + init_trans_3_GLubyte_elt(); + init_trans_4_GLshort_elt(); + init_trans_3_GLshort_elt(); + init_trans_2_GLshort_elt(); + init_trans_1_GLshort_elt(); + init_trans_4_GLushort_elt(); + init_trans_3_GLushort_elt(); + init_trans_2_GLushort_elt(); + init_trans_1_GLushort_elt(); + init_trans_4_GLint_elt(); + init_trans_3_GLint_elt(); + init_trans_2_GLint_elt(); + init_trans_1_GLint_elt(); + init_trans_4_GLuint_elt(); + init_trans_3_GLuint_elt(); + init_trans_2_GLuint_elt(); + init_trans_1_GLuint_elt(); + init_trans_4_GLdouble_elt(); + init_trans_3_GLdouble_elt(); + init_trans_2_GLdouble_elt(); + init_trans_1_GLdouble_elt(); + init_trans_4_GLfloat_elt(); + init_trans_3_GLfloat_elt(); + init_trans_2_GLfloat_elt(); + init_trans_1_GLfloat_elt(); +} + + +#undef TAB +#undef CLASS +#undef ARGS +#undef CHECK +#undef START + + + + +void _tnl_imm_elt_init( void ) +{ + init_translate_elt(); +} + + +static void _tnl_trans_elt_1f(GLfloat *to, + const struct gl_client_array *from, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ) +{ + _tnl_trans_elt_1f_tab[TYPE_IDX(from->Type)]( to, + from->Ptr, + from->StrideB, + flags, + elts, + match, + start, + n ); + +} + +static void _tnl_trans_elt_1ui(GLuint *to, + const struct gl_client_array *from, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ) +{ + _tnl_trans_elt_1ui_tab[TYPE_IDX(from->Type)]( to, + from->Ptr, + from->StrideB, + flags, + elts, + match, + start, + n ); + +} + + +static void _tnl_trans_elt_1ub(GLubyte *to, + const struct gl_client_array *from, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ) +{ + _tnl_trans_elt_1ub_tab[TYPE_IDX(from->Type)]( to, + from->Ptr, + from->StrideB, + flags, + elts, + match, + start, + n ); + +} + + +static void _tnl_trans_elt_4ub(GLubyte (*to)[4], + const struct gl_client_array *from, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ) +{ + _tnl_trans_elt_4ub_tab[from->Size][TYPE_IDX(from->Type)]( to, + from->Ptr, + from->StrideB, + flags, + elts, + match, + start, + n ); + +} + +static void _tnl_trans_elt_4f(GLfloat (*to)[4], + const struct gl_client_array *from, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ) +{ + _tnl_trans_elt_4f_tab[from->Size][TYPE_IDX(from->Type)]( to, + from->Ptr, + from->StrideB, + flags, + elts, + match, + start, + n ); + +} + +static void _tnl_trans_elt_3f(GLfloat (*to)[3], + const struct gl_client_array *from, + GLuint *flags, + GLuint *elts, + GLuint match, + GLuint start, + GLuint n ) +{ + _tnl_trans_elt_3f_tab[TYPE_IDX(from->Type)]( to, + from->Ptr, + from->StrideB, + flags, + elts, + match, + start, + n ); +} + + + + +/* Batch function to translate away all the array elements in the + * input buffer prior to transform. Done only the first time a vertex + * buffer is executed or compiled. + * + * KW: Have to do this after each glEnd if arrays aren't locked. + */ +void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM, + GLuint start, GLuint count ) +{ + GLuint *flags = IM->Flag; + GLuint *elts = IM->Elt; + GLuint translate = ctx->Array._Enabled; + GLuint i; + + if (MESA_VERBOSE&VERBOSE_IMMEDIATE) + fprintf(stderr, "exec_array_elements %d .. %d\n", start, count); + + if (translate & VERT_OBJ) { + _tnl_trans_elt_4f( IM->Obj, + &ctx->Array.Vertex, + flags, elts, (VERT_ELT|VERT_OBJ), + start, count); + + if (ctx->Array.Vertex.Size == 4) + translate |= VERT_OBJ_234; + else if (ctx->Array.Vertex.Size == 3) + translate |= VERT_OBJ_23; + } + + + if (translate & VERT_NORM) + _tnl_trans_elt_3f( IM->Normal, + &ctx->Array.Normal, + flags, elts, (VERT_ELT|VERT_NORM), + start, count); + + if (translate & VERT_EDGE) + _tnl_trans_elt_1ub( IM->EdgeFlag, + &ctx->Array.EdgeFlag, + flags, elts, (VERT_ELT|VERT_EDGE), + start, count); + + if (translate & VERT_RGBA) + _tnl_trans_elt_4ub( IM->Color, + &ctx->Array.Color, + flags, elts, (VERT_ELT|VERT_RGBA), + start, count); + + + if (translate & VERT_SPEC_RGB) + _tnl_trans_elt_4ub( IM->SecondaryColor, + &ctx->Array.SecondaryColor, + flags, elts, (VERT_ELT|VERT_SPEC_RGB), + start, count); + + if (translate & VERT_FOG_COORD) + _tnl_trans_elt_1f( IM->FogCoord, + &ctx->Array.FogCoord, + flags, elts, (VERT_ELT|VERT_FOG_COORD), + start, count); + + if (translate & VERT_INDEX) + _tnl_trans_elt_1ui( IM->Index, + &ctx->Array.Index, + flags, elts, (VERT_ELT|VERT_INDEX), + start, count); + + if (translate & VERT_TEX_ANY) { + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + if (translate & VERT_TEX(i)) { + _tnl_trans_elt_4f( IM->TexCoord[i], + &ctx->Array.TexCoord[i], + flags, elts, (VERT_ELT|VERT_TEX(i)), + start, count); + + if (ctx->Array.TexCoord[i].Size == 4) + IM->TexSize |= TEX_SIZE_4(i); + else if (ctx->Array.TexCoord[i].Size == 3) + IM->TexSize |= TEX_SIZE_3(i); + } + } + + for (i = start ; i < count ; i++) + if (flags[i] & VERT_ELT) flags[i] |= translate; + + IM->CopyOrFlag |= translate; +} + + diff --git a/src/mesa/tnl/t_imm_elt.h b/src/mesa/tnl/t_imm_elt.h new file mode 100644 index 00000000000..180b75fbee8 --- /dev/null +++ b/src/mesa/tnl/t_imm_elt.h @@ -0,0 +1,46 @@ +/* $Id: t_imm_elt.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + + +#ifndef _T_IMM_ELT_H_ +#define _T_IMM_ELT_H_ + +#include "mtypes.h" +#include "t_context.h" + + +extern void _tnl_imm_elt_init( void ); + +extern void _tnl_translate_array_elts( GLcontext *ctx, + struct immediate *IM, + GLuint start, + GLuint end ); + + +#endif diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c new file mode 100644 index 00000000000..ed8af649aad --- /dev/null +++ b/src/mesa/tnl/t_imm_eval.c @@ -0,0 +1,623 @@ +/* $Id: t_imm_eval.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "mtypes.h" +#include "math/m_eval.h" + +#include "t_context.h" +#include "t_imm_eval.h" +#include "t_imm_exec.h" +#include "t_imm_fixup.h" + + +static void eval_points1( GLfloat outcoord[][4], + GLfloat coord[][4], + const GLuint *flags, + GLfloat du, GLfloat u1 ) +{ + GLuint i; + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) + if (flags[i] & VERT_EVAL_ANY) { + outcoord[i][0] = coord[i][0]; + outcoord[i][1] = coord[i][1]; + if (flags[i] & VERT_EVAL_P1) + outcoord[i][0] = coord[i][0] * du + u1; + } +} + +static void eval_points2( GLfloat outcoord[][4], + GLfloat coord[][4], + const GLuint *flags, + GLfloat du, GLfloat u1, + GLfloat dv, GLfloat v1 ) +{ + GLuint i; + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) { + if (flags[i] & VERT_EVAL_ANY) { + outcoord[i][0] = coord[i][0]; + outcoord[i][1] = coord[i][1]; + if (flags[i] & VERT_EVAL_P2) { + outcoord[i][0] = coord[i][0] * du + u1; + outcoord[i][1] = coord[i][1] * dv + v1; + } + } + } +} + +static const GLubyte dirty_flags[5] = { + 0, /* not possible */ + VEC_DIRTY_0, + VEC_DIRTY_1, + VEC_DIRTY_2, + VEC_DIRTY_3 +}; + + +static void eval1_4f( GLvector4f *dest, + GLfloat coord[][4], + const GLuint *flags, + GLuint dimension, + struct gl_1d_map *map ) +{ + const GLfloat u1 = map->u1; + const GLfloat du = map->du; + GLfloat (*to)[4] = dest->data; + GLuint i; + + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) + if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) { + GLfloat u = (coord[i][0] - u1) * du; + ASSIGN_4V(to[i], 0,0,0,1); + _math_horner_bezier_curve(map->Points, to[i], u, + dimension, map->Order); + } + + dest->size = MAX2(dest->size, dimension); + dest->flags |= dirty_flags[dimension]; +} + + +static void eval1_1ui( GLvector1ui *dest, + GLfloat coord[][4], + const GLuint *flags, + struct gl_1d_map *map ) +{ + const GLfloat u1 = map->u1; + const GLfloat du = map->du; + GLuint *to = dest->data; + GLuint i; + + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) + if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) { + GLfloat u = (coord[i][0] - u1) * du; + GLfloat tmp; + _math_horner_bezier_curve(map->Points, &tmp, u, 1, map->Order); + to[i] = (GLuint) (GLint) tmp; + } + +} + +static void eval1_norm( GLvector3f *dest, + GLfloat coord[][4], + const GLuint *flags, + struct gl_1d_map *map ) +{ + const GLfloat u1 = map->u1; + const GLfloat du = map->du; + GLfloat (*to)[3] = dest->data; + GLuint i; + + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) + if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) { + GLfloat u = (coord[i][0] - u1) * du; + _math_horner_bezier_curve(map->Points, to[i], u, 3, map->Order); + } +} + +static void eval1_color( GLvector4ub *dest, + GLfloat coord[][4], + const GLuint *flags, + struct gl_1d_map *map ) +{ + const GLfloat u1 = map->u1; + const GLfloat du = map->du; + GLubyte (*to)[4] = dest->data; + GLuint i; + + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) + if (flags[i] & (VERT_EVAL_C1|VERT_EVAL_P1)) { + GLfloat u = (coord[i][0] - u1) * du; + GLfloat fcolor[4]; + _math_horner_bezier_curve(map->Points, fcolor, u, 4, map->Order); + FLOAT_RGBA_TO_CHAN_RGBA(to[i], fcolor); + } +} + + + + +static void eval2_obj_norm( GLvector4f *obj_ptr, + GLvector3f *norm_ptr, + GLfloat coord[][4], + GLuint *flags, + GLuint dimension, + struct gl_2d_map *map ) +{ + const GLfloat u1 = map->u1; + const GLfloat du = map->du; + const GLfloat v1 = map->v1; + const GLfloat dv = map->dv; + GLfloat (*obj)[4] = obj_ptr->data; + GLfloat (*normal)[3] = norm_ptr->data; + GLuint i; + + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) + if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) { + GLfloat u = (coord[i][0] - u1) * du; + GLfloat v = (coord[i][1] - v1) * dv; + GLfloat du[4], dv[4]; + + ASSIGN_4V(obj[i], 0,0,0,1); + _math_de_casteljau_surf(map->Points, obj[i], du, dv, u, v, dimension, + map->Uorder, map->Vorder); + + CROSS3(normal[i], du, dv); + NORMALIZE_3FV(normal[i]); + } + + obj_ptr->size = MAX2(obj_ptr->size, dimension); + obj_ptr->flags |= dirty_flags[dimension]; +} + + +static void eval2_4f( GLvector4f *dest, + GLfloat coord[][4], + const GLuint *flags, + GLuint dimension, + struct gl_2d_map *map ) +{ + const GLfloat u1 = map->u1; + const GLfloat du = map->du; + const GLfloat v1 = map->v1; + const GLfloat dv = map->dv; + GLfloat (*to)[4] = dest->data; + GLuint i; + + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) + if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) { + GLfloat u = (coord[i][0] - u1) * du; + GLfloat v = (coord[i][1] - v1) * dv; + _math_horner_bezier_surf(map->Points, to[i], u, v, dimension, + map->Uorder, map->Vorder); + } + + dest->size = MAX2(dest->size, dimension); + dest->flags |= dirty_flags[dimension]; +} + + +static void eval2_norm( GLvector3f *dest, + GLfloat coord[][4], + GLuint *flags, + struct gl_2d_map *map ) +{ + const GLfloat u1 = map->u1; + const GLfloat du = map->du; + const GLfloat v1 = map->v1; + const GLfloat dv = map->dv; + GLfloat (*to)[3] = dest->data; + GLuint i; + + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) + if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) { + GLfloat u = (coord[i][0] - u1) * du; + GLfloat v = (coord[i][1] - v1) * dv; + _math_horner_bezier_surf(map->Points, to[i], u, v, 3, + map->Uorder, map->Vorder); + } + +} + + +static void eval2_1ui( GLvector1ui *dest, + GLfloat coord[][4], + const GLuint *flags, + struct gl_2d_map *map ) +{ + const GLfloat u1 = map->u1; + const GLfloat du = map->du; + const GLfloat v1 = map->v1; + const GLfloat dv = map->dv; + GLuint *to = dest->data; + GLuint i; + + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) + if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) { + GLfloat u = (coord[i][0] - u1) * du; + GLfloat v = (coord[i][1] - v1) * dv; + GLfloat tmp; + _math_horner_bezier_surf(map->Points, &tmp, u, v, 1, + map->Uorder, map->Vorder); + + to[i] = (GLuint) (GLint) tmp; + } +} + + + +static void eval2_color( GLvector4ub *dest, + GLfloat coord[][4], + GLuint *flags, + struct gl_2d_map *map ) +{ + const GLfloat u1 = map->u1; + const GLfloat du = map->du; + const GLfloat v1 = map->v1; + const GLfloat dv = map->dv; + GLubyte (*to)[4] = dest->data; + GLuint i; + + for (i = 0 ; !(flags[i] & VERT_END_VB) ; i++) + if (flags[i] & (VERT_EVAL_C2|VERT_EVAL_P2)) { + GLfloat u = (coord[i][0] - u1) * du; + GLfloat v = (coord[i][1] - v1) * dv; + GLfloat fcolor[4]; + _math_horner_bezier_surf(map->Points, fcolor, u, v, 4, + map->Uorder, map->Vorder); + FLOAT_RGBA_TO_CHAN_RGBA(to[i], fcolor); + } + +} + + + +static void copy_4f( GLfloat to[][4], GLfloat from[][4], GLuint count ) +{ + MEMCPY( to, from, count * sizeof(to[0])); +} + +static void copy_3f( GLfloat to[][3], GLfloat from[][3], GLuint count ) +{ + MEMCPY( to, from, (count) * sizeof(to[0])); +} + +static void copy_4ub( GLubyte to[][4], GLubyte from[][4], GLuint count ) +{ + MEMCPY( to, from, (count) * sizeof(to[0])); +} + +static void copy_1ui( GLuint to[], GLuint from[], GLuint count ) +{ + MEMCPY( to, from, (count) * sizeof(to[0])); +} + + + +/* Translate eval enabled flags to VERT_* flags. + */ +static void update_eval( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint eval1 = 0, eval2 = 0; + + if (ctx->Eval.Map1Index) + eval1 |= VERT_INDEX; + + if (ctx->Eval.Map2Index) + eval2 |= VERT_INDEX; + + if (ctx->Eval.Map1Color4) + eval1 |= VERT_RGBA; + + if (ctx->Eval.Map2Color4) + eval2 |= VERT_RGBA; + + if (ctx->Eval.Map1Normal) + eval1 |= VERT_NORM; + + if (ctx->Eval.Map2Normal) + eval2 |= VERT_NORM; + + if (ctx->Eval.Map1TextureCoord4 || + ctx->Eval.Map1TextureCoord3 || + ctx->Eval.Map1TextureCoord2 || + ctx->Eval.Map1TextureCoord1) + eval1 |= VERT_TEX0; + + if (ctx->Eval.Map2TextureCoord4 || + ctx->Eval.Map2TextureCoord3 || + ctx->Eval.Map2TextureCoord2 || + ctx->Eval.Map2TextureCoord1) + eval2 |= VERT_TEX0; + + if (ctx->Eval.Map1Vertex4) + eval1 |= VERT_OBJ_234; + + if (ctx->Eval.Map1Vertex3) + eval1 |= VERT_OBJ_23; + + if (ctx->Eval.Map2Vertex4) { + if (ctx->Eval.AutoNormal) + eval2 |= VERT_OBJ_234 | VERT_NORM; + else + eval2 |= VERT_OBJ_234; + } + else if (ctx->Eval.Map2Vertex3) { + if (ctx->Eval.AutoNormal) + eval2 |= VERT_OBJ_23 | VERT_NORM; + else + eval2 |= VERT_OBJ_23; + } + + tnl->eval.EvalMap1Flags = eval1; + tnl->eval.EvalMap2Flags = eval2; + tnl->eval.EvalNewState = 0; +} + + +/* This looks a lot like a pipeline stage, but for various reasons is + * better handled outside the pipeline, and considered the final stage + * of fixing up an immediate struct for execution. + * + * Really want to cache the results of this function in display lists, + * at least for EvalMesh commands. + */ +void _tnl_eval_vb( GLcontext *ctx, + GLfloat (*coord)[4], + GLuint orflag, + GLuint andflag ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_arrays *tmp = &tnl->imm_inputs; + struct tnl_eval_store *store = &tnl->eval; + GLuint *flags = tnl->vb.Flag; + GLuint count = tnl->vb.Count; + GLuint any_eval1 = orflag & (VERT_EVAL_C1|VERT_EVAL_P1); + GLuint any_eval2 = orflag & (VERT_EVAL_C2|VERT_EVAL_P2); + GLuint all_eval = andflag & VERT_EVAL_ANY; /* may have false negatives */ + GLuint req = 0; + GLuint purge_flags = 0; + + if (tnl->eval.EvalNewState & _NEW_EVAL) + update_eval( ctx ); + + /* Handle the degenerate cases. + */ + if (any_eval1 && !ctx->Eval.Map1Vertex4 && !ctx->Eval.Map1Vertex3) + purge_flags = (VERT_EVAL_P1|VERT_EVAL_C1); + + if (any_eval2 && !ctx->Eval.Map2Vertex4 && !ctx->Eval.Map2Vertex3) + purge_flags |= (VERT_EVAL_P1|VERT_EVAL_C1); + + if (any_eval1) + req |= tnl->pipeline.inputs & tnl->eval.EvalMap1Flags; + + if (any_eval2) + req |= tnl->pipeline.inputs & tnl->eval.EvalMap2Flags; + + + /* Translate points into coords. Use store->Obj to hold the + * new data. + */ + if (any_eval1 && (orflag & VERT_EVAL_P1)) + { + eval_points1( store->Obj, coord, flags, + ctx->Eval.MapGrid1du, + ctx->Eval.MapGrid1u1); + + coord = store->Obj; + } + + if (any_eval2 && (orflag & VERT_EVAL_P2)) + { + eval_points2( store->Obj, coord, flags, + ctx->Eval.MapGrid2du, + ctx->Eval.MapGrid2u1, + ctx->Eval.MapGrid2dv, + ctx->Eval.MapGrid2v1 ); + + coord = store->Obj; + } + + + /* Perform the evaluations on active data elements. + */ + if (req & VERT_INDEX) + { + if (!all_eval) + copy_1ui( store->Index, tmp->Index.data, count ); + + tmp->Index.data = store->Index; + tmp->Index.start = store->Index; + + if (ctx->Eval.Map1Index && any_eval1) + eval1_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map1Index ); + + if (ctx->Eval.Map2Index && any_eval2) + eval2_1ui( &tmp->Index, coord, flags, &ctx->EvalMap.Map2Index ); + + } + + if (req & VERT_RGBA) + { + if (!all_eval) + copy_4ub( store->Color, tmp->Color.data, count ); + + tmp->Color.data = store->Color; + tmp->Color.start = (GLubyte *)store->Color; + + if (ctx->Eval.Map1Color4 && any_eval1) + eval1_color( &tmp->Color, coord, flags, &ctx->EvalMap.Map1Color4 ); + + if (ctx->Eval.Map2Color4 && any_eval2) + eval2_color( &tmp->Color, coord, flags, &ctx->EvalMap.Map2Color4 ); + } + + + if (req & VERT_TEX(0)) + { + if (!all_eval) + copy_4f( store->TexCoord, tmp->TexCoord[0].data, count ); + else + tmp->TexCoord[0].size = 0; + + tmp->TexCoord[0].data = store->TexCoord; + tmp->TexCoord[0].start = (GLfloat *)store->TexCoord; + + if (any_eval1) { + if (ctx->Eval.Map1TextureCoord4) { + eval1_4f( &tmp->TexCoord[0], coord, flags, 4, + &ctx->EvalMap.Map1Texture4 ); + } + else if (ctx->Eval.Map1TextureCoord3) { + eval1_4f( &tmp->TexCoord[0], coord, flags, 3, + &ctx->EvalMap.Map1Texture3 ); + } + else if (ctx->Eval.Map1TextureCoord2) { + eval1_4f( &tmp->TexCoord[0], coord, flags, 2, + &ctx->EvalMap.Map1Texture2 ); + } + else if (ctx->Eval.Map1TextureCoord1) { + eval1_4f( &tmp->TexCoord[0], coord, flags, 1, + &ctx->EvalMap.Map1Texture1 ); + } + } + + if (any_eval2) { + if (ctx->Eval.Map2TextureCoord4) { + eval2_4f( &tmp->TexCoord[0], coord, flags, 4, + &ctx->EvalMap.Map2Texture4 ); + } + else if (ctx->Eval.Map2TextureCoord3) { + eval2_4f( &tmp->TexCoord[0], coord, flags, 3, + &ctx->EvalMap.Map2Texture3 ); + } + else if (ctx->Eval.Map2TextureCoord2) { + eval2_4f( &tmp->TexCoord[0], coord, flags, 2, + &ctx->EvalMap.Map2Texture2 ); + } + else if (ctx->Eval.Map2TextureCoord1) { + eval2_4f( &tmp->TexCoord[0], coord, flags, 1, + &ctx->EvalMap.Map2Texture1 ); + } + } + } + + + if (req & VERT_NORM) + { + if (!all_eval) + copy_3f( store->Normal, tmp->Normal.data, count ); + + tmp->Normal.data = store->Normal; + tmp->Normal.start = (GLfloat *)store->Normal; + + if (ctx->Eval.Map1Normal && any_eval1) + eval1_norm( &tmp->Normal, coord, flags, + &ctx->EvalMap.Map1Normal ); + + if (ctx->Eval.Map2Normal && any_eval2) + eval2_norm( &tmp->Normal, coord, flags, + &ctx->EvalMap.Map2Normal ); + } + + + + /* In the AutoNormal case, the copy and assignment of tmp->NormalPtr + * are done above. + */ + if (req & VERT_OBJ) + { + if (!all_eval) { + copy_4f( store->Obj, tmp->Obj.data, count ); + } else + tmp->Obj.size = 0; + + tmp->Obj.data = store->Obj; + tmp->Obj.start = (GLfloat *)store->Obj; + + if (any_eval1) { + if (ctx->Eval.Map1Vertex4) { + eval1_4f( &tmp->Obj, coord, flags, 4, + &ctx->EvalMap.Map1Vertex4 ); + } + else if (ctx->Eval.Map1Vertex3) { + eval1_4f( &tmp->Obj, coord, flags, 3, + &ctx->EvalMap.Map1Vertex3 ); + } + } + + if (any_eval2) { + if (ctx->Eval.Map2Vertex4) + { + if (ctx->Eval.AutoNormal && (req & VERT_NORM)) + eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 4, + &ctx->EvalMap.Map2Vertex4 ); + else + eval2_4f( &tmp->Obj, coord, flags, 4, + &ctx->EvalMap.Map2Vertex4 ); + } + else if (ctx->Eval.Map2Vertex3) + { + if (ctx->Eval.AutoNormal && (req & VERT_NORM)) + eval2_obj_norm( &tmp->Obj, &tmp->Normal, coord, flags, 3, + &ctx->EvalMap.Map2Vertex3 ); + else + eval2_4f( &tmp->Obj, coord, flags, 3, + &ctx->EvalMap.Map2Vertex3 ); + } + } + } + + + { + GLuint i; + copy_1ui( store->Flag, flags, count ); + tnl->vb.Flag = store->Flag; + + /* This is overkill, but correct as fixup will have copied the + * values to all vertices in the VB - we may be falsely stating + * that some repeated values are new, but doing so is fairly + * harmless. + */ + for (i = 0 ; i < count ; i++) + store->Flag[i] |= req; + } +} + + + + + + + diff --git a/src/mesa/tnl/t_imm_eval.h b/src/mesa/tnl/t_imm_eval.h new file mode 100644 index 00000000000..06a91e0cd5b --- /dev/null +++ b/src/mesa/tnl/t_imm_eval.h @@ -0,0 +1,40 @@ +/* $Id: t_imm_eval.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef _T_IMM_EVAL_H +#define _T_IMM_EVAL_H + + +#include "mtypes.h" +#include "t_context.h" + +extern void _tnl_eval_init( void ); + +extern void _tnl_eval_vb( GLcontext *ctx, GLfloat (*coord)[4], + GLuint orflag, GLuint andflag ); + +#endif diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c new file mode 100644 index 00000000000..97f23d86e64 --- /dev/null +++ b/src/mesa/tnl/t_imm_exec.c @@ -0,0 +1,507 @@ +/* $Id: t_imm_exec.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "context.h" +#include "enums.h" +#include "dlist.h" +#include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "light.h" +#include "state.h" +#include "texture.h" +#include "mtypes.h" + +#include "math/m_matrix.h" +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_array_import.h" +#include "t_imm_alloc.h" +#include "t_imm_api.h" +#include "t_imm_debug.h" +#include "t_imm_dlist.h" +#include "t_imm_eval.h" +#include "t_imm_elt.h" +#include "t_imm_exec.h" +#include "t_imm_fixup.h" +#include "t_pipeline.h" + + + +/* Called to initialize new buffers, and to recycle old ones. + */ +void _tnl_reset_input( GLcontext *ctx, + GLuint start, + GLuint beginstate, + GLuint savedbeginstate ) +{ + struct immediate *IM = TNL_CURRENT_IM(ctx); + + /* Clear the dirty part of the flag array. + */ + if (start < IM->Count+2) + MEMSET(IM->Flag + start, 0, sizeof(GLuint) * (IM->Count+2-start)); + + IM->CopyStart = IM->Start = IM->Count = start; + IM->Primitive[IM->Start] = (ctx->Driver.CurrentExecPrimitive | PRIM_LAST); + IM->LastPrimitive = IM->Start; + IM->BeginState = beginstate; + IM->SavedBeginState = savedbeginstate; + IM->TexSize = 0; + + IM->ArrayEltFlags = ~ctx->Array._Enabled; + IM->ArrayEltIncr = ctx->Array.Vertex.Enabled ? 1 : 0; + IM->ArrayEltFlush = !ctx->Array.LockCount; +} + + + +static void copy_to_current( GLcontext *ctx, struct immediate *IM, + GLuint flag ) +{ + GLuint count = IM->LastData; + + if (MESA_VERBOSE&VERBOSE_IMMEDIATE) + _tnl_print_vert_flags("copy to current", flag); + + if (flag & VERT_NORM) + COPY_3FV( ctx->Current.Normal, IM->Normal[count]); + + if (flag & VERT_INDEX) + ctx->Current.Index = IM->Index[count]; + + if (flag & VERT_EDGE) + ctx->Current.EdgeFlag = IM->EdgeFlag[count]; + + if (flag & VERT_RGBA) + COPY_4UBV(ctx->Current.Color, IM->Color[count]); + + if (flag & VERT_SPEC_RGB) + COPY_4UBV(ctx->Current.SecondaryColor, IM->SecondaryColor[count]); + + if (flag & VERT_FOG_COORD) + ctx->Current.FogCoord = IM->FogCoord[count]; + + if (flag & VERT_TEX_ANY) { + GLuint i; + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { + if (flag & VERT_TEX(i)) { + COPY_4FV( ctx->Current.Texcoord[0], IM->TexCoord[0][count]); + } + } + } +} + + + +void _tnl_compute_orflag( struct immediate *IM ) +{ + GLuint count = IM->Count; + GLuint orflag = 0; + GLuint andflag = ~0U; + GLuint i; + + IM->LastData = count-1; + + + /* Compute the flags for the whole buffer. + */ + for (i = IM->CopyStart ; i < count ; i++) { + andflag &= IM->Flag[i]; + orflag |= IM->Flag[i]; + } + + /* It is possible there will be data in the buffer arising from + * calls like 'glNormal', 'glMaterial' that occur after the final + * glVertex, glEval, etc. Additionally, a buffer can consist of + * only a single glMaterial call, in which case IM->Start == + * IM->Count, but the buffer is definitely not empty. + */ + if (IM->Flag[i] & VERT_DATA) { + IM->LastData++; + orflag |= IM->Flag[i]; + } + + IM->Flag[IM->LastData+1] |= VERT_END_VB; + IM->CopyAndFlag = IM->AndFlag = andflag; + IM->CopyOrFlag = IM->OrFlag = orflag; +} + + + + + +/* Note: The 'start' member of the GLvector structs is now redundant + * because we always re-transform copied vertices, and the vectors + * below are set up so that the first copied vertex (if any) appears + * at position zero. + */ +static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + struct vertex_arrays *tmp = &tnl->imm_inputs; + GLuint inputs = tnl->pipeline.inputs; /* for copy-to-current */ + GLuint start = IM->CopyStart; + GLuint count = IM->Count - start; + + /* TODO: optimize the case where nothing has changed. (Just bind + * tmp to vb). + */ + + /* Setup constant data in the VB. + */ + VB->Count = count; + VB->FirstClipped = IMM_MAXDATA - IM->CopyStart; + VB->import_data = 0; + VB->importable_data = 0; + + /* Need an IM->FirstPrimitive? + */ + VB->Primitive = IM->Primitive + IM->CopyStart; + VB->PrimitiveLength = IM->PrimitiveLength + IM->CopyStart; + VB->FirstPrimitive = 0; + + VB->Flag = IM->Flag + start; + + /* TexCoordPtr's are zeroed in loop below. + */ + VB->NormalPtr = 0; + VB->NormalLengthPtr = 0; + VB->FogCoordPtr = 0; + VB->EdgeFlagPtr = 0; + VB->IndexPtr[0] = 0; + VB->IndexPtr[1] = 0; + VB->ColorPtr[0] = 0; + VB->ColorPtr[1] = 0; + VB->SecondaryColorPtr[0] = 0; + VB->SecondaryColorPtr[1] = 0; + VB->Elts = 0; + VB->MaterialMask = 0; + VB->Material = 0; + +/* _tnl_print_vert_flags("copy-orflag", IM->CopyOrFlag); */ +/* _tnl_print_vert_flags("orflag", IM->OrFlag); */ +/* _tnl_print_vert_flags("inputs", inputs); */ + + /* Setup the initial values of array pointers in the vb. + */ + if (inputs & VERT_OBJ) { + tmp->Obj.data = IM->Obj + start; + tmp->Obj.start = (GLfloat *)(IM->Obj + start); + tmp->Obj.count = count; + VB->ObjPtr = &tmp->Obj; + if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_234) + tmp->Obj.size = 4; + else if ((IM->CopyOrFlag & VERT_OBJ_234) == VERT_OBJ_23) + tmp->Obj.size = 3; + else + tmp->Obj.size = 2; + } + + if (inputs & VERT_NORM) { + tmp->Normal.data = IM->Normal + start; + tmp->Normal.start = (GLfloat *)(IM->Normal + start); + tmp->Normal.count = count; + VB->NormalPtr = &tmp->Normal; + if (IM->NormalLengths) + VB->NormalLengthPtr = IM->NormalLengths + start; + } + + if (inputs & VERT_INDEX) { + tmp->Index.count = count; + tmp->Index.data = IM->Index + start; + tmp->Index.start = IM->Index + start; + VB->IndexPtr[0] = &tmp->Index; + } + + if (inputs & VERT_FOG_COORD) { + tmp->FogCoord.data = IM->FogCoord + start; + tmp->FogCoord.start = IM->FogCoord + start; + tmp->FogCoord.count = count; + VB->FogCoordPtr = &tmp->FogCoord; + } + + if (inputs & VERT_SPEC_RGB) { + tmp->SecondaryColor.data = IM->SecondaryColor + start; + tmp->SecondaryColor.start = (GLubyte *)(IM->SecondaryColor + start); + tmp->SecondaryColor.count = count; + VB->SecondaryColorPtr[0] = &tmp->SecondaryColor; + } + + if (inputs & VERT_EDGE) { + tmp->EdgeFlag.data = IM->EdgeFlag + start; + tmp->EdgeFlag.start = IM->EdgeFlag + start; + tmp->EdgeFlag.count = count; + VB->EdgeFlagPtr = &tmp->EdgeFlag; + } + + if (inputs & VERT_RGBA) { + tmp->Color.data = IM->Color + start; + tmp->Color.start = (GLubyte *)(IM->Color + start); + tmp->Color.count = count; + VB->ColorPtr[0] = &tmp->Color; + } + + if (inputs & VERT_TEX_ANY) { + GLuint i; + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { + VB->TexCoordPtr[i] = 0; + if (inputs & VERT_TEX(i)) { + tmp->TexCoord[i].count = count; + tmp->TexCoord[i].data = IM->TexCoord[i] + start; + tmp->TexCoord[i].start = (GLfloat *)(IM->TexCoord[i] + start); + tmp->TexCoord[i].size = 2; + if (IM->TexSize & i) { + tmp->TexCoord[i].size = 3; + if (IM->TexSize & (i<<16)) + tmp->TexCoord[i].size = 4; + } + VB->TexCoordPtr[i] = &tmp->TexCoord[i]; + } + } + } + + if ((inputs & VERT_MATERIAL) && IM->Material) { + VB->MaterialMask = IM->MaterialMask + start; + VB->Material = IM->Material + start; + } +} + + + + +/* Called by exec_cassette and execute_compiled_cassette. + */ +void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + _tnl_vb_bind_immediate( ctx, IM ); + + if (IM->CopyOrFlag & VERT_EVAL_ANY) + _tnl_eval_vb( ctx, + IM->Obj + IM->CopyStart, + IM->CopyOrFlag, + IM->CopyAndFlag ); + + + /* Invalidate all stored data before and after run: + */ + tnl->pipeline.run_input_changes |= tnl->pipeline.inputs; + _tnl_run_pipeline( ctx ); + tnl->pipeline.run_input_changes |= tnl->pipeline.inputs; + + copy_to_current( ctx, IM, IM->OrFlag ); +} + + + + +/* Called for pure, locked VERT_ELT cassettes instead of + * _tnl_run_cassette. + */ +static void exec_elt_cassette( GLcontext *ctx, struct immediate *IM ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + + _tnl_vb_bind_arrays( ctx, ctx->Array.LockFirst, ctx->Array.LockCount ); + + VB->Elts = IM->Elt + IM->CopyStart; + VB->Primitive = IM->Primitive + IM->CopyStart; + VB->PrimitiveLength = IM->PrimitiveLength + IM->CopyStart; + VB->FirstPrimitive = 0; + + /* Run the pipeline. No input changes as a result of this action. + */ + _tnl_run_pipeline( ctx ); + + /* Still need to update current values: (TODO - copy from VB) + * TODO: delay this until FlushVertices + */ + if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { + _tnl_translate_array_elts( ctx, IM, IM->LastData, IM->LastData ); + copy_to_current( ctx, IM, ctx->Array._Enabled ); + } +} + +/* Called for cassettes where CopyStart == Count -- no need to run the + * pipeline. + */ +static void exec_empty_cassette( GLcontext *ctx, struct immediate *IM ) +{ + GLuint start = IM->CopyStart; + + if (IM->OrFlag & VERT_ELT) + _tnl_translate_array_elts( ctx, IM, start, start ); + + _tnl_fixup_input( ctx, IM ); /* shouldn't be needed? (demos/fire) */ + copy_to_current( ctx, IM, IM->OrFlag ); + + if (IM->OrFlag & VERT_MATERIAL) + gl_update_material( ctx, IM->Material[start], IM->MaterialMask[start] ); + + if (IM->OrFlag & VERT_RGBA) + if (ctx->Light.ColorMaterialEnabled) + gl_update_color_material( ctx, ctx->Current.Color ); +} + + +/* Called for regular vertex cassettes. + */ +static void exec_vert_cassette( GLcontext *ctx, struct immediate *IM ) +{ + if (IM->OrFlag & VERT_ELT) { + GLuint andflag = ~0; + GLuint i; + GLuint start = IM->FlushElt ? IM->LastPrimitive : IM->CopyStart; + _tnl_translate_array_elts( ctx, IM, start, IM->Count ); + + /* Need to recompute andflag. + */ + if (IM->CopyAndFlag & VERT_ELT) + IM->CopyAndFlag |= ctx->Array._Enabled; + else { + for (i = IM->CopyStart ; i < IM->Count ; i++) + andflag &= IM->Flag[i]; + IM->CopyAndFlag = andflag; + } + } + + _tnl_fixup_input( ctx, IM ); +/* _tnl_print_cassette( IM ); */ + _tnl_run_cassette( ctx, IM ); +} + + + +/* Called for all cassettes when not compiling or playing a display + * list. + */ +void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + ASSERT(tnl->ExecCopySource == IM); + + _tnl_compute_orflag( IM ); + + /* Mark the last primitive: + */ + IM->PrimitiveLength[IM->LastPrimitive] = IM->Count - IM->LastPrimitive; + ASSERT(IM->Primitive[IM->LastPrimitive] & PRIM_LAST); + + + if (tnl->pipeline.build_state_changes) + _tnl_validate_pipeline( ctx ); + + _tnl_get_exec_copy_verts( ctx, IM ); + + if (IM->CopyStart == IM->Count) { + exec_empty_cassette( ctx, IM ); + } + else if ((IM->OrFlag & VERT_DATA) == VERT_ELT && + ctx->Array.LockCount && + ctx->Array.Vertex.Enabled) { + exec_elt_cassette( ctx, IM ); + } + else { + exec_vert_cassette( ctx, IM ); + } + + _tnl_reset_input( ctx, + IMM_MAX_COPIED_VERTS, + IM->BeginState & (VERT_BEGIN_0|VERT_BEGIN_1), + IM->SavedBeginState ); + + /* Copy vertices and primitive information to immediate before it + * can be overwritten. + */ + _tnl_copy_immediate_vertices( ctx, IM ); + +/* if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) */ +/* ctx->Driver.NeedFlush &= ~FLUSH_STORED_VERTICES; */ +} + + + + +/* Setup vector pointers that will be used to bind immediates to VB's. + */ +void _tnl_imm_init( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_arrays *tmp = &tnl->imm_inputs; + GLuint i; + static int firsttime = 1; + + if (firsttime) { + firsttime = 0; + _tnl_imm_elt_init(); + } + + ctx->swtnl_im = _tnl_alloc_immediate( ctx ); + TNL_CURRENT_IM(ctx)->ref_count++; + + tnl->ExecCopyTexSize = 0; + tnl->ExecCopyCount = 0; + tnl->ExecCopySource = TNL_CURRENT_IM(ctx); + TNL_CURRENT_IM(ctx)->ref_count++; + TNL_CURRENT_IM(ctx)->CopyStart = IMM_MAX_COPIED_VERTS; + + gl_vector4f_init( &tmp->Obj, 0, 0 ); + gl_vector3f_init( &tmp->Normal, 0, 0 ); + gl_vector4ub_init( &tmp->Color, 0, 0 ); + gl_vector4ub_init( &tmp->SecondaryColor, 0, 0 ); + gl_vector1f_init( &tmp->FogCoord, 0, 0 ); + gl_vector1ui_init( &tmp->Index, 0, 0 ); + gl_vector1ub_init( &tmp->EdgeFlag, 0, 0 ); + + for (i = 0; i < ctx->Const.MaxTextureUnits; i++) + gl_vector4f_init( &tmp->TexCoord[i], 0, 0); + + /* Install the first immediate. Intially outside begin/end. + */ + _tnl_reset_input( ctx, IMM_MAX_COPIED_VERTS, 0, 0 ); + tnl->ReplayHardBeginEnd = 0; + + _tnl_imm_vtxfmt_init( ctx ); +} + + +void _tnl_imm_destroy( GLcontext *ctx ) +{ + if (TNL_CURRENT_IM(ctx)) + _tnl_free_immediate( TNL_CURRENT_IM(ctx) ); + +} diff --git a/src/mesa/tnl/t_imm_exec.h b/src/mesa/tnl/t_imm_exec.h new file mode 100644 index 00000000000..3a7284ccfd8 --- /dev/null +++ b/src/mesa/tnl/t_imm_exec.h @@ -0,0 +1,62 @@ +/* $Id: t_imm_exec.h,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef _T_VBXFORM_H +#define _T_VBXFORM_H + +#include "mtypes.h" +#include "t_context.h" + + +/* Hook for ctx->Driver.FlushVertices: + */ +extern void _tnl_flush_vertices( GLcontext *ctx, GLuint flush_flags ); + +/* Called from imm_api.c and _tnl_flush_vertices: + */ +extern void _tnl_flush_immediate( struct immediate *IM ); + +/* Called from imm_dlist.c and _tnl_flush_immediate: + */ +extern void _tnl_run_cassette( GLcontext *ctx, struct immediate *IM ); + +/* Initialize some stuff: + */ +extern void _tnl_imm_init( GLcontext *ctx ); + +extern void _tnl_imm_destroy( GLcontext *ctx ); + +extern void _tnl_reset_input( GLcontext *ctx, + GLuint start, + GLuint beginstate, + GLuint savedbeginstate ); + +extern void _tnl_compute_orflag( struct immediate *IM ); +extern void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM ); + + +#endif diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c new file mode 100644 index 00000000000..d55ab48c56d --- /dev/null +++ b/src/mesa/tnl/t_imm_fixup.c @@ -0,0 +1,811 @@ +/* $Id: t_imm_fixup.c,v 1.1 2000/12/26 05:09:32 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * Authors: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "context.h" +#include "enums.h" +#include "dlist.h" +#include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "state.h" +#include "texture.h" +#include "mtypes.h" + +#include "math/m_matrix.h" +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_imm_alloc.h" +#include "t_imm_debug.h" +#include "t_imm_fixup.h" +#include "t_pipeline.h" + + + +static void +fixup_4f( GLfloat data[][4], GLuint flag[], GLuint start, GLuint match ) +{ + GLuint i = start; + + for (;;) { + if ((flag[++i] & match) == 0) { + COPY_4FV(data[i], data[i-1]); + if (flag[i] & VERT_END_VB) break; + } + } +} + +static void +fixup_3f( float data[][3], GLuint flag[], GLuint start, GLuint match ) +{ + GLuint i = start; + + for (;;) { + if ((flag[++i] & match) == 0) { + COPY_3V(data[i], data[i-1]); + if (flag[i] & VERT_END_VB) break; + } + } +} + + +static void +fixup_1ui( GLuint *data, GLuint flag[], GLuint start, GLuint match ) +{ + GLuint i = start; + + for (;;) { + if ((flag[++i] & match) == 0) { + data[i] = data[i-1]; + if (flag[i] & VERT_END_VB) break; + } + } + flag[i] |= match; +} + + +static void +fixup_1f( GLfloat *data, GLuint flag[], GLuint start, GLuint match ) +{ + GLuint i = start; + + for (;;) { + if ((flag[++i] & match) == 0) { + data[i] = data[i-1]; + if (flag[i] & VERT_END_VB) break; + } + } + flag[i] |= match; +} + +static void +fixup_1ub( GLubyte *data, GLuint flag[], GLuint start, GLuint match ) +{ + GLuint i = start; + + for (;;) { + if ((flag[++i] & match) == 0) { + data[i] = data[i-1]; + if (flag[i] & VERT_END_VB) break; + } + } + flag[i] |= match; +} + + +static void +fixup_4ub( GLubyte data[][4], GLuint flag[], GLuint start, GLuint match ) +{ + GLuint i = start; + + for (;;) { + if ((flag[++i] & match) == 0) { + COPY_4UBV(data[i], data[i-1]); + if (flag[i] & VERT_END_VB) break; + } + } + flag[i] |= match; +} + + +static void +fixup_first_4f( GLfloat data[][4], GLuint flag[], GLuint match, + GLuint start, GLfloat *dflt ) +{ + GLuint i = start-1; + match |= VERT_END_VB; + + while ((flag[++i]&match) == 0) + COPY_4FV(data[i], dflt); +} + +static void +fixup_first_3f( GLfloat data[][3], GLuint flag[], GLuint match, + GLuint start, GLfloat *dflt ) +{ + GLuint i = start-1; + match |= VERT_END_VB; + + while ((flag[++i]&match) == 0) + COPY_3FV(data[i], dflt); +} + + +static void +fixup_first_1ui( GLuint data[], GLuint flag[], GLuint match, + GLuint start, GLuint dflt ) +{ + GLuint i = start-1; + match |= VERT_END_VB; + + while ((flag[++i]&match) == 0) + data[i] = dflt; +} + +static void +fixup_first_1f( GLfloat data[], GLuint flag[], GLuint match, + GLuint start, GLfloat dflt ) +{ + GLuint i = start-1; + match |= VERT_END_VB; + + while ((flag[++i]&match) == 0) + data[i] = dflt; +} + + +static void +fixup_first_1ub( GLubyte data[], GLuint flag[], GLuint match, + GLuint start, GLubyte dflt ) +{ + GLuint i = start-1; + match |= VERT_END_VB; + + while ((flag[++i]&match) == 0) + data[i] = dflt; +} + + +static void +fixup_first_4ub( GLubyte data[][4], GLuint flag[], GLuint match, + GLuint start, GLubyte dflt[4] ) +{ + GLuint i = start-1; + match |= VERT_END_VB; + + while ((flag[++i]&match) == 0) + COPY_4UBV(data[i], dflt); +} + + +void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint start = IM->CopyStart; + GLuint andflag = IM->CopyAndFlag; + GLuint orflag = IM->CopyOrFlag; + GLuint fixup; + + IM->CopyTexSize = IM->TexSize; + +/* fprintf(stderr, "Fixup input, Start: %u Count: %u LastData: %u\n", */ +/* IM->Start, IM->Count, IM->LastData); */ +/* _tnl_print_vert_flags("Orflag", orflag); */ +/* _tnl_print_vert_flags("Andflag", andflag); */ + + + fixup = ~andflag & VERT_FIXUP; + + if (!ctx->CompileFlag) + fixup &= tnl->pipeline.inputs; + + if (!ctx->ExecuteFlag) + fixup &= orflag; + + if ((orflag & (VERT_OBJ|VERT_EVAL_ANY)) == 0) + fixup = 0; + + if (fixup) { + GLuint copy = fixup & ~IM->Flag[start]; + + + /* Equivalent to a lazy copy-from-current when setting up the + * immediate. + */ + if (ctx->ExecuteFlag && copy) { +/* _tnl_print_vert_flags("copy from current", copy); */ + + if (copy & VERT_NORM) { + COPY_3V( IM->Normal[start], ctx->Current.Normal ); + } + + if (copy & VERT_RGBA) { + COPY_4UBV( IM->Color[start], ctx->Current.Color); + } + + if (copy & VERT_SPEC_RGB) + COPY_4UBV( IM->SecondaryColor[start], ctx->Current.SecondaryColor); + + if (copy & VERT_FOG_COORD) + IM->FogCoord[start] = ctx->Current.FogCoord; + + if (copy & VERT_INDEX) + IM->Index[start] = ctx->Current.Index; + + if (copy & VERT_EDGE) + IM->EdgeFlag[start] = ctx->Current.EdgeFlag; + + if (copy & VERT_TEX_ANY) { + GLuint i; + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { + if (copy & VERT_TEX(i)) + COPY_4FV( IM->TexCoord[i][start], ctx->Current.Texcoord[i] ); + } + } + } + + if (MESA_VERBOSE&VERBOSE_IMMEDIATE) +/* _tnl_print_vert_flags("fixup", fixup); */ + + if (fixup & VERT_TEX_ANY) { + GLuint i; + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { + if (fixup & VERT_TEX(i)) { + if (orflag & VERT_TEX(i)) + fixup_4f( IM->TexCoord[i], IM->Flag, start, VERT_TEX(i) ); + else + fixup_first_4f( IM->TexCoord[i], IM->Flag, VERT_END_VB, start, + IM->TexCoord[i][start]); + } + } + } + } + + if (fixup & VERT_EDGE) { + if (orflag & VERT_EDGE) + fixup_1ub( IM->EdgeFlag, IM->Flag, start, VERT_EDGE ); + else + fixup_first_1ub( IM->EdgeFlag, IM->Flag, VERT_END_VB, start, + IM->EdgeFlag[start] ); + } + + if (fixup & VERT_INDEX) { + if (orflag & VERT_INDEX) + fixup_1ui( IM->Index, IM->Flag, start, VERT_INDEX ); + else + fixup_first_1ui( IM->Index, IM->Flag, VERT_END_VB, start, IM->Index[start] ); + } + + if (fixup & VERT_RGBA) { + if (orflag & VERT_RGBA) + fixup_4ub( IM->Color, IM->Flag, start, VERT_RGBA ); + else + fixup_first_4ub( IM->Color, IM->Flag, VERT_END_VB, start, IM->Color[start] ); + } + + if (fixup & VERT_SPEC_RGB) { + if (orflag & VERT_SPEC_RGB) + fixup_4ub( IM->SecondaryColor, IM->Flag, start, VERT_SPEC_RGB ); + else + fixup_first_4ub( IM->SecondaryColor, IM->Flag, VERT_END_VB, start, + IM->SecondaryColor[start] ); + } + + if (fixup & VERT_FOG_COORD) { + if (orflag & VERT_FOG_COORD) + fixup_1f( IM->FogCoord, IM->Flag, start, VERT_FOG_COORD ); + else + fixup_first_1f( IM->FogCoord, IM->Flag, VERT_END_VB, start, + IM->FogCoord[start] ); + } + + if (fixup & VERT_NORM) { + if (orflag & VERT_NORM) + fixup_3f( IM->Normal, IM->Flag, start, VERT_NORM ); + else + fixup_first_3f( IM->Normal, IM->Flag, VERT_END_VB, start, + IM->Normal[start] ); + } + + /* Prune possible half-filled slot. + */ + IM->Flag[IM->LastData+1] &= ~VERT_END_VB; + IM->Flag[IM->Count] |= VERT_END_VB; + +} + + + + +static void copy_material( struct immediate *next, + struct immediate *prev, + GLuint dst, GLuint src ) +{ + if (next->Material == 0) { + next->Material = (GLmaterial (*)[2]) MALLOC( sizeof(GLmaterial) * + IMM_SIZE * 2 ); + next->MaterialMask = (GLuint *) MALLOC( sizeof(GLuint) * IMM_SIZE ); + } + + next->MaterialMask[dst] = prev->MaterialMask[src]; + MEMCPY(next->Material[dst], prev->Material[src], 2*sizeof(GLmaterial)); +} + + + +/* Copy the untransformed data from the shared vertices of a primitive + * that wraps over two immediate structs. This is done prior to + * set_immediate so that prev and next may point to the same + * structure. In general it's difficult to avoid this copy on long + * primitives. + * + * Have to be careful with the transitions between display list + * replay, compile and normal execute modes. + */ +static void copy_vertices( GLcontext *ctx, + struct immediate *next, + struct immediate *prev, + GLuint count, + GLuint *elts ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint offset = IMM_MAX_COPIED_VERTS - count; + GLuint i; + + next->CopyStart = next->Start - count; + + /* Copy the vertices + */ + for (i = 0 ; i < count ; i++) + { + GLuint src = elts[i+offset]; + GLuint dst = next->CopyStart+i; + + COPY_4FV( next->Obj[dst], prev->Obj[src] ); + COPY_3FV( next->Normal[dst], prev->Normal[src] ); + COPY_4UBV( next->Color[dst], prev->Color[src] ); + + if (prev->OrFlag & VERT_TEX_ANY) { + GLuint i; + for (i = 0 ; i < prev->MaxTextureUnits ; i++) { + if (prev->OrFlag & VERT_TEX(i)) + COPY_4FV( next->TexCoord[i][dst], prev->TexCoord[i][src] ); + } + } + + if (prev->Flag[src] & VERT_MATERIAL) + copy_material(next, prev, dst, src); + + next->Elt[dst] = prev->Elt[src]; + next->EdgeFlag[dst] = prev->EdgeFlag[src]; + next->Index[dst] = prev->Index[src]; + COPY_4UBV( next->SecondaryColor[dst], prev->SecondaryColor[src] ); + next->FogCoord[dst] = prev->FogCoord[src]; + next->Flag[dst] = (prev->CopyOrFlag & VERT_FIXUP); + next->CopyOrFlag |= prev->Flag[src]; /* redundant for current_im */ + next->CopyAndFlag &= prev->Flag[src]; /* redundant for current_im */ + } + + /* Only needed when copying to a compiled cassette + */ + if (next->NormalLengths) { + for (i = 0 ; i < count ; i++) + { + GLuint src = elts[i+offset]; + GLuint dst = next->CopyStart+i; + + if (prev->NormalLengths) + next->NormalLengths[dst] = prev->NormalLengths[src]; + else + next->NormalLengths[dst] = 1.0/LEN_3FV(prev->Normal[src]); + } + } + + ASSERT(prev == tnl->ExecCopySource); + if (--tnl->ExecCopySource->ref_count == 0) + _tnl_free_immediate( tnl->ExecCopySource ); + + next->ref_count++; + tnl->ExecCopySource = next; + tnl->ExecCopyElts[0] = next->Start-3; + tnl->ExecCopyElts[1] = next->Start-2; + tnl->ExecCopyElts[2] = next->Start-1; +} + +/* Copy vertices to an empty immediate struct. + */ +void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *IM ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + ASSERT(IM == TNL_CURRENT_IM(ctx)); + ASSERT(IM->Count == IM->Start); + + /* Need to push this in now as it won't be computed anywhere else/ + */ + IM->TexSize = tnl->ExecCopyTexSize; + + /* A wrapped primitive. We may be copying into a revived + * display list immediate, or onto the front of a new execute-mode + * immediate. + */ + copy_vertices( ctx, IM, + tnl->ExecCopySource, + tnl->ExecCopyCount, + tnl->ExecCopyElts ); + + if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { + /* Immediates are built by default to be correct in this state, + * and copying to the first slots of an immediate doesn't remove + * this property. + */ + ASSERT(tnl->ExecCopyTexSize == 0); + ASSERT(tnl->ExecCopyCount == 0); + ASSERT(IM->CopyStart == IM->Start); + } + + /* Copy the primitive information: + */ + IM->Primitive[IM->CopyStart] = (ctx->Driver.CurrentExecPrimitive | PRIM_LAST); + IM->LastPrimitive = IM->CopyStart; + if (tnl->ExecParity) + IM->Primitive[IM->CopyStart] |= PRIM_PARITY; +} + + +/* Revive a compiled immediate struct - propogate new 'Current' + * values. Often this is redundant because the current values were + * known and fixed up at compile time. + */ +void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint fixup; + GLuint count = IM->Count; + GLuint start = IM->Start; + + if (count == start) + return; + + IM->CopyOrFlag = IM->OrFlag; /* redundant for current_im */ + IM->CopyAndFlag = IM->AndFlag; /* redundant for current_im */ + IM->CopyTexSize = IM->TexSize | tnl->ExecCopyTexSize; + + copy_vertices( ctx, IM, + tnl->ExecCopySource, + tnl->ExecCopyCount, + tnl->ExecCopyElts ); + + if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { + ASSERT(tnl->ExecCopyTexSize == 0); + ASSERT(tnl->ExecCopyCount == 0); + ASSERT(IM->CopyStart == IM->Start); + } + + fixup = tnl->pipeline.inputs & ~IM->Flag[start] & VERT_FIXUP; + + if (fixup) { + if (fixup & VERT_TEX_ANY) { + GLuint i; + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { + if (fixup & VERT_TEX(i)) + fixup_first_4f( IM->TexCoord[i], IM->Flag, VERT_TEX(i), start, + ctx->Current.Texcoord[i] ); + } + } + + if (fixup & VERT_EDGE) + fixup_first_1ub(IM->EdgeFlag, IM->Flag, VERT_EDGE, start, + ctx->Current.EdgeFlag ); + + if (fixup & VERT_INDEX) + fixup_first_1ui(IM->Index, IM->Flag, VERT_INDEX, start, + ctx->Current.Index ); + + if (fixup & VERT_RGBA) + fixup_first_4ub(IM->Color, IM->Flag, VERT_RGBA, start, + ctx->Current.Color ); + + if (fixup & VERT_SPEC_RGB) + fixup_first_4ub(IM->SecondaryColor, IM->Flag, VERT_SPEC_RGB, start, + ctx->Current.SecondaryColor ); + + if (fixup & VERT_FOG_COORD) + fixup_first_1f(IM->FogCoord, IM->Flag, VERT_FOG_COORD, start, + ctx->Current.FogCoord ); + + if (fixup & VERT_NORM) { + fixup_first_3f(IM->Normal, IM->Flag, VERT_NORM, start, + ctx->Current.Normal ); + if (IM->NormalLengths) + fixup_first_1f(IM->NormalLengths, IM->Flag, VERT_NORM, start, + 1.0F / (GLfloat) LEN_3FV(ctx->Current.Normal) ); + } + } + + + /* Can potentially overwrite primitive details - need to save the + * first slot: + */ + tnl->DlistPrimitive = IM->Primitive[IM->Start]; + tnl->DlistPrimitiveLength = IM->PrimitiveLength[IM->Start]; + tnl->DlistLastPrimitive = IM->LastPrimitive; + + /* The first primitive may be different from what was recorded in + * the immediate struct. Consider an immediate that starts with a + * glBegin, compiled in a display list, which is called from within + * an existing Begin/End object. + */ + if (ctx->Driver.CurrentExecPrimitive == GL_POLYGON+1) { + GLuint i; + + if (IM->BeginState & VERT_ERROR_1) + gl_error( ctx, GL_INVALID_OPERATION, "begin/end"); + + for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i]) + if (IM->Flag[i] & (VERT_BEGIN|VERT_END_VB)) + break; + + /* Would like to just ignore vertices upto this point. Can't + * set copystart because it might skip materials? + */ + ASSERT(IM->Start == IM->CopyStart); + if (i > IM->CopyStart) { + IM->Primitive[IM->CopyStart] = GL_POLYGON+1; + IM->PrimitiveLength[IM->CopyStart] = i - IM->CopyStart; + if (IM->Flag[i] & VERT_END_VB) { + IM->Primitive[IM->CopyStart] |= PRIM_LAST; + IM->LastPrimitive = IM->CopyStart; + } + } + /* Shouldn't immediates be set up to have this structure *by default*? + */ + } else { + GLuint i; + + if (IM->BeginState & VERT_ERROR_0) + gl_error( ctx, GL_INVALID_OPERATION, "begin/end"); + + if (IM->CopyStart == IM->Start && + IM->Flag[IM->Start] & (VERT_END|VERT_END_VB)) + { + } + else + { + IM->Primitive[IM->CopyStart] = ctx->Driver.CurrentExecPrimitive; + if (tnl->ExecParity) + IM->Primitive[IM->CopyStart] |= PRIM_PARITY; + + + for (i = IM->Start ; i <= IM->Count ; i += IM->PrimitiveLength[i]) + if (IM->Flag[i] & (VERT_END|VERT_END_VB)) { + IM->PrimitiveLength[IM->CopyStart] = i - IM->CopyStart; + if (IM->Flag[i] & VERT_END_VB) { + IM->Primitive[IM->CopyStart] |= PRIM_LAST; + IM->LastPrimitive = IM->CopyStart; + } + if (IM->Flag[i] & VERT_END) { + IM->Primitive[IM->CopyStart] |= PRIM_END; + } + break; + } + } + } + + if (IM->Primitive[IM->LastPrimitive] & PRIM_END) + ctx->Driver.CurrentExecPrimitive = GL_POLYGON+1; + else + ctx->Driver.CurrentExecPrimitive = + IM->Primitive[IM->LastPrimitive] & PRIM_MODE_MASK; +} + + +/* Undo any changes potentially made to the immediate in the range + * IM->Start..IM->Count above. + */ +void _tnl_restore_compiled_cassette( GLcontext *ctx, struct immediate *IM ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + IM->Primitive[IM->Start] = tnl->DlistPrimitive; + IM->PrimitiveLength[IM->Start] = tnl->DlistPrimitiveLength; +} + + + + + + +static void copy_none( TNLcontext *tnl, GLuint start, GLuint count, GLuint ovf) +{ + (void) (start && ovf && tnl && count); +} + +static void copy_last( TNLcontext *tnl, GLuint start, GLuint count, GLuint ovf) +{ + (void) start; (void) ovf; + tnl->ExecCopyCount = 1; + tnl->ExecCopyElts[2] = count-1; +} + +static void copy_first_and_last( TNLcontext *tnl, GLuint start, GLuint count, + GLuint ovf) +{ + (void) ovf; + tnl->ExecCopyCount = 2; + tnl->ExecCopyElts[1] = start; + tnl->ExecCopyElts[2] = count-1; +} + +static void copy_last_two( TNLcontext *tnl, GLuint start, GLuint count, + GLuint ovf ) +{ + (void) start; + tnl->ExecCopyCount = 2+ovf; + tnl->ExecCopyElts[0] = count-3; + tnl->ExecCopyElts[1] = count-2; + tnl->ExecCopyElts[2] = count-1; +} + +static void copy_overflow( TNLcontext *tnl, GLuint start, GLuint count, + GLuint ovf ) +{ + (void) start; + tnl->ExecCopyCount = ovf; + tnl->ExecCopyElts[0] = count-3; + tnl->ExecCopyElts[1] = count-2; + tnl->ExecCopyElts[2] = count-1; +} + + +typedef void (*copy_func)( TNLcontext *tnl, GLuint start, GLuint count, + GLuint ovf ); + +static copy_func copy_tab[GL_POLYGON+2] = +{ + copy_none, + copy_overflow, + copy_first_and_last, + copy_last, + copy_overflow, + copy_last_two, + copy_first_and_last, + copy_overflow, + copy_last_two, + copy_first_and_last, + copy_none +}; + + + + + +/* Figure out what vertices need to be copied next time. + */ +void +_tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ) +{ + static const GLuint increment[GL_POLYGON+2] = { 1,2,1,1,3,1,1,4,2,1,1 }; + static const GLuint intro[GL_POLYGON+2] = { 0,0,2,2,0,2,2,0,2,2,0 }; + + TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint last = IM->LastPrimitive; + GLuint prim = ctx->Driver.CurrentExecPrimitive; + GLuint pincr = increment[prim]; + GLuint pintro = intro[prim]; + GLuint ovf = 0; + + + if (tnl->ExecCopySource != IM) { + if (--tnl->ExecCopySource->ref_count == 0) + _tnl_free_immediate( tnl->ExecCopySource ); + IM->ref_count++; + tnl->ExecCopySource = IM; + } + + if (prim == GL_POLYGON+1) { + tnl->ExecCopyCount = 0; + tnl->ExecCopyTexSize = 0; + tnl->ExecParity = 0; + } else { + tnl->ExecCopyCount = 0; + tnl->ExecCopyTexSize = IM->CopyTexSize; + tnl->ExecParity = IM->PrimitiveLength[IM->LastPrimitive] & 1; + + if (pincr != 1 && (IM->Count - last - pintro)) + ovf = (IM->Count - last - pintro) % pincr; + + if (last < IM->Count) + copy_tab[prim]( tnl, last, IM->Count, ovf ); + } +} + + +/* If we receive evalcoords in an immediate struct for maps which + * don't have a vertex enabled, need to do an additional fixup, as + * those rows containing evalcoords must now be ignored. The + * evalcoords may still generate colors, normals, etc, so have to + * respect the relative order between calls to EvalCoord and Normal + * etc. + * + * Generate the index list that will be used to render this immediate + * struct. + * + * Finally, generate a new primitives list for rendering the indices. + */ +#if 0 +void _tnl_fixup_purged_eval( GLcontext *ctx, + GLuint fixup, GLuint purge ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct tnl_eval_store *store = &tnl->eval; + GLuint *flags = tnl->vb.Flag; + GLuint i, j, nextprim; + GLuint fixup_fence = purge|VERT_OBJ; + GLuint good_index = (VERT_EVAL_ANY & ~purge)|VERT_OBJ; + GLuint prim_length = 0, lastprim = 0, nextprim = 0; + + if (fixup & VERT_TEX0) + fixup_4f( store->TexCoord, flags, 0, VERT_TEX0|fixup_fence ); + + if (fixup & VERT_INDEX) + fixup_1ui( store->Index, flags, 0, VERT_INDEX|fixup_fence ); + + if (fixup & VERT_RGBA) + fixup_4ub( store->Color, flags, 0, VERT_RGBA|fixup_fence ); + + if (fixup & VERT_NORM) + fixup_3f( store->Normal, flags, 0, VERT_NORM|fixup_fence ); + + for (i = 0, j = 0 ; i < tnl->vb.Count ; i++) { + if (flags[i] & good_index) { + store->Elts[j++] = i; + prim_length++; + } + if (i == nextprim) { + VB->PrimitiveLength[lastprim] = prim_length; + VB->Primitive[j] = VB->Primitive[i]; + nextprim += lastprimlen; + lastprim = i; + lastprimlen = VB->PrimitiveLength[i]; + } + } + + VB->Elts = store->Elts; + + /* What about copying??? No immediate exists with the right + * vertices in place... + */ + if (tnl->CurrentPrimitive != GL_POLYGON+1) { + } +} +#endif diff --git a/src/mesa/tnl/t_imm_fixup.h b/src/mesa/tnl/t_imm_fixup.h new file mode 100644 index 00000000000..a6740a2a55b --- /dev/null +++ b/src/mesa/tnl/t_imm_fixup.h @@ -0,0 +1,52 @@ +/* $Id: t_imm_fixup.h,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef _T_IMM_FIXUP_H +#define _T_IMM_FIXUP_H + +#include "mtypes.h" +#include "t_context.h" + + + +extern void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ); + +extern void _tnl_fixup_compiled_cassette( GLcontext *ctx, + struct immediate *IM ); + +extern void _tnl_restore_compiled_cassette( GLcontext *ctx, + struct immediate *IM ); + + +extern void _tnl_fixup_purged_eval( GLcontext *ctx, + GLuint fixup, GLuint purge ); + + +extern void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *IM ); +extern void _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ); + +#endif diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c index 60e375d7530..457b160eb95 100644 --- a/src/mesa/tnl/t_pipeline.c +++ b/src/mesa/tnl/t_pipeline.c @@ -1,4 +1,4 @@ -/* $Id: t_pipeline.c,v 1.6 2000/11/27 09:05:52 joukj Exp $ */ +/* $Id: t_pipeline.c,v 1.7 2000/12/26 05:09:33 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -22,10 +22,9 @@ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* Dynamic pipelines, support for CVA. - * Copyright (C) 1999 Keith Whitwell. + * + * Author: + * Keith Whitwell */ #include "glheader.h" @@ -38,435 +37,165 @@ #include "math/m_translate.h" #include "math/m_xform.h" -#include "t_bbox.h" -#include "t_clip.h" -#include "t_cva.h" -#include "t_debug.h" -#include "t_fog.h" -#include "t_light.h" +#include "t_context.h" #include "t_pipeline.h" -#include "t_shade.h" -#include "t_stages.h" -#include "t_vbcull.h" -#include "t_vbindirect.h" -#include "t_vbrender.h" -#include "t_vbxform.h" - - - - - -void _tnl_print_pipe_ops( const char *msg, GLuint flags ) -{ - fprintf(stderr, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n", - msg, - flags, - (flags & PIPE_OP_CVA_PREPARE) ? "cva-prepare, " : "", - (flags & PIPE_OP_VERT_XFORM) ? "vert-xform, " : "", - (flags & PIPE_OP_NORM_XFORM) ? "norm-xform, " : "", - (flags & PIPE_OP_LIGHT) ? "light, " : "", - (flags & PIPE_OP_FOG) ? "fog, " : "", - (flags & PIPE_OP_TEX) ? "tex-gen/tex-mat, " : "", - (flags & PIPE_OP_RAST_SETUP_0) ? "rast-0, " : "", - (flags & PIPE_OP_RAST_SETUP_1) ? "rast-1, " : "", - (flags & PIPE_OP_RENDER) ? "render, " : ""); - -} - -/* Have to reset only those parts of the vb which are being recalculated. - */ -void _tnl_reset_cva_vb( struct vertex_buffer *VB, GLuint stages ) +void _tnl_install_pipeline( GLcontext *ctx, + const struct gl_pipeline_stage **stages ) { - GLcontext *ctx = VB->ctx; TNLcontext *tnl = TNL_CONTEXT(ctx); - - if (MESA_VERBOSE&VERBOSE_PIPELINE) - _tnl_print_pipe_ops( "reset cva vb", stages ); - - if (stages & PIPE_OP_VERT_XFORM) - { - if (VB->ClipOrMask & CLIP_USER_BIT) - MEMSET(VB->UserClipMask, 0, VB->Count); - - VB->ClipOrMask = 0; - VB->ClipAndMask = CLIP_ALL_BITS; - VB->CullMode = 0; - VB->CullFlag[0] = VB->CullFlag[1] = 0; - VB->Culled = 0; - } - - if (stages & PIPE_OP_NORM_XFORM) { - VB->NormalPtr = &tnl->CVA.v.Normal; - } - - if (stages & PIPE_OP_LIGHT) - { - VB->ColorPtr = VB->Color[0] = VB->Color[1] = &tnl->CVA.v.Color; - VB->IndexPtr = VB->Index[0] = VB->Index[1] = &tnl->CVA.v.Index; - } - else if (stages & PIPE_OP_FOG) - { - if (ctx->Light.Enabled) { - VB->Color[0] = VB->LitColor[0]; - VB->Color[1] = VB->LitColor[1]; - VB->Index[0] = VB->LitIndex[0]; - VB->Index[1] = VB->LitIndex[1]; - } else { - VB->Color[0] = VB->Color[1] = &tnl->CVA.v.Color; - VB->Index[0] = VB->Index[1] = &tnl->CVA.v.Index; - } - VB->ColorPtr = VB->Color[0]; - VB->IndexPtr = VB->Index[0]; - } -} - - - - - - -static void pipeline_ctr( struct gl_pipeline *p, GLcontext *ctx, GLuint type ) -{ + struct gl_pipeline *pipe = &tnl->pipeline; GLuint i; - (void) ctx; - - p->state_change = 0; - p->cva_state_change = 0; - p->inputs = 0; - p->outputs = 0; - p->type = type; - p->ops = 0; - - for (i = 0 ; i < _tnl_default_nr_stages ; i++) - p->state_change |= _tnl_default_pipeline[i].state_change; -} - - -void _tnl_pipeline_init( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - - MEMCPY( tnl->PipelineStage, - _tnl_default_pipeline, - sizeof(*_tnl_default_pipeline) * _tnl_default_nr_stages ); - - tnl->NrPipelineStages = _tnl_default_nr_stages; - - pipeline_ctr( &tnl->CVA.elt, ctx, PIPE_IMMEDIATE); - pipeline_ctr( &tnl->CVA.pre, ctx, PIPE_PRECALC ); -} - + ASSERT(pipe->nr_stages == 0); -#define MINIMAL_VERT_DATA (VERT_DATA & ~VERT_EVAL_ANY) + pipe->run_state_changes = ~0; + pipe->run_input_changes = ~0; + pipe->build_state_changes = ~0; + pipe->build_state_trigger = 0; + pipe->inputs = 0; -#define VERT_CURRENT_DATA (VERT_TEX_ANY | \ - VERT_RGBA | \ - VERT_SPEC_RGB | \ - VERT_FOG_COORD | \ - VERT_INDEX | \ - VERT_EDGE | \ - VERT_NORM | \ - VERT_MATERIAL) - -/* Called prior to every recomputation of the CVA precalc data, except where - * the driver is able to calculate the pipeline unassisted. - */ -static void build_full_precalc_pipeline( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct gl_pipeline_stage *pipeline = tnl->PipelineStage; - struct gl_cva *cva = &tnl->CVA; - struct gl_pipeline *pre = &cva->pre; - struct gl_pipeline_stage **stages = pre->stages; - GLuint i; - GLuint newstate = pre->new_state; - GLuint changed_ops = 0; - GLuint oldoutputs = pre->outputs; - GLuint oldinputs = pre->inputs; - GLuint fallback = (VERT_CURRENT_DATA & - ~tnl->_ArraySummary); - GLuint changed_outputs = (tnl->_ArrayNewState | - (fallback & cva->orflag)); - GLuint available = fallback | tnl->_ArrayFlags; - - pre->cva_state_change = 0; - pre->ops = 0; - pre->outputs = 0; - pre->inputs = 0; - pre->forbidden_inputs = 0; - pre->fallback = 0; - - /* KW: Disable data reuse during Mesa reorg. Make this more readable... + /* Create a writeable copy of each stage. */ - newstate = ~0; - - if (tnl->_ArraySummary & VERT_ELT) - cva->orflag &= VERT_MATERIAL; - - cva->orflag &= ~(tnl->_ArraySummary & ~VERT_OBJ_ANY); - available &= ~cva->orflag; - - pre->outputs = available; - pre->inputs = available; - - if (MESA_VERBOSE & VERBOSE_PIPELINE) { - fprintf(stderr, ": Rebuild pipeline\n"); - _tnl_print_vert_flags("orflag", cva->orflag); + for (i = 0 ; i < MAX_PIPELINE_STAGES && stages[i] ; i++) { + MEMCPY( &pipe->stages[i], stages[i], sizeof( **stages )); + pipe->build_state_trigger |= pipe->stages[i].check_state; } - - - /* If something changes in the pipeline, tag all subsequent stages - * using this value for recalcuation. Also used to build the full - * pipeline by setting newstate and newinputs to ~0. - * - * Because all intermediate values are buffered, the new inputs - * are enough to fully specify what needs to be calculated, and a - * single pass identifies all stages requiring recalculation. - */ - for (i = 0 ; i < tnl->NrPipelineStages ; i++) - { - pipeline[i].check(ctx, &pipeline[i]); - - if (pipeline[i].type & PIPE_PRECALC) - { - if ((newstate & pipeline[i].cva_state_change) || - (changed_outputs & pipeline[i].inputs) || - !pipeline[i].inputs) - { - changed_ops |= pipeline[i].ops; - changed_outputs |= pipeline[i].outputs; - pipeline[i].active &= ~PIPE_PRECALC; - - if ((pipeline[i].inputs & ~available) == 0 && - (pipeline[i].ops & pre->ops) == 0) - { - pipeline[i].active |= PIPE_PRECALC; - *stages++ = &pipeline[i]; - } - } - - /* Incompatible with multiple stages structs implementing - * the same stage. - */ - available &= ~pipeline[i].outputs; - pre->outputs &= ~pipeline[i].outputs; - - if (pipeline[i].active & PIPE_PRECALC) { - pre->ops |= pipeline[i].ops; - pre->outputs |= pipeline[i].outputs; - available |= pipeline[i].outputs; - pre->forbidden_inputs |= pipeline[i].pre_forbidden_inputs; - } - } - else if (pipeline[i].active & PIPE_PRECALC) - { - pipeline[i].active &= ~PIPE_PRECALC; - changed_outputs |= pipeline[i].outputs; - changed_ops |= pipeline[i].ops; - } - } - - *stages = 0; - - pre->new_outputs = pre->outputs & (changed_outputs | ~oldoutputs); - pre->new_inputs = pre->inputs & ~oldinputs; - pre->fallback = pre->inputs & fallback; - pre->forbidden_inputs |= pre->inputs & fallback; - - pre->changed_ops = changed_ops; + pipe->nr_stages = i; } -void _tnl_build_precalc_pipeline( GLcontext *ctx ) +void _tnl_destroy_pipeline( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); - struct gl_pipeline *pre = &tnl->CVA.pre; - struct gl_pipeline *elt = &tnl->CVA.elt; - - if (!ctx->Driver.BuildPrecalcPipeline || - !ctx->Driver.BuildPrecalcPipeline( ctx )) - build_full_precalc_pipeline( ctx ); - - pre->data_valid = 0; - pre->pipeline_valid = 1; - elt->pipeline_valid = 0; + GLuint i; - tnl->CVA.orflag = 0; + for (i = 0 ; i < tnl->pipeline.nr_stages ; i++) + tnl->pipeline.stages[i].destroy( &tnl->pipeline.stages[i] ); - if (MESA_VERBOSE&VERBOSE_PIPELINE) - _tnl_print_pipeline( ctx, pre ); + tnl->pipeline.nr_stages = 0; } -static void build_full_immediate_pipeline( GLcontext *ctx ) + +void _tnl_validate_pipeline( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); - struct gl_pipeline_stage *pipeline = tnl->PipelineStage; - struct gl_cva *cva = &tnl->CVA; - struct gl_pipeline *pre = &cva->pre; - struct gl_pipeline *elt = &cva->elt; - struct gl_pipeline_stage **stages = elt->stages; - GLuint i; - GLuint newstate = elt->new_state; - GLuint active_ops = 0; - GLuint available = cva->orflag | MINIMAL_VERT_DATA; + struct gl_pipeline *pipe = &tnl->pipeline; + struct gl_pipeline_stage *stage = pipe->stages; + GLuint newstate = pipe->build_state_changes; GLuint generated = 0; - GLuint is_elt = 0; - - if (pre->data_valid && tnl->CompileCVAFlag) { - is_elt = 1; - active_ops = cva->pre.ops; - available |= pre->outputs | VERT_PRECALC_DATA; - } - - - elt->outputs = 0; /* not used */ - elt->inputs = 0; + GLuint i; - for (i = 0 ; i < tnl->NrPipelineStages ; i++) { - pipeline[i].active &= ~PIPE_IMMEDIATE; + pipe->inputs = 0; + pipe->build_state_changes = 0; - if ((pipeline[i].state_change & newstate) || - (pipeline[i].elt_forbidden_inputs & available)) - { - pipeline[i].check(ctx, &pipeline[i]); + for (i = 0 ; i < pipe->nr_stages ; i++) { + if (stage[i].check_state & newstate) { + stage[i].check(ctx, &stage[i]); } - if ((pipeline[i].type & PIPE_IMMEDIATE) && - (pipeline[i].ops & active_ops) == 0 && - (pipeline[i].elt_forbidden_inputs & available) == 0 - ) - { - if (pipeline[i].inputs & ~available) - elt->forbidden_inputs |= pipeline[i].inputs & ~available; - else - { - elt->inputs |= pipeline[i].inputs & ~generated; - elt->forbidden_inputs |= pipeline[i].elt_forbidden_inputs; - pipeline[i].active |= PIPE_IMMEDIATE; - *stages++ = &pipeline[i]; - generated |= pipeline[i].outputs; - available |= pipeline[i].outputs; - active_ops |= pipeline[i].ops; - } - } - } - - *stages = 0; - - elt->copy_transformed_data = 1; - elt->replay_copied_vertices = 0; - - if (is_elt) { - cva->merge = elt->inputs & pre->outputs; - elt->ops = active_ops & ~pre->ops; + if (stage[i].active) { + pipe->inputs |= stage[i].inputs & ~generated; + generated |= stage[i].outputs; + } } } -void _tnl_build_immediate_pipeline( GLcontext *ctx ) + +void _tnl_run_pipeline( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); - struct gl_pipeline *elt = &tnl->CVA.elt; + struct gl_pipeline *pipe = &tnl->pipeline; + struct gl_pipeline_stage *stage = pipe->stages; + GLuint changed_state = pipe->run_state_changes; + GLuint changed_inputs = pipe->run_input_changes; + GLboolean running = GL_TRUE; + GLuint i; - if (!ctx->Driver.BuildEltPipeline || - !ctx->Driver.BuildEltPipeline( ctx )) { - build_full_immediate_pipeline( ctx ); - } + unsigned short __tmp; - elt->pipeline_valid = 1; - tnl->CVA.orflag = 0; + /* Done elsewhere. + */ + ASSERT(pipe->build_state_changes == 0); - if (MESA_VERBOSE&VERBOSE_PIPELINE) - _tnl_print_pipeline( ctx, elt ); -} + START_FAST_MATH(__tmp); -#define INTERESTED ~0 + /* If something changes in the pipeline, tag all subsequent stages + * using this value for recalculation. + * + * Even inactive stages have their state and inputs examined to try + * to keep cached data alive over state-changes. + */ + for (i = 0 ; i < pipe->nr_stages ; i++) { + + stage[i].changed_inputs |= stage[i].inputs & changed_inputs; -void _tnl_update_pipelines( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint newstate = ctx->NewState; - struct gl_cva *cva = &tnl->CVA; - - newstate &= INTERESTED; - - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_STATE)) - gl_print_enable_flags("enabled", ctx->_Enabled); - - if (newstate || - cva->lock_changed || - cva->orflag != cva->last_orflag || - tnl->_ArrayFlags != cva->last_array_flags) - { - GLuint j; - GLuint flags = VERT_WIN; - - if (ctx->Visual.RGBAflag) { - flags |= VERT_RGBA; - if (ctx->_TriangleCaps && DD_SEPERATE_SPECULAR) - flags |= VERT_SPEC_RGB; - } else - flags |= VERT_INDEX; - - for (j = 0 ; j < ctx->Const.MaxTextureUnits ; j++) { - if (ctx->Texture.Unit[j]._ReallyEnabled) - flags |= VERT_TEX(j); + if (stage[i].run_state & changed_state) { + stage[i].changed_inputs = stage[i].inputs; } - if (ctx->Polygon._Unfilled) - flags |= VERT_EDGE; - - if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) - flags |= VERT_FOG_COORD; + if (stage[i].active) { + if (stage[i].changed_inputs) + changed_inputs |= stage[i].outputs; - if (ctx->RenderMode==GL_FEEDBACK) { - flags = (VERT_WIN | VERT_RGBA | VERT_INDEX | VERT_NORM | - VERT_EDGE | VERT_TEX_ANY); + if (running) { + running = stage[i].run( ctx, &stage[i] ); + } } - - tnl->_RenderFlags = flags; - - cva->elt.new_state |= newstate; - cva->elt.pipeline_valid = 0; - - cva->pre.new_state |= newstate; - cva->pre.forbidden_inputs = 0; - cva->pre.pipeline_valid = 0; - cva->lock_changed = 0; } + END_FAST_MATH(__tmp); - if (tnl->_ArrayNewState != cva->last_array_new_state) - cva->pre.pipeline_valid = 0; - - cva->pre.data_valid = 0; - cva->last_array_new_state = tnl->_ArrayNewState; - cva->last_orflag = cva->orflag; - cva->last_array_flags = tnl->_ArrayFlags; + pipe->run_state_changes = 0; + pipe->run_input_changes = 0; } -void _tnl_run_pipeline( struct vertex_buffer *VB ) -{ - struct gl_pipeline *pipe = VB->pipeline; - struct gl_pipeline_stage **stages = pipe->stages; - unsigned short x; - - pipe->data_valid = 1; /* optimized stages might want to reset this. */ - if (0) _tnl_print_pipeline( VB->ctx, pipe ); - - START_FAST_MATH(x); - for ( VB->Culled = 0; *stages && !VB->Culled ; stages++ ) - (*stages)->run( VB ); - - END_FAST_MATH(x); - - pipe->new_state = 0; -} +/* The default pipeline. This is useful for software rasterizers, and + * simple hardware rasterizers. For customization, I don't recommend + * tampering with the internals of these stages in the way that + * drivers did in Mesa 3.4. These stages are basically black boxes, + * and should be left intact. + * + * To customize the pipeline, consider: + * + * - removing redundant stages (making sure that the software rasterizer + * can cope with this on fallback paths). An example is fog + * coordinate generation, which is not required in the FX driver. + * + * - replacing general-purpose machine-independent stages with + * general-purpose machine-specific stages. There is no example of + * this to date, though it must be borne in mind that all subsequent + * stages that reference the output of the new stage must cope with + * any machine-specific data introduced. This may not be easy + * unless there are no such stages (ie the new stage is the last in + * the pipe). + * + * - inserting optimized (but specialized) stages ahead of the + * general-purpose fallback implementation. For example, the old + * fastpath mechanism, which only works when the VERT_ELT input is + * available, can be duplicated by placing the fastpath stage at the + * head of this pipeline. Such specialized stages are currently + * constrained to have no outputs (ie. they must either finish the * + * pipeline by returning GL_FALSE from run(), or do nothing). + * + * Some work can be done to lift some of the restrictions in the final + * case, if it becomes necessary to do so. + */ +const struct gl_pipeline_stage *_tnl_default_pipeline[] = { + &_tnl_update_material_stage, + &_tnl_vertex_transform_stage, + &_tnl_normal_transform_stage, + &_tnl_lighting_stage, + &_tnl_fog_coordinate_stage, + &_tnl_texgen_stage, + &_tnl_texture_transform_stage, + &_tnl_point_attenuation_stage, + &_tnl_render_stage, + 0 +}; diff --git a/src/mesa/tnl/t_pipeline.h b/src/mesa/tnl/t_pipeline.h index b9ae641894f..9d433bde0a7 100644 --- a/src/mesa/tnl/t_pipeline.h +++ b/src/mesa/tnl/t_pipeline.h @@ -1,4 +1,4 @@ -/* $Id: t_pipeline.h,v 1.3 2000/11/24 10:25:12 keithw Exp $ */ +/* $Id: t_pipeline.h,v 1.4 2000/12/26 05:09:33 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -36,25 +36,30 @@ #include "mtypes.h" #include "t_context.h" -extern void _tnl_pipeline_init( GLcontext *ctx ); +extern void _tnl_run_pipeline( GLcontext *ctx ); -extern void _tnl_update_materials( struct vertex_buffer *VB); +extern void _tnl_validate_pipeline( GLcontext *ctx ); -extern void _tnl_update_pipelines( GLcontext *ctx ); +extern void _tnl_destroy_pipeline( GLcontext *ctx ); -extern void _tnl_build_precalc_pipeline( GLcontext *ctx ); -extern void _tnl_build_immediate_pipeline( GLcontext *ctx ); +extern void _tnl_install_pipeline( GLcontext *ctx, + const struct gl_pipeline_stage **stages ); -extern void _tnl_print_vert_flags( const char *name, GLuint flags ); -extern void _tnl_print_pipeline( GLcontext *ctx, struct gl_pipeline *p ); -extern void _tnl_print_active_pipeline( GLcontext *ctx, struct gl_pipeline *p ); -extern void _tnl_run_pipeline( struct vertex_buffer *VB ); - -extern void _tnl_clean_color( struct vertex_buffer *VB ); - -extern void _tnl_reset_cva_vb( struct vertex_buffer *VB, GLuint stages ); +/* These are implemented in the t_vb_*.c files: + */ +extern const struct gl_pipeline_stage _tnl_update_material_stage; +extern const struct gl_pipeline_stage _tnl_vertex_transform_stage; +extern const struct gl_pipeline_stage _tnl_normal_transform_stage; +extern const struct gl_pipeline_stage _tnl_lighting_stage; +extern const struct gl_pipeline_stage _tnl_fog_coordinate_stage; +extern const struct gl_pipeline_stage _tnl_texgen_stage; +extern const struct gl_pipeline_stage _tnl_texture_transform_stage; +extern const struct gl_pipeline_stage _tnl_point_attenuation_stage; +extern const struct gl_pipeline_stage _tnl_render_stage; -extern void _tnl_print_pipe_ops( const char *msg, GLuint flags ); +/* Shorthand to plug in the default pipeline: + */ +extern const struct gl_pipeline_stage *_tnl_default_pipeline[]; #endif diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h new file mode 100644 index 00000000000..8a73e87de30 --- /dev/null +++ b/src/mesa/tnl/t_vb_cliptmp.h @@ -0,0 +1,477 @@ +/* $Id: t_vb_cliptmp.h,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + + +#define INSIDE( J ) !NEGATIVE(J) +#define OUTSIDE( J ) NEGATIVE(J) + + + + +static GLuint TAG(userclip_line)( GLcontext *ctx, + GLuint *i, GLuint *j, + interp_func interp ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLfloat (*coord)[4] = VB->ClipPtr->data; + GLuint ii = *i; + GLuint jj = *j; + GLuint p; + + for (p=0;pTransform.ClipEnabled[p]) { + GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + + GLfloat dpI = d*W(ii) + c*Z(ii) + b*Y(ii) + a*X(ii); + GLfloat dpJ = d*W(jj) + c*Z(jj) + b*Y(jj) + a*X(jj); + + GLuint flagI = OUTSIDE( dpI ); + GLuint flagJ = OUTSIDE( dpJ ); + + if (flagI ^ flagJ) { + if (flagJ) { + GLfloat t = dpI / (dpI - dpJ); + jj = interp( ctx, t, ii, jj, GL_FALSE ); + } else { + GLfloat t = dpJ / (dpJ - dpI); + ii = interp( ctx, t, jj, ii, GL_FALSE ); + } + } + else if (flagI) + return 0; + } + } + + *i = ii; + *j = jj; + return 1; +} + + +static GLuint TAG(userclip_polygon)( GLcontext *ctx, + GLuint n, + GLuint vlist[], + interp_func interp ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLfloat (*coord)[4] = VB->ClipPtr->data; + GLuint vlist2[MAX_CLIPPED_VERTICES]; + GLuint *inlist = vlist, *outlist = vlist2; + GLuint p; + + for (p=0;pTransform.ClipEnabled[p]) { + register float a = ctx->Transform._ClipUserPlane[p][0]; + register float b = ctx->Transform._ClipUserPlane[p][1]; + register float c = ctx->Transform._ClipUserPlane[p][2]; + register float d = ctx->Transform._ClipUserPlane[p][3]; + + /* initialize prev to be last in the input list */ + GLuint prevj = inlist[0]; + GLfloat dpJ = d*W(prevj) + c*Z(prevj) + b*Y(prevj) + a*X(prevj); + GLuint outcount = 0; + GLuint curri; + + inlist[n] = inlist[0]; + + for (curri=1;curriClipMask[prevj] &= ~CLIP_USER_BIT; + } else { + VB->ClipMask[prevj] |= CLIP_USER_BIT; + } + + if (DIFFERENT_SIGNS(dpI, dpJ)) { + if (NEGATIVE(dpI)) { + GLfloat t = dpI/(dpI-dpJ); + outlist[outcount++] = interp( ctx, t, currj, prevj, GL_TRUE); + } else { + GLfloat t = dpJ/(dpJ-dpI); + outlist[outcount++] = interp( ctx, t, prevj, currj, GL_FALSE); + } + } + + prevj = currj; + dpJ = dpI; + } + + if (outcount < 3) + return 0; + else { + GLuint *tmp; + tmp = inlist; + inlist = outlist; + outlist = tmp; + n = outcount; + } + + } /* if */ + } /* for p */ + + if (inlist!=vlist) { + GLuint i; + for (i = 0 ; i < n ; i++) + vlist[i] = inlist[i]; + } + + return n; +} + + +/* This now calls the user clip functions if required. + */ +static void TAG(viewclip_line)( GLcontext *ctx, + GLuint i, GLuint j, + GLubyte mask ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + interp_func interp = (interp_func) VB->interpfunc; + GLfloat (*coord)[4] = VB->ClipPtr->data; + GLuint ii = i, jj = j; + GLuint vlist[2]; + GLuint n; + + VB->LastClipped = VB->FirstClipped; + +/* + * We use 6 instances of this code to clip against the 6 planes. + */ +#define GENERAL_CLIP \ + if (mask & PLANE) { \ + GLfloat dpI = CLIP_DOTPROD( ii ); \ + GLfloat dpJ = CLIP_DOTPROD( jj ); \ + \ + if (DIFFERENT_SIGNS(dpI, dpJ)) { \ + if (NEGATIVE(dpJ)) { \ + GLfloat t = dpI / (dpI - dpJ); \ + jj = interp( ctx, t, ii, jj, GL_FALSE ); \ + } else { \ + GLfloat t = dpJ / (dpJ - dpI); \ + ii = interp( ctx, t, jj, ii, GL_FALSE ); \ + } \ + } \ + else if (NEGATIVE(dpI)) \ + return; \ + } + + +#define PLANE CLIP_RIGHT_BIT +#define CLIP_DOTPROD(K) (- X(K) + W(K)) + + GENERAL_CLIP + +#undef CLIP_DOTPROD +#undef PLANE +#define PLANE CLIP_LEFT_BIT +#define CLIP_DOTPROD(K) (X(K) + W(K)) + + GENERAL_CLIP + +#undef CLIP_DOTPROD +#undef PLANE +#define PLANE CLIP_TOP_BIT +#define CLIP_DOTPROD(K) (- Y(K) + W(K)) + + GENERAL_CLIP + +#undef CLIP_DOTPROD +#undef PLANE +#define PLANE CLIP_BOTTOM_BIT +#define CLIP_DOTPROD(K) (Y(K) + W(K)) + + GENERAL_CLIP + +#undef CLIP_DOTPROD +#undef PLANE +#define PLANE CLIP_FAR_BIT +#define CLIP_DOTPROD(K) (- Z(K) + W(K)) + + if (SIZE >= 3) { + GENERAL_CLIP + } + +#undef CLIP_DOTPROD +#undef PLANE +#define PLANE CLIP_NEAR_BIT +#define CLIP_DOTPROD(K) (Z(K) + W(K)) + + if (SIZE >=3 ) { + GENERAL_CLIP + } + +#undef CLIP_DOTPROD +#undef PLANE +#undef GENERAL_CLIP + + + if (mask & CLIP_USER_BIT) { + if ( TAG(userclip_line)( ctx, &ii, &jj, interp ) == 0 ) + return; + } + + vlist[0] = ii; + vlist[1] = jj; + n = 2; + + /* If necessary, project new vertices. + */ + { + GLuint i, j; + GLfloat (*proj)[4] = VB->ProjectedClipPtr->data; + GLuint start = VB->FirstClipped; + + for (i = 0; i < n; i++) { + j = vlist[i]; + if (j >= start) { + if (SIZE == 4 && W(j) != 0.0F) { + GLfloat wInv = 1.0F / W(j); + proj[j][0] = X(j) * wInv; + proj[j][1] = Y(j) * wInv; + proj[j][2] = Z(j) * wInv; + proj[j][3] = wInv; + } else { + proj[j][0] = X(j); + proj[j][1] = Y(j); + proj[j][2] = Z(j); + proj[j][3] = W(j); + } + } + } + } + + if (ctx->Driver.BuildProjectedVertices) + ctx->Driver.BuildProjectedVertices(ctx, + VB->FirstClipped, + VB->LastClipped, + ~0); + + /* Render the new line. + */ + ctx->Driver.LineFunc( ctx, ii, jj, j ); +} + +/* We now clip polygon triangles individually. This is necessary to + * avoid artifacts dependent on where the boundary of the VB falls + * within the polygon. As a result, there is an upper bound on the + * number of vertices which may be created, and the test against VB_SIZE + * is redundant. + */ +static void TAG(viewclip_polygon)( GLcontext *ctx, + GLuint n, GLuint vlist[], GLuint pv, + GLubyte mask ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + interp_func interp = (interp_func) VB->interpfunc; + GLfloat (*coord)[4] = VB->ClipPtr->data; + GLuint vlist2[MAX_CLIPPED_VERTICES]; + GLuint *inlist = vlist, *outlist = vlist2; + GLuint i; + GLubyte *clipmask = VB->ClipMask; + + VB->LastClipped = VB->FirstClipped; + + if (mask & CLIP_ALL_BITS) { + +#define GENERAL_CLIP \ + if (mask & PLANE) { \ + GLuint idxPrev = inlist[n-1]; \ + GLfloat dpPrev = CLIP_DOTPROD(idxPrev); \ + GLuint outcount = 0; \ + GLuint i; \ + \ + mask &= ~PLANE; \ + \ + for (i = 0; i < n; i++) { \ + GLuint idx = inlist[i]; \ + GLfloat dp = CLIP_DOTPROD(idx); \ + \ + if (!NEGATIVE(dpPrev)) { \ + outlist[outcount++] = idxPrev; \ + clipmask[idxPrev] &= ~PLANE; \ + } \ + \ + if (DIFFERENT_SIGNS(dp, dpPrev)) { \ + GLuint newvert; \ + if (NEGATIVE(dp)) { \ + /* Going out of bounds. Avoid division by zero as we \ + * know dp != dpPrev from DIFFERENT_SIGNS, above. \ + */ \ + GLfloat t = dp / (dp - dpPrev); \ + newvert = interp( ctx, t, idx, idxPrev, GL_TRUE ); \ + } else { \ + /* Coming back in. \ + */ \ + GLfloat t = dpPrev / (dpPrev - dp); \ + newvert = interp( ctx, t, idxPrev, idx, GL_FALSE ); \ + } \ + clipmask[newvert] = mask; \ + outlist[outcount++] = newvert; \ + } \ + \ + idxPrev = idx; \ + dpPrev = dp; \ + } \ + \ + if (outcount < 3) \ + return; \ + \ + { \ + GLuint *tmp = inlist; \ + inlist = outlist; \ + outlist = tmp; \ + n = outcount; \ + } \ + } + + +#define PLANE CLIP_RIGHT_BIT +#define CLIP_DOTPROD(K) (- X(K) + W(K)) + + GENERAL_CLIP + +#undef CLIP_DOTPROD +#undef PLANE + + +#define PLANE CLIP_LEFT_BIT +#define CLIP_DOTPROD(K) (X(K) + W(K)) + + GENERAL_CLIP + +#undef CLIP_DOTPROD +#undef PLANE + +#define PLANE CLIP_TOP_BIT +#define CLIP_DOTPROD(K) (- Y(K) + W(K)) + + GENERAL_CLIP + +#undef CLIP_DOTPROD +#undef PLANE + +#define PLANE CLIP_BOTTOM_BIT +#define CLIP_DOTPROD(K) (Y(K) + W(K)) + + GENERAL_CLIP + +#undef CLIP_DOTPROD +#undef PLANE + +#define PLANE CLIP_FAR_BIT +#define CLIP_DOTPROD(K) (- Z(K) + W(K)) + + if (SIZE >= 3) { + GENERAL_CLIP + } + +#undef CLIP_DOTPROD +#undef PLANE + +#define PLANE CLIP_NEAR_BIT +#define CLIP_DOTPROD(K) (Z(K) + W(K)) + + if (SIZE >=3 ) { + GENERAL_CLIP + } + +#undef CLIP_DOTPROD +#undef PLANE +#undef GENERAL_CLIP + + if (inlist != vlist) + for (i = 0 ; i < n ; i++) + vlist[i] = inlist[i]; + } + + /* Clip against user clipping planes in clip space. + */ + if (mask & CLIP_USER_BIT) { + n = TAG(userclip_polygon)( ctx, n, vlist, interp ); + if (n < 3) return; + } + + /* Project if necessary. + */ + { + GLuint i; + GLfloat (*proj)[4] = VB->ProjectedClipPtr->data; + GLuint first = VB->FirstClipped; + + for (i = 0; i < n; i++) { + GLuint j = vlist[i]; + if (j >= first) { + if (SIZE == 4 && W(j) != 0.0F) { + GLfloat wInv = 1.0F / W(j); + proj[j][0] = X(j) * wInv; + proj[j][1] = Y(j) * wInv; + proj[j][2] = Z(j) * wInv; + proj[j][3] = wInv; + } else { + proj[j][0] = X(j); + proj[j][1] = Y(j); + proj[j][2] = Z(j); + proj[j][3] = W(j); + } + } + } + } + + if (ctx->Driver.BuildProjectedVertices) + ctx->Driver.BuildProjectedVertices(ctx, + VB->FirstClipped, + VB->LastClipped, + ~0); + + /* Render the new vertices as an unclipped polygon. + * Argh - need to pass in pv... + */ + { + GLuint *tmp = VB->Elts; + VB->Elts = vlist; + render_poly_pv_raw_elts( ctx, 0, n, PRIM_BEGIN|PRIM_END, pv ); + VB->Elts = tmp; + } +} + + + +#undef W +#undef Z +#undef Y +#undef X +#undef SIZE +#undef TAG +#undef INSIDE +#undef OUTSIDE diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c new file mode 100644 index 00000000000..38a80702ab2 --- /dev/null +++ b/src/mesa/tnl/t_vb_fog.c @@ -0,0 +1,201 @@ +/* $Id: t_vb_fog.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + +struct fog_stage_data { + GLvector1f fogcoord; /* has actual storage allocated */ + GLvector1f input; /* points into VB->EyePtr Z values */ +}; + +#define FOG_STAGE_DATA(stage) ((struct fog_stage_data *)stage->private) + + + +/* Use lookup table & interpolation? + */ +static void make_win_fog_coords( GLcontext *ctx, GLvector1f *out, + const GLvector1f *in ) +{ + GLfloat end = ctx->Fog.End; + GLfloat *v = in->start; + GLuint stride = in->stride; + GLuint n = in->count; + GLfloat *data = out->data; + GLfloat d; + GLuint i; + + out->count = in->count; + + switch (ctx->Fog.Mode) { + case GL_LINEAR: + d = 1.0F / (ctx->Fog.End - ctx->Fog.Start); + for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) + data[i] = (end - ABSF(*v)) * d; + break; + case GL_EXP: + d = -ctx->Fog.Density; + for ( i = 0 ; i < n ; i++, STRIDE_F(v,stride)) + data[i] = exp( d*ABSF(*v) ); + break; + case GL_EXP2: + d = -(ctx->Fog.Density*ctx->Fog.Density); + for ( i = 0 ; i < n ; i++, STRIDE_F(v, stride)) { + GLfloat z = *v; + data[i] = exp( d*z*z ); + } + break; + default: + gl_problem(ctx, "Bad fog mode in make_fog_coord"); + return; + } +} + + +static GLboolean run_fog_stage( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct fog_stage_data *store = FOG_STAGE_DATA(stage); + GLvector1f *input; + + VB->FogCoordPtr = &store->fogcoord; + + if (stage->changed_inputs == 0) + return GL_TRUE; + + if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) { + if (!ctx->_NeedEyeCoords) { + GLfloat *m = ctx->ModelView.m; + GLfloat plane[4]; + + /* Use this to store calculated eye z values: + */ + input = &store->fogcoord; + + plane[0] = m[2]; + plane[1] = m[6]; + plane[2] = m[10]; + plane[3] = m[14]; + + /* Full eye coords weren't required, just calculate the + * eye Z values. + */ + gl_dotprod_tab[0][VB->ObjPtr->size](input->data, sizeof(GLfloat), + VB->ObjPtr, plane, 0 ); + + input->count = VB->ObjPtr->count; + } + else + { + input = &store->input; + + if (VB->EyePtr->size < 2) + gl_vector4f_clean_elem( VB->EyePtr, VB->Count, 2 ); + + input->data = &(VB->EyePtr->data[0][2]); + input->start = VB->EyePtr->start+2; + input->stride = VB->EyePtr->stride; + input->count = VB->EyePtr->count; + } + } else + input = VB->FogCoordPtr; + + make_win_fog_coords( ctx, VB->FogCoordPtr, input ); + return GL_TRUE; +} + +static void check_fog_stage( GLcontext *ctx, struct gl_pipeline_stage *stage ) +{ + stage->active = ctx->Fog.Enabled; + + if (ctx->Fog.FogCoordinateSource == GL_FRAGMENT_DEPTH_EXT) + stage->inputs = VERT_EYE; + else + stage->inputs = VERT_FOG_COORD; +} + + +/* Called the first time stage->run() is invoked. + */ +static GLboolean alloc_fog_data( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct fog_stage_data *store; + stage->private = MALLOC(sizeof(*store)); + store = FOG_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + gl_vector1f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 ); + gl_vector1f_init( &store->input, 0, 0 ); + + /* Now run the stage. + */ + stage->run = run_fog_stage; + return stage->run( ctx, stage ); +} + + +static void free_fog_data( struct gl_pipeline_stage *stage ) +{ + struct fog_stage_data *store = FOG_STAGE_DATA(stage); + if (store) { + gl_vector1f_free( &store->fogcoord ); + FREE( store ); + stage->private = 0; + } +} + + +const struct gl_pipeline_stage _tnl_fog_coordinate_stage = +{ + "build fog coordinates", + _NEW_FOG, + _NEW_FOG, + 0, 0, VERT_FOG_COORD, /* active, inputs, outputs */ + 0, 0, /* changed_inputs, private_data */ + free_fog_data, /* dtr */ + check_fog_stage, /* check */ + alloc_fog_data /* run -- initially set to init. */ +}; diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c new file mode 100644 index 00000000000..b55cda38588 --- /dev/null +++ b/src/mesa/tnl/t_vb_light.c @@ -0,0 +1,280 @@ +/* $Id: t_vb_light.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + + +#include "glheader.h" +#include "colormac.h" +#include "light.h" +#include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "simple_list.h" +#include "mtypes.h" + +#include "t_context.h" +#include "t_pipeline.h" + +#define LIGHT_FLAGS 0x1 /* must be first */ +#define LIGHT_TWOSIDE 0x2 +#define LIGHT_COLORMATERIAL 0x4 +#define MAX_LIGHT_FUNC 0x8 + +typedef void (*light_func)( GLcontext *ctx, + struct vertex_buffer *VB, + struct gl_pipeline_stage *stage, + GLvector4f *input ); + +struct light_stage_data { + GLvector4ub LitColor[2]; + GLvector1ui LitIndex[2]; + GLvector4ub LitSecondary[2]; + + light_func *light_func_tab; +}; + +#define LIGHT_STAGE_DATA(stage) ((struct light_stage_data *)(stage->private)) + +/* Tables for all the shading functions. + */ +static light_func _tnl_light_tab[MAX_LIGHT_FUNC]; +static light_func _tnl_light_fast_tab[MAX_LIGHT_FUNC]; +static light_func _tnl_light_fast_single_tab[MAX_LIGHT_FUNC]; +static light_func _tnl_light_spec_tab[MAX_LIGHT_FUNC]; +static light_func _tnl_light_ci_tab[MAX_LIGHT_FUNC]; + +#define TAG(x) x +#define IDX (0) +#include "t_vb_lighttmp.h" + +#define TAG(x) x##_tw +#define IDX (LIGHT_TWOSIDE) +#include "t_vb_lighttmp.h" + +#define TAG(x) x##_fl +#define IDX (LIGHT_FLAGS) +#include "t_vb_lighttmp.h" + +#define TAG(x) x##_tw_fl +#define IDX (LIGHT_FLAGS|LIGHT_TWOSIDE) +#include "t_vb_lighttmp.h" + +#define TAG(x) x##_cm +#define IDX (LIGHT_COLORMATERIAL) +#include "t_vb_lighttmp.h" + +#define TAG(x) x##_tw_cm +#define IDX (LIGHT_TWOSIDE|LIGHT_COLORMATERIAL) +#include "t_vb_lighttmp.h" + +#define TAG(x) x##_fl_cm +#define IDX (LIGHT_FLAGS|LIGHT_COLORMATERIAL) +#include "t_vb_lighttmp.h" + +#define TAG(x) x##_tw_fl_cm +#define IDX (LIGHT_FLAGS|LIGHT_TWOSIDE|LIGHT_COLORMATERIAL) +#include "t_vb_lighttmp.h" + + +static void init_lighting( void ) +{ + static int done; + + if (!done) { + init_light_tab(); + init_light_tab_tw(); + init_light_tab_fl(); + init_light_tab_tw_fl(); + init_light_tab_cm(); + init_light_tab_tw_cm(); + init_light_tab_fl_cm(); + init_light_tab_tw_fl_cm(); + done = 1; + } +} + + +static GLboolean run_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLvector4f *input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr; + GLuint ind; + + /* Make sure we can talk about elements 0..2 in the vector we are + * lighting. TODO: Don't repeat this in CVA! + */ + if (input->size <= 2) { + if (input->flags & VEC_NOT_WRITEABLE) { + ASSERT(VB->importable_data & VERT_OBJ); + VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE ); + input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr; + ASSERT((input->flags & VEC_NOT_WRITEABLE) == 0); + } + + gl_vector4f_clean_elem(input, VB->Count, 2); + } + + if (VB->Flag) + ind = LIGHT_FLAGS; + else + ind = 0; + + /* The individual tabs know about replaying side-effects vs. full + * re-execution. + */ + store->light_func_tab[ind]( ctx, VB, stage, input ); + + return GL_TRUE; +} + + +/* Called in place of do_lighting when the light table may have changed. + */ +static GLboolean run_validate_lighting( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + GLuint ind = 0; + light_func *tab; + + if (ctx->Visual.RGBAflag) { + if (ctx->Light._NeedVertices) { + if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) + tab = _tnl_light_spec_tab; + else + tab = _tnl_light_tab; + } + else { + if (ctx->Light.EnabledList.next == ctx->Light.EnabledList.prev) + tab = _tnl_light_fast_single_tab; + else + tab = _tnl_light_fast_tab; + } +/* tab = _tnl_light_tab; */ + } + + if (ctx->Light.ColorMaterialEnabled) + ind |= LIGHT_COLORMATERIAL; + + if (ctx->Light.Model.TwoSide) + ind |= LIGHT_TWOSIDE; + + LIGHT_STAGE_DATA(stage)->light_func_tab = &tab[ind]; + + /* This and the above should only be done on _NEW_LIGHT: + */ + gl_validate_all_lighting_tables( ctx ); + + /* Now run the stage... + */ + stage->run = run_lighting; + return stage->run( ctx, stage ); +} + +/* Called the first time stage->run is called. In effect, don't + * allocate data until the first time the stage is run. + */ +static GLboolean run_init_lighting( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct light_stage_data *store; + GLuint size = tnl->vb.Size; + + stage->private = MALLOC(sizeof(*store)); + store = LIGHT_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + /* Do onetime init. + */ + init_lighting(); + + gl_vector4ub_alloc( &store->LitColor[0], 0, size, 32 ); + gl_vector4ub_alloc( &store->LitColor[1], 0, size, 32 ); + gl_vector4ub_alloc( &store->LitSecondary[0], 0, size, 32 ); + gl_vector4ub_alloc( &store->LitSecondary[1], 0, size, 32 ); + gl_vector1ui_alloc( &store->LitIndex[0], 0, size, 32 ); + gl_vector1ui_alloc( &store->LitIndex[1], 0, size, 32 ); + + /* Now validate the stage derived data... + */ + stage->run = run_validate_lighting; + return stage->run( ctx, stage ); +} + + + +/* + * Check if lighting is enabled. If so, configure the pipeline stage's + * type, inputs, and outputs. + */ +static void check_lighting( GLcontext *ctx, struct gl_pipeline_stage *stage ) +{ + stage->active = ctx->Light.Enabled; + if (stage->active) { + if (stage->private) + stage->run = run_validate_lighting; + stage->inputs = VERT_NORM|VERT_MATERIAL; + if (ctx->Light._NeedVertices) + stage->inputs |= VERT_EYE; /* effectively, even when lighting in obj */ + if (ctx->Light.ColorMaterialEnabled) + stage->inputs |= VERT_RGBA; + } +} + + +static void dtr( struct gl_pipeline_stage *stage ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + + if (store) { + gl_vector4ub_free( &store->LitColor[0] ); + gl_vector4ub_free( &store->LitColor[1] ); + gl_vector1ui_free( &store->LitIndex[0] ); + gl_vector1ui_free( &store->LitIndex[1] ); + gl_vector4ub_free( &store->LitSecondary[0] ); + gl_vector4ub_free( &store->LitSecondary[1] ); + FREE( store ); + stage->private = 0; + } +} + +const struct gl_pipeline_stage _tnl_lighting_stage = +{ + "lighting", + _NEW_LIGHT, /* recheck */ + _NEW_LIGHT|_NEW_MODELVIEW, /* recalc -- modelview dependency + * otherwise not captured by inputs + * (which may be VERT_OBJ) */ + 0,0,VERT_RGBA, /* active, inputs, outputs */ + 0,0, /* changed_inputs, private_data */ + dtr, /* destroy */ + check_lighting, /* check */ + run_init_lighting /* run -- initially set to ctr */ +}; + diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h new file mode 100644 index 00000000000..f2bcde67148 --- /dev/null +++ b/src/mesa/tnl/t_vb_lighttmp.h @@ -0,0 +1,965 @@ +/* $Id: t_vb_lighttmp.h,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * + * Authors: + * Brian Paul + * Keith Whitwell + */ + + +#if (IDX & LIGHT_FLAGS) +# define VSTRIDE (4 * sizeof(GLfloat)) +# define NSTRIDE (3 * sizeof(GLfloat)) +# define CHECK_MATERIAL(x) (flags[x] & VERT_MATERIAL) +# define CHECK_END_VB(x) (flags[x] & VERT_END_VB) +# if (IDX & LIGHT_COLORMATERIAL) +# define CMSTRIDE STRIDE_4UB(CMcolor, (4 * sizeof(GLubyte))) +# define CHECK_COLOR_MATERIAL(x) (flags[x] & VERT_RGBA) +# define CHECK_VALIDATE(x) (flags[x] & (VERT_RGBA|VERT_MATERIAL)) +# define DO_ANOTHER_NORMAL(x) \ + ((flags[x] & (VERT_RGBA|VERT_NORM|VERT_END_VB|VERT_MATERIAL)) == VERT_NORM) +# define REUSE_LIGHT_RESULTS(x) \ + ((flags[x] & (VERT_RGBA|VERT_NORM|VERT_END_VB|VERT_MATERIAL)) == 0) +# else +# define CMSTRIDE 0 +# define CHECK_COLOR_MATERIAL(x) 0 +# define CHECK_VALIDATE(x) (flags[x] & (VERT_MATERIAL)) +# define DO_ANOTHER_NORMAL(x) \ + ((flags[x] & (VERT_NORM|VERT_END_VB|VERT_MATERIAL)) == VERT_NORM) +# define REUSE_LIGHT_RESULTS(x) \ + ((flags[x] & (VERT_NORM|VERT_END_VB|VERT_MATERIAL)) == 0) +# endif +#else +# define VSTRIDE vstride +# define NSTRIDE nstride +# define CHECK_MATERIAL(x) 0 /* no materials on array paths */ +# define CHECK_END_VB(XX) (XX >= nr) +# if (IDX & LIGHT_COLORMATERIAL) +# define CMSTRIDE STRIDE_4UB(CMcolor, CMstride) +# define CHECK_COLOR_MATERIAL(x) (x < nr) /* always have colormaterial */ +# define CHECK_VALIDATE(x) (x < nr) +# define DO_ANOTHER_NORMAL(x) 0 /* always stop to recalc colormat */ +# else +# define CMSTRIDE 0 +# define CHECK_COLOR_MATERIAL(x) 0 /* no colormaterial */ +# define CHECK_VALIDATE(x) (0) +# define DO_ANOTHER_NORMAL(XX) (XX < nr) /* keep going to end of vb */ +# endif +# define REUSE_LIGHT_RESULTS(x) 0 /* always have a new normal */ +#endif + + + +#if (IDX & LIGHT_TWOSIDE) +# define NR_SIDES 2 +#else +# define NR_SIDES 1 +#endif + + + +static void TAG(light_rgba_spec)( GLcontext *ctx, + struct vertex_buffer *VB, + struct gl_pipeline_stage *stage, + GLvector4f *input ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + GLfloat (*base)[3] = ctx->Light._BaseColor; + const GLchan *sumA = ctx->Light._BaseAlpha; + + GLuint j; + + GLuint vstride = input->stride; + const GLfloat *vertex = (GLfloat *)input->data; + GLuint nstride = VB->NormalPtr->stride; + const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; + + GLchan (*CMcolor)[4]; + GLuint CMstride; + + GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].data; + GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].data; + GLchan (*Fspec)[4] = (GLchan (*)[4]) store->LitSecondary[0].data; + GLchan (*Bspec)[4] = (GLchan (*)[4]) store->LitSecondary[1].data; + GLuint nr = VB->Count; + + GLuint *flags = VB->Flag; + struct gl_material (*new_material)[2] = VB->Material; + GLuint *new_material_mask = VB->MaterialMask; + + (void) flags; + (void) nstride; + (void) vstride; + + if (IDX & LIGHT_COLORMATERIAL) { + CMcolor = (GLchan (*)[4]) VB->ColorPtr[0]->data; + CMstride = VB->ColorPtr[0]->stride; + } + + VB->ColorPtr[0] = &store->LitColor[0]; + VB->SecondaryColorPtr[0] = &store->LitSecondary[0]; + + if (IDX & LIGHT_TWOSIDE) { + VB->ColorPtr[1] = &store->LitColor[1]; + VB->SecondaryColorPtr[1] = &store->LitSecondary[1]; + } + + /* Side-effects done, can we finish now? + */ + if (stage->changed_inputs == 0) + return; + + for ( j=0 ; + jLight.EnabledList) { + GLfloat n_dot_h; + GLfloat correction; + GLint side; + GLfloat contrib[3]; + GLfloat attenuation; + GLfloat VP[3]; /* unit vector from vertex to light */ + GLfloat n_dot_VP; /* n dot VP */ + GLfloat *h; + + /* compute VP and attenuation */ + if (!(light->_Flags & LIGHT_POSITIONAL)) { + /* directional light */ + COPY_3V(VP, light->_VP_inf_norm); + attenuation = light->_VP_inf_spot_attenuation; + } + else { + GLfloat d; /* distance from vertex to light */ + + SUB_3V(VP, light->_Position, vertex); + + d = (GLfloat) LEN_3FV( VP ); + + if (d > 1e-6) { + GLfloat invd = 1.0F / d; + SELF_SCALE_SCALAR_3V(VP, invd); + } + + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * + light->QuadraticAttenuation)); + + /* spotlight attenuation */ + if (light->_Flags & LIGHT_SPOT) { + GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + + if (PV_dot_dir_CosCutoff) { + continue; /* this light makes no contribution */ + } + else { + double x = PV_dot_dir * (EXP_TABLE_SIZE-1); + int k = (int) x; + GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + + (x-k)*light->_SpotExpTable[k][1]); + attenuation *= spot; + } + } + } + + + if (attenuation < 1e-3) + continue; /* this light makes no contribution */ + + /* Compute dot product or normal and vector from V to light pos */ + n_dot_VP = DOT3( normal, VP ); + + /* Which side gets the diffuse & specular terms? */ + if (n_dot_VP < 0.0F) { + ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); + if (!(IDX & LIGHT_TWOSIDE)) { + continue; + } + side = 1; + correction = -1; + n_dot_VP = -n_dot_VP; + } + else { + if (IDX & LIGHT_TWOSIDE) { + ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); + } + side = 0; + correction = 1; + } + + /* diffuse term */ + COPY_3V(contrib, light->_MatAmbient[side]); + ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]); + ACC_SCALE_SCALAR_3V(sum[side], attenuation, contrib ); + + /* specular term - cannibalize VP... */ + if (ctx->Light.Model.LocalViewer) { + GLfloat v[3]; + COPY_3V(v, vertex); + NORMALIZE_3FV(v); + SUB_3V(VP, VP, v); /* h = VP + VPe */ + h = VP; + NORMALIZE_3FV(h); + } + else if (light->_Flags & LIGHT_POSITIONAL) { + h = VP; + ACC_3V(h, ctx->_EyeZDir); + NORMALIZE_3FV(h); + } + else { + h = light->_h_inf_norm; + } + + n_dot_h = correction * DOT3(normal, h); + + if (n_dot_h > 0.0F) { + GLfloat spec_coef; + struct gl_shine_tab *tab = ctx->_ShineTable[side]; + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); + + if (spec_coef > 1.0e-10) { + spec_coef *= attenuation; + ACC_SCALE_SCALAR_3V( spec[side], spec_coef, + light->_MatSpecular[side]); + } + } + } /*loop over lights*/ + + FLOAT_RGB_TO_CHAN_RGB( Fcolor[j], sum[0] ); + FLOAT_RGB_TO_CHAN_RGB( Fspec[j], spec[0] ); + Fcolor[j][3] = sumA[0]; + + if (IDX & LIGHT_TWOSIDE) { + FLOAT_RGB_TO_CHAN_RGB( Bcolor[j], sum[1] ); + FLOAT_RGB_TO_CHAN_RGB( Bspec[j], spec[1] ); + Bcolor[j][3] = sumA[1]; + } + } + + if ( CHECK_COLOR_MATERIAL(j) ) + gl_update_color_material( ctx, CMcolor[j] ); + + if ( CHECK_MATERIAL(j) ) + gl_update_material( ctx, new_material[j], new_material_mask[j] ); + + if ( CHECK_VALIDATE(j) ) + gl_validate_all_lighting_tables( ctx ); +} + + +static void TAG(light_rgba)( GLcontext *ctx, + struct vertex_buffer *VB, + struct gl_pipeline_stage *stage, + GLvector4f *input ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + GLuint j; + + GLfloat (*base)[3] = ctx->Light._BaseColor; + const GLchan *sumA = ctx->Light._BaseAlpha; + + GLuint vstride = input->stride; + const GLfloat *vertex = (GLfloat *) input->data; + GLuint nstride = VB->NormalPtr->stride; + const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; + + GLubyte (*CMcolor)[4]; + GLuint CMstride; + + GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].data; + GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].data; + GLuint *flags = VB->Flag; + + struct gl_material (*new_material)[2] = VB->Material; + GLuint *new_material_mask = VB->MaterialMask; + GLuint nr = VB->Count; + + (void) flags; + (void) nstride; + (void) vstride; + + if (IDX & LIGHT_COLORMATERIAL) { + CMcolor = VB->ColorPtr[0]->data; + CMstride = VB->ColorPtr[0]->stride; + } + + VB->ColorPtr[0] = &store->LitColor[0]; + if (IDX & LIGHT_TWOSIDE) + VB->ColorPtr[1] = &store->LitColor[1]; + + if (stage->changed_inputs == 0) + return; + + for ( j=0 ; + jLight.EnabledList) { + + GLfloat n_dot_h; + GLfloat correction; + GLint side; + GLfloat contrib[3]; + GLfloat attenuation = 1.0; + GLfloat VP[3]; /* unit vector from vertex to light */ + GLfloat n_dot_VP; /* n dot VP */ + GLfloat *h; + + /* compute VP and attenuation */ + if (!(light->_Flags & LIGHT_POSITIONAL)) { + /* directional light */ + COPY_3V(VP, light->_VP_inf_norm); + attenuation = light->_VP_inf_spot_attenuation; + } + else { + GLfloat d; /* distance from vertex to light */ + + + SUB_3V(VP, light->_Position, vertex); + + d = LEN_3FV( VP ); + + if ( d > 1e-6) { + GLfloat invd = 1.0F / d; + SELF_SCALE_SCALAR_3V(VP, invd); + } + + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * + light->QuadraticAttenuation)); + + /* spotlight attenuation */ + if (light->_Flags & LIGHT_SPOT) { + GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + + if (PV_dot_dir_CosCutoff) { + continue; /* this light makes no contribution */ + } + else { + double x = PV_dot_dir * (EXP_TABLE_SIZE-1); + int k = (int) x; + GLfloat spot = (light->_SpotExpTable[k][0] + + (x-k)*light->_SpotExpTable[k][1]); + attenuation *= spot; + } + } + } + + + if (attenuation < 1e-3) + continue; /* this light makes no contribution */ + + + /* Compute dot product or normal and vector from V to light pos */ + n_dot_VP = DOT3( normal, VP ); + + /* which side are we lighting? */ + if (n_dot_VP < 0.0F) { + ACC_SCALE_SCALAR_3V(sum[0], attenuation, light->_MatAmbient[0]); + + if (!(IDX & LIGHT_TWOSIDE)) + continue; + + side = 1; + correction = -1; + n_dot_VP = -n_dot_VP; + } + else { + if (IDX & LIGHT_TWOSIDE) { + ACC_SCALE_SCALAR_3V( sum[1], attenuation, light->_MatAmbient[1]); + } + side = 0; + correction = 1; + } + + COPY_3V(contrib, light->_MatAmbient[side]); + + /* diffuse term */ + ACC_SCALE_SCALAR_3V(contrib, n_dot_VP, light->_MatDiffuse[side]); + + /* specular term - cannibalize VP... */ + { + if (ctx->Light.Model.LocalViewer) { + GLfloat v[3]; + COPY_3V(v, vertex); + NORMALIZE_3FV(v); + SUB_3V(VP, VP, v); /* h = VP + VPe */ + h = VP; + NORMALIZE_3FV(h); + } + else if (light->_Flags & LIGHT_POSITIONAL) { + h = VP; + ACC_3V(h, ctx->_EyeZDir); + NORMALIZE_3FV(h); + } + else { + h = light->_h_inf_norm; + } + + n_dot_h = correction * DOT3(normal, h); + + if (n_dot_h > 0.0F) + { + GLfloat spec_coef; + struct gl_shine_tab *tab = ctx->_ShineTable[side]; + + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef ); + + ACC_SCALE_SCALAR_3V( contrib, spec_coef, + light->_MatSpecular[side]); + } + } + + ACC_SCALE_SCALAR_3V( sum[side], attenuation, contrib ); + } + + FLOAT_RGB_TO_CHAN_RGB( Fcolor[j], sum[0] ); + Fcolor[j][3] = sumA[0]; + + if (IDX & LIGHT_TWOSIDE) { + FLOAT_RGB_TO_CHAN_RGB( Bcolor[j], sum[1] ); + Bcolor[j][3] = sumA[1]; + } + } + + if ( CHECK_COLOR_MATERIAL(j) ) + gl_update_color_material( ctx, (GLchan *)CMcolor[j] ); + + if ( CHECK_MATERIAL(j) ) + gl_update_material( ctx, new_material[j], new_material_mask[j] ); + + if ( CHECK_VALIDATE(j) ) + gl_validate_all_lighting_tables( ctx ); +} + + + + +/* As below, but with just a single light. + */ +static void TAG(light_fast_rgba_single)( GLcontext *ctx, + struct vertex_buffer *VB, + struct gl_pipeline_stage *stage, + GLvector4f *input ) + +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + GLuint nstride = VB->NormalPtr->stride; + const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; + GLubyte (*CMcolor)[4]; + GLuint CMstride; + GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].data; + GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].data; + struct gl_light *light = ctx->Light.EnabledList.next; + GLuint *flags = VB->Flag; + GLchan baseubyte[2][4]; + GLuint j = 0; + struct gl_material (*new_material)[2] = VB->Material; + GLuint *new_material_mask = VB->MaterialMask; + GLfloat base[2][3]; + GLuint nr = VB->Count; + + (void) input; /* doesn't refer to Eye or Obj */ + (void) flags; + (void) nr; + (void) nstride; + + if (IDX & LIGHT_COLORMATERIAL) { + CMcolor = VB->ColorPtr[0]->data; + CMstride = VB->ColorPtr[0]->stride; + } + + VB->ColorPtr[0] = &store->LitColor[0]; + if (IDX & LIGHT_TWOSIDE) + VB->ColorPtr[1] = &store->LitColor[1]; + + if (stage->changed_inputs == 0) + return; + + if ( CHECK_COLOR_MATERIAL(j) ) + gl_update_color_material( ctx, (GLchan *)CMcolor[j] ); + + if ( CHECK_MATERIAL(j) ) + gl_update_material( ctx, new_material[j], new_material_mask[j] ); + + if ( CHECK_VALIDATE(j) ) + gl_validate_all_lighting_tables( ctx ); + + baseubyte[0][3] = ctx->Light._BaseAlpha[0]; + baseubyte[1][3] = ctx->Light._BaseAlpha[1]; + + do { + /* No attenuation, so incoporate _MatAmbient into base color. + */ + { + COPY_3V(base[0], light->_MatAmbient[0]); + ACC_3V(base[0], ctx->Light._BaseColor[0] ); + FLOAT_RGB_TO_CHAN_RGB( baseubyte[0], base[0] ); + + if (IDX & LIGHT_TWOSIDE) { + COPY_3V(base[1], light->_MatAmbient[1]); + ACC_3V(base[1], ctx->Light._BaseColor[1]); + FLOAT_RGB_TO_CHAN_RGB( baseubyte[1], base[1]); + } + } + + do { + GLfloat n_dot_VP = DOT3(normal, light->_VP_inf_norm); + + COPY_CHAN4(Fcolor[j], baseubyte[0]); + if (IDX & LIGHT_TWOSIDE) COPY_CHAN4(Bcolor[j], baseubyte[1]); + + if (n_dot_VP < 0.0F) { + if (IDX & LIGHT_TWOSIDE) { + GLfloat n_dot_h = -DOT3(normal, light->_h_inf_norm); + GLfloat sum[3]; + COPY_3V(sum, base[1]); + ACC_SCALE_SCALAR_3V(sum, -n_dot_VP, light->_MatDiffuse[1]); + if (n_dot_h > 0.0F) { + GLfloat spec; + GET_SHINE_TAB_ENTRY( ctx->_ShineTable[1], n_dot_h, spec ); + ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[1]); + } + FLOAT_RGB_TO_CHAN_RGB(Bcolor[j], sum ); + } + } else { + GLfloat n_dot_h = DOT3(normal, light->_h_inf_norm); + GLfloat sum[3]; + COPY_3V(sum, base[0]); + ACC_SCALE_SCALAR_3V(sum, n_dot_VP, light->_MatDiffuse[0]); + if (n_dot_h > 0.0F) { + GLfloat spec; + GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec ); + ACC_SCALE_SCALAR_3V(sum, spec, light->_MatSpecular[0]); + + } + FLOAT_RGB_TO_CHAN_RGB(Fcolor[j], sum ); + } + + j++; + STRIDE_F(normal, NSTRIDE); + } while (DO_ANOTHER_NORMAL(j)); + + + for ( ; REUSE_LIGHT_RESULTS(j) ; j++ ) { + COPY_CHAN4(Fcolor[j], Fcolor[j-1]); + if (IDX & LIGHT_TWOSIDE) + COPY_CHAN4(Bcolor[j], Bcolor[j-1]); + STRIDE_F(normal, NSTRIDE); + } + + /* Have to recompute our base colors on material change. + */ + if ( CHECK_MATERIAL(j) ) + gl_update_material( ctx, new_material[j], new_material_mask[j] ); + + if ( CHECK_COLOR_MATERIAL(j) ) + gl_update_color_material( ctx, (GLchan *)CMcolor[j] ); + + if ( CHECK_VALIDATE(j) ) + gl_validate_all_lighting_tables( ctx ); + + } while (!CHECK_END_VB(j)); +} + + +/* Light infinite lights + */ +static void TAG(light_fast_rgba)( GLcontext *ctx, + struct vertex_buffer *VB, + struct gl_pipeline_stage *stage, + GLvector4f *input ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + const GLchan *sumA = ctx->Light._BaseAlpha; + GLuint nstride = VB->NormalPtr->stride; + const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; + GLubyte (*CMcolor)[4]; + GLuint CMstride; + GLchan (*Fcolor)[4] = (GLchan (*)[4]) store->LitColor[0].data; + GLchan (*Bcolor)[4] = (GLchan (*)[4]) store->LitColor[1].data; + GLuint *flags = VB->Flag; + GLuint j = 0; + struct gl_material (*new_material)[2] = VB->Material; + GLuint *new_material_mask = VB->MaterialMask; + GLuint nr = VB->Count; + struct gl_light *light; + + (void) flags; + (void) input; + (void) nr; + (void) nstride; + + if (IDX & LIGHT_COLORMATERIAL) { + CMcolor = VB->ColorPtr[0]->data; + CMstride = VB->ColorPtr[0]->stride; + } + + VB->ColorPtr[0] = &store->LitColor[0]; + if (IDX & LIGHT_TWOSIDE) + VB->ColorPtr[1] = &store->LitColor[1]; + + if ( CHECK_COLOR_MATERIAL(j) ) + gl_update_color_material( ctx, *CMcolor ); + + if ( CHECK_MATERIAL(j) ) + gl_update_material( ctx, new_material[j], new_material_mask[j] ); + + if ( CHECK_VALIDATE(j) ) + gl_validate_all_lighting_tables( ctx ); + + do { + do { + GLfloat sum[2][3]; + + COPY_3V(sum[0], ctx->Light._BaseColor[0]); + if (IDX & LIGHT_TWOSIDE) + COPY_3V(sum[1], ctx->Light._BaseColor[1]); + + foreach (light, &ctx->Light.EnabledList) { + GLfloat n_dot_h, n_dot_VP, spec; + + ACC_3V(sum[0], light->_MatAmbient[0]); + if (IDX & LIGHT_TWOSIDE) + ACC_3V(sum[1], light->_MatAmbient[1]); + + n_dot_VP = DOT3(normal, light->_VP_inf_norm); + + if (n_dot_VP > 0.0F) { + ACC_SCALE_SCALAR_3V(sum[0], n_dot_VP, light->_MatDiffuse[0]); + n_dot_h = DOT3(normal, light->_h_inf_norm); + if (n_dot_h > 0.0F) { + struct gl_shine_tab *tab = ctx->_ShineTable[0]; + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec ); + ACC_SCALE_SCALAR_3V( sum[0], spec, + light->_MatSpecular[0]); + } + } + else if (IDX & LIGHT_TWOSIDE) { + ACC_SCALE_SCALAR_3V(sum[1], -n_dot_VP, light->_MatDiffuse[1]); + n_dot_h = -DOT3(normal, light->_h_inf_norm); + if (n_dot_h > 0.0F) { + struct gl_shine_tab *tab = ctx->_ShineTable[1]; + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec ); + ACC_SCALE_SCALAR_3V( sum[1], spec, + light->_MatSpecular[1]); + } + } + } + + FLOAT_RGB_TO_CHAN_RGB( Fcolor[j], sum[0] ); + Fcolor[j][3] = sumA[0]; + + if (IDX & LIGHT_TWOSIDE) { + FLOAT_RGB_TO_CHAN_RGB( Bcolor[j], sum[1] ); + Bcolor[j][3] = sumA[1]; + } + + j++; + STRIDE_F(normal, NSTRIDE); + } while (DO_ANOTHER_NORMAL(j)); + + /* Reuse the shading results while there is no change to + * normal or material values. + */ + for ( ; REUSE_LIGHT_RESULTS(j) ; j++ ) { + COPY_CHAN4(Fcolor[j], Fcolor[j-1]); + if (IDX & LIGHT_TWOSIDE) + COPY_CHAN4(Bcolor[j], Bcolor[j-1]); + STRIDE_F(normal, NSTRIDE); + } + + if ( CHECK_COLOR_MATERIAL(j) ) + gl_update_color_material( ctx, CMcolor[j] ); + + if ( CHECK_MATERIAL(j) ) + gl_update_material( ctx, new_material[j], new_material_mask[j] ); + + if ( CHECK_VALIDATE(j) ) + gl_validate_all_lighting_tables( ctx ); + + } while (!CHECK_END_VB(j)); +} + + + + + +/* + * Use current lighting/material settings to compute the color indexes + * for an array of vertices. + * Input: n - number of vertices to light + * side - 0=use front material, 1=use back material + * vertex - array of [n] vertex position in eye coordinates + * normal - array of [n] surface normal vector + * Output: indexResult - resulting array of [n] color indexes + */ +static void TAG(light_ci)( GLcontext *ctx, + struct vertex_buffer *VB, + struct gl_pipeline_stage *stage, + GLvector4f *input ) +{ + struct light_stage_data *store = LIGHT_STAGE_DATA(stage); + GLuint j; + GLuint vstride = input->stride; + const GLfloat *vertex = (GLfloat *) input->data; + GLuint nstride = VB->NormalPtr->stride; + const GLfloat *normal = (GLfloat *)VB->NormalPtr->data; + GLubyte (*CMcolor)[4]; + GLuint CMstride; + GLuint *flags = VB->Flag; + GLuint *indexResult[2]; + struct gl_material (*new_material)[2] = VB->Material; + GLuint *new_material_mask = VB->MaterialMask; + GLuint nr = VB->Count; + + (void) flags; + (void) nstride; + (void) vstride; + + VB->IndexPtr[0] = &store->LitIndex[0]; + if (IDX & LIGHT_TWOSIDE) + VB->IndexPtr[1] = &store->LitIndex[1]; + + indexResult[0] = VB->IndexPtr[0]->data; + indexResult[1] = VB->IndexPtr[1]->data; + + if (IDX & LIGHT_COLORMATERIAL) { + CMcolor = VB->ColorPtr[0]->data; + CMstride = VB->ColorPtr[0]->stride; + } + + /* loop over vertices */ + for ( j=0 ; + jLight.EnabledList) { + + GLfloat attenuation = 1.0F; + GLfloat VP[3]; /* unit vector from vertex to light */ + GLfloat n_dot_VP; /* dot product of l and n */ + GLfloat *h, n_dot_h, correction = 1.0; + + /* compute l and attenuation */ + if (!(light->_Flags & LIGHT_POSITIONAL)) { + /* directional light */ + COPY_3V(VP, light->_VP_inf_norm); + } + else { + GLfloat d; /* distance from vertex to light */ + + SUB_3V(VP, light->_Position, vertex); + + d = LEN_3FV( VP ); + if ( d > 1e-6) { + GLfloat invd = 1.0F / d; + SELF_SCALE_SCALAR_3V(VP, invd); + } + + attenuation = 1.0F / (light->ConstantAttenuation + d * + (light->LinearAttenuation + d * + light->QuadraticAttenuation)); + + /* spotlight attenuation */ + if (light->_Flags & LIGHT_SPOT) { + GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + if (PV_dot_dir_CosCutoff) { + continue; /* this light makes no contribution */ + } + else { + double x = PV_dot_dir * (EXP_TABLE_SIZE-1); + int k = (int) x; + GLfloat spot = (light->_SpotExpTable[k][0] + + (x-k)*light->_SpotExpTable[k][1]); + attenuation *= spot; + } + } + } + + if (attenuation < 1e-3) + continue; /* this light makes no contribution */ + + n_dot_VP = DOT3( normal, VP ); + + /* which side are we lighting? */ + if (n_dot_VP < 0.0F) { + if (!(IDX & LIGHT_TWOSIDE)) + continue; + side = 1; + correction = -1; + n_dot_VP = -n_dot_VP; + } + + /* accumulate diffuse term */ + diffuse[side] += n_dot_VP * light->_dli * attenuation; + + /* specular term */ + if (ctx->Light.Model.LocalViewer) { + GLfloat v[3]; + COPY_3V(v, vertex); + NORMALIZE_3FV(v); + SUB_3V(VP, VP, v); /* h = VP + VPe */ + h = VP; + NORMALIZE_3FV(h); + } + else if (light->_Flags & LIGHT_POSITIONAL) { + h = VP; + ACC_3V(h, ctx->_EyeZDir); + NORMALIZE_3FV(h); + } + else { + h = light->_h_inf_norm; + } + + n_dot_h = correction * DOT3(normal, h); + + if (n_dot_h > 0.0F) + { + GLfloat spec_coef; + struct gl_shine_tab *tab = ctx->_ShineTable[side]; + GET_SHINE_TAB_ENTRY( tab, n_dot_h, spec_coef); + specular[side] += spec_coef * light->_sli * attenuation; + } + } /*loop over lights*/ + + /* Now compute final color index */ + for (side = 0 ; side < NR_SIDES ; side++) { + struct gl_material *mat = &ctx->Light.Material[side]; + GLfloat index; + + if (specular[side] > 1.0F) { + index = mat->SpecularIndex; + } + else { + GLfloat d_a = mat->DiffuseIndex - mat->AmbientIndex; + GLfloat s_a = mat->SpecularIndex - mat->AmbientIndex; + + index = mat->AmbientIndex + + diffuse[side] * (1.0F-specular[side]) * d_a + + specular[side] * s_a; + + if (index > mat->SpecularIndex) { + index = mat->SpecularIndex; + } + } + indexResult[side][j] = (GLuint) (GLint) index; + } + } /*for vertex*/ + + if ( CHECK_COLOR_MATERIAL(j) ) + gl_update_color_material( ctx, CMcolor[j] ); + + if ( CHECK_MATERIAL(j) ) + gl_update_material( ctx, new_material[j], new_material_mask[j] ); + + if ( CHECK_VALIDATE(j) ) + gl_validate_all_lighting_tables( ctx ); +} + + + +static void TAG(init_light_tab)( void ) +{ + _tnl_light_tab[IDX] = TAG(light_rgba); + _tnl_light_fast_tab[IDX] = TAG(light_fast_rgba); + _tnl_light_fast_single_tab[IDX] = TAG(light_fast_rgba_single); + _tnl_light_spec_tab[IDX] = TAG(light_rgba_spec); + _tnl_light_ci_tab[IDX] = TAG(light_ci); +} + + +#undef TAG +#undef IDX +#undef NR_SIDES +#undef NSTRIDE +#undef VSTRIDE +#undef CHECK_MATERIAL +#undef CHECK_END_VB +#undef DO_ANOTHER_NORMAL +#undef REUSE_LIGHT_RESULTS +#undef CMSTRIDE +#undef CHECK_COLOR_MATERIAL +#undef CHECK_VALIDATE diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c new file mode 100644 index 00000000000..97e7b9bb356 --- /dev/null +++ b/src/mesa/tnl/t_vb_normals.c @@ -0,0 +1,193 @@ +/* $Id: t_vb_normals.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + + +struct normal_stage_data { + normal_func *NormalTransform; + GLvector3f normal; +}; + +#define NORMAL_STAGE_DATA(stage) ((struct normal_stage_data *)stage->private) + + + + +static GLboolean run_normal_stage( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + + ASSERT(store->NormalTransform); + + if (VB->NormalLengthPtr) { + GLfloat diff = VB->NormalLengthPtr[0] - + 1.0/LEN_3FV(VB->NormalPtr->data[0]); + ASSERT((diff*diff) < .01); + } + + if (stage->changed_inputs) + (store->NormalTransform[0])(&ctx->ModelView, + ctx->_ModelViewInvScale, + VB->NormalPtr, + VB->NormalLengthPtr, + 0, + &store->normal); + + VB->NormalPtr = &store->normal; + return GL_TRUE; +} + + +static GLboolean run_validate_normal_stage( GLcontext *ctx, + struct gl_pipeline_stage *stage) +{ + struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); + + ASSERT(ctx->_NeedNormals); + + if (ctx->_NeedEyeCoords) { + GLuint transform = NORM_TRANSFORM_NO_ROT; + + if (ctx->ModelView.flags & (MAT_FLAG_GENERAL | + MAT_FLAG_ROTATION | + MAT_FLAG_GENERAL_3D | + MAT_FLAG_PERSPECTIVE)) + transform = NORM_TRANSFORM; + + + if (ctx->Transform.Normalize) { + store->NormalTransform = gl_normal_tab[transform | NORM_NORMALIZE]; + } + else if (ctx->Transform.RescaleNormals && + ctx->_ModelViewInvScale != 1.0) { + store->NormalTransform = gl_normal_tab[transform | NORM_RESCALE]; + } + else { + store->NormalTransform = gl_normal_tab[transform]; + } + } + else { + if (ctx->Transform.Normalize) { + store->NormalTransform = gl_normal_tab[NORM_NORMALIZE]; + } + else if (!ctx->Transform.RescaleNormals && + ctx->_ModelViewInvScale != 1.0) { + store->NormalTransform = gl_normal_tab[NORM_RESCALE]; + } + else { + store->NormalTransform = 0; + } + } + + if (store->NormalTransform) { + stage->run = run_normal_stage; + return stage->run( ctx, stage ); + } else { + stage->active = GL_FALSE; /* !!! */ + return GL_TRUE; + } +} + + +static void check_normal_transform( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + stage->active = ctx->_NeedNormals; + /* Don't clobber the initialize function: + */ + if (stage->private) + stage->run = run_validate_normal_stage; +} + + +static GLboolean alloc_normal_data( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct normal_stage_data *store; + stage->private = MALLOC(sizeof(*store)); + store = NORMAL_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + gl_vector3f_alloc( &store->normal, 0, tnl->vb.Size, 32 ); + + /* Now run the stage. + */ + stage->run = run_validate_normal_stage; + return stage->run( ctx, stage ); +} + + + +static void free_normal_data( struct gl_pipeline_stage *stage ) +{ + struct normal_stage_data *store = NORMAL_STAGE_DATA(stage); + if (store) { + gl_vector3f_free( &store->normal ); + FREE( store ); + stage->private = 0; + } +} + +#define _TNL_NEW_NORMAL_TRANSFORM (_NEW_MODELVIEW| \ + _NEW_TRANSFORM| \ + _MESA_NEW_NEED_NORMALS| \ + _MESA_NEW_NEED_EYE_COORDS) + + + +const struct gl_pipeline_stage _tnl_normal_transform_stage = +{ + "normal transform", + _TNL_NEW_NORMAL_TRANSFORM, /* re-check */ + _TNL_NEW_NORMAL_TRANSFORM, /* re-run */ + 0,VERT_NORM,VERT_NORM, /* active, inputs, outputs */ + 0, 0, /* changed_inputs, private */ + free_normal_data, /* destructor */ + check_normal_transform, /* check */ + alloc_normal_data /* run -- initially set to alloc */ +}; + diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c new file mode 100644 index 00000000000..16f9ca9722f --- /dev/null +++ b/src/mesa/tnl/t_vb_points.c @@ -0,0 +1,124 @@ +/* $Id: t_vb_points.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Brian Paul + */ + +#include "mtypes.h" +#include "mem.h" +#include "t_context.h" +#include "t_pipeline.h" + + +struct point_stage_data { + GLvector1f PointSize; +}; + +#define POINT_STAGE_DATA(stage) ((struct point_stage_data *)stage->private) + + +/* + * Compute attenuated point sizes + */ +static GLboolean run_point_stage( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct point_stage_data *store = POINT_STAGE_DATA(stage); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + const GLfloat (*eye)[4] = (const GLfloat (*)[4]) VB->EyePtr->data; + const GLfloat p0 = ctx->Point.Params[0]; + const GLfloat p1 = ctx->Point.Params[1]; + const GLfloat p2 = ctx->Point.Params[2]; + const GLfloat pointSize = ctx->Point._Size; + GLfloat *size = store->PointSize.data; + GLuint i; + + if (stage->changed_inputs) { + /* XXX do threshold and min/max clamping here? */ + for (i = 0; i < VB->Count; i++) { + const GLfloat dist = -eye[i][2]; + /* GLfloat dist = GL_SQRT(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);*/ + size[i] = pointSize / (p0 + dist * (p1 + dist * p2)); + } + } + + VB->PointSizePtr = &store->PointSize; + + return GL_TRUE; +} + + +/* If point size attenuation is on we'll compute the point size for + * each vertex in a special pipeline stage. + */ +static void check_point_size( GLcontext *ctx, struct gl_pipeline_stage *d ) +{ + d->active = ctx->Point._Attenuated; +} + +static GLboolean alloc_point_data( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct point_stage_data *store; + stage->private = MALLOC(sizeof(*store)); + store = POINT_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + gl_vector1f_alloc( &store->PointSize, 0, VB->Size, 32 ); + + /* Now run the stage. + */ + stage->run = run_point_stage; + return stage->run( ctx, stage ); +} + + +static void free_point_data( struct gl_pipeline_stage *stage ) +{ + struct point_stage_data *store = POINT_STAGE_DATA(stage); + if (store) { + gl_vector1f_free( &store->PointSize ); + FREE( store ); + stage->private = 0; + } +} + +const struct gl_pipeline_stage _tnl_point_attenuation_stage = +{ + "point size attenuation", /* name */ + _NEW_POINT, /* build_state_change */ + _NEW_POINT, /* run_state_change */ + 0, /* active */ + VERT_EYE, /* inputs */ + VERT_POINT_SIZE, /* outputs */ + 0, /* changed_inputs (temporary value) */ + 0, /* stage private data */ + free_point_data, /* destructor */ + check_point_size, /* check */ + alloc_point_data /* run -- initially set to alloc data */ +}; diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c new file mode 100644 index 00000000000..5707f21c901 --- /dev/null +++ b/src/mesa/tnl/t_vb_render.c @@ -0,0 +1,698 @@ +/* $Id: t_vb_render.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * Render whole vertex buffers, including projection of vertices from + * clip space and clipping of primitives. + * + * This file makes calls to project vertices and to the point, line + * and triangle rasterizers via the function pointers: + * + * context->Driver.BuildProjectedVertices() + * context->Driver.PointsFunc() + * context->Driver.LineFunc() + * context->Driver.TriangleFunc() + * context->Driver.QuadFunc() + * + */ + + +#include "glheader.h" +#include "context.h" +#include "colormac.h" +#include "macros.h" +#include "mem.h" +#include "mtypes.h" +#include "mmath.h" + +#include "math/m_matrix.h" +#include "math/m_xform.h" + +#include "t_pipeline.h" + + +typedef GLuint (*interp_func)( GLcontext *ctx, + GLfloat t, GLuint in, GLuint out, + GLboolean force_boundary ); + +typedef void (*clip_line_func)( GLcontext *ctx, + GLuint i, GLuint j, + GLubyte mask); + +typedef void (*clip_poly_func)( GLcontext *ctx, + GLuint n, GLuint vlist[], + GLuint pv, GLubyte mask ); + + +typedef void (*render_func)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ); + + + +struct render_stage_data { + + /* Clipping functions for current state. + */ + interp_func interp; /* Clip interpolation function */ + GLuint _ClipInputs; /* Inputs referenced by interpfunc */ + +}; + +#define RENDER_STAGE_DATA(stage) ((struct render_stage_data *)stage->private) + +static void render_poly_pv_raw_elts( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags, + GLuint pv ); + +/**********************************************************************/ +/* Interpolate between pairs of vertices */ +/**********************************************************************/ + + +#define INTERP_RGBA 0x1 +#define INTERP_TEX 0x2 +#define INTERP_INDEX 0x4 +#define INTERP_SPEC 0x8 +#define INTERP_FOG 0x10 +#define INTERP_EDGE 0x20 +#define MAX_INTERP 0x40 + + +#define LINTERP_SZ( t, vec, to, a, b, sz ) \ +do { \ + switch (sz) { \ + case 4: vec[to][3] = LINTERP( t, vec[a][3], vec[b][3] ); \ + case 3: vec[to][2] = LINTERP( t, vec[a][2], vec[b][2] ); \ + case 2: vec[to][1] = LINTERP( t, vec[a][1], vec[b][1] ); \ + case 1: vec[to][0] = LINTERP( t, vec[a][0], vec[b][0] ); \ + } \ +} while(0) + + +#if 1 + +#define LINTERP_RGBA(nr, t, out, a, b) { \ + int i; \ + for (i = 0; i < nr; i++) { \ + GLfloat fa = CHAN_TO_FLOAT(a[i]); \ + GLfloat fb = CHAN_TO_FLOAT(b[i]); \ + GLfloat fo = LINTERP(t, fa, fb); \ + FLOAT_COLOR_TO_CHAN(out[i], fo); \ + } \ +} + +#else + +#define LINTERP_RGBA(nr, t, out, a, b) { \ + int n; \ + const GLuint ti = FloatToInt(t*256.0F); \ + const GLubyte *Ib = (const GLubyte *)&a[0]; \ + const GLubyte *Jb = (const GLubyte *)&b[0]; \ + GLubyte *Ob = (GLubyte *)&out[0]; \ + \ + for (n = 0 ; n < nr ; n++) \ + Ob[n] = (GLubyte) (Ib[n] + ((ti * (Jb[n] - Ib[n]))/256)); \ +} + +#endif + + + +static interp_func interp_tab[0x80]; + + +#define IND (INTERP_RGBA) +#define NAME interp_RGBA +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_SPEC) +#define NAME interp_RGBA_SPEC +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_FOG) +#define NAME interp_RGBA_FOG +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_SPEC|INTERP_FOG) +#define NAME interp_RGBA_SPEC_FOG +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_TEX) +#define NAME interp_RGBA_TEX +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_SPEC|INTERP_TEX) +#define NAME interp_RGBA_SPEC_TEX +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_FOG|INTERP_TEX) +#define NAME interp_RGBA_FOG_TEX +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_TEX) +#define NAME interp_RGBA_SPEC_FOG_TEX +#include "t_vb_interptmp.h" + +#define IND (INTERP_INDEX) +#define NAME interp_INDEX +#include "t_vb_interptmp.h" + +#define IND (INTERP_FOG|INTERP_INDEX) +#define NAME interp_FOG_INDEX +#include "t_vb_interptmp.h" + +#define IND (INTERP_TEX|INTERP_INDEX) +#define NAME interp_TEX_INDEX +#include "t_vb_interptmp.h" + +#define IND (INTERP_FOG|INTERP_TEX|INTERP_INDEX) +#define NAME interp_FOG_TEX_INDEX +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_EDGE) +#define NAME interp_RGBA_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_SPEC|INTERP_EDGE) +#define NAME interp_RGBA_SPEC_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_FOG|INTERP_EDGE) +#define NAME interp_RGBA_FOG_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_EDGE) +#define NAME interp_RGBA_SPEC_FOG_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_TEX|INTERP_EDGE) +#define NAME interp_RGBA_TEX_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_SPEC|INTERP_TEX|INTERP_EDGE) +#define NAME interp_RGBA_SPEC_TEX_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_FOG|INTERP_TEX|INTERP_EDGE) +#define NAME interp_RGBA_FOG_TEX_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_TEX|INTERP_EDGE) +#define NAME interp_RGBA_SPEC_FOG_TEX_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_INDEX|INTERP_EDGE) +#define NAME interp_INDEX_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_FOG|INTERP_INDEX|INTERP_EDGE) +#define NAME interp_FOG_INDEX_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_TEX|INTERP_INDEX|INTERP_EDGE) +#define NAME interp_TEX_INDEX_EDGE +#include "t_vb_interptmp.h" + +#define IND (INTERP_FOG|INTERP_TEX|INTERP_INDEX|INTERP_EDGE) +#define NAME interp_FOG_TEX_INDEX_EDGE +#include "t_vb_interptmp.h" + + + +static GLuint interp_invalid( GLcontext *ctx, + GLfloat t, + GLuint in, GLuint out, + GLboolean boundary ) +{ + (void)(ctx && t && in && out && boundary); + fprintf(stderr, "Invalid interpolation function in t_vbrender.c\n"); + return in; +} + + +static void interp_init( void ) +{ + GLuint i; + + /* Use the maximal function as the default. I don't believe any of + * the non-implemented combinations are reachable, but this gives + * some safety from crashes. + */ + for (i = 0 ; i < Elements(interp_tab) ; i++) + interp_tab[i] = interp_invalid; + + interp_tab[INTERP_RGBA] = interp_RGBA; + interp_tab[INTERP_RGBA|INTERP_SPEC] = interp_RGBA_SPEC; + interp_tab[INTERP_RGBA|INTERP_FOG] = interp_RGBA_FOG; + interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_FOG] = interp_RGBA_SPEC_FOG; + interp_tab[INTERP_RGBA|INTERP_TEX] = interp_RGBA_TEX; + interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_TEX] = interp_RGBA_SPEC_TEX; + interp_tab[INTERP_RGBA|INTERP_FOG|INTERP_TEX] = interp_RGBA_FOG_TEX; + interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_TEX] = interp_RGBA_SPEC_FOG_TEX; + interp_tab[INTERP_INDEX] = interp_INDEX; + interp_tab[INTERP_FOG|INTERP_INDEX] = interp_FOG_INDEX; + interp_tab[INTERP_TEX|INTERP_INDEX] = interp_TEX_INDEX; + interp_tab[INTERP_FOG|INTERP_TEX|INTERP_INDEX] = interp_FOG_TEX_INDEX; + interp_tab[INTERP_RGBA|INTERP_EDGE] = interp_RGBA_EDGE; + interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_EDGE] = interp_RGBA_SPEC_EDGE; + interp_tab[INTERP_RGBA|INTERP_FOG|INTERP_EDGE] = interp_RGBA_FOG_EDGE; + interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_EDGE] = interp_RGBA_SPEC_FOG_EDGE; + interp_tab[INTERP_RGBA|INTERP_TEX|INTERP_EDGE] = interp_RGBA_TEX_EDGE; + interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_TEX|INTERP_EDGE] = interp_RGBA_SPEC_TEX_EDGE; + interp_tab[INTERP_RGBA|INTERP_FOG|INTERP_TEX|INTERP_EDGE] = interp_RGBA_FOG_TEX_EDGE; + interp_tab[INTERP_RGBA|INTERP_SPEC|INTERP_FOG|INTERP_TEX|INTERP_EDGE] = interp_RGBA_SPEC_FOG_TEX_EDGE; + interp_tab[INTERP_INDEX|INTERP_EDGE] = interp_INDEX_EDGE; + interp_tab[INTERP_FOG|INTERP_INDEX|INTERP_EDGE] = interp_FOG_INDEX_EDGE; + interp_tab[INTERP_TEX|INTERP_INDEX|INTERP_EDGE] = interp_TEX_INDEX_EDGE; + interp_tab[INTERP_FOG|INTERP_TEX|INTERP_INDEX|INTERP_EDGE] = interp_FOG_TEX_INDEX_EDGE; +} + + +/**********************************************************************/ +/* Clip single primitives */ +/**********************************************************************/ + + +#if 0 +#define NEGATIVE(x) ((*(int *)&x)<0) +#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) +#else +#define NEGATIVE(x) (x < 0) +#define DIFFERENT_SIGNS(a,b) ((a*b) < 0) +#endif + +#define W(i) coord[i][3] +#define Z(i) coord[i][2] +#define Y(i) coord[i][1] +#define X(i) coord[i][0] +#define SIZE 4 +#define TAG(x) x##_4 +#include "t_vb_cliptmp.h" + +#define W(i) 1.0 +#define Z(i) coord[i][2] +#define Y(i) coord[i][1] +#define X(i) coord[i][0] +#define SIZE 3 +#define TAG(x) x##_3 +#include "t_vb_cliptmp.h" + +#define W(i) 1.0 +#define Z(i) 0.0 +#define Y(i) coord[i][1] +#define X(i) coord[i][0] +#define SIZE 2 +#define TAG(x) x##_2 +#include "t_vb_cliptmp.h" + +static clip_poly_func clip_poly_tab[5] = { + 0, + 0, + viewclip_polygon_2, + viewclip_polygon_3, + viewclip_polygon_4 +}; + +static clip_line_func clip_line_tab[5] = { + 0, + 0, + viewclip_line_2, + viewclip_line_3, + viewclip_line_4 +}; + + + +/**********************************************************************/ +/* Clip and render single primitives */ +/**********************************************************************/ + + + +static INLINE void draw_line(GLcontext *ctx, GLuint v1, GLuint v2 ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte c1 = VB->ClipMask[v1], c2 = VB->ClipMask[v2]; + GLubyte ormask = c1|c2; + if (!ormask) + ctx->Driver.LineFunc( ctx, v1, v2, v2 ); + else if (!(c1 & c2 & 0x3f)) + clip_line_tab[VB->ClipPtr->size]( ctx, v1, v2, ormask ); +} + +static INLINE void draw_triangle(GLcontext *ctx, + GLuint v1, GLuint v2, GLuint v3, + GLuint pv ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte c1 = VB->ClipMask[v1], c2 = VB->ClipMask[v2], c3 = VB->ClipMask[v3]; + GLubyte ormask = c1|c2|c3; + if (!ormask) + ctx->Driver.TriangleFunc( ctx, v1, v2, v3, pv ); + else if (!(c1 & c2 & c3 & 0x3f)) { + GLuint vlist[MAX_CLIPPED_VERTICES]; + ASSIGN_3V(vlist, v1, v2, v3 ); + clip_poly_tab[VB->ClipPtr->size]( ctx, 3, vlist, pv, ormask ); + } +} + + +static INLINE void draw_quad( GLcontext *ctx, + GLuint v1, GLuint v2, GLuint v3, + GLuint v4, GLuint pv ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLubyte c1 = VB->ClipMask[v1], c2 = VB->ClipMask[v2]; + GLubyte c3 = VB->ClipMask[v3], c4 = VB->ClipMask[v4]; + GLubyte ormask = c1|c2|c3|c4; + if (!ormask) + ctx->Driver.QuadFunc( ctx, v1, v2, v3, v4, pv ); + else if (!(c1 & c2 & c3 & c4 & 0x3f)) { + GLuint vlist[MAX_CLIPPED_VERTICES]; + ASSIGN_4V(vlist, v1, v2, v3, v4 ); + clip_poly_tab[VB->ClipPtr->size]( ctx, 4, vlist, pv, ormask ); + } +} + + +/**********************************************************************/ +/* Clip and render whole begin/end objects */ +/**********************************************************************/ + +#define NEED_EDGEFLAG_SETUP (ctx->_TriangleCaps & DD_TRI_UNFILLED) +#define EDGEFLAG_GET(idx) VB->EdgeFlagPtr->data[idx] +#define EDGEFLAG_SET(idx, val) VB->EdgeFlagPtr->data[idx] = val + + +/* Vertices, no clipping. + */ +#define RENDER_POINTS( start, count ) \ + ctx->Driver.PointsFunc( ctx, start, count-1 ) + +#define RENDER_LINE( i1, i ) \ + ctx->Driver.LineFunc( ctx, i1, i, i ) + +#define RENDER_TRI( i2, i1, i, pv, parity ) \ +do { \ + if (parity) \ + ctx->Driver.TriangleFunc( ctx, i1, i2, i, pv ); \ + else \ + ctx->Driver.TriangleFunc( ctx, i2, i1, i, pv ); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv ) \ + ctx->Driver.QuadFunc( ctx, i3, i2, i1, i, pv ); + +#define TAG(x) x##_raw + +#define LOCAL_VARS \ + struct vertex_buffer *VB = &(TNL_CONTEXT(ctx)->vb); \ + (void) VB; + +#define RESET_STIPPLE ctx->Driver.ResetLineStipple( ctx ) +#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE; +#define PRESERVE_VB_DEFS +#include "t_vb_rendertmp.h" + + +/* Elts, no clipping. + */ +#undef ELT +#undef TAG +#undef LOCAL_VARS +#define TAG(x) x##_raw_elts +#define ELT(x) elt[x] +#define LOCAL_VARS \ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \ + const GLuint * const elt = VB->Elts; \ + (void) elt; +#include "t_vb_rendertmp.h" + + + + +/* Vertices, with the possibility of clipping. + */ +#define RENDER_POINTS( start, count ) \ + ctx->Driver.PointsFunc( ctx, start, count-1 ) + +#define RENDER_LINE( i1, i ) \ + draw_line( ctx, i1, i ) + +#define RENDER_TRI( i2, i1, i, pv, parity) \ +do { \ + GLuint e2=i2, e1=i1; \ + if (parity) { GLuint t=e2; e2=e1; e1=t; } \ + draw_triangle(ctx,e2,e1,i,pv); \ +} while (0) + +#define RENDER_QUAD( i3, i2, i1, i, pv) \ + draw_quad(ctx,i3,i2,i1,i,pv) + + +#define LOCAL_VARS \ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \ + (void)VB; + +#define TAG(x) x##_clipped +#define RESET_STIPPLE ctx->Driver.ResetLineStipple( ctx ) +#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE; +#define PRESERVE_VB_DEFS +#include "t_vb_rendertmp.h" + + + +/* Elts, with the possibility of clipping. + */ +#undef ELT +#undef TAG +#undef LOCAL_VARS +#define ELT(x) elt[x] +#define LOCAL_VARS \ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; \ + const GLuint * const elt = VB->Elts; \ + (void) elt; +#define TAG(x) x##_clipped_elts + +#include "t_vb_rendertmp.h" + + + +/**********************************************************************/ +/* Clip and render whole vertex buffers */ +/**********************************************************************/ + + +static GLboolean run_render( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLuint new_inputs = stage->changed_inputs; + render_func *tab; + GLint pass = 0; + + VB->interpfunc = (void *)RENDER_STAGE_DATA(stage)->interp; + + if (new_inputs) { + GLuint importable = new_inputs & VB->importable_data; + GLuint interested = 0; + + if (VB->ClipOrMask) + interested = ~0; + + if (ctx->_TriangleCaps & DD_TRI_UNFILLED) + interested |= VERT_EDGE; + + importable &= interested; + + if (importable) + VB->import_data( ctx, importable, VEC_NOT_WRITEABLE|VEC_BAD_STRIDE); + + if (ctx->Driver.BuildProjectedVertices) + ctx->Driver.BuildProjectedVertices( ctx, 0, VB->Count, new_inputs); + } + + /* Rendering is considered a side-effect, and must be repeated each + * time the stage is run, even if no inputs have changed. + */ + if (VB->Elts) { + tab = VB->ClipOrMask ? render_tab_clipped_elts : render_tab_raw_elts; + } else { + tab = VB->ClipOrMask ? render_tab_clipped : render_tab_raw; + } + + if (ctx->Driver.RenderStart) + ctx->Driver.RenderStart( ctx ); + + do + { + GLuint i, length, flags = 0; + for (i = 0 ; !(flags & PRIM_LAST) ; i += length) + { + flags = VB->Primitive[i]; + length= VB->PrimitiveLength[i]; + ASSERT(length || (flags & PRIM_LAST)); + ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); + if (length) + tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags ); + } + } while (ctx->Driver.MultipassFunc && + ctx->Driver.MultipassFunc( ctx, ++pass )); + + if (ctx->Driver.RenderFinish) + ctx->Driver.RenderFinish( ctx ); + + return GL_FALSE; /* finished the pipe */ +} + + +/**********************************************************************/ +/* Render pipeline stage */ +/**********************************************************************/ + + + +/* Quite a bit of work involved in finding out the inputs for the + * render stage. This function also identifies which vertex + * interpolation function to use, as these are essentially the same + * question. + */ +static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage ) +{ + struct render_stage_data *store = RENDER_STAGE_DATA(stage); + GLuint interp = 0; + GLuint inputs = VERT_CLIP; + GLuint i; + + if (ctx->Visual.RGBAflag) + { + interp |= INTERP_RGBA; + inputs |= VERT_RGBA; + + if (ctx->_TriangleCaps & DD_SEPERATE_SPECULAR) { + interp |= INTERP_SPEC; + inputs |= VERT_SPEC_RGB; + } + + if (ctx->Texture._ReallyEnabled) { + interp |= INTERP_TEX; + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { + if (ctx->Texture.Unit[i]._ReallyEnabled) + inputs |= VERT_TEX(i); + } + } + } + else if (ctx->Light.ShadeModel==GL_SMOOTH) + { + interp |= INTERP_INDEX; + inputs |= VERT_INDEX; + } + + if (ctx->Point._Attenuated) + inputs |= VERT_POINT_SIZE; + + /* How do drivers turn this off? + */ + if (ctx->Fog.Enabled) { + interp |= INTERP_FOG; + inputs |= VERT_FOG_COORD; + } + + if (ctx->_TriangleCaps & DD_TRI_UNFILLED) { + inputs |= VERT_EDGE; + } + + if (ctx->RenderMode==GL_FEEDBACK) { + interp |= INTERP_TEX; + inputs |= VERT_TEX_ANY; + } + + store->interp = interp_tab[interp]; + stage->inputs = inputs; +} + + +/* Called the first time stage->check() is invoked. + */ +static void alloc_render_data( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct render_stage_data *store; + static GLboolean first_time = 1; + + if (first_time) { + interp_init(); + first_time = 0; + } + + stage->private = MALLOC(sizeof(*store)); + if (!stage->private) + return; + + /* Now do the check. + */ + stage->check = check_render; + stage->check( ctx, stage ); +} + + + +static void dtr( struct gl_pipeline_stage *stage ) +{ + struct render_stage_data *store = RENDER_STAGE_DATA(stage); + if (store) { + FREE( store ); + stage->private = 0; + } +} + + +const struct gl_pipeline_stage _tnl_render_stage = +{ + "render", + (_NEW_BUFFERS | + _DD_NEW_SEPERATE_SPECULAR | + _NEW_TEXTURE| + _NEW_LIGHT| + _NEW_POINT| + _NEW_FOG| + _DD_NEW_TRI_UNFILLED | + _NEW_RENDERMODE), /* re-check (new inputs, interp function) */ + 0, /* re-run (always runs) */ + GL_TRUE, /* active */ + 0, 0, /* inputs (set in check_render), outputs */ + 0, 0, /* changed_inputs, private */ + dtr, /* destructor */ + alloc_render_data, /* check - initially set to alloc data */ + run_render /* run */ +}; diff --git a/src/mesa/tnl/t_vb_rendertmp.h b/src/mesa/tnl/t_vb_rendertmp.h new file mode 100644 index 00000000000..de8adb23ec5 --- /dev/null +++ b/src/mesa/tnl/t_vb_rendertmp.h @@ -0,0 +1,452 @@ +/* $Id: t_vb_rendertmp.h,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + + +#ifndef POSTFIX +#define POSTFIX +#endif + +#ifndef INIT +#define INIT(x) +#endif + +#ifndef NEED_EDGEFLAG_SETUP +#define NEED_EDGEFLAG_SETUP 0 +#define EDGEFLAG_GET(a) 0 +#define EDGEFLAG_SET(a,b) +#endif + +#ifndef RESET_STIPPLE +#define RESET_STIPPLE +#endif + +#ifndef RESET_OCCLUSION +#define RESET_OCCLUSION +#endif + +#ifndef TEST_PRIM_END +#define TEST_PRIM_END(flags) (flags & PRIM_END) +#define TEST_PRIM_BEGIN(flags) (flags & PRIM_BEGIN) +#define TEST_PRIM_PARITY(flags) (flags & PRIM_PARITY) +#endif + +#ifndef ELT +#define ELT(x) x +#endif + +static void TAG(render_points)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + LOCAL_VARS; + (void) flags; + + RESET_OCCLUSION; + INIT(GL_POINTS); + RENDER_POINTS( start, count ); + POSTFIX; +} + +static void TAG(render_lines)( GLcontext *ctx, + GLuint start, + GLuint count, + GLuint flags ) +{ + GLuint j; + LOCAL_VARS; + (void) flags; + + RESET_OCCLUSION; + INIT(GL_LINES); + for (j=start+1; j + * Keith Whitwell + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "mmath.h" +#include "mem.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + +/*********************************************************************** + * Automatic texture coordinate generation (texgen) code. + */ + + +struct texgen_stage_data; + +typedef void (*texgen_func)( GLcontext *ctx, + struct texgen_stage_data *store, + GLuint unit); + + +struct texgen_stage_data { + + /* Per-texunit derived state. + */ + GLuint TexgenSize[MAX_TEXTURE_UNITS]; + GLuint TexgenHoles[MAX_TEXTURE_UNITS]; + texgen_func TexgenFunc[MAX_TEXTURE_UNITS]; + + /* Temporary values used in texgen. + */ + GLfloat (*tmp_f)[3]; + GLfloat *tmp_m; + + /* Buffered outputs of the stage. + */ + GLvector4f texcoord[MAX_TEXTURE_UNITS]; +}; + + +#define TEXGEN_STAGE_DATA(stage) ((struct texgen_stage_data *)stage->private) + + + + +static GLuint all_bits[5] = { + 0, + VEC_SIZE_1, + VEC_SIZE_2, + VEC_SIZE_3, + VEC_SIZE_4, +}; + +#define VEC_SIZE_FLAGS (VEC_SIZE_1|VEC_SIZE_2|VEC_SIZE_3|VEC_SIZE_4) + +/* + */ +static void build_m3(GLfloat f[][3], GLfloat m[], + const GLvector3f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = (GLfloat *)eye->start; + GLuint count = eye->count; + const GLfloat *norm = normal->start; + GLuint i; + + + /* KW: Had to rearrange this loop to avoid a compiler bug with gcc + * 2.7.3.1 at -O3 optimization. Using -fno-strength-reduce + * also fixed the bug - is this generally necessary? + */ + for (i=0;istride); + } +} + + + +static void build_m2(GLfloat f[][3], GLfloat m[], + const GLvector3f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = eye->start; + GLuint count = eye->count; + + GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride); + } +} + + + +typedef void (*build_m_func)(GLfloat f[][3], + GLfloat m[], + const GLvector3f *normal, + const GLvector4f *eye ); + + + +static build_m_func build_m_tab[5] = { + 0, + 0, + build_m2, + build_m3, + build_m3 +}; + + +/* This is unusual in that we respect the stride of the output vector + * (f). This allows us to pass in either a texcoord vector4f, or a + * temporary vector3f. + */ +static void build_f3( GLfloat *f, + GLuint fstride, + const GLvector3f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = eye->start; + GLuint count = eye->count; + + GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride); + } +} + + +static void build_f2( GLfloat *f, + GLuint fstride, + const GLvector3f *normal, + const GLvector4f *eye ) +{ + GLuint stride = eye->stride; + GLfloat *coord = eye->start; + GLuint count = eye->count; + GLfloat *norm = normal->start; + GLuint i; + + for (i=0;istride); + } +} + +typedef void (*build_f_func)( GLfloat *f, + GLuint fstride, + const GLvector3f *normal_vec, + const GLvector4f *eye ); + + + +/* Just treat 4-vectors as 3-vectors. + */ +static build_f_func build_f_tab[5] = { + 0, + 0, + build_f2, + build_f3, + build_f3 +}; + + +/* Special case texgen functions. + */ +static void texgen_reflection_map_nv( GLcontext *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLvector4f *in = VB->TexCoordPtr[unit]; + GLvector4f *out = &store->texcoord[unit]; + + build_f_tab[VB->EyePtr->size]( out->start, + out->stride, + VB->NormalPtr, + VB->EyePtr ); + + if (in) { + out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; + out->count = in->count; + out->size = MAX2(in->size, 3); + if (in->size == 4) + gl_copy_tab[0][0x8](out, in, 0); + } + else { + out->flags |= VEC_SIZE_3; + out->size = 3; + out->count = in->count; + } + +} + + + +static void texgen_normal_map_nv( GLcontext *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLvector4f *in = VB->TexCoordPtr[unit]; + GLvector4f *out = &store->texcoord[unit]; + GLvector3f *normal = VB->NormalPtr; + GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->start; + GLuint count = VB->Count; + GLuint i; + const GLfloat *norm = normal->start; + + for (i=0;istride)) { + texcoord[i][0] = norm[0]; + texcoord[i][1] = norm[1]; + texcoord[i][2] = norm[2]; + } + + + if (in) { + out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_3; + out->count = in->count; + out->size = MAX2(in->size, 3); + if (in->size == 4) + gl_copy_tab[0][0x8](out, in, 0); + } + else { + out->flags |= VEC_SIZE_3; + out->size = 3; + out->count = in->count; + } +} + + +static void texgen_sphere_map( GLcontext *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLvector4f *in = VB->TexCoordPtr[unit]; + GLvector4f *out = &store->texcoord[unit]; + GLfloat (*texcoord)[4] = (GLfloat (*)[4]) out->start; + GLuint count = VB->Count; + GLuint i; + GLfloat (*f)[3] = store->tmp_f; + GLfloat *m = store->tmp_m; + + (build_m_tab[VB->EyePtr->size])( store->tmp_f, + store->tmp_m, + VB->NormalPtr, + VB->EyePtr ); + + for (i=0;isize = MAX2(in->size,2); + out->count = in->count; + out->flags |= (in->flags & VEC_SIZE_FLAGS) | VEC_SIZE_2; + if (in->size > 2) + gl_copy_tab[0][all_bits[in->size] & ~0x3](out, in, 0); + } else { + out->size = 2; + out->flags |= VEC_SIZE_2; + out->count = in->count; + } +} + + + +static void texgen( GLcontext *ctx, + struct texgen_stage_data *store, + GLuint unit ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *VB = &tnl->vb; + GLvector4f *in = VB->TexCoordPtr[unit]; + GLvector4f *out = &store->texcoord[unit]; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + const GLvector4f *obj = VB->ObjPtr; + const GLvector4f *eye = VB->EyePtr; + const GLvector3f *normal = VB->NormalPtr; + GLfloat (*texcoord)[4] = (GLfloat (*)[4])out->data; + GLfloat *indata; + GLuint count = VB->Count; + GLfloat (*f)[3] = store->tmp_f; + GLfloat *m = store->tmp_m; + + + if (texUnit->_GenFlags & TEXGEN_NEED_M) { + build_m_tab[in->size]( store->tmp_f, store->tmp_m, normal, eye ); + } else if (texUnit->_GenFlags & TEXGEN_NEED_F) { + build_f_tab[in->size]( (GLfloat *)store->tmp_f, 3, normal, eye ); + } + + if (in != out) { + GLuint copy = (all_bits[in->size] & ~texUnit->TexGenEnabled); + if (copy) + gl_copy_tab[0][copy](out, in, 0); + } + + if (store->TexgenHoles[unit]) + { + GLuint holes = (~all_bits[in->size] & store->TexgenHoles[unit]); + if (holes) { + if (holes & VEC_DIRTY_2) gl_vector4f_clean_elem(out, count, 2); + if (holes & VEC_DIRTY_1) gl_vector4f_clean_elem(out, count, 1); + if (holes & VEC_DIRTY_0) gl_vector4f_clean_elem(out, count, 0); + } + } + + out->size = MAX2(in->size, store->TexgenSize[unit]); + out->flags |= (in->flags & VEC_SIZE_FLAGS) | texUnit->TexGenEnabled; + out->count = in->count; + + if (texUnit->TexGenEnabled & S_BIT) { + GLuint i; + switch (texUnit->GenModeS) { + case GL_OBJECT_LINEAR: + (gl_dotprod_tab[0][obj->size])((GLfloat *)out->data, + sizeof(out->data[0]), obj, + texUnit->ObjectPlaneS, 0); + break; + case GL_EYE_LINEAR: + (gl_dotprod_tab[0][eye->size])((GLfloat *)out->data, + sizeof(out->data[0]), eye, + texUnit->EyePlaneS, 0); + break; + case GL_SPHERE_MAP: + for (indata=in->start,i=0 ; istride)) + texcoord[i][0] = indata[0] * m[i] + 0.5F; + break; + case GL_REFLECTION_MAP_NV: + for (i=0;istart; + for (i=0;istride)) { + texcoord[i][0] = norm[0]; + } + break; + } + default: + gl_problem(ctx, "Bad S texgen"); + } + } + + if (texUnit->TexGenEnabled & T_BIT) { + GLuint i; + switch (texUnit->GenModeT) { + case GL_OBJECT_LINEAR: + (gl_dotprod_tab[0][obj->size])(&(out->data[0][1]), + sizeof(out->data[0]), obj, + texUnit->ObjectPlaneT, 0); + break; + case GL_EYE_LINEAR: + (gl_dotprod_tab[0][eye->size])(&(out->data[0][1]), + sizeof(out->data[0]), eye, + texUnit->EyePlaneT, 0); + break; + case GL_SPHERE_MAP: + for (indata=in->start,i=0; istride)) + texcoord[i][1] = indata[1] * m[i] + 0.5F; + break; + case GL_REFLECTION_MAP_NV: + for (i=0;istart; + for (i=0;istride)) { + texcoord[i][1] = norm[1]; + } + break; + } + default: + gl_problem(ctx, "Bad T texgen"); + } + } + + if (texUnit->TexGenEnabled & R_BIT) { + GLuint i; + switch (texUnit->GenModeR) { + case GL_OBJECT_LINEAR: + (gl_dotprod_tab[0][obj->size])(&(out->data[0][2]), + sizeof(out->data[0]), obj, + texUnit->ObjectPlaneR, 0); + break; + case GL_EYE_LINEAR: + (gl_dotprod_tab[0][eye->size])(&(out->data[0][2]), + sizeof(out->data[0]), eye, + texUnit->EyePlaneR, 0); + break; + case GL_REFLECTION_MAP_NV: + for (i=0;istart; + for (i=0;istride)) { + texcoord[i][2] = norm[2]; + } + break; + } + default: + gl_problem(ctx, "Bad R texgen"); + } + } + + if (texUnit->TexGenEnabled & Q_BIT) { + switch (texUnit->GenModeQ) { + case GL_OBJECT_LINEAR: + (gl_dotprod_tab[0][obj->size])(&(out->data[0][3]), + sizeof(out->data[0]), obj, + texUnit->ObjectPlaneQ, 0); + break; + case GL_EYE_LINEAR: + (gl_dotprod_tab[0][eye->size])(&(out->data[0][3]), + sizeof(out->data[0]), eye, + texUnit->EyePlaneQ, 0); + break; + default: + gl_problem(ctx, "Bad Q texgen"); + } + } +} + + + +static GLboolean run_texgen_stage( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct texgen_stage_data *store = TEXGEN_STAGE_DATA( stage ); + GLuint i; + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + if (ctx->_Enabled & ENABLE_TEXGEN(i)) { + if (stage->changed_inputs & (VERT_EYE | VERT_NORM | VERT_TEX(i))) + store->TexgenFunc[i]( ctx, store, i ); + + VB->TexCoordPtr[i] = &store->texcoord[i]; + } + + return GL_TRUE; +} + + + + +static GLboolean run_validate_texgen_stage( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); + GLuint i; + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + + if (texUnit->TexGenEnabled) { + GLuint sz; + + if (texUnit->TexGenEnabled & R_BIT) + sz = 4; + else if (texUnit->TexGenEnabled & Q_BIT) + sz = 3; + else if (texUnit->TexGenEnabled & T_BIT) + sz = 2; + else + sz = 1; + + store->TexgenSize[i] = sz; + store->TexgenHoles[i] = (all_bits[sz] & ~texUnit->TexGenEnabled); + store->TexgenFunc[i] = texgen; + + if (texUnit->TexGenEnabled == (S_BIT|T_BIT|R_BIT)) { + if (texUnit->_GenFlags == TEXGEN_REFLECTION_MAP_NV) { + store->TexgenFunc[i] = texgen_reflection_map_nv; + } + else if (texUnit->_GenFlags == TEXGEN_NORMAL_MAP_NV) { + store->TexgenFunc[i] = texgen_normal_map_nv; + } + } + else if (texUnit->TexGenEnabled == (S_BIT|T_BIT) && + texUnit->_GenFlags == TEXGEN_SPHERE_MAP) { + store->TexgenFunc[i] = texgen_sphere_map; + } + } + } + + stage->run = run_texgen_stage; + return stage->run( ctx, stage ); +} + + +static void check_texgen( GLcontext *ctx, struct gl_pipeline_stage *stage ) +{ + GLuint i; + stage->active = 0; + + if (ctx->_Enabled & ENABLE_TEXGEN_ANY) { + GLuint inputs = 0; + GLuint outputs = 0; + + if (ctx->Texture._GenFlags & TEXGEN_NEED_VERTICES) + inputs |= VERT_EYE; + + if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) + inputs |= VERT_NORM; + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + if (ctx->_Enabled & ENABLE_TEXGEN(i)) + { + outputs |= VERT_TEX(i); + + /* Need the original input in case it contains a Q coord: + * (sigh) + */ + if ((ctx->Texture.Unit[i]._ReallyEnabled|Q_BIT) & + ~ctx->Texture.Unit[i].TexGenEnabled) + inputs |= VERT_TEX(i); + + /* Something for Feedback? */ + } + + if (stage->private) + stage->run = run_validate_texgen_stage; + stage->active = 1; + stage->inputs = inputs; + stage->outputs = outputs; + } +} + + + + +/* Called the first time stage->run() is invoked. + */ +static GLboolean alloc_texgen_data( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct texgen_stage_data *store; + GLuint i; + + stage->private = CALLOC(sizeof(*store)); + store = TEXGEN_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + gl_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); + + store->tmp_f = (GLfloat (*)[3]) MALLOC(VB->Size * sizeof(GLfloat) * 3); + store->tmp_m = (GLfloat *) MALLOC(VB->Size * sizeof(GLfloat)); + + /* Now validate and run the stage. + */ + stage->run = run_validate_texgen_stage; + return stage->run( ctx, stage ); +} + + +static void free_texgen_data( struct gl_pipeline_stage *stage ) + +{ + struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage); + GLuint i; + + if (store) { + for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) + if (store->texcoord[i].data) + gl_vector4f_free( &store->texcoord[i] ); + + + if (store->tmp_f) FREE( store->tmp_f ); + if (store->tmp_m) FREE( store->tmp_m ); + FREE( store ); + stage->private = 0; + } +} + + + +const struct gl_pipeline_stage _tnl_texgen_stage = +{ + "texgen", + _NEW_TEXTURE, /* when to call check() */ + _NEW_TEXTURE, /* when to invalidate stored data */ + 0,0,0, /* active, inputs, outputs */ + 0,0, /* changed_inputs, private */ + free_texgen_data, /* destructor */ + check_texgen, /* check */ + alloc_texgen_data /* run -- initially set to alloc data */ +}; + + diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c new file mode 100644 index 00000000000..ea415a550e3 --- /dev/null +++ b/src/mesa/tnl/t_vb_texmat.c @@ -0,0 +1,148 @@ +/* $Id: t_vb_texmat.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + +/* Is there any real benefit seperating texmat from texgen? It means + * we need two lots of intermediate storage. Any changes to + * _NEW_TEXTURE will invalidate both sets -- it's only on changes to + * *only* _NEW_TEXTURE_MATRIX that texgen survives but texmat doesn't. + * + * However, the seperation of this code from the complex texgen stuff + * is very appealing. + */ +struct texmat_stage_data { + GLvector4f texcoord[MAX_TEXTURE_UNITS]; +}; + +#define TEXMAT_STAGE_DATA(stage) ((struct texmat_stage_data *)stage->private) + +static void check_texmat( GLcontext *ctx, struct gl_pipeline_stage *stage ) +{ + GLuint i; + stage->active = 0; + + if (ctx->_Enabled & ENABLE_TEXMAT_ANY) { + GLuint flags = 0; + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + if (ctx->_Enabled & ENABLE_TEXMAT(i)) + flags |= VERT_TEX(i); + + stage->active = 1; + stage->inputs = flags; + stage->outputs = flags; + } +} + +static GLboolean run_texmat_stage( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + GLuint i; + + /* ENABLE_TEXMAT implies that the texture matrix is not the + * identity, so we don't have to check that here. + */ + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + if (ctx->_Enabled & ENABLE_TEXMAT(i)) { + if (stage->changed_inputs & VERT_TEX(i)) + (void) TransformRaw( &store->texcoord[i], &ctx->TextureMatrix[i], + VB->TexCoordPtr[i]); + + VB->TexCoordPtr[i] = &store->texcoord[i]; + } + return GL_TRUE; +} + + +/* Called the first time stage->run() is invoked. + */ +static GLboolean alloc_texmat_data( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct texmat_stage_data *store; + GLuint i; + + stage->private = CALLOC(sizeof(*store)); + store = TEXMAT_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) + gl_vector4f_alloc( &store->texcoord[i], 0, VB->Size, 32 ); + + /* Now run the stage. + */ + stage->run = run_texmat_stage; + return stage->run( ctx, stage ); +} + + +static void free_texmat_data( struct gl_pipeline_stage *stage ) +{ + struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage); + GLuint i; + + if (store) { + for (i = 0 ; i < MAX_TEXTURE_UNITS ; i++) + if (store->texcoord[i].data) + gl_vector4f_free( &store->texcoord[i] ); + FREE( store ); + stage->private = 0; + } +} + + + +const struct gl_pipeline_stage _tnl_texture_transform_stage = +{ + "texture transform", + _NEW_TEXTURE|_NEW_TEXTURE_MATRIX, + _NEW_TEXTURE|_NEW_TEXTURE_MATRIX, + 0,0,0, /* active, inputs, outputs */ + 0,0, /* changed_inputs, private */ + free_texmat_data, /* destructor */ + check_texmat, /* check */ + alloc_texmat_data, /* run -- initially set to init */ +}; diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c new file mode 100644 index 00000000000..7667d423a8b --- /dev/null +++ b/src/mesa/tnl/t_vb_vertex.c @@ -0,0 +1,311 @@ +/* $Id: t_vb_vertex.c,v 1.1 2000/12/26 05:09:33 keithw Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Keith Whitwell + */ + + +#include "glheader.h" +#include "colormac.h" +#include "context.h" +#include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "mtypes.h" + +#include "math/m_xform.h" + +#include "t_context.h" +#include "t_pipeline.h" + + + +struct vertex_stage_data { + GLvector4f eye; + GLvector4f clip; + GLvector4f proj; + GLubyte *clipmask; + GLubyte ormask; + GLubyte andmask; + + + /* Need these because it's difficult to replay the sideeffects + * analytically. + */ + GLvector4f *save_eyeptr; + GLvector4f *save_clipptr; + GLvector4f *save_projptr; +}; + +#define VERTEX_STAGE_DATA(stage) ((struct vertex_stage_data *)stage->private) + + + + +/* This function implements cliptesting for user-defined clip planes. + * The clipping of primitives to these planes is implemented in + * t_render_clip.h. + */ +#define USER_CLIPTEST(NAME, SZ) \ +static void NAME( GLcontext *ctx, \ + GLvector4f *clip, \ + GLubyte *clipmask, \ + GLubyte *clipormask, \ + GLubyte *clipandmask ) \ +{ \ + GLuint p; \ + \ + for (p = 0; p < ctx->Const.MaxClipPlanes; p++) \ + if (ctx->Transform.ClipEnabled[p]) { \ + GLuint nr, i; \ + 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 = (GLfloat *)clip->data; \ + GLuint stride = clip->stride; \ + GLuint count = clip->count; \ + \ + for (nr = 0, i = 0 ; i < count ; i++) { \ + GLfloat dp = coord[0] * a + coord[1] * b; \ + if (SZ > 2) dp += coord[2] * c; \ + if (SZ > 3) dp += coord[3] * d; else dp += d; \ + \ + if (dp < 0) { \ + nr++; \ + clipmask[i] |= CLIP_USER_BIT; \ + } \ + \ + STRIDE_F(coord, stride); \ + } \ + \ + if (nr > 0) { \ + *clipormask |= CLIP_USER_BIT; \ + if (nr == count) { \ + *clipandmask |= CLIP_USER_BIT; \ + return; \ + } \ + } \ + } \ +} + + +USER_CLIPTEST(userclip2, 2) +USER_CLIPTEST(userclip3, 3) +USER_CLIPTEST(userclip4, 4) + +static void (*(usercliptab[5]))( GLcontext *, + GLvector4f *, GLubyte *, + GLubyte *, GLubyte * ) = +{ + 0, + 0, + userclip2, + userclip3, + userclip4 +}; + + + +static GLboolean run_vertex_stage( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct vertex_stage_data *store = (struct vertex_stage_data *)stage->private; + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + + if (stage->changed_inputs) + { +/* VB->ObjPtr->size = 4; */ + + if (ctx->_NeedEyeCoords) { + /* Seperate modelview and project transformations: + */ + if (ctx->ModelView.type == MATRIX_IDENTITY) + VB->EyePtr = VB->ObjPtr; + else + VB->EyePtr = TransformRaw( &store->eye, &ctx->ModelView, + VB->ObjPtr); + + if (ctx->ProjectionMatrix.type == MATRIX_IDENTITY) + VB->ClipPtr = VB->EyePtr; + else + VB->ClipPtr = TransformRaw( &store->clip, &ctx->ProjectionMatrix, + VB->EyePtr ); + } + else + { + /* Combined modelviewproject transform: + */ + if (ctx->_ModelProjectMatrix.type == MATRIX_IDENTITY) + VB->ClipPtr = VB->ObjPtr; + else + VB->ClipPtr = TransformRaw( &store->clip, &ctx->_ModelProjectMatrix, + VB->ObjPtr ); + } + + /* Cliptest and perspective divide. Clip functions must clear + * the clipmask. + */ + store->ormask = 0; + store->andmask = CLIP_ALL_BITS; + + VB->ProjectedClipPtr = + gl_clip_tab[VB->ClipPtr->size]( VB->ClipPtr, + &store->proj, + store->clipmask, + &store->ormask, + &store->andmask ); + + if (store->andmask) + return GL_FALSE; + + + /* Test userclip planes. This contributes to VB->ClipMask, so + * is essentially required to be in this stage. + */ + if (ctx->Transform._AnyClip) { + usercliptab[VB->ClipPtr->size]( ctx, + VB->ClipPtr, + store->clipmask, + &store->ormask, + &store->andmask ); + + if (store->andmask) + return GL_FALSE; + } + + VB->ClipOrMask = store->ormask; + VB->ClipMask = store->clipmask; + + if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_OBJ)) + VB->importable_data |= VERT_CLIP; + + /* Drivers expect this to be size 4... + */ + if (VB->ProjectedClipPtr->size < 4) { + ASSERT(VB->ProjectedClipPtr == VB->ClipPtr); + if (VB->ProjectedClipPtr->flags & VEC_NOT_WRITEABLE) { + ASSERT(VB->ProjectedClipPtr == VB->ObjPtr); + VB->import_data( ctx, VERT_OBJ, VEC_NOT_WRITEABLE ); + VB->ProjectedClipPtr = VB->ClipPtr = VB->ObjPtr; + } + if (VB->ClipPtr->size == 2) + gl_vector4f_clean_elem( VB->ClipPtr, VB->Count, 2 ); + gl_vector4f_clean_elem( VB->ClipPtr, VB->Count, 3 ); + VB->ClipPtr->size = 4; + } + + store->save_eyeptr = VB->EyePtr; + store->save_clipptr = VB->ClipPtr; + store->save_projptr = VB->ProjectedClipPtr; + } + else { + /* Replay the sideeffects. + */ + VB->EyePtr = store->save_eyeptr; + VB->ClipPtr = store->save_clipptr; + VB->ProjectedClipPtr = store->save_projptr; + VB->ClipMask = store->clipmask; + VB->ClipOrMask = store->ormask; + if (VB->ClipPtr == VB->ObjPtr && (VB->importable_data & VERT_OBJ)) + VB->importable_data |= VERT_CLIP; + if (store->andmask) + return GL_FALSE; + } + + return GL_TRUE; +} + + +static void check_vertex( GLcontext *ctx, struct gl_pipeline_stage *stage ) +{ + (void) ctx; + (void) stage; +} + +static GLboolean init_vertex_stage( GLcontext *ctx, + struct gl_pipeline_stage *stage ) +{ + struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; + struct vertex_stage_data *store; + GLuint size = VB->Size; + + stage->private = CALLOC(sizeof(*store)); + store = VERTEX_STAGE_DATA(stage); + if (!store) + return GL_FALSE; + + gl_vector4f_alloc( &store->eye, 0, size, 32 ); + gl_vector4f_alloc( &store->clip, 0, size, 32 ); + gl_vector4f_alloc( &store->proj, 0, size, 32 ); + + store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); + + if (!store->clipmask || + !store->eye.data || + !store->clip.data || + !store->proj.data) + return GL_FALSE; + + /* Now run the stage. + */ + stage->run = run_vertex_stage; + return stage->run( ctx, stage ); +} + +static void dtr( struct gl_pipeline_stage *stage ) +{ + struct vertex_stage_data *store = VERTEX_STAGE_DATA(stage); + + if (store) { + gl_vector4f_free( &store->eye ); + gl_vector4f_free( &store->clip ); + gl_vector4f_free( &store->proj ); + ALIGN_FREE( store->clipmask ); + FREE(store); + stage->private = 0; + stage->run = init_vertex_stage; + } +} + + +const struct gl_pipeline_stage _tnl_vertex_transform_stage = +{ + "modelview/project/cliptest/divide", + 0, /* re-check -- always on */ + _NEW_MODELVIEW| + _NEW_PROJECTION| + _NEW_TRANSFORM, /* re-run */ + GL_TRUE, /* active */ + VERT_OBJ, /* inputs */ + VERT_EYE|VERT_CLIP, /* outputs */ + 0, 0, /* changed_inputs, private */ + dtr, /* destructor */ + check_vertex, /* check */ + init_vertex_stage /* run -- initially set to init */ +}; + + diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h index c14ed296ad5..f95ce0e5037 100644 --- a/src/mesa/tnl/tnl.h +++ b/src/mesa/tnl/tnl.h @@ -32,8 +32,9 @@ -/* These are the public-access functions exported from tnl. (Many - * more are currently hooked into dispatch directly by core code.) +/* These are the public-access functions exported from tnl. (A few + * more are currently hooked into dispatch directly by the module + * itself.) */ extern GLboolean _tnl_CreateContext( GLcontext *ctx ); @@ -59,4 +60,16 @@ extern void _tnl_wakeup_save_exec( GLcontext *ctx ); +/* Functions to assist driver t&l modules which have to fallback to + * this module in the middle of a begin/end pair. Use this instead of + * glBegin() to identify the primitive as wrapped: + * + * Even with this it's difficult to see how the drivers are going to + * replay any glMaterial commands received in the few vertices before + * the fallback. + */ +extern void +_tnl_fallback_begin( GLcontext *ctx, GLenum mode ); + + #endif diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index f88df17293f..4d6382070a9 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -23,4960 +23,3720 @@ ALIGNTEXT16 GLOBL_FN(GL_PREFIX(NewList)) GL_PREFIX(NewList): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_NewList)) JMP(GL_OFFSET(_gloffset_NewList)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EndList)) GL_PREFIX(EndList): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EndList)) JMP(GL_OFFSET(_gloffset_EndList)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CallList)) GL_PREFIX(CallList): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CallList)) JMP(GL_OFFSET(_gloffset_CallList)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CallLists)) GL_PREFIX(CallLists): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CallLists)) JMP(GL_OFFSET(_gloffset_CallLists)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DeleteLists)) GL_PREFIX(DeleteLists): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DeleteLists)) JMP(GL_OFFSET(_gloffset_DeleteLists)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GenLists)) GL_PREFIX(GenLists): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GenLists)) JMP(GL_OFFSET(_gloffset_GenLists)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ListBase)) GL_PREFIX(ListBase): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ListBase)) JMP(GL_OFFSET(_gloffset_ListBase)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Begin)) GL_PREFIX(Begin): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Begin)) JMP(GL_OFFSET(_gloffset_Begin)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Bitmap)) GL_PREFIX(Bitmap): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Bitmap)) JMP(GL_OFFSET(_gloffset_Bitmap)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3b)) GL_PREFIX(Color3b): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3b)) JMP(GL_OFFSET(_gloffset_Color3b)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3bv)) GL_PREFIX(Color3bv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3bv)) JMP(GL_OFFSET(_gloffset_Color3bv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3d)) GL_PREFIX(Color3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3d)) JMP(GL_OFFSET(_gloffset_Color3d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3dv)) GL_PREFIX(Color3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3dv)) JMP(GL_OFFSET(_gloffset_Color3dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3f)) GL_PREFIX(Color3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3f)) JMP(GL_OFFSET(_gloffset_Color3f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3fv)) GL_PREFIX(Color3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3fv)) JMP(GL_OFFSET(_gloffset_Color3fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3i)) GL_PREFIX(Color3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3i)) JMP(GL_OFFSET(_gloffset_Color3i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3iv)) GL_PREFIX(Color3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3iv)) JMP(GL_OFFSET(_gloffset_Color3iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3s)) GL_PREFIX(Color3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3s)) JMP(GL_OFFSET(_gloffset_Color3s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3sv)) GL_PREFIX(Color3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3sv)) JMP(GL_OFFSET(_gloffset_Color3sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3ub)) GL_PREFIX(Color3ub): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3ub)) JMP(GL_OFFSET(_gloffset_Color3ub)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3ubv)) GL_PREFIX(Color3ubv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3ubv)) JMP(GL_OFFSET(_gloffset_Color3ubv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3ui)) GL_PREFIX(Color3ui): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3ui)) JMP(GL_OFFSET(_gloffset_Color3ui)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3uiv)) GL_PREFIX(Color3uiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3uiv)) JMP(GL_OFFSET(_gloffset_Color3uiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3us)) GL_PREFIX(Color3us): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3us)) JMP(GL_OFFSET(_gloffset_Color3us)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3usv)) GL_PREFIX(Color3usv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3usv)) JMP(GL_OFFSET(_gloffset_Color3usv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4b)) GL_PREFIX(Color4b): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4b)) JMP(GL_OFFSET(_gloffset_Color4b)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4bv)) GL_PREFIX(Color4bv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4bv)) JMP(GL_OFFSET(_gloffset_Color4bv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4d)) GL_PREFIX(Color4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4d)) JMP(GL_OFFSET(_gloffset_Color4d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4dv)) GL_PREFIX(Color4dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4dv)) JMP(GL_OFFSET(_gloffset_Color4dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4f)) GL_PREFIX(Color4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4f)) JMP(GL_OFFSET(_gloffset_Color4f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4fv)) GL_PREFIX(Color4fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4fv)) JMP(GL_OFFSET(_gloffset_Color4fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4i)) GL_PREFIX(Color4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4i)) JMP(GL_OFFSET(_gloffset_Color4i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4iv)) GL_PREFIX(Color4iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4iv)) JMP(GL_OFFSET(_gloffset_Color4iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4s)) GL_PREFIX(Color4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4s)) JMP(GL_OFFSET(_gloffset_Color4s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4sv)) GL_PREFIX(Color4sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4sv)) JMP(GL_OFFSET(_gloffset_Color4sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4ub)) GL_PREFIX(Color4ub): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4ub)) JMP(GL_OFFSET(_gloffset_Color4ub)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4ubv)) GL_PREFIX(Color4ubv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4ubv)) JMP(GL_OFFSET(_gloffset_Color4ubv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4ui)) GL_PREFIX(Color4ui): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4ui)) JMP(GL_OFFSET(_gloffset_Color4ui)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4uiv)) GL_PREFIX(Color4uiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4uiv)) JMP(GL_OFFSET(_gloffset_Color4uiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4us)) GL_PREFIX(Color4us): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4us)) JMP(GL_OFFSET(_gloffset_Color4us)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4usv)) GL_PREFIX(Color4usv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4usv)) JMP(GL_OFFSET(_gloffset_Color4usv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EdgeFlag)) GL_PREFIX(EdgeFlag): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EdgeFlag)) JMP(GL_OFFSET(_gloffset_EdgeFlag)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EdgeFlagv)) GL_PREFIX(EdgeFlagv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EdgeFlagv)) JMP(GL_OFFSET(_gloffset_EdgeFlagv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(End)) GL_PREFIX(End): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_End)) JMP(GL_OFFSET(_gloffset_End)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexd)) GL_PREFIX(Indexd): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexd)) JMP(GL_OFFSET(_gloffset_Indexd)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexdv)) GL_PREFIX(Indexdv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexdv)) JMP(GL_OFFSET(_gloffset_Indexdv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexf)) GL_PREFIX(Indexf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexf)) JMP(GL_OFFSET(_gloffset_Indexf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexfv)) GL_PREFIX(Indexfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexfv)) JMP(GL_OFFSET(_gloffset_Indexfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexi)) GL_PREFIX(Indexi): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexi)) JMP(GL_OFFSET(_gloffset_Indexi)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexiv)) GL_PREFIX(Indexiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexiv)) JMP(GL_OFFSET(_gloffset_Indexiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexs)) GL_PREFIX(Indexs): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexs)) JMP(GL_OFFSET(_gloffset_Indexs)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexsv)) GL_PREFIX(Indexsv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexsv)) JMP(GL_OFFSET(_gloffset_Indexsv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3b)) GL_PREFIX(Normal3b): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3b)) JMP(GL_OFFSET(_gloffset_Normal3b)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3bv)) GL_PREFIX(Normal3bv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3bv)) JMP(GL_OFFSET(_gloffset_Normal3bv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3d)) GL_PREFIX(Normal3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3d)) JMP(GL_OFFSET(_gloffset_Normal3d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3dv)) GL_PREFIX(Normal3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3dv)) JMP(GL_OFFSET(_gloffset_Normal3dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3f)) GL_PREFIX(Normal3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3f)) JMP(GL_OFFSET(_gloffset_Normal3f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3fv)) GL_PREFIX(Normal3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3fv)) JMP(GL_OFFSET(_gloffset_Normal3fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3i)) GL_PREFIX(Normal3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3i)) JMP(GL_OFFSET(_gloffset_Normal3i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3iv)) GL_PREFIX(Normal3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3iv)) JMP(GL_OFFSET(_gloffset_Normal3iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3s)) GL_PREFIX(Normal3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3s)) JMP(GL_OFFSET(_gloffset_Normal3s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Normal3sv)) GL_PREFIX(Normal3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3sv)) JMP(GL_OFFSET(_gloffset_Normal3sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2d)) GL_PREFIX(RasterPos2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2d)) JMP(GL_OFFSET(_gloffset_RasterPos2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2dv)) GL_PREFIX(RasterPos2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2dv)) JMP(GL_OFFSET(_gloffset_RasterPos2dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2f)) GL_PREFIX(RasterPos2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2f)) JMP(GL_OFFSET(_gloffset_RasterPos2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2fv)) GL_PREFIX(RasterPos2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2fv)) JMP(GL_OFFSET(_gloffset_RasterPos2fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2i)) GL_PREFIX(RasterPos2i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2i)) JMP(GL_OFFSET(_gloffset_RasterPos2i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2iv)) GL_PREFIX(RasterPos2iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2iv)) JMP(GL_OFFSET(_gloffset_RasterPos2iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2s)) GL_PREFIX(RasterPos2s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2s)) JMP(GL_OFFSET(_gloffset_RasterPos2s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos2sv)) GL_PREFIX(RasterPos2sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2sv)) JMP(GL_OFFSET(_gloffset_RasterPos2sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3d)) GL_PREFIX(RasterPos3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3d)) JMP(GL_OFFSET(_gloffset_RasterPos3d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3dv)) GL_PREFIX(RasterPos3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3dv)) JMP(GL_OFFSET(_gloffset_RasterPos3dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3f)) GL_PREFIX(RasterPos3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3f)) JMP(GL_OFFSET(_gloffset_RasterPos3f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3fv)) GL_PREFIX(RasterPos3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3fv)) JMP(GL_OFFSET(_gloffset_RasterPos3fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3i)) GL_PREFIX(RasterPos3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3i)) JMP(GL_OFFSET(_gloffset_RasterPos3i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3iv)) GL_PREFIX(RasterPos3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3iv)) JMP(GL_OFFSET(_gloffset_RasterPos3iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3s)) GL_PREFIX(RasterPos3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3s)) JMP(GL_OFFSET(_gloffset_RasterPos3s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos3sv)) GL_PREFIX(RasterPos3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3sv)) JMP(GL_OFFSET(_gloffset_RasterPos3sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4d)) GL_PREFIX(RasterPos4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4d)) JMP(GL_OFFSET(_gloffset_RasterPos4d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4dv)) GL_PREFIX(RasterPos4dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4dv)) JMP(GL_OFFSET(_gloffset_RasterPos4dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4f)) GL_PREFIX(RasterPos4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4f)) JMP(GL_OFFSET(_gloffset_RasterPos4f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4fv)) GL_PREFIX(RasterPos4fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4fv)) JMP(GL_OFFSET(_gloffset_RasterPos4fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4i)) GL_PREFIX(RasterPos4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4i)) JMP(GL_OFFSET(_gloffset_RasterPos4i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4iv)) GL_PREFIX(RasterPos4iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4iv)) JMP(GL_OFFSET(_gloffset_RasterPos4iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4s)) GL_PREFIX(RasterPos4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4s)) JMP(GL_OFFSET(_gloffset_RasterPos4s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RasterPos4sv)) GL_PREFIX(RasterPos4sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4sv)) JMP(GL_OFFSET(_gloffset_RasterPos4sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectd)) GL_PREFIX(Rectd): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectd)) JMP(GL_OFFSET(_gloffset_Rectd)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectdv)) GL_PREFIX(Rectdv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectdv)) JMP(GL_OFFSET(_gloffset_Rectdv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectf)) GL_PREFIX(Rectf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectf)) JMP(GL_OFFSET(_gloffset_Rectf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectfv)) GL_PREFIX(Rectfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectfv)) JMP(GL_OFFSET(_gloffset_Rectfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Recti)) GL_PREFIX(Recti): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Recti)) JMP(GL_OFFSET(_gloffset_Recti)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectiv)) GL_PREFIX(Rectiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectiv)) JMP(GL_OFFSET(_gloffset_Rectiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rects)) GL_PREFIX(Rects): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rects)) JMP(GL_OFFSET(_gloffset_Rects)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rectsv)) GL_PREFIX(Rectsv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectsv)) JMP(GL_OFFSET(_gloffset_Rectsv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1d)) GL_PREFIX(TexCoord1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1d)) JMP(GL_OFFSET(_gloffset_TexCoord1d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1dv)) GL_PREFIX(TexCoord1dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1dv)) JMP(GL_OFFSET(_gloffset_TexCoord1dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1f)) GL_PREFIX(TexCoord1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1f)) JMP(GL_OFFSET(_gloffset_TexCoord1f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1fv)) GL_PREFIX(TexCoord1fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1fv)) JMP(GL_OFFSET(_gloffset_TexCoord1fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1i)) GL_PREFIX(TexCoord1i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1i)) JMP(GL_OFFSET(_gloffset_TexCoord1i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1iv)) GL_PREFIX(TexCoord1iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1iv)) JMP(GL_OFFSET(_gloffset_TexCoord1iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1s)) GL_PREFIX(TexCoord1s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1s)) JMP(GL_OFFSET(_gloffset_TexCoord1s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord1sv)) GL_PREFIX(TexCoord1sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1sv)) JMP(GL_OFFSET(_gloffset_TexCoord1sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2d)) GL_PREFIX(TexCoord2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2d)) JMP(GL_OFFSET(_gloffset_TexCoord2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2dv)) GL_PREFIX(TexCoord2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2dv)) JMP(GL_OFFSET(_gloffset_TexCoord2dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2f)) GL_PREFIX(TexCoord2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2f)) JMP(GL_OFFSET(_gloffset_TexCoord2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2fv)) GL_PREFIX(TexCoord2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2fv)) JMP(GL_OFFSET(_gloffset_TexCoord2fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2i)) GL_PREFIX(TexCoord2i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2i)) JMP(GL_OFFSET(_gloffset_TexCoord2i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2iv)) GL_PREFIX(TexCoord2iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2iv)) JMP(GL_OFFSET(_gloffset_TexCoord2iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2s)) GL_PREFIX(TexCoord2s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2s)) JMP(GL_OFFSET(_gloffset_TexCoord2s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord2sv)) GL_PREFIX(TexCoord2sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2sv)) JMP(GL_OFFSET(_gloffset_TexCoord2sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3d)) GL_PREFIX(TexCoord3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3d)) JMP(GL_OFFSET(_gloffset_TexCoord3d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3dv)) GL_PREFIX(TexCoord3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3dv)) JMP(GL_OFFSET(_gloffset_TexCoord3dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3f)) GL_PREFIX(TexCoord3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3f)) JMP(GL_OFFSET(_gloffset_TexCoord3f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3fv)) GL_PREFIX(TexCoord3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3fv)) JMP(GL_OFFSET(_gloffset_TexCoord3fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3i)) GL_PREFIX(TexCoord3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3i)) JMP(GL_OFFSET(_gloffset_TexCoord3i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3iv)) GL_PREFIX(TexCoord3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3iv)) JMP(GL_OFFSET(_gloffset_TexCoord3iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3s)) GL_PREFIX(TexCoord3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3s)) JMP(GL_OFFSET(_gloffset_TexCoord3s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord3sv)) GL_PREFIX(TexCoord3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3sv)) JMP(GL_OFFSET(_gloffset_TexCoord3sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4d)) GL_PREFIX(TexCoord4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4d)) JMP(GL_OFFSET(_gloffset_TexCoord4d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4dv)) GL_PREFIX(TexCoord4dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4dv)) JMP(GL_OFFSET(_gloffset_TexCoord4dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4f)) GL_PREFIX(TexCoord4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4f)) JMP(GL_OFFSET(_gloffset_TexCoord4f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4fv)) GL_PREFIX(TexCoord4fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4fv)) JMP(GL_OFFSET(_gloffset_TexCoord4fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4i)) GL_PREFIX(TexCoord4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4i)) JMP(GL_OFFSET(_gloffset_TexCoord4i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4iv)) GL_PREFIX(TexCoord4iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4iv)) JMP(GL_OFFSET(_gloffset_TexCoord4iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4s)) GL_PREFIX(TexCoord4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4s)) JMP(GL_OFFSET(_gloffset_TexCoord4s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoord4sv)) GL_PREFIX(TexCoord4sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4sv)) JMP(GL_OFFSET(_gloffset_TexCoord4sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2d)) GL_PREFIX(Vertex2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2d)) JMP(GL_OFFSET(_gloffset_Vertex2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2dv)) GL_PREFIX(Vertex2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2dv)) JMP(GL_OFFSET(_gloffset_Vertex2dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2f)) GL_PREFIX(Vertex2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2f)) JMP(GL_OFFSET(_gloffset_Vertex2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2fv)) GL_PREFIX(Vertex2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2fv)) JMP(GL_OFFSET(_gloffset_Vertex2fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2i)) GL_PREFIX(Vertex2i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2i)) JMP(GL_OFFSET(_gloffset_Vertex2i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2iv)) GL_PREFIX(Vertex2iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2iv)) JMP(GL_OFFSET(_gloffset_Vertex2iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2s)) GL_PREFIX(Vertex2s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2s)) JMP(GL_OFFSET(_gloffset_Vertex2s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex2sv)) GL_PREFIX(Vertex2sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2sv)) JMP(GL_OFFSET(_gloffset_Vertex2sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3d)) GL_PREFIX(Vertex3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3d)) JMP(GL_OFFSET(_gloffset_Vertex3d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3dv)) GL_PREFIX(Vertex3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3dv)) JMP(GL_OFFSET(_gloffset_Vertex3dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3f)) GL_PREFIX(Vertex3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3f)) JMP(GL_OFFSET(_gloffset_Vertex3f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3fv)) GL_PREFIX(Vertex3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3fv)) JMP(GL_OFFSET(_gloffset_Vertex3fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3i)) GL_PREFIX(Vertex3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3i)) JMP(GL_OFFSET(_gloffset_Vertex3i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3iv)) GL_PREFIX(Vertex3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3iv)) JMP(GL_OFFSET(_gloffset_Vertex3iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3s)) GL_PREFIX(Vertex3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3s)) JMP(GL_OFFSET(_gloffset_Vertex3s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex3sv)) GL_PREFIX(Vertex3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3sv)) JMP(GL_OFFSET(_gloffset_Vertex3sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4d)) GL_PREFIX(Vertex4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4d)) JMP(GL_OFFSET(_gloffset_Vertex4d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4dv)) GL_PREFIX(Vertex4dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4dv)) JMP(GL_OFFSET(_gloffset_Vertex4dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4f)) GL_PREFIX(Vertex4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4f)) JMP(GL_OFFSET(_gloffset_Vertex4f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4fv)) GL_PREFIX(Vertex4fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4fv)) JMP(GL_OFFSET(_gloffset_Vertex4fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4i)) GL_PREFIX(Vertex4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4i)) JMP(GL_OFFSET(_gloffset_Vertex4i)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4iv)) GL_PREFIX(Vertex4iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4iv)) JMP(GL_OFFSET(_gloffset_Vertex4iv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4s)) GL_PREFIX(Vertex4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4s)) JMP(GL_OFFSET(_gloffset_Vertex4s)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Vertex4sv)) GL_PREFIX(Vertex4sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4sv)) JMP(GL_OFFSET(_gloffset_Vertex4sv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClipPlane)) GL_PREFIX(ClipPlane): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClipPlane)) JMP(GL_OFFSET(_gloffset_ClipPlane)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorMaterial)) GL_PREFIX(ColorMaterial): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorMaterial)) JMP(GL_OFFSET(_gloffset_ColorMaterial)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CullFace)) GL_PREFIX(CullFace): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CullFace)) JMP(GL_OFFSET(_gloffset_CullFace)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Fogf)) GL_PREFIX(Fogf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogf)) JMP(GL_OFFSET(_gloffset_Fogf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Fogfv)) GL_PREFIX(Fogfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogfv)) JMP(GL_OFFSET(_gloffset_Fogfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Fogi)) GL_PREFIX(Fogi): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogi)) JMP(GL_OFFSET(_gloffset_Fogi)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Fogiv)) GL_PREFIX(Fogiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogiv)) JMP(GL_OFFSET(_gloffset_Fogiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FrontFace)) GL_PREFIX(FrontFace): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FrontFace)) JMP(GL_OFFSET(_gloffset_FrontFace)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Hint)) GL_PREFIX(Hint): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Hint)) JMP(GL_OFFSET(_gloffset_Hint)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Lightf)) GL_PREFIX(Lightf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lightf)) JMP(GL_OFFSET(_gloffset_Lightf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Lightfv)) GL_PREFIX(Lightfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lightfv)) JMP(GL_OFFSET(_gloffset_Lightfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Lighti)) GL_PREFIX(Lighti): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lighti)) JMP(GL_OFFSET(_gloffset_Lighti)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Lightiv)) GL_PREFIX(Lightiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lightiv)) JMP(GL_OFFSET(_gloffset_Lightiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LightModelf)) GL_PREFIX(LightModelf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModelf)) JMP(GL_OFFSET(_gloffset_LightModelf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LightModelfv)) GL_PREFIX(LightModelfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModelfv)) JMP(GL_OFFSET(_gloffset_LightModelfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LightModeli)) GL_PREFIX(LightModeli): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModeli)) JMP(GL_OFFSET(_gloffset_LightModeli)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LightModeliv)) GL_PREFIX(LightModeliv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModeliv)) JMP(GL_OFFSET(_gloffset_LightModeliv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LineStipple)) GL_PREFIX(LineStipple): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LineStipple)) JMP(GL_OFFSET(_gloffset_LineStipple)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LineWidth)) GL_PREFIX(LineWidth): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LineWidth)) JMP(GL_OFFSET(_gloffset_LineWidth)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Materialf)) GL_PREFIX(Materialf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materialf)) JMP(GL_OFFSET(_gloffset_Materialf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Materialfv)) GL_PREFIX(Materialfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materialfv)) JMP(GL_OFFSET(_gloffset_Materialfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Materiali)) GL_PREFIX(Materiali): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materiali)) JMP(GL_OFFSET(_gloffset_Materiali)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Materialiv)) GL_PREFIX(Materialiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materialiv)) JMP(GL_OFFSET(_gloffset_Materialiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PointSize)) GL_PREFIX(PointSize): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointSize)) JMP(GL_OFFSET(_gloffset_PointSize)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PolygonMode)) GL_PREFIX(PolygonMode): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PolygonMode)) JMP(GL_OFFSET(_gloffset_PolygonMode)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PolygonStipple)) GL_PREFIX(PolygonStipple): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PolygonStipple)) JMP(GL_OFFSET(_gloffset_PolygonStipple)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Scissor)) GL_PREFIX(Scissor): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Scissor)) JMP(GL_OFFSET(_gloffset_Scissor)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ShadeModel)) GL_PREFIX(ShadeModel): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ShadeModel)) JMP(GL_OFFSET(_gloffset_ShadeModel)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexParameterf)) GL_PREFIX(TexParameterf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameterf)) JMP(GL_OFFSET(_gloffset_TexParameterf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexParameterfv)) GL_PREFIX(TexParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameterfv)) JMP(GL_OFFSET(_gloffset_TexParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexParameteri)) GL_PREFIX(TexParameteri): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameteri)) JMP(GL_OFFSET(_gloffset_TexParameteri)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexParameteriv)) GL_PREFIX(TexParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameteriv)) JMP(GL_OFFSET(_gloffset_TexParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexImage1D)) GL_PREFIX(TexImage1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage1D)) JMP(GL_OFFSET(_gloffset_TexImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexImage2D)) GL_PREFIX(TexImage2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage2D)) JMP(GL_OFFSET(_gloffset_TexImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexEnvf)) GL_PREFIX(TexEnvf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnvf)) JMP(GL_OFFSET(_gloffset_TexEnvf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexEnvfv)) GL_PREFIX(TexEnvfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnvfv)) JMP(GL_OFFSET(_gloffset_TexEnvfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexEnvi)) GL_PREFIX(TexEnvi): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnvi)) JMP(GL_OFFSET(_gloffset_TexEnvi)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexEnviv)) GL_PREFIX(TexEnviv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnviv)) JMP(GL_OFFSET(_gloffset_TexEnviv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGend)) GL_PREFIX(TexGend): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGend)) JMP(GL_OFFSET(_gloffset_TexGend)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGendv)) GL_PREFIX(TexGendv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGendv)) JMP(GL_OFFSET(_gloffset_TexGendv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGenf)) GL_PREFIX(TexGenf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGenf)) JMP(GL_OFFSET(_gloffset_TexGenf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGenfv)) GL_PREFIX(TexGenfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGenfv)) JMP(GL_OFFSET(_gloffset_TexGenfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGeni)) GL_PREFIX(TexGeni): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGeni)) JMP(GL_OFFSET(_gloffset_TexGeni)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexGeniv)) GL_PREFIX(TexGeniv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGeniv)) JMP(GL_OFFSET(_gloffset_TexGeniv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FeedbackBuffer)) GL_PREFIX(FeedbackBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FeedbackBuffer)) JMP(GL_OFFSET(_gloffset_FeedbackBuffer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SelectBuffer)) GL_PREFIX(SelectBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SelectBuffer)) JMP(GL_OFFSET(_gloffset_SelectBuffer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(RenderMode)) GL_PREFIX(RenderMode): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RenderMode)) JMP(GL_OFFSET(_gloffset_RenderMode)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(InitNames)) GL_PREFIX(InitNames): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_InitNames)) JMP(GL_OFFSET(_gloffset_InitNames)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadName)) GL_PREFIX(LoadName): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadName)) JMP(GL_OFFSET(_gloffset_LoadName)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PassThrough)) GL_PREFIX(PassThrough): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PassThrough)) JMP(GL_OFFSET(_gloffset_PassThrough)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PopName)) GL_PREFIX(PopName): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PopName)) JMP(GL_OFFSET(_gloffset_PopName)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PushName)) GL_PREFIX(PushName): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PushName)) JMP(GL_OFFSET(_gloffset_PushName)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawBuffer)) GL_PREFIX(DrawBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawBuffer)) JMP(GL_OFFSET(_gloffset_DrawBuffer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Clear)) GL_PREFIX(Clear): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Clear)) JMP(GL_OFFSET(_gloffset_Clear)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClearAccum)) GL_PREFIX(ClearAccum): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearAccum)) JMP(GL_OFFSET(_gloffset_ClearAccum)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClearIndex)) GL_PREFIX(ClearIndex): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearIndex)) JMP(GL_OFFSET(_gloffset_ClearIndex)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClearColor)) GL_PREFIX(ClearColor): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearColor)) JMP(GL_OFFSET(_gloffset_ClearColor)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClearStencil)) GL_PREFIX(ClearStencil): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearStencil)) JMP(GL_OFFSET(_gloffset_ClearStencil)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClearDepth)) GL_PREFIX(ClearDepth): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearDepth)) JMP(GL_OFFSET(_gloffset_ClearDepth)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(StencilMask)) GL_PREFIX(StencilMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StencilMask)) JMP(GL_OFFSET(_gloffset_StencilMask)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorMask)) GL_PREFIX(ColorMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorMask)) JMP(GL_OFFSET(_gloffset_ColorMask)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DepthMask)) GL_PREFIX(DepthMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DepthMask)) JMP(GL_OFFSET(_gloffset_DepthMask)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IndexMask)) GL_PREFIX(IndexMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IndexMask)) JMP(GL_OFFSET(_gloffset_IndexMask)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Accum)) GL_PREFIX(Accum): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Accum)) JMP(GL_OFFSET(_gloffset_Accum)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Disable)) GL_PREFIX(Disable): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Disable)) JMP(GL_OFFSET(_gloffset_Disable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Enable)) GL_PREFIX(Enable): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Enable)) JMP(GL_OFFSET(_gloffset_Enable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Finish)) GL_PREFIX(Finish): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Finish)) JMP(GL_OFFSET(_gloffset_Finish)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Flush)) GL_PREFIX(Flush): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Flush)) JMP(GL_OFFSET(_gloffset_Flush)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PopAttrib)) GL_PREFIX(PopAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PopAttrib)) JMP(GL_OFFSET(_gloffset_PopAttrib)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PushAttrib)) GL_PREFIX(PushAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PushAttrib)) JMP(GL_OFFSET(_gloffset_PushAttrib)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Map1d)) GL_PREFIX(Map1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map1d)) JMP(GL_OFFSET(_gloffset_Map1d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Map1f)) GL_PREFIX(Map1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map1f)) JMP(GL_OFFSET(_gloffset_Map1f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Map2d)) GL_PREFIX(Map2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map2d)) JMP(GL_OFFSET(_gloffset_Map2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Map2f)) GL_PREFIX(Map2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map2f)) JMP(GL_OFFSET(_gloffset_Map2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MapGrid1d)) GL_PREFIX(MapGrid1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid1d)) JMP(GL_OFFSET(_gloffset_MapGrid1d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MapGrid1f)) GL_PREFIX(MapGrid1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid1f)) JMP(GL_OFFSET(_gloffset_MapGrid1f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MapGrid2d)) GL_PREFIX(MapGrid2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid2d)) JMP(GL_OFFSET(_gloffset_MapGrid2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MapGrid2f)) GL_PREFIX(MapGrid2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid2f)) JMP(GL_OFFSET(_gloffset_MapGrid2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord1d)) GL_PREFIX(EvalCoord1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1d)) JMP(GL_OFFSET(_gloffset_EvalCoord1d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord1dv)) GL_PREFIX(EvalCoord1dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1dv)) JMP(GL_OFFSET(_gloffset_EvalCoord1dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord1f)) GL_PREFIX(EvalCoord1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1f)) JMP(GL_OFFSET(_gloffset_EvalCoord1f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord1fv)) GL_PREFIX(EvalCoord1fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1fv)) JMP(GL_OFFSET(_gloffset_EvalCoord1fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord2d)) GL_PREFIX(EvalCoord2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2d)) JMP(GL_OFFSET(_gloffset_EvalCoord2d)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord2dv)) GL_PREFIX(EvalCoord2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2dv)) JMP(GL_OFFSET(_gloffset_EvalCoord2dv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord2f)) GL_PREFIX(EvalCoord2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2f)) JMP(GL_OFFSET(_gloffset_EvalCoord2f)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalCoord2fv)) GL_PREFIX(EvalCoord2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2fv)) JMP(GL_OFFSET(_gloffset_EvalCoord2fv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalMesh1)) GL_PREFIX(EvalMesh1): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalMesh1)) JMP(GL_OFFSET(_gloffset_EvalMesh1)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalPoint1)) GL_PREFIX(EvalPoint1): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalPoint1)) JMP(GL_OFFSET(_gloffset_EvalPoint1)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalMesh2)) GL_PREFIX(EvalMesh2): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalMesh2)) JMP(GL_OFFSET(_gloffset_EvalMesh2)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EvalPoint2)) GL_PREFIX(EvalPoint2): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalPoint2)) JMP(GL_OFFSET(_gloffset_EvalPoint2)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(AlphaFunc)) GL_PREFIX(AlphaFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_AlphaFunc)) JMP(GL_OFFSET(_gloffset_AlphaFunc)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendFunc)) GL_PREFIX(BlendFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendFunc)) JMP(GL_OFFSET(_gloffset_BlendFunc)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LogicOp)) GL_PREFIX(LogicOp): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LogicOp)) JMP(GL_OFFSET(_gloffset_LogicOp)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(StencilFunc)) GL_PREFIX(StencilFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StencilFunc)) JMP(GL_OFFSET(_gloffset_StencilFunc)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(StencilOp)) GL_PREFIX(StencilOp): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StencilOp)) JMP(GL_OFFSET(_gloffset_StencilOp)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DepthFunc)) GL_PREFIX(DepthFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DepthFunc)) JMP(GL_OFFSET(_gloffset_DepthFunc)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelZoom)) GL_PREFIX(PixelZoom): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelZoom)) JMP(GL_OFFSET(_gloffset_PixelZoom)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTransferf)) GL_PREFIX(PixelTransferf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTransferf)) JMP(GL_OFFSET(_gloffset_PixelTransferf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTransferi)) GL_PREFIX(PixelTransferi): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTransferi)) JMP(GL_OFFSET(_gloffset_PixelTransferi)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelStoref)) GL_PREFIX(PixelStoref): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelStoref)) JMP(GL_OFFSET(_gloffset_PixelStoref)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelStorei)) GL_PREFIX(PixelStorei): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelStorei)) JMP(GL_OFFSET(_gloffset_PixelStorei)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelMapfv)) GL_PREFIX(PixelMapfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelMapfv)) JMP(GL_OFFSET(_gloffset_PixelMapfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelMapuiv)) GL_PREFIX(PixelMapuiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelMapuiv)) JMP(GL_OFFSET(_gloffset_PixelMapuiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelMapusv)) GL_PREFIX(PixelMapusv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelMapusv)) JMP(GL_OFFSET(_gloffset_PixelMapusv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReadBuffer)) GL_PREFIX(ReadBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ReadBuffer)) JMP(GL_OFFSET(_gloffset_ReadBuffer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyPixels)) GL_PREFIX(CopyPixels): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyPixels)) JMP(GL_OFFSET(_gloffset_CopyPixels)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReadPixels)) GL_PREFIX(ReadPixels): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ReadPixels)) JMP(GL_OFFSET(_gloffset_ReadPixels)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawPixels)) GL_PREFIX(DrawPixels): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawPixels)) JMP(GL_OFFSET(_gloffset_DrawPixels)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetBooleanv)) GL_PREFIX(GetBooleanv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetBooleanv)) JMP(GL_OFFSET(_gloffset_GetBooleanv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetClipPlane)) GL_PREFIX(GetClipPlane): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetClipPlane)) JMP(GL_OFFSET(_gloffset_GetClipPlane)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetDoublev)) GL_PREFIX(GetDoublev): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetDoublev)) JMP(GL_OFFSET(_gloffset_GetDoublev)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetError)) GL_PREFIX(GetError): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetError)) JMP(GL_OFFSET(_gloffset_GetError)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFloatv)) GL_PREFIX(GetFloatv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetFloatv)) JMP(GL_OFFSET(_gloffset_GetFloatv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetIntegerv)) GL_PREFIX(GetIntegerv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetIntegerv)) JMP(GL_OFFSET(_gloffset_GetIntegerv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetLightfv)) GL_PREFIX(GetLightfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetLightfv)) JMP(GL_OFFSET(_gloffset_GetLightfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetLightiv)) GL_PREFIX(GetLightiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetLightiv)) JMP(GL_OFFSET(_gloffset_GetLightiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMapdv)) GL_PREFIX(GetMapdv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMapdv)) JMP(GL_OFFSET(_gloffset_GetMapdv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMapfv)) GL_PREFIX(GetMapfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMapfv)) JMP(GL_OFFSET(_gloffset_GetMapfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMapiv)) GL_PREFIX(GetMapiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMapiv)) JMP(GL_OFFSET(_gloffset_GetMapiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMaterialfv)) GL_PREFIX(GetMaterialfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMaterialfv)) JMP(GL_OFFSET(_gloffset_GetMaterialfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMaterialiv)) GL_PREFIX(GetMaterialiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMaterialiv)) JMP(GL_OFFSET(_gloffset_GetMaterialiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPixelMapfv)) GL_PREFIX(GetPixelMapfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelMapfv)) JMP(GL_OFFSET(_gloffset_GetPixelMapfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPixelMapuiv)) GL_PREFIX(GetPixelMapuiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelMapuiv)) JMP(GL_OFFSET(_gloffset_GetPixelMapuiv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPixelMapusv)) GL_PREFIX(GetPixelMapusv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelMapusv)) JMP(GL_OFFSET(_gloffset_GetPixelMapusv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPolygonStipple)) GL_PREFIX(GetPolygonStipple): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPolygonStipple)) JMP(GL_OFFSET(_gloffset_GetPolygonStipple)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetString)) GL_PREFIX(GetString): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetString)) JMP(GL_OFFSET(_gloffset_GetString)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexEnvfv)) GL_PREFIX(GetTexEnvfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexEnvfv)) JMP(GL_OFFSET(_gloffset_GetTexEnvfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexEnviv)) GL_PREFIX(GetTexEnviv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexEnviv)) JMP(GL_OFFSET(_gloffset_GetTexEnviv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexGendv)) GL_PREFIX(GetTexGendv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexGendv)) JMP(GL_OFFSET(_gloffset_GetTexGendv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexGenfv)) GL_PREFIX(GetTexGenfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexGenfv)) JMP(GL_OFFSET(_gloffset_GetTexGenfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexGeniv)) GL_PREFIX(GetTexGeniv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexGeniv)) JMP(GL_OFFSET(_gloffset_GetTexGeniv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexImage)) GL_PREFIX(GetTexImage): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexImage)) JMP(GL_OFFSET(_gloffset_GetTexImage)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexParameterfv)) GL_PREFIX(GetTexParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexParameterfv)) JMP(GL_OFFSET(_gloffset_GetTexParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexParameteriv)) GL_PREFIX(GetTexParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexParameteriv)) JMP(GL_OFFSET(_gloffset_GetTexParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexLevelParameterfv)) GL_PREFIX(GetTexLevelParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexLevelParameterfv)) JMP(GL_OFFSET(_gloffset_GetTexLevelParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexLevelParameteriv)) GL_PREFIX(GetTexLevelParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexLevelParameteriv)) JMP(GL_OFFSET(_gloffset_GetTexLevelParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IsEnabled)) GL_PREFIX(IsEnabled): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsEnabled)) JMP(GL_OFFSET(_gloffset_IsEnabled)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IsList)) GL_PREFIX(IsList): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsList)) JMP(GL_OFFSET(_gloffset_IsList)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DepthRange)) GL_PREFIX(DepthRange): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DepthRange)) JMP(GL_OFFSET(_gloffset_DepthRange)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Frustum)) GL_PREFIX(Frustum): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Frustum)) JMP(GL_OFFSET(_gloffset_Frustum)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadIdentity)) GL_PREFIX(LoadIdentity): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadIdentity)) JMP(GL_OFFSET(_gloffset_LoadIdentity)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadMatrixf)) GL_PREFIX(LoadMatrixf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadMatrixf)) JMP(GL_OFFSET(_gloffset_LoadMatrixf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadMatrixd)) GL_PREFIX(LoadMatrixd): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadMatrixd)) JMP(GL_OFFSET(_gloffset_LoadMatrixd)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MatrixMode)) GL_PREFIX(MatrixMode): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MatrixMode)) JMP(GL_OFFSET(_gloffset_MatrixMode)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultMatrixf)) GL_PREFIX(MultMatrixf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultMatrixf)) JMP(GL_OFFSET(_gloffset_MultMatrixf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultMatrixd)) GL_PREFIX(MultMatrixd): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultMatrixd)) JMP(GL_OFFSET(_gloffset_MultMatrixd)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Ortho)) GL_PREFIX(Ortho): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Ortho)) JMP(GL_OFFSET(_gloffset_Ortho)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PopMatrix)) GL_PREFIX(PopMatrix): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PopMatrix)) JMP(GL_OFFSET(_gloffset_PopMatrix)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PushMatrix)) GL_PREFIX(PushMatrix): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PushMatrix)) JMP(GL_OFFSET(_gloffset_PushMatrix)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rotated)) GL_PREFIX(Rotated): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rotated)) JMP(GL_OFFSET(_gloffset_Rotated)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Rotatef)) GL_PREFIX(Rotatef): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rotatef)) JMP(GL_OFFSET(_gloffset_Rotatef)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Scaled)) GL_PREFIX(Scaled): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Scaled)) JMP(GL_OFFSET(_gloffset_Scaled)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Scalef)) GL_PREFIX(Scalef): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Scalef)) JMP(GL_OFFSET(_gloffset_Scalef)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Translated)) GL_PREFIX(Translated): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Translated)) JMP(GL_OFFSET(_gloffset_Translated)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Translatef)) GL_PREFIX(Translatef): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Translatef)) JMP(GL_OFFSET(_gloffset_Translatef)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Viewport)) GL_PREFIX(Viewport): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Viewport)) JMP(GL_OFFSET(_gloffset_Viewport)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ArrayElement)) GL_PREFIX(ArrayElement): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ArrayElement)) JMP(GL_OFFSET(_gloffset_ArrayElement)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorPointer)) GL_PREFIX(ColorPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorPointer)) JMP(GL_OFFSET(_gloffset_ColorPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DisableClientState)) GL_PREFIX(DisableClientState): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DisableClientState)) JMP(GL_OFFSET(_gloffset_DisableClientState)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawArrays)) GL_PREFIX(DrawArrays): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawArrays)) JMP(GL_OFFSET(_gloffset_DrawArrays)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawElements)) GL_PREFIX(DrawElements): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawElements)) JMP(GL_OFFSET(_gloffset_DrawElements)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EdgeFlagPointer)) GL_PREFIX(EdgeFlagPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EdgeFlagPointer)) JMP(GL_OFFSET(_gloffset_EdgeFlagPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EnableClientState)) GL_PREFIX(EnableClientState): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EnableClientState)) JMP(GL_OFFSET(_gloffset_EnableClientState)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPointerv)) GL_PREFIX(GetPointerv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPointerv)) JMP(GL_OFFSET(_gloffset_GetPointerv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IndexPointer)) GL_PREFIX(IndexPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IndexPointer)) JMP(GL_OFFSET(_gloffset_IndexPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(InterleavedArrays)) GL_PREFIX(InterleavedArrays): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_InterleavedArrays)) JMP(GL_OFFSET(_gloffset_InterleavedArrays)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(NormalPointer)) GL_PREFIX(NormalPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_NormalPointer)) JMP(GL_OFFSET(_gloffset_NormalPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoordPointer)) GL_PREFIX(TexCoordPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoordPointer)) JMP(GL_OFFSET(_gloffset_TexCoordPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexPointer)) GL_PREFIX(VertexPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_VertexPointer)) JMP(GL_OFFSET(_gloffset_VertexPointer)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PolygonOffset)) GL_PREFIX(PolygonOffset): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PolygonOffset)) JMP(GL_OFFSET(_gloffset_PolygonOffset)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexImage1D)) GL_PREFIX(CopyTexImage1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexImage1D)) JMP(GL_OFFSET(_gloffset_CopyTexImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexImage2D)) GL_PREFIX(CopyTexImage2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexImage2D)) JMP(GL_OFFSET(_gloffset_CopyTexImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage1D)) GL_PREFIX(CopyTexSubImage1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage1D)) JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage2D)) GL_PREFIX(CopyTexSubImage2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage2D)) JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage1D)) GL_PREFIX(TexSubImage1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage1D)) JMP(GL_OFFSET(_gloffset_TexSubImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage2D)) GL_PREFIX(TexSubImage2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage2D)) JMP(GL_OFFSET(_gloffset_TexSubImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(AreTexturesResident)) GL_PREFIX(AreTexturesResident): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_AreTexturesResident)) JMP(GL_OFFSET(_gloffset_AreTexturesResident)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BindTexture)) GL_PREFIX(BindTexture): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BindTexture)) JMP(GL_OFFSET(_gloffset_BindTexture)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DeleteTextures)) GL_PREFIX(DeleteTextures): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DeleteTextures)) JMP(GL_OFFSET(_gloffset_DeleteTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GenTextures)) GL_PREFIX(GenTextures): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GenTextures)) JMP(GL_OFFSET(_gloffset_GenTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IsTexture)) GL_PREFIX(IsTexture): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsTexture)) JMP(GL_OFFSET(_gloffset_IsTexture)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PrioritizeTextures)) GL_PREFIX(PrioritizeTextures): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PrioritizeTextures)) JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexub)) GL_PREFIX(Indexub): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexub)) JMP(GL_OFFSET(_gloffset_Indexub)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexubv)) GL_PREFIX(Indexubv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexubv)) JMP(GL_OFFSET(_gloffset_Indexubv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PopClientAttrib)) GL_PREFIX(PopClientAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PopClientAttrib)) JMP(GL_OFFSET(_gloffset_PopClientAttrib)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PushClientAttrib)) GL_PREFIX(PushClientAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PushClientAttrib)) JMP(GL_OFFSET(_gloffset_PushClientAttrib)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendColor)) GL_PREFIX(BlendColor): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendColor)) JMP(GL_OFFSET(_gloffset_BlendColor)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendEquation)) GL_PREFIX(BlendEquation): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendEquation)) JMP(GL_OFFSET(_gloffset_BlendEquation)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawRangeElements)) GL_PREFIX(DrawRangeElements): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawRangeElements)) JMP(GL_OFFSET(_gloffset_DrawRangeElements)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTable)) GL_PREFIX(ColorTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTable)) JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableParameterfv)) GL_PREFIX(ColorTableParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameterfv)) JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableParameteriv)) GL_PREFIX(ColorTableParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameteriv)) JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorTable)) GL_PREFIX(CopyColorTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorTable)) JMP(GL_OFFSET(_gloffset_CopyColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTable)) GL_PREFIX(GetColorTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTable)) JMP(GL_OFFSET(_gloffset_GetColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameterfv)) GL_PREFIX(GetColorTableParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterfv)) JMP(GL_OFFSET(_gloffset_GetColorTableParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameteriv)) GL_PREFIX(GetColorTableParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameteriv)) JMP(GL_OFFSET(_gloffset_GetColorTableParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorSubTable)) GL_PREFIX(ColorSubTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorSubTable)) JMP(GL_OFFSET(_gloffset_ColorSubTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorSubTable)) GL_PREFIX(CopyColorSubTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorSubTable)) JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionFilter1D)) GL_PREFIX(ConvolutionFilter1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionFilter1D)) JMP(GL_OFFSET(_gloffset_ConvolutionFilter1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionFilter2D)) GL_PREFIX(ConvolutionFilter2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionFilter2D)) JMP(GL_OFFSET(_gloffset_ConvolutionFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameterf)) GL_PREFIX(ConvolutionParameterf): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameterf)) JMP(GL_OFFSET(_gloffset_ConvolutionParameterf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameterfv)) GL_PREFIX(ConvolutionParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameterfv)) JMP(GL_OFFSET(_gloffset_ConvolutionParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameteri)) GL_PREFIX(ConvolutionParameteri): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameteri)) JMP(GL_OFFSET(_gloffset_ConvolutionParameteri)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameteriv)) GL_PREFIX(ConvolutionParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameteriv)) JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1D)) GL_PREFIX(CopyConvolutionFilter1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter1D)) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2D)) GL_PREFIX(CopyConvolutionFilter2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter2D)) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionFilter)) GL_PREFIX(GetConvolutionFilter): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetConvolutionFilter)) JMP(GL_OFFSET(_gloffset_GetConvolutionFilter)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionParameterfv)) GL_PREFIX(GetConvolutionParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetConvolutionParameterfv)) JMP(GL_OFFSET(_gloffset_GetConvolutionParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionParameteriv)) GL_PREFIX(GetConvolutionParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetConvolutionParameteriv)) JMP(GL_OFFSET(_gloffset_GetConvolutionParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetSeparableFilter)) GL_PREFIX(GetSeparableFilter): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetSeparableFilter)) JMP(GL_OFFSET(_gloffset_GetSeparableFilter)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SeparableFilter2D)) GL_PREFIX(SeparableFilter2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SeparableFilter2D)) JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogram)) GL_PREFIX(GetHistogram): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetHistogram)) JMP(GL_OFFSET(_gloffset_GetHistogram)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramParameterfv)) GL_PREFIX(GetHistogramParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetHistogramParameterfv)) JMP(GL_OFFSET(_gloffset_GetHistogramParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramParameteriv)) GL_PREFIX(GetHistogramParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetHistogramParameteriv)) JMP(GL_OFFSET(_gloffset_GetHistogramParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmax)) GL_PREFIX(GetMinmax): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMinmax)) JMP(GL_OFFSET(_gloffset_GetMinmax)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmaxParameterfv)) GL_PREFIX(GetMinmaxParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMinmaxParameterfv)) JMP(GL_OFFSET(_gloffset_GetMinmaxParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmaxParameteriv)) GL_PREFIX(GetMinmaxParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMinmaxParameteriv)) JMP(GL_OFFSET(_gloffset_GetMinmaxParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Histogram)) GL_PREFIX(Histogram): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Histogram)) JMP(GL_OFFSET(_gloffset_Histogram)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Minmax)) GL_PREFIX(Minmax): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Minmax)) JMP(GL_OFFSET(_gloffset_Minmax)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResetHistogram)) GL_PREFIX(ResetHistogram): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResetHistogram)) JMP(GL_OFFSET(_gloffset_ResetHistogram)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResetMinmax)) GL_PREFIX(ResetMinmax): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResetMinmax)) JMP(GL_OFFSET(_gloffset_ResetMinmax)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexImage3D)) GL_PREFIX(TexImage3D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage3D)) JMP(GL_OFFSET(_gloffset_TexImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage3D)) GL_PREFIX(TexSubImage3D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage3D)) JMP(GL_OFFSET(_gloffset_TexSubImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage3D)) GL_PREFIX(CopyTexSubImage3D): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage3D)) JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ActiveTextureARB)) GL_PREFIX(ActiveTextureARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ActiveTextureARB)) JMP(GL_OFFSET(_gloffset_ActiveTextureARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ClientActiveTextureARB)) GL_PREFIX(ClientActiveTextureARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClientActiveTextureARB)) JMP(GL_OFFSET(_gloffset_ClientActiveTextureARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1dARB)) GL_PREFIX(MultiTexCoord1dARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord1dARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord1dARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1dvARB)) GL_PREFIX(MultiTexCoord1dvARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord1dvARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord1dvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1fARB)) GL_PREFIX(MultiTexCoord1fARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord1fARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord1fARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1fvARB)) GL_PREFIX(MultiTexCoord1fvARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord1fvARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord1fvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1iARB)) GL_PREFIX(MultiTexCoord1iARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord1iARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord1iARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1ivARB)) GL_PREFIX(MultiTexCoord1ivARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord1ivARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord1ivARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1sARB)) GL_PREFIX(MultiTexCoord1sARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord1sARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord1sARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord1svARB)) GL_PREFIX(MultiTexCoord1svARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord1svARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord1svARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2dARB)) GL_PREFIX(MultiTexCoord2dARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord2dARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord2dARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2dvARB)) GL_PREFIX(MultiTexCoord2dvARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord2dvARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord2dvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2fARB)) GL_PREFIX(MultiTexCoord2fARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord2fARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord2fARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2fvARB)) GL_PREFIX(MultiTexCoord2fvARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord2fvARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord2fvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2iARB)) GL_PREFIX(MultiTexCoord2iARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord2iARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord2iARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2ivARB)) GL_PREFIX(MultiTexCoord2ivARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord2ivARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord2ivARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2sARB)) GL_PREFIX(MultiTexCoord2sARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord2sARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord2sARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord2svARB)) GL_PREFIX(MultiTexCoord2svARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord2svARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord2svARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3dARB)) GL_PREFIX(MultiTexCoord3dARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord3dARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord3dARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3dvARB)) GL_PREFIX(MultiTexCoord3dvARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord3dvARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord3dvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3fARB)) GL_PREFIX(MultiTexCoord3fARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord3fARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord3fARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3fvARB)) GL_PREFIX(MultiTexCoord3fvARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord3fvARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord3fvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3iARB)) GL_PREFIX(MultiTexCoord3iARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord3iARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord3iARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3ivARB)) GL_PREFIX(MultiTexCoord3ivARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord3ivARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord3ivARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3sARB)) GL_PREFIX(MultiTexCoord3sARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord3sARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord3sARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord3svARB)) GL_PREFIX(MultiTexCoord3svARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord3svARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord3svARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4dARB)) GL_PREFIX(MultiTexCoord4dARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord4dARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord4dARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4dvARB)) GL_PREFIX(MultiTexCoord4dvARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord4dvARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord4dvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4fARB)) GL_PREFIX(MultiTexCoord4fARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord4fARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord4fARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4fvARB)) GL_PREFIX(MultiTexCoord4fvARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord4fvARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord4fvARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4iARB)) GL_PREFIX(MultiTexCoord4iARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord4iARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord4iARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4ivARB)) GL_PREFIX(MultiTexCoord4ivARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord4ivARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord4ivARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4sARB)) GL_PREFIX(MultiTexCoord4sARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord4sARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord4sARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultiTexCoord4svARB)) GL_PREFIX(MultiTexCoord4svARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultiTexCoord4svARB)) JMP(GL_OFFSET(_gloffset_MultiTexCoord4svARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadTransposeMatrixfARB)) GL_PREFIX(LoadTransposeMatrixfARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadTransposeMatrixfARB)) JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LoadTransposeMatrixdARB)) GL_PREFIX(LoadTransposeMatrixdARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadTransposeMatrixdARB)) JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultTransposeMatrixfARB)) GL_PREFIX(MultTransposeMatrixfARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultTransposeMatrixfARB)) JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MultTransposeMatrixdARB)) GL_PREFIX(MultTransposeMatrixdARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultTransposeMatrixdARB)) JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SampleCoverageARB)) GL_PREFIX(SampleCoverageARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SampleCoverageARB)) JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SamplePassARB)) GL_PREFIX(SamplePassARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SamplePassARB)) JMP(GL_OFFSET(_gloffset_SamplePassARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexImage3DARB)) GL_PREFIX(CompressedTexImage3DARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CompressedTexImage3DARB)) JMP(GL_OFFSET(_gloffset_CompressedTexImage3DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexImage2DARB)) GL_PREFIX(CompressedTexImage2DARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CompressedTexImage2DARB)) JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexImage1DARB)) GL_PREFIX(CompressedTexImage1DARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CompressedTexImage1DARB)) JMP(GL_OFFSET(_gloffset_CompressedTexImage1DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexSubImage3DARB)) GL_PREFIX(CompressedTexSubImage3DARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CompressedTexSubImage3DARB)) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage3DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexSubImage2DARB)) GL_PREFIX(CompressedTexSubImage2DARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CompressedTexSubImage2DARB)) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage2DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CompressedTexSubImage1DARB)) GL_PREFIX(CompressedTexSubImage1DARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CompressedTexSubImage1DARB)) JMP(GL_OFFSET(_gloffset_CompressedTexSubImage1DARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetCompressedTexImageARB)) GL_PREFIX(GetCompressedTexImageARB): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetCompressedTexImageARB)) JMP(GL_OFFSET(_gloffset_GetCompressedTexImageARB)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendColorEXT)) GL_PREFIX(BlendColorEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendColorEXT)) JMP(GL_OFFSET(_gloffset_BlendColor)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PolygonOffsetEXT)) GL_PREFIX(PolygonOffsetEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PolygonOffsetEXT)) JMP(GL_OFFSET(_gloffset_PolygonOffsetEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexImage3DEXT)) GL_PREFIX(TexImage3DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage3DEXT)) JMP(GL_OFFSET(_gloffset_TexImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage3DEXT)) GL_PREFIX(TexSubImage3DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage3DEXT)) JMP(GL_OFFSET(_gloffset_TexSubImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexFilterFuncSGIS)) GL_PREFIX(GetTexFilterFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexFilterFuncSGIS)) JMP(GL_OFFSET(_gloffset_GetTexFilterFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexFilterFuncSGIS)) GL_PREFIX(TexFilterFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexFilterFuncSGIS)) JMP(GL_OFFSET(_gloffset_TexFilterFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage1DEXT)) GL_PREFIX(TexSubImage1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage1DEXT)) JMP(GL_OFFSET(_gloffset_TexSubImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage2DEXT)) GL_PREFIX(TexSubImage2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage2DEXT)) JMP(GL_OFFSET(_gloffset_TexSubImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexImage1DEXT)) GL_PREFIX(CopyTexImage1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexImage1DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexImage2DEXT)) GL_PREFIX(CopyTexImage2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexImage2DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage1DEXT)) GL_PREFIX(CopyTexSubImage1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage1DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage2DEXT)) GL_PREFIX(CopyTexSubImage2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage2DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage3DEXT)) GL_PREFIX(CopyTexSubImage3DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage3DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramEXT)) GL_PREFIX(GetHistogramEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetHistogramEXT)) JMP(GL_OFFSET(_gloffset_GetHistogramEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramParameterfvEXT)) GL_PREFIX(GetHistogramParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetHistogramParameterfvEXT)) JMP(GL_OFFSET(_gloffset_GetHistogramParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramParameterivEXT)) GL_PREFIX(GetHistogramParameterivEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetHistogramParameterivEXT)) JMP(GL_OFFSET(_gloffset_GetHistogramParameterivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmaxEXT)) GL_PREFIX(GetMinmaxEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMinmaxEXT)) JMP(GL_OFFSET(_gloffset_GetMinmaxEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmaxParameterfvEXT)) GL_PREFIX(GetMinmaxParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMinmaxParameterfvEXT)) JMP(GL_OFFSET(_gloffset_GetMinmaxParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetMinmaxParameterivEXT)) GL_PREFIX(GetMinmaxParameterivEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMinmaxParameterivEXT)) JMP(GL_OFFSET(_gloffset_GetMinmaxParameterivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(HistogramEXT)) GL_PREFIX(HistogramEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_HistogramEXT)) JMP(GL_OFFSET(_gloffset_Histogram)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(MinmaxEXT)) GL_PREFIX(MinmaxEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MinmaxEXT)) JMP(GL_OFFSET(_gloffset_Minmax)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResetHistogramEXT)) GL_PREFIX(ResetHistogramEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResetHistogramEXT)) JMP(GL_OFFSET(_gloffset_ResetHistogram)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResetMinmaxEXT)) GL_PREFIX(ResetMinmaxEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResetMinmaxEXT)) JMP(GL_OFFSET(_gloffset_ResetMinmax)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionFilter1DEXT)) GL_PREFIX(ConvolutionFilter1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionFilter1DEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionFilter1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionFilter2DEXT)) GL_PREFIX(ConvolutionFilter2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionFilter2DEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameterfEXT)) GL_PREFIX(ConvolutionParameterfEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameterfEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameterf)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameterfvEXT)) GL_PREFIX(ConvolutionParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameterfvEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameteriEXT)) GL_PREFIX(ConvolutionParameteriEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameteriEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameteri)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionParameterivEXT)) GL_PREFIX(ConvolutionParameterivEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameterivEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1DEXT)) GL_PREFIX(CopyConvolutionFilter1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter1DEXT)) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter1D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2DEXT)) GL_PREFIX(CopyConvolutionFilter2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter2DEXT)) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionFilterEXT)) GL_PREFIX(GetConvolutionFilterEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetConvolutionFilterEXT)) JMP(GL_OFFSET(_gloffset_GetConvolutionFilterEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionParameterfvEXT)) GL_PREFIX(GetConvolutionParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetConvolutionParameterfvEXT)) JMP(GL_OFFSET(_gloffset_GetConvolutionParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionParameterivEXT)) GL_PREFIX(GetConvolutionParameterivEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetConvolutionParameterivEXT)) JMP(GL_OFFSET(_gloffset_GetConvolutionParameterivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetSeparableFilterEXT)) GL_PREFIX(GetSeparableFilterEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetSeparableFilterEXT)) JMP(GL_OFFSET(_gloffset_GetSeparableFilterEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SeparableFilter2DEXT)) GL_PREFIX(SeparableFilter2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SeparableFilter2DEXT)) JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableSGI)) GL_PREFIX(ColorTableSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableSGI)) JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableParameterfvSGI)) GL_PREFIX(ColorTableParameterfvSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameterfvSGI)) JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableParameterivSGI)) GL_PREFIX(ColorTableParameterivSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameterivSGI)) JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorTableSGI)) GL_PREFIX(CopyColorTableSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorTableSGI)) JMP(GL_OFFSET(_gloffset_CopyColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableSGI)) GL_PREFIX(GetColorTableSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableSGI)) JMP(GL_OFFSET(_gloffset_GetColorTableSGI)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameterfvSGI)) GL_PREFIX(GetColorTableParameterfvSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterfvSGI)) JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvSGI)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameterivSGI)) GL_PREFIX(GetColorTableParameterivSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterivSGI)) JMP(GL_OFFSET(_gloffset_GetColorTableParameterivSGI)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTexGenSGIX)) GL_PREFIX(PixelTexGenSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTexGenSGIX)) JMP(GL_OFFSET(_gloffset_PixelTexGenSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTexGenParameteriSGIS)) GL_PREFIX(PixelTexGenParameteriSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTexGenParameteriSGIS)) JMP(GL_OFFSET(_gloffset_PixelTexGenParameteriSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTexGenParameterivSGIS)) GL_PREFIX(PixelTexGenParameterivSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTexGenParameterivSGIS)) JMP(GL_OFFSET(_gloffset_PixelTexGenParameterivSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTexGenParameterfSGIS)) GL_PREFIX(PixelTexGenParameterfSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTexGenParameterfSGIS)) JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PixelTexGenParameterfvSGIS)) GL_PREFIX(PixelTexGenParameterfvSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTexGenParameterfvSGIS)) JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfvSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterivSGIS)) GL_PREFIX(GetPixelTexGenParameterivSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelTexGenParameterivSGIS)) JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterivSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterfvSGIS)) GL_PREFIX(GetPixelTexGenParameterfvSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelTexGenParameterfvSGIS)) JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterfvSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexImage4DSGIS)) GL_PREFIX(TexImage4DSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage4DSGIS)) JMP(GL_OFFSET(_gloffset_TexImage4DSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage4DSGIS)) GL_PREFIX(TexSubImage4DSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage4DSGIS)) JMP(GL_OFFSET(_gloffset_TexSubImage4DSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(AreTexturesResidentEXT)) GL_PREFIX(AreTexturesResidentEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_AreTexturesResidentEXT)) JMP(GL_OFFSET(_gloffset_AreTexturesResidentEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BindTextureEXT)) GL_PREFIX(BindTextureEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BindTextureEXT)) JMP(GL_OFFSET(_gloffset_BindTexture)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DeleteTexturesEXT)) GL_PREFIX(DeleteTexturesEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DeleteTexturesEXT)) JMP(GL_OFFSET(_gloffset_DeleteTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GenTexturesEXT)) GL_PREFIX(GenTexturesEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GenTexturesEXT)) JMP(GL_OFFSET(_gloffset_GenTexturesEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IsTextureEXT)) GL_PREFIX(IsTextureEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsTextureEXT)) JMP(GL_OFFSET(_gloffset_IsTextureEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PrioritizeTexturesEXT)) GL_PREFIX(PrioritizeTexturesEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PrioritizeTexturesEXT)) JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DetailTexFuncSGIS)) GL_PREFIX(DetailTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DetailTexFuncSGIS)) JMP(GL_OFFSET(_gloffset_DetailTexFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetDetailTexFuncSGIS)) GL_PREFIX(GetDetailTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetDetailTexFuncSGIS)) JMP(GL_OFFSET(_gloffset_GetDetailTexFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SharpenTexFuncSGIS)) GL_PREFIX(SharpenTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SharpenTexFuncSGIS)) JMP(GL_OFFSET(_gloffset_SharpenTexFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetSharpenTexFuncSGIS)) GL_PREFIX(GetSharpenTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetSharpenTexFuncSGIS)) JMP(GL_OFFSET(_gloffset_GetSharpenTexFuncSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SampleMaskSGIS)) GL_PREFIX(SampleMaskSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SampleMaskSGIS)) JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SamplePatternSGIS)) GL_PREFIX(SamplePatternSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SamplePatternSGIS)) JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ArrayElementEXT)) GL_PREFIX(ArrayElementEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ArrayElementEXT)) JMP(GL_OFFSET(_gloffset_ArrayElement)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorPointerEXT)) GL_PREFIX(ColorPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorPointerEXT)) JMP(GL_OFFSET(_gloffset_ColorPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawArraysEXT)) GL_PREFIX(DrawArraysEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawArraysEXT)) JMP(GL_OFFSET(_gloffset_DrawArrays)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(EdgeFlagPointerEXT)) GL_PREFIX(EdgeFlagPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EdgeFlagPointerEXT)) JMP(GL_OFFSET(_gloffset_EdgeFlagPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetPointervEXT)) GL_PREFIX(GetPointervEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPointervEXT)) JMP(GL_OFFSET(_gloffset_GetPointerv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IndexPointerEXT)) GL_PREFIX(IndexPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IndexPointerEXT)) JMP(GL_OFFSET(_gloffset_IndexPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(NormalPointerEXT)) GL_PREFIX(NormalPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_NormalPointerEXT)) JMP(GL_OFFSET(_gloffset_NormalPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexCoordPointerEXT)) GL_PREFIX(TexCoordPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoordPointerEXT)) JMP(GL_OFFSET(_gloffset_TexCoordPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexPointerEXT)) GL_PREFIX(VertexPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_VertexPointerEXT)) JMP(GL_OFFSET(_gloffset_VertexPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendEquationEXT)) GL_PREFIX(BlendEquationEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendEquationEXT)) JMP(GL_OFFSET(_gloffset_BlendEquation)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SpriteParameterfSGIX)) GL_PREFIX(SpriteParameterfSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameterfSGIX)) JMP(GL_OFFSET(_gloffset_SpriteParameterfSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SpriteParameterfvSGIX)) GL_PREFIX(SpriteParameterfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameterfvSGIX)) JMP(GL_OFFSET(_gloffset_SpriteParameterfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SpriteParameteriSGIX)) GL_PREFIX(SpriteParameteriSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameteriSGIX)) JMP(GL_OFFSET(_gloffset_SpriteParameteriSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SpriteParameterivSGIX)) GL_PREFIX(SpriteParameterivSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameterivSGIX)) JMP(GL_OFFSET(_gloffset_SpriteParameterivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PointParameterfEXT)) GL_PREFIX(PointParameterfEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointParameterfEXT)) JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PointParameterfvEXT)) GL_PREFIX(PointParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointParameterfvEXT)) JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PointParameterfSGIS)) GL_PREFIX(PointParameterfSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointParameterfSGIS)) JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PointParameterfvSGIS)) GL_PREFIX(PointParameterfvSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointParameterfvSGIS)) JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetInstrumentsSGIX)) GL_PREFIX(GetInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetInstrumentsSGIX)) JMP(GL_OFFSET(_gloffset_GetInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(InstrumentsBufferSGIX)) GL_PREFIX(InstrumentsBufferSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_InstrumentsBufferSGIX)) JMP(GL_OFFSET(_gloffset_InstrumentsBufferSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PollInstrumentsSGIX)) GL_PREFIX(PollInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PollInstrumentsSGIX)) JMP(GL_OFFSET(_gloffset_PollInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReadInstrumentsSGIX)) GL_PREFIX(ReadInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ReadInstrumentsSGIX)) JMP(GL_OFFSET(_gloffset_ReadInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(StartInstrumentsSGIX)) GL_PREFIX(StartInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StartInstrumentsSGIX)) JMP(GL_OFFSET(_gloffset_StartInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(StopInstrumentsSGIX)) GL_PREFIX(StopInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StopInstrumentsSGIX)) JMP(GL_OFFSET(_gloffset_StopInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FrameZoomSGIX)) GL_PREFIX(FrameZoomSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FrameZoomSGIX)) JMP(GL_OFFSET(_gloffset_FrameZoomSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TagSampleBufferSGIX)) GL_PREFIX(TagSampleBufferSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TagSampleBufferSGIX)) JMP(GL_OFFSET(_gloffset_TagSampleBufferSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReferencePlaneSGIX)) GL_PREFIX(ReferencePlaneSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ReferencePlaneSGIX)) JMP(GL_OFFSET(_gloffset_ReferencePlaneSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FlushRasterSGIX)) GL_PREFIX(FlushRasterSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FlushRasterSGIX)) JMP(GL_OFFSET(_gloffset_FlushRasterSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorSubTableEXT)) GL_PREFIX(ColorSubTableEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorSubTableEXT)) JMP(GL_OFFSET(_gloffset_ColorSubTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorSubTableEXT)) GL_PREFIX(CopyColorSubTableEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorSubTableEXT)) JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(HintPGI)) GL_PREFIX(HintPGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_HintPGI)) JMP(GL_OFFSET(_gloffset_HintPGI)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableEXT)) GL_PREFIX(ColorTableEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableEXT)) JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableEXT)) GL_PREFIX(GetColorTableEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableEXT)) JMP(GL_OFFSET(_gloffset_GetColorTableEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameterivEXT)) GL_PREFIX(GetColorTableParameterivEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterivEXT)) JMP(GL_OFFSET(_gloffset_GetColorTableParameterivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetColorTableParameterfvEXT)) GL_PREFIX(GetColorTableParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterfvEXT)) JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetListParameterfvSGIX)) GL_PREFIX(GetListParameterfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetListParameterfvSGIX)) JMP(GL_OFFSET(_gloffset_GetListParameterfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetListParameterivSGIX)) GL_PREFIX(GetListParameterivSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetListParameterivSGIX)) JMP(GL_OFFSET(_gloffset_GetListParameterivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ListParameterfSGIX)) GL_PREFIX(ListParameterfSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ListParameterfSGIX)) JMP(GL_OFFSET(_gloffset_ListParameterfSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ListParameterfvSGIX)) GL_PREFIX(ListParameterfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ListParameterfvSGIX)) JMP(GL_OFFSET(_gloffset_ListParameterfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ListParameteriSGIX)) GL_PREFIX(ListParameteriSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ListParameteriSGIX)) JMP(GL_OFFSET(_gloffset_ListParameteriSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ListParameterivSGIX)) GL_PREFIX(ListParameterivSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ListParameterivSGIX)) JMP(GL_OFFSET(_gloffset_ListParameterivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IndexMaterialEXT)) GL_PREFIX(IndexMaterialEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IndexMaterialEXT)) JMP(GL_OFFSET(_gloffset_IndexMaterialEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(IndexFuncEXT)) GL_PREFIX(IndexFuncEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IndexFuncEXT)) JMP(GL_OFFSET(_gloffset_IndexFuncEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LockArraysEXT)) GL_PREFIX(LockArraysEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LockArraysEXT)) JMP(GL_OFFSET(_gloffset_LockArraysEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(UnlockArraysEXT)) GL_PREFIX(UnlockArraysEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_UnlockArraysEXT)) JMP(GL_OFFSET(_gloffset_UnlockArraysEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CullParameterdvEXT)) GL_PREFIX(CullParameterdvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CullParameterdvEXT)) JMP(GL_OFFSET(_gloffset_CullParameterdvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CullParameterfvEXT)) GL_PREFIX(CullParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CullParameterfvEXT)) JMP(GL_OFFSET(_gloffset_CullParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentColorMaterialSGIX)) GL_PREFIX(FragmentColorMaterialSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentColorMaterialSGIX)) JMP(GL_OFFSET(_gloffset_FragmentColorMaterialSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightfSGIX)) GL_PREFIX(FragmentLightfSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentLightfSGIX)) JMP(GL_OFFSET(_gloffset_FragmentLightfSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightfvSGIX)) GL_PREFIX(FragmentLightfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentLightfvSGIX)) JMP(GL_OFFSET(_gloffset_FragmentLightfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightiSGIX)) GL_PREFIX(FragmentLightiSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentLightiSGIX)) JMP(GL_OFFSET(_gloffset_FragmentLightiSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightivSGIX)) GL_PREFIX(FragmentLightivSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentLightivSGIX)) JMP(GL_OFFSET(_gloffset_FragmentLightivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightModelfSGIX)) GL_PREFIX(FragmentLightModelfSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentLightModelfSGIX)) JMP(GL_OFFSET(_gloffset_FragmentLightModelfSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightModelfvSGIX)) GL_PREFIX(FragmentLightModelfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentLightModelfvSGIX)) JMP(GL_OFFSET(_gloffset_FragmentLightModelfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightModeliSGIX)) GL_PREFIX(FragmentLightModeliSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentLightModeliSGIX)) JMP(GL_OFFSET(_gloffset_FragmentLightModeliSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentLightModelivSGIX)) GL_PREFIX(FragmentLightModelivSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentLightModelivSGIX)) JMP(GL_OFFSET(_gloffset_FragmentLightModelivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentMaterialfSGIX)) GL_PREFIX(FragmentMaterialfSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentMaterialfSGIX)) JMP(GL_OFFSET(_gloffset_FragmentMaterialfSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentMaterialfvSGIX)) GL_PREFIX(FragmentMaterialfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentMaterialfvSGIX)) JMP(GL_OFFSET(_gloffset_FragmentMaterialfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentMaterialiSGIX)) GL_PREFIX(FragmentMaterialiSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentMaterialiSGIX)) JMP(GL_OFFSET(_gloffset_FragmentMaterialiSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentMaterialivSGIX)) GL_PREFIX(FragmentMaterialivSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FragmentMaterialivSGIX)) JMP(GL_OFFSET(_gloffset_FragmentMaterialivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFragmentLightfvSGIX)) GL_PREFIX(GetFragmentLightfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetFragmentLightfvSGIX)) JMP(GL_OFFSET(_gloffset_GetFragmentLightfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFragmentLightivSGIX)) GL_PREFIX(GetFragmentLightivSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetFragmentLightivSGIX)) JMP(GL_OFFSET(_gloffset_GetFragmentLightivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFragmentMaterialfvSGIX)) GL_PREFIX(GetFragmentMaterialfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetFragmentMaterialfvSGIX)) JMP(GL_OFFSET(_gloffset_GetFragmentMaterialfvSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFragmentMaterialivSGIX)) GL_PREFIX(GetFragmentMaterialivSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetFragmentMaterialivSGIX)) JMP(GL_OFFSET(_gloffset_GetFragmentMaterialivSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(LightEnviSGIX)) GL_PREFIX(LightEnviSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightEnviSGIX)) JMP(GL_OFFSET(_gloffset_LightEnviSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(DrawRangeElementsEXT)) GL_PREFIX(DrawRangeElementsEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawRangeElementsEXT)) JMP(GL_OFFSET(_gloffset_DrawRangeElements)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3bEXT)) GL_PREFIX(SecondaryColor3bEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3bEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3bEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3bvEXT)) GL_PREFIX(SecondaryColor3bvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3bvEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3bvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3dEXT)) GL_PREFIX(SecondaryColor3dEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3dEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3dEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3dvEXT)) GL_PREFIX(SecondaryColor3dvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3dvEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3dvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3fEXT)) GL_PREFIX(SecondaryColor3fEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3fEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3fEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3fvEXT)) GL_PREFIX(SecondaryColor3fvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3fvEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3fvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3iEXT)) GL_PREFIX(SecondaryColor3iEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3iEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3iEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3ivEXT)) GL_PREFIX(SecondaryColor3ivEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3ivEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3ivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3sEXT)) GL_PREFIX(SecondaryColor3sEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3sEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3sEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3svEXT)) GL_PREFIX(SecondaryColor3svEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3svEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3svEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3ubEXT)) GL_PREFIX(SecondaryColor3ubEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3ubEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3ubEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3ubvEXT)) GL_PREFIX(SecondaryColor3ubvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3ubvEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3ubvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3uiEXT)) GL_PREFIX(SecondaryColor3uiEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3uiEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3uiEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3uivEXT)) GL_PREFIX(SecondaryColor3uivEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3uivEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3uivEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3usEXT)) GL_PREFIX(SecondaryColor3usEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3usEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3usEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColor3usvEXT)) GL_PREFIX(SecondaryColor3usvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColor3usvEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColor3usvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SecondaryColorPointerEXT)) GL_PREFIX(SecondaryColorPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SecondaryColorPointerEXT)) JMP(GL_OFFSET(_gloffset_SecondaryColorPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoordfEXT)) GL_PREFIX(FogCoordfEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FogCoordfEXT)) JMP(GL_OFFSET(_gloffset_FogCoordfEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoordfvEXT)) GL_PREFIX(FogCoordfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FogCoordfvEXT)) JMP(GL_OFFSET(_gloffset_FogCoordfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoorddEXT)) GL_PREFIX(FogCoorddEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FogCoorddEXT)) JMP(GL_OFFSET(_gloffset_FogCoorddEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoorddvEXT)) GL_PREFIX(FogCoorddvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FogCoorddvEXT)) JMP(GL_OFFSET(_gloffset_FogCoorddvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoordPointerEXT)) GL_PREFIX(FogCoordPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FogCoordPointerEXT)) JMP(GL_OFFSET(_gloffset_FogCoordPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendFuncSeparateEXT)) GL_PREFIX(BlendFuncSeparateEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendFuncSeparateEXT)) JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexWeightfEXT)) GL_PREFIX(VertexWeightfEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_VertexWeightfEXT)) JMP(GL_OFFSET(_gloffset_VertexWeightfEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexWeightfvEXT)) GL_PREFIX(VertexWeightfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_VertexWeightfvEXT)) JMP(GL_OFFSET(_gloffset_VertexWeightfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexWeightPointerEXT)) GL_PREFIX(VertexWeightPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_VertexWeightPointerEXT)) JMP(GL_OFFSET(_gloffset_VertexWeightPointerEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FlushVertexArrayRangeNV)) GL_PREFIX(FlushVertexArrayRangeNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FlushVertexArrayRangeNV)) JMP(GL_OFFSET(_gloffset_FlushVertexArrayRangeNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(VertexArrayRangeNV)) GL_PREFIX(VertexArrayRangeNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_VertexArrayRangeNV)) JMP(GL_OFFSET(_gloffset_VertexArrayRangeNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerParameterfvNV)) GL_PREFIX(CombinerParameterfvNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CombinerParameterfvNV)) JMP(GL_OFFSET(_gloffset_CombinerParameterfvNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerParameterfNV)) GL_PREFIX(CombinerParameterfNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CombinerParameterfNV)) JMP(GL_OFFSET(_gloffset_CombinerParameterfNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerParameterivNV)) GL_PREFIX(CombinerParameterivNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CombinerParameterivNV)) JMP(GL_OFFSET(_gloffset_CombinerParameterivNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerParameteriNV)) GL_PREFIX(CombinerParameteriNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CombinerParameteriNV)) JMP(GL_OFFSET(_gloffset_CombinerParameteriNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerInputNV)) GL_PREFIX(CombinerInputNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CombinerInputNV)) JMP(GL_OFFSET(_gloffset_CombinerInputNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerOutputNV)) GL_PREFIX(CombinerOutputNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CombinerOutputNV)) JMP(GL_OFFSET(_gloffset_CombinerOutputNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FinalCombinerInputNV)) GL_PREFIX(FinalCombinerInputNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FinalCombinerInputNV)) JMP(GL_OFFSET(_gloffset_FinalCombinerInputNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetCombinerInputParameterfvNV)) GL_PREFIX(GetCombinerInputParameterfvNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetCombinerInputParameterfvNV)) JMP(GL_OFFSET(_gloffset_GetCombinerInputParameterfvNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetCombinerInputParameterivNV)) GL_PREFIX(GetCombinerInputParameterivNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetCombinerInputParameterivNV)) JMP(GL_OFFSET(_gloffset_GetCombinerInputParameterivNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetCombinerOutputParameterfvNV)) GL_PREFIX(GetCombinerOutputParameterfvNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetCombinerOutputParameterfvNV)) JMP(GL_OFFSET(_gloffset_GetCombinerOutputParameterfvNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetCombinerOutputParameterivNV)) GL_PREFIX(GetCombinerOutputParameterivNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetCombinerOutputParameterivNV)) JMP(GL_OFFSET(_gloffset_GetCombinerOutputParameterivNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFinalCombinerInputParameterfvNV)) GL_PREFIX(GetFinalCombinerInputParameterfvNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetFinalCombinerInputParameterfvNV)) JMP(GL_OFFSET(_gloffset_GetFinalCombinerInputParameterfvNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetFinalCombinerInputParameterivNV)) GL_PREFIX(GetFinalCombinerInputParameterivNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetFinalCombinerInputParameterivNV)) JMP(GL_OFFSET(_gloffset_GetFinalCombinerInputParameterivNV)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResizeBuffersMESA)) GL_PREFIX(ResizeBuffersMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResizeBuffersMESA)) JMP(GL_OFFSET(_gloffset_ResizeBuffersMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2dMESA)) GL_PREFIX(WindowPos2dMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos2dMESA)) JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2dvMESA)) GL_PREFIX(WindowPos2dvMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos2dvMESA)) JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2fMESA)) GL_PREFIX(WindowPos2fMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos2fMESA)) JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2fvMESA)) GL_PREFIX(WindowPos2fvMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos2fvMESA)) JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2iMESA)) GL_PREFIX(WindowPos2iMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos2iMESA)) JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2ivMESA)) GL_PREFIX(WindowPos2ivMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos2ivMESA)) JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2sMESA)) GL_PREFIX(WindowPos2sMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos2sMESA)) JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos2svMESA)) GL_PREFIX(WindowPos2svMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos2svMESA)) JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3dMESA)) GL_PREFIX(WindowPos3dMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos3dMESA)) JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3dvMESA)) GL_PREFIX(WindowPos3dvMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos3dvMESA)) JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3fMESA)) GL_PREFIX(WindowPos3fMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos3fMESA)) JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3fvMESA)) GL_PREFIX(WindowPos3fvMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos3fvMESA)) JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3iMESA)) GL_PREFIX(WindowPos3iMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos3iMESA)) JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3ivMESA)) GL_PREFIX(WindowPos3ivMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos3ivMESA)) JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3sMESA)) GL_PREFIX(WindowPos3sMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos3sMESA)) JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos3svMESA)) GL_PREFIX(WindowPos3svMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos3svMESA)) JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4dMESA)) GL_PREFIX(WindowPos4dMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos4dMESA)) JMP(GL_OFFSET(_gloffset_WindowPos4dMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4dvMESA)) GL_PREFIX(WindowPos4dvMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos4dvMESA)) JMP(GL_OFFSET(_gloffset_WindowPos4dvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4fMESA)) GL_PREFIX(WindowPos4fMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos4fMESA)) JMP(GL_OFFSET(_gloffset_WindowPos4fMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4fvMESA)) GL_PREFIX(WindowPos4fvMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos4fvMESA)) JMP(GL_OFFSET(_gloffset_WindowPos4fvMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4iMESA)) GL_PREFIX(WindowPos4iMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos4iMESA)) JMP(GL_OFFSET(_gloffset_WindowPos4iMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4ivMESA)) GL_PREFIX(WindowPos4ivMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos4ivMESA)) JMP(GL_OFFSET(_gloffset_WindowPos4ivMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4sMESA)) GL_PREFIX(WindowPos4sMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos4sMESA)) JMP(GL_OFFSET(_gloffset_WindowPos4sMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(WindowPos4svMESA)) GL_PREFIX(WindowPos4svMESA): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos4svMESA)) JMP(GL_OFFSET(_gloffset_WindowPos4svMESA)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TbufferMask3DFX)) GL_PREFIX(TbufferMask3DFX): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TbufferMask3DFX)) JMP(GL_OFFSET(_gloffset_TbufferMask3DFX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SampleMaskEXT)) GL_PREFIX(SampleMaskEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SampleMaskEXT)) JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(SamplePatternEXT)) GL_PREFIX(SamplePatternEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SamplePatternEXT)) JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) diff --git a/src/mesa/x86/x86_cliptest.S b/src/mesa/x86/x86_cliptest.S index b1dd844b7ba..0258a9b636a 100644 --- a/src/mesa/x86/x86_cliptest.S +++ b/src/mesa/x86/x86_cliptest.S @@ -1,4 +1,4 @@ -/* $Id: x86_cliptest.S,v 1.2 2000/10/23 00:16:28 gareth Exp $ */ +/* $Id: x86_cliptest.S,v 1.3 2000/12/26 05:09:31 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -132,7 +132,7 @@ LLBL( ctp4_clip_table_ready ): OR_L( CONST(VEC_SIZE_4), REGOFF(V4F_FLAGS, EDI) ) MOV_L( EAX, ARG_SOURCE ) /* put stride in ARG_SOURCE */ - MOV_L( CONST(3), REGOFF(V4F_SIZE, EDI) ) + MOV_L( CONST(4), REGOFF(V4F_SIZE, EDI) ) MOV_L( ECX, REGOFF(V4F_COUNT, EDI) ) MOV_L( REGOFF(V4F_START, EDI), EDI ) -- 2.30.2