R300: clean up Fog registers
authorAlex Deucher <alex@botch2.com>
Tue, 13 May 2008 18:02:29 +0000 (14:02 -0400)
committerAlex Deucher <alex@botch2.com>
Tue, 13 May 2008 18:02:29 +0000 (14:02 -0400)
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 82c7eb09351f4dcebe9cad64190878587aaf86cb..07384eecdd3a95807034ec3bb73505bafb5413d2 100644 (file)
@@ -439,11 +439,11 @@ void r300InitCmdBuf(r300ContextPtr r300)
                r300->hw.fpp.cmd[R300_FPP_CMD_0] = cmdpacket0(R300_PFS_PARAM_0_X, 0);
        }
        ALLOC_STATE(fogs, always, R300_FOGS_CMDSIZE, 0);
-       r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(FG_FOG_BLEND, 1);
+       r300->hw.fogs.cmd[R300_FOGS_CMD_0] = cmdpacket0(R300_FG_FOG_BLEND, 1);
        ALLOC_STATE(fogc, always, R300_FOGC_CMDSIZE, 0);
-       r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(FG_FOG_COLOR_R, 3);
+       r300->hw.fogc.cmd[R300_FOGC_CMD_0] = cmdpacket0(R300_FG_FOG_COLOR_R, 3);
        ALLOC_STATE(at, always, R300_AT_CMDSIZE, 0);
-       r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(FG_ALPHA_FUNC, 2);
+       r300->hw.at.cmd[R300_AT_CMD_0] = cmdpacket0(R300_FG_ALPHA_FUNC, 2);
        ALLOC_STATE(fg_depth_src, always, 2, 0);
        r300->hw.fg_depth_src.cmd[0] = cmdpacket0(R300_FG_DEPTH_SRC, 1);
        ALLOC_STATE(rb3d_cctl, always, 2, 0);
index e95c797fa20f00edd9a6372ee22ab9f57b5576d7..3863a5403146cb59f9febfe4f1573f2e7999bb41 100644 (file)
@@ -215,7 +215,7 @@ static void r300EmitClearState(GLcontext * ctx)
 
        /* disable fog */
        R300_STATECHANGE(r300, fogs);
-       reg_start(FG_FOG_BLEND, 0);
+       reg_start(R300_FG_FOG_BLEND, 0);
        e32(0x0);
 
        R300_STATECHANGE(r300, vir[1]);
@@ -271,7 +271,7 @@ static void r300EmitClearState(GLcontext * ctx)
        efloat(0.0);
 
        R300_STATECHANGE(r300, at);
-       reg_start(FG_ALPHA_FUNC, 0);
+       reg_start(R300_FG_ALPHA_FUNC, 0);
        e32(0x0);
 
        R300_STATECHANGE(r300, bld);
index 558d32702855a938b13b8767a4990fa3612b1ada..5948c9b22c07a8c78d81cc132af3953a54783a6d 100644 (file)
@@ -1933,60 +1933,61 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 /* END: Fragment program instruction set */
 
 /* 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_FG_FOG_BLEND                             0x4bc0
+#       define R300_FG_FOG_BLEND_DISABLE              (0 << 0)
+#       define R300_FG_FOG_BLEND_ENABLE               (1 << 0)
+#      define R300_FG_FOG_BLEND_FN_LINEAR            (0 << 1)
+#      define R300_FG_FOG_BLEND_FN_EXP               (1 << 1)
+#      define R300_FG_FOG_BLEND_FN_EXP2              (2 << 1)
+#      define R300_FG_FOG_BLEND_FN_CONSTANT          (3 << 1)
+#      define R300_FG_FOG_BLEND_FN_MASK              (3 << 1)
 
 /* Fog: Red Component of Fog Color */
-#define FG_FOG_COLOR_R                           0x4bc8
+#define R300_FG_FOG_COLOR_R                           0x4bc8
 /* Fog: Green Component of Fog Color */
-#define FG_FOG_COLOR_G                           0x4bcc
+#define R300_FG_FOG_COLOR_G                           0x4bcc
 /* Fog: Blue Component of Fog Color */
