summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r200/r200_swtcl.c
diff options
context:
space:
mode:
authorRoland Scheidegger <rscheidegger@gmx.ch>2006-10-13 22:10:05 +0000
committerRoland Scheidegger <rscheidegger@gmx.ch>2006-10-13 22:10:05 +0000
commitcb977ae5f4c9fab5753c04bfdd8736978ad4feee (patch)
tree1f38b694427bb1021da66f6dee020af67b880c3d /src/mesa/drivers/dri/r200/r200_swtcl.c
parent40b88fd1f3dedd0137b170a7272854e2bf4c3210 (diff)
implement ARB_point_parameters and ARB_point_sprite on r200. The code is nearly the same as outlined in bug #4707, except it disables perspective correction for point sprites to make them actually work. And, separate the state atom into two as the tcl parameters would overwrite vertex program parameters when active. Also implement the GL_VERTEX_PROGRAM_POINT_SIZE_ARB option to make vertex programs outputting a point size work correctly (untested). Smooth points will still always be size 1. While here, enable gouraud shading for fog when using fog coord.
Diffstat (limited to 'src/mesa/drivers/dri/r200/r200_swtcl.c')
-rw-r--r--src/mesa/drivers/dri/r200/r200_swtcl.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index aa78f38286..c14a275f7a 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -117,6 +117,11 @@ static void r200SetVertexFormat( GLcontext *ctx )
offset = 3;
}
+ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_POINTSIZE )) {
+ EMIT_ATTR( _TNL_ATTRIB_POINTSIZE, EMIT_1F, R200_VTX_POINT_SIZE );
+ offset += 1;
+ }
+
rmesa->swtcl.coloroffset = offset;
#if MESA_LITTLE_ENDIAN
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA, (R200_VTX_PK_RGBA << R200_VTX_COLOR_0_SHIFT) );
@@ -349,7 +354,9 @@ static INLINE GLuint reduced_hw_prim( GLcontext *ctx, GLuint prim)
{
switch (prim) {
case GL_POINTS:
- return (ctx->_TriangleCaps & DD_POINT_SIZE) ?
+ return (ctx->Point.PointSprite ||
+ ((ctx->_TriangleCaps & (DD_POINT_SIZE | DD_POINT_ATTEN)) &&
+ !(ctx->_TriangleCaps & (DD_POINT_SMOOTH)))) ?
R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS;
case GL_LINES:
/* fallthrough */
@@ -632,6 +639,17 @@ static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim )
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (rmesa->swtcl.hw_primitive != hwprim) {
+ /* need to disable perspective-correct texturing for point sprites */
+ if ((hwprim & 0xf) == R200_VF_PRIM_POINT_SPRITES && ctx->Point.PointSprite) {
+ if (rmesa->hw.set.cmd[SET_RE_CNTL] & R200_PERSPECTIVE_ENABLE) {
+ R200_STATECHANGE( rmesa, set );
+ rmesa->hw.set.cmd[SET_RE_CNTL] &= ~R200_PERSPECTIVE_ENABLE;
+ }
+ }
+ else if (!(rmesa->hw.set.cmd[SET_RE_CNTL] & R200_PERSPECTIVE_ENABLE)) {
+ R200_STATECHANGE( rmesa, set );
+ rmesa->hw.set.cmd[SET_RE_CNTL] |= R200_PERSPECTIVE_ENABLE;
+ }
R200_NEWPRIM( rmesa );
rmesa->swtcl.hw_primitive = hwprim;
}