diff options
author | Gareth Hughes <[email protected]> | 2001-03-12 00:48:37 +0000 |
---|---|---|
committer | Gareth Hughes <[email protected]> | 2001-03-12 00:48:37 +0000 |
commit | 22144ab7552f0799bcfca506bf4ffa7f70a06649 (patch) | |
tree | e7986aa02e97d88071b0769dc8d5359860320614 /src/mesa/drivers | |
parent | 57ffddba9870a0e602ae454e13072a0af48fa150 (diff) |
Consistent copyright info (version number, date) across all files.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/common/t_dd.c | 29 | ||||
-rw-r--r-- | src/mesa/drivers/common/t_dd_dmatmp.h | 147 | ||||
-rw-r--r-- | src/mesa/drivers/common/t_dd_rendertmp.h | 39 | ||||
-rw-r--r-- | src/mesa/drivers/common/t_dd_tritmp.h | 123 | ||||
-rw-r--r-- | src/mesa/drivers/common/t_dd_unfilled.h | 91 | ||||
-rw-r--r-- | src/mesa/drivers/common/t_dd_vb.c | 40 | ||||
-rw-r--r-- | src/mesa/drivers/common/t_dd_vbtmp.h | 174 | ||||
-rw-r--r-- | src/mesa/drivers/common/t_dd_vertex.h | 8 |
8 files changed, 357 insertions, 294 deletions
diff --git a/src/mesa/drivers/common/t_dd.c b/src/mesa/drivers/common/t_dd.c index 27db3058755..0926e23603d 100644 --- a/src/mesa/drivers/common/t_dd.c +++ b/src/mesa/drivers/common/t_dd.c @@ -1,3 +1,31 @@ +/* $Id: t_dd.c,v 1.2 2001/03/12 00:48:44 gareth Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 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 <[email protected]> + */ static void copy_pv_rgba4_spec5( GLcontext *ctx, GLuint edst, GLuint esrc ) { @@ -29,4 +57,3 @@ static void copy_pv_rgba3( GLcontext *ctx, GLuint edst, GLuint esrc ) i810Vertex *src = (i810Vertex *)(i810verts + (esrc << shift)); dst->ui[3] = src->ui[3]; } - diff --git a/src/mesa/drivers/common/t_dd_dmatmp.h b/src/mesa/drivers/common/t_dd_dmatmp.h index f2a08c02842..db06f0f92c2 100644 --- a/src/mesa/drivers/common/t_dd_dmatmp.h +++ b/src/mesa/drivers/common/t_dd_dmatmp.h @@ -1,19 +1,21 @@ +/* $Id: t_dd_dmatmp.h,v 1.6 2001/03/12 00:48:44 gareth Exp $ */ + /* * Mesa 3-D graphics library * Version: 3.5 - * - * Copyright (C) 1999 Brian Paul All Rights Reserved. - * + * + * Copyright (C) 1999-2001 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 @@ -21,39 +23,39 @@ * 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 <[email protected]> + * Authors: + * Keith Whitwell <[email protected]> */ /* Template for render stages which build and emit vertices directly * to fixed-size dma buffers. Useful for rendering strips and other * native primitives where clipping and per-vertex tweaks such as - * those in t_dd_tritmp.h are not required. + * those in t_dd_tritmp.h are not required. * * Produces code for both inline triangles and indexed triangles. * Where various primitive types are unaccelerated by hardware, the * code attempts to fallback to other primitive types (quadstrips to * tristrips, lineloops to linestrips), or to indexed vertices. * Ultimately, a FALLBACK() macro is invoked if there is no way to - * render the primitive natively. + * render the primitive natively. */ #if !defined(HAVE_TRIANGLES) #error "must have at least triangles to use render template" #endif -#if !HAVE_ELTS +#if !HAVE_ELTS #define ELTS_VARS #define ALLOC_ELTS( nr ) #define EMIT_ELT( offset, elt ) #define INCR_ELTS( nr ) -#define ELT_INIT(prim) +#define ELT_INIT(prim) #define GET_CURRENT_VB_MAX_ELTS() 0 #define GET_SUBSEQUENT_VB_MAX_ELTS() 0 #define ALLOC_ELTS_NEW_PRIMITIVE(nr) -#define RELEASE_ELT_VERTS() -#define EMIT_INDEXED_VERTS( ctx, start, count ) +#define RELEASE_ELT_VERTS() +#define EMIT_INDEXED_VERTS( ctx, start, count ) #endif #ifndef EMIT_TWO_ELTS @@ -63,21 +65,21 @@ do { \ EMIT_ELT( offset+1, elt1 ); \ } while (0) #endif - + /**********************************************************************/ /* Render whole begin/end objects */ /**********************************************************************/ -static GLboolean TAG(emit_elt_verts)( GLcontext *ctx, +static GLboolean TAG(emit_elt_verts)( GLcontext *ctx, GLuint start, GLuint count ) { if (HAVE_ELTS) { LOCAL_VARS; GLuint nr = count - start; - if ( nr >= GET_SUBSEQUENT_VB_MAX_VERTS() ) /* assumes same packing for + if ( nr >= GET_SUBSEQUENT_VB_MAX_VERTS() ) /* assumes same packing for * indexed and regualar verts */ return GL_FALSE; @@ -99,8 +101,8 @@ static void TAG(emit_elts)( GLcontext *ctx, GLuint *elts, GLuint nr ) ALLOC_ELTS( nr ); - for ( i = 0 ; i < nr ; i+=2, elts += 2 ) { - EMIT_TWO_ELTS( 0, elts[0], elts[1] ); + for ( i = 0 ; i < nr ; i+=2, elts += 2 ) { + EMIT_TWO_ELTS( 0, elts[0], elts[1] ); INCR_ELTS( 2 ); } } @@ -123,12 +125,12 @@ static void TAG(render_points_verts)( GLcontext *ctx, int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); int currentsz = GET_CURRENT_VB_MAX_VERTS(); GLuint j, nr; - + INIT( GL_POINTS ); - + if (currentsz < 8) currentsz = dmasz; - + for (j = start; j < count; j += nr ) { nr = MIN2( currentsz, count - j ); EMIT_VERTS( ctx, j, nr ); @@ -151,7 +153,7 @@ static void TAG(render_lines_verts)( GLcontext *ctx, GLuint j, nr; INIT( GL_LINES ); - + /* Emit whole number of lines in total and in each buffer: */ count -= (count-start) & 1; @@ -214,7 +216,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, NEW_PRIMITIVE(); INIT( GL_LINE_STRIP ); - if (flags & PRIM_BEGIN) + if (flags & PRIM_BEGIN) j = start; else j = start + 1; @@ -224,7 +226,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, currentsz--; dmasz--; - if (currentsz < 8) + if (currentsz < 8) currentsz = dmasz; for ( ; j < count - 1; j += nr - 1 ) { @@ -232,8 +234,8 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, EMIT_VERTS( ctx, j, nr ); currentsz = dmasz; } - - if (flags & PRIM_END) + + if (flags & PRIM_END) EMIT_VERTS( ctx, start, 1 ); } else { @@ -253,7 +255,7 @@ static void TAG(render_triangles_verts)( GLcontext *ctx, GLuint j, nr; INIT(GL_TRIANGLES); - + /* Emit whole number of tris in total. dmasz is already a multiple * of 3. */ @@ -281,12 +283,12 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx, GLuint j, nr; int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); int currentsz; - + INIT(GL_TRIANGLE_STRIP); NEW_PRIMITIVE(); - + currentsz = GET_CURRENT_VB_MAX_VERTS(); - + if (currentsz < 8) { FIRE_VERTICES(); currentsz = dmasz; @@ -304,7 +306,7 @@ static void TAG(render_tri_strip_verts)( GLcontext *ctx, */ dmasz -= (dmasz & 1); currentsz -= (currentsz & 1); - + for (j = start ; j < count - 2; j += nr - 2 ) { nr = MIN2( currentsz, count - j ); EMIT_VERTS( ctx, j, nr ); @@ -325,7 +327,7 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx, GLuint j, nr; int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); int currentsz = GET_CURRENT_VB_MAX_VERTS(); - + NEW_PRIMITIVE(); INIT(GL_TRIANGLE_FAN); @@ -340,7 +342,7 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx, EMIT_VERTS( ctx, j, nr - 1 ); currentsz = dmasz; } - } + } else { /* Could write code to emit these as indexed vertices (for the * g400, for instance). @@ -368,14 +370,14 @@ static void TAG(render_poly_verts)( GLcontext *ctx, FIRE_VERTICES(); currentsz = dmasz; } - + for (j = start + 1 ; j < count - 1 ; j += nr - 1 ) { nr = MIN2( currentsz, count - j + 1 ); EMIT_VERTS( ctx, start, 1 ); EMIT_VERTS( ctx, j, nr - 1 ); currentsz = dmasz; } - } + } else if (HAVE_TRI_FANS && !(ctx->_TriangleCaps & DD_FLATSHADE)) { TAG(render_tri_fan_verts)( ctx, start, count, flags ); } else { @@ -394,7 +396,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx, /* TODO. */ } else if (HAVE_TRI_STRIPS && ctx->_TriangleCaps & DD_FLATSHADE) { - if (TAG(emit_elt_verts)( ctx, start, count )) { + if (TAG(emit_elt_verts)( ctx, start, count )) { LOCAL_VARS; int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); int currentsz; @@ -412,7 +414,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx, dmasz -= dmasz & 1; count -= (count-start) & 1; currentsz -= currentsz & 1; - + if (currentsz < 12) currentsz = dmasz; @@ -428,28 +430,28 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx, NEW_PRIMITIVE(); ALLOC_ELTS_NEW_PRIMITIVE( quads*6 ); - + for ( i = 0 ; i < quads*2 ; i+=2 ) { EMIT_TWO_ELTS( 0, (i+0), (i+1) ); EMIT_TWO_ELTS( 2, (i+2), (i+1) ); EMIT_TWO_ELTS( 4, (i+3), (i+2) ); INCR_ELTS( 6 ); } - + NEW_PRIMITIVE(); } currentsz = dmasz; } RELEASE_ELT_VERTS(); - } + } else { /* Vertices won't fit in a single buffer or elts not available, * VERT_FALLBACK. */ VERT_FALLBACK( ctx, start, count, flags ); } - } + } else if (HAVE_TRI_STRIPS) { LOCAL_VARS; int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS(); @@ -465,7 +467,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx, dmasz -= dmasz & 1; currentsz -= currentsz & 1; count -= (count-start) & 1; - + if (currentsz < 8) { FIRE_VERTICES(); currentsz = dmasz; @@ -488,10 +490,10 @@ static void TAG(render_quads_verts)( GLcontext *ctx, GLuint flags ) { if (HAVE_QUADS && 0) { - } else if (TAG(emit_elt_verts)( ctx, start, count )) { + } else if (TAG(emit_elt_verts)( ctx, start, count )) { /* Hardware doesn't have a quad primitive type -- try to * simulate it using indexed vertices and the triangle - * primitive: + * primitive: */ LOCAL_VARS; int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); @@ -532,14 +534,14 @@ static void TAG(render_quads_verts)( GLcontext *ctx, EMIT_TWO_ELTS( 4, (i+2), (i+3) ); INCR_ELTS( 6 ); } - + NEW_PRIMITIVE(); } currentsz = dmasz; } - + RELEASE_ELT_VERTS(); - } + } else { /* Vertices won't fit in a single buffer, fallback. */ @@ -557,7 +559,7 @@ static void TAG(render_noop)( GLcontext *ctx, -static render_func TAG(render_tab_verts)[GL_POLYGON+2] = +static render_func TAG(render_tab_verts)[GL_POLYGON+2] = { TAG(render_points_verts), TAG(render_lines_verts), @@ -577,7 +579,7 @@ static render_func TAG(render_tab_verts)[GL_POLYGON+2] = * Render elts using hardware indexed verts * ****************************************************************************/ -#if (HAVE_ELTS) +#if (HAVE_ELTS) static void TAG(render_points_elts)( GLcontext *ctx, GLuint start, GLuint count, @@ -589,9 +591,9 @@ static void TAG(render_points_elts)( GLcontext *ctx, int currentsz; GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; GLuint j, nr; - + ELT_INIT( GL_POINTS ); - + currentsz = GET_CURRENT_VB_MAX_ELTS(); if (currentsz < 8) currentsz = dmasz; @@ -689,34 +691,34 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx, int currentsz; GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; GLuint j, nr; - + NEW_PRIMITIVE(); ELT_INIT( GL_LINE_STRIP ); - - if (flags & PRIM_BEGIN) + + if (flags & PRIM_BEGIN) j = start; else j = start + 1; - + currentsz = GET_CURRENT_VB_MAX_ELTS(); if (currentsz < 8) { FIRE_VERTICES(); currentsz = dmasz; } - + /* Ensure last vertex doesn't wrap: */ currentsz--; dmasz--; - + for ( ; j < count - 1; j += nr - 1 ) { nr = MIN2( currentsz, count - j ); /* NEW_PRIMITIVE(); */ TAG(emit_elts)( ctx, elts+j, nr ); currentsz = dmasz; } - - if (flags & PRIM_END) + + if (flags & PRIM_END) TAG(emit_elts)( ctx, elts+start, 1 ); NEW_PRIMITIVE(); @@ -744,7 +746,7 @@ static void TAG(render_triangles_elts)( GLcontext *ctx, NEW_PRIMITIVE(); ELT_INIT( GL_TRIANGLES ); - + currentsz = GET_CURRENT_VB_MAX_ELTS(); /* Emit whole number of tris in total. dmasz is already a multiple @@ -779,17 +781,17 @@ static void TAG(render_tri_strip_elts)( GLcontext *ctx, NEW_PRIMITIVE(); ELT_INIT( GL_TRIANGLE_STRIP ); - + currentsz = GET_CURRENT_VB_MAX_ELTS(); if (currentsz < 8) { FIRE_VERTICES(); currentsz = dmasz; } - + if (flags & PRIM_PARITY) { TAG(emit_elts)( ctx, elts+start, 1 ); } - + /* Keep the same winding over multiple buffers: */ dmasz -= (dmasz & 1); @@ -882,7 +884,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx, GLuint flags ) { if (HAVE_QUAD_STRIPS && 0) { - } + } else if (HAVE_TRI_STRIPS) { LOCAL_VARS; GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts; @@ -898,11 +900,11 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx, dmasz -= dmasz & 1; count -= (count-start) & 1; currentsz -= currentsz & 1; - + if (currentsz < 12) currentsz = dmasz; - if (ctx->_TriangleCaps & DD_FLATSHADE) { + if (ctx->_TriangleCaps & DD_FLATSHADE) { ELT_INIT( GL_TRIANGLES ); currentsz = currentsz/6*2; @@ -911,7 +913,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx, for (j = start; j < count - 3; j += nr - 2 ) { nr = MIN2( currentsz, count - j ); - if (nr >= 4) + if (nr >= 4) { GLint i; GLint quads = (nr/2)-1; @@ -920,20 +922,20 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx, NEW_PRIMITIVE(); ALLOC_ELTS_NEW_PRIMITIVE( quads*6 ); - + for ( i = 0 ; i < quads ; i++, elts += 2 ) { EMIT_TWO_ELTS( 0, elts[0], elts[1] ); EMIT_TWO_ELTS( 2, elts[2], elts[1] ); EMIT_TWO_ELTS( 4, elts[3], elts[2] ); INCR_ELTS( 6 ); } - + NEW_PRIMITIVE(); } currentsz = dmasz; } - } + } else { ELT_INIT( GL_TRIANGLE_STRIP ); @@ -981,7 +983,7 @@ static void TAG(render_quads_elts)( GLcontext *ctx, for (j = start; j < count - 3; j += nr - 2 ) { nr = MIN2( currentsz, count - j ); - if (nr >= 4) + if (nr >= 4) { GLint quads = nr/4; GLint i; @@ -1005,7 +1007,7 @@ static void TAG(render_quads_elts)( GLcontext *ctx, -static render_func TAG(render_tab_elts)[GL_POLYGON+2] = +static render_func TAG(render_tab_elts)[GL_POLYGON+2] = { TAG(render_points_elts), TAG(render_lines_elts), @@ -1020,4 +1022,3 @@ static render_func TAG(render_tab_elts)[GL_POLYGON+2] = TAG(render_noop), }; #endif - diff --git a/src/mesa/drivers/common/t_dd_rendertmp.h b/src/mesa/drivers/common/t_dd_rendertmp.h index 2524bf44b8d..b75643bb5f1 100644 --- a/src/mesa/drivers/common/t_dd_rendertmp.h +++ b/src/mesa/drivers/common/t_dd_rendertmp.h @@ -1,21 +1,21 @@ -/* $Id: t_dd_rendertmp.h,v 1.1 2001/02/16 18:14:42 keithw Exp $ */ +/* $Id: t_dd_rendertmp.h,v 1.2 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 - * - * Copyright (C) 1999 Brian Paul All Rights Reserved. - * + * + * Copyright (C) 1999-2001 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 @@ -23,7 +23,7 @@ * 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: + * Authors: * Keith Whitwell <[email protected]> */ @@ -33,13 +33,13 @@ #endif #ifndef INIT -#define INIT(x) +#define INIT(x) #endif #ifndef NEED_EDGEFLAG_SETUP #define NEED_EDGEFLAG_SETUP 0 #define EDGEFLAG_GET(a) 0 -#define EDGEFLAG_SET(a,b) (void)b +#define EDGEFLAG_SET(a,b) (void)b #endif #ifndef RESET_STIPPLE @@ -109,7 +109,7 @@ static void TAG(render_line_strip)( GLcontext *ctx, RESET_OCCLUSION; INIT(GL_LINE_STRIP); - for (j=start+1; j<count; j++ ) + for (j=start+1; j<count; j++ ) RENDER_LINE( ELT(j-1), ELT(j) ); if (TEST_PRIM_END(flags)) @@ -124,7 +124,7 @@ static void TAG(render_line_loop)( GLcontext *ctx, GLuint count, GLuint flags ) { - GLuint i; + GLuint i; LOCAL_VARS; (void) flags; @@ -186,10 +186,10 @@ static void TAG(render_tri_strip)( GLcontext *ctx, GLuint j; GLuint parity = 0; LOCAL_VARS; - + if (TEST_PRIM_PARITY(flags)) parity = 1; - + INIT(GL_TRIANGLE_STRIP); if (NEED_EDGEFLAG_SETUP) { for (j=start+2;j<count;j++,parity^=1) { @@ -273,13 +273,13 @@ static void TAG(render_poly)( GLcontext *ctx, /* If the primitive does not begin here, the first edge * is non-boundary. */ - if (!TEST_PRIM_BEGIN(flags)) + if (!TEST_PRIM_BEGIN(flags)) EDGEFLAG_SET( ELT(start), GL_FALSE ); /* If the primitive does not end here, the final edge is * non-boundary. */ - if (!TEST_PRIM_END(flags)) + if (!TEST_PRIM_END(flags)) EDGEFLAG_SET( ELT(count-1), GL_FALSE ); /* Draw the first triangles (possibly zero) @@ -290,7 +290,7 @@ static void TAG(render_poly)( GLcontext *ctx, RENDER_TRI( ELT(j-1), ELT(j), ELT(start) ); EDGEFLAG_SET( ELT(j), ef ); j++; - + /* Don't render the first edge again: */ EDGEFLAG_SET( ELT(start), GL_FALSE ); @@ -312,7 +312,7 @@ static void TAG(render_poly)( GLcontext *ctx, */ EDGEFLAG_SET( ELT(count-1), efcount ); EDGEFLAG_SET( ELT(start), efstart ); - + if (TEST_PRIM_END(flags)) { RESET_STIPPLE; } @@ -348,7 +348,7 @@ static void TAG(render_quads)( GLcontext *ctx, } } POSTFIX; -} +} static void TAG(render_quad_strip)( GLcontext *ctx, GLuint start, @@ -399,7 +399,7 @@ static void TAG(render_noop)( GLcontext *ctx, RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *, GLuint, GLuint, - GLuint) = + GLuint) = { TAG(render_points), TAG(render_lines), @@ -436,4 +436,3 @@ RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *, #undef PRESERVE_VB_DEFS #undef PRESERVE_TAG - diff --git a/src/mesa/drivers/common/t_dd_tritmp.h b/src/mesa/drivers/common/t_dd_tritmp.h index b3ab9f612f0..2a98b9fedf2 100644 --- a/src/mesa/drivers/common/t_dd_tritmp.h +++ b/src/mesa/drivers/common/t_dd_tritmp.h @@ -1,20 +1,22 @@ +/* $Id: t_dd_tritmp.h,v 1.6 2001/03/12 00:48:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 - * - * Copyright (C) 1999 Brian Paul All Rights Reserved. - * + * + * Copyright (C) 1999-2001 +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 @@ -22,19 +24,19 @@ * 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 <[email protected]> + * Authors: + * Keith Whitwell <[email protected]> */ /* Template for building functions to plug into the driver interface * of t_vb_render.c: - * ctx->Driver.QuadFunc - * ctx->Driver.TriangleFunc - * ctx->Driver.LineFunc - * ctx->Driver.PointsFunc + * ctx->Driver.QuadFunc + * ctx->Driver.TriangleFunc + * ctx->Driver.LineFunc + * ctx->Driver.PointsFunc * - * DO_TWOSIDE: Plug back-color values from the VB into backfacing triangles, + * DO_TWOSIDE: Plug back-color values from the VB into backfacing triangles, * and restore vertices afterwards. * DO_OFFSET: Calculate offset for triangles and adjust vertices. Restore * vertices after rendering. @@ -67,39 +69,39 @@ #if HAVE_RGBA #define VERT_SET_IND( v, c ) (void) c #define VERT_COPY_IND( v0, v1 ) -#define VERT_SAVE_IND( idx ) -#define VERT_RESTORE_IND( idx ) -#if HAVE_BACK_COLORS -#define VERT_SET_RGBA( v, c ) -#endif +#define VERT_SAVE_IND( idx ) +#define VERT_RESTORE_IND( idx ) +#if HAVE_BACK_COLORS +#define VERT_SET_RGBA( v, c ) +#endif #else #define VERT_SET_RGBA( v, c ) (void) c #define VERT_COPY_RGBA( v0, v1 ) -#define VERT_SAVE_RGBA( idx ) -#define VERT_RESTORE_RGBA( idx ) -#if HAVE_BACK_COLORS -#define VERT_SET_IND( v, c ) -#endif +#define VERT_SAVE_RGBA( idx ) +#define VERT_RESTORE_RGBA( idx ) +#if HAVE_BACK_COLORS +#define VERT_SET_IND( v, c ) +#endif #endif #if !HAVE_SPEC #define VERT_SET_SPEC( v, c ) (void) c #define VERT_COPY_SPEC( v0, v1 ) -#define VERT_SAVE_SPEC( idx ) -#define VERT_RESTORE_SPEC( idx ) +#define VERT_SAVE_SPEC( idx ) +#define VERT_RESTORE_SPEC( idx ) #if HAVE_BACK_COLORS #define VERT_COPY_SPEC1( v ) #endif #else #if HAVE_BACK_COLORS -#define VERT_SET_SPEC( v, c ) +#define VERT_SET_SPEC( v, c ) #endif #endif #if !HAVE_BACK_COLORS #define VERT_COPY_SPEC1( v ) #define VERT_COPY_IND1( v ) -#define VERT_COPY_RGBA1( v ) +#define VERT_COPY_RGBA1( v ) #endif #ifndef INSANE_VERTICES @@ -139,7 +141,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) if (DO_UNFILLED) { if (facing) { mode = ctx->Polygon.BackMode; - if (ctx->Polygon.CullFlag && + if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode != GL_FRONT) { return; } @@ -174,7 +176,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) VERT_SAVE_SPEC( 2 ); VERT_COPY_SPEC1( v[2] ); } - } + } else { GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data; ASSERT(VB->ColorPtr[1]->stride == 4*sizeof(GLchan)); @@ -185,17 +187,17 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) VERT_SET_RGBA( v[1], vbcolor[e1] ); } VERT_SET_RGBA( v[2], vbcolor[e2] ); - + if (HAVE_SPEC && VB->SecondaryColorPtr[1]) { GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; - + if (!DO_FLAT) { VERT_SET_SPEC( v[0], vbspec[e0] ); VERT_SET_SPEC( v[1], vbspec[e1] ); } VERT_SET_SPEC( v[2], vbspec[e2] ); } - } + } } else { GLuint *vbindex = VB->IndexPtr[1]->data; @@ -243,7 +245,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) VERT_COPY_SPEC( v[0], v[2] ); VERT_COPY_SPEC( v[1], v[2] ); } - } + } else { VERT_SAVE_IND( 0 ); VERT_SAVE_IND( 1 ); @@ -274,7 +276,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } if (DO_UNFILLED) RASTERIZE( GL_TRIANGLES ); - TRI( v[0], v[1], v[2] ); + TRI( v[0], v[1], v[2] ); } if (DO_OFFSET) @@ -296,22 +298,22 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) VERT_RESTORE_SPEC( 1 ); VERT_RESTORE_SPEC( 2 ); } - } + } else { GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data; ASSERT(VB->ColorPtr[0]->stride == 4*sizeof(GLchan)); (void) vbcolor; - + if (!DO_FLAT) { VERT_SET_RGBA( v[0], vbcolor[e0] ); VERT_SET_RGBA( v[1], vbcolor[e1] ); } VERT_SET_RGBA( v[2], vbcolor[e2] ); - + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { GLchan (*vbspec)[4] = VB->SecondaryColorPtr[0]->data; ASSERT(VB->SecondaryColorPtr[0]->stride == 4*sizeof(GLchan)); - + if (!DO_FLAT) { VERT_SET_SPEC( v[0], vbspec[e0] ); VERT_SET_SPEC( v[1], vbspec[e1] ); @@ -319,7 +321,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) VERT_SET_SPEC( v[2], vbspec[e2] ); } } - } + } else { GLuint *vbindex = VB->IndexPtr[0]->data; if (!DO_FLAT) { @@ -339,7 +341,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) VERT_RESTORE_SPEC( 0 ); VERT_RESTORE_SPEC( 1 ); } - } + } else { VERT_RESTORE_IND( 0 ); VERT_RESTORE_IND( 1 ); @@ -381,7 +383,7 @@ static void TAG(quad)( GLcontext *ctx, if (DO_UNFILLED) { if (facing) { mode = ctx->Polygon.BackMode; - if (ctx->Polygon.CullFlag && + if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode != GL_FRONT) { return; } @@ -399,7 +401,7 @@ static void TAG(quad)( GLcontext *ctx, if (HAVE_RGBA) { GLchan (*vbcolor)[4] = VB->ColorPtr[1]->data; (void)vbcolor; - + if (!DO_FLAT) { VERT_SET_RGBA( v[0], vbcolor[e0] ); VERT_SET_RGBA( v[1], vbcolor[e1] ); @@ -471,7 +473,7 @@ static void TAG(quad)( GLcontext *ctx, VERT_COPY_SPEC( v[1], v[3] ); VERT_COPY_SPEC( v[2], v[3] ); } - } + } else { VERT_SAVE_IND( 0 ); VERT_SAVE_IND( 1 ); @@ -506,7 +508,7 @@ static void TAG(quad)( GLcontext *ctx, VERT_Z_ADD(v[3], offset); } RASTERIZE( GL_TRIANGLES ); - QUAD( (v[0]), (v[1]), (v[2]), (v[3]) ); + QUAD( (v[0]), (v[1]), (v[2]), (v[3]) ); } if (DO_OFFSET) @@ -515,7 +517,7 @@ static void TAG(quad)( GLcontext *ctx, VERT_SET_Z(v[1], z[1]); VERT_SET_Z(v[2], z[2]); VERT_SET_Z(v[3], z[3]); - } + } if (DO_TWOSIDE && facing == 1) { @@ -523,18 +525,18 @@ static void TAG(quad)( GLcontext *ctx, GLchan (*vbcolor)[4] = VB->ColorPtr[0]->data; ASSERT(VB->ColorPtr[0]->stride == 4*sizeof(GLchan)); (void) vbcolor; - + if (!DO_FLAT) { VERT_SET_RGBA( v[0], vbcolor[e0] ); VERT_SET_RGBA( v[1], vbcolor[e1] ); VERT_SET_RGBA( v[2], vbcolor[e2] ); } VERT_SET_RGBA( v[3], vbcolor[e3] ); - + if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { GLchan (*vbspec)[4] = VB->SecondaryColorPtr[0]->data; ASSERT(VB->SecondaryColorPtr[0]->stride == 4*sizeof(GLchan)); - + if (!DO_FLAT) { VERT_SET_SPEC( v[0], vbspec[e0] ); VERT_SET_SPEC( v[1], vbspec[e1] ); @@ -542,7 +544,7 @@ static void TAG(quad)( GLcontext *ctx, } VERT_SET_SPEC( v[3], vbspec[e3] ); } - } + } else { GLuint *vbindex = VB->IndexPtr[0]->data; if (!DO_FLAT) { @@ -565,7 +567,7 @@ static void TAG(quad)( GLcontext *ctx, VERT_RESTORE_SPEC( 1 ); VERT_RESTORE_SPEC( 2 ); } - } + } else { VERT_RESTORE_IND( 0 ); VERT_RESTORE_IND( 1 ); @@ -573,7 +575,7 @@ static void TAG(quad)( GLcontext *ctx, } } } -#else +#else static void TAG(quad)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2, GLuint e3 ) { @@ -581,12 +583,12 @@ static void TAG(quad)( GLcontext *ctx, GLuint e0, struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLubyte ef1 = VB->EdgeFlag[e1]; GLubyte ef3 = VB->EdgeFlag[e3]; - VB->EdgeFlag[e1] = 0; + VB->EdgeFlag[e1] = 0; TAG(triangle)( ctx, e0, e1, e3 ); VB->EdgeFlag[e1] = ef1; - VB->EdgeFlag[e3] = 0; - TAG(triangle)( ctx, e1, e2, e3 ); - VB->EdgeFlag[e3] = ef3; + VB->EdgeFlag[e3] = 0; + TAG(triangle)( ctx, e1, e2, e3 ); + VB->EdgeFlag[e3] = ef3; } else { TAG(triangle)( ctx, e0, e1, e3 ); TAG(triangle)( ctx, e1, e2, e3 ); @@ -613,7 +615,7 @@ static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 ) VERT_SAVE_SPEC( 0 ); VERT_COPY_SPEC( v[0], v[1] ); } - } + } else { VERT_SAVE_IND( 0 ); VERT_COPY_IND( v[0], v[1] ); @@ -629,7 +631,7 @@ static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 ) if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { VERT_RESTORE_SPEC( 0 ); } - } + } else { VERT_RESTORE_IND( 0 ); } @@ -687,17 +689,17 @@ static void TAG(init)( void ) #undef VERT_COPY_IND #undef VERT_SAVE_IND #undef VERT_RESTORE_IND -#if HAVE_BACK_COLORS +#if HAVE_BACK_COLORS #undef VERT_SET_RGBA -#endif +#endif #else #undef VERT_SET_RGBA #undef VERT_COPY_RGBA #undef VERT_SAVE_RGBA #undef VERT_RESTORE_RGBA -#if HAVE_BACK_COLORS +#if HAVE_BACK_COLORS #undef VERT_SET_IND -#endif +#endif #endif #if !HAVE_SPEC @@ -724,4 +726,3 @@ static void TAG(init)( void ) #undef VERT_SET_Z #undef VERT_Z_ADD #endif - diff --git a/src/mesa/drivers/common/t_dd_unfilled.h b/src/mesa/drivers/common/t_dd_unfilled.h index 59c9bfdc5ab..08fc69f0a95 100644 --- a/src/mesa/drivers/common/t_dd_unfilled.h +++ b/src/mesa/drivers/common/t_dd_unfilled.h @@ -1,18 +1,47 @@ +/* $Id: t_dd_unfilled.h,v 1.3 2001/03/12 00:48:44 gareth Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 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 <[email protected]> + */ + #if HAVE_RGBA -#define VERT_SET_IND( v, c ) +#define VERT_SET_IND( v, c ) #define VERT_COPY_IND( v0, v1 ) -#define VERT_SAVE_IND( idx ) -#define VERT_RESTORE_IND( idx ) +#define VERT_SAVE_IND( idx ) +#define VERT_RESTORE_IND( idx ) #endif #if !HAVE_SPEC -#define VERT_SET_SPEC( v, c ) +#define VERT_SET_SPEC( v, c ) #define VERT_COPY_SPEC( v0, v1 ) -#define VERT_SAVE_SPEC( idx ) -#define VERT_RESTORE_SPEC( idx ) +#define VERT_SAVE_SPEC( idx ) +#define VERT_RESTORE_SPEC( idx ) #endif -static void TAG(unfilled_tri)( GLcontext *ctx, +static void TAG(unfilled_tri)( GLcontext *ctx, GLenum mode, GLuint e0, GLuint e1, GLuint e2 ) { @@ -31,7 +60,7 @@ static void TAG(unfilled_tri)( GLcontext *ctx, VERT_SAVE_RGBA(1); VERT_COPY_RGBA(v[0], v[2]); VERT_COPY_RGBA(v[1], v[2]); - + if (HAVE_SPEC) { VERT_SAVE_SPEC(0); VERT_SAVE_SPEC(1); @@ -48,21 +77,21 @@ static void TAG(unfilled_tri)( GLcontext *ctx, if (mode == GL_POINT) { RASTERIZE(GL_POINTS); - if (ef[e0]) POINT( v[0] ); - if (ef[e1]) POINT( v[1] ); - if (ef[e2]) POINT( v[2] ); + if (ef[e0]) POINT( v[0] ); + if (ef[e1]) POINT( v[1] ); + if (ef[e2]) POINT( v[2] ); } else { RASTERIZE(GL_LINES); if (RENDER_PRIMITIVE == GL_POLYGON) { - if (ef[e2]) LINE( v[2], v[0] ); - if (ef[e0]) LINE( v[0], v[1] ); - if (ef[e1]) LINE( v[1], v[2] ); - } + if (ef[e2]) LINE( v[2], v[0] ); + if (ef[e0]) LINE( v[0], v[1] ); + if (ef[e1]) LINE( v[1], v[2] ); + } else { - if (ef[e0]) LINE( v[0], v[1] ); - if (ef[e1]) LINE( v[1], v[2] ); - if (ef[e2]) LINE( v[2], v[0] ); + if (ef[e0]) LINE( v[0], v[1] ); + if (ef[e1]) LINE( v[1], v[2] ); + if (ef[e2]) LINE( v[2], v[0] ); } } @@ -70,7 +99,7 @@ static void TAG(unfilled_tri)( GLcontext *ctx, if (HAVE_RGBA) { VERT_RESTORE_RGBA(0); VERT_RESTORE_RGBA(1); - + if (HAVE_SPEC) { VERT_RESTORE_SPEC(0); VERT_RESTORE_SPEC(1); @@ -83,9 +112,9 @@ static void TAG(unfilled_tri)( GLcontext *ctx, } -static void TAG(unfilled_quad)( GLcontext *ctx, +static void TAG(unfilled_quad)( GLcontext *ctx, GLenum mode, - GLuint e0, GLuint e1, + GLuint e0, GLuint e1, GLuint e2, GLuint e3 ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; @@ -109,7 +138,7 @@ static void TAG(unfilled_quad)( GLcontext *ctx, VERT_COPY_RGBA(v[0], v[3]); VERT_COPY_RGBA(v[1], v[3]); VERT_COPY_RGBA(v[2], v[3]); - + if (HAVE_SPEC) { VERT_SAVE_SPEC(0); VERT_SAVE_SPEC(1); @@ -130,17 +159,17 @@ static void TAG(unfilled_quad)( GLcontext *ctx, if (mode == GL_POINT) { RASTERIZE(GL_POINTS); - if (ef[e0]) POINT( v[0] ); - if (ef[e1]) POINT( v[1] ); - if (ef[e2]) POINT( v[2] ); - if (ef[e3]) POINT( v[3] ); + if (ef[e0]) POINT( v[0] ); + if (ef[e1]) POINT( v[1] ); + if (ef[e2]) POINT( v[2] ); + if (ef[e3]) POINT( v[3] ); } else { RASTERIZE(GL_LINES); - if (ef[e0]) LINE( v[0], v[1] ); - if (ef[e1]) LINE( v[1], v[2] ); - if (ef[e2]) LINE( v[2], v[3] ); - if (ef[e3]) LINE( v[3], v[0] ); + if (ef[e0]) LINE( v[0], v[1] ); + if (ef[e1]) LINE( v[1], v[2] ); + if (ef[e2]) LINE( v[2], v[3] ); + if (ef[e3]) LINE( v[3], v[0] ); } if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) { @@ -148,7 +177,7 @@ static void TAG(unfilled_quad)( GLcontext *ctx, VERT_RESTORE_RGBA(0); VERT_RESTORE_RGBA(1); VERT_RESTORE_RGBA(2); - + if (HAVE_SPEC) { VERT_RESTORE_SPEC(0); VERT_RESTORE_SPEC(1); diff --git a/src/mesa/drivers/common/t_dd_vb.c b/src/mesa/drivers/common/t_dd_vb.c index 9d5277ee010..a5a9f53ab42 100644 --- a/src/mesa/drivers/common/t_dd_vb.c +++ b/src/mesa/drivers/common/t_dd_vb.c @@ -1,19 +1,21 @@ +/* $Id: t_dd_vb.c,v 1.6 2001/03/12 00:48:44 gareth Exp $ */ + /* * Mesa 3-D graphics library * Version: 3.5 - * - * Copyright (C) 1999 Brian Paul All Rights Reserved. - * + * + * Copyright (C) 1999-2001 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 @@ -21,8 +23,8 @@ * 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 <[email protected]> + * Authors: + * Keith Whitwell <[email protected]> */ #if (HAVE_HW_VIEWPORT) @@ -65,8 +67,8 @@ static void copy_pv_rgba3( GLcontext *ctx, GLuint edst, GLuint esrc ) } -void TAG(translate_vertex)(GLcontext *ctx, - const VERTEX *src, +void TAG(translate_vertex)(GLcontext *ctx, + const VERTEX *src, SWvertex *dst) { GLuint format = GET_VERTEX_FORMAT(); @@ -90,7 +92,7 @@ void TAG(translate_vertex)(GLcontext *ctx, dst->color[1] = src->tv.color.green; dst->color[2] = src->tv.color.blue; dst->color[3] = src->tv.color.alpha; - } + } else { GLfloat oow = (HAVE_HW_DIVIDE) ? 1.0 / src->v.w : src->v.w; @@ -121,10 +123,10 @@ void TAG(translate_vertex)(GLcontext *ctx, dst->specular[0] = src->v.specular.red; dst->specular[1] = src->v.specular.green; dst->specular[2] = src->v.specular.blue; - + dst->fog = src->v.color.alpha/255.0; - if (HAVE_PTEX_VERTICES && + if (HAVE_PTEX_VERTICES && ((HAVE_TEX2_VERTICES && format == PROJ_TEX3_VERTEX_FORMAT) || (format == PROJ_TEX1_VERTEX_FORMAT))) { @@ -175,7 +177,7 @@ void TAG(translate_vertex)(GLcontext *ctx, } #if 0 -static void +static void mga_translate_vertex( GLcontext *ctx, const mgaVertex *src, SWvertex *dst) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); @@ -184,7 +186,7 @@ mga_translate_vertex( GLcontext *ctx, const mgaVertex *src, SWvertex *dst) dst->win[1] = - src->v.y + mmesa->driDrawable->h + mmesa->drawY + SUBPIXEL_Y; dst->win[2] = src->v.z / mmesa->depth_scale; dst->win[3] = src->v.oow; - + dst->color[0] = src->v.color.red; dst->color[1] = src->v.color.green; dst->color[2] = src->v.color.blue; @@ -215,22 +217,22 @@ void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v ) if (format == TINY_VERTEX_FORMAT) { fprintf(stderr, "x %f y %f z %f\n", v->v.x, v->v.y, v->v.z); - fprintf(stderr, "r %d g %d b %d a %d\n", + fprintf(stderr, "r %d g %d b %d a %d\n", v->tv.color.red, v->tv.color.green, v->tv.color.blue, v->tv.color.alpha); - } + } else { - fprintf(stderr, "x %f y %f z %f oow %f\n", + fprintf(stderr, "x %f y %f z %f oow %f\n", v->v.x, v->v.y, v->v.z, v->v.w); - fprintf(stderr, "r %d g %d b %d a %d\n", + fprintf(stderr, "r %d g %d b %d a %d\n", v->v.color.red, v->v.color.green, v->v.color.blue, v->v.color.alpha); } - + fprintf(stderr, "\n"); } diff --git a/src/mesa/drivers/common/t_dd_vbtmp.h b/src/mesa/drivers/common/t_dd_vbtmp.h index 2e9a7ec9bcc..4b87fe6a321 100644 --- a/src/mesa/drivers/common/t_dd_vbtmp.h +++ b/src/mesa/drivers/common/t_dd_vbtmp.h @@ -1,19 +1,21 @@ +/* $Id: t_dd_vbtmp.h,v 1.8 2001/03/12 00:48:44 gareth Exp $ */ + /* * Mesa 3-D graphics library * Version: 3.5 - * - * Copyright (C) 1999 Brian Paul All Rights Reserved. - * + * + * Copyright (C) 1999-2001 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 @@ -21,8 +23,8 @@ * 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 <[email protected]> + * Authors: + * Keith Whitwell <[email protected]> */ @@ -58,7 +60,7 @@ * unsigned int ui[16]; * unsigned char ub4[4][16]; * } - * + * * DO_XYZW: Emit xyz and maybe w coordinates. * DO_RGBA: Emit color. @@ -74,7 +76,7 @@ * * HAVE_HW_VIEWPORT: Hardware performs viewport transform. * HAVE_HW_DIVIDE: Hardware performs perspective divide. - * + * * HAVE_TINY_VERTICES: Hardware understands v.tv format. * HAVE_PTEX_VERTICES: Hardware understands v.pv format. * HAVE_NOTEX_VERTICES: Hardware understands v.v format with texcount 0. @@ -186,7 +188,7 @@ static void TAG(emit)( GLcontext *ctx, if (VB->TexCoordPtr[t0]) { tc0_stride = VB->TexCoordPtr[t0]->stride; tc0 = VB->TexCoordPtr[t0]->data; - if (DO_PTEX) + if (DO_PTEX) tc0_size = VB->TexCoordPtr[t0]->size; } else { @@ -228,21 +230,21 @@ static void TAG(emit)( GLcontext *ctx, if (DO_TEX3) if (tc3) tc3 = (GLfloat (*)[4])((GLubyte *)tc3 + start * tc3_stride); - if (DO_RGBA) + if (DO_RGBA) STRIDE_4UB(col, start * col_stride); - if (DO_SPEC) + if (DO_SPEC) STRIDE_4UB(spec, start * spec_stride); - if (DO_FOG) + if (DO_FOG) STRIDE_F(fog, start * fog_stride); } for (i=start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) { if (DO_XYZW) { if (HAVE_HW_VIEWPORT || mask[i] == 0) { - VIEWPORT_X(v->v.x, coord[0][0]); - VIEWPORT_Y(v->v.y, coord[0][1]); - VIEWPORT_Z(v->v.z, coord[0][2]); - v->v.w = coord[0][3]; + VIEWPORT_X(v->v.x, coord[0][0]); + VIEWPORT_Y(v->v.y, coord[0][1]); + VIEWPORT_Z(v->v.z, coord[0][2]); + v->v.w = coord[0][3]; } coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride); } @@ -274,18 +276,18 @@ static void TAG(emit)( GLcontext *ctx, v->v.v0 = tc0[0][1]; if (DO_PTEX) { if (HAVE_PTEX_VERTICES) { - if (tc0_size == 4) + if (tc0_size == 4) v->pv.q0 = tc0[0][3]; else v->pv.q0 = 1.0; - } + } else if (tc0_size == 4) { float rhw = 1.0 / tc0[0][3]; v->v.w *= tc0[0][3]; v->v.u0 *= rhw; v->v.v0 *= rhw; - } - } + } + } tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride); } } @@ -294,18 +296,18 @@ static void TAG(emit)( GLcontext *ctx, if (DO_PTEX) { v->pv.u1 = tc1[0][0]; v->pv.v1 = tc1[0][1]; - if (tc1_size == 4) + if (tc1_size == 4) v->pv.q1 = tc1[0][3]; else v->pv.q1 = 1.0; - } + } else { v->v.u1 = tc1[0][0]; v->v.v1 = tc1[0][1]; } tc1 = (GLfloat (*)[4])((GLubyte *)tc1 + tc1_stride); } - } + } else if (DO_PTEX) { *(GLuint *)&v->pv.q1 = 0; /* avoid culling on radeon */ } @@ -314,45 +316,45 @@ static void TAG(emit)( GLcontext *ctx, if (DO_PTEX) { v->pv.u2 = tc2[0][0]; v->pv.v2 = tc2[0][1]; - if (tc2_size == 4) + if (tc2_size == 4) v->pv.q2 = tc2[0][3]; else v->pv.q2 = 1.0; - } + } else { v->v.u2 = tc2[0][0]; v->v.v2 = tc2[0][1]; } tc2 = (GLfloat (*)[4])((GLubyte *)tc2 + tc2_stride); } - } + } if (DO_TEX3) { if (tc3) { if (DO_PTEX) { v->pv.u3 = tc3[0][0]; v->pv.v3 = tc3[0][1]; - if (tc3_size == 4) + if (tc3_size == 4) v->pv.q3 = tc3[0][3]; else v->pv.q3 = 1.0; - } + } else { v->v.u3 = tc3[0][0]; v->v.v3 = tc3[0][1]; } tc3 = (GLfloat (*)[4])((GLubyte *)tc3 + tc3_stride); } - } + } } } else { for (i=start; i < end; i++, v = (VERTEX *)((GLubyte *)v + stride)) { if (DO_XYZW) { if (HAVE_HW_VIEWPORT || mask[i] == 0) { - VIEWPORT_X(v->v.x, coord[i][0]); - VIEWPORT_Y(v->v.y, coord[i][1]); - VIEWPORT_Z(v->v.z, coord[i][2]); - v->v.w = coord[i][3]; + VIEWPORT_X(v->v.x, coord[i][0]); + VIEWPORT_Y(v->v.y, coord[i][1]); + VIEWPORT_Z(v->v.z, coord[i][2]); + v->v.w = coord[i][3]; } } if (DO_RGBA) { @@ -380,20 +382,20 @@ static void TAG(emit)( GLcontext *ctx, v->pv.u0 = tc0[i][0]; v->pv.v0 = tc0[i][1]; if (HAVE_PTEX_VERTICES) { - if (tc0_size == 4) + if (tc0_size == 4) v->pv.q0 = tc0[i][3]; else v->pv.q0 = 1.0; v->pv.q1 = 0; /* radeon */ - } + } else if (tc0_size == 4) { float rhw = 1.0 / tc0[i][3]; v->v.w *= tc0[i][3]; v->v.u0 *= rhw; v->v.v0 *= rhw; - } - } + } + } else { v->v.u0 = tc0[i][0]; v->v.v0 = tc0[i][1]; @@ -405,11 +407,11 @@ static void TAG(emit)( GLcontext *ctx, if (DO_PTEX) { v->pv.u1 = tc1[i][0]; v->pv.v1 = tc1[i][1]; - if (tc1_size == 4) + if (tc1_size == 4) v->pv.q1 = tc1[i][3]; else v->pv.q1 = 1.0; - } + } else { v->v.u1 = tc1[i][0]; v->v.v1 = tc1[i][1]; @@ -419,7 +421,7 @@ static void TAG(emit)( GLcontext *ctx, } } } -#else +#else #if DO_XYZW #if HAVE_HW_DIVIDE @@ -432,7 +434,7 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; GLubyte (*col)[4] = VB->ColorPtr[0]->data; GLuint col_stride = VB->ColorPtr[0]->stride; - GLfloat (*coord)[4] = VB->ProjectedClipPtr->data; + GLfloat (*coord)[4] = VB->ProjectedClipPtr->data; GLuint coord_stride = VB->ProjectedClipPtr->stride; GLfloat *v = (GLfloat *)dest; const GLubyte *mask = VB->ClipMask; @@ -444,7 +446,7 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, ASSERT(stride == 4); /* Pack what's left into a 4-dword vertex. Color is in a different - * place, and there is no 'w' coordinate. + * place, and there is no 'w' coordinate. */ if (VB->importable_data) { if (start) { @@ -454,15 +456,15 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, for (i=start; i < end; i++, v+=4) { if (HAVE_HW_VIEWPORT || mask[i] == 0) { - VIEWPORT_X(v[0], coord[0][0]); - VIEWPORT_Y(v[1], coord[0][1]); - VIEWPORT_Z(v[2], coord[0][2]); + VIEWPORT_X(v[0], coord[0][0]); + VIEWPORT_Y(v[1], coord[0][1]); + VIEWPORT_Z(v[2], coord[0][2]); } coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride); if (DO_RGBA) { if (HAVE_RGBA_COLOR) { *(GLuint *)&v[3] = *(GLuint *)col; - } + } else { GLubyte *b = (GLubyte *)&v[3]; b[0] = col[0][2]; @@ -477,9 +479,9 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, else { for (i=start; i < end; i++, v+=4) { if (HAVE_HW_VIEWPORT || mask[i] == 0) { - VIEWPORT_X(v[0], coord[i][0]); - VIEWPORT_Y(v[1], coord[i][1]); - VIEWPORT_Z(v[2], coord[i][2]); + VIEWPORT_X(v[0], coord[i][0]); + VIEWPORT_Y(v[1], coord[i][1]); + VIEWPORT_Z(v[2], coord[i][2]); } if (DO_RGBA) { if (HAVE_RGBA_COLOR) { @@ -551,13 +553,13 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) if (DO_PTEX) return GL_TRUE; - + if ((DO_TEX3 && VB->TexCoordPtr[3]->size == 4) || (DO_TEX2 && VB->TexCoordPtr[2]->size == 4) || (DO_TEX1 && VB->TexCoordPtr[1]->size == 4) || (DO_TEX0 && VB->TexCoordPtr[0]->size == 4)) return GL_FALSE; - + return GL_TRUE; } #else @@ -574,11 +576,11 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) if (DO_TEX1 && VB->TexCoordPtr[0] == 0) VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; - if (DO_PTEX) + if (DO_PTEX) return GL_TRUE; - + /* No hardware support for projective texture. Can fake it for - * TEX0 only. + * TEX0 only. */ if ((DO_TEX3 && VB->TexCoordPtr[3]->size == 4) || (DO_TEX2 && VB->TexCoordPtr[2]->size == 4) || @@ -600,7 +602,7 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) static void TAG(interp)( GLcontext *ctx, - GLfloat t, + GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary ) { @@ -617,25 +619,25 @@ static void TAG(interp)( GLcontext *ctx, (void)s; - + if (!HAVE_HW_DIVIDE) { w = 1.0 / dstclip[3]; - VIEWPORT_X( dst->v.x, dstclip[0] * w ); - VIEWPORT_Y( dst->v.y, dstclip[1] * w ); - VIEWPORT_Z( dst->v.z, dstclip[2] * w ); - } + VIEWPORT_X( dst->v.x, dstclip[0] * w ); + VIEWPORT_Y( dst->v.y, dstclip[1] * w ); + VIEWPORT_Z( dst->v.z, dstclip[2] * w ); + } else { - VIEWPORT_X( dst->v.x, dstclip[0] ); - VIEWPORT_Y( dst->v.y, dstclip[1] ); - VIEWPORT_Z( dst->v.z, dstclip[2] ); - w = dstclip[3]; + VIEWPORT_X( dst->v.x, dstclip[0] ); + VIEWPORT_Y( dst->v.y, dstclip[1] ); + VIEWPORT_Z( dst->v.z, dstclip[2] ); + w = dstclip[3]; } - if (HAVE_HW_DIVIDE || DO_FOG || DO_SPEC || DO_TEX0 || DO_TEX1 || + if (HAVE_HW_DIVIDE || DO_FOG || DO_SPEC || DO_TEX0 || DO_TEX1 || DO_TEX2 || DO_TEX3) { - dst->v.w = w; - + dst->v.w = w; + INTERP_UB( t, dst->ub4[4][0], out->ub4[4][0], in->ub4[4][0] ); INTERP_UB( t, dst->ub4[4][1], out->ub4[4][1], in->ub4[4][1] ); INTERP_UB( t, dst->ub4[4][2], out->ub4[4][2], in->ub4[4][2] ); @@ -663,17 +665,17 @@ static void TAG(interp)( GLcontext *ctx, GLfloat qdst, rqdst; ASSERT( !HAVE_HW_DIVIDE ); - + INTERP_F( t, dst->v.u0, out->v.u0 * qout, in->v.u0 * qin ); INTERP_F( t, dst->v.v0, out->v.v0 * qout, in->v.v0 * qin ); INTERP_F( t, qdst, qout, qin ); - + rqdst = 1.0 / qdst; dst->v.u0 *= rqdst; dst->v.v0 *= rqdst; dst->v.w *= rqdst; } - } + } else { INTERP_F( t, dst->v.u0, out->v.u0, in->v.u0 ); INTERP_F( t, dst->v.v0, out->v.v0, in->v.v0 ); @@ -728,12 +730,12 @@ static void TAG(interp)( GLcontext *ctx, static void TAG(init)( void ) { setup_tab[IND].emit = TAG(emit); - + #if (DO_XYZW && DO_RGBA) setup_tab[IND].check_tex_sizes = TAG(check_tex_sizes); setup_tab[IND].interp = TAG(interp); #endif - + if (DO_SPEC) setup_tab[IND].copy_pv = copy_pv_rgba4_spec5; else if (HAVE_HW_DIVIDE || DO_SPEC || DO_FOG || DO_TEX0 || DO_TEX1 || @@ -747,55 +749,55 @@ static void TAG(init)( void ) ASSERT(HAVE_PTEX_VERTICES); setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT; setup_tab[IND].vertex_size = 18; - setup_tab[IND].vertex_stride_shift = 7; + setup_tab[IND].vertex_stride_shift = 7; } else { setup_tab[IND].vertex_format = TEX3_VERTEX_FORMAT; setup_tab[IND].vertex_size = 14; - setup_tab[IND].vertex_stride_shift = 6; + setup_tab[IND].vertex_stride_shift = 6; } - } + } else if (DO_TEX2) { if (DO_PTEX) { ASSERT(HAVE_PTEX_VERTICES); setup_tab[IND].vertex_format = PROJ_TEX3_VERTEX_FORMAT; setup_tab[IND].vertex_size = 18; - setup_tab[IND].vertex_stride_shift = 7; + setup_tab[IND].vertex_stride_shift = 7; } else { setup_tab[IND].vertex_format = TEX2_VERTEX_FORMAT; setup_tab[IND].vertex_size = 12; - setup_tab[IND].vertex_stride_shift = 6; + setup_tab[IND].vertex_stride_shift = 6; } - } + } else if (DO_TEX1) { if (DO_PTEX) { ASSERT(HAVE_PTEX_VERTICES); setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT; setup_tab[IND].vertex_size = 12; - setup_tab[IND].vertex_stride_shift = 6; + setup_tab[IND].vertex_stride_shift = 6; } else { setup_tab[IND].vertex_format = TEX1_VERTEX_FORMAT; setup_tab[IND].vertex_size = 10; - setup_tab[IND].vertex_stride_shift = 6; + setup_tab[IND].vertex_stride_shift = 6; } - } + } else if (DO_TEX0) { if (DO_PTEX && HAVE_PTEX_VERTICES) { setup_tab[IND].vertex_format = PROJ_TEX1_VERTEX_FORMAT; setup_tab[IND].vertex_size = 12; - setup_tab[IND].vertex_stride_shift = 6; + setup_tab[IND].vertex_stride_shift = 6; } else { setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT; setup_tab[IND].vertex_size = 8; - setup_tab[IND].vertex_stride_shift = 5; + setup_tab[IND].vertex_stride_shift = 5; } } else if (!HAVE_HW_DIVIDE && !DO_SPEC && !DO_FOG && HAVE_TINY_VERTICES) { setup_tab[IND].vertex_format = TINY_VERTEX_FORMAT; setup_tab[IND].vertex_size = 4; - setup_tab[IND].vertex_stride_shift = 4; + setup_tab[IND].vertex_stride_shift = 4; } else if (HAVE_NOTEX_VERTICES) { setup_tab[IND].vertex_format = NOTEX_VERTEX_FORMAT; setup_tab[IND].vertex_size = 6; @@ -803,7 +805,7 @@ static void TAG(init)( void ) } else { setup_tab[IND].vertex_format = TEX0_VERTEX_FORMAT; setup_tab[IND].vertex_size = 8; - setup_tab[IND].vertex_stride_shift = 5; + setup_tab[IND].vertex_stride_shift = 5; } assert(setup_tab[IND].vertex_size * 4 <= diff --git a/src/mesa/drivers/common/t_dd_vertex.h b/src/mesa/drivers/common/t_dd_vertex.h index 61c69b87191..10a06ff2212 100644 --- a/src/mesa/drivers/common/t_dd_vertex.h +++ b/src/mesa/drivers/common/t_dd_vertex.h @@ -1,8 +1,10 @@ +/* $Id: t_dd_vertex.h,v 1.5 2001/03/12 00:48:44 gareth Exp $ */ + /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -21,8 +23,8 @@ * 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 <[email protected]> + * Authors: + * Keith Whitwell <[email protected]> */ #ifdef COLOR_IS_RGBA |