-#define FG_FOG_COLOR_B                           0x4bd0
-#      define FG_FOG_COLOR_MASK 0x000001ff
+#define R300_FG_FOG_COLOR_B                           0x4bd0
+#      define R300_FG_FOG_COLOR_MASK 0x000003ff
 
 /* Fog: Constant Factor for Fog Blending */
-#define FG_FOG_FACTOR                            0x4bc4
-#      define FG_FOG_FACTOR_MASK 0x000001ff
+#define R300_FG_FOG_FACTOR                            0x4bc4
+#      define FG_FOG_FACTOR_MASK 0x000003ff
 
 /* Fog: Alpha function */
-#define FG_ALPHA_FUNC                            0x4bd4
-#       define R300_REF_ALPHA_MASK               0x000000ff
-#       define FG_ALPHA_FUNC_NEVER                     (0 << 8)
-#       define FG_ALPHA_FUNC_LESS                      (1 << 8)
-#       define FG_ALPHA_FUNC_EQUAL                     (2 << 8)
-#       define FG_ALPHA_FUNC_LE                        (3 << 8)
-#       define FG_ALPHA_FUNC_GREATER                   (4 << 8)
-#       define FG_ALPHA_FUNC_NOTEQUAL                  (5 << 8)
-#       define FG_ALPHA_FUNC_GE                        (6 << 8)
-#       define FG_ALPHA_FUNC_ALWAYS                    (7 << 8)
-#       define R300_ALPHA_TEST_OP_MASK                 (7 << 8)
-#       define FG_ALPHA_FUNC_DISABLE                   (0 << 11)
-#       define FG_ALPHA_FUNC_ENABLE                    (1 << 11)
-#       define FG_ALPHA_FUNC_10BIT                     (0 << 12)
-#       define FG_ALPHA_FUNC_8BIT                      (1 << 12)
-/* gap in AMD spec */
-#       define FG_ALPHA_FUNC_MASK_DISABLE              (0 << 16)
-#       define FG_ALPHA_FUNC_MASK_ENABLE               (1 << 16)
-#       define FG_ALPHA_FUNC_CFG_2_OF_4                (0 << 17)
-#       define FG_ALPHA_FUNC_CFG_3_OF_6                (1 << 17)
-/* gap in AMD spec */
-#       define FG_ALPHA_FUNC_DITH_DISABLE              (0 << 20)
-#       define FG_ALPHA_FUNC_DITH_ENABLE               (1 << 20)
-/* gap in AMD spec */
-#       define FG_ALPHA_FUNC_OFFSET_DISABLE            (0 << 24) /* Not supported in R520. Default R300 and RV350 behaviour. */
-#       define FG_ALPHA_FUNC_OFFSET_ENABLE             (1 << 24) /* Not supported in R520 */
-#       define FG_ALPHA_FUNC_DISC_ZERO_MASK_DISABLE    (0 << 25)
-#       define FG_ALPHA_FUNC_DISC_ZERO_MASK_ENABLE     (1 << 25)
-/* gap in AMD spec */
-#       define FG_ALPHA_FUNC_FP16_DISABLE              (0 << 28)
-#       define FG_ALPHA_FUNC_FP16_ENABLE               (1 << 28)
-/* gap in AMD spec */
+#define R300_FG_ALPHA_FUNC                            0x4bd4
+#       define R300_FG_ALPHA_FUNC_VAL_MASK               0x0000000f
+#       define R300_FG_ALPHA_FUNC_NEVER                     (0 << 8)
+#       define R300_FG_ALPHA_FUNC_LESS                      (1 << 8)
+#       define R300_FG_ALPHA_FUNC_EQUAL                     (2 << 8)
+#       define R300_FG_ALPHA_FUNC_LE                        (3 << 8)
+#       define R300_FG_ALPHA_FUNC_GREATER                   (4 << 8)
+#       define R300_FG_ALPHA_FUNC_NOTEQUAL                  (5 << 8)
+#       define R300_FG_ALPHA_FUNC_GE                        (6 << 8)
+#       define R300_FG_ALPHA_FUNC_ALWAYS                    (7 << 8)
+#       define R300_ALPHA_TEST_OP_MASK                      (7 << 8)
+#       define R300_FG_ALPHA_FUNC_DISABLE                   (0 << 11)
+#       define R300_FG_ALPHA_FUNC_ENABLE                    (1 << 11)
+
+#       define R500_FG_ALPHA_FUNC_10BIT                     (0 << 12)
+#       define R500_FG_ALPHA_FUNC_8BIT                      (1 << 12)
+
+#       define R300_FG_ALPHA_FUNC_MASK_DISABLE              (0 << 16)
+#       define R300_FG_ALPHA_FUNC_MASK_ENABLE               (1 << 16)
+#       define R300_FG_ALPHA_FUNC_CFG_2_OF_4                (0 << 17)
+#       define R300_FG_ALPHA_FUNC_CFG_3_OF_6                (1 << 17)
+
+#       define R300_FG_ALPHA_FUNC_DITH_DISABLE              (0 << 20)
+#       define R300_FG_ALPHA_FUNC_DITH_ENABLE               (1 << 20)
+
+#       define R500_FG_ALPHA_FUNC_OFFSET_DISABLE            (0 << 24)
+#       define R500_FG_ALPHA_FUNC_OFFSET_ENABLE             (1 << 24) /* Not supported in R520 */
+#       define R500_FG_ALPHA_FUNC_DISC_ZERO_MASK_DISABLE    (0 << 25)
+#       define R500_FG_ALPHA_FUNC_DISC_ZERO_MASK_ENABLE     (1 << 25)
+
+#       define R500_FG_ALPHA_FUNC_FP16_DISABLE              (0 << 28)
+#       define R500_FG_ALPHA_FUNC_FP16_ENABLE               (1 << 28)
+
 
 /* Fog: Where does the depth come from? */
 #define R300_FG_DEPTH_SRC                  0x4bd8
