- for (i = 0; i < PIPE_MAX_CLIP_PLANES; i++) {
- if (ctx->Transform.ClipPlanesEnabled & (1 << i)) {
- memcpy(clip.ucp[clip.nr],
- ctx->Transform._ClipUserPlane[i],
- sizeof(clip.ucp[0]));
- clip.nr++;
- }
- }
+ /* 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));