ilo: fix alpha test on Gen8
authorChia-I Wu <olvaffe@gmail.com>
Mon, 16 Feb 2015 20:54:17 +0000 (04:54 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Mon, 16 Feb 2015 20:59:33 +0000 (04:59 +0800)
Shoudl use GEN8_BLEND_DW0_ALPHA_TEST_ENABLE instead of
GEN6_RT_DW1_ALPHA_TEST_ENABLE (and others).

src/gallium/drivers/ilo/ilo_state_3d_bottom.c

index 7c88d0f90063b18a8c6067c6849b1d2369cfc753..96b1b229ccd8a2c4b3f047dd322ddd5ded6f1544 100644 (file)
@@ -2003,7 +2003,7 @@ dsa_get_alpha_enable_gen6(const struct ilo_dev_info *dev,
 {
    uint32_t dw;
 
-   ILO_DEV_ASSERT(dev, 6, 8);
+   ILO_DEV_ASSERT(dev, 6, 7.5);
 
    if (!state->enabled)
       return 0;
@@ -2015,6 +2015,24 @@ dsa_get_alpha_enable_gen6(const struct ilo_dev_info *dev,
    return dw;
 }
 
+static uint32_t
+dsa_get_alpha_enable_gen8(const struct ilo_dev_info *dev,
+                          const struct pipe_alpha_state *state)
+{
+   uint32_t dw;
+
+   ILO_DEV_ASSERT(dev, 8, 8);
+
+   if (!state->enabled)
+      return 0;
+
+   /* this will be ORed to BLEND_STATE */
+   dw = GEN8_BLEND_DW0_ALPHA_TEST_ENABLE |
+        gen6_translate_dsa_func(state->func) << 24;
+
+   return dw;
+}
+
 void
 ilo_gpe_init_dsa(const struct ilo_dev_info *dev,
                  const struct pipe_depth_stencil_alpha_state *state,
@@ -2031,10 +2049,17 @@ ilo_gpe_init_dsa(const struct ilo_dev_info *dev,
 
       assert(!(dw_stencil & dw_depth));
       dsa->payload[0] = dw_stencil | dw_depth;
+
+      dsa->dw_blend_alpha = dsa_get_alpha_enable_gen8(dev, &state->alpha);
+      dsa->dw_ps_blend_alpha = (state->alpha.enabled) ?
+         GEN8_PS_BLEND_DW1_ALPHA_TEST_ENABLE : 0;
    } else {
       dsa->payload[0] = dsa_get_stencil_enable_gen6(dev,
             &state->stencil[0], &state->stencil[1]);
       dsa->payload[2] = dsa_get_depth_enable_gen6(dev, &state->depth);
+
+      dsa->dw_blend_alpha = dsa_get_alpha_enable_gen6(dev, &state->alpha);
+      dsa->dw_ps_blend_alpha = 0;
    }
 
    dsa->payload[1] = state->stencil[0].valuemask << 24 |
@@ -2042,10 +2067,6 @@ ilo_gpe_init_dsa(const struct ilo_dev_info *dev,
                      state->stencil[1].valuemask << 8 |
                      state->stencil[1].writemask;
 
-   dsa->dw_blend_alpha = dsa_get_alpha_enable_gen6(dev, &state->alpha);
-   dsa->dw_ps_blend_alpha = (state->alpha.enabled) ?
-      GEN8_PS_BLEND_DW1_ALPHA_TEST_ENABLE : 0;
-
    dsa->alpha_ref = float_to_ubyte(state->alpha.ref_value);
 }