diff options
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/Imakefile | 26 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgabuffers.c | 1 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h | 21 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgaioctl.c | 2 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgaioctl.h | 32 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgalib.h | 1 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgaspan.c | 1 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgatex.c | 1 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgatris.c | 1 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgatris.h | 75 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgatritmp.h | 166 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgavb.c | 40 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgavb.h | 20 |
13 files changed, 218 insertions, 169 deletions
diff --git a/xc/lib/GL/mesa/src/drv/mga/Imakefile b/xc/lib/GL/mesa/src/drv/mga/Imakefile index 3eec12d29..f01632491 100644 --- a/xc/lib/GL/mesa/src/drv/mga/Imakefile +++ b/xc/lib/GL/mesa/src/drv/mga/Imakefile @@ -45,13 +45,6 @@ MESA_INCLUDES = -I. -I.. -I../../include DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFS) INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) -#if 0 - LOSRC = ../../../../lowpc.c - LOOBJ = ../../../../lowpc.o - - HISRC = ../../../../highpc.c - HIOBJ = ../../../../highpc.o -#endif DRISRCS = ../../../dri/dri_mesa.c \ ../../../../dri/dri_tmm.c @@ -275,14 +268,23 @@ MESA_INCLUDES = -I. -I.. -I../../include #endif #endif +#ifdef GlxSoProf + HIOBJS = ../../../../highpc.o + LOOBJS = ../../../../lowpc.o + HISRCS = ../../../../highpc.c + LOSRCS = ../../../../lowpc.c +#endif + ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) COMMONSRCS = ../common/mm.c ../common/hwlog.c COMMONOBJS = ../common/mm.o ../common/hwlog.o - SRCS = $(LOWSRC) $(DRISRCS) $(DRMSRCS) $(MESASRCS) $(ASMSRCS) $(COMMONSRCS) $(MGASRCS) $(HISRC) - OBJS = $(LOWOBJ) $(DRIOBJS) $(DRMOBJS) $(MESAOBJS) $(ASMOBJS) $(COMMONOBJS) $(MGAOBJS) $(HIOBJ) + SRCS = $(LOSRCS) $(DRISRCS) $(DRMSRCS) $(MESASRCS) $(ASMSRCS) \ + $(COMMONSRCS) $(MGASRCS) $(HISRCS) + OBJS = $(LOOBJS) $(DRIOBJS) $(DRMOBJS) $(MESAOBJS) $(ASMOBJS) \ + $(COMMONOBJS) $(MGAOBJS) $(HIOBJS) REQUIREDLIBS += -lm #if !GlxBuiltInMga @@ -310,6 +312,12 @@ ALL_OBJS = $(OBJS) ALL_DEPS = DONE SharedDepModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) + +#ifdef GlxSoProf +SOPROF_LIBNAME = _mga_dri_p +NormalDepLibraryTarget($(SOPROF_LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) +InstallLibrary($(SOPROF_LIBNAME),$(MODULEDIR)/dri) +#endif #endif DependTarget() diff --git a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c index 851d66032..0431361d2 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgabuffers.c @@ -37,6 +37,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mgalib.h" #include "mgabuffers.h" #include "mgastate.h" +#include "mgaioctl.h" static void mgaXMesaSetFrontClipRects( mgaContextPtr mmesa ) { diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h b/xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h index ce758a532..19c913f5a 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgaelttmp.h @@ -83,8 +83,6 @@ static void TAG(emit_unclipped_verts)( struct vertex_buffer *VB ) } if (TYPE & MGA_TEX0_BIT) { -/* fprintf(stderr, "i %d tex0 %f, %f\n", i, */ -/* tex0_data[0], tex0_data[1]); */ *(int*)&f[6] = *(int*)&tex0_data[0]; *(int*)&f[7] = *(int*)&tex0_data[1]; } @@ -127,19 +125,9 @@ static void TAG(build_tri_verts)( mgaContextPtr mmesa, if (TYPE & MGA_RGBA_BIT) { GLubyte *col = VEC_ELT(VB->ColorPtr, GLubyte, elt[i]); - GLubyte *b = (GLubyte *)&O[4]; - b[CLIP_UBYTE_R] = col[0]; - b[CLIP_UBYTE_G] = col[1]; - b[CLIP_UBYTE_B] = col[2]; - b[CLIP_UBYTE_A] = col[3]; + *(GLuint *)&O[4] = *(GLuint *)col; } - if (0) - fprintf(stderr, - "build_tri_vert elt[%d]: %d phys: %x (first_phys %x elt_buf %x\n", - i, elt[i], UNCLIPPED_VERT(elt[i]), - mmesa->first_vert_phys, (GLuint)mmesa->elt_buf); - *(GLuint *)&O[5] = UNCLIPPED_VERT(elt[i]); if (TYPE & MGA_TEX0_BIT) { @@ -176,8 +164,6 @@ static void TAG(interp)( GLfloat t, ((GLubyte *)&(J[4]))); } - if (0) fprintf(stderr, "setting 0x%x to ~0\n", (GLuint)&O[5]); - *(GLuint *)&O[5] = ~0; /* note that this is a new vertex */ if (TYPE & MGA_TEX0_BIT) { @@ -215,10 +201,6 @@ static void TAG(project_and_emit_verts)( mgaContextPtr mmesa, const GLfloat *I = &verts[elt[i] * CLIP_STRIDE]; GLuint tmp = *(GLuint *)&I[5]; - if (0) fprintf(stderr, "elt[%d] (tmp 0x%x %d) %d --> ", i, (GLuint)&I[5], - tmp, elt[i]); - - if ((elt[i] = tmp) == ~0) { GLfloat oow = 1.0/I[3]; @@ -247,7 +229,6 @@ static void TAG(project_and_emit_verts)( mgaContextPtr mmesa, O -= BUFFER_STRIDE; } - if (0) fprintf(stderr, "0x%x\n", elt[i]); } mmesa->next_vert = O; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c index edacb9115..a1875d85d 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c @@ -80,7 +80,7 @@ int mgaUpdateLock( mgaContextPtr mmesa, drmLockFlags flags ) return 0; } -static drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ) +drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ) { int idx = 0; int size = 0; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h index 900e4a4f8..96be18ee1 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h @@ -2,6 +2,7 @@ #define MGA_IOCTL_H #include "mgalib.h" +#include "mga_xmesa.h" GLbitfield mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint cx, GLint cy, GLint cw, GLint ch ); @@ -54,5 +55,36 @@ void mgaDDInitIoctlFuncs( GLcontext *ctx ); else if (mmesa->next_elt != mmesa->first_elt) mgaFlushElts(mmesa); \ } while (0) +extern drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ); + +static __inline +mgaUI32 *mgaAllocVertexDwordsInline( mgaContextPtr mmesa, int dwords ) +{ + int bytes = dwords * 4; + mgaUI32 *head; + + if (!mmesa->vertex_dma_buffer) { + LOCK_HARDWARE( mmesa ); + + if (mmesa->first_elt != mmesa->next_elt) + mgaFlushEltsLocked(mmesa); + + mmesa->vertex_dma_buffer = mga_get_buffer_ioctl( mmesa ); + UNLOCK_HARDWARE( mmesa ); + } else if (mmesa->vertex_dma_buffer->used + bytes > + mmesa->vertex_dma_buffer->total) { + LOCK_HARDWARE( mmesa ); + mgaFlushVerticesLocked( mmesa ); + mmesa->vertex_dma_buffer = mga_get_buffer_ioctl( mmesa ); + UNLOCK_HARDWARE( mmesa ); + } + + head = (mgaUI32 *)((char *)mmesa->vertex_dma_buffer->address + + mmesa->vertex_dma_buffer->used); + + mmesa->vertex_dma_buffer->used += bytes; + return head; +} + #endif diff --git a/xc/lib/GL/mesa/src/drv/mga/mgalib.h b/xc/lib/GL/mesa/src/drv/mga/mgalib.h index be843ba8f..1f8c64909 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgalib.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgalib.h @@ -39,7 +39,6 @@ #include "mgacommon.h" #include "mm.h" #include "mgalog.h" -#include "mgaioctl.h" #include "mgatex.h" #include "mgavb.h" diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c index 4b0bd9ee0..25553bcff 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c @@ -3,6 +3,7 @@ #include "mgalib.h" #include "mgalog.h" #include "mgaspan.h" +#include "mgaioctl.h" #define DBG 0 diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.c b/xc/lib/GL/mesa/src/drv/mga/mgatex.c index ebd9ce486..b095807fd 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatex.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatex.c @@ -37,6 +37,7 @@ #include "mgatex.h" #include "mgalog.h" #include "mgaregs.h" +#include "mgaioctl.h" #include "simple_list.h" diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.c b/xc/lib/GL/mesa/src/drv/mga/mgatris.c index 4f5ff299b..2942cec7e 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatris.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.c @@ -108,6 +108,7 @@ static void mgaPrintRenderState( const char *msg, GLuint state ) #define TAG(x) x##_twoside_offset_flat #include "mgatritmp.h" + void mgaDDTrifuncInit() { int i; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatris.h b/xc/lib/GL/mesa/src/drv/mga/mgatris.h index 8d340e3ad..bbebbc400 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatris.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgatris.h @@ -28,6 +28,7 @@ #define MGATIS_INC #include "types.h" +#include "mgaioctl.h" extern void mgaDDChooseRenderState(GLcontext *ctx); extern void mgaDDTrifuncInit( void ); @@ -48,9 +49,28 @@ static __inline void mga_draw_triangle( mgaContextPtr mmesa, mgaVertex *v2 ) { mgaUI32 vertsize = mmesa->vertsize; - mgaUI32 *wv = mgaAllocVertexDwords( mmesa, 3 * vertsize ); + mgaUI32 *wv = mgaAllocVertexDwordsInline( mmesa, 3 * vertsize ); int j; +#if defined (USE_X86_ASM) + /* GTH: We can safely assume the vertex stride is some number of + * dwords, and thus a "rep movsd" is okay. The vb pointer is + * automagically updated with this instruction, so we don't have + * to manually take care of incrementing it. + */ + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "D" ((long)wv), "S" ((long)v0) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)v1) + : "memory" ); + __asm__ __volatile__( "rep ; movsl" + : "=%c" (j) + : "0" (vertsize), "S" ((long)v2) + : "memory" ); +#else for (j = 0 ; j < vertsize ; j++) wv[j] = v0->ui[j]; @@ -61,6 +81,7 @@ static __inline void mga_draw_triangle( mgaContextPtr mmesa, wv += vertsize; for (j = 0 ; j < vertsize ; j++) wv[j] = v2->ui[j]; +#endif } @@ -71,38 +92,38 @@ static __inline void mga_draw_point( mgaContextPtr mmesa, mgaUI32 *wv = mgaAllocVertexDwords( mmesa, 6*vertsize); int j; - *(float *)&wv[0] = tmp->warp1.x - sz; - *(float *)&wv[1] = tmp->warp1.y - sz; + *(float *)&wv[0] = tmp->v.x - sz; + *(float *)&wv[1] = tmp->v.y - sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp->warp1.x + sz; - *(float *)&wv[1] = tmp->warp1.y - sz; + *(float *)&wv[0] = tmp->v.x + sz; + *(float *)&wv[1] = tmp->v.y - sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp->warp1.x + sz; - *(float *)&wv[1] = tmp->warp1.y + sz; + *(float *)&wv[0] = tmp->v.x + sz; + *(float *)&wv[1] = tmp->v.y + sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp->warp1.x + sz; - *(float *)&wv[1] = tmp->warp1.y + sz; + *(float *)&wv[0] = tmp->v.x + sz; + *(float *)&wv[1] = tmp->v.y + sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp->warp1.x - sz; - *(float *)&wv[1] = tmp->warp1.y + sz; + *(float *)&wv[0] = tmp->v.x - sz; + *(float *)&wv[1] = tmp->v.y + sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp->warp1.x - sz; - *(float *)&wv[1] = tmp->warp1.y - sz; + *(float *)&wv[0] = tmp->v.x - sz; + *(float *)&wv[1] = tmp->v.y - sz; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp->ui[j]; } @@ -118,8 +139,8 @@ static __inline void mga_draw_line( mgaContextPtr mmesa, float dx, dy, ix, iy; int j; - dx = tmp0->warp1.x - tmp1->warp1.x; - dy = tmp0->warp1.y - tmp1->warp1.y; + dx = tmp0->v.x - tmp1->v.x; + dy = tmp0->v.y - tmp1->v.y; ix = width * .5; iy = 0; @@ -130,38 +151,38 @@ static __inline void mga_draw_line( mgaContextPtr mmesa, iy = ix; ix = 0; } - *(float *)&wv[0] = tmp0->warp1.x - ix; - *(float *)&wv[1] = tmp0->warp1.y - iy; + *(float *)&wv[0] = tmp0->v.x - ix; + *(float *)&wv[1] = tmp0->v.y - iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp0->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp1->warp1.x + ix; - *(float *)&wv[1] = tmp1->warp1.y + iy; + *(float *)&wv[0] = tmp1->v.x + ix; + *(float *)&wv[1] = tmp1->v.y + iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp1->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp0->warp1.x + ix; - *(float *)&wv[1] = tmp0->warp1.y + iy; + *(float *)&wv[0] = tmp0->v.x + ix; + *(float *)&wv[1] = tmp0->v.y + iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp0->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp0->warp1.x - ix; - *(float *)&wv[1] = tmp0->warp1.y - iy; + *(float *)&wv[0] = tmp0->v.x - ix; + *(float *)&wv[1] = tmp0->v.y - iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp0->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp1->warp1.x - ix; - *(float *)&wv[1] = tmp1->warp1.y - iy; + *(float *)&wv[0] = tmp1->v.x - ix; + *(float *)&wv[1] = tmp1->v.y - iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp1->ui[j]; wv += vertsize; - *(float *)&wv[0] = tmp1->warp1.x + ix; - *(float *)&wv[1] = tmp1->warp1.y + iy; + *(float *)&wv[0] = tmp1->v.x + ix; + *(float *)&wv[1] = tmp1->v.y + iy; for (j = 2 ; j < vertsize ; j++) wv[j] = tmp1->ui[j]; wv += vertsize; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h b/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h index cc2b8a359..c1b81aa4d 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgatritmp.h @@ -1,94 +1,108 @@ -static __inline void TAG(triangle)( GLcontext *ctx, GLuint e0, - GLuint e1, GLuint e2, GLuint pv ) +static __inline void TAG(triangle)(GLcontext *ctx, + GLuint e0, GLuint e1, GLuint e2, + GLuint pv) { - mgaContextPtr mmesa = MGA_CONTEXT( ctx ); - GLuint vertsize = mmesa->vertsize; - mgaUI32 *wv = mgaAllocVertexDwords( mmesa, 3 * vertsize); - - struct vertex_buffer *VB = ctx->VB; - mgaVertexPtr mgaVB = MGA_DRIVER_DATA(VB)->verts; - const mgaVertex *v[3]; - int i, j; + mgaContextPtr mgactx = MGA_CONTEXT(ctx); + struct vertex_buffer *VB = ctx->VB; + mgaVertexPtr mgaverts = MGA_DRIVER_DATA(VB)->verts; + mgaVertex *v[3]; #if (IND & MGA_OFFSET_BIT) - GLfloat offset = 0.0; + GLfloat offset; + GLfloat z[3]; #endif -#if (IND & (MGA_FLAT_BIT|MGA_TWOSIDE_BIT)) - mgaUI32 c[3]; - - c[2] = c[1] = c[0] = *(mgaUI32 *)&mgaVB[pv].warp2.color; +#if (IND & (MGA_TWOSIDE_BIT | MGA_FLAT_BIT)) + GLuint c[3]; #endif - (void) VB; + v[0] = &mgaverts[e0]; + v[1] = &mgaverts[e1]; + v[2] = &mgaverts[e2]; - v[0] = &mgaVB[e0]; - v[1] = &mgaVB[e1]; - v[2] = &mgaVB[e2]; +#if (IND & (MGA_TWOSIDE_BIT | MGA_FLAT_BIT)) + c[0] = v[0]->ui[4]; + c[1] = v[1]->ui[4]; + c[2] = v[2]->ui[4]; +#endif -#if (IND & (MGA_TWOSIDE_BIT|MGA_OFFSET_BIT)) +#if (IND & (MGA_TWOSIDE_BIT | MGA_OFFSET_BIT)) { - GLfloat ex = v[0]->warp1.x - v[2]->warp1.x; - GLfloat ey = v[0]->warp1.y - v[2]->warp1.y; - GLfloat fx = v[1]->warp1.x - v[2]->warp1.x; - GLfloat fy = v[1]->warp1.y - v[2]->warp1.y; - GLfloat cc = ex*fy-ey*fx; - -#if (IND & MGA_TWOSIDE_BIT) + GLfloat ex = v[0]->v.x - v[2]->v.x; + GLfloat ey = v[0]->v.y - v[2]->v.y; + GLfloat fx = v[1]->v.x - v[2]->v.x; + GLfloat fy = v[1]->v.y - v[2]->v.y; + GLfloat cc = ex*fy - ey*fx; + +#if (IND & MGA_TWOSIDE_BIT) { - GLuint facing = (cc>0.0) ^ ctx->Polygon.FrontBit; + GLuint facing = (cc > 0.0) ^ ctx->Polygon.FrontBit; GLubyte (*vbcolor)[4] = VB->Color[facing]->data; if (IND & MGA_FLAT_BIT) { - MGA_COLOR((char *)&c[0],vbcolor[pv]); - c[2] = c[1] = c[0]; + MGA_COLOR((char *)&v[0]->ui[4], vbcolor[pv]); + v[2]->ui[4] = v[1]->ui[4] = v[0]->ui[4]; } else { - MGA_COLOR((char *)&c[0],vbcolor[e0]); - MGA_COLOR((char *)&c[1],vbcolor[e1]); - MGA_COLOR((char *)&c[2],vbcolor[e2]); + MGA_COLOR((char *)&v[0]->ui[4], vbcolor[e0]); + MGA_COLOR((char *)&v[1]->ui[4], vbcolor[e1]); + MGA_COLOR((char *)&v[2]->ui[4], vbcolor[e2]); } } #endif - -#if (IND & MGA_OFFSET_BIT) - if (ctx->Polygon.OffsetFill) + +#if (IND & MGA_OFFSET_BIT) { - offset = ctx->Polygon.OffsetUnits * (1.0/0x10000); + offset = ctx->Polygon.OffsetUnits * 1.0/0x10000; + z[0] = v[0]->v.z; + z[1] = v[1]->v.z; + z[2] = v[2]->v.z; if (cc * cc > 1e-16) { - GLfloat ez = v[0]->warp1.z - v[2]->warp1.z; - GLfloat fz = v[1]->warp1.z - v[2]->warp1.z; - GLfloat a = ey*fz-ez*fy; - GLfloat b = ez*fx-ex*fz; - GLfloat ic = 1.0 / cc; - GLfloat ac = a * ic; - GLfloat bc = b * ic; - if (ac<0.0F) ac = -ac; - if (bc<0.0F) bc = -bc; - offset += MAX2( ac, bc ) * ctx->Polygon.OffsetFactor; + GLfloat ez = z[0] - z[2]; + GLfloat fz = z[1] - z[2]; + GLfloat a = ey*fz - ez*fy; + GLfloat b = ez*fx - ex*fz; + GLfloat ic = 1.0 / cc; + GLfloat ac = a * ic; + GLfloat bc = b * ic; + if (ac < 0.0f) ac = -ac; + if (bc < 0.0f) bc = -bc; + offset += MAX2(ac, bc) * ctx->Polygon.OffsetFactor; } + v[0]->v.z += offset; + v[1]->v.z += offset; + v[2]->v.z += offset; } #endif } -#endif - - - for (j = 0 ; j < 3 ; j++, wv += vertsize) { +#elif (IND & MGA_FLAT_BIT) + { + GLuint color = mgaverts[pv].ui[4]; + v[0]->ui[4] = color; + v[1]->ui[4] = color; + v[2]->ui[4] = color; + } +#endif - for (i = 0 ; i < vertsize ; i++) - wv[i] = v[j]->ui[i]; + mga_draw_triangle( mgactx, v[0], v[1], v[2] ); -#if (IND & (MGA_FLAT_BIT|MGA_TWOSIDE_BIT)) - wv[4] = c[j]; /* color is the fifth element... */ -#endif #if (IND & MGA_OFFSET_BIT) - *(float *)&wv[2] = v[j]->warp1.z + offset; + v[0]->v.z = z[0]; + v[1]->v.z = z[1]; + v[2]->v.z = z[2]; #endif - } + +#if (IND & (MGA_FLAT_BIT | MGA_TWOSIDE_BIT)) + v[0]->ui[4] = c[0]; + v[1]->ui[4] = c[1]; + v[2]->ui[4] = c[2]; +#endif + } + static void TAG(quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv ) @@ -113,37 +127,37 @@ static void TAG(line)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv ) GLubyte (*vbcolor)[4] = ctx->VB->ColorPtr->data; if (IND & MGA_FLAT_BIT) { - MGA_COLOR((char *)&vert0->warp1.color,vbcolor[pv]); - *(int *)&vert1->warp1.color = *(int *)&vert0->warp1.color; + MGA_COLOR((char *)&vert0->v.color,vbcolor[pv]); + *(int *)&vert1->v.color = *(int *)&vert0->v.color; } else { - MGA_COLOR((char *)&vert0->warp1.color,vbcolor[v0]); - MGA_COLOR((char *)&vert1->warp1.color,vbcolor[v1]); + MGA_COLOR((char *)&vert0->v.color,vbcolor[v0]); + MGA_COLOR((char *)&vert1->v.color,vbcolor[v1]); } } else if (IND & MGA_FLAT_BIT) { - c0 = *(GLuint *) &(vert0->warp1.color); - c1 = *(GLuint *) &(vert1->warp1.color); - *(int *)&vert0->warp1.color = - *(int *)&vert1->warp1.color = *(int *)&mgaVB[pv].warp1.color; + c0 = *(GLuint *) &(vert0->v.color); + c1 = *(GLuint *) &(vert1->v.color); + *(int *)&vert0->v.color = + *(int *)&vert1->v.color = *(int *)&mgaVB[pv].v.color; } if (IND & MGA_OFFSET_BIT) { GLfloat offset = ctx->LineZoffset * (1.0 / 0x10000); - z0 = vert0->warp1.z; - z1 = vert1->warp1.z; - vert0->warp1.z += offset; - vert1->warp1.z += offset; + z0 = vert0->v.z; + z1 = vert1->v.z; + vert0->v.z += offset; + vert1->v.z += offset; } mga_draw_line( mmesa, &mgaVB[v0], &mgaVB[v1], width ); if (IND & MGA_OFFSET_BIT) { - vert0->warp1.z = z0; - vert1->warp1.z = z1; + vert0->v.z = z0; + vert1->v.z = z1; } if ((IND & MGA_FLAT_BIT) && !(IND & MGA_TWOSIDE_BIT)) { - *(GLuint *) &(vert0->warp1.color) = c0; - *(GLuint *) &(vert1->warp1.color) = c1; + *(GLuint *) &(vert0->v.color) = c0; + *(GLuint *) &(vert1->v.color) = c1; } } @@ -162,11 +176,11 @@ static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last ) mgaVertex tmp0 = mgaVB[i]; if (IND & MGA_TWOSIDE_BIT) { GLubyte (*vbcolor)[4] = VB->ColorPtr->data; - MGA_COLOR((char *)&tmp0.warp1.color, vbcolor[i]); + MGA_COLOR((char *)&tmp0.v.color, vbcolor[i]); } if (IND & MGA_OFFSET_BIT) { GLfloat offset = ctx->PointZoffset * (1.0 / 0x10000); - tmp0.warp1.z += offset; + tmp0.v.z += offset; } mga_draw_point( mmesa, &tmp0, sz ); } else diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.c b/xc/lib/GL/mesa/src/drv/mga/mgavb.c index 742b557e6..3fea4ffe0 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgavb.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgavb.c @@ -34,36 +34,36 @@ #include <stdlib.h> #define TEX0 { \ - v->warp2.tu0 = tc0[i][0]; \ - v->warp2.tv0 = tc0[i][1]; \ + v->v.tu0 = tc0[i][0]; \ + v->v.tv0 = tc0[i][1]; \ } #define TEX1 { \ - v->warp2.tu1 = tc1[i][0]; \ - v->warp2.tv1 = tc1[i][1]; \ + v->v.tu1 = tc1[i][0]; \ + v->v.tv1 = tc1[i][1]; \ } #define SPC { \ GLubyte *spec = &(VB->Spec[0][i][0]); \ - v->warp2.specular.red = spec[0]; \ - v->warp2.specular.green = spec[1]; \ - v->warp2.specular.blue = spec[2]; \ + v->v.specular.red = spec[0]; \ + v->v.specular.green = spec[1]; \ + v->v.specular.blue = spec[2]; \ } #define FOG { \ GLubyte *spec = &(VB->Spec[0][i][0]); \ - v->warp2.specular.alpha = spec[3]; \ + v->v.specular.alpha = spec[3]; \ } #define COL { \ GLubyte *col = &(VB->Color[0]->data[i][0]); \ - v->warp2.color.blue = col[2]; \ - v->warp2.color.green = col[1]; \ - v->warp2.color.red = col[0]; \ - v->warp2.color.alpha = col[3]; \ + v->v.color.blue = col[2]; \ + v->v.color.green = col[1]; \ + v->v.color.red = col[0]; \ + v->v.color.alpha = col[3]; \ } -/* The warp2 code we have doesn't seem to support projective texturing +/* The v code we have doesn't seem to support projective texturing * in the multitexture case. (Would require another 1/w value for the * second set of texcoords). This may be a problem for the g400. */ @@ -75,19 +75,19 @@ mmesa->setupdone &= ~MGA_WIN_BIT; \ for (i=start; i < end; i++, v++) { \ float oow = 1.0 / tc[i][3]; \ - v->warp2.rhw *= tc[i][3]; \ - v->warp2.tu0 *= oow; \ - v->warp2.tv0 *= oow; \ + v->v.rhw *= tc[i][3]; \ + v->v.tu0 *= oow; \ + v->v.tv0 *= oow; \ } \ } #define COORD \ GLfloat *win = VB->Win.data[i]; \ - v->warp2.rhw = win[3]; \ - v->warp2.z = (1.0/0x10000) * win[2]; \ - v->warp2.x = win[0] + xoffset; \ - v->warp2.y = - win[1] + yoffset; + v->v.rhw = win[3]; \ + v->v.z = (1.0/0x10000) * win[2]; \ + v->v.x = win[0] + xoffset; \ + v->v.y = - win[1] + yoffset; #define NOP diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.h b/xc/lib/GL/mesa/src/drv/mga/mgavb.h index 675c1779c..e8926ba1f 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgavb.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgavb.h @@ -46,35 +46,25 @@ typedef struct mga_warp_color_t { } mga_warp_color; -/* - * vertex type used for the single-warp g200 - */ -typedef struct mga_warp_vertex_t { - GLfloat x,y,z; /* coordinates in screen space*/ - GLfloat rhw; /* reciprocal homogeneous w */ - mga_warp_color color; /* vertex color */ - mga_warp_color specular; /* specular color, alpha is fog */ - GLfloat tu0,tv0; /* texture coordinates */ -} mga_warp_vertex1; /* - * vertex type used for the dual-warp g400 + * The vertex structure. The final tu1/tv1 values only used in multitexture + * modes. */ -typedef struct mga_warp_vertex2_t { +typedef struct mga_warp_vertex_t { GLfloat x,y,z; /* coordinates in screen space*/ GLfloat rhw; /* reciprocal homogeneous w */ mga_warp_color color; /* vertex color */ mga_warp_color specular; /* specular color, alpha is fog */ GLfloat tu0,tv0; /* texture coordinates */ GLfloat tu1,tv1; /* same for second stage */ -} mga_warp_vertex2; +} mga_warp_vertex; /* The fastpath code still expects a 16-float stride vertex. */ union mga_vertex_t { - mga_warp_vertex1 warp1; - mga_warp_vertex2 warp2; + mga_warp_vertex v; float f[16]; mgaUI32 ui[16]; }; |