blob: cde1dd11ca30235289c6dc171d4b71eb73fd7d5e [file] [log] [blame]
Keith Whitwell8e4a95a2007-05-24 10:41:34 +01001/**************************************************************************
2 *
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28#include "imports.h"
29#include "st_public.h"
30#include "st_context.h"
Brian51b300c2007-08-02 10:29:50 -060031#include "st_cb_clear.h"
Keith Whitwell8e4a95a2007-05-24 10:41:34 +010032#include "st_atom.h"
33#include "st_draw.h"
34#include "st_program.h"
Keith Whitwell943964a2007-06-14 18:23:43 +010035#include "pipe/p_context.h"
Keith Whitwell8e4a95a2007-05-24 10:41:34 +010036
37void st_invalidate_state(GLcontext * ctx, GLuint new_state)
38{
39 struct st_context *st = st_context(ctx);
40
41 st->dirty.mesa |= new_state;
42 st->dirty.st |= ST_NEW_MESA;
43}
44
45
46struct st_context *st_create_context( GLcontext *ctx,
Keith Whitwell943964a2007-06-14 18:23:43 +010047 struct pipe_context *pipe )
Keith Whitwell8e4a95a2007-05-24 10:41:34 +010048{
49 struct st_context *st = CALLOC_STRUCT( st_context );
50
51 ctx->st = st;
52
53 st->ctx = ctx;
Keith Whitwell943964a2007-06-14 18:23:43 +010054 st->pipe = pipe;
Keith Whitwell8e4a95a2007-05-24 10:41:34 +010055
56 st->dirty.mesa = ~0;
57 st->dirty.st = ~0;
58
59 st_init_atoms( st );
60 st_init_draw( st );
61 st_init_cb_program( st );
Keith Whitwell4f442d92007-08-02 13:59:31 +010062 st_init_cb_clear( st );
Keith Whitwell8e4a95a2007-05-24 10:41:34 +010063
64 return st;
65}
66
67
68void st_destroy_context( struct st_context *st )
69{
70 st_destroy_atoms( st );
71 st_destroy_draw( st );
72 st_destroy_cb_program( st );
Keith Whitwell943964a2007-06-14 18:23:43 +010073 st->pipe->destroy( st->pipe );
Keith Whitwell8e4a95a2007-05-24 10:41:34 +010074 FREE( st );
75}
76
77
78