st_atom_clip.c

Go to the documentation of this file.
00001 /**************************************************************************
00002  * 
00003  * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
00004  * All Rights Reserved.
00005  * 
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation the rights to use, copy, modify, merge, publish,
00010  * distribute, sub license, and/or sell copies of the Software, and to
00011  * permit persons to whom the Software is furnished to do so, subject to
00012  * the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial portions
00016  * of the Software.
00017  * 
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
00021  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
00022  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00023  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00024  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025  * 
00026  **************************************************************************/
00027 
00028  /*
00029   * Authors:
00030   *   Keith Whitwell <keith@tungstengraphics.com>
00031   */
00032  
00033 
00034 #include "st_context.h"
00035 #include "pipe/p_context.h"
00036 #include "st_atom.h"
00037 
00038 
00039 /* Second state atom for user clip planes:
00040  */
00041 static void update_clip( struct st_context *st )
00042 {
00043    struct pipe_clip_state clip;
00044    GLuint i;
00045 
00046    memset(&clip, 0, sizeof(clip));
00047 
00048    for (i = 0; i < PIPE_MAX_CLIP_PLANES; i++) {
00049       if (st->ctx->Transform.ClipPlanesEnabled & (1 << i)) {
00050          memcpy(clip.ucp[clip.nr], 
00051                 st->ctx->Transform._ClipUserPlane[i], 
00052                 sizeof(clip.ucp[0]));
00053          clip.nr++;
00054       }
00055    }
00056       
00057    if (memcmp(&clip, &st->state.clip, sizeof(clip)) != 0) {
00058       st->state.clip = clip;
00059       st->pipe->set_clip_state(st->pipe, &clip);
00060    }
00061 }
00062 
00063 
00064 const struct st_tracked_state st_update_clip = {
00065    "st_update_clip",                                    /* name */
00066    {                                                    /* dirty */
00067       (_NEW_TRANSFORM),                                 /* mesa */
00068       0,                                                /* st */
00069    },
00070    update_clip                                          /* update */
00071 };

Generated on Tue Sep 29 06:25:18 2009 for Gallium3D by  doxygen 1.5.4