#include "st_context.h"
#include "pipe/p_context.h"
#include "st_atom.h"
-
+#include "st_program.h"
#include "cso_cache/cso_context.h"
struct pipe_clip_state clip;
const struct gl_context *ctx = st->ctx;
GLuint i;
+ bool use_eye = FALSE;
memset(&clip, 0, sizeof(clip));
+ /* if we have a vertex shader that writes clip vertex we need to pass
+ the pre-projection transformed coordinates into the driver. */
+ if (st->vp) {
+ if (ctx->Shader.CurrentVertexProgram)
+ use_eye = TRUE;
+ }
+
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++;
+ memcpy(clip.ucp[clip.nr],
+ use_eye ? ctx->Transform.EyeUserPlane[i] : ctx->Transform._ClipUserPlane[i],
+ sizeof(clip.ucp[0]));
+ clip.nr++;
}
}
const struct st_tracked_state st_update_clip = {
"st_update_clip", /* name */
{ /* dirty */
- (_NEW_TRANSFORM), /* mesa */
+ (_NEW_TRANSFORM | _NEW_PROGRAM), /* mesa */
0, /* st */
},
update_clip /* update */