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#ifndef LP_SETUP_H
28bf215546Sopenharmony_ci#define LP_SETUP_H
29bf215546Sopenharmony_ci
30bf215546Sopenharmony_ci#include "pipe/p_compiler.h"
31bf215546Sopenharmony_ci#include "lp_jit.h"
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_cistruct draw_context;
34bf215546Sopenharmony_cistruct vertex_info;
35bf215546Sopenharmony_cistruct pipe_resource;
36bf215546Sopenharmony_cistruct pipe_query;
37bf215546Sopenharmony_cistruct pipe_surface;
38bf215546Sopenharmony_cistruct pipe_blend_color;
39bf215546Sopenharmony_cistruct pipe_screen;
40bf215546Sopenharmony_cistruct pipe_framebuffer_state;
41bf215546Sopenharmony_cistruct lp_fragment_shader_variant;
42bf215546Sopenharmony_cistruct lp_jit_context;
43bf215546Sopenharmony_cistruct llvmpipe_query;
44bf215546Sopenharmony_cistruct pipe_fence_handle;
45bf215546Sopenharmony_cistruct lp_setup_variant;
46bf215546Sopenharmony_cistruct lp_setup_context;
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_civoid
49bf215546Sopenharmony_cilp_setup_reset(struct lp_setup_context *setup);
50bf215546Sopenharmony_ci
51bf215546Sopenharmony_cistruct lp_setup_context *
52bf215546Sopenharmony_cilp_setup_create(struct pipe_context *pipe,
53bf215546Sopenharmony_ci                struct draw_context *draw);
54bf215546Sopenharmony_ci
55bf215546Sopenharmony_civoid
56bf215546Sopenharmony_cilp_setup_clear(struct lp_setup_context *setup,
57bf215546Sopenharmony_ci               const union pipe_color_union *clear_color,
58bf215546Sopenharmony_ci               double clear_depth,
59bf215546Sopenharmony_ci               unsigned clear_stencil,
60bf215546Sopenharmony_ci               unsigned flags);
61bf215546Sopenharmony_ci
62bf215546Sopenharmony_civoid
63bf215546Sopenharmony_cilp_setup_flush(struct lp_setup_context *setup,
64bf215546Sopenharmony_ci               const char *reason);
65bf215546Sopenharmony_ci
66bf215546Sopenharmony_civoid
67bf215546Sopenharmony_cilp_setup_bind_framebuffer(struct lp_setup_context *setup,
68bf215546Sopenharmony_ci                          const struct pipe_framebuffer_state *fb);
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_civoid
71bf215546Sopenharmony_cilp_setup_bind_rasterizer(struct lp_setup_context *setup,
72bf215546Sopenharmony_ci                         const struct pipe_rasterizer_state *rast);
73bf215546Sopenharmony_ci
74bf215546Sopenharmony_civoid
75bf215546Sopenharmony_cilp_setup_set_setup_variant(struct lp_setup_context *setup,
76bf215546Sopenharmony_ci                           const struct lp_setup_variant *variant);
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_civoid
79bf215546Sopenharmony_cilp_setup_set_fs_variant(struct lp_setup_context *setup,
80bf215546Sopenharmony_ci                        struct lp_fragment_shader_variant *variant);
81bf215546Sopenharmony_ci
82bf215546Sopenharmony_civoid
83bf215546Sopenharmony_cilp_setup_set_fs_constants(struct lp_setup_context *setup,
84bf215546Sopenharmony_ci                          unsigned num,
85bf215546Sopenharmony_ci                          struct pipe_constant_buffer *buffers);
86bf215546Sopenharmony_ci
87bf215546Sopenharmony_civoid
88bf215546Sopenharmony_cilp_setup_set_fs_ssbos(struct lp_setup_context *setup,
89bf215546Sopenharmony_ci                      unsigned num,
90bf215546Sopenharmony_ci                      struct pipe_shader_buffer *buffers,
91bf215546Sopenharmony_ci                      uint32_t ssbo_write_mask);
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_civoid
94bf215546Sopenharmony_cilp_setup_set_fs_images(struct lp_setup_context *setup,
95bf215546Sopenharmony_ci                       unsigned num,
96bf215546Sopenharmony_ci                       struct pipe_image_view *images);
97bf215546Sopenharmony_ci
98bf215546Sopenharmony_civoid
99bf215546Sopenharmony_cilp_setup_set_alpha_ref_value(struct lp_setup_context *setup,
100bf215546Sopenharmony_ci                             float alpha_ref_value);
101bf215546Sopenharmony_ci
102bf215546Sopenharmony_civoid
103bf215546Sopenharmony_cilp_setup_set_stencil_ref_values(struct lp_setup_context *setup,
104bf215546Sopenharmony_ci                                const ubyte refs[2]);
105bf215546Sopenharmony_ci
106bf215546Sopenharmony_civoid
107bf215546Sopenharmony_cilp_setup_set_blend_color(struct lp_setup_context *setup,
108bf215546Sopenharmony_ci                         const struct pipe_blend_color *blend_color);
109bf215546Sopenharmony_ci
110bf215546Sopenharmony_civoid
111bf215546Sopenharmony_cilp_setup_set_scissors(struct lp_setup_context *setup,
112bf215546Sopenharmony_ci                      const struct pipe_scissor_state *scissors);
113bf215546Sopenharmony_ci
114bf215546Sopenharmony_civoid
115bf215546Sopenharmony_cilp_setup_set_viewports(struct lp_setup_context *setup,
116bf215546Sopenharmony_ci                       unsigned num_viewports,
117bf215546Sopenharmony_ci                       const struct pipe_viewport_state *viewports);
118bf215546Sopenharmony_ci
119bf215546Sopenharmony_civoid
120bf215546Sopenharmony_cilp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
121bf215546Sopenharmony_ci                                    unsigned num,
122bf215546Sopenharmony_ci                                    struct pipe_sampler_view **views);
123bf215546Sopenharmony_ci
124bf215546Sopenharmony_civoid
125bf215546Sopenharmony_cilp_setup_set_fragment_sampler_state(struct lp_setup_context *setup,
126bf215546Sopenharmony_ci                                    unsigned num,
127bf215546Sopenharmony_ci                                    struct pipe_sampler_state **samplers);
128bf215546Sopenharmony_ci
129bf215546Sopenharmony_ciunsigned
130bf215546Sopenharmony_cilp_setup_is_resource_referenced(const struct lp_setup_context *setup,
131bf215546Sopenharmony_ci                                const struct pipe_resource *texture);
132bf215546Sopenharmony_ci
133bf215546Sopenharmony_civoid
134bf215546Sopenharmony_cilp_setup_set_sample_mask(struct lp_setup_context *setup,
135bf215546Sopenharmony_ci                         uint32_t sample_mask);
136bf215546Sopenharmony_ci
137bf215546Sopenharmony_civoid
138bf215546Sopenharmony_cilp_setup_set_rasterizer_discard(struct lp_setup_context *setup,
139bf215546Sopenharmony_ci                                boolean rasterizer_discard);
140bf215546Sopenharmony_ci
141bf215546Sopenharmony_civoid
142bf215546Sopenharmony_cilp_setup_set_vertex_info(struct lp_setup_context *setup,
143bf215546Sopenharmony_ci                         struct vertex_info *info);
144bf215546Sopenharmony_ci
145bf215546Sopenharmony_civoid
146bf215546Sopenharmony_cilp_setup_set_linear_mode(struct lp_setup_context *setup,
147bf215546Sopenharmony_ci                         boolean permit_linear_rasterizer);
148bf215546Sopenharmony_ci
149bf215546Sopenharmony_civoid
150bf215546Sopenharmony_cilp_setup_begin_query(struct lp_setup_context *setup,
151bf215546Sopenharmony_ci                     struct llvmpipe_query *pq);
152bf215546Sopenharmony_ci
153bf215546Sopenharmony_civoid
154bf215546Sopenharmony_cilp_setup_end_query(struct lp_setup_context *setup,
155bf215546Sopenharmony_ci                   struct llvmpipe_query *pq);
156bf215546Sopenharmony_ci
157bf215546Sopenharmony_cistatic inline unsigned
158bf215546Sopenharmony_cilp_clamp_viewport_idx(int idx)
159bf215546Sopenharmony_ci{
160bf215546Sopenharmony_ci   return (PIPE_MAX_VIEWPORTS > idx && idx >= 0) ? idx : 0;
161bf215546Sopenharmony_ci}
162bf215546Sopenharmony_ci
163bf215546Sopenharmony_ci#endif
164