blob: 570bc549cc437b592e9fc30de129d479a54691d3 [file] [log] [blame]
Brian08e341e2008-03-14 15:54:02 -06001/**************************************************************************
2 *
José Fonseca87712852014-01-17 16:27:50 +00003 * Copyright 2007 VMware, Inc.
Brian08e341e2008-03-14 15:54:02 -06004 * 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.
José Fonseca87712852014-01-17 16:27:50 +000021 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
Brian08e341e2008-03-14 15:54:02 -060022 * 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
José Fonseca87712852014-01-17 16:27:50 +000028/* Authors: Keith Whitwell <keithw@vmware.com>
Brian08e341e2008-03-14 15:54:02 -060029 */
30
31#ifndef SP_STATE_H
32#define SP_STATE_H
33
34#include "pipe/p_state.h"
José Fonsecac208a2c2008-07-28 12:42:13 +090035#include "tgsi/tgsi_scan.h"
Brian08e341e2008-03-14 15:54:02 -060036
37
38#define SP_NEW_VIEWPORT 0x1
39#define SP_NEW_RASTERIZER 0x2
40#define SP_NEW_FS 0x4
41#define SP_NEW_BLEND 0x8
42#define SP_NEW_CLIP 0x10
43#define SP_NEW_SCISSOR 0x20
44#define SP_NEW_STIPPLE 0x40
45#define SP_NEW_FRAMEBUFFER 0x80
46#define SP_NEW_DEPTH_STENCIL_ALPHA 0x100
47#define SP_NEW_CONSTANTS 0x200
48#define SP_NEW_SAMPLER 0x400
49#define SP_NEW_TEXTURE 0x800
50#define SP_NEW_VERTEX 0x1000
51#define SP_NEW_VS 0x2000
52#define SP_NEW_QUERY 0x4000
Zack Rusin89d85772009-12-14 17:11:46 -050053#define SP_NEW_GS 0x8000
Zack Rusina45b7f42010-05-28 13:14:07 -040054#define SP_NEW_SO 0x10000
55#define SP_NEW_SO_BUFFERS 0x20000
Brian08e341e2008-03-14 15:54:02 -060056
57
58struct tgsi_sampler;
Dave Airlieeb9ad9f2016-03-22 07:59:35 +100059struct tgsi_image;
Brian08e341e2008-03-14 15:54:02 -060060struct tgsi_exec_machine;
Brian Paul9671f7a2008-05-17 10:30:21 -060061struct vertex_info;
Brian08e341e2008-03-14 15:54:02 -060062
63
Brian Paulc534f112011-07-21 09:55:22 -060064struct sp_fragment_shader_variant_key
65{
Brian Paul57aa5972011-07-21 09:55:22 -060066 boolean polygon_stipple;
Brian Paulc534f112011-07-21 09:55:22 -060067};
Brian08e341e2008-03-14 15:54:02 -060068
Brian Paulc534f112011-07-21 09:55:22 -060069
70struct sp_fragment_shader_variant
71{
72 const struct tgsi_token *tokens;
73 struct sp_fragment_shader_variant_key key;
Brian08e341e2008-03-14 15:54:02 -060074 struct tgsi_shader_info info;
75
Brian Paul57aa5972011-07-21 09:55:22 -060076 unsigned stipple_sampler_unit;
77
Brian Paulc534f112011-07-21 09:55:22 -060078 /* See comments about this elsewhere */
79#if 0
Brian Paule22e3922010-09-17 18:41:30 -060080 struct draw_fragment_shader *draw_shader;
Brian Paulc534f112011-07-21 09:55:22 -060081#endif
Brian Paule22e3922010-09-17 18:41:30 -060082
Brian Paulc534f112011-07-21 09:55:22 -060083 void (*prepare)(const struct sp_fragment_shader_variant *shader,
84 struct tgsi_exec_machine *machine,
Dave Airlieeb9ad9f2016-03-22 07:59:35 +100085 struct tgsi_sampler *sampler,
86 struct tgsi_image *image);
Brian08e341e2008-03-14 15:54:02 -060087
Brian Paulc534f112011-07-21 09:55:22 -060088 unsigned (*run)(const struct sp_fragment_shader_variant *shader,
89 struct tgsi_exec_machine *machine,
Dave Airlie493eab72016-03-22 07:52:26 +100090 struct quad_header *quad,
91 bool early_depth_test);
Brian Paulc534f112011-07-21 09:55:22 -060092
93 /* Deletes this instance of the object */
Brian Paulfddcc672012-12-14 10:47:46 -070094 void (*delete)(struct sp_fragment_shader_variant *shader,
95 struct tgsi_exec_machine *machine);
Brian Paulc534f112011-07-21 09:55:22 -060096
97 struct sp_fragment_shader_variant *next;
98};
Brian08e341e2008-03-14 15:54:02 -060099
100
Brian Paulc534f112011-07-21 09:55:22 -0600101/** Subclass of pipe_shader_state */
102struct sp_fragment_shader {
103 struct pipe_shader_state shader;
104 struct sp_fragment_shader_variant *variants;
105 struct draw_fragment_shader *draw_shader;
Brian08e341e2008-03-14 15:54:02 -0600106};
107
Brian08e341e2008-03-14 15:54:02 -0600108
109/** Subclass of pipe_shader_state */
110struct sp_vertex_shader {
Keith Whitwellfa0f4852009-03-13 16:22:35 +0000111 struct pipe_shader_state shader;
Brian08e341e2008-03-14 15:54:02 -0600112 struct draw_vertex_shader *draw_data;
Keith Whitwell4fc7d032009-08-21 17:13:11 +0100113 int max_sampler; /* -1 if no samplers */
Brian08e341e2008-03-14 15:54:02 -0600114};
115
Zack Rusin89d85772009-12-14 17:11:46 -0500116/** Subclass of pipe_shader_state */
117struct sp_geometry_shader {
118 struct pipe_shader_state shader;
119 struct draw_geometry_shader *draw_data;
Zack Rusin53bd9792010-06-11 13:31:52 -0400120 int max_sampler;
Zack Rusin89d85772009-12-14 17:11:46 -0500121};
Brian08e341e2008-03-14 15:54:02 -0600122
Roland Scheidegger057427d2010-03-01 18:46:29 +0100123struct sp_velems_state {
124 unsigned count;
Roland Scheideggere8983f72010-03-09 14:23:00 +0100125 struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];
Roland Scheidegger057427d2010-03-01 18:46:29 +0100126};
127
Zack Rusina45b7f42010-05-28 13:14:07 -0400128struct sp_so_state {
Marek Olšák861a0292011-12-15 18:42:21 +0100129 struct pipe_stream_output_info base;
Zack Rusina45b7f42010-05-28 13:14:07 -0400130};
131
Brian08e341e2008-03-14 15:54:02 -0600132
Brian Paul27396922010-09-25 13:58:41 -0600133void
134softpipe_init_blend_funcs(struct pipe_context *pipe);
Brian08e341e2008-03-14 15:54:02 -0600135
Michal Krol8a619e62009-12-01 08:51:20 +0100136void
Brian Paul63a5b7d2010-09-25 14:15:11 -0600137softpipe_init_clip_funcs(struct pipe_context *pipe);
138
139void
Brian Paulc5dd2e42010-09-25 14:02:38 -0600140softpipe_init_sampler_funcs(struct pipe_context *pipe);
141
Brian Paulbd13a0d2010-09-25 14:08:49 -0600142void
143softpipe_init_rasterizer_funcs(struct pipe_context *pipe);
Brian08e341e2008-03-14 15:54:02 -0600144
Brian Paul5b2406c2010-09-25 14:12:12 -0600145void
Brian Paul1e35f642010-09-25 14:19:18 -0600146softpipe_init_shader_funcs(struct pipe_context *pipe);
Brian08e341e2008-03-14 15:54:02 -0600147
Brian Paul279b3682010-09-25 13:54:24 -0600148void
Brian Paul1e35f642010-09-25 14:19:18 -0600149softpipe_init_streamout_funcs(struct pipe_context *pipe);
Brian08e341e2008-03-14 15:54:02 -0600150
Brian Pauleed45092010-09-25 14:06:58 -0600151void
152softpipe_init_vertex_funcs(struct pipe_context *pipe);
Roland Scheidegger057427d2010-03-01 18:46:29 +0100153
Brian Paul1e35f642010-09-25 14:19:18 -0600154void
Dave Airlieeb9ad9f2016-03-22 07:59:35 +1000155softpipe_init_image_funcs(struct pipe_context *pipe);
156
157void
Brian Paul1e35f642010-09-25 14:19:18 -0600158softpipe_set_framebuffer_state(struct pipe_context *,
159 const struct pipe_framebuffer_state *);
Brian08e341e2008-03-14 15:54:02 -0600160
Brian Paul1e35f642010-09-25 14:19:18 -0600161void
Brian Paul57aa5972011-07-21 09:55:22 -0600162softpipe_update_derived(struct softpipe_context *softpipe, unsigned prim);
Brian08e341e2008-03-14 15:54:02 -0600163
Chia-I Wu6d28bf92010-07-16 04:35:58 +0800164void
Roland Scheideggeref17cc92013-03-08 22:29:34 +0100165softpipe_set_sampler_views(struct pipe_context *pipe,
166 unsigned shader,
167 unsigned start,
168 unsigned num,
169 struct pipe_sampler_view **views);
170
171
172void
Chia-I Wu6d28bf92010-07-16 04:35:58 +0800173softpipe_draw_vbo(struct pipe_context *pipe,
174 const struct pipe_draw_info *info);
175
Brian Paul1e35f642010-09-25 14:19:18 -0600176void
Brian08e341e2008-03-14 15:54:02 -0600177softpipe_map_texture_surfaces(struct softpipe_context *sp);
178
179void
180softpipe_unmap_texture_surfaces(struct softpipe_context *sp);
181
182
183struct vertex_info *
Brian08e341e2008-03-14 15:54:02 -0600184softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe);
185
186
Brian Paulc534f112011-07-21 09:55:22 -0600187struct sp_fragment_shader_variant *
188softpipe_find_fs_variant(struct softpipe_context *softpipe,
189 struct sp_fragment_shader *fs,
190 const struct sp_fragment_shader_variant_key *key);
191
192
Brian Paul57aa5972011-07-21 09:55:22 -0600193struct sp_fragment_shader_variant *
194softpipe_find_fs_variant(struct softpipe_context *softpipe,
195 struct sp_fragment_shader *fs,
196 const struct sp_fragment_shader_variant_key *key);
197
Roland Scheidegger3d29e752014-08-28 05:13:35 +0200198void
199softpipe_prepare_vertex_sampling(struct softpipe_context *ctx,
200 unsigned num,
201 struct pipe_sampler_view **views);
202void
203softpipe_cleanup_vertex_sampling(struct softpipe_context *ctx);
204
205
206void
207softpipe_prepare_geometry_sampling(struct softpipe_context *ctx,
208 unsigned num,
209 struct pipe_sampler_view **views);
210void
211softpipe_cleanup_geometry_sampling(struct softpipe_context *ctx);
212
Brian Paul57aa5972011-07-21 09:55:22 -0600213
Brian08e341e2008-03-14 15:54:02 -0600214#endif