aa5c374a647e35abe4c3a39680ee90e302dc8e2e
[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 unsigned draw_id);
333
334
335 typedef int
336 (*draw_gs_jit_func)(struct draw_gs_jit_context *context,
337 float inputs[6][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS][TGSI_NUM_CHANNELS],
338 struct vertex_header **output,
339 unsigned num_prims,
340 unsigned instance_id,
341 int *prim_ids,
342 unsigned invocation_id);
343
344 struct draw_llvm_variant_key
345 {
346 unsigned nr_vertex_elements:8;
347 unsigned nr_samplers:8;
348 unsigned nr_sampler_views:8;
349 unsigned nr_images:8;
350 unsigned clamp_vertex_color:1;
351 unsigned clip_xy:1;
352 unsigned clip_z:1;
353 unsigned clip_user:1;
354 unsigned clip_halfz:1;
355 unsigned bypass_viewport:1;
356 unsigned need_edgeflags:1;
357 unsigned has_gs:1;
358 unsigned num_outputs:8;
359 unsigned ucp_enable:PIPE_MAX_CLIP_PLANES;
360 /* note padding here - must use memset */
361
362 /* Variable number of vertex elements:
363 */
364 struct pipe_vertex_element vertex_element[1];
365
366 /* Followed by variable number of samplers:
367 */
368 /* struct draw_sampler_static_state sampler; */
369 /* Followed by variable number of images
370 */
371 };
372
373 struct draw_gs_llvm_variant_key
374 {
375 unsigned nr_samplers:8;
376 unsigned nr_sampler_views:8;
377 unsigned nr_images:8;
378 unsigned num_outputs:8;
379 /* note padding here - must use memset */
380
381 struct draw_sampler_static_state samplers[1];
382 /* Followed by variable number of images.*/
383 };
384
385 #define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \
386 (sizeof(struct draw_llvm_variant_key) + \
387 PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state) + \
388 PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
389 (PIPE_MAX_ATTRIBS-1) * sizeof(struct pipe_vertex_element))
390
391 #define DRAW_GS_LLVM_MAX_VARIANT_KEY_SIZE \
392 (sizeof(struct draw_gs_llvm_variant_key) + \
393 PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
394 PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
395
396
397 static inline size_t
398 draw_llvm_variant_key_size(unsigned nr_vertex_elements,
399 unsigned nr_samplers, unsigned nr_images)
400 {
401 return (sizeof(struct draw_llvm_variant_key) +
402 nr_samplers * sizeof(struct draw_sampler_static_state) +
403 nr_images * sizeof(struct draw_image_static_state) +
404 (nr_vertex_elements - 1) * sizeof(struct pipe_vertex_element));
405 }
406
407
408 static inline size_t
409 draw_gs_llvm_variant_key_size(unsigned nr_samplers, unsigned nr_images)
410 {
411 return (sizeof(struct draw_gs_llvm_variant_key) +
412 (nr_images) * sizeof(struct draw_sampler_static_state) +
413 (nr_samplers - 1) * sizeof(struct draw_sampler_static_state));
414 }
415
416
417 static inline struct draw_sampler_static_state *
418 draw_llvm_variant_key_samplers(struct draw_llvm_variant_key *key)
419 {
420 return (struct draw_sampler_static_state *)
421 &key->vertex_element[key->nr_vertex_elements];
422 }
423
424 static inline struct draw_image_static_state *
425 draw_llvm_variant_key_images(struct draw_llvm_variant_key *key)
426 {
427 struct draw_sampler_static_state *samplers = (struct draw_sampler_static_state *)
428 (&key->vertex_element[key->nr_vertex_elements]);
429 return (struct draw_image_static_state *)
430 &samplers[key->nr_samplers];
431 }
432
433 static inline struct draw_image_static_state *
434 draw_gs_llvm_variant_key_images(struct draw_gs_llvm_variant_key *key)
435 {
436 return (struct draw_image_static_state *)
437 &key->samplers[key->nr_samplers];
438 }
439
440 struct draw_llvm_variant_list_item
441 {
442 struct draw_llvm_variant *base;
443 struct draw_llvm_variant_list_item *next, *prev;
444 };
445
446 struct draw_gs_llvm_variant_list_item
447 {
448 struct draw_gs_llvm_variant *base;
449 struct draw_gs_llvm_variant_list_item *next, *prev;
450 };
451
452
453 struct draw_llvm_variant
454 {
455 struct gallivm_state *gallivm;
456
457 /* LLVM JIT builder types */
458 LLVMTypeRef context_ptr_type;
459 LLVMTypeRef buffer_ptr_type;
460 LLVMTypeRef vb_ptr_type;
461 LLVMTypeRef vertex_header_ptr_type;
462
463 LLVMValueRef function;
464 draw_jit_vert_func jit_func;
465
466 struct llvm_vertex_shader *shader;
467
468 struct draw_llvm *llvm;
469 struct draw_llvm_variant_list_item list_item_global;
470 struct draw_llvm_variant_list_item list_item_local;
471
472 /* key is variable-sized, must be last */
473 struct draw_llvm_variant_key key;
474 };
475
476
477 struct draw_gs_llvm_variant
478 {
479 struct gallivm_state *gallivm;
480
481 /* LLVM JIT builder types */
482 LLVMTypeRef context_ptr_type;
483 LLVMTypeRef vertex_header_ptr_type;
484 LLVMTypeRef input_array_type;
485
486 LLVMValueRef context_ptr;
487 LLVMValueRef io_ptr;
488 LLVMValueRef num_prims;
489 LLVMValueRef function;
490 draw_gs_jit_func jit_func;
491
492 struct llvm_geometry_shader *shader;
493
494 struct draw_llvm *llvm;
495 struct draw_gs_llvm_variant_list_item list_item_global;
496 struct draw_gs_llvm_variant_list_item list_item_local;
497
498 /* key is variable-sized, must be last */
499 struct draw_gs_llvm_variant_key key;
500 };
501
502 struct llvm_vertex_shader {
503 struct draw_vertex_shader base;
504
505 unsigned variant_key_size;
506 struct draw_llvm_variant_list_item variants;
507 unsigned variants_created;
508 unsigned variants_cached;
509 };
510
511 struct llvm_geometry_shader {
512 struct draw_geometry_shader base;
513
514 unsigned variant_key_size;
515 struct draw_gs_llvm_variant_list_item variants;
516 unsigned variants_created;
517 unsigned variants_cached;
518 };
519
520
521 struct draw_llvm {
522 struct draw_context *draw;
523
524 LLVMContextRef context;
525 boolean context_owned;
526
527 struct draw_jit_context jit_context;
528 struct draw_gs_jit_context gs_jit_context;
529
530 struct draw_llvm_variant_list_item vs_variants_list;
531 int nr_variants;
532
533 struct draw_gs_llvm_variant_list_item gs_variants_list;
534 int nr_gs_variants;
535 };
536
537
538 static inline struct llvm_vertex_shader *
539 llvm_vertex_shader(struct draw_vertex_shader *vs)
540 {
541 return (struct llvm_vertex_shader *)vs;
542 }
543
544 static inline struct llvm_geometry_shader *
545 llvm_geometry_shader(struct draw_geometry_shader *gs)
546 {
547 return (struct llvm_geometry_shader *)gs;
548 }
549
550
551
552
553 struct draw_llvm *
554 draw_llvm_create(struct draw_context *draw, LLVMContextRef llvm_context);
555
556 void
557 draw_llvm_destroy(struct draw_llvm *llvm);
558
559 struct draw_llvm_variant *
560 draw_llvm_create_variant(struct draw_llvm *llvm,
561 unsigned num_vertex_header_attribs,
562 const struct draw_llvm_variant_key *key);
563
564 void
565 draw_llvm_destroy_variant(struct draw_llvm_variant *variant);
566
567 struct draw_llvm_variant_key *
568 draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
569
570 void
571 draw_llvm_dump_variant_key(struct draw_llvm_variant_key *key);
572
573
574 struct draw_gs_llvm_variant *
575 draw_gs_llvm_create_variant(struct draw_llvm *llvm,
576 unsigned num_vertex_header_attribs,
577 const struct draw_gs_llvm_variant_key *key);
578
579 void
580 draw_gs_llvm_destroy_variant(struct draw_gs_llvm_variant *variant);
581
582 struct draw_gs_llvm_variant_key *
583 draw_gs_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
584
585 void
586 draw_gs_llvm_dump_variant_key(struct draw_gs_llvm_variant_key *key);
587
588 struct lp_build_sampler_soa *
589 draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state);
590
591 struct lp_build_image_soa *
592 draw_llvm_image_soa_create(const struct draw_image_static_state *static_state);
593
594 void
595 draw_llvm_set_sampler_state(struct draw_context *draw,
596 enum pipe_shader_type shader_stage);
597
598 void
599 draw_llvm_set_mapped_texture(struct draw_context *draw,
600 enum pipe_shader_type shader_stage,
601 unsigned sview_idx,
602 uint32_t width, uint32_t height, uint32_t depth,
603 uint32_t first_level, uint32_t last_level,
604 const void *base_ptr,
605 uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
606 uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
607 uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS]);
608
609 void
610 draw_llvm_set_mapped_image(struct draw_context *draw,
611 enum pipe_shader_type shader_stage,
612 unsigned idx,
613 uint32_t width, uint32_t height, uint32_t depth,
614 const void *base_ptr,
615 uint32_t row_stride,
616 uint32_t img_stride);
617 #endif