Maybe someone has some ideas how to get it to work completely.
What works and what doesn't:
- I could not get the point primitive of the r200 to respect point size settings no matter what. So I'm just using the point sprite primitive instead. I'm not sure if this has consequences (performance maybe?) or not, things like r200PointsBitmap might also be negatively affected.
- Smooth points do not work. Actually, setting that smooth point bit register indeed does change the output, but only very slightly (seems to make the points very slightly larger, but they are still of square shape). Interestingly, using ati's fglrx driver there was an error if point_smooth was set but blending was off - the points would be square in that case instead of round, but with blending on everything was correct. Not sure if that's just coincidence or if there is some alpha blend hackery necessary to get those nice round points!
- I could not get the r200 to perform the attenuation calculation needed for ARB_point_parameters. In fact, I could not get any change whatsoever in output no matter what values I tried setting the various registers potentially related to point sprite to. I think I'm missing something fundamental here. The chip does however always clamp the point size to the set Minsize and Maxsize values (even when using software tcl). With software tcl, attenuation works, threshold doesn't (I assume something similar to what the i915 driver does would be needed for software tcl, i.e. replace size and alpha value).
A drm change is needed unfortunately for emitting the R200_SE_TCL_POINT_SPRITE_CNTL register (the drm patch is for both core and old version, the r200 driver should work but will not compile without it). I'm wondering if this register also works for non-tcl hardware, despite the name it also affects the swtcl path (since it selects if the point size is taken from the vertex or from the point size register).
Roland
Index: shared/radeon.h
===================================================================
RCS file: /cvs/dri/drm/shared/radeon.h,v
retrieving revision 1.32
diff -u -r1.32 radeon.h
--- shared/radeon.h 24 Aug 2004 11:15:53 -0000 1.32
+++ shared/radeon.h 22 Oct 2004 16:54:56 -0000
@@ -45,7 +45,7 @@
#define DRIVER_DATE "20020828"
#define DRIVER_MAJOR 1
-#define DRIVER_MINOR 11
+#define DRIVER_MINOR 13
#define DRIVER_PATCHLEVEL 0
/* Interface history:
@@ -80,6 +80,7 @@
* located in the card's address space
* 1.11- Add packet R200_EMIT_RB3D_BLENDCOLOR to support GL_EXT_blend_color
* and GL_EXT_blend_[func|equation]_separate on r200
+ * 1.13- Add packed R200_EMIT_TCL_POINT_SPRITE_CNTL for ARB_point_parameters
*/
#define DRIVER_IOCTLS \
[DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \
Index: shared/radeon_drm.h
===================================================================
RCS file: /cvs/dri/drm/shared/radeon_drm.h,v
retrieving revision 1.23
diff -u -r1.23 radeon_drm.h
--- shared/radeon_drm.h 17 Aug 2004 11:24:50 -0000 1.23
+++ shared/radeon_drm.h 22 Oct 2004 16:54:59 -0000
@@ -145,7 +145,8 @@
#define RADEON_EMIT_PP_TEX_SIZE_1 74
#define RADEON_EMIT_PP_TEX_SIZE_2 75
#define R200_EMIT_RB3D_BLENDCOLOR 76
-#define RADEON_MAX_STATE_PACKETS 77
+#define R200_EMIT_TCL_POINT_SPRITE_CNTL 77
+#define RADEON_MAX_STATE_PACKETS 78
/* Commands understood by cmd_buffer ioctl. More can be added but
Index: shared/radeon_drv.h
===================================================================
RCS file: /cvs/dri/drm/shared/radeon_drv.h,v
retrieving revision 1.35
diff -u -r1.35 radeon_drv.h
--- shared/radeon_drv.h 27 Sep 2004 20:14:31 -0000 1.35
+++ shared/radeon_drv.h 22 Oct 2004 16:55:03 -0000
@@ -741,6 +741,8 @@
#define R200_RB3D_BLENDCOLOR 0x3218
+#define R200_SE_TCL_POINT_SPRITE_CNTL 0x22c4
+
/* Constants */
#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */
Index: shared/radeon_state.c
===================================================================
RCS file: /cvs/dri/drm/shared/radeon_state.c,v
retrieving revision 1.38
diff -u -r1.38 radeon_state.c
--- shared/radeon_state.c 27 Sep 2004 20:14:31 -0000 1.38
+++ shared/radeon_state.c 22 Oct 2004 16:55:11 -0000
@@ -205,6 +205,7 @@
case RADEON_EMIT_PP_TEX_SIZE_1:
case RADEON_EMIT_PP_TEX_SIZE_2:
case R200_EMIT_RB3D_BLENDCOLOR:
+ case R200_EMIT_TCL_POINT_SPRITE_CNTL:
/* These packets don't contain memory offsets */
break;
@@ -569,6 +570,7 @@
{ RADEON_PP_TEX_SIZE_1, 2, "RADEON_PP_TEX_SIZE_1" },
{ RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_2" },
{ R200_RB3D_BLENDCOLOR, 3, "R200_RB3D_BLENDCOLOR" },
+ { R200_SE_TCL_POINT_SPRITE_CNTL, 1, "R200_SE_TCL_POINT_SPRITE_CNTL"},
};
Index: shared-core/radeon_drm.h
===================================================================
RCS file: /cvs/dri/drm/shared-core/radeon_drm.h,v
retrieving revision 1.25
diff -u -r1.25 radeon_drm.h
--- shared-core/radeon_drm.h 10 Oct 2004 05:52:19 -0000 1.25
+++ shared-core/radeon_drm.h 22 Oct 2004 16:55:14 -0000
@@ -144,7 +144,8 @@
#define RADEON_EMIT_PP_TEX_SIZE_1 74
#define RADEON_EMIT_PP_TEX_SIZE_2 75
#define R200_EMIT_RB3D_BLENDCOLOR 76
-#define RADEON_MAX_STATE_PACKETS 77
+#define R200_EMIT_TCL_POINT_SPRITE_CNTL 77
+#define RADEON_MAX_STATE_PACKETS 78
/* Commands understood by cmd_buffer ioctl. More can be added but
* obviously these can't be removed or changed:
Index: shared-core/radeon_drv.h
===================================================================
RCS file: /cvs/dri/drm/shared-core/radeon_drv.h,v
retrieving revision 1.36
diff -u -r1.36 radeon_drv.h
--- shared-core/radeon_drv.h 10 Oct 2004 05:52:19 -0000 1.36
+++ shared-core/radeon_drv.h 22 Oct 2004 16:55:19 -0000
@@ -74,10 +74,11 @@
* and GL_EXT_blend_[func|equation]_separate on r200
* 1.12- Add R300 CP microcode support - this just loads the CP on r300
* (No 3D support yet - just microcode loading).
+ * 1.13- Add packed R200_EMIT_TCL_POINT_SPRITE_CNTL for ARB_point_parameters
*/
#define DRIVER_MAJOR 1
-#define DRIVER_MINOR 12
+#define DRIVER_MINOR 13
#define DRIVER_PATCHLEVEL 0
enum radeon_family {
@@ -801,6 +802,8 @@
#define R200_RB3D_BLENDCOLOR 0x3218
+#define R200_SE_TCL_POINT_SPRITE_CNTL 0x22c4
+
/* Constants */
#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */
Index: shared-core/radeon_state.c
===================================================================
RCS file: /cvs/dri/drm/shared-core/radeon_state.c,v
retrieving revision 1.39
diff -u -r1.39 radeon_state.c
--- shared-core/radeon_state.c 10 Oct 2004 05:52:19 -0000 1.39
+++ shared-core/radeon_state.c 22 Oct 2004 16:55:31 -0000
@@ -207,6 +207,7 @@
case RADEON_EMIT_PP_TEX_SIZE_1:
case RADEON_EMIT_PP_TEX_SIZE_2:
case R200_EMIT_RB3D_BLENDCOLOR:
+ case R200_EMIT_TCL_POINT_SPRITE_CNTL:
/* These packets don't contain memory offsets */
break;
@@ -582,7 +583,9 @@
RADEON_PP_TEX_SIZE_0, 2, "RADEON_PP_TEX_SIZE_0"}, {
RADEON_PP_TEX_SIZE_1, 2, "RADEON_PP_TEX_SIZE_1"}, {
RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_2"}, {
-R200_RB3D_BLENDCOLOR, 3, "R200_RB3D_BLENDCOLOR"},};
+ R200_RB3D_BLENDCOLOR, 3, "R200_RB3D_BLENDCOLOR"}, {
+ R200_SE_TCL_POINT_SPRITE_CNTL, 1, "R200_SE_TCL_POINT_SPRITE_CNTL"},
+};
/* ================================================================
* Performance monitoring functions
Index: progs/demos/pointblast.c
===================================================================
RCS file: /cvs/mesa/Mesa/progs/demos/pointblast.c,v
retrieving revision 1.6
diff -u -r1.6 pointblast.c
--- progs/demos/pointblast.c 16 Feb 2004 14:45:56 -0000 1.6
+++ progs/demos/pointblast.c 22 Oct 2004 17:28:36 -0000
@@ -27,7 +27,7 @@
#endif
#if 0 /* For debugging. */
-#undef GL_EXT_point_parameters
+#undef GL_ARB_point_parameters
#endif
static GLfloat angle = -150; /* in degrees */
Index: src/mesa/drivers/dri/r200/r200_cmdbuf.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_cmdbuf.c,v
retrieving revision 1.13
diff -u -r1.13 r200_cmdbuf.c
--- src/mesa/drivers/dri/r200/r200_cmdbuf.c 2 Oct 2004 05:22:19 -0000 1.13
+++ src/mesa/drivers/dri/r200/r200_cmdbuf.c 22 Oct 2004 17:28:38 -0000
@@ -105,6 +105,7 @@
insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.mtl[i] );
for (i = 0; i < 6; ++i)
insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.ucp[i] );
+ insert_at_tail( &rmesa->hw.atomlist, &rmesa->hw.spr );
}
static void r200SaveHwState( r200ContextPtr rmesa )
Index: src/mesa/drivers/dri/r200/r200_context.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_context.c,v
retrieving revision 1.33
diff -u -r1.33 r200_context.c
--- src/mesa/drivers/dri/r200/r200_context.c 7 Oct 2004 23:30:30 -0000 1.33
+++ src/mesa/drivers/dri/r200/r200_context.c 22 Oct 2004 17:28:39 -0000
@@ -166,6 +166,7 @@
&_tnl_fog_coordinate_stage,
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
+ &_tnl_point_attenuation_stage,
&_tnl_vertex_program_stage,
/* Try again to go to tcl?
@@ -357,9 +360,20 @@
*/
ctx->Const.MinPointSize = 1.0;
ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
-
+
+ if (rmesa->r200Screen->drmSupportsPointSprite) {
+ ctx->Const.MaxPointSize = 2047.0;
+ ctx->Const.MaxPointSizeAA = 2047.0;
+ ctx->Const.PointSizeGranularity = 0.0625;
+ }
+ else {
+ ctx->Const.MaxPointSize = 1.0;
+ ctx->Const.MaxPointSizeAA = 1.0;
+ }
+
+ /* mesa initialization problem */
+ ctx->Point.MaxSize = ctx->Const.MaxPointSize;
+
ctx->Const.MinLineWidth = 1.0;
ctx->Const.MinLineWidthAA = 1.0;
ctx->Const.MaxLineWidth = 10.0;
@@ -415,6 +429,10 @@
_mesa_enable_extension( ctx, "GL_EXT_blend_equation_separate" );
_mesa_enable_extension( ctx, "GL_EXT_blend_func_separate" );
}
+
+ if (rmesa->r200Screen->drmSupportsPointSprite)
+ _mesa_enable_extension( ctx, "GL_ARB_point_parameters" );
+
if(driQueryOptionb(&rmesa->optionCache, "arb_vertex_program"))
_mesa_enable_extension( ctx, "GL_ARB_vertex_program");
if(driQueryOptionb(&rmesa->optionCache, "nv_vertex_program"))
Index: src/mesa/drivers/dri/r200/r200_context.h
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_context.h,v
retrieving revision 1.23
diff -u -r1.23 r200_context.h
--- src/mesa/drivers/dri/r200/r200_context.h 16 Oct 2004 03:36:14 -0000 1.23
+++ src/mesa/drivers/dri/r200/r200_context.h 22 Oct 2004 17:28:40 -0000
@@ -487,7 +487,31 @@
#define CST_SE_TCL_INPUT_VTX_3 17
#define CST_STATE_SIZE 18
-
+/* SPR - point sprite state
+ */
+#define SPR_CMD_0 0
+#define SPR_POINT_SPRITE_CNTL 1
+#define SPR_CMD_1 2
+#define SPR_ATT_CONST_0 3
+#define SPR_ATT_CONST_1 4
+#define SPR_ATT_CONST_2 5
+#define SPR_ATT_CONST_3 6
+#define SPR_CMD_2 7
+#define SPR_VPORT_SCALE_0 8
+#define SPR_VPORT_SCALE_1 9
+#define SPR_VPORT_SCALE_2 10
+#define SPR_VPORT_SCALE_3 11
+#define SPR_CMD_3 12
+#define SPR_EYE_0 13
+#define SPR_EYE_1 14
+#define SPR_EYE_2 15
+#define SPR_EYE_3 16
+#define SPR_CMD_4 17
+#define SPR_CLAMP_0 18
+#define SPR_CLAMP_1 19
+#define SPR_CLAMP_2 20
+#define SPR_CLAMP_3 21
+#define SPR_STATE_SIZE 22
struct r200_hw_state {
@@ -526,6 +550,7 @@
struct r200_state_atom grd; /* guard band clipping */
struct r200_state_atom fog;
struct r200_state_atom glt;
+ struct r200_state_atom spr;
int max_state_size; /* Number of bytes necessary for a full state emit. */
GLboolean is_dirty, all_dirty;
Index: src/mesa/drivers/dri/r200/r200_reg.h
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_reg.h,v
retrieving revision 1.7
diff -u -r1.7 r200_reg.h
--- src/mesa/drivers/dri/r200/r200_reg.h 16 Oct 2004 03:36:14 -0000 1.7
+++ src/mesa/drivers/dri/r200/r200_reg.h 22 Oct 2004 17:28:41 -0000
@@ -649,6 +649,7 @@
#define R200_CULL_FRONT (1<<29)
#define R200_CULL_BACK (1<<30)
#define R200_SE_TCL_POINT_SPRITE_CNTL 0x22c4
+#define R200_POINTSIZE_SEL_STATE (1<<16)
/* gap */
#define R200_SE_VTX_ST_POS_0_X_4 0x2300
#define R200_SE_VTX_ST_POS_0_Y_4 0x2304
Index: src/mesa/drivers/dri/r200/r200_sanity.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_sanity.c,v
retrieving revision 1.6
diff -u -r1.6 r200_sanity.c
--- src/mesa/drivers/dri/r200/r200_sanity.c 3 Aug 2004 13:03:33 -0000 1.6
+++ src/mesa/drivers/dri/r200/r200_sanity.c 22 Oct 2004 17:28:49 -0000
@@ -143,6 +143,7 @@
{ RADEON_PP_TEX_SIZE_1, 2, "RADEON_PP_TEX_SIZE_1" },
{ RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_2" },
{ R200_RB3D_BLENDCOLOR, 3, "R200_RB3D_BLENDCOLOR" },
+ { R200_SE_TCL_POINT_SPRITE_CNTL, 1, "R200_SE_TCL_POINT_SPRITE_CNTL" },
};
struct reg_names {
Index: src/mesa/drivers/dri/r200/r200_screen.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_screen.c,v
retrieving revision 1.29
diff -u -r1.29 r200_screen.c
--- src/mesa/drivers/dri/r200/r200_screen.c 7 Oct 2004 23:30:30 -0000 1.29
+++ src/mesa/drivers/dri/r200/r200_screen.c 22 Oct 2004 17:28:49 -0000
@@ -328,8 +328,10 @@
/* Check if kernel module is new enough to support cube maps */
screen->drmSupportsCubeMaps = (sPriv->drmMinor >= 7);
/* Check if kernel module is new enough to support blend color and
- separate blend functions/equations */
- screen->drmSupportsBlendColor = (sPriv->drmMinor >= 11);
+ separate blend functions/equations */
+ screen->drmSupportsBlendColor = (sPriv->drmMinor >= 11);
+ /* Check if kernel module is new enough to support point sprites / point
parameters */
+ screen->drmSupportsPointSprite = (sPriv->drmMinor >= 13);
}
}
Index: src/mesa/drivers/dri/r200/r200_screen.h
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_screen.h,v
retrieving revision 1.10
diff -u -r1.10 r200_screen.h
--- src/mesa/drivers/dri/r200/r200_screen.h 2 Jun 2004 22:09:11 -0000 1.10
+++ src/mesa/drivers/dri/r200/r200_screen.h 22 Oct 2004 17:28:49 -0000
@@ -97,6 +97,7 @@
GLboolean drmSupportsCubeMaps; /* need radeon kernel module >=1.7 */
GLboolean drmSupportsBlendColor; /* need radeon kernel module >= 1.11 */
+ GLboolean drmSupportsPointSprite; /* need radeon kernel module >= 1.13 */
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
Index: src/mesa/drivers/dri/r200/r200_state.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_state.c,v
retrieving revision 1.24
diff -u -r1.24 r200_state.c
--- src/mesa/drivers/dri/r200/r200_state.c 16 Oct 2004 03:36:14 -0000 1.24
+++ src/mesa/drivers/dri/r200/r200_state.c 22 Oct 2004 17:28:49 -0000
@@ -646,9 +646,60 @@
*/
static void r200PointSize( GLcontext *ctx, GLfloat size )
{
- if (0) fprintf(stderr, "%s: %f\n", __FUNCTION__, 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));
+}
+
+
+static void r200PointParameter( GLcontext *ctx, GLenum pname, const GLfloat *params)
+{
+ r200ContextPtr rmesa = R200_CONTEXT(ctx);
+ switch (pname) {
+ case GL_POINT_SIZE_MIN:
+ R200_STATECHANGE( rmesa, lin );
+ rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] &= 0xffff;
+ rmesa->hw.lin.cmd[LIN_SE_LINE_WIDTH] |= (GLuint)(ctx->Point.MinSize * 16.0) <<
16;
+ break;
+ case GL_POINT_SIZE_MAX:
+ R200_STATECHANGE( rmesa, cst );
+ rmesa->hw.cst.cmd[CST_RE_POINTSIZE] &= 0xffff;
+ rmesa->hw.cst.cmd[CST_RE_POINTSIZE] |= (((GLuint)(ctx->Point.MaxSize * 16.0))
<< 16);
+ break;
+
+ case GL_POINT_DISTANCE_ATTENUATION: {
+ GLfloat *fcmd = (GLfloat *)R200_DB_STATE( spr );
+ /* set the params to both regs, maybe one is the right one... */
+ fcmd[SPR_VPORT_SCALE_0] = ctx->Point.Params[0];
+ fcmd[SPR_VPORT_SCALE_1] = ctx->Point.Params[1];
+ fcmd[SPR_VPORT_SCALE_2] = ctx->Point.Params[2];
+ fcmd[SPR_ATT_CONST_0] = ctx->Point.Params[0];
+ fcmd[SPR_ATT_CONST_1] = ctx->Point.Params[1];
+ fcmd[SPR_ATT_CONST_2] = ctx->Point.Params[2];
+ R200_DB_STATECHANGE( rmesa, &rmesa->hw.spr );
+ /* hmm this doesn't work...*/
+ }
+ break;
+ case GL_POINT_FADE_THRESHOLD_SIZE: {
+ /* where do I put this??? */
+ GLfloat *fcmd = (GLfloat *)R200_DB_STATE( spr );
+ fcmd[SPR_ATT_CONST_3] = ctx->Point.Threshold;
+ R200_DB_STATECHANGE( rmesa, &rmesa->hw.spr );
+ }
+ break;
+ /* not implemented - r200 probably can't do all of it
+ case GL_POINT_SPRITE_R_MODE_NV:
+ case GL_POINT_SPRITE_COORD_ORIGIN: */
+ default:
+ fprintf(stderr, "bad pname parameter in r200PointParameter\n");
+ return;
+ }
}
+
/* =============================================================
* Line state
*/
@@ -1948,6 +1998,12 @@
* for aa is enough to satisfy conform.
*/
case GL_POINT_SMOOTH:
+ R200_STATECHANGE( rmesa, set );
+ if ( state ) {
+ rmesa->hw.set.cmd[SET_RE_CNTL] |= R200_POINT_SMOOTH;
+ } else {
+ rmesa->hw.set.cmd[SET_RE_CNTL] &= ~R200_POINT_SMOOTH;
+ }
break;
/* These don't really do anything, as we don't use the 3vtx
@@ -2310,6 +2366,7 @@
functions->PolygonMode = r200PolygonMode;
functions->PolygonOffset = r200PolygonOffset;
functions->PolygonStipple = r200PolygonStipple;
+ functions->PointParameterfv = r200PointParameter;
functions->PointSize = r200PointSize;
functions->RenderMode = r200RenderMode;
functions->Scissor = r200Scissor;
Index: src/mesa/drivers/dri/r200/r200_state_init.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_state_init.c,v
retrieving revision 1.17
diff -u -r1.17 r200_state_init.c
--- src/mesa/drivers/dri/r200/r200_state_init.c 16 Oct 2004 03:36:14 -0000 1.17
+++ src/mesa/drivers/dri/r200/r200_state_init.c 22 Oct 2004 17:28:49 -0000
@@ -264,10 +264,14 @@
ALLOC_STATE( cube[4], never, CUBE_STATE_SIZE, "CUBE/tex-4", 4 );
ALLOC_STATE( cube[5], never, CUBE_STATE_SIZE, "CUBE/tex-5", 5 );
}
-
+
ALLOC_STATE( tcl, tcl, TCL_STATE_SIZE, "TCL/tcl", 0 );
ALLOC_STATE( msl, tcl, MSL_STATE_SIZE, "MSL/matrix-select", 0 );
ALLOC_STATE( tcg, tcl, TCG_STATE_SIZE, "TCG/texcoordgen", 0 );
+ if (rmesa->r200Screen->drmSupportsPointSprite)
+ ALLOC_STATE( spr, always, SPR_STATE_SIZE, "SPR/pointsprite", 0 );
+ else
+ ALLOC_STATE (spr, never, SPR_STATE_SIZE, "SPR/pointsprite", 0 );
ALLOC_STATE( mtl[0], tcl_lighting, MTL_STATE_SIZE, "MTL0/material0", 0 );
ALLOC_STATE( mtl[1], tcl_lighting, MTL_STATE_SIZE, "MTL1/material1", 1 );
ALLOC_STATE( grd, tcl, GRD_STATE_SIZE, "GRD/guard-band", 0 );
@@ -361,6 +365,7 @@
rmesa->hw.zbs.cmd[ZBS_CMD_0] = cmdpkt(RADEON_EMIT_SE_ZBIAS_FACTOR);
rmesa->hw.tcl.cmd[TCL_CMD_0] = cmdpkt(R200_EMIT_TCL_LIGHT_MODEL_CTL_0);
rmesa->hw.tcl.cmd[TCL_CMD_1] = cmdpkt(R200_EMIT_TCL_UCP_VERT_BLEND_CTL);
+ rmesa->hw.spr.cmd[SPR_CMD_0] = cmdpkt(R200_EMIT_TCL_POINT_SPRITE_CNTL);
rmesa->hw.tcg.cmd[TCG_CMD_0] = cmdpkt(R200_EMIT_TEX_PROC_CTL_2);
rmesa->hw.msl.cmd[MSL_CMD_0] = cmdpkt(R200_EMIT_MATRIX_SELECT_0);
rmesa->hw.vap.cmd[VAP_CMD_0] = cmdpkt(R200_EMIT_VAP_CTL);
@@ -385,6 +390,15 @@
cmdvec( R200_VS_GLOBAL_AMBIENT_ADDR, 1, 4 );
rmesa->hw.eye.cmd[EYE_CMD_0] =
cmdvec( R200_VS_EYE_VECTOR_ADDR, 1, 4 );
+
+ rmesa->hw.spr.cmd[SPR_CMD_1] =
+ cmdvec( R200_VS_PNT_SPRITE_ATT_CONST, 1, 4 );
+ rmesa->hw.spr.cmd[SPR_CMD_2] =
+ cmdvec( R200_VS_PNT_SPRITE_VPORT_SCALE, 1, 4 );
+ rmesa->hw.spr.cmd[SPR_CMD_3] =
+ cmdvec( R200_VS_PNT_SPRITE_EYE_IN_MODEL, 1, 4 );
+ rmesa->hw.spr.cmd[SPR_CMD_4] =
+ cmdvec( R200_VS_PNT_SPRITE_CLAMP, 1, 4 );
rmesa->hw.mat[R200_MTX_MV].cmd[MAT_CMD_0] =
cmdvec( R200_VS_MATRIX_0_MV, 1, 16);
@@ -544,7 +558,8 @@
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->Point.MaxSize * 16.0)) << 16) | 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] =
@@ -697,6 +712,8 @@
rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] =
(R200_UCP_IN_CLIP_SPACE |
R200_CULL_FRONT_IS_CCW);
+
+ rmesa->hw.spr.cmd[SPR_POINT_SPRITE_CNTL] = R200_POINTSIZE_SEL_STATE;
/* Texgen/Texmat state */
rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_2] = 0x00ffffff;
Index: src/mesa/drivers/dri/r200/r200_swtcl.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_swtcl.c,v
retrieving revision 1.16
diff -u -r1.16 r200_swtcl.c
--- src/mesa/drivers/dri/r200/r200_swtcl.c 16 Oct 2004 03:36:14 -0000 1.16
+++ src/mesa/drivers/dri/r200/r200_swtcl.c 22 Oct 2004 17:28:49 -0000
@@ -114,6 +114,12 @@
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F, R200_VTX_XY | R200_VTX_Z0 );
offset = 3;
}
+
+ /* ??? */
+ if (index & _TNL_BIT_POINTSIZE) {
+ EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, R200_VTX_POINT_SIZE );
+ offset += 1;
+ }
rmesa->swtcl.coloroffset = offset;
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA, (R200_VTX_PK_RGBA <<
R200_VTX_COLOR_0_SHIFT) );
@@ -160,6 +166,11 @@
R200_STATECHANGE( rmesa, vtx );
rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = fmt_0;
rmesa->hw.vtx.cmd[VTX_VTXFMT_1] = fmt_1;
+ /* this is really ugly */
+ R200_STATECHANGE( rmesa, spr );
+ if (index & _TNL_BIT_POINTSIZE)
+ rmesa->hw.spr.cmd[SPR_POINT_SPRITE_CNTL] &= ~R200_POINTSIZE_SEL_STATE;
+ else rmesa->hw.spr.cmd[SPR_POINT_SPRITE_CNTL] |= R200_POINTSIZE_SEL_STATE;
rmesa->swtcl.vertex_size =
_tnl_install_attrs( ctx,
@@ -301,7 +312,7 @@
static const GLuint reduced_hw_prim[GL_POLYGON+1] = {
- R200_VF_PRIM_POINTS,
+ R200_VF_PRIM_POINT_SPRITES,
R200_VF_PRIM_LINES,
R200_VF_PRIM_LINES,
R200_VF_PRIM_LINES,
Index: src/mesa/drivers/dri/r200/r200_tcl.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_tcl.c,v
retrieving revision 1.13
diff -u -r1.13 r200_tcl.c
--- src/mesa/drivers/dri/r200/r200_tcl.c 16 Oct 2004 03:36:14 -0000 1.13
+++ src/mesa/drivers/dri/r200/r200_tcl.c 22 Oct 2004 17:28:49 -0000
@@ -68,7 +68,7 @@
#define HAVE_ELTS 1
-#define HW_POINTS R200_VF_PRIM_POINTS
+#define HW_POINTS R200_VF_PRIM_POINT_SPRITES
#define HW_LINES R200_VF_PRIM_LINES
#define HW_LINE_LOOP 0
#define HW_LINE_STRIP R200_VF_PRIM_LINE_STRIP
@@ -459,6 +459,10 @@
R200_STATECHANGE( rmesa, vte );
rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] &= ~(R200_VTX_XY_FMT|R200_VTX_Z_FMT);
+
+ R200_STATECHANGE( rmesa, spr );
+ rmesa->hw.spr.cmd[SPR_POINT_SPRITE_CNTL] |= R200_POINTSIZE_SEL_STATE;
+
if (R200_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "R200 end tcl fallback\n");
Index: src/mesa/drivers/dri/radeon/radeon_sanity.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/radeon/radeon_sanity.c,v
retrieving revision 1.6
diff -u -r1.6 radeon_sanity.c
--- src/mesa/drivers/dri/radeon/radeon_sanity.c 28 Jun 2004 22:32:38 -0000 1.6
+++ src/mesa/drivers/dri/radeon/radeon_sanity.c 22 Oct 2004 17:28:50 -0000
@@ -139,6 +139,8 @@
{ RADEON_PP_TEX_SIZE_1, 2, "RADEON_PP_TEX_SIZE_1" },
{ RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_2" },
{ 0, 3, "R200_RB3D_BLENDCOLOR" },
+ { 0, 1, "R200_SE_TCL_POINT_SPRITE_CNTL" },
+
};
struct reg_names {
