1 /**************************************************************************
3 * Copyright 2007 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 **************************************************************************/
28 /* Authors: Keith Whitwell <keith@tungstengraphics.com>
34 #include "pipe/p_state.h"
36 #include "x86/rtasm/x86sse.h"
43 * Softpipe fs state is derived from pipe_shader_state.
45 struct sp_fragment_shader_state
{
46 struct pipe_shader_state shader
;
47 #if defined(__i386__) || defined(__386__)
48 struct x86_function sse2_program
;
51 struct gallivm_prog
*llvm_prog
;
55 struct softpipe_texture
57 struct pipe_texture base
;
59 /* Derived from the above:
62 unsigned depth_pitch
; /* per-image on i945? */
63 unsigned total_height
;
65 unsigned nr_images
[PIPE_MAX_TEXTURE_LEVELS
];
67 /* Explicitly store the offset of each image for each cube face or
68 * depth value. Pretty much have to accept that hardware formats
69 * are going to be so diverse that there is no unified way to
70 * compute the offsets of depth/cube images within a mipmap level,
71 * so have to store them as a lookup table:
73 unsigned *image_offset
[PIPE_MAX_TEXTURE_LEVELS
]; /**< array [depth] of offsets */
75 /* Includes image offset tables:
77 unsigned long level_offset
[PIPE_MAX_TEXTURE_LEVELS
];
79 /* The data is held here:
81 struct pipe_buffer_handle
*buffer
;
85 softpipe_create_alpha_test_state(struct pipe_context
*,
86 const struct pipe_alpha_test_state
*);
88 softpipe_bind_alpha_test_state(struct pipe_context
*, void *);
90 softpipe_delete_alpha_test_state(struct pipe_context
*, void *);
93 softpipe_create_blend_state(struct pipe_context
*,
94 const struct pipe_blend_state
*);
95 void softpipe_bind_blend_state(struct pipe_context
*,
97 void softpipe_delete_blend_state(struct pipe_context
*,
101 softpipe_create_sampler_state(struct pipe_context
*,
102 const struct pipe_sampler_state
*);
103 void softpipe_bind_sampler_state(struct pipe_context
*, unsigned, void *);
104 void softpipe_delete_sampler_state(struct pipe_context
*, void *);
107 softpipe_create_depth_stencil_state(struct pipe_context
*,
108 const struct pipe_depth_stencil_state
*);
109 void softpipe_bind_depth_stencil_state(struct pipe_context
*, void *);
110 void softpipe_delete_depth_stencil_state(struct pipe_context
*, void *);
113 softpipe_create_rasterizer_state(struct pipe_context
*,
114 const struct pipe_rasterizer_state
*);
115 void softpipe_bind_rasterizer_state(struct pipe_context
*, void *);
116 void softpipe_delete_rasterizer_state(struct pipe_context
*, void *);
118 void softpipe_set_framebuffer_state( struct pipe_context
*,
119 const struct pipe_framebuffer_state
* );
121 void softpipe_set_blend_color( struct pipe_context
*pipe
,
122 const struct pipe_blend_color
*blend_color
);
124 void softpipe_set_clear_color_state( struct pipe_context
*,
125 const struct pipe_clear_color_state
* );
127 void softpipe_set_clip_state( struct pipe_context
*,
128 const struct pipe_clip_state
* );
130 void softpipe_set_constant_buffer(struct pipe_context
*,
131 uint shader
, uint index
,
132 const struct pipe_constant_buffer
*buf
);
134 void softpipe_set_feedback_state( struct pipe_context
*,
135 const struct pipe_feedback_state
* );
137 void *softpipe_create_fs_state(struct pipe_context
*,
138 const struct pipe_shader_state
*);
139 void softpipe_bind_fs_state(struct pipe_context
*, void *);
140 void softpipe_delete_fs_state(struct pipe_context
*, void *);
141 void *softpipe_create_vs_state(struct pipe_context
*,
142 const struct pipe_shader_state
*);
143 void softpipe_bind_vs_state(struct pipe_context
*, void *);
144 void softpipe_delete_vs_state(struct pipe_context
*, void *);
146 void softpipe_set_polygon_stipple( struct pipe_context
*,
147 const struct pipe_poly_stipple
* );
149 void softpipe_set_sampler_units( struct pipe_context
*,
150 uint numSamplers
, const uint
*units
);
152 void softpipe_set_scissor_state( struct pipe_context
*,
153 const struct pipe_scissor_state
* );
155 void softpipe_set_texture_state( struct pipe_context
*,
157 struct pipe_texture
* );
159 void softpipe_set_viewport_state( struct pipe_context
*,
160 const struct pipe_viewport_state
* );
162 void softpipe_set_vertex_element(struct pipe_context
*,
164 const struct pipe_vertex_element
*);
166 void softpipe_set_vertex_buffer(struct pipe_context
*,
168 const struct pipe_vertex_buffer
*);
170 void softpipe_set_feedback_buffer(struct pipe_context
*,
172 const struct pipe_feedback_buffer
*);
176 void softpipe_update_derived( struct softpipe_context
*softpipe
);
179 boolean
softpipe_draw_arrays(struct pipe_context
*pipe
, unsigned mode
,
180 unsigned start
, unsigned count
);
182 boolean
softpipe_draw_elements(struct pipe_context
*pipe
,
183 struct pipe_buffer_handle
*indexBuffer
,
185 unsigned mode
, unsigned start
, unsigned count
);
189 softpipe_map_surfaces(struct softpipe_context
*sp
);
192 softpipe_unmap_surfaces(struct softpipe_context
*sp
);
195 softpipe_map_texture_surfaces(struct softpipe_context
*sp
);
198 softpipe_unmap_texture_surfaces(struct softpipe_context
*sp
);