From da99cded2609312feeb656979b0c26328ed7294a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 10 May 2000 22:36:05 +0000 Subject: [PATCH] fixed PB bugs, removed MutablePixels, MonoPixels from GLcontext --- src/mesa/main/lines.c | 90 ++++++++++++++++-------------------------- src/mesa/main/points.c | 50 ++++++++++++++++++++--- src/mesa/main/state.c | 21 ++-------- 3 files changed, 81 insertions(+), 80 deletions(-) diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c index ba877a85e19..28f9e38fbf5 100644 --- a/src/mesa/main/lines.c +++ b/src/mesa/main/lines.c @@ -1,4 +1,4 @@ -/* $Id: lines.c,v 1.9 2000/03/03 18:55:45 brianp Exp $ */ +/* $Id: lines.c,v 1.10 2000/05/10 22:36:05 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -116,22 +116,13 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) static void flat_ci_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); - count = ctx->PB->count; + PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); #define INTERP_XY 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -141,25 +132,14 @@ static void flat_ci_line( GLcontext *ctx, static void flat_ci_z_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - GLdepth *pbz = ctx->PB->z; - PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); - count = ctx->PB->count; + PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); #define INTERP_XY 1 #define INTERP_Z 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -169,23 +149,14 @@ static void flat_ci_z_line( GLcontext *ctx, static void flat_rgba_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - GLubyte *color = ctx->VB->ColorPtr->data[pvert]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); - count = ctx->PB->count; + const GLubyte *color = ctx->VB->ColorPtr->data[pvert]; + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); #define INTERP_XY 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -195,26 +166,15 @@ static void flat_rgba_line( GLcontext *ctx, static void flat_rgba_z_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - GLdepth *pbz = ctx->PB->z; - GLubyte *color = ctx->VB->ColorPtr->data[pvert]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); - count = ctx->PB->count; + const GLubyte *color = ctx->VB->ColorPtr->data[pvert]; + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); #define INTERP_XY 1 #define INTERP_Z 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -227,9 +187,11 @@ static void smooth_ci_line( GLcontext *ctx, GLint count = ctx->PB->count; GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; - GLuint *pbi = ctx->PB->i; + GLuint *pbi = ctx->PB->index; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_INDEX 1 @@ -255,9 +217,11 @@ static void smooth_ci_z_line( GLcontext *ctx, GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; - GLuint *pbi = ctx->PB->i; + GLuint *pbi = ctx->PB->index; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_INDEX 1 @@ -287,6 +251,8 @@ static void smooth_rgba_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -319,6 +285,8 @@ static void smooth_rgba_z_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_RGB 1 @@ -358,9 +326,11 @@ static void general_smooth_ci_line( GLcontext *ctx, GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; - GLuint *pbi = ctx->PB->i; + GLuint *pbi = ctx->PB->index; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -430,7 +400,7 @@ static void general_flat_ci_line( GLcontext *ctx, GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; - PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); + PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); count = ctx->PB->count; if (ctx->Line.StippleFlag) { @@ -498,6 +468,8 @@ static void general_smooth_rgba_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -590,7 +562,7 @@ static void general_flat_rgba_line( GLcontext *ctx, GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; GLubyte *color = ctx->VB->ColorPtr->data[pvert]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); count = ctx->PB->count; if (ctx->Line.StippleFlag) { @@ -659,7 +631,7 @@ static void flat_textured_line( GLcontext *ctx, GLfloat *pbt = ctx->PB->t[0]; GLfloat *pbu = ctx->PB->u[0]; GLubyte *color = ctx->VB->ColorPtr->data[pv]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); count = ctx->PB->count; if (ctx->Line.StippleFlag) { @@ -722,6 +694,8 @@ static void smooth_textured_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -799,6 +773,8 @@ static void smooth_multitextured_line( GLcontext *ctx, GLubyte (*pbspec)[3] = ctx->PB->spec; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index cffb66c67c0..1a6e9a9c30f 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -1,4 +1,4 @@ -/* $Id: points.c,v 1.8 2000/05/07 23:18:54 brianp Exp $ */ +/* $Id: points.c,v 1.9 2000/05/10 22:36:05 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -156,7 +156,7 @@ size1_ci_points( GLcontext *ctx, GLuint first, GLuint last ) GLfloat *win; GLint *pbx = PB->x, *pby = PB->y; GLdepth *pbz = PB->z; - GLuint *pbi = PB->i; + GLuint *pbi = PB->index; GLuint pbcount = PB->count; GLuint i; @@ -245,7 +245,7 @@ general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) y1 = y0 + isize - 1; } - PB_SET_INDEX( ctx, PB, VB->IndexPtr->data[i] ); + PB_SET_INDEX( PB, VB->IndexPtr->data[i] ); for (iy = y0; iy <= y1; iy++) { for (ix = x0; ix <= x1; ix++) { @@ -294,7 +294,7 @@ general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) y1 = y0 + isize - 1; } - PB_SET_COLOR( ctx, PB, + PB_SET_COLOR( PB, VB->ColorPtr->data[i][0], VB->ColorPtr->data[i][1], VB->ColorPtr->data[i][2], @@ -832,7 +832,7 @@ dist_atten_general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) y1 = y0 + isize - 1; } - PB_SET_INDEX( ctx, PB, VB->IndexPtr->data[i] ); + PB_SET_INDEX( PB, VB->IndexPtr->data[i] ); for (iy=y0;iy<=y1;iy++) { for (ix=x0;ix<=x1;ix++) { @@ -898,7 +898,7 @@ dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) y1 = y0 + isize - 1; } - PB_SET_COLOR( ctx, PB, + PB_SET_COLOR( PB, VB->ColorPtr->data[i][0], VB->ColorPtr->data[i][1], VB->ColorPtr->data[i][2], @@ -1264,6 +1264,43 @@ dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) } +#ifdef DEBUG +void +_mesa_print_points_function(GLcontext *ctx) +{ + printf("Point Func == "); + if (ctx->Driver.PointsFunc == size1_ci_points) + printf("size1_ci_points\n"); + else if (ctx->Driver.PointsFunc == size1_rgba_points) + printf("size1_rgba_points\n"); + else if (ctx->Driver.PointsFunc == general_ci_points) + printf("general_ci_points\n"); + else if (ctx->Driver.PointsFunc == general_rgba_points) + printf("general_rgba_points\n"); + else if (ctx->Driver.PointsFunc == textured_rgba_points) + printf("textured_rgba_points\n"); + else if (ctx->Driver.PointsFunc == multitextured_rgba_points) + printf("multitextured_rgba_points\n"); + else if (ctx->Driver.PointsFunc == antialiased_rgba_points) + printf("antialiased_rgba_points\n"); + else if (ctx->Driver.PointsFunc == null_points) + printf("null_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_general_ci_points) + printf("dist_atten_general_ci_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_general_rgba_points) + printf("dist_atten_general_rgba_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_textured_rgba_points) + printf("dist_atten_textured_rgba_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_antialiased_rgba_points) + printf("dist_atten_antialiased_rgba_points\n"); + else if (!ctx->Driver.PointsFunc) + printf("NULL\n"); + else + printf("Driver func %p\n", ctx->Driver.PointsFunc); +} +#endif + + /* * Examine the current context to determine which point drawing function * should be used. @@ -1332,5 +1369,6 @@ void gl_set_point_function( GLcontext *ctx ) ctx->Driver.PointsFunc = gl_select_points; } + /*_mesa_print_points_function(ctx);*/ } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 87e1137967f..ead81566c88 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.11 2000/05/04 14:09:41 brianp Exp $ */ +/* $Id: state.c,v 1.12 2000/05/10 22:36:05 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -798,6 +798,7 @@ static void update_rasterflags( GLcontext *ctx ) if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT; if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT; if (ctx->Color.SWmasking) ctx->RasterMask |= MASKING_BIT; + if (ctx->Texture.ReallyEnabled) ctx->RasterMask |= TEXTURE_BIT; if (ctx->DrawBuffer->UseSoftwareAlphaBuffers && ctx->Color.ColorMask[ACOMP] @@ -968,10 +969,9 @@ void gl_update_state( GLcontext *ctx ) ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals); } - if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING | NEW_FOG)) { + if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING | NEW_FOG | NEW_TEXTURE_ENABLE)) { - - if (ctx->NewState & NEW_RASTER_OPS) { + if (ctx->NewState & (NEW_RASTER_OPS | NEW_TEXTURE_ENABLE)) { update_pixel_logic(ctx); update_pixel_masking(ctx); update_fog_mode(ctx); @@ -980,20 +980,7 @@ void gl_update_state( GLcontext *ctx ) (*ctx->Driver.Dither)( ctx, ctx->Color.DitherFlag ); } - /* Check if incoming colors can be modified during rasterization */ - if (ctx->Fog.Enabled || - ctx->Texture.Enabled || - ctx->Color.BlendEnabled || - ctx->Color.SWmasking || - ctx->Color.SWLogicOpEnabled) { - ctx->MutablePixels = GL_TRUE; - } - else { - ctx->MutablePixels = GL_FALSE; - } - /* update scissor region */ - ctx->DrawBuffer->Xmin = 0; ctx->DrawBuffer->Ymin = 0; ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width-1; -- 2.30.2