ALLOC_STATE( lsf, always, 2, "lsf", 0 );
r300->hw.lsf.cmd[0] = cmducs(R300_RE_LINE_STIPPLE_FACTOR, 1);
#endif
- ALLOC_STATE( sm, always, 2, "sm", 0 );
- r300->hw.sm.cmd[0] = cmducs(R300_RE_SHADE_MODEL, 1);
ALLOC_STATE( unk4260, always, 4, "unk4260", 0 );
r300->hw.unk4260.cmd[0] = cmducs(0x4260, 3);
ALLOC_STATE( unk4274, always, 5, "unk4274", 0 );
#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.sm);
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4288);
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42A0);
insert_at_tail(&r300->hw.atomlist, &r300->hw.zbs);
#define R300_PS_POINTSIZE 1
#define R300_PS_CMDSIZE 2
-#define R300_SM_CMD_0 0
-#define R300_SM 1
-
#define R300_ZBS_CMD_0 0
#define R300_ZBS_T_FACTOR 1
#define R300_ZBS_T_CONSTANT 2
#endif
struct r300_state_atom unk4260; /* (4260) */
struct r300_state_atom unk4274; /* (4274) */
- struct r300_state_atom sm; /* shade model (4278) */
struct r300_state_atom unk4288; /* (4288) */
struct r300_state_atom unk42A0; /* (42A0) */
struct r300_state_atom zbs; /* zbias (42A4) */
R300_STATECHANGE(r300, pvs);
r300->hw.pvs.cmd[R300_PVS_CNTL_1] =
(0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
- (0 << R300_PVS_CNTL_1_UNKNOWN_SHIFT) |
+ (0 << R300_PVS_CNTL_1_POS_END_SHIFT) |
(1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT);
r300->hw.pvs.cmd[R300_PVS_CNTL_2] = 0; /* no parameters */
r300->hw.pvs.cmd[R300_PVS_CNTL_3] =
// experiments so far have shown that both *must* point to an instruction
// inside the vertex program, otherwise the GPU locks up.
// fglrx usually sets CNTL_3_UNKNOWN to the end of the program and
-// CNTL_1_UNKNOWN somewhere in the middle, but the criteria are not clear.
-
-// Some tests would indicate that CNTL_3_UNKNOWN is set to program len -
-// number of "temp to result instrutions". I havent yet seen a case where
-// "temp to result instrutions" have not been moved at the end of program.
-// However tests have shown that fgls vertex program implementation is
-// not perfect and im having hard-time trusting
-// it at the time being. -aet
+// CNTL_1_UNKNOWN points to instruction where last write to position takes place.
+// Most likely this is used to ignore rest of the program in cases where group of verts arent visible.
+// For some reason this "section" is sometimes accepted other instruction that have
+// no relationship with position calculations.
*/
#define R300_VAP_PVS_CNTL_1 0x22D0
# define R300_PVS_CNTL_1_PROGRAM_START_SHIFT 0
-# define R300_PVS_CNTL_1_UNKNOWN_SHIFT 10
+# define R300_PVS_CNTL_1_POS_END_SHIFT 10
# define R300_PVS_CNTL_1_PROGRAM_END_SHIFT 20
/* Addresses are relative the the vertex program parameters area. */
#define R300_VAP_PVS_CNTL_2 0x22D4
# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_6_COMP_CNT_SHIFT 18
# define R300_GB_VAP_RASTER_VTX_FMT_1__TEX_7_COMP_CNT_SHIFT 21
+/* UNK30 seems to enables point to quad transformation on textures
+ (or something closely related to that).
+ This bit is rather fatal at the time being due to lackings at pixel shader side */
#define R300_GB_ENABLE 0x4008
# define R300_GB_POINT_STUFF_ENABLE (1<<0)
# define R300_GB_LINE_STUFF_ENABLE (1<<1)
# define R300_GB_TRIANGLE_STUFF_ENABLE (1<<2)
# define R300_GB_STENCIL_AUTO_ENABLE (1<<4)
+# define R300_GB_UNK30 (1<<30)
/* each of the following is 2 bits wide */
#define R300_GB_TEX_REPLICATE 0
#define R300_GB_TEX_ST 1
size = ctx->Point._Size;
R300_STATECHANGE(r300, ps);
- r300->hw.ps.cmd[R300_PS_POINTSIZE] =
+ r300->hw.ps.cmd[R300_PS_POINTSIZE] =
((int)(size * 6) << R300_POINTSIZE_X_SHIFT) |
((int)(size * 6) << R300_POINTSIZE_Y_SHIFT);
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
- R300_STATECHANGE(rmesa, sm);
+ R300_STATECHANGE(rmesa, unk4274);
switch (mode) {
case GL_FLAT:
- rmesa->hw.sm.cmd[R300_SM] = R300_RE_SHADE_MODEL_FLAT;
+ rmesa->hw.unk4274.cmd[2] = R300_RE_SHADE_MODEL_FLAT;
break;
case GL_SMOOTH:
- rmesa->hw.sm.cmd[R300_SM] = R300_RE_SHADE_MODEL_SMOOTH;
+ rmesa->hw.unk4274.cmd[2] = R300_RE_SHADE_MODEL_SMOOTH;
break;
default:
return;
R300_STATECHANGE(rmesa, pvs);
rmesa->hw.pvs.cmd[R300_PVS_CNTL_1]=(rmesa->state.vertex_shader.program_start << R300_PVS_CNTL_1_PROGRAM_START_SHIFT)
- | (rmesa->state.vertex_shader.unknown_ptr1 << R300_PVS_CNTL_1_UNKNOWN_SHIFT)
+ | (rmesa->state.vertex_shader.unknown_ptr1 << R300_PVS_CNTL_1_POS_END_SHIFT)
| (rmesa->state.vertex_shader.program_end << R300_PVS_CNTL_1_PROGRAM_END_SHIFT);
rmesa->hw.pvs.cmd[R300_PVS_CNTL_2]=(rmesa->state.vertex_shader.param_offset << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT)
| (rmesa->state.vertex_shader.param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT);
R300_STATECHANGE(rmesa, pvs);
rmesa->hw.pvs.cmd[R300_PVS_CNTL_1]=(0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT)
- | (inst_count/*pos_end*/ << R300_PVS_CNTL_1_UNKNOWN_SHIFT)
+ | (inst_count/*pos_end*/ << R300_PVS_CNTL_1_POS_END_SHIFT)
| (inst_count << R300_PVS_CNTL_1_PROGRAM_END_SHIFT);
rmesa->hw.pvs.cmd[R300_PVS_CNTL_2]=(0 << R300_PVS_CNTL_2_PARAM_OFFSET_SHIFT)
| (param_count << R300_PVS_CNTL_2_PARAM_COUNT_SHIFT);
r300DepthMask(ctx, ctx->Depth.Mask);
r300DepthFunc(ctx, ctx->Depth.Func);
- r300ShadeModel(ctx, ctx->Light.ShadeModel);
-
/* stencil */
r300Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled);
r300StencilMask(ctx, ctx->Stencil.WriteMask[0]);
r300->hw.gb_enable.cmd[1] = R300_GB_POINT_STUFF_ENABLE
| R300_GB_LINE_STUFF_ENABLE
- | R300_GB_TRIANGLE_STUFF_ENABLE;
+ | R300_GB_TRIANGLE_STUFF_ENABLE /*| R300_GB_UNK30*/;
r300->hw.gb_misc.cmd[R300_GB_MISC_MSPOS_0] = 0x66666666;
r300->hw.gb_misc.cmd[R300_GB_MISC_MSPOS_1] = 0x06666666;
(6 << R300_POINTSIZE_Y_SHIFT);
#endif
- r300->hw.unk4230.cmd[1] = 0x01800000;
+ r300->hw.unk4230.cmd[1] = 0x01800000;//18000006;
r300->hw.unk4230.cmd[2] = 0x00020006;
r300->hw.unk4230.cmd[3] = r300PackFloat32(1.0 / 192.0);
r300->hw.unk4260.cmd[3] = r300PackFloat32(1.0);
r300->hw.unk4274.cmd[1] = 0x00000002;
- r300->hw.unk4274.cmd[2] = 0x0003AAAA;
+ r300ShadeModel(ctx, ctx->Light.ShadeModel);
r300->hw.unk4274.cmd[3] = 0x00000000;
r300->hw.unk4274.cmd[4] = 0x00000000;