2 * Mesa 3-D graphics library
4 * Copyright (C) 2012-2013 LunarG, Inc.
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:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
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.
25 * Chia-I Wu <olv@lunarg.com>
31 #include "core/ilo_state_shader.h"
33 #include "ilo_common.h"
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
,
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
,
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
,
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
,
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
,
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
,
83 ILO_KERNEL_PARAM_COUNT
,
88 struct ilo_rasterizer_state
;
89 struct ilo_shader_cache
;
90 struct ilo_shader_state
;
93 struct ilo_state_vector
;
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
;
103 struct ilo_state_vs vs
;
104 struct ilo_state_gs sol
;
108 struct ilo_shader_cache
*
109 ilo_shader_cache_create(void);
112 ilo_shader_cache_destroy(struct ilo_shader_cache
*shc
);
115 ilo_shader_cache_add(struct ilo_shader_cache
*shc
,
116 struct ilo_shader_state
*shader
);
119 ilo_shader_cache_remove(struct ilo_shader_cache
*shc
,
120 struct ilo_shader_state
*shader
);
123 ilo_shader_cache_upload(struct ilo_shader_cache
*shc
,
124 struct ilo_builder
*builder
);
127 ilo_shader_cache_invalidate(struct ilo_shader_cache
*shc
);
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
);
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
);
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
);
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
);
150 ilo_shader_destroy(struct ilo_shader_state
*shader
);
153 ilo_shader_get_type(const struct ilo_shader_state
*shader
);
156 ilo_shader_select_kernel(struct ilo_shader_state
*shader
,
157 const struct ilo_state_vector
*vec
,
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
);
166 ilo_shader_get_kernel_offset(const struct ilo_shader_state
*shader
);
169 ilo_shader_get_kernel_param(const struct ilo_shader_state
*shader
,
170 enum ilo_kernel_param param
);
172 const union ilo_shader_cso
*
173 ilo_shader_get_kernel_cso(const struct ilo_shader_state
*shader
);
175 const struct pipe_stream_output_info
*
176 ilo_shader_get_kernel_so_info(const struct ilo_shader_state
*shader
);
178 const struct ilo_state_sol
*
179 ilo_shader_get_kernel_sol(const struct ilo_shader_state
*shader
);
181 const struct ilo_state_sbe
*
182 ilo_shader_get_kernel_sbe(const struct ilo_shader_state
*shader
);
184 #endif /* ILO_SHADER_H */