Merge branch 'mesa_7_7_branch'
[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 #include "pipe/p_defines.h"
35
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 struct cso_context;
42
43 struct cso_context *cso_create_context( struct pipe_context *pipe );
44
45 void cso_release_all( struct cso_context *ctx );
46
47 void cso_destroy_context( struct cso_context *cso );
48
49
50
51 enum pipe_error cso_set_blend( struct cso_context *cso,
52 const struct pipe_blend_state *blend );
53 void cso_save_blend(struct cso_context *cso);
54 void cso_restore_blend(struct cso_context *cso);
55
56
57
58 enum pipe_error cso_set_depth_stencil_alpha( struct cso_context *cso,
59 const struct pipe_depth_stencil_alpha_state *dsa );
60 void cso_save_depth_stencil_alpha(struct cso_context *cso);
61 void cso_restore_depth_stencil_alpha(struct cso_context *cso);
62
63
64
65 enum pipe_error cso_set_rasterizer( struct cso_context *cso,
66 const struct pipe_rasterizer_state *rasterizer );
67 void cso_save_rasterizer(struct cso_context *cso);
68 void cso_restore_rasterizer(struct cso_context *cso);
69
70
71
72 enum pipe_error cso_set_samplers( struct cso_context *cso,
73 unsigned count,
74 const struct pipe_sampler_state **states );
75 void cso_save_samplers(struct cso_context *cso);
76 void cso_restore_samplers(struct cso_context *cso);
77
78 /* Alternate interface to support state trackers that like to modify
79 * samplers one at a time:
80 */
81 enum pipe_error cso_single_sampler( struct cso_context *cso,
82 unsigned nr,
83 const struct pipe_sampler_state *states );
84
85 void cso_single_sampler_done( struct cso_context *cso );
86
87 void
88 cso_save_vertex_samplers(struct cso_context *cso);
89
90 void
91 cso_restore_vertex_samplers(struct cso_context *cso);
92
93 enum pipe_error
94 cso_single_vertex_sampler(struct cso_context *cso,
95 unsigned nr,
96 const struct pipe_sampler_state *states);
97
98 void
99 cso_single_vertex_sampler_done(struct cso_context *cso);
100
101
102
103 enum pipe_error cso_set_sampler_textures( struct cso_context *cso,
104 uint count,
105 struct pipe_texture **textures );
106 void cso_save_sampler_textures( struct cso_context *cso );
107 void cso_restore_sampler_textures( struct cso_context *cso );
108
109
110
111 enum pipe_error
112 cso_set_vertex_sampler_textures(struct cso_context *cso,
113 uint count,
114 struct pipe_texture **textures);
115 void
116 cso_save_vertex_sampler_textures(struct cso_context *cso);
117 void
118 cso_restore_vertex_sampler_textures(struct cso_context *cso);
119
120
121
122 /* These aren't really sensible -- most of the time the api provides
123 * object semantics for shaders anyway, and the cases where it doesn't
124 * (eg mesa's internall-generated texenv programs), it will be up to
125 * the state tracker to implement their own specialized caching.
126 */
127 enum pipe_error cso_set_fragment_shader_handle(struct cso_context *ctx,
128 void *handle );
129 void cso_delete_fragment_shader(struct cso_context *ctx, void *handle );
130 /*
131 enum pipe_error cso_set_fragment_shader( struct cso_context *cso,
132 const struct pipe_shader_state *shader );
133 */
134 void cso_save_fragment_shader(struct cso_context *cso);
135 void cso_restore_fragment_shader(struct cso_context *cso);
136
137
138 enum pipe_error cso_set_vertex_shader_handle(struct cso_context *ctx,
139 void *handle );
140 void cso_delete_vertex_shader(struct cso_context *ctx, void *handle );
141 /*
142 enum pipe_error cso_set_vertex_shader( struct cso_context *cso,
143 const struct pipe_shader_state *shader );
144 */
145 void cso_save_vertex_shader(struct cso_context *cso);
146 void cso_restore_vertex_shader(struct cso_context *cso);
147
148
149
150 enum pipe_error cso_set_framebuffer(struct cso_context *cso,
151 const struct pipe_framebuffer_state *fb);
152 void cso_save_framebuffer(struct cso_context *cso);
153 void cso_restore_framebuffer(struct cso_context *cso);
154
155
156 enum pipe_error cso_set_viewport(struct cso_context *cso,
157 const struct pipe_viewport_state *vp);
158 void cso_save_viewport(struct cso_context *cso);
159 void cso_restore_viewport(struct cso_context *cso);
160
161
162 enum pipe_error cso_set_blend_color(struct cso_context *cso,
163 const struct pipe_blend_color *bc);
164
165
166 #ifdef __cplusplus
167 }
168 #endif
169
170 #endif