xref: /aosp_15_r20/external/mesa3d/src/gallium/auxiliary/draw/draw_llvm.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /**************************************************************************
2  *
3  * Copyright 2010 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 
28 #ifndef DRAW_LLVM_H
29 #define DRAW_LLVM_H
30 
31 #include "draw/draw_private.h"
32 
33 #include "draw/draw_vs.h"
34 #include "draw/draw_gs.h"
35 #include "draw/draw_tess.h"
36 
37 #include "gallivm/lp_bld_sample.h"
38 #include "gallivm/lp_bld_limits.h"
39 #include "gallivm/lp_bld_jit_types.h"
40 #include "gallivm/lp_bld_jit_sample.h"
41 
42 #include "pipe/p_context.h"
43 #include "util/list.h"
44 
45 
46 struct draw_llvm;
47 struct llvm_vertex_shader;
48 struct llvm_geometry_shader;
49 struct llvm_tess_ctrl_shader;
50 struct llvm_tess_eval_shader;
51 
52 /**
53  * This structure is passed directly to the generated vertex shader.
54  *
55  * It contains the derived state.
56  *
57  * Changes here must be reflected in the draw_jit_context_* macros.
58  * Changes to the ordering should be avoided.
59  *
60  * Only use types with a clear size and padding here, in particular prefer the
61  * stdint.h types to the basic integer types.
62  */
63 struct draw_vs_jit_context
64 {
65    float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
66    struct pipe_viewport_state *viewports;
67 };
68 
69 enum {
70    DRAW_VS_JIT_CTX_PLANES               = 0,
71    DRAW_VS_JIT_CTX_VIEWPORT             = 1,
72    DRAW_VS_JIT_CTX_NUM_FIELDS
73 };
74 
75 #define draw_vs_jit_context_planes(_gallivm, _type, _ptr) \
76    lp_build_struct_get2(_gallivm, _type, _ptr, DRAW_VS_JIT_CTX_PLANES, "planes")
77 
78 #define draw_vs_jit_context_viewports(_variant, _ptr) \
79    lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_VS_JIT_CTX_VIEWPORT, "viewports")
80 
81 
82 #define draw_jit_vbuffer_offset(_gallivm, _type, _ptr)         \
83    lp_build_struct_get2(_gallivm, _type, _ptr, 1, "buffer_offset")
84 
85 enum {
86    DRAW_JIT_DVBUFFER_MAP = 0,
87    DRAW_JIT_DVBUFFER_SIZE,
88    DRAW_JIT_DVBUFFER_NUM_FIELDS  /* number of fields above */
89 };
90 
91 #define draw_jit_dvbuffer_map(_gallivm, _type, _ptr)         \
92    lp_build_struct_get2(_gallivm, _type, _ptr, DRAW_JIT_DVBUFFER_MAP, "map")
93 
94 #define draw_jit_dvbuffer_size(_gallivm, _type, _ptr)        \
95    lp_build_struct_get2(_gallivm, _type, _ptr, DRAW_JIT_DVBUFFER_SIZE, "size")
96 
97 
98 /**
99  * This structure is passed directly to the generated geometry shader.
100  *
101  * It contains the derived state.
102  *
103  * Changes here must be reflected in the draw_gs_jit_context_* macros.
104  * Changes to the ordering should be avoided.
105  *
106  * Only use types with a clear size and padding here, in particular prefer the
107  * stdint.h types to the basic integer types.
108  */
109 struct draw_gs_jit_context
110 {
111    float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
112    struct pipe_viewport_state *viewports;
113 
114    int **prim_lengths;
115    int *emitted_vertices;
116    int *emitted_prims;
117 };
118 
119 enum {
120    DRAW_GS_JIT_CTX_PLANES = 0,
121    DRAW_GS_JIT_CTX_VIEWPORT = 1,
122    DRAW_GS_JIT_CTX_PRIM_LENGTHS = 2,
123    DRAW_GS_JIT_CTX_EMITTED_VERTICES = 3,
124    DRAW_GS_JIT_CTX_EMITTED_PRIMS = 4,
125    DRAW_GS_JIT_CTX_NUM_FIELDS = 5
126 };
127 
128 #define draw_gs_jit_context_planes(_gallivm, _ptr) \
129    lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_PLANES, "planes")
130 
131 #define draw_gs_jit_context_viewports(_gallivm, _ptr) \
132    lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_VIEWPORT, "viewports")
133 
134 #define draw_gs_jit_prim_lengths(_variant, _ptr) \
135    lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_PRIM_LENGTHS, "prim_lengths")
136 
137 #define draw_gs_jit_emitted_vertices(_variant, _ptr) \
138    lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_EMITTED_VERTICES, "emitted_vertices")
139 
140 #define draw_gs_jit_emitted_prims(_variant, _ptr) \
141    lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_GS_JIT_CTX_EMITTED_PRIMS, "emitted_prims")
142 
143 
144 typedef bool
145 (*draw_jit_vert_func)(struct draw_vs_jit_context *context,
146                       const struct lp_jit_resources *resources,
147                       struct vertex_header *io,
148                       const struct draw_vertex_buffer vbuffers[PIPE_MAX_ATTRIBS],
149                       unsigned count,
150                       unsigned start,
151                       unsigned stride,
152                       struct pipe_vertex_buffer *vertex_buffers,
153                       unsigned instance_id,
154                       unsigned vertex_id_offset,
155                       unsigned start_instance,
156                       const unsigned *fetch_elts,
157                       unsigned draw_id, unsigned view_id);
158 
159 
160 typedef int
161 (*draw_gs_jit_func)(struct draw_gs_jit_context *context,
162                     const struct lp_jit_resources *resources,
163                     float inputs[6][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS][TGSI_NUM_CHANNELS],
164                     struct vertex_header **output,
165                     unsigned num_prims,
166                     unsigned instance_id,
167                     int *prim_ids,
168                     unsigned invocation_id,
169                     unsigned view_id);
170 
171 typedef int
172 (*draw_tcs_jit_func)(const struct lp_jit_resources *resources,
173                      float inputs[32][NUM_TCS_INPUTS][TGSI_NUM_CHANNELS],
174                      float outputs[32][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS],
175                      uint32_t prim_id, uint32_t patch_vertices_in,
176                      unsigned view_id);
177 
178 typedef int
179 (*draw_tes_jit_func)(const struct lp_jit_resources *resources,
180                      float inputs[32][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS],
181                      struct vertex_header *io,
182                      uint32_t prim_id, uint32_t num_tess_coord,
183                      float *tess_coord_x, float *tess_coord_y, float *tess_outer,
184                      float *tess_inner, uint32_t patch_vertices_in,
185                      unsigned view_id);
186 
187 
188 struct draw_llvm_variant_key
189 {
190    unsigned nr_vertex_elements:8;
191    unsigned nr_samplers:8;
192    unsigned nr_sampler_views:8;
193    unsigned nr_images:8;
194    unsigned clamp_vertex_color:1;
195    unsigned clip_xy:1;
196    unsigned clip_z:1;
197    unsigned clip_user:1;
198    unsigned clip_halfz:1;
199    unsigned bypass_viewport:1;
200    unsigned need_edgeflags:1;
201    unsigned has_gs_or_tes:1;
202    unsigned num_outputs:8;
203    unsigned ucp_enable:PIPE_MAX_CLIP_PLANES;
204    /* note padding here - must use memset */
205 
206    /* Variable number of vertex elements:
207     */
208    struct pipe_vertex_element vertex_element[1];
209 
210    /* Followed by variable number of samplers:
211     */
212 /*   struct draw_sampler_static_state sampler; */
213    /* Followed by variable number of images
214     */
215 };
216 
217 struct draw_gs_llvm_variant_key
218 {
219    unsigned nr_samplers:8;
220    unsigned nr_sampler_views:8;
221    unsigned nr_images:8;
222    unsigned num_outputs:8;
223    /* note padding here - must use memset */
224    unsigned clamp_vertex_color:1;
225    struct lp_sampler_static_state samplers[1];
226    /* Followed by variable number of images.*/
227 };
228 
229 struct draw_tcs_llvm_variant_key
230 {
231    unsigned nr_samplers:8;
232    unsigned nr_sampler_views:8;
233    unsigned nr_images:8;
234    struct lp_sampler_static_state samplers[1];
235    /* Followed by variable number of images.*/
236 };
237 
238 struct draw_tes_llvm_variant_key
239 {
240    unsigned nr_samplers:8;
241    unsigned nr_sampler_views:8;
242    unsigned nr_images:8;
243    unsigned primid_output:7;
244    unsigned primid_needed:1;
245    unsigned clamp_vertex_color:1;
246    struct lp_sampler_static_state samplers[1];
247    /* Followed by variable number of images.*/
248 };
249 
250 #define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \
251    (sizeof(struct draw_llvm_variant_key) +	\
252     PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct lp_sampler_static_state) +	\
253     PIPE_MAX_SHADER_IMAGES * sizeof(struct lp_image_static_state) + \
254     (PIPE_MAX_ATTRIBS-1) * sizeof(struct pipe_vertex_element))
255 
256 #define DRAW_GS_LLVM_MAX_VARIANT_KEY_SIZE \
257    (sizeof(struct draw_gs_llvm_variant_key) +	\
258     PIPE_MAX_SHADER_IMAGES * sizeof(struct lp_image_static_state) + \
259     PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct lp_sampler_static_state))
260 
261 #define DRAW_TCS_LLVM_MAX_VARIANT_KEY_SIZE \
262    (sizeof(struct draw_tcs_llvm_variant_key) +	\
263     PIPE_MAX_SHADER_IMAGES * sizeof(struct lp_image_static_state) + \
264     PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct lp_sampler_static_state))
265 
266 #define DRAW_TES_LLVM_MAX_VARIANT_KEY_SIZE \
267    (sizeof(struct draw_tes_llvm_variant_key) +	\
268     PIPE_MAX_SHADER_IMAGES * sizeof(struct lp_image_static_state) + \
269     PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct lp_sampler_static_state))
270 
271 
272 static inline size_t
draw_llvm_variant_key_size(unsigned nr_vertex_elements,unsigned nr_samplers,unsigned nr_sampler_views,unsigned nr_images)273 draw_llvm_variant_key_size(unsigned nr_vertex_elements,
274                            unsigned nr_samplers,
275                            unsigned nr_sampler_views,
276                            unsigned nr_images)
277 {
278    return (sizeof(struct draw_llvm_variant_key) +
279            (nr_vertex_elements - 1) * sizeof(struct pipe_vertex_element) +
280            MAX2(nr_samplers, nr_sampler_views) *
281                sizeof(struct lp_sampler_static_state) +
282            nr_images * sizeof(struct lp_image_static_state));
283 }
284 
285 
286 static inline size_t
draw_gs_llvm_variant_key_size(unsigned nr_samplers,unsigned nr_sampler_views,unsigned nr_images)287 draw_gs_llvm_variant_key_size(unsigned nr_samplers,
288                               unsigned nr_sampler_views,
289                               unsigned nr_images)
290 {
291    return (sizeof(struct draw_gs_llvm_variant_key) +
292            (MAX2(nr_samplers, nr_sampler_views) - 1) *
293                sizeof(struct lp_sampler_static_state) +
294            nr_images * sizeof(struct lp_sampler_static_state));
295 }
296 
297 static inline size_t
draw_tcs_llvm_variant_key_size(unsigned nr_samplers,unsigned nr_sampler_views,unsigned nr_images)298 draw_tcs_llvm_variant_key_size(unsigned nr_samplers,
299                                unsigned nr_sampler_views,
300                                unsigned nr_images)
301 {
302    return (sizeof(struct draw_tcs_llvm_variant_key) +
303            (MAX2(nr_samplers, nr_sampler_views) - 1) *
304                sizeof(struct lp_sampler_static_state) +
305            nr_images * sizeof(struct lp_sampler_static_state));
306 }
307 
308 static inline size_t
draw_tes_llvm_variant_key_size(unsigned nr_samplers,unsigned nr_sampler_views,unsigned nr_images)309 draw_tes_llvm_variant_key_size(unsigned nr_samplers,
310                                unsigned nr_sampler_views,
311                                unsigned nr_images)
312 {
313    return (sizeof(struct draw_tes_llvm_variant_key) +
314            (MAX2(nr_samplers, nr_sampler_views) - 1) *
315                sizeof(struct lp_sampler_static_state) +
316            nr_images * sizeof(struct lp_sampler_static_state));
317 }
318 
319 static inline struct lp_sampler_static_state *
draw_llvm_variant_key_samplers(struct draw_llvm_variant_key * key)320 draw_llvm_variant_key_samplers(struct draw_llvm_variant_key *key)
321 {
322    return (struct lp_sampler_static_state *)
323       &key->vertex_element[key->nr_vertex_elements];
324 }
325 
326 static inline struct lp_image_static_state *
draw_llvm_variant_key_images(struct draw_llvm_variant_key * key)327 draw_llvm_variant_key_images(struct draw_llvm_variant_key *key)
328 {
329    struct lp_sampler_static_state *samplers = (struct lp_sampler_static_state *)
330       (&key->vertex_element[key->nr_vertex_elements]);
331    return (struct lp_image_static_state *)
332       &samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
333 }
334 
335 static inline struct lp_image_static_state *
draw_gs_llvm_variant_key_images(struct draw_gs_llvm_variant_key * key)336 draw_gs_llvm_variant_key_images(struct draw_gs_llvm_variant_key *key)
337 {
338    return (struct lp_image_static_state *)
339       &key->samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
340 }
341 
342 static inline struct lp_image_static_state *
draw_tcs_llvm_variant_key_images(struct draw_tcs_llvm_variant_key * key)343 draw_tcs_llvm_variant_key_images(struct draw_tcs_llvm_variant_key *key)
344 {
345    return (struct lp_image_static_state *)
346       &key->samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
347 }
348 
349 static inline struct lp_image_static_state *
draw_tes_llvm_variant_key_images(struct draw_tes_llvm_variant_key * key)350 draw_tes_llvm_variant_key_images(struct draw_tes_llvm_variant_key *key)
351 {
352    return (struct lp_image_static_state *)
353       &key->samplers[MAX2(key->nr_samplers, key->nr_sampler_views)];
354 }
355 
356 struct draw_llvm_variant_list_item
357 {
358    struct list_head list;
359    struct draw_llvm_variant *base;
360 };
361 
362 struct draw_gs_llvm_variant_list_item
363 {
364    struct list_head list;
365    struct draw_gs_llvm_variant *base;
366 };
367 
368 struct draw_tcs_llvm_variant_list_item
369 {
370    struct list_head list;
371    struct draw_tcs_llvm_variant *base;
372 };
373 
374 struct draw_tes_llvm_variant_list_item
375 {
376    struct list_head list;
377    struct draw_tes_llvm_variant *base;
378 };
379 
380 struct draw_llvm_variant
381 {
382    struct gallivm_state *gallivm;
383 
384    /* LLVM JIT builder types */
385    LLVMTypeRef context_type;
386    LLVMTypeRef context_ptr_type;
387 
388    LLVMTypeRef resources_type;
389    LLVMTypeRef resources_ptr_type;
390 
391    LLVMTypeRef buffer_type;
392    LLVMTypeRef buffer_ptr_type;
393 
394    LLVMTypeRef vb_type;
395    LLVMTypeRef vb_ptr_type;
396 
397    LLVMTypeRef vertex_header_type;
398    LLVMTypeRef vertex_header_ptr_type;
399 
400    LLVMValueRef function;
401    char *function_name;
402    draw_jit_vert_func jit_func;
403 
404    struct llvm_vertex_shader *shader;
405 
406    struct draw_llvm *llvm;
407    struct draw_llvm_variant_list_item list_item_global;
408    struct draw_llvm_variant_list_item list_item_local;
409 
410    /* key is variable-sized, must be last */
411    struct draw_llvm_variant_key key;
412 };
413 
414 
415 struct draw_gs_llvm_variant
416 {
417    struct gallivm_state *gallivm;
418 
419    /* LLVM JIT builder types */
420    LLVMTypeRef context_type;
421    LLVMTypeRef context_ptr_type;
422 
423    LLVMTypeRef resources_type;
424    LLVMTypeRef resources_ptr_type;
425 
426    LLVMTypeRef vertex_header_type;
427    LLVMTypeRef vertex_header_ptr_type;
428 
429    LLVMTypeRef input_array_type;
430 
431    LLVMValueRef context_ptr;
432    LLVMValueRef io_ptr;
433    LLVMValueRef num_prims;
434    LLVMValueRef function;
435    char *function_name;
436    draw_gs_jit_func jit_func;
437 
438    struct llvm_geometry_shader *shader;
439 
440    struct draw_llvm *llvm;
441    struct draw_gs_llvm_variant_list_item list_item_global;
442    struct draw_gs_llvm_variant_list_item list_item_local;
443 
444    /* key is variable-sized, must be last */
445    struct draw_gs_llvm_variant_key key;
446 };
447 
448 struct draw_tcs_llvm_variant
449 {
450    struct gallivm_state *gallivm;
451 
452    /* LLVM JIT builder types */
453    LLVMTypeRef resources_type;
454    LLVMTypeRef resources_ptr_type;
455    LLVMTypeRef input_array_type;
456    LLVMTypeRef output_array_type;
457 
458    LLVMValueRef context_ptr;
459    /* LLVMValueRef io_ptr; */
460    LLVMValueRef num_prims;
461    LLVMValueRef function;
462    char *function_name;
463    draw_tcs_jit_func jit_func;
464 
465    struct llvm_tess_ctrl_shader *shader;
466 
467    struct draw_llvm *llvm;
468    struct draw_tcs_llvm_variant_list_item list_item_global;
469    struct draw_tcs_llvm_variant_list_item list_item_local;
470 
471    /* key is variable-sized, must be last */
472    struct draw_tcs_llvm_variant_key key;
473 };
474 
475 struct draw_tes_llvm_variant
476 {
477    struct gallivm_state *gallivm;
478 
479    /* LLVM JIT builder types */
480    LLVMTypeRef resources_type;
481    LLVMTypeRef resources_ptr_type;
482    LLVMTypeRef vertex_header_ptr_type;
483    LLVMTypeRef input_array_type;
484    LLVMTypeRef patch_input_array_type;
485 
486    LLVMTypeRef input_array_deref_type;
487    LLVMTypeRef vertex_header_type;
488 
489    LLVMValueRef context_ptr;
490    LLVMValueRef io_ptr;
491    LLVMValueRef num_prims;
492    LLVMValueRef function;
493    char *function_name;
494    draw_tes_jit_func jit_func;
495 
496    struct llvm_tess_eval_shader *shader;
497 
498    struct draw_llvm *llvm;
499    struct draw_tes_llvm_variant_list_item list_item_global;
500    struct draw_tes_llvm_variant_list_item list_item_local;
501 
502    /* key is variable-sized, must be last */
503    struct draw_tes_llvm_variant_key key;
504 };
505 
506 struct llvm_vertex_shader {
507    struct draw_vertex_shader base;
508 
509    unsigned variant_key_size;
510    struct draw_llvm_variant_list_item variants;
511    unsigned variants_created;
512    unsigned variants_cached;
513 };
514 
515 struct llvm_geometry_shader {
516    struct draw_geometry_shader base;
517 
518    unsigned variant_key_size;
519    struct draw_gs_llvm_variant_list_item variants;
520    unsigned variants_created;
521    unsigned variants_cached;
522 };
523 
524 struct llvm_tess_ctrl_shader {
525    struct draw_tess_ctrl_shader base;
526 
527    unsigned variant_key_size;
528    struct draw_tcs_llvm_variant_list_item variants;
529    unsigned variants_created;
530    unsigned variants_cached;
531 };
532 
533 struct llvm_tess_eval_shader {
534    struct draw_tess_eval_shader base;
535 
536    unsigned variant_key_size;
537    struct draw_tes_llvm_variant_list_item variants;
538    unsigned variants_created;
539    unsigned variants_cached;
540 };
541 
542 struct draw_llvm {
543    struct draw_context *draw;
544 
545    lp_context_ref context;
546 
547    struct draw_vs_jit_context vs_jit_context;
548    struct draw_gs_jit_context gs_jit_context;
549 
550    struct lp_jit_resources jit_resources[DRAW_MAX_SHADER_STAGE];
551 
552    struct draw_llvm_variant_list_item vs_variants_list;
553    int nr_variants;
554 
555    struct draw_gs_llvm_variant_list_item gs_variants_list;
556    int nr_gs_variants;
557 
558    struct draw_tcs_llvm_variant_list_item tcs_variants_list;
559    int nr_tcs_variants;
560 
561    struct draw_tes_llvm_variant_list_item tes_variants_list;
562    int nr_tes_variants;
563 };
564 
565 
566 static inline struct llvm_vertex_shader *
llvm_vertex_shader(struct draw_vertex_shader * vs)567 llvm_vertex_shader(struct draw_vertex_shader *vs)
568 {
569    return (struct llvm_vertex_shader *)vs;
570 }
571 
572 static inline struct llvm_geometry_shader *
llvm_geometry_shader(struct draw_geometry_shader * gs)573 llvm_geometry_shader(struct draw_geometry_shader *gs)
574 {
575    return (struct llvm_geometry_shader *)gs;
576 }
577 
578 static inline struct llvm_tess_ctrl_shader *
llvm_tess_ctrl_shader(struct draw_tess_ctrl_shader * tcs)579 llvm_tess_ctrl_shader(struct draw_tess_ctrl_shader *tcs)
580 {
581    return (struct llvm_tess_ctrl_shader *)tcs;
582 }
583 
584 static inline struct llvm_tess_eval_shader *
llvm_tess_eval_shader(struct draw_tess_eval_shader * tes)585 llvm_tess_eval_shader(struct draw_tess_eval_shader *tes)
586 {
587    return (struct llvm_tess_eval_shader *)tes;
588 }
589 
590 struct draw_llvm *
591 draw_llvm_create(struct draw_context *draw, lp_context_ref *llvm_context);
592 
593 void
594 draw_llvm_destroy(struct draw_llvm *llvm);
595 
596 struct draw_llvm_variant *
597 draw_llvm_create_variant(struct draw_llvm *llvm,
598                          unsigned num_vertex_header_attribs,
599                          const struct draw_llvm_variant_key *key);
600 
601 void
602 draw_llvm_destroy_variant(struct draw_llvm_variant *variant);
603 
604 struct draw_llvm_variant_key *
605 draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
606 
607 void
608 draw_llvm_dump_variant_key(struct draw_llvm_variant_key *key);
609 
610 
611 struct draw_gs_llvm_variant *
612 draw_gs_llvm_create_variant(struct draw_llvm *llvm,
613                             unsigned num_vertex_header_attribs,
614                             const struct draw_gs_llvm_variant_key *key);
615 
616 void
617 draw_gs_llvm_destroy_variant(struct draw_gs_llvm_variant *variant);
618 
619 struct draw_gs_llvm_variant_key *
620 draw_gs_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
621 
622 void
623 draw_gs_llvm_dump_variant_key(struct draw_gs_llvm_variant_key *key);
624 
625 struct draw_tcs_llvm_variant *
626 draw_tcs_llvm_create_variant(struct draw_llvm *llvm,
627                              unsigned num_vertex_header_attribs,
628                              const struct draw_tcs_llvm_variant_key *key);
629 
630 void
631 draw_tcs_llvm_destroy_variant(struct draw_tcs_llvm_variant *variant);
632 
633 struct draw_tcs_llvm_variant_key *
634 draw_tcs_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
635 
636 void
637 draw_tcs_llvm_dump_variant_key(struct draw_tcs_llvm_variant_key *key);
638 
639 struct draw_tes_llvm_variant *
640 draw_tes_llvm_create_variant(struct draw_llvm *llvm,
641                              unsigned num_vertex_header_attribs,
642                              const struct draw_tes_llvm_variant_key *key);
643 
644 void
645 draw_tes_llvm_destroy_variant(struct draw_tes_llvm_variant *variant);
646 
647 struct draw_tes_llvm_variant_key *
648 draw_tes_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
649 
650 void
651 draw_tes_llvm_dump_variant_key(struct draw_tes_llvm_variant_key *key);
652 
653 void
654 draw_llvm_set_sampler_state(struct draw_context *draw,
655                             enum pipe_shader_type shader_stage);
656 
657 void
658 draw_llvm_set_mapped_texture(struct draw_context *draw,
659                              enum pipe_shader_type shader_stage,
660                              unsigned sview_idx,
661                              uint32_t width, uint32_t height, uint32_t depth,
662                              uint32_t first_level, uint32_t last_level,
663                              uint32_t num_samples,
664                              uint32_t sample_stride,
665                              const void *base_ptr,
666                              uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
667                              uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
668                              uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS]);
669 
670 void
671 draw_llvm_set_mapped_image(struct draw_context *draw,
672                            enum pipe_shader_type shader_stage,
673                            unsigned idx,
674                            uint32_t width, uint32_t height, uint32_t depth,
675                            const void *base_ptr,
676                            uint32_t row_stride,
677                            uint32_t img_stride,
678                            uint32_t num_samples,
679                            uint32_t sample_stride);
680 
681 void
682 draw_store_aos_array(struct gallivm_state *gallivm,
683                      struct lp_type soa_type,
684                      LLVMTypeRef io_type,
685                      LLVMValueRef io_ptr,
686                      LLVMValueRef *indices,
687                      LLVMValueRef* aos,
688                      int attrib,
689                      LLVMValueRef clipmask,
690                      bool need_edgeflag,
691                      bool per_prim);
692 
693 #endif
694