svga: s/0/FALSE/
[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 "ilo_common.h"
32
33 enum ilo_kernel_param {
34 ILO_KERNEL_INPUT_COUNT,
35 ILO_KERNEL_OUTPUT_COUNT,
36 ILO_KERNEL_URB_DATA_START_REG,
37 ILO_KERNEL_SKIP_CBUF0_UPLOAD,
38 ILO_KERNEL_PCB_CBUF0_SIZE,
39
40 ILO_KERNEL_VS_INPUT_INSTANCEID,
41 ILO_KERNEL_VS_INPUT_VERTEXID,
42 ILO_KERNEL_VS_INPUT_EDGEFLAG,
43 ILO_KERNEL_VS_PCB_UCP_SIZE,
44 ILO_KERNEL_VS_GEN6_SO,
45 ILO_KERNEL_VS_GEN6_SO_START_REG,
46 ILO_KERNEL_VS_GEN6_SO_POINT_OFFSET,
47 ILO_KERNEL_VS_GEN6_SO_LINE_OFFSET,
48 ILO_KERNEL_VS_GEN6_SO_TRI_OFFSET,
49
50 ILO_KERNEL_GS_DISCARD_ADJACENCY,
51 ILO_KERNEL_GS_GEN6_SVBI_POST_INC,
52
53 ILO_KERNEL_FS_INPUT_Z,
54 ILO_KERNEL_FS_INPUT_W,
55 ILO_KERNEL_FS_OUTPUT_Z,
56 ILO_KERNEL_FS_USE_KILL,
57 ILO_KERNEL_FS_BARYCENTRIC_INTERPOLATIONS,
58 ILO_KERNEL_FS_DISPATCH_16_OFFSET,
59
60 ILO_KERNEL_PARAM_COUNT,
61 };
62
63 struct ilo_kernel_routing {
64 uint32_t const_interp_enable;
65 uint32_t point_sprite_enable;
66 unsigned source_skip, source_len;
67
68 bool swizzle_enable;
69 uint16_t swizzles[16];
70 };
71
72 struct intel_bo;
73 struct ilo_context;
74 struct ilo_rasterizer_state;
75 struct ilo_shader_cache;
76 struct ilo_shader_state;
77 struct ilo_shader_cso;
78
79 struct ilo_shader_cache *
80 ilo_shader_cache_create(void);
81
82 void
83 ilo_shader_cache_destroy(struct ilo_shader_cache *shc);
84
85 void
86 ilo_shader_cache_add(struct ilo_shader_cache *shc,
87 struct ilo_shader_state *shader);
88
89 void
90 ilo_shader_cache_remove(struct ilo_shader_cache *shc,
91 struct ilo_shader_state *shader);
92
93 int
94 ilo_shader_cache_upload(struct ilo_shader_cache *shc,
95 struct intel_bo *bo, unsigned offset,
96 bool incremental);
97
98 struct ilo_shader_state *
99 ilo_shader_create_vs(const struct ilo_dev_info *dev,
100 const struct pipe_shader_state *state,
101 const struct ilo_context *precompile);
102
103 struct ilo_shader_state *
104 ilo_shader_create_gs(const struct ilo_dev_info *dev,
105 const struct pipe_shader_state *state,
106 const struct ilo_context *precompile);
107
108 struct ilo_shader_state *
109 ilo_shader_create_fs(const struct ilo_dev_info *dev,
110 const struct pipe_shader_state *state,
111 const struct ilo_context *precompile);
112
113 struct ilo_shader_state *
114 ilo_shader_create_cs(const struct ilo_dev_info *dev,
115 const struct pipe_compute_state *state,
116 const struct ilo_context *precompile);
117
118 void
119 ilo_shader_destroy(struct ilo_shader_state *shader);
120
121 int
122 ilo_shader_get_type(const struct ilo_shader_state *shader);
123
124 bool
125 ilo_shader_select_kernel(struct ilo_shader_state *shader,
126 const struct ilo_context *ilo,
127 uint32_t dirty);
128
129 bool
130 ilo_shader_select_kernel_routing(struct ilo_shader_state *shader,
131 const struct ilo_shader_state *source,
132 const struct ilo_rasterizer_state *rasterizer);
133
134 uint32_t
135 ilo_shader_get_kernel_offset(const struct ilo_shader_state *shader);
136
137 int
138 ilo_shader_get_kernel_param(const struct ilo_shader_state *shader,
139 enum ilo_kernel_param param);
140
141 const struct ilo_shader_cso *
142 ilo_shader_get_kernel_cso(const struct ilo_shader_state *shader);
143
144 const struct pipe_stream_output_info *
145 ilo_shader_get_kernel_so_info(const struct ilo_shader_state *shader);
146
147 const struct ilo_kernel_routing *
148 ilo_shader_get_kernel_routing(const struct ilo_shader_state *shader);
149
150 #endif /* ILO_SHADER_H */