[r300] Sync fog register names to the AMD spec
authorChristoph Brill <egore911@egore911.de>
Mon, 25 Feb 2008 20:44:11 +0000 (21:44 +0100)
committerChristoph Brill <egore911@egore911.de>
Mon, 25 Feb 2008 20:44:11 +0000 (21:44 +0100)
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/r300/r300_ioctl.c
src/mesa/drivers/dri/r300/r300_reg.h
src/mesa/drivers/dri/r300/r300_state.c

index 21ae712e8142c234a79bf477ebdd27da50007935..243a65a267a3128331e03a746eb3dc8a152e37b7 100644 (file)
@@ -398,7 +398,7 @@ void r300InitCmdBuf(r300ContextPtr r300)
        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);
index d9eaedd70f46602ed7273963dd0f7d98fec4da1e..ff9c2c880de1d47bea7274d4655399e07394514b 100644 (file)
@@ -207,7 +207,7 @@ static void r300EmitClearState(GLcontext * ctx)
 
        /* 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]);
index 182d7fe98a6fb6e0a5882ff8a5b5311595564184..17d051da4ac869ec0a166fbaf3471ef39746f013 100644 (file)
@@ -1459,14 +1459,16 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       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
@@ -1507,13 +1509,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       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 */
 
index 970561c258a0750996a69302e0ed0dfad741123c..5d4085544007d72d33fdb588bcfdabf2ead321c0 100644 (file)
@@ -641,8 +641,8 @@ static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
                        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;
@@ -659,8 +659,8 @@ static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
                        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;
@@ -668,8 +668,8 @@ static void r300Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
                        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:
@@ -1681,7 +1681,7 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state)
        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);
@@ -1689,7 +1689,7 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state)
                        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;