ilo: add variants of 3DSTATE_CLIP
authorChia-I Wu <olvaffe@gmail.com>
Tue, 11 Nov 2014 02:21:03 +0000 (10:21 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Tue, 11 Nov 2014 05:51:21 +0000 (13:51 +0800)
Add gen6_disable_3DSTATE_CLIP to disable clipping.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
src/gallium/drivers/ilo/ilo_builder_3d_bottom.h
src/gallium/drivers/ilo/ilo_render_gen6.c
src/gallium/drivers/ilo/ilo_render_gen7.c

index 2397a2c7943abcc47efce6d95225144d29a0802d..3207843cbcd331be5c70d8c5ef1713ef0722170f 100644 (file)
@@ -46,35 +46,27 @@ gen6_3DSTATE_CLIP(struct ilo_builder *builder,
 {
    const uint8_t cmd_len = 4;
    uint32_t dw1, dw2, dw3, *dw;
+   int interps;
 
    ILO_DEV_ASSERT(builder->dev, 6, 7.5);
 
-   if (rasterizer) {
-      int interps;
-
-      dw1 = rasterizer->clip.payload[0];
-      dw2 = rasterizer->clip.payload[1];
-      dw3 = rasterizer->clip.payload[2];
+   dw1 = rasterizer->clip.payload[0];
+   dw2 = rasterizer->clip.payload[1];
+   dw3 = rasterizer->clip.payload[2];
 
-      if (enable_guardband && rasterizer->clip.can_enable_guardband)
-         dw2 |= GEN6_CLIP_DW2_GB_TEST_ENABLE;
+   if (enable_guardband && rasterizer->clip.can_enable_guardband)
+      dw2 |= GEN6_CLIP_DW2_GB_TEST_ENABLE;
 
-      interps = (fs) ?  ilo_shader_get_kernel_param(fs,
-            ILO_KERNEL_FS_BARYCENTRIC_INTERPOLATIONS) : 0;
+   interps = (fs) ?  ilo_shader_get_kernel_param(fs,
+         ILO_KERNEL_FS_BARYCENTRIC_INTERPOLATIONS) : 0;
 
-      if (interps & (GEN6_INTERP_NONPERSPECTIVE_PIXEL |
-                     GEN6_INTERP_NONPERSPECTIVE_CENTROID |
-                     GEN6_INTERP_NONPERSPECTIVE_SAMPLE))
-         dw2 |= GEN6_CLIP_DW2_NONPERSPECTIVE_BARYCENTRIC_ENABLE;
+   if (interps & (GEN6_INTERP_NONPERSPECTIVE_PIXEL |
+                  GEN6_INTERP_NONPERSPECTIVE_CENTROID |
+                  GEN6_INTERP_NONPERSPECTIVE_SAMPLE))
+      dw2 |= GEN6_CLIP_DW2_NONPERSPECTIVE_BARYCENTRIC_ENABLE;
 
-      dw3 |= GEN6_CLIP_DW3_RTAINDEX_FORCED_ZERO |
-             (num_viewports - 1);
-   }
-   else {
-      dw1 = 0;
-      dw2 = 0;
-      dw3 = 0;
-   }
+   dw3 |= GEN6_CLIP_DW3_RTAINDEX_FORCED_ZERO |
+          (num_viewports - 1);
 
    ilo_builder_batch_pointer(builder, cmd_len, &dw);
 
@@ -84,6 +76,22 @@ gen6_3DSTATE_CLIP(struct ilo_builder *builder,
    dw[3] = dw3;
 }
 
+static inline void
+gen6_disable_3DSTATE_CLIP(struct ilo_builder *builder)
+{
+   const uint8_t cmd_len = 4;
+   uint32_t *dw;
+
+   ILO_DEV_ASSERT(builder->dev, 6, 7.5);
+
+   ilo_builder_batch_pointer(builder, cmd_len, &dw);
+
+   dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_CLIP) | (cmd_len - 2);
+   dw[1] = 0;
+   dw[2] = 0;
+   dw[3] = 0;
+}
+
 /**
  * Fill in DW2 to DW7 of 3DSTATE_SF.
  */
index deaa515006843b90a0ad1e8d6b17f7f847ff6c67..70a7400d5dd7382a69f3b1923219709336cf719b 100644 (file)
@@ -851,7 +851,7 @@ gen6_rectlist_vs_to_sf(struct ilo_render *r,
    gen6_3DSTATE_CONSTANT_GS(r->builder, NULL, NULL, 0);
    gen6_3DSTATE_GS(r->builder, NULL, NULL, 0);
 
-   gen6_3DSTATE_CLIP(r->builder, NULL, NULL, false, 0);
+   gen6_disable_3DSTATE_CLIP(r->builder);
    gen6_3DSTATE_SF(r->builder, NULL, NULL);
 }
 
index e0e6d06ba998bc2fa596ede459a4ef553629736f..79d147a7a25385d3520e0899bbff6fa7bb7e1fb3 100644 (file)
@@ -737,7 +737,7 @@ gen7_rectlist_vs_to_sf(struct ilo_render *r,
 
    gen7_3DSTATE_STREAMOUT(r->builder, 0x0, 0, false);
 
-   gen6_3DSTATE_CLIP(r->builder, NULL, NULL, false, 0);
+   gen6_disable_3DSTATE_CLIP(r->builder);
 
    gen7_wa_pre_3dstate_sf_depth_bias(r);