@@ -1994,8 +1995,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R300_FG_DEPTH_SRC_SHADER (1 << 0)
 
 /* Fog: Alpha Compare Value */
-#define FG_ALPHA_VALUE                0x4be0
-#      define FG_ALPHA_VALUE_MASK 0x0000ffff
+#define R500_FG_ALPHA_VALUE                0x4be0
+#      define R500_FG_ALPHA_VALUE_MASK 0x0000ffff
 
 /* gap */
 
@@ -2012,14 +2013,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* Unpipelined. */
 #define R300_RB3D_CCTL                      0x4e00
-/* gap in AMD docs */
 #      define R300_RB3D_CCTL_NUM_MULTIWRITES_1_BUFFER                (0 << 5)
 #      define R300_RB3D_CCTL_NUM_MULTIWRITES_2_BUFFERS               (1 << 5)
 #      define R300_RB3D_CCTL_NUM_MULTIWRITES_3_BUFFERS               (2 << 5)
 #      define R300_RB3D_CCTL_NUM_MULTIWRITES_4_BUFFERS               (3 << 5)
 #      define R300_RB3D_CCTL_CLRCMP_FLIPE_DISABLE                    (0 << 7)
 #      define R300_RB3D_CCTL_CLRCMP_FLIPE_ENABLE                     (1 << 7)
-/* gap in AMD docs */
 #      define R300_RB3D_CCTL_AA_COMPRESSION_DISABLE                  (0 << 9)
 #      define R300_RB3D_CCTL_AA_COMPRESSION_ENABLE                   (1 << 9)
 #      define R300_RB3D_CCTL_CMASK_DISABLE                           (0 << 10)
