ilo: add 3DSTATE_AA_LINE_PARAMETERS to ilo_state_raster
[mesa.git] / src / gallium / drivers / ilo / ilo_shader.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_SHADER_H
29 #define ILO_SHADER_H
30
31 #include "core/ilo_state_shader.h"
32
33 #include "ilo_common.h"
34
35 enum ilo_kernel_param {
36 ILO_KERNEL_INPUT_COUNT,
37 ILO_KERNEL_OUTPUT_COUNT,
38 ILO_KERNEL_SAMPLER_COUNT,
39 ILO_KERNEL_URB_DATA_START_REG,
40 ILO_KERNEL_SKIP_CBUF0_UPLOAD,
41 ILO_KERNEL_PCB_CBUF0_SIZE,
42
43 ILO_KERNEL_SURFACE_TOTAL_COUNT,
44 ILO_KERNEL_SURFACE_TEX_BASE,
45 ILO_KERNEL_SURFACE_TEX_COUNT,
46 ILO_KERNEL_SURFACE_CONST_BASE,
47 ILO_KERNEL_SURFACE_CONST_COUNT,
48 ILO_KERNEL_SURFACE_RES_BASE,
49 ILO_KERNEL_SURFACE_RES_COUNT,
50
51 ILO_KERNEL_VS_INPUT_INSTANCEID,
52 ILO_KERNEL_VS_INPUT_VERTEXID,
53 ILO_KERNEL_VS_INPUT_EDGEFLAG,
54 ILO_KERNEL_VS_PCB_UCP_SIZE,
55 ILO_KERNEL_VS_GEN6_SO,
56 ILO_KERNEL_VS_GEN6_SO_START_REG,
57 ILO_KERNEL_VS_GEN6_SO_POINT_OFFSET,
58 ILO_KERNEL_VS_GEN6_SO_LINE_OFFSET,
59 ILO_KERNEL_VS_GEN6_SO_TRI_OFFSET,
60 ILO_KERNEL_VS_GEN6_SO_SURFACE_COUNT,
61
62 ILO_KERNEL_GS_DISCARD_ADJACENCY,
63 ILO_KERNEL_GS_GEN6_SVBI_POST_INC,
64 ILO_KERNEL_GS_GEN6_SURFACE_SO_BASE,
65 ILO_KERNEL_GS_GEN6_SURFACE_SO_COUNT,
66
67 ILO_KERNEL_FS_INPUT_Z,
68 ILO_KERNEL_FS_INPUT_W,
69 ILO_KERNEL_FS_OUTPUT_Z,
70 ILO_KERNEL_FS_USE_KILL,
71 ILO_KERNEL_FS_BARYCENTRIC_INTERPOLATIONS,
72 ILO_KERNEL_FS_DISPATCH_16_OFFSET,
73 ILO_KERNEL_FS_SURFACE_RT_BASE,
74 ILO_KERNEL_FS_SURFACE_RT_COUNT,
75
76 ILO_KERNEL_CS_LOCAL_SIZE,
77 ILO_KERNEL_CS_PRIVATE_SIZE,
78 ILO_KERNEL_CS_INPUT_SIZE,
79 ILO_KERNEL_CS_SIMD_SIZE,
80 ILO_KERNEL_CS_SURFACE_GLOBAL_BASE,
81 ILO_KERNEL_CS_SURFACE_GLOBAL_COUNT,
82
83 ILO_KERNEL_PARAM_COUNT,
84 };
85
86 struct intel_bo;
87 struct ilo_builder;
88 struct ilo_rasterizer_state;
89 struct ilo_shader_cache;
90 struct ilo_shader_state;
91 struct ilo_state_sbe;
92 struct ilo_state_sol;
93 struct ilo_state_vector;
94
95 union ilo_shader_cso {
96 struct ilo_state_vs vs;
97 struct ilo_state_hs hs;
98 struct ilo_state_ds ds;
99 struct ilo_state_gs gs;
100 struct ilo_state_ps ps;
101
102 struct {
103 struct ilo_state_vs vs;
104 struct ilo_state_gs sol;
105 } vs_sol;
106 };
107
108 struct ilo_shader_cache *
109 ilo_shader_cache_create(void);
110
111 void
112 ilo_shader_cache_destroy(struct ilo_shader_cache *shc);
113
114 void
115 ilo_shader_cache_add(struct ilo_shader_cache *shc,
116 struct ilo_shader_state *shader);
117
118 void
119 ilo_shader_cache_remove(struct ilo_shader_cache *shc,
120 struct ilo_shader_state *shader);
121
122 void
123 ilo_shader_cache_upload(struct ilo_shader_cache *shc,
124 struct ilo_builder *builder);
125
126 void
127 ilo_shader_cache_invalidate(struct ilo_shader_cache *shc);
128
129 struct ilo_shader_state *
130 ilo_shader_create_vs(const struct ilo_dev *dev,
131 const struct pipe_shader_state *state,
132 const struct ilo_state_vector *precompile);
133
134 struct ilo_shader_state *
135 ilo_shader_create_gs(const struct ilo_dev *dev,
136 const struct pipe_shader_state *state,
137 const struct ilo_state_vector *precompile);
138
139 struct ilo_shader_state *
140 ilo_shader_create_fs(const struct ilo_dev *dev,
141 const struct pipe_shader_state *state,
142 const struct ilo_state_vector *precompile);
143
144 struct ilo_shader_state *
145 ilo_shader_create_cs(const struct ilo_dev *dev,
146 const struct pipe_compute_state *state,
147 const struct ilo_state_vector *precompile);
148
149 void
150 ilo_shader_destroy(struct ilo_shader_state *shader);
151
152 int
153 ilo_shader_get_type(const struct ilo_shader_state *shader);
154
155 bool
156 ilo_shader_select_kernel(struct ilo_shader_state *shader,
157 const struct ilo_state_vector *vec,
158 uint32_t dirty);
159
160 bool
161 ilo_shader_select_kernel_sbe(struct ilo_shader_state *shader,
162 const struct ilo_shader_state *source,
163 const struct ilo_rasterizer_state *rasterizer);
164
165 uint32_t
166 ilo_shader_get_kernel_offset(const struct ilo_shader_state *shader);
167
168 int
169 ilo_shader_get_kernel_param(const struct ilo_shader_state *shader,
170 enum ilo_kernel_param param);
171
172 const union ilo_shader_cso *
173 ilo_shader_get_kernel_cso(const struct ilo_shader_state *shader);
174
175 const struct pipe_stream_output_info *
176 ilo_shader_get_kernel_so_info(const struct ilo_shader_state *shader);
177
178 const struct ilo_state_sol *
179 ilo_shader_get_kernel_sol(const struct ilo_shader_state *shader);
180
181 const struct ilo_state_sbe *
182 ilo_shader_get_kernel_sbe(const struct ilo_shader_state *shader);
183
184 #endif /* ILO_SHADER_H */