diff options
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_atom_clip.c')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_clip.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_clip.c b/mesalib/src/mesa/state_tracker/st_atom_clip.c index 236d3cf40..2a5110098 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_clip.c +++ b/mesalib/src/mesa/state_tracker/st_atom_clip.c @@ -35,6 +35,7 @@ #include "pipe/p_context.h" #include "st_atom.h" #include "st_program.h" +#include "util/u_debug.h" #include "cso_cache/cso_context.h" @@ -44,10 +45,9 @@ static void update_clip( struct st_context *st ) { struct pipe_clip_state clip; const struct gl_context *ctx = st->ctx; - GLuint i; bool use_eye = FALSE; - memset(&clip, 0, sizeof(clip)); + assert(sizeof(clip.ucp) <= sizeof(ctx->Transform._ClipUserPlane)); /* if we have a vertex shader that writes clip vertex we need to pass the pre-projection transformed coordinates into the driver. */ @@ -56,21 +56,11 @@ static void update_clip( struct st_context *st ) use_eye = TRUE; } - for (i = 0; i < PIPE_MAX_CLIP_PLANES; i++) { - if (ctx->Transform.ClipPlanesEnabled & (1 << i)) { - memcpy(clip.ucp[clip.nr], - use_eye ? ctx->Transform.EyeUserPlane[i] : ctx->Transform._ClipUserPlane[i], - sizeof(clip.ucp[0])); - clip.nr++; - } - } - - clip.depth_clamp = ctx->Transform.DepthClamp != GL_FALSE; - - if (memcmp(&clip, &st->state.clip, sizeof(clip)) != 0) { - st->state.clip = clip; - cso_set_clip(st->cso_context, &clip); - } + memcpy(clip.ucp, + use_eye ? ctx->Transform.EyeUserPlane + : ctx->Transform._ClipUserPlane, sizeof(clip.ucp)); + st->state.clip = clip; + cso_set_clip(st->cso_context, &clip); } |