Renamed softpipe directories and files to something less confusing.
[mesa.git] / src / mesa / state_tracker / st_context.c
1 /**************************************************************************
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"
31 #include "st_atom.h"
32 #include "st_draw.h"
33 #include "st_program.h"
34 #include "softpipe/sp_context.h"
35
36 void st_invalidate_state(GLcontext * ctx, GLuint new_state)
37 {
38 struct st_context *st = st_context(ctx);
39
40 st->dirty.mesa |= new_state;
41 st->dirty.st |= ST_NEW_MESA;
42 }
43
44
45 struct st_context *st_create_context( GLcontext *ctx,
46 struct softpipe_context *softpipe )
47 {
48 struct st_context *st = CALLOC_STRUCT( st_context );
49
50 ctx->st = st;
51
52 st->ctx = ctx;
53 st->softpipe = softpipe;
54
55 st->dirty.mesa = ~0;
56 st->dirty.st = ~0;
57
58 st_init_atoms( st );
59 st_init_draw( st );
60 st_init_cb_program( st );
61
62 return st;
63 }
64
65
66 void st_destroy_context( struct st_context *st )
67 {
68 st_destroy_atoms( st );
69 st_destroy_draw( st );
70 st_destroy_cb_program( st );
71 st->softpipe->destroy( st->softpipe );
72 FREE( st );
73 }
74
75
76