[Mesa-dev] [PATCH 2/5] st/mesa: don't check st->vp in update_clip

Marek Olšák maraeo at gmail.com
Thu Feb 23 00:07:48 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

The clip state is updated before VS, so it can be NULL for the first draw
call. Just remove the unnecessary dependency on st->vp.
---
 src/mesa/state_tracker/st_atom_clip.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c
index 9d2870f..0df7985 100644
--- a/src/mesa/state_tracker/st_atom_clip.c
+++ b/src/mesa/state_tracker/st_atom_clip.c
@@ -44,24 +44,22 @@
 static void update_clip( struct st_context *st )
 {
    struct pipe_clip_state clip;
    const struct gl_context *ctx = st->ctx;
    bool use_eye = FALSE;
 
    STATIC_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. */
-   if (st->vp) {
-      if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX])
-         use_eye = TRUE;
-   }
+   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) {
       st->state.clip = clip;
-- 
2.7.4



More information about the mesa-dev mailing list