summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/gamma
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2003-11-24 15:21:14 +0000
committerKeith Whitwell <[email protected]>2003-11-24 15:21:14 +0000
commit57c9814b9e87924696df4c741861c29d4236d1eb (patch)
tree63c9139693032c681fad3e7b50d743b762e0a64d /src/mesa/drivers/dri/gamma
parent5b5cf9cb8b3f540365e3da8e4a70f6a5040a1c6c (diff)
Import vtx-0-2-branch
Diffstat (limited to 'src/mesa/drivers/dri/gamma')
-rw-r--r--src/mesa/drivers/dri/gamma/Makefile.X112
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_context.c4
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_render.c102
-rw-r--r--src/mesa/drivers/dri/gamma/gamma_vb.c2
4 files changed, 30 insertions, 80 deletions
diff --git a/src/mesa/drivers/dri/gamma/Makefile.X11 b/src/mesa/drivers/dri/gamma/Makefile.X11
index f779bf336cc..8364ebaecf0 100644
--- a/src/mesa/drivers/dri/gamma/Makefile.X11
+++ b/src/mesa/drivers/dri/gamma/Makefile.X11
@@ -1,4 +1,4 @@
-# $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
diff --git a/src/mesa/drivers/dri/gamma/gamma_context.c b/src/mesa/drivers/dri/gamma/gamma_context.c
index f7db2adea37..b27851be8f8 100644
--- a/src/mesa/drivers/dri/gamma/gamma_context.c
+++ b/src/mesa/drivers/dri/gamma/gamma_context.c
@@ -48,9 +48,9 @@
#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,
diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c
index b8bf6171564..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]);
- }
}
}
}
@@ -178,7 +124,7 @@ static void VERT_FALLBACK( GLcontext *ctx,
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] = {
@@ -236,7 +182,7 @@ static __inline void gammaEndPrimitive( gammaContextPtr gmesa )
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);
@@ -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 );
@@ -271,9 +221,9 @@ static GLboolean gamma_run_render( GLcontext *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)
@@ -293,13 +243,13 @@ static void gamma_check_render( GLcontext *ctx,
}
-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 |
diff --git a/src/mesa/drivers/dri/gamma/gamma_vb.c b/src/mesa/drivers/dri/gamma/gamma_vb.c
index 2e2f9ede457..f4ed08b140f 100644
--- a/src/mesa/drivers/dri/gamma/gamma_vb.c
+++ b/src/mesa/drivers/dri/gamma/gamma_vb.c
@@ -278,7 +278,7 @@ void gammaBuildVertices( GLcontext *ctx,
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;