1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2007 VMware, Inc.
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
16bf215546Sopenharmony_ci * of the Software.
17bf215546Sopenharmony_ci *
18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci/* Authors:  Keith Whitwell <keithw@vmware.com>
29bf215546Sopenharmony_ci */
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci#ifndef LP_STATE_H
32bf215546Sopenharmony_ci#define LP_STATE_H
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci#include "pipe/p_state.h"
35bf215546Sopenharmony_ci#include "lp_jit.h"
36bf215546Sopenharmony_ci#include "lp_state_fs.h"
37bf215546Sopenharmony_ci#include "gallivm/lp_bld.h"
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_ci#define LP_NEW_VIEWPORT      0x1
41bf215546Sopenharmony_ci#define LP_NEW_RASTERIZER    0x2
42bf215546Sopenharmony_ci#define LP_NEW_FS            0x4
43bf215546Sopenharmony_ci#define LP_NEW_BLEND         0x8
44bf215546Sopenharmony_ci#define LP_NEW_CLIP          0x10
45bf215546Sopenharmony_ci#define LP_NEW_SCISSOR       0x20
46bf215546Sopenharmony_ci#define LP_NEW_STIPPLE       0x40
47bf215546Sopenharmony_ci#define LP_NEW_FRAMEBUFFER   0x80
48bf215546Sopenharmony_ci#define LP_NEW_DEPTH_STENCIL_ALPHA 0x100
49bf215546Sopenharmony_ci#define LP_NEW_FS_CONSTANTS  0x200
50bf215546Sopenharmony_ci#define LP_NEW_SAMPLER       0x400
51bf215546Sopenharmony_ci#define LP_NEW_SAMPLER_VIEW  0x800
52bf215546Sopenharmony_ci#define LP_NEW_VERTEX        0x1000
53bf215546Sopenharmony_ci#define LP_NEW_VS            0x2000
54bf215546Sopenharmony_ci#define LP_NEW_OCCLUSION_QUERY 0x4000
55bf215546Sopenharmony_ci#define LP_NEW_BLEND_COLOR   0x8000
56bf215546Sopenharmony_ci#define LP_NEW_GS            0x10000
57bf215546Sopenharmony_ci#define LP_NEW_SO            0x20000
58bf215546Sopenharmony_ci#define LP_NEW_SO_BUFFERS    0x40000
59bf215546Sopenharmony_ci#define LP_NEW_FS_SSBOS      0x80000
60bf215546Sopenharmony_ci#define LP_NEW_FS_IMAGES    0x100000
61bf215546Sopenharmony_ci#define LP_NEW_TCS          0x200000
62bf215546Sopenharmony_ci#define LP_NEW_TES          0x400000
63bf215546Sopenharmony_ci#define LP_NEW_SAMPLE_MASK  0x800000
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ci#define LP_CSNEW_CS 0x1
66bf215546Sopenharmony_ci#define LP_CSNEW_CONSTANTS 0x2
67bf215546Sopenharmony_ci#define LP_CSNEW_SAMPLER 0x4
68bf215546Sopenharmony_ci#define LP_CSNEW_SAMPLER_VIEW 0x8
69bf215546Sopenharmony_ci#define LP_CSNEW_SSBOS 0x10
70bf215546Sopenharmony_ci#define LP_CSNEW_IMAGES 0x20
71bf215546Sopenharmony_ci
72bf215546Sopenharmony_cistruct vertex_info;
73bf215546Sopenharmony_cistruct pipe_context;
74bf215546Sopenharmony_cistruct llvmpipe_context;
75bf215546Sopenharmony_ci
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_cistruct lp_geometry_shader {
79bf215546Sopenharmony_ci   boolean no_tokens;
80bf215546Sopenharmony_ci   struct pipe_stream_output_info stream_output;
81bf215546Sopenharmony_ci   struct draw_geometry_shader *dgs;
82bf215546Sopenharmony_ci};
83bf215546Sopenharmony_ci
84bf215546Sopenharmony_cistruct lp_tess_ctrl_shader {
85bf215546Sopenharmony_ci   boolean no_tokens;
86bf215546Sopenharmony_ci   struct pipe_stream_output_info stream_output;
87bf215546Sopenharmony_ci   struct draw_tess_ctrl_shader *dtcs;
88bf215546Sopenharmony_ci};
89bf215546Sopenharmony_ci
90bf215546Sopenharmony_cistruct lp_tess_eval_shader {
91bf215546Sopenharmony_ci   boolean no_tokens;
92bf215546Sopenharmony_ci   struct pipe_stream_output_info stream_output;
93bf215546Sopenharmony_ci   struct draw_tess_eval_shader *dtes;
94bf215546Sopenharmony_ci};
95bf215546Sopenharmony_ci
96bf215546Sopenharmony_ci
97bf215546Sopenharmony_ci/** Vertex element state */
98bf215546Sopenharmony_cistruct lp_velems_state
99bf215546Sopenharmony_ci{
100bf215546Sopenharmony_ci   unsigned count;
101bf215546Sopenharmony_ci   struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];
102bf215546Sopenharmony_ci};
103bf215546Sopenharmony_ci
104bf215546Sopenharmony_cistruct lp_so_state {
105bf215546Sopenharmony_ci   struct pipe_stream_output_info base;
106bf215546Sopenharmony_ci};
107bf215546Sopenharmony_ci
108bf215546Sopenharmony_ci
109bf215546Sopenharmony_civoid
110bf215546Sopenharmony_cillvmpipe_set_framebuffer_state(struct pipe_context *,
111bf215546Sopenharmony_ci                               const struct pipe_framebuffer_state *);
112bf215546Sopenharmony_ci
113bf215546Sopenharmony_civoid
114bf215546Sopenharmony_cillvmpipe_update_fs(struct llvmpipe_context *lp);
115bf215546Sopenharmony_ci
116bf215546Sopenharmony_civoid
117bf215546Sopenharmony_cillvmpipe_update_setup(struct llvmpipe_context *lp);
118bf215546Sopenharmony_ci
119bf215546Sopenharmony_civoid
120bf215546Sopenharmony_cillvmpipe_update_derived_clear(struct llvmpipe_context *llvmpipe);
121bf215546Sopenharmony_ci
122bf215546Sopenharmony_civoid
123bf215546Sopenharmony_cillvmpipe_update_derived(struct llvmpipe_context *llvmpipe);
124bf215546Sopenharmony_ci
125bf215546Sopenharmony_civoid
126bf215546Sopenharmony_cillvmpipe_init_sampler_funcs(struct llvmpipe_context *llvmpipe);
127bf215546Sopenharmony_ci
128bf215546Sopenharmony_civoid
129bf215546Sopenharmony_cillvmpipe_init_blend_funcs(struct llvmpipe_context *llvmpipe);
130bf215546Sopenharmony_ci
131bf215546Sopenharmony_civoid
132bf215546Sopenharmony_cillvmpipe_init_vertex_funcs(struct llvmpipe_context *llvmpipe);
133bf215546Sopenharmony_ci
134bf215546Sopenharmony_civoid
135bf215546Sopenharmony_cillvmpipe_init_draw_funcs(struct llvmpipe_context *llvmpipe);
136bf215546Sopenharmony_ci
137bf215546Sopenharmony_civoid
138bf215546Sopenharmony_cillvmpipe_init_compute_funcs(struct llvmpipe_context *llvmpipe);
139bf215546Sopenharmony_ci
140bf215546Sopenharmony_civoid
141bf215546Sopenharmony_cillvmpipe_init_clip_funcs(struct llvmpipe_context *llvmpipe);
142bf215546Sopenharmony_ci
143bf215546Sopenharmony_civoid
144bf215546Sopenharmony_cillvmpipe_init_fs_funcs(struct llvmpipe_context *llvmpipe);
145bf215546Sopenharmony_ci
146bf215546Sopenharmony_civoid
147bf215546Sopenharmony_cillvmpipe_init_vs_funcs(struct llvmpipe_context *llvmpipe);
148bf215546Sopenharmony_ci
149bf215546Sopenharmony_civoid
150bf215546Sopenharmony_cillvmpipe_init_gs_funcs(struct llvmpipe_context *llvmpipe);
151bf215546Sopenharmony_ci
152bf215546Sopenharmony_civoid
153bf215546Sopenharmony_cillvmpipe_init_tess_funcs(struct llvmpipe_context *llvmpipe);
154bf215546Sopenharmony_ci
155bf215546Sopenharmony_civoid
156bf215546Sopenharmony_cillvmpipe_init_rasterizer_funcs(struct llvmpipe_context *llvmpipe);
157bf215546Sopenharmony_ci
158bf215546Sopenharmony_civoid
159bf215546Sopenharmony_cillvmpipe_init_so_funcs(struct llvmpipe_context *llvmpipe);
160bf215546Sopenharmony_ci
161bf215546Sopenharmony_civoid
162bf215546Sopenharmony_cillvmpipe_prepare_vertex_sampling(struct llvmpipe_context *ctx,
163bf215546Sopenharmony_ci                                 unsigned num,
164bf215546Sopenharmony_ci                                 struct pipe_sampler_view **views);
165bf215546Sopenharmony_ci
166bf215546Sopenharmony_civoid
167bf215546Sopenharmony_cillvmpipe_prepare_geometry_sampling(struct llvmpipe_context *ctx,
168bf215546Sopenharmony_ci                                   unsigned num,
169bf215546Sopenharmony_ci                                   struct pipe_sampler_view **views);
170bf215546Sopenharmony_ci
171bf215546Sopenharmony_civoid
172bf215546Sopenharmony_cillvmpipe_prepare_tess_ctrl_sampling(struct llvmpipe_context *ctx,
173bf215546Sopenharmony_ci                                    unsigned num,
174bf215546Sopenharmony_ci                                    struct pipe_sampler_view **views);
175bf215546Sopenharmony_ci
176bf215546Sopenharmony_civoid
177bf215546Sopenharmony_cillvmpipe_prepare_tess_eval_sampling(struct llvmpipe_context *ctx,
178bf215546Sopenharmony_ci                                    unsigned num,
179bf215546Sopenharmony_ci                                    struct pipe_sampler_view **views);
180bf215546Sopenharmony_civoid
181bf215546Sopenharmony_cillvmpipe_cleanup_stage_sampling(struct llvmpipe_context *ctx,
182bf215546Sopenharmony_ci                                enum pipe_shader_type stage);
183bf215546Sopenharmony_ci
184bf215546Sopenharmony_civoid
185bf215546Sopenharmony_cillvmpipe_prepare_vertex_images(struct llvmpipe_context *lp,
186bf215546Sopenharmony_ci                               unsigned num,
187bf215546Sopenharmony_ci                               struct pipe_image_view *views);
188bf215546Sopenharmony_ci
189bf215546Sopenharmony_civoid
190bf215546Sopenharmony_cillvmpipe_prepare_geometry_images(struct llvmpipe_context *lp,
191bf215546Sopenharmony_ci                                 unsigned num,
192bf215546Sopenharmony_ci                                 struct pipe_image_view *views);
193bf215546Sopenharmony_ci
194bf215546Sopenharmony_civoid
195bf215546Sopenharmony_cillvmpipe_prepare_tess_ctrl_images(struct llvmpipe_context *lp,
196bf215546Sopenharmony_ci                                  unsigned num,
197bf215546Sopenharmony_ci                                  struct pipe_image_view *views);
198bf215546Sopenharmony_ci
199bf215546Sopenharmony_civoid
200bf215546Sopenharmony_cillvmpipe_prepare_tess_eval_images(struct llvmpipe_context *lp,
201bf215546Sopenharmony_ci                                  unsigned num,
202bf215546Sopenharmony_ci                                  struct pipe_image_view *views);
203bf215546Sopenharmony_ci
204bf215546Sopenharmony_civoid
205bf215546Sopenharmony_cillvmpipe_cleanup_stage_images(struct llvmpipe_context *ctx,
206bf215546Sopenharmony_ci                              enum pipe_shader_type stage);
207bf215546Sopenharmony_ci
208bf215546Sopenharmony_ci#endif
209