914f783fd000209b9715a103528ce9548d9d0ec1
[mesa.git] / src / gallium / auxiliary / draw / draw_llvm.h
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
36 #include "gallivm/lp_bld_sample.h"
37 #include "gallivm/lp_bld_limits.h"
38
39 #include "pipe/p_context.h"
40 #include "util/simple_list.h"
41
42
43 struct draw_llvm;
44 struct llvm_vertex_shader;
45 struct llvm_geometry_shader;
46
47 struct draw_jit_texture
48 {
49 uint32_t width;
50 uint32_t height;
51 uint32_t depth;
52 const void *base;
53 uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
54 uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
55 uint32_t first_level;
56 uint32_t last_level;
57 uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS];
58 };
59
60
61 struct draw_sampler_static_state
62 {
63 /*
64 * These attributes are effectively interleaved for more sane key handling.
65 * However, there might be lots of null space if the amount of samplers and
66 * textures isn't the same.
67 */
68 struct lp_static_sampler_state sampler_state;
69 struct lp_static_texture_state texture_state;
70 };
71
72 struct draw_image_static_state
73 {
74 struct lp_static_texture_state image_state;
75 };
76
77
78 struct draw_jit_sampler
79 {
80 float min_lod;
81 float max_lod;
82 float lod_bias;
83 float border_color[4];
84 };
85
86
87 struct draw_jit_image
88 {
89 uint32_t width;
90 uint32_t height;
91 uint32_t depth;
92 const void *base;
93 uint32_t row_stride;
94 uint32_t img_stride;
95 };
96
97 enum {
98 DRAW_JIT_TEXTURE_WIDTH = 0,
99 DRAW_JIT_TEXTURE_HEIGHT,
100 DRAW_JIT_TEXTURE_DEPTH,
101 DRAW_JIT_TEXTURE_BASE,
102 DRAW_JIT_TEXTURE_ROW_STRIDE,
103 DRAW_JIT_TEXTURE_IMG_STRIDE,
104 DRAW_JIT_TEXTURE_FIRST_LEVEL,
105 DRAW_JIT_TEXTURE_LAST_LEVEL,
106 DRAW_JIT_TEXTURE_MIP_OFFSETS,
107 DRAW_JIT_TEXTURE_NUM_FIELDS /* number of fields above */
108 };
109
110
111 enum {
112 DRAW_JIT_SAMPLER_MIN_LOD,
113 DRAW_JIT_SAMPLER_MAX_LOD,
114 DRAW_JIT_SAMPLER_LOD_BIAS,
115 DRAW_JIT_SAMPLER_BORDER_COLOR,
116 DRAW_JIT_SAMPLER_NUM_FIELDS /* number of fields above */
117 };
118
119
120 enum {
121 DRAW_JIT_VERTEX_VERTEX_ID = 0,
122 DRAW_JIT_VERTEX_CLIP_POS,
123 DRAW_JIT_VERTEX_DATA
124 };
125
126 enum {
127 DRAW_JIT_IMAGE_WIDTH = 0,
128 DRAW_JIT_IMAGE_HEIGHT,
129 DRAW_JIT_IMAGE_DEPTH,
130 DRAW_JIT_IMAGE_BASE,
131 DRAW_JIT_IMAGE_ROW_STRIDE,
132 DRAW_JIT_IMAGE_IMG_STRIDE,
133 DRAW_JIT_IMAGE_NUM_FIELDS /* number of fields above */
134 };
135
136 /**
137 * This structure is passed directly to the generated vertex shader.
138 *
139 * It contains the derived state.
140 *
141 * Changes here must be reflected in the draw_jit_context_* macros.
142 * Changes to the ordering should be avoided.
143 *
144 * Only use types with a clear size and padding here, in particular prefer the
145 * stdint.h types to the basic integer types.
146 */
147 struct draw_jit_context
148 {
149 const float *vs_constants[LP_MAX_TGSI_CONST_BUFFERS];
150 int num_vs_constants[LP_MAX_TGSI_CONST_BUFFERS];
151 float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
152 struct pipe_viewport_state *viewports;
153
154 struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
155 struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
156 struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
157
158 const uint32_t *vs_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
159 int num_vs_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
160 };
161
162 enum {
163 DRAW_JIT_CTX_CONSTANTS = 0,
164 DRAW_JIT_CTX_NUM_CONSTANTS = 1,
165 DRAW_JIT_CTX_PLANES = 2,
166 DRAW_JIT_CTX_VIEWPORT = 3,
167 DRAW_JIT_CTX_TEXTURES = 4,
168 DRAW_JIT_CTX_SAMPLERS = 5,
169 DRAW_JIT_CTX_IMAGES = 6,
170 DRAW_JIT_CTX_SSBOS = 7,
171 DRAW_JIT_CTX_NUM_SSBOS = 8,
172 DRAW_JIT_CTX_NUM_FIELDS
173 };
174
175 #define draw_jit_context_vs_constants(_gallivm, _ptr) \
176 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_CONSTANTS, "vs_constants")
177
178 #define draw_jit_context_num_vs_constants(_gallivm, _ptr) \
179 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_NUM_CONSTANTS, "num_vs_constants")
180
181 #define draw_jit_context_planes(_gallivm, _ptr) \
182 lp_build_struct_get(_gallivm, _ptr, DRAW_JIT_CTX_PLANES, "planes")
183
184 #define draw_jit_context_viewports(_gallivm, _ptr) \
185 lp_build_struct_get(_gallivm, _ptr, DRAW_JIT_CTX_VIEWPORT, "viewports")
186
187 #define draw_jit_context_textures(_gallivm, _ptr) \
188 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_TEXTURES, "textures")
189
190 #define draw_jit_context_samplers(_gallivm, _ptr) \
191 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_SAMPLERS, "samplers")
192
193 #define draw_jit_context_images(_gallivm, _ptr) \
194 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_IMAGES, "images")
195
196 #define draw_jit_context_vs_ssbos(_gallivm, _ptr) \
197 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_SSBOS, "vs_ssbos")
198
199 #define draw_jit_context_num_vs_ssbos(_gallivm, _ptr) \
200 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_NUM_SSBOS, "num_vs_ssbos")
201
202
203 #define draw_jit_header_id(_gallivm, _ptr) \
204 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_VERTEX_VERTEX_ID, "id")
205
206 #define draw_jit_header_clip_pos(_gallivm, _ptr) \
207 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_VERTEX_CLIP_POS, "clip_pos")
208
209 #define draw_jit_header_data(_gallivm, _ptr) \
210 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_VERTEX_DATA, "data")
211
212
213 #define draw_jit_vbuffer_stride(_gallivm, _ptr) \
214 lp_build_struct_get(_gallivm, _ptr, 0, "stride")
215
216 #define draw_jit_vbuffer_offset(_gallivm, _ptr) \
217 lp_build_struct_get(_gallivm, _ptr, 2, "buffer_offset")
218
219 enum {
220 DRAW_JIT_DVBUFFER_MAP = 0,
221 DRAW_JIT_DVBUFFER_SIZE,
222 DRAW_JIT_DVBUFFER_NUM_FIELDS /* number of fields above */
223 };
224
225 #define draw_jit_dvbuffer_map(_gallivm, _ptr) \
226 lp_build_struct_get(_gallivm, _ptr, DRAW_JIT_DVBUFFER_MAP, "map")
227
228 #define draw_jit_dvbuffer_size(_gallivm, _ptr) \
229 lp_build_struct_get(_gallivm, _ptr, DRAW_JIT_DVBUFFER_SIZE, "size")
230
231
232 /**
233 * This structure is passed directly to the generated geometry shader.
234 *
235 * It contains the derived state.
236 *
237 * Changes here must be reflected in the draw_gs_jit_context_* macros.
238 * Changes to the ordering should be avoided.
239 *
240 * Only use types with a clear size and padding here, in particular prefer the
241 * stdint.h types to the basic integer types.
242 */
243 struct draw_gs_jit_context
244 {
245 const float *constants[LP_MAX_TGSI_CONST_BUFFERS];
246 int num_constants[LP_MAX_TGSI_CONST_BUFFERS];
247 float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
248 struct pipe_viewport_state *viewports;
249
250 /* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and
251 * DRAW_JIT_CTX_SAMPLERS positions in the struct */
252 struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
253 struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
254 struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
255
256 int **prim_lengths;
257 int *emitted_vertices;
258 int *emitted_prims;
259 const uint32_t *ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
260 int num_ssbos[LP_MAX_TGSI_SHADER_BUFFERS];
261
262 };
263
264 enum {
265 DRAW_GS_JIT_CTX_CONSTANTS = 0,
266 DRAW_GS_JIT_CTX_NUM_CONSTANTS = 1,
267 DRAW_GS_JIT_CTX_PLANES = 2,
268 DRAW_GS_JIT_CTX_VIEWPORT = 3,
269 /* Textures and samples are reserved for DRAW_JIT_CTX_TEXTURES
270 * and DRAW_JIT_CTX_SAMPLERS, because they both need
271 * to be at exactly the same locations as they are in the
272 * VS ctx structure for sampling to work. */
273 DRAW_GS_JIT_CTX_TEXTURES = DRAW_JIT_CTX_TEXTURES,
274 DRAW_GS_JIT_CTX_SAMPLERS = DRAW_JIT_CTX_SAMPLERS,
275 DRAW_GS_JIT_CTX_IMAGES = DRAW_JIT_CTX_IMAGES,
276 DRAW_GS_JIT_CTX_PRIM_LENGTHS = 7,
277 DRAW_GS_JIT_CTX_EMITTED_VERTICES = 8,
278 DRAW_GS_JIT_CTX_EMITTED_PRIMS = 9,
279 DRAW_GS_JIT_CTX_SSBOS = 10,
280 DRAW_GS_JIT_CTX_NUM_SSBOS = 11,
281 DRAW_GS_JIT_CTX_NUM_FIELDS = 12
282 };
283
284 #define draw_gs_jit_context_constants(_gallivm, _ptr) \
285 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_CONSTANTS, "constants")
286
287 #define draw_gs_jit_context_num_constants(_gallivm, _ptr) \
288 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_NUM_CONSTANTS, "num_constants")
289
290 #define draw_gs_jit_context_planes(_gallivm, _ptr) \
291 lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_PLANES, "planes")
292
293 #define draw_gs_jit_context_viewports(_gallivm, _ptr) \
294 lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_VIEWPORT, "viewports")
295
296 #define draw_gs_jit_context_textures(_gallivm, _ptr) \
297 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_TEXTURES, "textures")
298
299 #define draw_gs_jit_context_samplers(_gallivm, _ptr) \
300 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_SAMPLERS, "samplers")
301
302 #define draw_gs_jit_context_images(_gallivm, _ptr) \
303 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_IMAGES, "images")
304
305 #define draw_gs_jit_prim_lengths(_gallivm, _ptr) \
306 lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_PRIM_LENGTHS, "prim_lengths")
307
308 #define draw_gs_jit_emitted_vertices(_gallivm, _ptr) \
309 lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_EMITTED_VERTICES, "emitted_vertices")
310
311 #define draw_gs_jit_emitted_prims(_gallivm, _ptr) \
312 lp_build_struct_get(_gallivm, _ptr, DRAW_GS_JIT_CTX_EMITTED_PRIMS, "emitted_prims")
313
314 #define draw_gs_jit_context_ssbos(_gallivm, _ptr) \
315 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_SSBOS, "ssbos")
316
317 #define draw_gs_jit_context_num_ssbos(_gallivm, _ptr) \
318 lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_GS_JIT_CTX_NUM_SSBOS, "num_ssbos")
319
320 typedef boolean
321 (*draw_jit_vert_func)(struct draw_jit_context *context,
322 struct vertex_header *io,
323 const struct draw_vertex_buffer vbuffers[PIPE_MAX_ATTRIBS],
324 unsigned count,
325 unsigned start_or_maxelt,
326 unsigned stride,
327 struct pipe_vertex_buffer *vertex_buffers,
328 unsigned instance_id,
329 unsigned vertex_id_offset,
330 unsigned start_instance,
331 const unsigned *fetch_elts);
332
333
334 typedef int
335 (*draw_gs_jit_func)(struct draw_gs_jit_context *context,
336 float inputs[6][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS][TGSI_NUM_CHANNELS],
337 struct vertex_header *output,
338 unsigned num_prims,
339 unsigned instance_id,
340 int *prim_ids,
341 unsigned invocation_id);
342
343 struct draw_llvm_variant_key
344 {
345 unsigned nr_vertex_elements:8;
346 unsigned nr_samplers:8;
347 unsigned nr_sampler_views:8;
348 unsigned nr_images:8;
349 unsigned clamp_vertex_color:1;
350 unsigned clip_xy:1;
351 unsigned clip_z:1;
352 unsigned clip_user:1;
353 unsigned clip_halfz:1;
354 unsigned bypass_viewport:1;
355 unsigned need_edgeflags:1;
356 unsigned has_gs:1;
357 unsigned num_outputs:8;
358 unsigned ucp_enable:PIPE_MAX_CLIP_PLANES;
359 /* note padding here - must use memset */
360
361 /* Variable number of vertex elements:
362 */
363 struct pipe_vertex_element vertex_element[1];
364
365 /* Followed by variable number of samplers:
366 */
367 /* struct draw_sampler_static_state sampler; */
368 /* Followed by variable number of images
369 */
370 };
371
372 struct draw_gs_llvm_variant_key
373 {
374 unsigned nr_samplers:8;
375 unsigned nr_sampler_views:8;
376 unsigned nr_images:8;
377 unsigned num_outputs:8;
378 /* note padding here - must use memset */
379
380 struct draw_sampler_static_state samplers[1];
381 /* Followed by variable number of images.*/
382 };
383
384 #define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \
385 (sizeof(struct draw_llvm_variant_key) + \
386 PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state) + \
387 PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
388 (PIPE_MAX_ATTRIBS-1) * sizeof(struct pipe_vertex_element))
389
390 #define DRAW_GS_LLVM_MAX_VARIANT_KEY_SIZE \
391 (sizeof(struct draw_gs_llvm_variant_key) + \
392 PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
393 PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
394
395
396 static inline size_t
397 draw_llvm_variant_key_size(unsigned nr_vertex_elements,
398 unsigned nr_samplers, unsigned nr_images)
399 {
400 return (sizeof(struct draw_llvm_variant_key) +
401 nr_samplers * sizeof(struct draw_sampler_static_state) +
402 nr_images * sizeof(struct draw_image_static_state) +
403 (nr_vertex_elements - 1) * sizeof(struct pipe_vertex_element));
404 }
405
406
407 static inline size_t
408 draw_gs_llvm_variant_key_size(unsigned nr_samplers, unsigned nr_images)
409 {
410 return (sizeof(struct draw_gs_llvm_variant_key) +
411 (nr_images) * sizeof(struct draw_sampler_static_state) +
412 (nr_samplers - 1) * sizeof(struct draw_sampler_static_state));
413 }
414
415
416 static inline struct draw_sampler_static_state *
417 draw_llvm_variant_key_samplers(struct draw_llvm_variant_key *key)
418 {
419 return (struct draw_sampler_static_state *)
420 &key->vertex_element[key->nr_vertex_elements];
421 }
422
423 static inline struct draw_image_static_state *
424 draw_llvm_variant_key_images(struct draw_llvm_variant_key *key)
425 {
426 struct draw_sampler_static_state *samplers = (struct draw_sampler_static_state *)
427 (&key->vertex_element[key->nr_vertex_elements]);
428 return (struct draw_image_static_state *)
429 &samplers[key->nr_samplers];
430 }
431
432 static inline struct draw_image_static_state *
433 draw_gs_llvm_variant_key_images(struct draw_gs_llvm_variant_key *key)
434 {
435 return (struct draw_image_static_state *)
436 &key->samplers[key->nr_samplers];
437 }
438
439 struct draw_llvm_variant_list_item
440 {
441 struct draw_llvm_variant *base;
442 struct draw_llvm_variant_list_item *next, *prev;
443 };
444
445 struct draw_gs_llvm_variant_list_item
446 {
447 struct draw_gs_llvm_variant *base;
448 struct draw_gs_llvm_variant_list_item *next, *prev;
449 };
450
451
452 struct draw_llvm_variant
453 {
454 struct gallivm_state *gallivm;
455
456 /* LLVM JIT builder types */
457 LLVMTypeRef context_ptr_type;
458 LLVMTypeRef buffer_ptr_type;
459 LLVMTypeRef vb_ptr_type;
460 LLVMTypeRef vertex_header_ptr_type;
461
462 LLVMValueRef function;
463 draw_jit_vert_func jit_func;
464
465 struct llvm_vertex_shader *shader;
466
467 struct draw_llvm *llvm;
468 struct draw_llvm_variant_list_item list_item_global;
469 struct draw_llvm_variant_list_item list_item_local;
470
471 /* key is variable-sized, must be last */
472 struct draw_llvm_variant_key key;
473 };
474
475
476 struct draw_gs_llvm_variant
477 {
478 struct gallivm_state *gallivm;
479
480 /* LLVM JIT builder types */
481 LLVMTypeRef context_ptr_type;
482 LLVMTypeRef vertex_header_ptr_type;
483 LLVMTypeRef input_array_type;
484
485 LLVMValueRef context_ptr;
486 LLVMValueRef io_ptr;
487 LLVMValueRef num_prims;
488 LLVMValueRef function;
489 draw_gs_jit_func jit_func;
490
491 struct llvm_geometry_shader *shader;
492
493 struct draw_llvm *llvm;
494 struct draw_gs_llvm_variant_list_item list_item_global;
495 struct draw_gs_llvm_variant_list_item list_item_local;
496
497 /* key is variable-sized, must be last */
498 struct draw_gs_llvm_variant_key key;
499 };
500
501 struct llvm_vertex_shader {
502 struct draw_vertex_shader base;
503
504 unsigned variant_key_size;
505 struct draw_llvm_variant_list_item variants;
506 unsigned variants_created;
507 unsigned variants_cached;
508 };
509
510 struct llvm_geometry_shader {
511 struct draw_geometry_shader base;
512
513 unsigned variant_key_size;
514 struct draw_gs_llvm_variant_list_item variants;
515 unsigned variants_created;
516 unsigned variants_cached;
517 };
518
519
520 struct draw_llvm {
521 struct draw_context *draw;
522
523 LLVMContextRef context;
524 boolean context_owned;
525
526 struct draw_jit_context jit_context;
527 struct draw_gs_jit_context gs_jit_context;
528
529 struct draw_llvm_variant_list_item vs_variants_list;
530 int nr_variants;
531
532 struct draw_gs_llvm_variant_list_item gs_variants_list;
533 int nr_gs_variants;
534 };
535
536
537 static inline struct llvm_vertex_shader *
538 llvm_vertex_shader(struct draw_vertex_shader *vs)
539 {
540 return (struct llvm_vertex_shader *)vs;
541 }
542
543 static inline struct llvm_geometry_shader *
544 llvm_geometry_shader(struct draw_geometry_shader *gs)
545 {
546 return (struct llvm_geometry_shader *)gs;
547 }
548
549
550
551
552 struct draw_llvm *
553 draw_llvm_create(struct draw_context *draw, LLVMContextRef llvm_context);
554
555 void
556 draw_llvm_destroy(struct draw_llvm *llvm);
557
558 struct draw_llvm_variant *
559 draw_llvm_create_variant(struct draw_llvm *llvm,
560 unsigned num_vertex_header_attribs,
561 const struct draw_llvm_variant_key *key);
562
563 void
564 draw_llvm_destroy_variant(struct draw_llvm_variant *variant);
565
566 struct draw_llvm_variant_key *
567 draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
568
569 void
570 draw_llvm_dump_variant_key(struct draw_llvm_variant_key *key);
571
572
573 struct draw_gs_llvm_variant *
574 draw_gs_llvm_create_variant(struct draw_llvm *llvm,
575 unsigned num_vertex_header_attribs,
576 const struct draw_gs_llvm_variant_key *key);
577
578 void
579 draw_gs_llvm_destroy_variant(struct draw_gs_llvm_variant *variant);
580
581 struct draw_gs_llvm_variant_key *
582 draw_gs_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
583
584 void
585 draw_gs_llvm_dump_variant_key(struct draw_gs_llvm_variant_key *key);
586
587 struct lp_build_sampler_soa *
588 draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state);
589
590 struct lp_build_image_soa *
591 draw_llvm_image_soa_create(const struct draw_image_static_state *static_state);
592
593 void
594 draw_llvm_set_sampler_state(struct draw_context *draw,
595 enum pipe_shader_type shader_stage);
596
597 void
598 draw_llvm_set_mapped_texture(struct draw_context *draw,
599 enum pipe_shader_type shader_stage,
600 unsigned sview_idx,
601 uint32_t width, uint32_t height, uint32_t depth,
602 uint32_t first_level, uint32_t last_level,
603 const void *base_ptr,
604 uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
605 uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
606 uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS]);
607
608 void
609 draw_llvm_set_mapped_image(struct draw_context *draw,
610 enum pipe_shader_type shader_stage,
611 unsigned idx,
612 uint32_t width, uint32_t height, uint32_t depth,
613 const void *base_ptr,
614 uint32_t row_stride,
615 uint32_t img_stride);
616 #endif