- for (i = 0; i < PIPE_MAX_CLIP_PLANES; i++) {
- if (st->ctx->Transform.ClipPlanesEnabled & (1 << i)) {
- memcpy(clip.ucp[clip.nr],
- st->ctx->Transform._ClipUserPlane[i],
- sizeof(clip.ucp[0]));
- clip.nr++;
- }
- }
-
- if (memcmp(&clip, &st->state.clip, sizeof(clip)) != 0) {
+ /* if we have a vertex shader that writes clip vertex we need to pass
+ the pre-projection transformed coordinates into the driver. */
+ if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX])
+ use_eye = TRUE;
+
+ /* _ClipUserPlane = _NEW_TRANSFORM | _NEW_PROJECTION
+ * EyeUserPlane = _NEW_TRANSFORM
+ */
+ memcpy(clip.ucp,
+ use_eye ? ctx->Transform.EyeUserPlane
+ : ctx->Transform._ClipUserPlane, sizeof(clip.ucp));
+
+ if (memcmp(&st->state.clip, &clip, sizeof(clip)) != 0) {