r300->hw.ps.cmd[0] = cmducs(R300_RE_POINTSIZE, 1);
ALLOC_STATE( unk4230, always, 4, "unk4230", 0 );
r300->hw.unk4230.cmd[0] = cmducs(0x4230, 3);
+ ALLOC_STATE( lcntl, always, 2, "lcntl", 0 );
+ r300->hw.lcntl.cmd[0] = cmducs(R300_RE_LINE_CNT, 1);
+#ifdef EXP_C
+ ALLOC_STATE( lsf, always, 2, "lsf", 0 );
+ r300->hw.lsf.cmd[0] = cmducs(R300_RE_LINE_STIPPLE_FACTOR, 1);
+#endif
ALLOC_STATE( unk4260, always, 4, "unk4260", 0 );
r300->hw.unk4260.cmd[0] = cmducs(0x4260, 3);
ALLOC_STATE( unk4274, always, 5, "unk4274", 0 );
r300->hw.rr.cmd[R300_RR_CMD_0] = cmducs(R300_RS_ROUTE_0, 1);
ALLOC_STATE( unk43A4, always, 3, "unk43A4", 0 );
r300->hw.unk43A4.cmd[0] = cmducs(0x43A4, 2);
+#ifdef EXP_C
+ ALLOC_STATE( lsp, always, 3, "lsp", 0 );
+ r300->hw.lsp.cmd[0] = cmducs(R300_RE_LINE_STIPPLE_PTRN1, 2);
+#endif
ALLOC_STATE( unk43E8, always, 2, "unk43E8", 0 );
r300->hw.unk43E8.cmd[0] = cmducs(0x43E8, 1);
ALLOC_STATE( fp, always, R300_FP_CMDSIZE, "fp", 0 );
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4214);
insert_at_tail(&r300->hw.atomlist, &r300->hw.ps);
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4230);
+ insert_at_tail(&r300->hw.atomlist, &r300->hw.lcntl);
+#ifdef EXP_C
+ insert_at_tail(&r300->hw.atomlist, &r300->hw.lsf);
+#endif
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4260);
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4274);
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4288);
insert_at_tail(&r300->hw.atomlist, &r300->hw.ri);
insert_at_tail(&r300->hw.atomlist, &r300->hw.rr);
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk43A4);
+#ifdef EXP_C
+ insert_at_tail(&r300->hw.atomlist, &r300->hw.lsp);
+#endif
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk43E8);
insert_at_tail(&r300->hw.atomlist, &r300->hw.fp);
insert_at_tail(&r300->hw.atomlist, &r300->hw.fpt);
ctx->Const.MaxTextureCoordUnits);
ctx->Const.MaxTextureMaxAnisotropy = 16.0;
- /* No wide points.
- */
ctx->Const.MinPointSize = 1.0;
ctx->Const.MinPointSizeAA = 1.0;
- ctx->Const.MaxPointSize = 1.0;
- ctx->Const.MaxPointSizeAA = 1.0;
+ ctx->Const.MaxPointSize = R300_POINTSIZE_MAX;
+ ctx->Const.MaxPointSizeAA = R300_POINTSIZE_MAX;
ctx->Const.MinLineWidth = 1.0;
ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 1.0;
- ctx->Const.MaxLineWidthAA = 1.0;
+ ctx->Const.MaxLineWidth = R300_LINESIZE_MAX;
+ ctx->Const.MaxLineWidthAA = R300_LINESIZE_MAX;
/* Initialize the software rasterizer and helper modules.
*/
struct r300_state_atom unk4214; /* (4214) */
struct r300_state_atom ps; /* pointsize (421C) */
struct r300_state_atom unk4230; /* (4230) */
+ struct r300_state_atom lcntl; /* line control */
+#ifdef EXP_C
+ struct r300_state_atom lsf; /* line stipple factor */
+#endif
+ struct r300_state_atom dummy[4];
struct r300_state_atom unk4260; /* (4260) */
struct r300_state_atom unk4274; /* (4274) */
struct r300_state_atom unk4288; /* (4288) */
struct r300_state_atom ri; /* rs interpolators (4310) */
struct r300_state_atom rr; /* rs route (4330) */
struct r300_state_atom unk43A4; /* (43A4) */
+#ifdef EXP_C
+ struct r300_state_atom lsp; /* line stipple pattern */
+#endif
struct r300_state_atom unk43E8; /* (43E8) */
struct r300_state_atom fp; /* fragment program cntl + nodes (4600) */
struct r300_state_atom fpt; /* texi - (4620) */
# define R300_POINTSIZE_Y_MASK (0xFFFF << 0) /* GUESS */
# define R300_POINTSIZE_X_SHIFT 16
# define R300_POINTSIZE_X_MASK (0xFFFF << 16) /* GUESS */
+# define R300_POINTSIZE_MAX (R300_POINTSIZE_Y_MASK / 6)
+
+/* The line width is given in multiples of 6.
+ 00020018 == 4.0, 0002001e == 5.0 */
+#define R300_RE_LINE_CNT 0x4234
+# define R300_LINESIZE_SHIFT 0
+# define R300_LINESIZE_MASK (0xFFFF << 0) /* GUESS */
+# define R300_LINESIZE_MAX (R300_LINESIZE_MASK / 6)
+# define R300_LINE_CNT_UNK1 (1 << 17)
+
+/* Linestipple factor. 3a088889 == 1.0, 3baaaaa9 == 10.0 */
+#define R300_RE_LINE_STIPPLE_FACTOR 0x4238
+#define R300_RE_LINE_STIPPLE_PTRN1 0x43E0
+#define R300_RE_LINE_STIPPLE_PTRN2 0x43E4
+
#define R300_RE_ZBIAS_T_FACTOR 0x42A4
#define R300_RE_ZBIAS_T_CONSTANT 0x42A8
r300->hw.vps.cmd[R300_VPS_POINTSIZE] = r300PackFloat32(1.0);
#endif
}
+
+/* =============================================================
+ * Line state
+ */
+static void r300LineWidth(GLcontext *ctx, GLfloat widthf)
+{
+ r300ContextPtr r300 = R300_CONTEXT(ctx);
+ /* IMHO mesa isnt clamping line widths according to ctx->Const.*LineWidth
+ before calling this from the dd function table.
+ Since r300ResetHwState calls these with clamped values,
+ they must be set properly. */
+
+ R300_STATECHANGE(r300, lcntl);
+ r300->hw.lcntl.cmd[1] = (int)(widthf * 6.0);
+ /* Doesnt look very good without this... */
+ r300->hw.lcntl.cmd[1] |= R300_LINE_CNT_UNK1;
+}
+
/* =============================================================
* Stencil
*/
r300->hw.unk4214.cmd[1] = 0x00050005;
- r300PointSize(ctx, ctx->Point.Size);
+ r300PointSize(ctx, ctx->Point._Size);
#if 0
r300->hw.ps.cmd[R300_PS_POINTSIZE] = (6 << R300_POINTSIZE_X_SHIFT) |
(6 << R300_POINTSIZE_Y_SHIFT);
r300->hw.unk4230.cmd[1] = 0x01800000;
r300->hw.unk4230.cmd[2] = 0x00020006;
r300->hw.unk4230.cmd[3] = r300PackFloat32(1.0 / 192.0);
-
+
+ r300LineWidth(ctx, ctx->Line._Width);
+
+#ifdef EXP_C
+ static int foobar=0;
+ r300->hw.lsf.cmd[1] = foobar++; //0x3a088889;
+#endif
r300->hw.unk4260.cmd[1] = 0;
r300->hw.unk4260.cmd[2] = r300PackFloat32(0.0);
r300->hw.unk4260.cmd[3] = r300PackFloat32(1.0);
r300->hw.unk43A4.cmd[1] = 0x0000001C;
r300->hw.unk43A4.cmd[2] = 0x2DA49525;
-
+
+#ifdef EXP_C
+ r300->hw.lsp.cmd[1] = rand()%(~0); //0x00b405a0;
+ r300->hw.lsp.cmd[2] = foobar++;// 0x00efe81f;
+#endif
+
r300->hw.unk43E8.cmd[1] = 0x00FFFFFF;
#if 0
functions->Viewport = r300Viewport;
functions->DepthRange = r300DepthRange;
functions->PointSize = r300PointSize;
+ functions->LineWidth = r300LineWidth;
functions->PolygonOffset = r300PolygonOffset;
}