00ae4f7e51de414a3cf73b4e9faabb5e4aa95128
[mesa.git] / src / gallium / drivers / ilo / ilo_render_gen.h
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 2012-2013 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Authors:
25 * Chia-I Wu <olv@lunarg.com>
26 */
27
28 #ifndef ILO_RENDER_GEN_H
29 #define ILO_RENDER_GEN_H
30
31 #include "ilo_common.h"
32
33 struct ilo_blitter;
34 struct ilo_render;
35 struct ilo_state_vector;
36
37 struct gen6_draw_session {
38 uint32_t pipe_dirty;
39
40 /* commands */
41 int reduced_prim;
42
43 bool prim_changed;
44 bool primitive_restart_changed;
45
46 void (*emit_draw_commands)(struct ilo_render *render,
47 const struct ilo_state_vector *ilo,
48 struct gen6_draw_session *session);
49
50 /* dynamic states */
51 bool viewport_changed;
52 bool scissor_changed;
53
54 bool cc_changed;
55 bool dsa_changed;
56 bool blend_changed;
57
58 bool sampler_vs_changed;
59 bool sampler_gs_changed;
60 bool sampler_fs_changed;
61
62 bool pcb_vs_changed;
63 bool pcb_gs_changed;
64 bool pcb_fs_changed;
65
66 /* surface states */
67 bool binding_table_vs_changed;
68 bool binding_table_gs_changed;
69 bool binding_table_fs_changed;
70
71 int num_surfaces[PIPE_SHADER_TYPES];
72 };
73
74 int
75 ilo_render_get_draw_dynamic_states_len(const struct ilo_render *render,
76 const struct ilo_state_vector *vec);
77
78 void
79 ilo_render_emit_draw_dynamic_states(struct ilo_render *render,
80 const struct ilo_state_vector *vec,
81 struct gen6_draw_session *session);
82
83 int
84 ilo_render_get_rectlist_dynamic_states_len(const struct ilo_render *render,
85 const struct ilo_blitter *blitter);
86
87 void
88 ilo_render_emit_rectlist_dynamic_states(struct ilo_render *render,
89 const struct ilo_blitter *blitter);
90
91 int
92 ilo_render_get_draw_surface_states_len(const struct ilo_render *render,
93 const struct ilo_state_vector *vec);
94
95 void
96 ilo_render_emit_draw_surface_states(struct ilo_render *render,
97 const struct ilo_state_vector *vec,
98 struct gen6_draw_session *session);
99
100 void
101 gen6_wa_pre_pipe_control(struct ilo_render *r, uint32_t dw1);
102
103 void
104 gen6_draw_prepare(struct ilo_render *r,
105 const struct ilo_state_vector *ilo,
106 struct gen6_draw_session *session);
107
108 void
109 gen6_draw_emit(struct ilo_render *r,
110 const struct ilo_state_vector *ilo,
111 struct gen6_draw_session *session);
112
113 void
114 gen6_draw_end(struct ilo_render *r,
115 const struct ilo_state_vector *ilo,
116 struct gen6_draw_session *session);
117
118 void
119 gen6_draw_common_select(struct ilo_render *r,
120 const struct ilo_state_vector *ilo,
121 struct gen6_draw_session *session);
122
123 void
124 gen6_draw_common_sip(struct ilo_render *r,
125 const struct ilo_state_vector *ilo,
126 struct gen6_draw_session *session);
127
128 void
129 gen6_draw_common_base_address(struct ilo_render *r,
130 const struct ilo_state_vector *ilo,
131 struct gen6_draw_session *session);
132
133 void
134 gen6_draw_vf(struct ilo_render *r,
135 const struct ilo_state_vector *ilo,
136 struct gen6_draw_session *session);
137
138 void
139 gen6_draw_vf_statistics(struct ilo_render *r,
140 const struct ilo_state_vector *ilo,
141 struct gen6_draw_session *session);
142
143 void
144 gen6_draw_vs(struct ilo_render *r,
145 const struct ilo_state_vector *ilo,
146 struct gen6_draw_session *session);
147
148 void
149 gen6_draw_clip(struct ilo_render *r,
150 const struct ilo_state_vector *ilo,
151 struct gen6_draw_session *session);
152
153 void
154 gen6_draw_sf_rect(struct ilo_render *r,
155 const struct ilo_state_vector *ilo,
156 struct gen6_draw_session *session);
157
158 void
159 gen6_draw_wm_raster(struct ilo_render *r,
160 const struct ilo_state_vector *ilo,
161 struct gen6_draw_session *session);
162
163 void
164 ilo_render_init_gen6(struct ilo_render *render);
165
166 #endif /* ILO_RENDER_GEN_H */