ALLOC_STATE(fpi[3], variable, R300_FPI_CMDSIZE, 3);
r300->hw.fpi[3].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR3_0, 1);
ALLOC_STATE(fogs, always, R300_FOGS_CMDSIZE, 0);
- r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(R300_RE_FOG_STATE, 1);
+ r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(FG_FOG_BLEND, 1);
ALLOC_STATE(fogc, always, R300_FOGC_CMDSIZE, 0);
r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(R300_FOG_COLOR_R, 3);
ALLOC_STATE(at, always, R300_AT_CMDSIZE, 0);
/* disable fog */
R300_STATECHANGE(r300, fogs);
- reg_start(R300_RE_FOG_STATE, 0);
+ reg_start(FG_FOG_BLEND, 0);
e32(0x0);
R300_STATECHANGE(r300, vir[1]);
# define R300_FPI2_UNKNOWN_31 (1 << 31)
/* END: Fragment program instruction set */
-/* Fog state and color */
-#define R300_RE_FOG_STATE 0x4BC0
-# define R300_FOG_DISABLE (0 << 0)
-# define R300_FOG_ENABLE (1 << 0)
-# define R300_FOG_MODE_LINEAR (0 << 1)
-# define R300_FOG_MODE_EXP (1 << 1)
-# define R300_FOG_MODE_EXP2 (2 << 1)
-# define R300_FOG_MODE_MASK (3 << 1)
+/* Fog: Fog Blending Enable */
+#define FG_FOG_BLEND 0x4bc0
+# define FG_FOG_BLEND_DISABLE (0 << 0)
+# define FG_FOG_BLEND_ENABLE (1 << 0)
+# define FG_FOG_BLEND_FN_LINEAR (0 << 1)
+# define FG_FOG_BLEND_FN_EXP (1 << 1)
+# define FG_FOG_BLEND_FN_EXP2 (2 << 1)
+# define FG_FOG_BLEND_FN_CONSTANT (3 << 1)
+# define FG_FOG_BLEND_FN_MASK 0x00000006
+
#define R300_FOG_COLOR_R 0x4BC8
#define R300_FOG_COLOR_G 0x4BCC
#define R300_FOG_COLOR_B 0x4BD0
# define FG_ALPHA_FUNC_FP16_ENABLE (1 << 28)
/* gap in AMD spec */
-/* Where does the depth come from? */
+/* Fog: Where does the depth come from? */
#define R300_FG_DEPTH_SRC 0x4bd8
# define R300_FG_DEPTH_SRC_SCAN (0 << 0)
# define R300_FG_DEPTH_SRC_SHADER (1 << 0)
-/* Alpha Compare Value */
-#define R300_FG_ALPHA_VALUE 0x4be0
+/* Fog: Alpha Compare Value */
+#define FG_ALPHA_VALUE 0x4be0
+# define FG_ALPHA_VALUE_MASK 0x0000ffff
/* gap */
R300_STATECHANGE(r300, fogs);
r300->hw.fogs.cmd[R300_FOGS_STATE] =
(r300->hw.fogs.
- cmd[R300_FOGS_STATE] & ~R300_FOG_MODE_MASK) |
- R300_FOG_MODE_LINEAR;
+ cmd[FG_FOG_BLEND] & ~FG_FOG_BLEND_FN_MASK) |
+ FG_FOG_BLEND_FN_LINEAR;
if (ctx->Fog.Start == ctx->Fog.End) {
fogScale.f = -1.0;
R300_STATECHANGE(r300, fogs);
r300->hw.fogs.cmd[R300_FOGS_STATE] =
(r300->hw.fogs.
- cmd[R300_FOGS_STATE] & ~R300_FOG_MODE_MASK) |
- R300_FOG_MODE_EXP;
+ cmd[FG_FOG_BLEND] & ~FG_FOG_BLEND_FN_MASK) |
+ FG_FOG_BLEND_FN_EXP;
fogScale.f = 0.0933 * ctx->Fog.Density;
fogStart.f = 0.0;
break;
R300_STATECHANGE(r300, fogs);
r300->hw.fogs.cmd[R300_FOGS_STATE] =
(r300->hw.fogs.
- cmd[R300_FOGS_STATE] & ~R300_FOG_MODE_MASK) |
- R300_FOG_MODE_EXP2;
+ cmd[FG_FOG_BLEND] & ~FG_FOG_BLEND_FN_MASK) |
+ FG_FOG_BLEND_FN_EXP2;
fogScale.f = 0.3 * ctx->Fog.Density;
fogStart.f = 0.0;
default:
case GL_FOG:
R300_STATECHANGE(r300, fogs);
if (state) {
- r300->hw.fogs.cmd[R300_FOGS_STATE] |= R300_FOG_ENABLE;
+ r300->hw.fogs.cmd[FG_FOG_BLEND] |= FG_FOG_BLEND_ENABLE;
r300Fogfv(ctx, GL_FOG_MODE, NULL);
r300Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density);
r300Fogfv(ctx, GL_FOG_END, &ctx->Fog.End);
r300Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color);
} else {
- r300->hw.fogs.cmd[R300_FOGS_STATE] &= ~R300_FOG_ENABLE;
+ r300->hw.fogs.cmd[FG_FOG_BLEND] &= ~FG_FOG_BLEND_ENABLE;
}
break;