📄 fxvb.c
字号:
/* * Mesa 3-D graphics library * Version: 5.1 * * Copyright (C) 1999-2003 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 * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS 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 <keith@tungstengraphics.com> * Daniel Borca <dborca@users.sourceforge.net> */#ifdef HAVE_CONFIG_H#include "conf.h"#endif#ifdef FX#include "glheader.h"#include "mtypes.h"#include "imports.h"#include "macros.h"#include "colormac.h"#include "math/m_translate.h"#include "swrast_setup/swrast_setup.h"#include "tnl/tnl.h"#include "tnl/t_context.h"#include "fxdrv.h"static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ){ fxMesaContext fxMesa = FX_CONTEXT( ctx ); GrVertex *dst = fxMesa->verts + edst; GrVertex *src = fxMesa->verts + esrc;#if FX_PACKEDCOLOR *(GLuint *)&dst->pargb = *(GLuint *)&src->pargb;#else /* !FX_PACKEDCOLOR */ COPY_FLOAT(dst->r, src->r); COPY_FLOAT(dst->g, src->g); COPY_FLOAT(dst->b, src->b); COPY_FLOAT(dst->a, src->a);#endif /* !FX_PACKEDCOLOR */}static void copy_pv2( GLcontext *ctx, GLuint edst, GLuint esrc ){ fxMesaContext fxMesa = FX_CONTEXT( ctx ); GrVertex *dst = fxMesa->verts + edst; GrVertex *src = fxMesa->verts + esrc;#if FX_PACKEDCOLOR *(GLuint *)&dst->pargb = *(GLuint *)&src->pargb; *(GLuint *)&dst->pspec = *(GLuint *)&src->pspec;#else /* !FX_PACKEDCOLOR */ COPY_FLOAT(dst->r, src->r); COPY_FLOAT(dst->g, src->g); COPY_FLOAT(dst->b, src->b); COPY_FLOAT(dst->a, src->a); COPY_FLOAT(dst->r1, src->r1); COPY_FLOAT(dst->g1, src->g1); COPY_FLOAT(dst->b1, src->b1);#endif /* !FX_PACKEDCOLOR */}static struct { void (*emit) (GLcontext *ctx, GLuint start, GLuint end, void *dest); tnl_copy_pv_func copy_pv; tnl_interp_func interp; GLboolean (*check_tex_sizes) (GLcontext *ctx); GLuint vertex_format;} setup_tab[MAX_SETUP];#define GET_COLOR(ptr, idx) ((ptr)->data[idx])static void interp_extras( GLcontext *ctx, GLfloat t, GLuint dst, GLuint out, GLuint in, GLboolean force_boundary ){ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; if (VB->ColorPtr[1]) { /* If stride is zero, ColorPtr[1] is constant across the VB, so * there is no point interpolating between two values as they will * be identical. This case is handled in t_dd_tritmp.h */ if (VB->ColorPtr[1]->stride) { assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat)); INTERP_4F( t, GET_COLOR(VB->ColorPtr[1], dst), GET_COLOR(VB->ColorPtr[1], out), GET_COLOR(VB->ColorPtr[1], in) ); } if (VB->SecondaryColorPtr[1]) { INTERP_3F( t, GET_COLOR(VB->SecondaryColorPtr[1], dst), GET_COLOR(VB->SecondaryColorPtr[1], out), GET_COLOR(VB->SecondaryColorPtr[1], in) ); } } if (VB->EdgeFlag) { VB->EdgeFlag[dst] = VB->EdgeFlag[out] || force_boundary; } setup_tab[FX_CONTEXT(ctx)->SetupIndex].interp(ctx, t, dst, out, in, force_boundary);}static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ){ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; if (VB->ColorPtr[1]) { COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst), GET_COLOR(VB->ColorPtr[1], src) ); if (VB->SecondaryColorPtr[1]) { COPY_3FV( GET_COLOR(VB->SecondaryColorPtr[1], dst), GET_COLOR(VB->SecondaryColorPtr[1], src) ); } } setup_tab[FX_CONTEXT(ctx)->SetupIndex].copy_pv(ctx, dst, src);}#define IND (SETUP_XYZW|SETUP_RGBA)#define TAG(x) x##_wg#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0)#define TAG(x) x##_wgt0#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1)#define TAG(x) x##_wgt0t1#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX)#define TAG(x) x##_wgpt0#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\ SETUP_PTEX)#define TAG(x) x##_wgpt0t1#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_PSIZ)#define TAG(x) x##_wga#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ)#define TAG(x) x##_wgt0a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ)#define TAG(x) x##_wgt0t1a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ)#define TAG(x) x##_wgpt0a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\ SETUP_PTEX|SETUP_PSIZ)#define TAG(x) x##_wgpt0t1a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC)#define TAG(x) x##_2wg#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0)#define TAG(x) x##_2wgt0#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1)#define TAG(x) x##_2wgt0t1#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PTEX)#define TAG(x) x##_2wgpt0#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|\ SETUP_PTEX)#define TAG(x) x##_2wgpt0t1#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_PSIZ)#define TAG(x) x##_2wga#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PSIZ)#define TAG(x) x##_2wgt0a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ)#define TAG(x) x##_2wgt0t1a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ)#define TAG(x) x##_2wgpt0a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|\ SETUP_PTEX|SETUP_PSIZ)#define TAG(x) x##_2wgpt0t1a#include "fxvbtmp.h"/* fog { */#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_FOGC)#define TAG(x) x##_wgf#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_FOGC)#define TAG(x) x##_wgt0f#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|SETUP_FOGC)#define TAG(x) x##_wgt0t1f#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX|SETUP_FOGC)#define TAG(x) x##_wgpt0f#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\ SETUP_PTEX|SETUP_FOGC)#define TAG(x) x##_wgpt0t1f#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_PSIZ|SETUP_FOGC)#define TAG(x) x##_wgaf#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC)#define TAG(x) x##_wgt0af#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC)#define TAG(x) x##_wgt0t1af#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)#define TAG(x) x##_wgpt0af#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_TMU0|SETUP_TMU1|\ SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)#define TAG(x) x##_wgpt0t1af#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_FOGC)#define TAG(x) x##_2wgf#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_FOGC)#define TAG(x) x##_2wgt0f#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|SETUP_FOGC)#define TAG(x) x##_2wgt0t1f#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PTEX|SETUP_FOGC)#define TAG(x) x##_2wgpt0f#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|\ SETUP_PTEX|SETUP_FOGC)#define TAG(x) x##_2wgpt0t1f#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_PSIZ|SETUP_FOGC)#define TAG(x) x##_2wgaf#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC)#define TAG(x) x##_2wgt0af#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC)#define TAG(x) x##_2wgt0t1af#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)#define TAG(x) x##_2wgpt0af#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1|\ SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC)#define TAG(x) x##_2wgpt0t1af#include "fxvbtmp.h"/* fog } *//* Snapping for voodoo-1 */#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA)#define TAG(x) x##_wsg#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0)#define TAG(x) x##_wsgt0#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ SETUP_TMU1)#define TAG(x) x##_wsgt0t1#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ SETUP_PTEX)#define TAG(x) x##_wsgpt0#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ SETUP_TMU1|SETUP_PTEX)#define TAG(x) x##_wsgpt0t1#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_PSIZ)#define TAG(x) x##_wsga#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ)#define TAG(x) x##_wsgt0a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ SETUP_TMU1|SETUP_PSIZ)#define TAG(x) x##_wsgt0t1a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ SETUP_PTEX|SETUP_PSIZ)#define TAG(x) x##_wsgpt0a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ)#define TAG(x) x##_wsgpt0t1a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC)#define TAG(x) x##_2wsg#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0)#define TAG(x) x##_2wsgt0#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ SETUP_TMU1)#define TAG(x) x##_2wsgt0t1#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ SETUP_PTEX)#define TAG(x) x##_2wsgpt0#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ SETUP_TMU1|SETUP_PTEX)#define TAG(x) x##_2wsgpt0t1#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_PSIZ)#define TAG(x) x##_2wsga#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PSIZ)#define TAG(x) x##_2wsgt0a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ SETUP_TMU1|SETUP_PSIZ)#define TAG(x) x##_2wsgt0t1a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ SETUP_PTEX|SETUP_PSIZ)#define TAG(x) x##_2wsgpt0a#include "fxvbtmp.h"#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ)#define TAG(x) x##_2wsgpt0t1a#include "fxvbtmp.h"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -