summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2003-11-21 16:41:14 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2003-11-21 16:41:14 +0000
commit3a7c3b02a38ce4707effbd5ac1ca5c07a9d3e8a4 (patch)
tree774d35dd139b75e17fc4e4ac0985afd39e6379ce
parent3ec97611d2dc04e27c2ab6a9b1c15ac0bbd0b589 (diff)
fixup gamma_render.c
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_render.c90
1 files changed, 20 insertions, 70 deletions
diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c
index d05db931dea..67063c2e525 100644
--- a/src/mesa/drivers/dri/gamma/gamma_render.c
+++ b/src/mesa/drivers/dri/gamma/gamma_render.c
@@ -46,18 +46,15 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
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;
@@ -70,58 +67,8 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
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]);
@@ -132,9 +79,9 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
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]);
@@ -143,15 +90,14 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end)
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]);
- }
}
}
}
@@ -256,12 +202,16 @@ static GLboolean gamma_run_render( GLcontext *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 );