summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r200
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/r200')
-rw-r--r--src/mesa/drivers/dri/r200/r200_cmdbuf.c1
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c11
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.h7
-rw-r--r--src/mesa/drivers/dri/r200/r200_screen.c1
-rw-r--r--src/mesa/drivers/dri/r200/r200_screen.h1
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c14
-rw-r--r--src/mesa/drivers/dri/r200/r200_state_init.c12
-rw-r--r--src/mesa/drivers/dri/r200/r200_swtcl.c34
-rw-r--r--src/mesa/drivers/dri/r200/r200_tcl.c3
9 files changed, 59 insertions, 25 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c
index 759175a82f..2122d16dcb 100644
--- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c
+++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c
@@ -108,6 +108,7 @@ void r200SetUpAtomList( r200ContextPtr rmesa )
for (i = 0; i < 6; ++i)
insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.ucp[i] );
/* FIXME: is this a good place to insert that atom ? */
+ insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.spr );
insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.prf );
}
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 2c95e9a6c2..1c65fea6a1 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -400,12 +400,19 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
ctx->Const.MaxTextureMaxAnisotropy = 16.0;
- /* No wide points.
+ /* No wide AA points.
*/
ctx->Const.MinPointSize = 1.0;
ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
ctx->Const.MaxPointSizeAA = 1.0;
+ ctx->Const.PointSizeGranularity = 0.0625;
+ if (rmesa->r200Screen->drmSupportsPointSprites)
+ ctx->Const.MaxPointSize = 2047.0;
+ else
+ ctx->Const.MaxPointSize = 1.0;
+
+ /* mesa initialization problem - _mesa_init_point was already called */
+ ctx->Point.MaxSize = ctx->Const.MaxPointSize;
ctx->Const.MinLineWidth = 1.0;
ctx->Const.MinLineWidthAA = 1.0;
diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h
index aacc1327e6..ccb67b0d69 100644
--- a/src/mesa/drivers/dri/r200/r200_context.h
+++ b/src/mesa/drivers/dri/r200/r200_context.h
@@ -397,6 +397,11 @@ struct r200_state_atom {
#define VTX_STATE_CNTL 8
#define VTX_STATE_SIZE 9
+/* SPR - point sprite state
+ */
+#define SPR_CMD_0 0
+#define SPR_POINT_SPRITE_CNTL 1
+#define SPR_STATE_SIZE 2
#define VTX_COLOR(v,n) (((v)>>(R200_VTX_COLOR_0_SHIFT+(n)*2))&\
R200_VTX_COLOR_MASK)
@@ -559,6 +564,7 @@ struct r200_hw_state {
struct r200_state_atom prf;
struct r200_state_atom afs[2];
struct r200_state_atom atf;
+ struct r200_state_atom spr;
int max_state_size; /* Number of bytes necessary for a full state emit. */
GLboolean is_dirty, all_dirty;
@@ -928,7 +934,6 @@ struct r200_context {
GLmatrix TexGenMatrix[R200_MAX_TEXTURE_UNITS];
GLboolean recheck_texgen[R200_MAX_TEXTURE_UNITS];
GLboolean TexGenNeedNormals[R200_MAX_TEXTURE_UNITS];
- GLuint TexMatEnabled;
GLuint TexMatCompSel;
GLuint TexGenEnabled;
GLuint TexGenCompSel;
diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c
index ff4b85915f..794450c27c 100644
--- a/src/mesa/drivers/dri/r200/r200_screen.c
+++ b/src/mesa/drivers/dri/r200/r200_screen.c
@@ -360,6 +360,7 @@ r200CreateScreen( __DRIscreenPrivate *sPriv )
screen->drmSupportsBlendColor = (sPriv->drmMinor >= 11);
screen->drmSupportsTriPerf = (sPriv->drmMinor >= 16);
screen->drmSupportsFragShader = (sPriv->drmMinor >= 18);
+ screen->drmSupportsPointSprites = (sPriv->drmMinor >= 13);
}
/* Check if ddx has set up a surface reg to cover depth buffer */
diff --git a/src/mesa/drivers/dri/r200/r200_screen.h b/src/mesa/drivers/dri/r200/r200_screen.h
index 47e6f2be72..c1fa12ed5e 100644
--- a/src/mesa/drivers/dri/r200/r200_screen.h
+++ b/src/mesa/drivers/dri/r200/r200_screen.h
@@ -98,6 +98,7 @@ typedef struct {
GLboolean drmSupportsBlendColor; /* need radeon kernel module >= 1.11 */
GLboolean drmSupportsTriPerf; /* need radeon kernel module >= 1.16 */
GLboolean drmSupportsFragShader; /* need radeon kernel module >= 1.18 */
+ GLboolean drmSupportsPointSprites; /* need radeon kernel module >= 1.13 */
GLboolean depthHasSurface;
/* Configuration cache with default values for all contexts */
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index caf8571a52..e80cae872e 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -689,7 +689,11 @@ static void r200FrontFace( GLcontext *ctx, GLenum mode )
*/
static void r200PointSize( GLcontext *ctx, GLfloat size )
{
- if (0) fprintf(stderr, "%s: %f\n", __FUNCTION__, size );
+ r200ContextPtr rmesa = R200_CONTEXT(ctx);
+
+ R200_STATECHANGE( rmesa, cst );
+ rmesa->hw.cst.cmd[CST_RE_POINTSIZE] &= ~0xffff;
+ rmesa->hw.cst.cmd[CST_RE_POINTSIZE] |= ((GLuint)(ctx->Point.Size * 16.0));
}
/* =============================================================
@@ -1982,10 +1986,10 @@ static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state )
}
break;
- /* Pointsize registers on r200 don't seem to do anything. Maybe
- * have to pass pointsizes as vertex parameters? In any case,
- * setting pointmin == pointsizemax == 1.0, and doing nothing
- * for aa is enough to satisfy conform.
+ /* Pointsize registers on r200 only work for point sprites, and point smooth
+ * doesn't work for point sprites (and isn't needed for 1.0 sized aa points).
+ * In any case, setting pointmin == pointsizemax == 1.0 for aa points
+ * is enough to satisfy conform.
*/
case GL_POINT_SMOOTH:
break;
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
index db78afd375..ead80d2c32 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -352,6 +352,10 @@ void r200InitState( r200ContextPtr rmesa )
else {
ALLOC_STATE( prf, never, PRF_STATE_SIZE, "PRF/performance-tri", 0 );
}
+ if (rmesa->r200Screen->drmSupportsPointSprites)
+ ALLOC_STATE( spr, always, SPR_STATE_SIZE, "SPR/pointsprite", 0 );
+ else
+ ALLOC_STATE (spr, never, SPR_STATE_SIZE, "SPR/pointsprite", 0 );
r200SetUpAtomList( rmesa );
@@ -436,6 +440,7 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->hw.vtx.cmd[VTX_CMD_2] = cmdpkt(R200_EMIT_SE_VTX_STATE_CNTL);
rmesa->hw.vte.cmd[VTE_CMD_0] = cmdpkt(R200_EMIT_VTE_CNTL);
rmesa->hw.prf.cmd[PRF_CMD_0] = cmdpkt(R200_EMIT_PP_TRI_PERF_CNTL);
+ rmesa->hw.spr.cmd[SPR_CMD_0] = cmdpkt(R200_EMIT_TCL_POINT_SPRITE_CNTL);
rmesa->hw.mtl[0].cmd[MTL_CMD_0] =
cmdvec( R200_VS_MAT_0_EMISS, 1, 16 );
rmesa->hw.mtl[0].cmd[MTL_CMD_1] =
@@ -640,7 +645,8 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->hw.cst.cmd[CST_SE_VAP_CNTL_STATUS] |= (1<<8);
}
- rmesa->hw.cst.cmd[CST_RE_POINTSIZE] = 0x100010;
+ rmesa->hw.cst.cmd[CST_RE_POINTSIZE] =
+ (((GLuint)(ctx->Const.MaxPointSize * 16.0)) << R200_MAXPOINTSIZE_SHIFT) | 0x10;
rmesa->hw.cst.cmd[CST_SE_TCL_INPUT_VTX_0] =
(0x0 << R200_VERTEX_POSITION_ADDR__SHIFT);
rmesa->hw.cst.cmd[CST_SE_TCL_INPUT_VTX_1] =
@@ -869,7 +875,9 @@ void r200InitState( r200ContextPtr rmesa )
rmesa->hw.eye.cmd[EYE_Z] = IEEE_ONE;
rmesa->hw.eye.cmd[EYE_RESCALE_FACTOR] = IEEE_ONE;
+ rmesa->hw.spr.cmd[SPR_POINT_SPRITE_CNTL] = R200_POINTSIZE_SEL_STATE;
+
r200LightingSpaceChange( ctx );
-
+
rmesa->hw.all_dirty = GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index 375db2658d..826c668b8d 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -340,18 +340,24 @@ r200AllocDmaLowVerts( r200ContextPtr rmesa, int nverts, int vsize )
/**************************************************************************/
-static const GLuint reduced_hw_prim[GL_POLYGON+1] = {
- R200_VF_PRIM_POINTS,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_LINES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES,
- R200_VF_PRIM_TRIANGLES
-};
+static INLINE GLuint reduced_hw_prim( GLcontext *ctx, GLuint prim)
+{
+ switch (prim) {
+ case GL_POINTS:
+ return (ctx->_TriangleCaps & DD_POINT_SIZE) ?
+ R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS;
+ case GL_LINES:
+ /* fallthrough */
+ case GL_LINE_LOOP:
+ /* fallthrough */
+ case GL_LINE_STRIP:
+ return R200_VF_PRIM_LINES;
+ default:
+ /* all others reduced to triangles */
+ return R200_VF_PRIM_TRIANGLES;
+ }
+}
+
static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim );
static void r200RenderPrimitive( GLcontext *ctx, GLenum prim );
@@ -496,7 +502,7 @@ do { \
* Helpers for rendering unfilled primitives *
***********************************************************************/
-#define RASTERIZE(x) r200RasterPrimitive( ctx, reduced_hw_prim[x] )
+#define RASTERIZE(x) r200RasterPrimitive( ctx, reduced_hw_prim(ctx, x) )
#define RENDER_PRIMITIVE rmesa->swtcl.render_primitive
#undef TAG
#define TAG(x) x
@@ -631,7 +637,7 @@ static void r200RenderPrimitive( GLcontext *ctx, GLenum prim )
r200ContextPtr rmesa = R200_CONTEXT(ctx);
rmesa->swtcl.render_primitive = prim;
if (prim < GL_TRIANGLES || !(ctx->_TriangleCaps & DD_TRI_UNFILLED))
- r200RasterPrimitive( ctx, reduced_hw_prim[prim] );
+ r200RasterPrimitive( ctx, reduced_hw_prim(ctx, prim) );
}
static void r200RenderFinish( GLcontext *ctx )
diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c
index 05c658fbe2..55e7b49079 100644
--- a/src/mesa/drivers/dri/r200/r200_tcl.c
+++ b/src/mesa/drivers/dri/r200/r200_tcl.c
@@ -68,7 +68,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define HAVE_ELTS 1
-#define HW_POINTS R200_VF_PRIM_POINTS
+#define HW_POINTS ((ctx->_TriangleCaps & DD_POINT_SIZE) ? \
+ R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS)
#define HW_LINES R200_VF_PRIM_LINES
#define HW_LINE_LOOP 0
#define HW_LINE_STRIP R200_VF_PRIM_LINE_STRIP