summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i810/i810state.c10
-rw-r--r--src/mesa/drivers/dri/i810/i810tris.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf_state.c6
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_native_vb.c2
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_tris.c13
-rw-r--r--src/mesa/drivers/dri/mga/mgatris.c10
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c9
-rw-r--r--src/mesa/drivers/dri/savage/savagetris.c16
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_tris.c2
10 files changed, 52 insertions, 24 deletions
diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c
index 3ad25282d9..e0d5b2b487 100644
--- a/src/mesa/drivers/dri/i810/i810state.c
+++ b/src/mesa/drivers/dri/i810/i810state.c
@@ -380,7 +380,10 @@ static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused)
static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
- int width = (int)ctx->Line._Width;
+ /* AA, non-AA limits are same */
+ const int width = (int) CLAMP(ctx->Line.Width,
+ ctx->Const.MinLineWidth,
+ ctx->Const.MaxLineWidth);
imesa->LcsLineWidth = 0;
if (width & 1) imesa->LcsLineWidth |= LCS_LINEWIDTH_1_0;
@@ -396,7 +399,10 @@ static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
static void i810PointSize( GLcontext *ctx, GLfloat sz )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
- int size = (int)ctx->Point._Size;
+ /* AA, non-AA limits are same */
+ const int size = (int) CLAMP(ctx->Point.Size,
+ ctx->Const.MinPointSize,
+ ctx->Const.MaxPointSize);
imesa->LcsPointSize = 0;
if (size & 1) imesa->LcsPointSize |= LCS_LINEWIDTH_1_0;
diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c
index 3e09427bb9..2c4ee06633 100644
--- a/src/mesa/drivers/dri/i810/i810tris.c
+++ b/src/mesa/drivers/dri/i810/i810tris.c
@@ -112,7 +112,9 @@ static __inline__ void i810_draw_quad( i810ContextPtr imesa,
static __inline__ void i810_draw_point( i810ContextPtr imesa,
i810VertexPtr tmp )
{
- GLfloat sz = imesa->glCtx->Point._Size * .5;
+ GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
+ imesa->glCtx->Const.MinPointSize,
+ imesa->glCtx->Const.MaxPointSize);
int vertsize = imesa->vertex_size;
GLuint *vb = i810AllocDmaLow( imesa, 2 * 4 * vertsize );
int j;
diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c
index bfac52d765..9a6e5f5f19 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_state.c
@@ -173,7 +173,8 @@ static void upload_sf_unit( struct brw_context *brw )
/* _NEW_LINE */
- sf.sf6.line_width = brw->attribs.Line->_Width * (1<<1);
+ /* XXX use ctx->Const.Min/MaxLineWidth here */
+ sf.sf6.line_width = CLAMP(brw->attribs.Line->Width, 1.0, 5.0) * (1<<1);
sf.sf6.line_endcap_aa_region_width = 1;
if (brw->attribs.Line->SmoothFlag)
@@ -183,7 +184,8 @@ static void upload_sf_unit( struct brw_context *brw )
/* _NEW_POINT */
sf.sf6.point_rast_rule = 1; /* opengl conventions */
- sf.sf7.point_size = brw->attribs.Point->_Size * (1<<3);
+ /* XXX clamp max depends on AA vs. non-AA */
+ sf.sf7.point_size = CLAMP(brw->attribs.Point->Size, 1.0, 3.0) * (1<<3);
sf.sf7.use_point_size_state = !brw->attribs.Point->_Attenuated;
/* might be BRW_NEW_PRIMITIVE if we have to adjust pv for polygons:
diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vb.c b/src/mesa/drivers/dri/mach64/mach64_native_vb.c
index 75cf0e2ed2..248fa2a9a2 100644
--- a/src/mesa/drivers/dri/mach64/mach64_native_vb.c
+++ b/src/mesa/drivers/dri/mach64/mach64_native_vb.c
@@ -103,7 +103,7 @@ void TAG(translate_vertex)(GLcontext *ctx,
assert( p + 1 - (CARD32 *)src == 10 );
- dst->pointSize = ctx->Point._Size;
+ dst->pointSize = ctx->Point.Size;
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c
index 08cc1849a1..369f610442 100644
--- a/src/mesa/drivers/dri/mach64/mach64_tris.c
+++ b/src/mesa/drivers/dri/mach64/mach64_tris.c
@@ -673,7 +673,10 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa,
#if MACH64_NATIVE_VTXFMT
GLcontext *ctx = mmesa->glCtx;
const GLuint vertsize = mmesa->vertex_size;
- GLint width = (GLint)(mmesa->glCtx->Line._Width * 2.0); /* 2 fractional bits for hardware */
+ /* 2 fractional bits for hardware: */
+ const int width = (int) (2.0 * CLAMP(mmesa->glCtx->Line.Width,
+ mmesa->glCtx->Const.MinLineWidth,
+ mmesa->glCtx->Const.MaxLineWidth));
GLfloat ooa;
GLuint *pxy0, *pxy1;
GLuint xy0old, xy0, xy1old, xy1;
@@ -691,9 +694,6 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa,
mach64_print_vertex( ctx, v1 );
}
- if( !width )
- width = 1; /* round to the nearest supported width */
-
pxy0 = &v0->ui[xyoffset];
xy0old = *pxy0;
xy0 = LE32_IN( &xy0old );
@@ -961,7 +961,10 @@ static __inline void mach64_draw_point( mach64ContextPtr mmesa,
#if MACH64_NATIVE_VTXFMT
GLcontext *ctx = mmesa->glCtx;
const GLuint vertsize = mmesa->vertex_size;
- GLint sz = (GLint)(mmesa->glCtx->Point._Size * 2.0); /* 2 fractional bits for hardware */
+ /* 2 fractional bits for hardware: */
+ GLint sz = (GLint) (2.0 * CLAMP(mmesa->glCtx->Point.Size,
+ ctx->Const.MinPointSize,
+ ctx->Const.MaxPointSize));
GLfloat ooa;
GLuint *pxy;
GLuint xyold, xy;
diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c
index 2b7ea05b14..91b413ae76 100644
--- a/src/mesa/drivers/dri/mga/mgatris.c
+++ b/src/mesa/drivers/dri/mga/mgatris.c
@@ -104,8 +104,10 @@ static void __inline__ mga_draw_quad( mgaContextPtr mmesa,
static __inline__ void mga_draw_point( mgaContextPtr mmesa,
mgaVertexPtr tmp )
{
- GLfloat sz = mmesa->glCtx->Point._Size * .5;
- int vertex_size = mmesa->vertex_size;
+ const GLfloat sz = 0.5 * CLAMP(mmesa->glCtx->Point.Size,
+ mmesa->glCtx->Const.MinPointSize,
+ mmesa->glCtx->Const.MaxPointSize);
+ const int vertex_size = mmesa->vertex_size;
GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
int j;
@@ -165,7 +167,9 @@ static __inline__ void mga_draw_line( mgaContextPtr mmesa,
GLuint vertex_size = mmesa->vertex_size;
GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
GLfloat dx, dy, ix, iy;
- GLfloat width = mmesa->glCtx->Line._Width;
+ const GLfloat width = CLAMP(mmesa->glCtx->Line.Width,
+ mmesa->glCtx->Const.MinLineWidth,
+ mmesa->glCtx->Const.MaxLineWidth);
GLint j;
#if 0
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 2115799b9b..1d975ecd57 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -772,9 +772,11 @@ static void r200LineWidth( GLcontext *ctx, GLfloat widthf )
R200_STATECHANGE( rmesa, set );
/* Line width is stored in U6.4 format.
+ * Same min/max limits for AA, non-AA lines.
*/
rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] &= ~0xffff;
- rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)(ctx->Line._Width * 16.0);
+ rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)
+ (CLAMP(widthf, ctx->Const.MinLineWidth, ctx->Const.MaxLineWidth) * 16.0);
if ( widthf > 1.0 ) {
rmesa->hw.set.cmd[SET_SE_CNTL] |= R200_WIDELINE_ENABLE;
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index a790acacfe..088216c76e 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -733,8 +733,8 @@ static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
static void r300PointSize(GLcontext * ctx, GLfloat size)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
-
- size = ctx->Point._Size;
+ /* same size limits for AA, non-AA points */
+ size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
R300_STATECHANGE(r300, ps);
r300->hw.ps.cmd[R300_PS_POINTSIZE] =
@@ -749,8 +749,9 @@ static void r300LineWidth(GLcontext * ctx, GLfloat widthf)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
- widthf = ctx->Line._Width;
-
+ widthf = CLAMP(widthf,
+ ctx->Const.MinPointSize,
+ ctx->Const.MaxPointSize);
R300_STATECHANGE(r300, lcntl);
r300->hw.lcntl.cmd[1] =
R300_LINE_CNT_HO | R300_LINE_CNT_VE | (int)(widthf * 6.0);
diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c
index 3dd821a4d3..4ce2f60b4f 100644
--- a/src/mesa/drivers/dri/savage/savagetris.c
+++ b/src/mesa/drivers/dri/savage/savagetris.c
@@ -131,7 +131,9 @@ static __inline__ void savage_draw_point (savageContextPtr imesa,
u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
const GLfloat x = tmp->v.x;
const GLfloat y = tmp->v.y;
- const GLfloat sz = imesa->glCtx->Point._Size * .5;
+ const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
+ imesa->glCtx->Const.MinPointSize,
+ imesa->glCtx->Const.MaxPointSize);
GLuint j;
*(float *)&vb[0] = x - sz;
@@ -164,7 +166,9 @@ static __inline__ void savage_draw_line (savageContextPtr imesa,
savageVertexPtr v1 ) {
GLuint vertsize = imesa->HwVertexSize;
u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
- GLfloat width = imesa->glCtx->Line._Width;
+ const GLfloat width = CLAMP(imesa->glCtx->Line.Width,
+ imesa->glCtx->Const.MinLineWidth,
+ imesa->glCtx->Const.MaxLineWidth);
GLfloat dx, dy, ix, iy;
GLuint j;
@@ -234,7 +238,9 @@ static __inline__ void savage_ptex_line (savageContextPtr imesa,
savageVertexPtr v1 ) {
GLuint vertsize = imesa->HwVertexSize;
u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
- GLfloat width = imesa->glCtx->Line._Width;
+ const GLfloat width = CLAMP(imesa->glCtx->Line.Width,
+ imesa->glCtx->Const.MinLineWidth,
+ imesa->glCtx->Const.MaxLineWidth);
GLfloat dx, dy, ix, iy;
savageVertex tmp0, tmp1;
GLuint j;
@@ -281,7 +287,9 @@ static __inline__ void savage_ptex_point (savageContextPtr imesa,
u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
const GLfloat x = v0->v.x;
const GLfloat y = v0->v.y;
- const GLfloat sz = imesa->glCtx->Point._Size * .5;
+ const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
+ imesa->glCtx->Const.MinPointSize,
+ imesa->glCtx->Const.MaxPointSize);
savageVertex tmp;
GLuint j;
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tris.c b/src/mesa/drivers/dri/tdfx/tdfx_tris.c
index 96f9ae27fc..7252a7e7dc 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_tris.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_tris.c
@@ -184,7 +184,7 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
}
}
- dst->pointSize = ctx->Point._Size;
+ dst->pointSize = ctx->Point.Size;
}