-# $Id: Makefile.X11,v 1.3 2003/10/20 02:17:32 jonsmirl Exp $
# Mesa 3-D graphics library
# Version: 5.0
-/* $Id: fb_dri.c,v 1.2 2003/10/08 01:53:30 kendallb Exp $ */
/*
* Mesa 3-D graphics library
-# $Id: Makefile.X11,v 1.2 2003/10/20 02:17:32 jonsmirl Exp $
+# $Id: Makefile.X11,v 1.3 2003/11/24 15:21:14 keithw Exp $
# Mesa 3-D graphics library
# Version: 5.0
#include "gamma_vb.h"
#include "gamma_tris.h"
-extern const struct gl_pipeline_stage _gamma_render_stage;
+extern const struct tnl_pipeline_stage _gamma_render_stage;
-static const struct gl_pipeline_stage *gamma_pipeline[] = {
+static const struct tnl_pipeline_stage *gamma_pipeline[] = {
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
GLfloat (*coord)[4];
GLuint coord_stride;
- GLubyte (*col)[4];
+ GLfloat (*col)[4];
GLuint col_stride;
int i;
GLuint tc0_stride = 0;
GLfloat (*tc0)[4] = 0;
GLuint tc0_size = 0;
- if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- gamma_import_float_colors( ctx );
-
- col = VB->ColorPtr[0]->Ptr;
- col_stride = VB->ColorPtr[0]->StrideB;
+ col = VB->ColorPtr[0]->data;
+ col_stride = VB->ColorPtr[0]->stride;
if (ctx->Texture.Unit[0]._ReallyEnabled) {
tc0_stride = VB->TexCoordPtr[0]->stride;
coord_stride = VB->NdcPtr->stride;
}
- if (VB->importable_data) {
- if (start) {
- coord = (GLfloat (*)[4])((GLubyte *)coord + start * coord_stride);
- STRIDE_4UB(col, start * col_stride);
- if (ctx->Texture.Unit[0]._ReallyEnabled)
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride);
- }
-
- if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 9);
- WRITEF(gmesa->buf, Tq4, tc0[0][3]);
- WRITEF(gmesa->buf, Tr4, tc0[0][2]);
- WRITEF(gmesa->buf, Tt4, tc0[0][0]);
- WRITEF(gmesa->buf, Ts4, tc0[0][1]);
- WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]);
- WRITEF(gmesa->buf, Vw, coord[0][3]);
- WRITEF(gmesa->buf, Vz, coord[0][2]);
- WRITEF(gmesa->buf, Vy, coord[0][1]);
- WRITEF(gmesa->buf, Vx4, coord[0][0]);
- STRIDE_4UB(col, col_stride);
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride);
- coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride);
- }
- } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 7);
- WRITEF(gmesa->buf, Tt2, tc0[0][0]);
- WRITEF(gmesa->buf, Ts2, tc0[0][1]);
- WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]);
- WRITEF(gmesa->buf, Vw, coord[0][3]);
- WRITEF(gmesa->buf, Vz, coord[0][2]);
- WRITEF(gmesa->buf, Vy, coord[0][1]);
- WRITEF(gmesa->buf, Vx4, coord[0][0]);
- STRIDE_4UB(col, col_stride);
- tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + tc0_stride);
- coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride);
- }
- } else {
- for (i=start; i < end; i++) {
- CHECK_DMA_BUFFER(gmesa, 4);
- WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[0]);
- WRITEF(gmesa->buf, Vz, coord[0][2]);
- WRITEF(gmesa->buf, Vy, coord[0][1]);
- WRITEF(gmesa->buf, Vx3, coord[0][0]);
- STRIDE_4UB(col, col_stride);
- coord = (GLfloat (*)[4])((GLubyte *)coord + coord_stride);
- }
- }
- } else {
- if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) {
- for (i=start; i < end; i++) {
+ if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 4) {
+ for (i=start; i < end; i++) {
CHECK_DMA_BUFFER(gmesa, 9);
WRITEF(gmesa->buf, Tq4, tc0[i][3]);
WRITEF(gmesa->buf, Tr4, tc0[i][2]);
WRITEF(gmesa->buf, Vz, coord[i][2]);
WRITEF(gmesa->buf, Vy, coord[i][1]);
WRITEF(gmesa->buf, Vx4, coord[i][0]);
- }
- } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) {
- for (i=start; i < end; i++) {
+ }
+ } else if (ctx->Texture.Unit[0]._ReallyEnabled && tc0_size == 2) {
+ for (i=start; i < end; i++) {
CHECK_DMA_BUFFER(gmesa, 7);
WRITEF(gmesa->buf, Tt2, tc0[i][0]);
WRITEF(gmesa->buf, Ts2, tc0[i][1]);
WRITEF(gmesa->buf, Vz, coord[i][2]);
WRITEF(gmesa->buf, Vy, coord[i][1]);
WRITEF(gmesa->buf, Vx4, coord[i][0]);
- }
- } else {
- for (i=start; i < end; i++) {
+ }
+ } else {
+ for (i=start; i < end; i++) {
CHECK_DMA_BUFFER(gmesa, 4);
WRITE(gmesa->buf, PackedColor4, *(CARD32*)col[i]);
WRITEF(gmesa->buf, Vz, coord[i][2]);
WRITEF(gmesa->buf, Vy, coord[i][1]);
WRITEF(gmesa->buf, Vx3, coord[i][0]);
- }
}
}
}
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- GAMMA_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
+ GAMMA_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
}
static const GLuint hw_prim[GL_POLYGON+1] = {
static GLboolean gamma_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Start( ctx );
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
+
+ if (!length)
+ continue;
+
+ tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, prim);
}
tnl->Driver.Render.Finish( ctx );
static void gamma_check_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
- GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
+ GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
-const struct gl_pipeline_stage _gamma_render_stage =
+const struct tnl_pipeline_stage _gamma_render_stage =
{
"gamma render",
(_DD_NEW_SEPARATE_SPECULAR |
if (!newinputs)
return;
- if (newinputs & VERT_BIT_CLIP) {
+ if (newinputs & VERT_BIT_POS) {
setup_tab[gmesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
-# $Id: Makefile.X11,v 1.2 2003/10/20 02:17:32 jonsmirl Exp $
# Mesa 3-D graphics library
# Version: 5.0
NULL
};
-extern const struct gl_pipeline_stage _i810_render_stage;
+extern const struct tnl_pipeline_stage _i810_render_stage;
-static const struct gl_pipeline_stage *i810_pipeline[] = {
+static const struct tnl_pipeline_stage *i810_pipeline[] = {
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start,
count, flags );
- I810_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
+ I810_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
}
static GLboolean i810_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint i, length, flags = 0;
+ GLuint i;
/* Don't handle clipping or indexed vertices.
*/
return GL_TRUE;
}
- imesa->SetupNewInputs = VERT_BIT_CLIP;
+ imesa->SetupNewInputs = VERT_BIT_POS;
tnl->Driver.Render.Start( ctx );
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
- flags = VB->Primitive[i];
- length= VB->PrimitiveLength[i];
- if (length)
- i810_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
- flags );
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
+
+ if (!length)
+ continue;
+
+ i810_render_tab_verts[prim & PRIM_MODE_MASK]( ctx, start, start + length,
+ prim );
}
tnl->Driver.Render.Finish( ctx );
}
-static void i810_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
+static void i810_check_render( GLcontext *ctx, struct tnl_pipeline_stage *stage )
{
- GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
+ GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
-const struct gl_pipeline_stage _i810_render_stage =
+const struct tnl_pipeline_stage _i810_render_stage =
{
"i810 render",
(_DD_NEW_SEPARATE_SPECULAR |
memset(retval, 0, sizeof(drmBufMap));
retval->list = (drmBufPtr)ALIGN_MALLOC(sizeof(drmBuf) * I810_DMA_BUF_NR, 32);
if(retval->list == NULL) {
- FREE(retval);
+ ALIGN_FREE(retval);
return NULL;
}
memset(retval->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR);
if (!newinputs)
return;
- if (newinputs & VERT_BIT_CLIP) {
+ if (newinputs & VERT_BIT_POS) {
setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
-# $Id: Makefile.X11,v 1.3 2003/10/20 02:17:33 jonsmirl Exp $
# Mesa 3-D graphics library
# Version: 5.0
};
-extern const struct gl_pipeline_stage _i830_render_stage;
+extern const struct tnl_pipeline_stage _i830_render_stage;
-static const struct gl_pipeline_stage *i830_pipeline[] = {
+static const struct tnl_pipeline_stage *i830_pipeline[] = {
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start,
count, flags );
- I830_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_CLIP;
+ I830_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS;
}
int nr_rprims = 0;
int nr_rverts = 0;
int rprim = 0;
- int i = 0, length, flags = 0;
+ int i;
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length) {
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
+ {
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
+
if (!length)
continue;
- if (!hw_prim[flags & PRIM_MODE_MASK])
+ if (!hw_prim[prim & PRIM_MODE_MASK])
return GL_FALSE;
nr_prims++;
- nr_rverts += length * scale_prim[flags & PRIM_MODE_MASK];
+ nr_rverts += length * scale_prim[prim & PRIM_MODE_MASK];
- if (reduced_prim[flags&PRIM_MODE_MASK] != rprim) {
+ if (reduced_prim[prim&PRIM_MODE_MASK] != rprim) {
nr_rprims++;
- rprim = reduced_prim[flags&PRIM_MODE_MASK];
+ rprim = reduced_prim[prim&PRIM_MODE_MASK];
}
}
static GLboolean i830_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
return GL_TRUE;
}
- imesa->SetupNewInputs = VERT_BIT_CLIP;
+ imesa->SetupNewInputs = VERT_BIT_POS;
tnl->Driver.Render.Start( ctx );
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length) {
- flags = VB->Primitive[i];
- length= VB->PrimitiveLength[i];
- if (length)
- i830_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
- flags );
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
+ {
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
+
+ if (!length)
+ continue;
+
+ i830_render_tab_verts[prim & PRIM_MODE_MASK]( ctx, start, start + length,
+ prim );
}
tnl->Driver.Render.Finish( ctx );
static void i830_check_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
- GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
+ GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
inputs |= VERT_BIT_COLOR1;
stage->inputs = inputs;
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
-const struct gl_pipeline_stage _i830_render_stage =
+const struct tnl_pipeline_stage _i830_render_stage =
{
"i830 render",
(_DD_NEW_SEPARATE_SPECULAR |
if (!newinputs)
return;
- if (newinputs & VERT_BIT_CLIP) {
+ if (newinputs & VERT_BIT_POS) {
setup_tab[imesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
-# $Id: Makefile.X11,v 1.5 2003/10/21 06:05:41 jonsmirl Exp $
# Mesa 3-D graphics library
# Version: 5.0
}
-extern const struct gl_pipeline_stage _mga_render_stage;
+extern const struct tnl_pipeline_stage _mga_render_stage;
-static const struct gl_pipeline_stage *mga_pipeline[] = {
+static const struct tnl_pipeline_stage *mga_pipeline[] = {
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
if (*(dPriv->pStamp) != mmesa->lastStamp) {
mmesa->lastStamp = *(dPriv->pStamp);
- mmesa->SetupNewInputs |= VERT_BIT_CLIP;
+ mmesa->SetupNewInputs |= VERT_BIT_POS;
mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
mgaUpdateRects( mmesa, (MGA_FRONT|MGA_BACK) );
}
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- MGA_CONTEXT(ctx)->SetupNewInputs |= VERT_BIT_CLIP;
+ MGA_CONTEXT(ctx)->SetupNewInputs |= VERT_BIT_POS;
}
#define LOCAL_VARS mgaContextPtr mmesa = MGA_CONTEXT(ctx)
static GLboolean mga_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
- GLuint i, length, flags = 0;
+ GLuint i;
/* Don't handle clipping or indexed vertices or vertex manipulations.
*/
tnl->Driver.Render.Start( ctx );
mmesa->SetupNewInputs = ~0;
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
- flags = VB->Primitive[i];
- length= VB->PrimitiveLength[i];
- if (length)
- mga_render_tab_verts[flags & PRIM_MODE_MASK]( ctx, i, i + length,
- flags );
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
+
+ if (!length)
+ continue;
+
+ mga_render_tab_verts[prim & PRIM_MODE_MASK]( ctx, start, start + length,
+ prim);
}
tnl->Driver.Render.Finish( ctx );
}
-static void mga_check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
+static void mga_check_render( GLcontext *ctx, struct tnl_pipeline_stage *stage )
{
- GLuint inputs = VERT_BIT_CLIP | VERT_BIT_COLOR0;
+ GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
-const struct gl_pipeline_stage _mga_render_stage =
+const struct tnl_pipeline_stage _mga_render_stage =
{
"mga render",
(_DD_NEW_SEPARATE_SPECULAR |
if (!newinputs)
return;
- if (newinputs & VERT_BIT_CLIP) {
+ if (newinputs & VERT_BIT_POS) {
setup_tab[mmesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
-# $Id: Makefile.X11,v 1.3 2003/10/21 06:05:43 jonsmirl Exp $
# Mesa 3-D graphics library
# Version: 5.0
if (!newinputs)
return;
- if (newinputs & VERT_BIT_CLIP) {
+ if (newinputs & VERT_BIT_POS) {
setup_tab[rmesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
-# $Id: Makefile.X11,v 1.6 2003/10/21 06:05:46 jonsmirl Exp $
# Mesa 3-D graphics library
# Version: 5.0
NULL
};
-extern const struct gl_pipeline_stage _r200_render_stage;
-extern const struct gl_pipeline_stage _r200_tcl_stage;
+extern const struct tnl_pipeline_stage _r200_render_stage;
+extern const struct tnl_pipeline_stage _r200_tcl_stage;
-static const struct gl_pipeline_stage *r200_pipeline[] = {
+static const struct tnl_pipeline_stage *r200_pipeline[] = {
/* Try and go straight to t&l
*/
#include "math/m_translate.h"
#include "tnl/tnl.h"
#include "tnl/t_context.h"
-#include "tnl/t_imm_debug.h"
#include "r200_context.h"
#include "r200_ioctl.h"
GLuint vfmt0 = 0, vfmt1 = 0;
GLuint count = VB->Count;
- if (R200_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, inputs );
-
if (1) {
if (!rmesa->tcl.obj.buf)
emit_vector( ctx,
case 3: vfmt0 |= R200_VTX_Z0;
case 2:
default:
- break;
+ break;
}
component[nr++] = &rmesa->tcl.obj;
}
}
if (inputs & VERT_BIT_COLOR0) {
- if (VB->ColorPtr[0]->Type == GL_UNSIGNED_BYTE) {
- if (!rmesa->tcl.rgba.buf)
- emit_ubyte_rgba( ctx,
- &rmesa->tcl.rgba,
- (char *)VB->ColorPtr[0]->Ptr,
- VB->ColorPtr[0]->Size,
- VB->ColorPtr[0]->StrideB,
- count);
-
- vfmt0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT;
+ int emitsize;
+
+ if (VB->ColorPtr[0]->size == 4 &&
+ (VB->ColorPtr[0]->stride != 0 ||
+ VB->ColorPtr[0]->data[0][3] != 1.0)) {
+ vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
+ emitsize = 4;
}
- else {
- int emitsize;
-
- if (VB->ColorPtr[0]->Size == 4 &&
- (VB->ColorPtr[0]->StrideB != 0 ||
- ((GLfloat *)VB->ColorPtr[0]->Ptr)[3] != 1.0)) {
- vfmt0 |= R200_VTX_FP_RGBA << R200_VTX_COLOR_0_SHIFT;
- emitsize = 4;
- }
- else {
- vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_0_SHIFT;
- emitsize = 3;
- }
-
- if (!rmesa->tcl.rgba.buf)
- emit_vector( ctx,
- &(rmesa->tcl.rgba),
- (char *)VB->ColorPtr[0]->Ptr,
- emitsize,
- VB->ColorPtr[0]->StrideB,
- count);
+ else {
+ vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_0_SHIFT;
+ emitsize = 3;
}
+ if (!rmesa->tcl.rgba.buf)
+ emit_vector( ctx,
+ &(rmesa->tcl.rgba),
+ (char *)VB->ColorPtr[0]->data,
+ emitsize,
+ VB->ColorPtr[0]->stride,
+ count);
+
component[nr++] = &rmesa->tcl.rgba;
}
if (inputs & VERT_BIT_COLOR1) {
if (!rmesa->tcl.spec.buf) {
- if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- r200_import_float_spec_colors( ctx );
-
- emit_ubyte_rgba( ctx,
- &rmesa->tcl.spec,
- (char *)VB->SecondaryColorPtr[0]->Ptr,
- 3,
- VB->SecondaryColorPtr[0]->StrideB,
- count);
+ emit_vector( ctx,
+ &rmesa->tcl.spec,
+ (char *)VB->SecondaryColorPtr[0]->data,
+ 3,
+ VB->SecondaryColorPtr[0]->stride,
+ count);
}
/* How does this work?
*/
- vfmt0 |= R200_VTX_PK_RGBA << R200_VTX_COLOR_1_SHIFT;
+ vfmt0 |= R200_VTX_FP_RGB << R200_VTX_COLOR_1_SHIFT;
component[nr++] = &rmesa->tcl.spec;
}
{
r200ContextPtr rmesa = R200_CONTEXT( ctx );
- if (R200_DEBUG & DEBUG_VERTS)
- _tnl_print_vert_flags( __FUNCTION__, newinputs );
+/* if (R200_DEBUG & DEBUG_VERTS) */
+/* _tnl_print_vert_flags( __FUNCTION__, newinputs ); */
if (newinputs & VERT_BIT_POS)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ );
r200VtxfmtInvalidate( ctx );
}
+/* A hack. The r200 can actually cope just fine with materials
+ * between begin/ends, so fix this.
+ */
+static GLboolean check_material( GLcontext *ctx )
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ GLint i;
+
+ for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT;
+ i < _TNL_ATTRIB_MAT_BACK_INDEXES;
+ i++)
+ if (tnl->vb.AttribPtr[i] &&
+ tnl->vb.AttribPtr[i]->stride)
+ return GL_TRUE;
+
+ return GL_FALSE;
+}
+
+
static void r200WrapRunPipeline( GLcontext *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
+ GLboolean has_material;
if (0)
fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState);
if (rmesa->NewGLState)
r200ValidateState( ctx );
- if (tnl->vb.Material) {
+ has_material = (ctx->Light.Enabled && check_material( ctx ));
+
+ if (has_material) {
TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_TRUE );
}
*/
_tnl_run_pipeline( ctx );
- if (tnl->vb.Material) {
+ if (has_material) {
TCL_FALLBACK( ctx, R200_TCL_FALLBACK_MATERIAL, GL_FALSE );
r200UpdateMaterial( ctx ); /* not needed any more? */
}
#include "math/m_translate.h"
#include "tnl/tnl.h"
#include "tnl/t_context.h"
-#include "tnl/t_imm_exec.h"
#include "tnl/t_pipeline.h"
#include "r200_context.h"
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- R200_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
+ R200_CONTEXT(ctx)->swtcl.SetupNewInputs = _TNL_BIT_POS;
}
static void ELT_FALLBACK( GLcontext *ctx,
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabElts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- R200_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
+ R200_CONTEXT(ctx)->swtcl.SetupNewInputs = _TNL_BIT_POS;
}
static GLboolean r200_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Start( ctx );
- for (i = 0 ; !(flags & PRIM_LAST) ; i += length)
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
+
+ if (!length)
+ continue;
if (R200_DEBUG & DEBUG_PRIMS)
fprintf(stderr, "r200_render.c: prim %s %d..%d\n",
- _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK),
- i, i+length);
+ _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK),
+ start, start+length);
- if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
+ tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, flags );
}
tnl->Driver.Render.Finish( ctx );
static void r200_check_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
- GLuint inputs = VERT_BIT_POS | VERT_BIT_CLIP | VERT_BIT_COLOR0;
+ GLuint inputs = _TNL_BIT_POS | _TNL_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
- inputs |= VERT_BIT_COLOR1;
+ inputs |= _TNL_BIT_COLOR1;
if (ctx->Texture.Unit[0]._ReallyEnabled)
- inputs |= VERT_BIT_TEX0;
+ inputs |= _TNL_BIT_TEX0;
if (ctx->Texture.Unit[1]._ReallyEnabled)
- inputs |= VERT_BIT_TEX1;
+ inputs |= _TNL_BIT_TEX1;
if (ctx->Fog.Enabled)
- inputs |= VERT_BIT_FOG;
+ inputs |= _TNL_BIT_FOG;
}
stage->inputs = inputs;
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
-const struct gl_pipeline_stage _r200_render_stage =
+const struct tnl_pipeline_stage _r200_render_stage =
{
"r200 render",
(_DD_NEW_SEPARATE_SPECULAR |
void r200FlushVertices( GLcontext *ctx, GLuint flags )
{
- _tnl_flush_vertices( ctx, flags );
+ _tnl_FlushVertices( ctx, flags );
if (flags & FLUSH_STORED_VERTICES)
R200_NEWPRIM( R200_CONTEXT( ctx ) );
/* TCL render.
*/
static GLboolean r200_run_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
rmesa->tcl.Elts = VB->Elts;
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
-
- if (R200_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: prim %s %d..%d\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK),
- i, i+length);
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
if (!length)
continue;
if (rmesa->tcl.Elts)
- r200EmitEltPrimitive( ctx, i, i+length, flags );
+ r200EmitEltPrimitive( ctx, start, start+length, prim );
else
- r200EmitPrimitive( ctx, i, i+length, flags );
+ r200EmitPrimitive( ctx, start, start+length, prim );
}
return GL_FALSE; /* finished the pipe */
static void r200_check_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint inputs = VERT_BIT_POS;
}
static void r200_init_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
stage->check = r200_check_tcl_render;
stage->check( ctx, stage );
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
/* Initial state for tcl stage.
*/
-const struct gl_pipeline_stage _r200_tcl_stage =
+const struct tnl_pipeline_stage _r200_tcl_stage =
{
"r200 render",
(_DD_NEW_SEPARATE_SPECULAR |
count_func( "Vertex2fv", &rmesa->vb.dfn_cache.Vertex2fv );
count_func( "Vertex3f", &rmesa->vb.dfn_cache.Vertex3f );
count_func( "Vertex3fv", &rmesa->vb.dfn_cache.Vertex3fv );
- count_func( "Color4ub", &rmesa->vb.dfn_cache.Color4ub );
- count_func( "Color4ubv", &rmesa->vb.dfn_cache.Color4ubv );
- count_func( "Color3ub", &rmesa->vb.dfn_cache.Color3ub );
- count_func( "Color3ubv", &rmesa->vb.dfn_cache.Color3ubv );
+ count_func( "Color4ub", &rmesa->vb.dfn_cache.Color4ub );
+ count_func( "Color4ubv", &rmesa->vb.dfn_cache.Color4ubv );
+ count_func( "Color3ub", &rmesa->vb.dfn_cache.Color3ub );
+ count_func( "Color3ubv", &rmesa->vb.dfn_cache.Color3ubv );
count_func( "Color4f", &rmesa->vb.dfn_cache.Color4f );
count_func( "Color4fv", &rmesa->vb.dfn_cache.Color4fv );
count_func( "Color3f", &rmesa->vb.dfn_cache.Color3f );
glNormal3fv( rmesa->vb.normalptr );
if (VTX_COLOR(ind0, 0) == R200_VTX_PK_RGBA)
- glColor4ub( rmesa->vb.colorptr->red, rmesa->vb.colorptr->green, rmesa->vb.colorptr->blue, rmesa->vb.colorptr->alpha );
+ glColor4ub( rmesa->vb.colorptr->red,
+ rmesa->vb.colorptr->green,
+ rmesa->vb.colorptr->blue,
+ rmesa->vb.colorptr->alpha );
else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGBA)
glColor4fv( rmesa->vb.floatcolorptr );
else if (VTX_COLOR(ind0, 0) == R200_VTX_FP_RGB) {
}
if (VTX_COLOR(ind0, 1) == R200_VTX_PK_RGBA)
- _glapi_Dispatch->SecondaryColor3ubEXT( rmesa->vb.specptr->red, rmesa->vb.specptr->green, rmesa->vb.specptr->blue );
+ _glapi_Dispatch->SecondaryColor3ubEXT( rmesa->vb.specptr->red,
+ rmesa->vb.specptr->green,
+ rmesa->vb.specptr->blue );
if (ind1 & (7 << R200_VTX_TEX0_COMP_CNT_SHIFT))
glTexCoord2fv( rmesa->vb.texcoordptr[0] );
vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
- vfmt->Indexi = _mesa_noop_Indexi;
- vfmt->Indexiv = _mesa_noop_Indexiv;
+ vfmt->Indexf = _mesa_noop_Indexf;
+ vfmt->Indexfv = _mesa_noop_Indexfv;
/* Active but unsupported -- fallback if we receive these:
*/
vfmt->CallList = r200_fallback_CallList;
+ vfmt->CallLists = r200_fallback_CallLists;
vfmt->EvalCoord1f = r200_fallback_EvalCoord1f;
vfmt->EvalCoord1fv = r200_fallback_EvalCoord1fv;
vfmt->EvalCoord2f = r200_fallback_EvalCoord2f;
{
vfmt->Color3f = choose_Color3f;
vfmt->Color3fv = choose_Color3fv;
- vfmt->Color3ub = choose_Color3ub;
- vfmt->Color3ubv = choose_Color3ubv;
vfmt->Color4f = choose_Color4f;
vfmt->Color4fv = choose_Color4fv;
- vfmt->Color4ub = choose_Color4ub;
- vfmt->Color4ubv = choose_Color4ubv;
vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT;
vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT;
- vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT;
- vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT;
vfmt->MultiTexCoord1fARB = choose_MultiTexCoord1fARB;
vfmt->MultiTexCoord1fvARB = choose_MultiTexCoord1fvARB;
vfmt->MultiTexCoord2fARB = choose_MultiTexCoord2fARB;
vfmt->Vertex2fv = choose_Vertex2fv;
vfmt->Vertex3f = choose_Vertex3f;
vfmt->Vertex3fv = choose_Vertex3fv;
+
+ /* TODO: restore ubyte colors to vtxfmt.
+ */
+#if 0
+ vfmt->Color3ub = choose_Color3ub;
+ vfmt->Color3ubv = choose_Color3ubv;
+ vfmt->Color4ub = choose_Color4ub;
+ vfmt->Color4ubv = choose_Color4ubv;
+ vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT;
+ vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT;
+#endif
}
-# $Id: Makefile.X11,v 1.3 2003/10/21 06:05:49 jonsmirl Exp $
# Mesa 3-D graphics library
# Version: 5.0
NULL
};
-extern const struct gl_pipeline_stage _radeon_texrect_stage;
-extern const struct gl_pipeline_stage _radeon_render_stage;
-extern const struct gl_pipeline_stage _radeon_tcl_stage;
+extern const struct tnl_pipeline_stage _radeon_texrect_stage;
+extern const struct tnl_pipeline_stage _radeon_render_stage;
+extern const struct tnl_pipeline_stage _radeon_tcl_stage;
-static const struct gl_pipeline_stage *radeon_pipeline[] = {
+static const struct tnl_pipeline_stage *radeon_pipeline[] = {
/* Try and go straight to t&l
*/
radeonInitState( rmesa );
radeonInitSwtcl( ctx );
+ _mesa_vector4f_alloc( &rmesa->tcl.ObjClean, 0,
+ ctx->Const.MaxArrayLockSize, 32 );
+
fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode");
rmesa->iw.irq_seq = -1;
rmesa->irqsEmitted = 0;
rmesa->glCtx->DriverCtx = NULL;
_mesa_destroy_context( rmesa->glCtx );
+ _mesa_vector4f_free( &rmesa->tcl.ObjClean );
+
if (rmesa->state.scissor.pClipRects) {
FREE(rmesa->state.scissor.pClipRects);
rmesa->state.scissor.pClipRects = 0;
#include "radeon_screen.h"
#include "mm.h"
+#include "math/m_vector.h"
+
/* Flags for software fallback cases */
/* See correponding strings in radeon_swtcl.c */
#define RADEON_FALLBACK_TEXTURE 0x0001
GLint last_offset;
GLuint hw_primitive;
+ /* Temporary for cases where incoming vertex data is incompatible
+ * with maos code.
+ */
+ GLvector4f ObjClean;
+
struct radeon_dma_region *aos_components[8];
GLuint nr_aos_components;
GLuint Fallback;
GLuint NewGLState;
-
- /* Temporaries for translating away float colors:
- */
- struct gl_client_array UbyteColor;
- struct gl_client_array UbyteSecondaryColor;
-
/* Vertex buffers
*/
struct radeon_ioctl ioctl;
void *dest )
{
LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
+ struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
GLuint (*tc0)[4], (*tc1)[4], (*tc2)[4];
+ GLfloat (*col)[4], (*spec)[4];
GLfloat (*fog)[4];
GLuint (*norm)[4];
- GLubyte (*col)[4], (*spec)[4];
GLuint tc0_stride, tc1_stride, col_stride, spec_stride, fog_stride;
GLuint tc2_stride, norm_stride;
+ GLuint fill_tex = 0;
GLuint (*coord)[4];
GLuint coord_stride; /* object coordinates */
GLubyte dummy[4];
if (RADEON_DEBUG & DEBUG_VERTS)
fprintf(stderr, "%s\n", __FUNCTION__);
- /* The vertex code expects Obj to be clean to element 3. To fix
- * this, add more vertex code (for obj-2, obj-3) or preferably move
- * to maos.
- */
- if (VB->ObjPtr->size < 3) {
- if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 2 );
- }
-
- if (DO_W && VB->ObjPtr->size < 4) {
- if (VB->ObjPtr->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_BIT_POS, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->ObjPtr, VB->Count, 3 );
- }
-
coord = (GLuint (*)[4])VB->ObjPtr->data;
coord_stride = VB->ObjPtr->stride;
if (DO_TEX2) {
- const GLuint t2 = GET_TEXSOURCE(2);
- tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data;
- tc2_stride = VB->TexCoordPtr[t2]->stride;
- if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) {
- if (VB->TexCoordPtr[t2]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_BIT_TEX2, VEC_NOT_WRITEABLE );
+ if (VB->TexCoordPtr[2]) {
+ const GLuint t2 = GET_TEXSOURCE(2);
+ tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data;
+ tc2_stride = VB->TexCoordPtr[t2]->stride;
+ if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) {
+ fill_tex |= (1<<2);
}
- _mesa_vector4f_clean_elem( VB->TexCoordPtr[t2], VB->Count, 3 );
+ } else {
+ tc2 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX2];
+ tc2_stride = 0;
}
}
tc1 = (GLuint (*)[4])VB->TexCoordPtr[t1]->data;
tc1_stride = VB->TexCoordPtr[t1]->stride;
if (DO_PTEX && VB->TexCoordPtr[t1]->size < 4) {
- if (VB->TexCoordPtr[t1]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_BIT_TEX1, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->TexCoordPtr[t1], VB->Count, 3 );
+ fill_tex |= (1<<1);
}
} else {
- tc1 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX1]; /* could be anything, really */
+ tc1 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX1];
tc1_stride = 0;
}
}
tc0_stride = VB->TexCoordPtr[t0]->stride;
tc0 = (GLuint (*)[4])VB->TexCoordPtr[t0]->data;
if (DO_PTEX && VB->TexCoordPtr[t0]->size < 4) {
- if (VB->TexCoordPtr[t0]->flags & VEC_NOT_WRITEABLE) {
- VB->import_data( ctx, VERT_BIT_TEX0, VEC_NOT_WRITEABLE );
- }
- _mesa_vector4f_clean_elem( VB->TexCoordPtr[t0], VB->Count, 3 );
+ fill_tex |= (1<<0);
}
} else {
- tc0 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX0]; /* could be anything, really */
+ tc0 = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_TEX0];
tc0_stride = 0;
}
if (DO_RGBA) {
if (VB->ColorPtr[0]) {
- /* This is incorrect when colormaterial is enabled:
- */
- if (VB->ColorPtr[0]->Type != GL_UNSIGNED_BYTE) {
- if (0) fprintf(stderr, "IMPORTING FLOAT COLORS\n");
- IMPORT_FLOAT_COLORS( ctx );
- }
- col = (GLubyte (*)[4])VB->ColorPtr[0]->Ptr;
- col_stride = VB->ColorPtr[0]->StrideB;
+ col = VB->ColorPtr[0]->data;
+ col_stride = VB->ColorPtr[0]->stride;
} else {
- col = &dummy; /* any old memory is fine */
+ col = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
col_stride = 0;
}
}
if (DO_SPEC) {
if (VB->SecondaryColorPtr[0]) {
- if (VB->SecondaryColorPtr[0]->Type != GL_UNSIGNED_BYTE)
- IMPORT_FLOAT_SPEC_COLORS( ctx );
- spec = (GLubyte (*)[4])VB->SecondaryColorPtr[0]->Ptr;
- spec_stride = VB->SecondaryColorPtr[0]->StrideB;
+ spec = VB->SecondaryColorPtr[0]->data;
+ spec_stride = VB->SecondaryColorPtr[0]->stride;
} else {
- spec = &dummy;
+ spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
spec_stride = 0;
}
}
}
- if (VB->importable_data) {
- if (start) {
- coord = (GLuint (*)[4])((GLubyte *)coord + start * coord_stride);
- if (DO_TEX0)
- tc0 = (GLuint (*)[4])((GLubyte *)tc0 + start * tc0_stride);
- if (DO_TEX1)
- tc1 = (GLuint (*)[4])((GLubyte *)tc1 + start * tc1_stride);
- if (DO_TEX2)
- tc2 = (GLuint (*)[4])((GLubyte *)tc2 + start * tc2_stride);
- if (DO_NORM)
- norm = (GLuint (*)[4])((GLubyte *)norm + start * norm_stride);
- if (DO_RGBA)
- STRIDE_4UB(col, start * col_stride);
- if (DO_SPEC)
- STRIDE_4UB(spec, start * spec_stride);
- if (DO_FOG)
- fog = (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride);
- }
+ if (start) {
+ coord = (GLuint (*)[4])((GLubyte *)coord + start * coord_stride);
+ if (DO_TEX0)
+ tc0 = (GLuint (*)[4])((GLubyte *)tc0 + start * tc0_stride);
+ if (DO_TEX1)
+ tc1 = (GLuint (*)[4])((GLubyte *)tc1 + start * tc1_stride);
+ if (DO_TEX2)
+ tc2 = (GLuint (*)[4])((GLubyte *)tc2 + start * tc2_stride);
+ if (DO_NORM)
+ norm = (GLuint (*)[4])((GLubyte *)norm + start * norm_stride);
+ if (DO_RGBA)
+ STRIDE_4F(col, start * col_stride);
+ if (DO_SPEC)
+ STRIDE_4F(spec, start * spec_stride);
+ if (DO_FOG)
+ STRIDE_4F(fog, start * fog_stride);
+ }
+
+ {
for (i=start; i < end; i++) {
+
v[0].ui = coord[0][0];
v[1].ui = coord[0][1];
v[2].ui = coord[0][2];
- if (TCL_DEBUG) fprintf(stderr, "%d: %.2f %.2f %.2f ", i, v[0].f, v[1].f, v[2].f);
if (DO_W) {
v[3].ui = coord[0][3];
- if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[3].f);
v += 4;
}
else
v[0].ui = norm[0][0];
v[1].ui = norm[0][1];
v[2].ui = norm[0][2];
- if (TCL_DEBUG) fprintf(stderr, "norm: %.2f %.2f %.2f ", v[0].f, v[1].f, v[2].f);
v += 3;
norm = (GLuint (*)[4])((GLubyte *)norm + norm_stride);
}
if (DO_RGBA) {
- v[0].ui = LE32_TO_CPU(*(GLuint *)&col[0]);
- STRIDE_4UB(col, col_stride);
- if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui);
+ UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.red, col[0][0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.green, col[0][1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.blue, col[0][2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.alpha, col[0][3]);
+ STRIDE_4F(col, col_stride);
v++;
}
if (DO_SPEC || DO_FOG) {
if (DO_SPEC) {
- v[0].specular.red = spec[0][0];
- v[0].specular.green = spec[0][1];
- v[0].specular.blue = spec[0][2];
- STRIDE_4UB(spec, spec_stride);
+ UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.red, spec[0][0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.green, spec[0][1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.blue, spec[0][2]);
+ STRIDE_4F(spec, spec_stride);
}
if (DO_FOG) {
- v[0].specular.alpha = fog[0][0] * 255.0;
- fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride);
+ UNCLAMPED_FLOAT_TO_UBYTE(v[0].rgba.alpha, fog[0][0]);
+ fog = (GLfloat (*)[4])((GLubyte *)fog + fog_stride);
}
if (TCL_DEBUG) fprintf(stderr, "%x ", v[0].ui);
v++;
v[1].ui = tc0[0][1];
if (TCL_DEBUG) fprintf(stderr, "t0: %.2f %.2f ", v[0].f, v[1].f);
if (DO_PTEX) {
- v[2].ui = tc0[0][3];
+ if (fill_tex & (1<<0))
+ v[2].f = 1.0;
+ else
+ v[2].ui = tc0[0][3];
if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f);
v += 3;
}
v[1].ui = tc1[0][1];
if (TCL_DEBUG) fprintf(stderr, "t1: %.2f %.2f ", v[0].f, v[1].f);
if (DO_PTEX) {
- v[2].ui = tc1[0][3];
+ if (fill_tex & (1<<1))
+ v[2].f = 1.0;
+ else
+ v[2].ui = tc1[0][3];
if (TCL_DEBUG) fprintf(stderr, "%.2f ", v[2].f);
v += 3;
}
v[0].ui = tc2[0][0];
v[1].ui = tc2[0][1];
if (DO_PTEX) {
- v[2].ui = tc2[0][3];
+ if (fill_tex & (1<<2))
+ v[2].f = 1.0;
+ else
+ v[2].ui = tc2[0][3];
v += 3;
}
else
}
if (TCL_DEBUG) fprintf(stderr, "\n");
}
- } else {
- for (i=start; i < end; i++) {
- v[0].ui = coord[i][0];
- v[1].ui = coord[i][1];
- v[2].ui = coord[i][2];
- if (DO_W) {
- v[3].ui = coord[i][3];
- v += 4;
- }
- else
- v += 3;
-
- if (DO_NORM) {
- v[0].ui = norm[i][0];
- v[1].ui = norm[i][1];
- v[2].ui = norm[i][2];
- v += 3;
- }
- if (DO_RGBA) {
- v[0].ui = LE32_TO_CPU(*(GLuint *)&col[i]);
- v++;
- }
- if (DO_SPEC || DO_FOG) {
- if (DO_SPEC) {
- v[0].specular.red = spec[i][0];
- v[0].specular.green = spec[i][1];
- v[0].specular.blue = spec[i][2];
- }
- if (DO_FOG) {
- GLfloat *f = (GLfloat *) ((GLubyte *)fog + fog_stride);
- v[0].specular.alpha = *f * 255.0;
- }
- v++;
- }
- if (DO_TEX0) {
- v[0].ui = tc0[i][0];
- v[1].ui = tc0[i][1];
- if (DO_PTEX) {
- v[2].ui = tc0[i][3];
- v += 3;
- }
- else
- v += 2;
- }
- if (DO_TEX1) {
- v[0].ui = tc1[i][0];
- v[1].ui = tc1[i][1];
- if (DO_PTEX) {
- v[2].ui = tc1[i][3];
- v += 3;
- }
- else
- v += 2;
- }
- if (DO_TEX2) {
- v[0].ui = tc2[i][0];
- v[1].ui = tc2[i][1];
- if (DO_PTEX) {
- v[2].ui = tc2[i][3];
- v += 3;
- }
- else
- v += 2;
- }
- }
}
}
#include "array_cache/acache.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
-#include "tnl/t_imm_debug.h"
#include "radeon_context.h"
#include "radeon_state.h"
#define RADEON_TCL_MAX_SETUP 13
-union emit_union { float f; GLuint ui; radeon_color_t specular; };
+union emit_union { float f; GLuint ui; radeon_color_t rgba; };
static struct {
void (*emit)( GLcontext *, GLuint, GLuint, void * );
setup_tab[i].vertex_size * 4,
4);
+ /* The vertex code expects Obj to be clean to element 3. To fix
+ * this, add more vertex code (for obj-2, obj-3) or preferably move
+ * to maos.
+ */
+ if (VB->ObjPtr->size < 3 ||
+ (VB->ObjPtr->size == 3 &&
+ (setup_tab[i].vertex_format & RADEON_CP_VC_FRMT_W0))) {
+
+ _math_trans_4f( rmesa->tcl.ObjClean.data,
+ VB->ObjPtr->data,
+ VB->ObjPtr->stride,
+ GL_FLOAT,
+ VB->ObjPtr->size,
+ 0,
+ VB->Count );
+
+ switch (VB->ObjPtr->size) {
+ case 1:
+ _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 1);
+ case 2:
+ _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 2);
+ case 3:
+ if (setup_tab[i].vertex_format & RADEON_CP_VC_FRMT_W0) {
+ _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 3);
+ }
+ case 4:
+ default:
+ break;
+ }
+
+ VB->ObjPtr = &rmesa->tcl.ObjClean;
+ }
+
+
+
setup_tab[i].emit( ctx, 0, VB->Count,
rmesa->tcl.indexed_verts.address +
rmesa->tcl.indexed_verts.start );
radeonVtxfmtInvalidate( ctx );
}
+
+/* A hack. Need a faster way to find this out.
+ */
+static GLboolean check_material( GLcontext *ctx )
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ GLint i;
+
+ for (i = _TNL_ATTRIB_MAT_FRONT_AMBIENT;
+ i < _TNL_ATTRIB_MAT_BACK_INDEXES;
+ i++)
+ if (tnl->vb.AttribPtr[i] &&
+ tnl->vb.AttribPtr[i]->stride)
+ return GL_TRUE;
+
+ return GL_FALSE;
+}
+
+
static void radeonWrapRunPipeline( GLcontext *ctx )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
+ GLboolean has_material;
if (0)
fprintf(stderr, "%s, newstate: %x\n", __FUNCTION__, rmesa->NewGLState);
if (rmesa->NewGLState)
radeonValidateState( ctx );
- if (tnl->vb.Material) {
+ has_material = (ctx->Light.Enabled && check_material( ctx ));
+
+ if (has_material) {
TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_MATERIAL, GL_TRUE );
}
*/
_tnl_run_pipeline( ctx );
- if (tnl->vb.Material) {
+ if (has_material) {
TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_MATERIAL, GL_FALSE );
radeonUpdateMaterial( ctx ); /* not needed any more? */
}
#include "math/m_translate.h"
#include "tnl/tnl.h"
#include "tnl/t_context.h"
-#include "tnl/t_imm_exec.h"
#include "tnl/t_pipeline.h"
+#include "tnl/t_vtx_api.h" /* for _tnl_FlushVertices */
#include "radeon_context.h"
#include "radeon_ioctl.h"
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabVerts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
+ RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_POS;
}
static void ELT_FALLBACK( GLcontext *ctx,
tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK );
tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 );
tnl->Driver.Render.PrimTabElts[flags&PRIM_MODE_MASK]( ctx, start, count, flags );
- RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_CLIP;
+ RADEON_CONTEXT(ctx)->swtcl.SetupNewInputs = VERT_BIT_POS;
}
static GLboolean radeon_run_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
return GL_TRUE; /* too many vertices */
}
- for (i = 0 ; !(flags & PRIM_LAST) ; i += length)
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
+
+ if (!length)
+ continue;
if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "radeon_render.c: prim %s %d..%d\n",
- _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK),
- i, i+length);
+ fprintf(stderr, "r200_render.c: prim %s %d..%d\n",
+ _mesa_lookup_enum_by_nr(prim & PRIM_MODE_MASK),
+ start, start+length);
if (length)
- tab[flags & PRIM_MODE_MASK]( ctx, i, i + length, flags );
+ tab[prim & PRIM_MODE_MASK]( ctx, start, start + length, flags );
}
tnl->Driver.Render.Finish( ctx );
static void radeon_check_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
- GLuint inputs = VERT_BIT_POS | VERT_BIT_CLIP | VERT_BIT_COLOR0;
+ GLuint inputs = VERT_BIT_POS | VERT_BIT_COLOR0;
if (ctx->RenderMode == GL_RENDER) {
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
-const struct gl_pipeline_stage _radeon_render_stage =
+const struct tnl_pipeline_stage _radeon_render_stage =
{
"radeon render",
(_DD_NEW_SEPARATE_SPECULAR |
static GLboolean run_texrect_stage( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
/* Called the first time stage->run() is invoked.
*/
static GLboolean alloc_texrect_data( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct texrect_stage_data *store;
static void check_texrect( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
GLuint flags = 0;
}
-static void free_texrect_data( struct gl_pipeline_stage *stage )
+static void free_texrect_data( struct tnl_pipeline_stage *stage )
{
struct texrect_stage_data *store = TEXRECT_STAGE_DATA(stage);
GLuint i;
}
-const struct gl_pipeline_stage _radeon_texrect_stage =
+const struct tnl_pipeline_stage _radeon_texrect_stage =
{
"radeon texrect stage", /* name */
_NEW_TEXTURE, /* check_state */
void radeonFlushVertices( GLcontext *ctx, GLuint flags )
{
- _tnl_flush_vertices( ctx, flags );
+ _tnl_FlushVertices( ctx, flags );
if (flags & FLUSH_STORED_VERTICES)
RADEON_NEWPRIM( RADEON_CONTEXT( ctx ) );
rmesa->swtcl.verts = 0;
}
- if (rmesa->UbyteSecondaryColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteSecondaryColor.Ptr);
- rmesa->UbyteSecondaryColor.Ptr = 0;
- }
-
- if (rmesa->UbyteColor.Ptr) {
- ALIGN_FREE(rmesa->UbyteColor.Ptr);
- rmesa->UbyteColor.Ptr = 0;
- }
}
/* TCL render.
*/
static GLboolean radeon_run_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
rmesa->tcl.Elts = VB->Elts;
- for (i = VB->FirstPrimitive ; !(flags & PRIM_LAST) ; i += length)
+ for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
- flags = VB->Primitive[i];
- length = VB->PrimitiveLength[i];
-
- if (RADEON_DEBUG & DEBUG_PRIMS)
- fprintf(stderr, "%s: prim %s %d..%d\n",
- __FUNCTION__,
- _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK),
- i, i+length);
+ GLuint prim = VB->Primitive[i].mode;
+ GLuint start = VB->Primitive[i].start;
+ GLuint length = VB->Primitive[i].count;
if (!length)
continue;
if (rmesa->tcl.Elts)
- radeonEmitEltPrimitive( ctx, i, i+length, flags );
+ radeonEmitEltPrimitive( ctx, start, start+length, prim );
else
- radeonEmitPrimitive( ctx, i, i+length, flags );
+ radeonEmitPrimitive( ctx, start, start+length, prim );
}
return GL_FALSE; /* finished the pipe */
static void radeon_check_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLuint inputs = VERT_BIT_POS;
}
static void radeon_init_tcl_render( GLcontext *ctx,
- struct gl_pipeline_stage *stage )
+ struct tnl_pipeline_stage *stage )
{
stage->check = radeon_check_tcl_render;
stage->check( ctx, stage );
}
-static void dtr( struct gl_pipeline_stage *stage )
+static void dtr( struct tnl_pipeline_stage *stage )
{
(void)stage;
}
/* Initial state for tcl stage.
*/
-const struct gl_pipeline_stage _radeon_tcl_stage =
+const struct tnl_pipeline_stage _radeon_tcl_stage =
{
"radeon render",
(_DD_NEW_SEPARATE_SPECULAR |
vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
vfmt->EdgeFlagv = _mesa_noop_EdgeFlagv;
- vfmt->Indexi = _mesa_noop_Indexi;
- vfmt->Indexiv = _mesa_noop_Indexiv;
+ vfmt->Indexf = _mesa_noop_Indexf;
+ vfmt->Indexfv = _mesa_noop_Indexfv;
/* Active but unsupported -- fallback if we receive these:
*/
vfmt->CallList = radeon_fallback_CallList;
+ vfmt->CallLists = radeon_fallback_CallLists;
vfmt->EvalCoord1f = radeon_fallback_EvalCoord1f;
vfmt->EvalCoord1fv = radeon_fallback_EvalCoord1fv;
vfmt->EvalCoord2f = radeon_fallback_EvalCoord2f;
{
vfmt->Color3f = choose_Color3f;
vfmt->Color3fv = choose_Color3fv;
- vfmt->Color3ub = choose_Color3ub;
- vfmt->Color3ubv = choose_Color3ubv;
vfmt->Color4f = choose_Color4f;
vfmt->Color4fv = choose_Color4fv;
- vfmt->Color4ub = choose_Color4ub;
- vfmt->Color4ubv = choose_Color4ubv;
vfmt->SecondaryColor3fEXT = choose_SecondaryColor3fEXT;
vfmt->SecondaryColor3fvEXT = choose_SecondaryColor3fvEXT;
- vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT;
- vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT;
vfmt->MultiTexCoord1fARB = choose_MultiTexCoord1fARB;
vfmt->MultiTexCoord1fvARB = choose_MultiTexCoord1fvARB;
vfmt->MultiTexCoord2fARB = choose_MultiTexCoord2fARB;
vfmt->Vertex2fv = choose_Vertex2fv;
vfmt->Vertex3f = choose_Vertex3f;
vfmt->Vertex3fv = choose_Vertex3fv;
+
+#if 0
+ vfmt->Color3ub = choose_Color3ub;
+ vfmt->Color3ubv = choose_Color3ubv;
+ vfmt->Color4ub = choose_Color4ub;
+ vfmt->Color4ubv = choose_Color4ubv;
+ vfmt->SecondaryColor3ubEXT = choose_SecondaryColor3ubEXT;
+ vfmt->SecondaryColor3ubvEXT = choose_SecondaryColor3ubvEXT;
+#endif
}
-# $Id: Makefile.X11,v 1.2 2003/10/20 02:17:33 jonsmirl Exp $
# Mesa 3-D graphics library
# Version: 5.0
if (!newinputs)
return;
- if (newinputs & VERT_BIT_CLIP) {
+ if (newinputs & VERT_BIT_POS) {
setup_tab[smesa->SetupIndex].emit( ctx, start, count, v, stride );
} else {
GLuint ind = 0;
}
}
-static const struct gl_pipeline_stage *fx_pipeline[] = {
+static const struct tnl_pipeline_stage *fx_pipeline[] = {
&_tnl_vertex_transform_stage, /* TODO: Add the fastpath here */
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
if (!newinputs)
return;
- if (newinputs & VERT_BIT_CLIP) {
+ if (newinputs & VERT_BIT_POS) {
setup_tab[fxMesa->SetupIndex].emit( ctx, start, count, v );
} else {
GLuint ind = 0;
-/* $Id: wmesa.c,v 1.2 2003/11/04 23:37:53 brianp Exp $ */
/*
* Windows (Win32) device driver for Mesa 3.4