index e060523ff841b1c185c49c43937e09123fc47f84..30e853b01fdc6908e15bea0d36354c6d450427a2 100644 (file)
@@ -450,25 +450,25 @@ static void r300SetAlphaState(GLcontext * ctx)
 
        switch (ctx->Color.AlphaFunc) {
        case GL_NEVER:
-               pp_misc |= FG_ALPHA_FUNC_NEVER;
+               pp_misc |= R300_FG_ALPHA_FUNC_NEVER;
                break;
        case GL_LESS:
-               pp_misc |= FG_ALPHA_FUNC_LESS;
+               pp_misc |= R300_FG_ALPHA_FUNC_LESS;
                break;
        case GL_EQUAL:
-               pp_misc |= FG_ALPHA_FUNC_EQUAL;
+               pp_misc |= R300_FG_ALPHA_FUNC_EQUAL;
                break;
        case GL_LEQUAL:
-               pp_misc |= FG_ALPHA_FUNC_LE;
+               pp_misc |= R300_FG_ALPHA_FUNC_LE;
                break;
        case GL_GREATER:
-               pp_misc |= FG_ALPHA_FUNC_GREATER;
+               pp_misc |= R300_FG_ALPHA_FUNC_GREATER;
                break;
        case GL_NOTEQUAL:
-               pp_misc |= FG_ALPHA_FUNC_NOTEQUAL;
+               pp_misc |= R300_FG_ALPHA_FUNC_NOTEQUAL;
                break;
        case GL_GEQUAL:
-               pp_misc |= FG_ALPHA_FUNC_GE;
+               pp_misc |= R300_FG_ALPHA_FUNC_GE;
                break;
        case GL_ALWAYS:
                /*pp_misc |= FG_ALPHA_FUNC_ALWAYS; */
@@ -477,8 +477,8 @@ static void r300SetAlphaState(GLcontext * ctx)
        }
 
        if (really_enabled) {
-               pp_misc |= FG_ALPHA_FUNC_ENABLE;
-               pp_misc |= (refByte & R300_REF_ALPHA_MASK);
+               pp_misc |= R300_FG_ALPHA_FUNC_ENABLE;
+               pp_misc |= (refByte & R300_FG_ALPHA_FUNC_VAL_MASK);
        } else {
                pp_misc = 0x0;
        }
@@ -716,8 +716,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] & ~FG_FOG_BLEND_FN_MASK) |
-                           FG_FOG_BLEND_FN_LINEAR;
+                            cmd[R300_FOGS_STATE] & ~R300_FG_FOG_BLEND_FN_MASK) |
+                           R300_FG_FOG_BLEND_FN_LINEAR;
 
                        if (ctx->Fog.Start == ctx->Fog.End) {
                                fogScale.f = -1.0;
@@ -734,8 +734,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] & ~FG_FOG_BLEND_FN_MASK) |
-                           FG_FOG_BLEND_FN_EXP;
+                            cmd[R300_FOGS_STATE] & ~R300_FG_FOG_BLEND_FN_MASK) |
+                           R300_FG_FOG_BLEND_FN_EXP;
                        fogScale.f = 0.0933 * ctx->Fog.Density;
                        fogStart.f = 0.0;
                        break;
@@ -743,8 +743,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] & ~FG_FOG_BLEND_FN_MASK) |
-                           FG_FOG_BLEND_FN_EXP2;
+                            cmd[R300_FOGS_STATE] & ~R300_FG_FOG_BLEND_FN_MASK) |
+                           R300_FG_FOG_BLEND_FN_EXP2;
                        fogScale.f = 0.3 * ctx->Fog.Density;
                        fogStart.f = 0.0;
                default:
@@ -808,7 +808,7 @@ static void r300SetFogState(GLcontext * ctx, GLboolean state)
 
        R300_STATECHANGE(r300, fogs);
        if (state) {
-               r300->hw.fogs.cmd[R300_FOGS_STATE] |= FG_FOG_BLEND_ENABLE;
+               r300->hw.fogs.cmd[R300_FOGS_STATE] |= R300_FG_FOG_BLEND_ENABLE;
 
                r300Fogfv(ctx, GL_FOG_MODE, NULL);
                r300Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density);
@@ -816,7 +816,7 @@ static void r300SetFogState(GLcontext * ctx, 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] &= ~FG_FOG_BLEND_ENABLE;
+               r300->hw.fogs.cmd[R300_FOGS_STATE] &= ~R300_FG_FOG_BLEND_ENABLE;
        }
 }