Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
[mesa.git] / src / gallium / auxiliary / cso_cache / cso_context.h
1 /**************************************************************************
2 *
3 * Copyright 2007-2008 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
29 #ifndef CSO_CONTEXT_H
30 #define CSO_CONTEXT_H
31
32 #include "pipe/p_context.h"
33 #include "pipe/p_state.h"
34
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 struct cso_context;
41
42 struct cso_context *cso_create_context( struct pipe_context *pipe );
43
44 void cso_destroy_context( struct cso_context *cso );
45
46
47
48 void cso_set_blend( struct cso_context *cso,
49 const struct pipe_blend_state *blend );
50 void cso_save_blend(struct cso_context *cso);
51 void cso_restore_blend(struct cso_context *cso);
52
53
54
55 void cso_set_depth_stencil_alpha( struct cso_context *cso,
56 const struct pipe_depth_stencil_alpha_state *dsa );
57 void cso_save_depth_stencil_alpha(struct cso_context *cso);
58 void cso_restore_depth_stencil_alpha(struct cso_context *cso);
59
60
61
62 void cso_set_rasterizer( struct cso_context *cso,
63 const struct pipe_rasterizer_state *rasterizer );
64 void cso_save_rasterizer(struct cso_context *cso);
65 void cso_restore_rasterizer(struct cso_context *cso);
66
67
68
69 void cso_set_samplers( struct cso_context *cso,
70 unsigned count,
71 const struct pipe_sampler_state **states );
72 void cso_save_samplers(struct cso_context *cso);
73 void cso_restore_samplers(struct cso_context *cso);
74
75 /* Alternate interface to support state trackers that like to modify
76 * samplers one at a time:
77 */
78 void cso_single_sampler( struct cso_context *cso,
79 unsigned nr,
80 const struct pipe_sampler_state *states );
81
82 void cso_single_sampler_done( struct cso_context *cso );
83
84
85
86 void cso_set_sampler_textures( struct cso_context *cso,
87 uint count,
88 struct pipe_texture **textures );
89 void cso_save_sampler_textures( struct cso_context *cso );
90 void cso_restore_sampler_textures( struct cso_context *cso );
91
92
93
94 /* These aren't really sensible -- most of the time the api provides
95 * object semantics for shaders anyway, and the cases where it doesn't
96 * (eg mesa's internall-generated texenv programs), it will be up to
97 * the state tracker to implement their own specialized caching.
98 */
99 void cso_set_fragment_shader( struct cso_context *cso,
100 const struct pipe_shader_state *shader );
101 void cso_save_fragment_shader(struct cso_context *cso);
102 void cso_restore_fragment_shader(struct cso_context *cso);
103
104
105
106 void cso_set_vertex_shader( struct cso_context *cso,
107 const struct pipe_shader_state *shader );
108 void cso_save_vertex_shader(struct cso_context *cso);
109 void cso_restore_vertex_shader(struct cso_context *cso);
110
111
112
113 void cso_set_framebuffer(struct cso_context *cso,
114 const struct pipe_framebuffer_state *fb);
115 void cso_save_framebuffer(struct cso_context *cso);
116 void cso_restore_framebuffer(struct cso_context *cso);
117
118
119 void cso_set_viewport(struct cso_context *cso,
120 const struct pipe_viewport_state *vp);
121 void cso_save_viewport(struct cso_context *cso);
122 void cso_restore_viewport(struct cso_context *cso);
123
124
125 void cso_set_blend_color(struct cso_context *cso,
126 const struct pipe_blend_color *bc);
127
128
129 #ifdef __cplusplus
130 }
131 #endif
132
133 #endif