fixed PB bugs, removed MutablePixels, MonoPixels from GLcontext

This commit is contained in:
Brian Paul
2000-05-10 22:36:05 +00:00
parent 7a39d2f833
commit da99cded26
3 changed files with 81 additions and 80 deletions

View File

@@ -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 * Mesa 3-D graphics library
@@ -116,22 +116,13 @@ _mesa_LineStipple( GLint factor, GLushort pattern )
static void flat_ci_line( GLcontext *ctx, static void flat_ci_line( GLcontext *ctx,
GLuint vert0, GLuint vert1, GLuint pvert ) GLuint vert0, GLuint vert1, GLuint pvert )
{ {
GLint count; PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
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;
#define INTERP_XY 1 #define INTERP_XY 1
#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0);
#define PLOT(X,Y) \
pbx[count] = X; \
pby[count] = Y; \
count++;
#include "linetemp.h" #include "linetemp.h"
ctx->PB->count = count;
gl_flush_pb(ctx); gl_flush_pb(ctx);
} }
@@ -141,25 +132,14 @@ static void flat_ci_line( GLcontext *ctx,
static void flat_ci_z_line( GLcontext *ctx, static void flat_ci_z_line( GLcontext *ctx,
GLuint vert0, GLuint vert1, GLuint pvert ) GLuint vert0, GLuint vert1, GLuint pvert )
{ {
GLint count; PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] );
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;
#define INTERP_XY 1 #define INTERP_XY 1
#define INTERP_Z 1 #define INTERP_Z 1
#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
#define PLOT(X,Y) \
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
count++;
#include "linetemp.h" #include "linetemp.h"
ctx->PB->count = count;
gl_flush_pb(ctx); gl_flush_pb(ctx);
} }
@@ -169,23 +149,14 @@ static void flat_ci_z_line( GLcontext *ctx,
static void flat_rgba_line( GLcontext *ctx, static void flat_rgba_line( GLcontext *ctx,
GLuint vert0, GLuint vert1, GLuint pvert ) GLuint vert0, GLuint vert1, GLuint pvert )
{ {
GLint count; const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
GLint *pbx = ctx->PB->x; PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
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;
#define INTERP_XY 1 #define INTERP_XY 1
#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0);
#define PLOT(X,Y) \
pbx[count] = X; \
pby[count] = Y; \
count++;
#include "linetemp.h" #include "linetemp.h"
ctx->PB->count = count;
gl_flush_pb(ctx); gl_flush_pb(ctx);
} }
@@ -195,26 +166,15 @@ static void flat_rgba_line( GLcontext *ctx,
static void flat_rgba_z_line( GLcontext *ctx, static void flat_rgba_z_line( GLcontext *ctx,
GLuint vert0, GLuint vert1, GLuint pvert ) GLuint vert0, GLuint vert1, GLuint pvert )
{ {
GLint count; const GLubyte *color = ctx->VB->ColorPtr->data[pvert];
GLint *pbx = ctx->PB->x; PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] );
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;
#define INTERP_XY 1 #define INTERP_XY 1
#define INTERP_Z 1 #define INTERP_Z 1
#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z);
#define PLOT(X,Y) \
pbx[count] = X; \
pby[count] = Y; \
pbz[count] = Z; \
count++;
#include "linetemp.h" #include "linetemp.h"
ctx->PB->count = count;
gl_flush_pb(ctx); gl_flush_pb(ctx);
} }
@@ -227,9 +187,11 @@ static void smooth_ci_line( GLcontext *ctx,
GLint count = ctx->PB->count; GLint count = ctx->PB->count;
GLint *pbx = ctx->PB->x; GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y; GLint *pby = ctx->PB->y;
GLuint *pbi = ctx->PB->i; GLuint *pbi = ctx->PB->index;
(void) pvert; (void) pvert;
ctx->PB->mono = GL_FALSE;
#define INTERP_XY 1 #define INTERP_XY 1
#define INTERP_INDEX 1 #define INTERP_INDEX 1
@@ -255,9 +217,11 @@ static void smooth_ci_z_line( GLcontext *ctx,
GLint *pbx = ctx->PB->x; GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y; GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z; GLdepth *pbz = ctx->PB->z;
GLuint *pbi = ctx->PB->i; GLuint *pbi = ctx->PB->index;
(void) pvert; (void) pvert;
ctx->PB->mono = GL_FALSE;
#define INTERP_XY 1 #define INTERP_XY 1
#define INTERP_Z 1 #define INTERP_Z 1
#define INTERP_INDEX 1 #define INTERP_INDEX 1
@@ -287,6 +251,8 @@ static void smooth_rgba_line( GLcontext *ctx,
GLubyte (*pbrgba)[4] = ctx->PB->rgba; GLubyte (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert; (void) pvert;
ctx->PB->mono = GL_FALSE;
#define INTERP_XY 1 #define INTERP_XY 1
#define INTERP_RGB 1 #define INTERP_RGB 1
#define INTERP_ALPHA 1 #define INTERP_ALPHA 1
@@ -319,6 +285,8 @@ static void smooth_rgba_z_line( GLcontext *ctx,
GLubyte (*pbrgba)[4] = ctx->PB->rgba; GLubyte (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert; (void) pvert;
ctx->PB->mono = GL_FALSE;
#define INTERP_XY 1 #define INTERP_XY 1
#define INTERP_Z 1 #define INTERP_Z 1
#define INTERP_RGB 1 #define INTERP_RGB 1
@@ -358,9 +326,11 @@ static void general_smooth_ci_line( GLcontext *ctx,
GLint *pbx = ctx->PB->x; GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y; GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z; GLdepth *pbz = ctx->PB->z;
GLuint *pbi = ctx->PB->i; GLuint *pbi = ctx->PB->index;
(void) pvert; (void) pvert;
ctx->PB->mono = GL_FALSE;
if (ctx->Line.StippleFlag) { if (ctx->Line.StippleFlag) {
/* stippled */ /* stippled */
#define INTERP_XY 1 #define INTERP_XY 1
@@ -430,7 +400,7 @@ static void general_flat_ci_line( GLcontext *ctx,
GLint *pbx = ctx->PB->x; GLint *pbx = ctx->PB->x;
GLint *pby = ctx->PB->y; GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z; 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; count = ctx->PB->count;
if (ctx->Line.StippleFlag) { if (ctx->Line.StippleFlag) {
@@ -498,6 +468,8 @@ static void general_smooth_rgba_line( GLcontext *ctx,
GLubyte (*pbrgba)[4] = ctx->PB->rgba; GLubyte (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert; (void) pvert;
ctx->PB->mono = GL_FALSE;
if (ctx->Line.StippleFlag) { if (ctx->Line.StippleFlag) {
/* stippled */ /* stippled */
#define INTERP_XY 1 #define INTERP_XY 1
@@ -590,7 +562,7 @@ static void general_flat_rgba_line( GLcontext *ctx,
GLint *pby = ctx->PB->y; GLint *pby = ctx->PB->y;
GLdepth *pbz = ctx->PB->z; GLdepth *pbz = ctx->PB->z;
GLubyte *color = ctx->VB->ColorPtr->data[pvert]; 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; count = ctx->PB->count;
if (ctx->Line.StippleFlag) { if (ctx->Line.StippleFlag) {
@@ -659,7 +631,7 @@ static void flat_textured_line( GLcontext *ctx,
GLfloat *pbt = ctx->PB->t[0]; GLfloat *pbt = ctx->PB->t[0];
GLfloat *pbu = ctx->PB->u[0]; GLfloat *pbu = ctx->PB->u[0];
GLubyte *color = ctx->VB->ColorPtr->data[pv]; 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; count = ctx->PB->count;
if (ctx->Line.StippleFlag) { if (ctx->Line.StippleFlag) {
@@ -722,6 +694,8 @@ static void smooth_textured_line( GLcontext *ctx,
GLubyte (*pbrgba)[4] = ctx->PB->rgba; GLubyte (*pbrgba)[4] = ctx->PB->rgba;
(void) pvert; (void) pvert;
ctx->PB->mono = GL_FALSE;
if (ctx->Line.StippleFlag) { if (ctx->Line.StippleFlag) {
/* stippled */ /* stippled */
#define INTERP_XY 1 #define INTERP_XY 1
@@ -799,6 +773,8 @@ static void smooth_multitextured_line( GLcontext *ctx,
GLubyte (*pbspec)[3] = ctx->PB->spec; GLubyte (*pbspec)[3] = ctx->PB->spec;
(void) pvert; (void) pvert;
ctx->PB->mono = GL_FALSE;
if (ctx->Line.StippleFlag) { if (ctx->Line.StippleFlag) {
/* stippled */ /* stippled */
#define INTERP_XY 1 #define INTERP_XY 1

View File

@@ -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 * Mesa 3-D graphics library
@@ -156,7 +156,7 @@ size1_ci_points( GLcontext *ctx, GLuint first, GLuint last )
GLfloat *win; GLfloat *win;
GLint *pbx = PB->x, *pby = PB->y; GLint *pbx = PB->x, *pby = PB->y;
GLdepth *pbz = PB->z; GLdepth *pbz = PB->z;
GLuint *pbi = PB->i; GLuint *pbi = PB->index;
GLuint pbcount = PB->count; GLuint pbcount = PB->count;
GLuint i; GLuint i;
@@ -245,7 +245,7 @@ general_ci_points( GLcontext *ctx, GLuint first, GLuint last )
y1 = y0 + isize - 1; 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 (iy = y0; iy <= y1; iy++) {
for (ix = x0; ix <= x1; ix++) { for (ix = x0; ix <= x1; ix++) {
@@ -294,7 +294,7 @@ general_rgba_points( GLcontext *ctx, GLuint first, GLuint last )
y1 = y0 + isize - 1; y1 = y0 + isize - 1;
} }
PB_SET_COLOR( ctx, PB, PB_SET_COLOR( PB,
VB->ColorPtr->data[i][0], VB->ColorPtr->data[i][0],
VB->ColorPtr->data[i][1], VB->ColorPtr->data[i][1],
VB->ColorPtr->data[i][2], VB->ColorPtr->data[i][2],
@@ -832,7 +832,7 @@ dist_atten_general_ci_points( GLcontext *ctx, GLuint first, GLuint last )
y1 = y0 + isize - 1; 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 (iy=y0;iy<=y1;iy++) {
for (ix=x0;ix<=x1;ix++) { 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; y1 = y0 + isize - 1;
} }
PB_SET_COLOR( ctx, PB, PB_SET_COLOR( PB,
VB->ColorPtr->data[i][0], VB->ColorPtr->data[i][0],
VB->ColorPtr->data[i][1], VB->ColorPtr->data[i][1],
VB->ColorPtr->data[i][2], 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 * Examine the current context to determine which point drawing function
* should be used. * should be used.
@@ -1332,5 +1369,6 @@ void gl_set_point_function( GLcontext *ctx )
ctx->Driver.PointsFunc = gl_select_points; ctx->Driver.PointsFunc = gl_select_points;
} }
/*_mesa_print_points_function(ctx);*/
} }

View File

@@ -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 * 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->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT;
if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT; if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT;
if (ctx->Color.SWmasking) ctx->RasterMask |= MASKING_BIT; if (ctx->Color.SWmasking) ctx->RasterMask |= MASKING_BIT;
if (ctx->Texture.ReallyEnabled) ctx->RasterMask |= TEXTURE_BIT;
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers if (ctx->DrawBuffer->UseSoftwareAlphaBuffers
&& ctx->Color.ColorMask[ACOMP] && ctx->Color.ColorMask[ACOMP]
@@ -968,10 +969,9 @@ void gl_update_state( GLcontext *ctx )
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals); 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 | NEW_TEXTURE_ENABLE)) {
if (ctx->NewState & NEW_RASTER_OPS) {
update_pixel_logic(ctx); update_pixel_logic(ctx);
update_pixel_masking(ctx); update_pixel_masking(ctx);
update_fog_mode(ctx); update_fog_mode(ctx);
@@ -980,20 +980,7 @@ void gl_update_state( GLcontext *ctx )
(*ctx->Driver.Dither)( ctx, ctx->Color.DitherFlag ); (*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 */ /* update scissor region */
ctx->DrawBuffer->Xmin = 0; ctx->DrawBuffer->Xmin = 0;
ctx->DrawBuffer->Ymin = 0; ctx->DrawBuffer->Ymin = 0;
ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width-1; ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width-1;