Keith Whitwell | 8e4a95a | 2007-05-24 10:41:34 +0100 | [diff] [blame] | 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" |
Brian | 51b300c | 2007-08-02 10:29:50 -0600 | [diff] [blame] | 31 | #include "st_cb_clear.h" |
Brian | 184b6a1 | 2007-08-02 14:21:16 -0600 | [diff] [blame] | 32 | #include "st_cb_drawpixels.h" |
Brian | 4435bae | 2007-08-06 15:49:11 -0600 | [diff] [blame^] | 33 | #include "st_cb_texture.h" |
Keith Whitwell | 8e4a95a | 2007-05-24 10:41:34 +0100 | [diff] [blame] | 34 | #include "st_atom.h" |
| 35 | #include "st_draw.h" |
| 36 | #include "st_program.h" |
Keith Whitwell | 943964a | 2007-06-14 18:23:43 +0100 | [diff] [blame] | 37 | #include "pipe/p_context.h" |
Keith Whitwell | 8e4a95a | 2007-05-24 10:41:34 +0100 | [diff] [blame] | 38 | |
| 39 | void st_invalidate_state(GLcontext * ctx, GLuint new_state) |
| 40 | { |
| 41 | struct st_context *st = st_context(ctx); |
| 42 | |
| 43 | st->dirty.mesa |= new_state; |
| 44 | st->dirty.st |= ST_NEW_MESA; |
| 45 | } |
| 46 | |
| 47 | |
| 48 | struct st_context *st_create_context( GLcontext *ctx, |
Keith Whitwell | 943964a | 2007-06-14 18:23:43 +0100 | [diff] [blame] | 49 | struct pipe_context *pipe ) |
Keith Whitwell | 8e4a95a | 2007-05-24 10:41:34 +0100 | [diff] [blame] | 50 | { |
| 51 | struct st_context *st = CALLOC_STRUCT( st_context ); |
| 52 | |
| 53 | ctx->st = st; |
| 54 | |
| 55 | st->ctx = ctx; |
Keith Whitwell | 943964a | 2007-06-14 18:23:43 +0100 | [diff] [blame] | 56 | st->pipe = pipe; |
Keith Whitwell | 8e4a95a | 2007-05-24 10:41:34 +0100 | [diff] [blame] | 57 | |
| 58 | st->dirty.mesa = ~0; |
| 59 | st->dirty.st = ~0; |
| 60 | |
| 61 | st_init_atoms( st ); |
| 62 | st_init_draw( st ); |
Brian | 61d0215 | 2007-08-02 20:40:19 -0600 | [diff] [blame] | 63 | |
Keith Whitwell | 4f442d9 | 2007-08-02 13:59:31 +0100 | [diff] [blame] | 64 | st_init_cb_clear( st ); |
Brian | 61d0215 | 2007-08-02 20:40:19 -0600 | [diff] [blame] | 65 | st_init_cb_program( st ); |
Brian | 184b6a1 | 2007-08-02 14:21:16 -0600 | [diff] [blame] | 66 | st_init_cb_drawpixels( st ); |
Brian | 4435bae | 2007-08-06 15:49:11 -0600 | [diff] [blame^] | 67 | st_init_cb_texture( st ); |
Keith Whitwell | 8e4a95a | 2007-05-24 10:41:34 +0100 | [diff] [blame] | 68 | |
| 69 | return st; |
| 70 | } |
| 71 | |
| 72 | |
| 73 | void st_destroy_context( struct st_context *st ) |
| 74 | { |
| 75 | st_destroy_atoms( st ); |
| 76 | st_destroy_draw( st ); |
Brian | 61d0215 | 2007-08-02 20:40:19 -0600 | [diff] [blame] | 77 | |
| 78 | st_destroy_cb_clear( st ); |
Keith Whitwell | 8e4a95a | 2007-05-24 10:41:34 +0100 | [diff] [blame] | 79 | st_destroy_cb_program( st ); |
Brian | 61d0215 | 2007-08-02 20:40:19 -0600 | [diff] [blame] | 80 | st_destroy_cb_drawpixels( st ); |
Brian | 4435bae | 2007-08-06 15:49:11 -0600 | [diff] [blame^] | 81 | /*st_destroy_cb_teximage( st );*/ |
| 82 | st_destroy_cb_texture( st ); |
Brian | 61d0215 | 2007-08-02 20:40:19 -0600 | [diff] [blame] | 83 | |
Keith Whitwell | 943964a | 2007-06-14 18:23:43 +0100 | [diff] [blame] | 84 | st->pipe->destroy( st->pipe ); |
Keith Whitwell | 8e4a95a | 2007-05-24 10:41:34 +0100 | [diff] [blame] | 85 | FREE( st ); |
| 86 | } |
| 87 | |
| 88 | |
| 89 | |