• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**************************************************************************
2  *
3  * Copyright 2007 VMware, Inc.
4  * 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.
21  * IN NO EVENT SHALL VMWARE 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.
25  *
26  **************************************************************************/
27 #ifndef LP_SETUP_H
28 #define LP_SETUP_H
29 
30 #include "pipe/p_compiler.h"
31 #include "lp_jit.h"
32 
33 struct draw_context;
34 struct vertex_info;
35 struct pipe_resource;
36 struct pipe_query;
37 struct pipe_surface;
38 struct pipe_blend_color;
39 struct pipe_screen;
40 struct pipe_framebuffer_state;
41 struct lp_fragment_shader_variant;
42 struct lp_jit_context;
43 struct llvmpipe_query;
44 struct pipe_fence_handle;
45 struct lp_setup_variant;
46 struct lp_setup_context;
47 
48 void
49 lp_setup_reset(struct lp_setup_context *setup);
50 
51 struct lp_setup_context *
52 lp_setup_create(struct pipe_context *pipe,
53                 struct draw_context *draw);
54 
55 void
56 lp_setup_clear(struct lp_setup_context *setup,
57                const union pipe_color_union *clear_color,
58                double clear_depth,
59                unsigned clear_stencil,
60                unsigned flags);
61 
62 void
63 lp_setup_flush(struct lp_setup_context *setup,
64                const char *reason);
65 
66 void
67 lp_setup_bind_framebuffer(struct lp_setup_context *setup,
68                           const struct pipe_framebuffer_state *fb);
69 
70 void
71 lp_setup_bind_rasterizer(struct lp_setup_context *setup,
72                          const struct pipe_rasterizer_state *rast);
73 
74 void
75 lp_setup_set_setup_variant(struct lp_setup_context *setup,
76                            const struct lp_setup_variant *variant);
77 
78 void
79 lp_setup_set_fs_variant(struct lp_setup_context *setup,
80                         struct lp_fragment_shader_variant *variant);
81 
82 void
83 lp_setup_set_fs_constants(struct lp_setup_context *setup,
84                           unsigned num,
85                           struct pipe_constant_buffer *buffers);
86 
87 void
88 lp_setup_set_fs_ssbos(struct lp_setup_context *setup,
89                       unsigned num,
90                       struct pipe_shader_buffer *buffers,
91                       uint32_t ssbo_write_mask);
92 
93 void
94 lp_setup_set_fs_images(struct lp_setup_context *setup,
95                        unsigned num,
96                        struct pipe_image_view *images);
97 
98 void
99 lp_setup_set_alpha_ref_value(struct lp_setup_context *setup,
100                              float alpha_ref_value);
101 
102 void
103 lp_setup_set_stencil_ref_values(struct lp_setup_context *setup,
104                                 const ubyte refs[2]);
105 
106 void
107 lp_setup_set_blend_color(struct lp_setup_context *setup,
108                          const struct pipe_blend_color *blend_color);
109 
110 void
111 lp_setup_set_scissors(struct lp_setup_context *setup,
112                       const struct pipe_scissor_state *scissors);
113 
114 void
115 lp_setup_set_viewports(struct lp_setup_context *setup,
116                        unsigned num_viewports,
117                        const struct pipe_viewport_state *viewports);
118 
119 void
120 lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
121                                     unsigned num,
122                                     struct pipe_sampler_view **views);
123 
124 void
125 lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup,
126                                     unsigned num,
127                                     struct pipe_sampler_state **samplers);
128 
129 unsigned
130 lp_setup_is_resource_referenced(const struct lp_setup_context *setup,
131                                 const struct pipe_resource *texture);
132 
133 void
134 lp_setup_set_sample_mask(struct lp_setup_context *setup,
135                          uint32_t sample_mask);
136 
137 void
138 lp_setup_set_rasterizer_discard(struct lp_setup_context *setup,
139                                 boolean rasterizer_discard);
140 
141 void
142 lp_setup_set_vertex_info(struct lp_setup_context *setup,
143                          struct vertex_info *info);
144 
145 void
146 lp_setup_set_linear_mode(struct lp_setup_context *setup,
147                          boolean permit_linear_rasterizer);
148 
149 void
150 lp_setup_begin_query(struct lp_setup_context *setup,
151                      struct llvmpipe_query *pq);
152 
153 void
154 lp_setup_end_query(struct lp_setup_context *setup,
155                    struct llvmpipe_query *pq);
156 
157 static inline unsigned
lp_clamp_viewport_idx(int idx)158 lp_clamp_viewport_idx(int idx)
159 {
160    return (PIPE_MAX_VIEWPORTS > idx && idx >= 0) ? idx : 0;
161 }
162 
163 #endif
164