i965: Always reserve clip distance VUE slots in SSO mode.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_vue_map.c
index f1af22147cc68135cec8d6916e873a8e0b6c91e6..4d509d3901434969943f452a0570edddb843ab5d 100644 (file)
@@ -68,6 +68,19 @@ brw_compute_vue_map(const struct gen_device_info *devinfo,
    if (devinfo->gen < 6)
       separate = false;
 
+   if (separate) {
+      /* In SSO mode, we don't know whether the adjacent stage will
+       * read/write gl_ClipDistance, which has a fixed slot location.
+       * We have to assume the worst and reserve a slot for it, or else
+       * the rest of our varyings will be off by a slot.
+       *
+       * Note that we don't have to worry about COL/BFC, as those built-in
+       * variables only exist in legacy GL, which only supports VS and FS.
+       */
+      slots_valid |= BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST0);
+      slots_valid |= BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST1);
+   }
+
    vue_map->slots_valid = slots_valid;
    vue_map->separate = separate;