1 /**************************************************************************
3 * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
32 #include "pipe/p_context.h"
33 #include "pipe/p_state.h"
34 #include "pipe/p_defines.h"
43 struct cso_context
*cso_create_context( struct pipe_context
*pipe
);
45 void cso_release_all( struct cso_context
*ctx
);
47 void cso_destroy_context( struct cso_context
*cso
);
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
);
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
);
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
);
72 enum pipe_error
cso_set_samplers( struct cso_context
*cso
,
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
);
78 /* Alternate interface to support state trackers that like to modify
79 * samplers one at a time:
81 enum pipe_error
cso_single_sampler( struct cso_context
*cso
,
83 const struct pipe_sampler_state
*states
);
85 void cso_single_sampler_done( struct cso_context
*cso
);
87 enum pipe_error
cso_set_vertex_samplers(struct cso_context
*cso
,
89 const struct pipe_sampler_state
**states
);
92 cso_save_vertex_samplers(struct cso_context
*cso
);
95 cso_restore_vertex_samplers(struct cso_context
*cso
);
98 cso_single_vertex_sampler(struct cso_context
*cso
,
100 const struct pipe_sampler_state
*states
);
103 cso_single_vertex_sampler_done(struct cso_context
*cso
);
107 enum pipe_error
cso_set_sampler_textures( struct cso_context
*cso
,
109 struct pipe_texture
**textures
);
110 void cso_save_sampler_textures( struct cso_context
*cso
);
111 void cso_restore_sampler_textures( struct cso_context
*cso
);
116 cso_set_vertex_sampler_textures(struct cso_context
*cso
,
118 struct pipe_texture
**textures
);
120 cso_save_vertex_sampler_textures(struct cso_context
*cso
);
122 cso_restore_vertex_sampler_textures(struct cso_context
*cso
);
126 /* These aren't really sensible -- most of the time the api provides
127 * object semantics for shaders anyway, and the cases where it doesn't
128 * (eg mesa's internall-generated texenv programs), it will be up to
129 * the state tracker to implement their own specialized caching.
131 enum pipe_error
cso_set_fragment_shader_handle(struct cso_context
*ctx
,
133 void cso_delete_fragment_shader(struct cso_context
*ctx
, void *handle
);
135 enum pipe_error cso_set_fragment_shader( struct cso_context *cso,
136 const struct pipe_shader_state *shader );
138 void cso_save_fragment_shader(struct cso_context
*cso
);
139 void cso_restore_fragment_shader(struct cso_context
*cso
);
142 enum pipe_error
cso_set_vertex_shader_handle(struct cso_context
*ctx
,
144 void cso_delete_vertex_shader(struct cso_context
*ctx
, void *handle
);
146 enum pipe_error cso_set_vertex_shader( struct cso_context *cso,
147 const struct pipe_shader_state *shader );
149 void cso_save_vertex_shader(struct cso_context
*cso
);
150 void cso_restore_vertex_shader(struct cso_context
*cso
);
153 enum pipe_error
cso_set_geometry_shader_handle(struct cso_context
*ctx
,
155 void cso_delete_geometry_shader(struct cso_context
*ctx
, void *handle
);
156 void cso_save_geometry_shader(struct cso_context
*cso
);
157 void cso_restore_geometry_shader(struct cso_context
*cso
);
161 enum pipe_error
cso_set_framebuffer(struct cso_context
*cso
,
162 const struct pipe_framebuffer_state
*fb
);
163 void cso_save_framebuffer(struct cso_context
*cso
);
164 void cso_restore_framebuffer(struct cso_context
*cso
);
167 enum pipe_error
cso_set_viewport(struct cso_context
*cso
,
168 const struct pipe_viewport_state
*vp
);
169 void cso_save_viewport(struct cso_context
*cso
);
170 void cso_restore_viewport(struct cso_context
*cso
);
173 enum pipe_error
cso_set_blend_color(struct cso_context
*cso
,
174 const struct pipe_blend_color
*bc
);