X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmesa%2Fdrivers%2Fglide%2Ffxvb.c;h=cc9ad0e8b8349d5ff3537068bd09f4db6bf40146;hb=0a9187801505130738ae947c69cafa8a1dd118d1;hp=2d9f73d6a8f5af6e6fa97bf897ff0198e009c66b;hpb=e81b180065f0a9f80c1310ac447509b1debc4559;p=mesa.git diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c index 2d9f73d6a8f..cc9ad0e8b83 100644 --- a/src/mesa/drivers/glide/fxvb.c +++ b/src/mesa/drivers/glide/fxvb.c @@ -17,14 +17,15 @@ * 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 + * 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 Whitwell + * Daniel Borca */ #ifdef HAVE_CONFIG_H @@ -33,11 +34,11 @@ #ifdef FX -#include "glheader.h" -#include "mtypes.h" -#include "imports.h" -#include "macros.h" -#include "colormac.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/colormac.h" #include "math/m_translate.h" #include "swrast_setup/swrast_setup.h" @@ -54,54 +55,46 @@ static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc ) 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 */ } -typedef void (*emit_func)( GLcontext *, GLuint, GLuint, void * ); - -static struct { - emit_func emit; - interp_func interp; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); - GLuint vertex_format; -} setup_tab[MAX_SETUP]; - - -static void import_float_colors( GLcontext *ctx ) +static void copy_pv2( GLcontext *ctx, GLuint edst, GLuint esrc ) { - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - struct gl_client_array *from = VB->ColorPtr[0]; - struct gl_client_array *to = &FX_CONTEXT(ctx)->UbyteColor; - GLuint count = VB->Count; - - if (!to->Ptr) { - to->Ptr = ALIGN_MALLOC( VB->Size * 4 * sizeof(GLubyte), 32 ); - to->Type = GL_UNSIGNED_BYTE; - } + fxMesaContext fxMesa = FX_CONTEXT( ctx ); + GrVertex *dst = fxMesa->verts + edst; + GrVertex *src = fxMesa->verts + esrc; - /* No need to transform the same value 3000 times. - */ - if (!from->StrideB) { - to->StrideB = 0; - count = 1; - } - else - to->StrideB = 4 * sizeof(GLubyte); - - _math_trans_4ub( (GLubyte (*)[4]) to->Ptr, - from->Ptr, - from->StrideB, - from->Type, - from->Size, - 0, - count); - - VB->ColorPtr[0] = to; +#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]; -/* Hack alert: assume chan is 8 bits */ -#define GET_COLOR(ptr, idx) (((GLchan (*)[4])((ptr)->Ptr))[idx]) + +#define GET_COLOR(ptr, idx) ((ptr)->data[idx]) static void interp_extras( GLcontext *ctx, @@ -111,19 +104,25 @@ static void interp_extras( GLcontext *ctx, { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - if (VB->ColorPtr[1]) { - INTERP_4CHAN( t, - GET_COLOR(VB->ColorPtr[1], dst), - GET_COLOR(VB->ColorPtr[1], out), - GET_COLOR(VB->ColorPtr[1], in) ); -#if 1 /* [dBorca] GL_EXT_separate_specular_color */ - if (VB->SecondaryColorPtr[1]) { - INTERP_3CHAN( t, - GET_COLOR(VB->SecondaryColorPtr[1], dst), - GET_COLOR(VB->SecondaryColorPtr[1], out), - GET_COLOR(VB->SecondaryColorPtr[1], in) ); + if (VB->BackfaceColorPtr) { + /* If stride is zero, BackfaceColorPtr 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->BackfaceColorPtr->stride) { + assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat)); + INTERP_4F( t, + GET_COLOR(VB->BackfaceColorPtr, dst), + GET_COLOR(VB->BackfaceColorPtr, out), + GET_COLOR(VB->BackfaceColorPtr, in) ); + } + + if (VB->BackfaceSecondaryColorPtr) { + INTERP_3F( t, + GET_COLOR(VB->BackfaceSecondaryColorPtr, dst), + GET_COLOR(VB->BackfaceSecondaryColorPtr, out), + GET_COLOR(VB->BackfaceSecondaryColorPtr, in) ); } -#endif } if (VB->EdgeFlag) { @@ -138,18 +137,17 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - if (VB->ColorPtr[1]) { - COPY_CHAN4( GET_COLOR(VB->ColorPtr[1], dst), - GET_COLOR(VB->ColorPtr[1], src) ); -#if 1 /* [dBorca] GL_EXT_separate_specular_color */ - if (VB->SecondaryColorPtr[1]) { - COPY_CHAN4( GET_COLOR(VB->SecondaryColorPtr[1], dst), - GET_COLOR(VB->SecondaryColorPtr[1], src) ); + if (VB->BackfaceColorPtr) { + COPY_4FV( GET_COLOR(VB->BackfaceColorPtr, dst), + GET_COLOR(VB->BackfaceColorPtr, src) ); + + if (VB->BackfaceSecondaryColorPtr) { + COPY_3FV( GET_COLOR(VB->BackfaceSecondaryColorPtr, dst), + GET_COLOR(VB->BackfaceSecondaryColorPtr, src) ); } -#endif } - copy_pv(ctx, dst, src); + setup_tab[FX_CONTEXT(ctx)->SetupIndex].copy_pv(ctx, dst, src); } @@ -174,6 +172,157 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) #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 */ @@ -200,6 +349,171 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) #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" + +/* fog { */ +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_FOGC) +#define TAG(x) x##_wsgf +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|SETUP_FOGC) +#define TAG(x) x##_wsgt0f +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ + SETUP_TMU1|SETUP_FOGC) +#define TAG(x) x##_wsgt0t1f +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ + SETUP_PTEX|SETUP_FOGC) +#define TAG(x) x##_wsgpt0f +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ + SETUP_TMU1|SETUP_PTEX|SETUP_FOGC) +#define TAG(x) x##_wsgpt0t1f +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_PSIZ|SETUP_FOGC) +#define TAG(x) x##_wsgaf +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC) +#define TAG(x) x##_wsgt0af +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ + SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC) +#define TAG(x) x##_wsgt0t1af +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ + SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC) +#define TAG(x) x##_wsgpt0af +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_TMU0|\ + SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC) +#define TAG(x) x##_wsgpt0t1af +#include "fxvbtmp.h" + + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_FOGC) +#define TAG(x) x##_2wsgf +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_FOGC) +#define TAG(x) x##_2wsgt0f +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ + SETUP_TMU1|SETUP_FOGC) +#define TAG(x) x##_2wsgt0t1f +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ + SETUP_PTEX|SETUP_FOGC) +#define TAG(x) x##_2wsgpt0f +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ + SETUP_TMU1|SETUP_PTEX|SETUP_FOGC) +#define TAG(x) x##_2wsgpt0t1f +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_PSIZ|SETUP_FOGC) +#define TAG(x) x##_2wsgaf +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_PSIZ|SETUP_FOGC) +#define TAG(x) x##_2wsgt0af +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ + SETUP_TMU1|SETUP_PSIZ|SETUP_FOGC) +#define TAG(x) x##_2wsgt0t1af +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ + SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC) +#define TAG(x) x##_2wsgpt0af +#include "fxvbtmp.h" + +#define IND (SETUP_XYZW|SETUP_SNAP|SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|\ + SETUP_TMU1|SETUP_PTEX|SETUP_PSIZ|SETUP_FOGC) +#define TAG(x) x##_2wsgpt0t1af +#include "fxvbtmp.h" +/* fog } */ + /* Vertex repair (multipass rendering) */ @@ -224,6 +538,27 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) #include "fxvbtmp.h" +#define IND (SETUP_RGBA|SETUP_SPEC) +#define TAG(x) x##_2g +#include "fxvbtmp.h" + +#define IND (SETUP_TMU0|SETUP_SPEC) +#define TAG(x) x##_2t0 +#include "fxvbtmp.h" + +#define IND (SETUP_TMU0|SETUP_SPEC|SETUP_TMU1) +#define TAG(x) x##_2t0t1 +#include "fxvbtmp.h" + +#define IND (SETUP_RGBA|SETUP_SPEC|SETUP_TMU0) +#define TAG(x) x##_2gt0 +#include "fxvbtmp.h" + +#define IND (SETUP_RGBA|SETUP_SPEC|SETUP_TMU0|SETUP_TMU1) +#define TAG(x) x##_2gt0t1 +#include "fxvbtmp.h" + + static void init_setup_tab( void ) { @@ -232,31 +567,109 @@ static void init_setup_tab( void ) init_wgt0t1(); init_wgpt0(); init_wgpt0t1(); + init_wga(); + init_wgt0a(); + init_wgt0t1a(); + init_wgpt0a(); + init_wgpt0t1a(); + init_2wg(); + init_2wgt0(); + init_2wgt0t1(); + init_2wgpt0(); + init_2wgpt0t1(); + init_2wga(); + init_2wgt0a(); + init_2wgt0t1a(); + init_2wgpt0a(); + init_2wgpt0t1a(); + init_wgf(); + init_wgt0f(); + init_wgt0t1f(); + init_wgpt0f(); + init_wgpt0t1f(); + init_wgaf(); + init_wgt0af(); + init_wgt0t1af(); + init_wgpt0af(); + init_wgpt0t1af(); + init_2wgf(); + init_2wgt0f(); + init_2wgt0t1f(); + init_2wgpt0f(); + init_2wgpt0t1f(); + init_2wgaf(); + init_2wgt0af(); + init_2wgt0t1af(); + init_2wgpt0af(); + init_2wgpt0t1af(); init_wsg(); init_wsgt0(); init_wsgt0t1(); init_wsgpt0(); init_wsgpt0t1(); + init_wsga(); + init_wsgt0a(); + init_wsgt0t1a(); + init_wsgpt0a(); + init_wsgpt0t1a(); + init_2wsg(); + init_2wsgt0(); + init_2wsgt0t1(); + init_2wsgpt0(); + init_2wsgpt0t1(); + init_2wsga(); + init_2wsgt0a(); + init_2wsgt0t1a(); + init_2wsgpt0a(); + init_2wsgpt0t1a(); + init_wsgf(); + init_wsgt0f(); + init_wsgt0t1f(); + init_wsgpt0f(); + init_wsgpt0t1f(); + init_wsgaf(); + init_wsgt0af(); + init_wsgt0t1af(); + init_wsgpt0af(); + init_wsgpt0t1af(); + init_2wsgf(); + init_2wsgt0f(); + init_2wsgt0t1f(); + init_2wsgpt0f(); + init_2wsgpt0t1f(); + init_2wsgaf(); + init_2wsgt0af(); + init_2wsgt0t1af(); + init_2wsgpt0af(); + init_2wsgpt0t1af(); init_g(); init_t0(); init_t0t1(); init_gt0(); init_gt0t1(); + init_2g(); + init_2t0(); + init_2t0t1(); + init_2gt0(); + init_2gt0t1(); } void fxPrintSetupFlags(char *msg, GLuint flags ) { - fprintf(stderr, "%s(%x): %s%s%s%s%s\n", + fprintf(stderr, "%s(%x): %s%s%s%s%s%s%s%s\n", msg, (int)flags, - (flags & SETUP_XYZW) ? " xyzw," : "", - (flags & SETUP_SNAP) ? " snap," : "", + (flags & SETUP_XYZW) ? " xyzw," : "", + (flags & SETUP_SNAP) ? " snap," : "", (flags & SETUP_RGBA) ? " rgba," : "", (flags & SETUP_TMU0) ? " tex-0," : "", - (flags & SETUP_TMU1) ? " tex-1," : ""); + (flags & SETUP_TMU1) ? " tex-1," : "", + (flags & SETUP_PSIZ) ? " psiz," : "", + (flags & SETUP_SPEC) ? " spec," : "", + (flags & SETUP_FOGC) ? " fog," : ""); } @@ -290,7 +703,7 @@ void fxCheckTexSizes( GLcontext *ctx ) } -void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint count, +void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint end, GLuint newinputs ) { fxMesaContext fxMesa = FX_CONTEXT( ctx ); @@ -299,15 +712,21 @@ void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint count, if (!newinputs) return; - if (newinputs & VERT_BIT_CLIP) { - setup_tab[fxMesa->SetupIndex].emit( ctx, start, count, v ); + if (newinputs & VERT_BIT_POS) { + setup_tab[fxMesa->SetupIndex].emit( ctx, start, end, v ); } else { GLuint ind = 0; if (newinputs & VERT_BIT_COLOR0) ind |= SETUP_RGBA; - - if (newinputs & VERT_BIT_TEX0) + + if (newinputs & VERT_BIT_COLOR1) + ind |= SETUP_SPEC; + + if (newinputs & VERT_BIT_FOG) + ind |= SETUP_FOGC; + + if (newinputs & VERT_BIT_TEX0) ind |= SETUP_TMU0; if (newinputs & VERT_BIT_TEX1) @@ -319,7 +738,7 @@ void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint count, ind &= fxMesa->SetupIndex; if (ind) { - setup_tab[ind].emit( ctx, start, count, v ); + setup_tab[ind].emit( ctx, start, end, v ); } } } @@ -339,18 +758,28 @@ void fxChooseVertexState( GLcontext *ctx ) if (ctx->Texture._EnabledUnits & 0x2) { if (ctx->Texture._EnabledUnits & 0x1) { - ind |= SETUP_TMU1|SETUP_TMU0; - } - else { - fxMesa->tmu_source[0] = 1; - fxMesa->tmu_source[1] = 0; - ind |= SETUP_TMU0; + ind |= SETUP_TMU1; } + ind |= SETUP_TMU0; + fxMesa->tmu_source[0] = 1; + fxMesa->tmu_source[1] = 0; } else if (ctx->Texture._EnabledUnits & 0x1) { ind |= SETUP_TMU0; } - + + if (ctx->_TriangleCaps & DD_POINT_ATTEN) { + ind |= SETUP_PSIZ; + } + + if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) { + ind |= SETUP_SPEC; + } + + if (ctx->Fog.FogCoordinateSource == GL_FOG_COORDINATE_EXT) { + ind |= SETUP_FOGC; + } + fxMesa->SetupIndex = ind; if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) { @@ -358,7 +787,7 @@ void fxChooseVertexState( GLcontext *ctx ) tnl->Driver.Render.CopyPV = copy_pv_extras; } else { tnl->Driver.Render.Interp = setup_tab[ind].interp; - tnl->Driver.Render.CopyPV = copy_pv; + tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv; } if (setup_tab[ind].vertex_format != fxMesa->stw_hint_state) { @@ -391,11 +820,6 @@ void fxFreeVB( GLcontext *ctx ) ALIGN_FREE(fxMesa->verts); fxMesa->verts = 0; } - - if (fxMesa->UbyteColor.Ptr) { - ALIGN_FREE((void *)fxMesa->UbyteColor.Ptr); - fxMesa->UbyteColor.Ptr = 0; - } } #else