1 /**************************************************************************
3 * Copyright 2020 Red Hat.
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
17 * OR 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 FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 **************************************************************************/
25 #include "draw_tess.h"
27 #include "draw_llvm.h"
30 #include "tessellator/p_tessellator.h"
31 #include "nir/nir_to_tgsi_info.h"
32 #include "util/u_prim.h"
33 #include "util/u_math.h"
34 #include "util/u_memory.h"
35 #include "util/ralloc.h"
37 draw_tes_get_input_index(int semantic
, int index
,
38 const struct tgsi_shader_info
*input_info
)
41 const ubyte
*input_semantic_names
= input_info
->output_semantic_name
;
42 const ubyte
*input_semantic_indices
= input_info
->output_semantic_index
;
43 for (i
= 0; i
< PIPE_MAX_SHADER_OUTPUTS
; i
++) {
44 if (input_semantic_names
[i
] == semantic
&&
45 input_semantic_indices
[i
] == index
)
52 #define DEBUG_INPUTS 0
54 llvm_fetch_tcs_input(struct draw_tess_ctrl_shader
*shader
,
55 const struct draw_prim_info
*input_prim_info
,
57 unsigned num_vertices
)
59 const float (*input_ptr
)[4];
60 float (*input_data
)[32][NUM_TCS_INPUTS
][TGSI_NUM_CHANNELS
] = &shader
->tcs_input
->data
;
63 unsigned input_vertex_stride
= shader
->input_vertex_stride
;
65 input_ptr
= shader
->input
;
66 for (i
= 0; i
< num_vertices
; i
++) {
67 const float (*input
)[4];
68 int vertex_idx
= prim_id
* num_vertices
+ i
;
69 if (input_prim_info
->linear
== FALSE
)
70 vertex_idx
= input_prim_info
->elts
[vertex_idx
];
72 debug_printf("%d) tcs vertex index = %d (prim idx = %d)\n",
75 input
= (const float (*)[4])((const char *)input_ptr
+ (vertex_idx
* input_vertex_stride
));
76 for (slot
= 0, vs_slot
= 0; slot
< shader
->info
.num_inputs
; ++slot
) {
77 vs_slot
= draw_tes_get_input_index(
78 shader
->info
.input_semantic_name
[slot
],
79 shader
->info
.input_semantic_index
[slot
],
82 debug_printf("VS/TCS signature mismatch!\n");
83 (*input_data
)[i
][slot
][0] = 0;
84 (*input_data
)[i
][slot
][1] = 0;
85 (*input_data
)[i
][slot
][2] = 0;
86 (*input_data
)[i
][slot
][3] = 0;
88 (*input_data
)[i
][slot
][0] = input
[vs_slot
][0];
89 (*input_data
)[i
][slot
][1] = input
[vs_slot
][1];
90 (*input_data
)[i
][slot
][2] = input
[vs_slot
][2];
91 (*input_data
)[i
][slot
][3] = input
[vs_slot
][3];
93 debug_printf("\t\t%p = %f %f %f %f\n", &(*input_data
)[i
][slot
][0],
94 (*input_data
)[i
][slot
][0],
95 (*input_data
)[i
][slot
][1],
96 (*input_data
)[i
][slot
][2],
97 (*input_data
)[i
][slot
][3]);
105 #define DEBUG_OUTPUTS 0
107 llvm_store_tcs_output(struct draw_tess_ctrl_shader
*shader
,
109 struct draw_vertex_info
*output_verts
,
112 float (*output_ptr
)[4];
113 float (*output_data
)[32][PIPE_MAX_SHADER_INPUTS
][TGSI_NUM_CHANNELS
] = &shader
->tcs_output
->data
;
115 unsigned num_vertices
= shader
->vertices_out
;
117 char *output
= (char *)output_verts
->verts
->data
;
118 output
+= vert_start
* output_verts
->stride
;
120 for (i
= 0; i
< num_vertices
; i
++) {
123 debug_printf("%d) tcs store vertex index = %d (prim idx = %d)\n",
126 output_ptr
= (float(*)[4])(output
+ (i
* output_verts
->stride
));
128 for (slot
= 0; slot
< shader
->info
.num_outputs
; ++slot
) {
129 output_ptr
[slot
][0] = (*output_data
)[i
][slot
][0];
130 output_ptr
[slot
][1] = (*output_data
)[i
][slot
][1];
131 output_ptr
[slot
][2] = (*output_data
)[i
][slot
][2];
132 output_ptr
[slot
][3] = (*output_data
)[i
][slot
][3];
134 debug_printf("\t\t%p = %f %f %f %f\n",
135 &output_ptr
[slot
][0],
139 output_ptr
[slot
][3]);
146 llvm_tcs_run(struct draw_tess_ctrl_shader
*shader
, uint32_t prim_id
)
148 shader
->current_variant
->jit_func(shader
->jit_context
, shader
->tcs_input
->data
, shader
->tcs_output
->data
, prim_id
,
149 shader
->draw
->pt
.vertices_per_patch
);
154 * Execute tess ctrl shader.
156 int draw_tess_ctrl_shader_run(struct draw_tess_ctrl_shader
*shader
,
157 const void *constants
[PIPE_MAX_CONSTANT_BUFFERS
],
158 const unsigned constants_size
[PIPE_MAX_CONSTANT_BUFFERS
],
159 const struct draw_vertex_info
*input_verts
,
160 const struct draw_prim_info
*input_prim
,
161 const struct tgsi_shader_info
*input_info
,
162 struct draw_vertex_info
*output_verts
,
163 struct draw_prim_info
*output_prims
)
165 const float (*input
)[4] = (const float (*)[4])input_verts
->verts
->data
;
166 unsigned num_outputs
= draw_total_tcs_outputs(shader
->draw
);
167 unsigned input_stride
= input_verts
->vertex_size
;
168 unsigned vertex_size
= sizeof(struct vertex_header
) + num_outputs
* 4 * sizeof(float);
169 unsigned num_patches
= input_prim
->count
/ shader
->draw
->pt
.vertices_per_patch
;
171 output_verts
->vertex_size
= vertex_size
;
172 output_verts
->stride
= output_verts
->vertex_size
;
173 output_verts
->verts
= NULL
;
174 output_verts
->count
= 0;
175 shader
->input
= input
;
176 shader
->input_vertex_stride
= input_stride
;
177 shader
->input_info
= input_info
;
179 output_prims
->linear
= TRUE
;
180 output_prims
->start
= 0;
181 output_prims
->elts
= NULL
;
182 output_prims
->count
= 0;
183 output_prims
->prim
= PIPE_PRIM_PATCHES
;
184 output_prims
->flags
= 0;
185 output_prims
->primitive_lengths
= NULL
;
186 output_prims
->primitive_count
= 0;
188 if (shader
->draw
->collect_statistics
) {
189 shader
->draw
->statistics
.hs_invocations
+= num_patches
;
191 #ifdef LLVM_AVAILABLE
192 for (unsigned i
= 0; i
< num_patches
; i
++) {
193 uint32_t vert_start
= output_verts
->count
;
195 output_verts
->count
+= shader
->vertices_out
;
197 llvm_fetch_tcs_input(shader
, input_prim
, i
, shader
->draw
->pt
.vertices_per_patch
);
199 llvm_tcs_run(shader
, i
);
201 uint32_t old_verts
= util_align_npot(vert_start
, 16);
202 uint32_t new_verts
= util_align_npot(output_verts
->count
, 16);
203 uint32_t old_size
= output_verts
->vertex_size
* old_verts
;
204 uint32_t new_size
= output_verts
->vertex_size
* new_verts
;
205 output_verts
->verts
= REALLOC(output_verts
->verts
, old_size
, new_size
);
207 llvm_store_tcs_output(shader
, i
, output_verts
, vert_start
);
211 output_prims
->primitive_count
= num_patches
;
215 #ifdef LLVM_AVAILABLE
216 #define DEBUG_INPUTS 0
218 llvm_fetch_tes_input(struct draw_tess_eval_shader
*shader
,
219 const struct draw_prim_info
*input_prim_info
,
221 unsigned num_vertices
)
223 const float (*input_ptr
)[4];
224 float (*input_data
)[32][PIPE_MAX_SHADER_INPUTS
][TGSI_NUM_CHANNELS
] = &shader
->tes_input
->data
;
227 unsigned input_vertex_stride
= shader
->input_vertex_stride
;
229 input_ptr
= shader
->input
;
230 for (i
= 0; i
< num_vertices
; i
++) {
231 const float (*input
)[4];
232 int vertex_idx
= prim_id
* num_vertices
+ i
;
234 if (input_prim_info
->linear
== FALSE
)
235 vertex_idx
= input_prim_info
->elts
[vertex_idx
];
237 debug_printf("%d) tes vertex index = %d (prim idx = %d)\n",
240 input
= (const float (*)[4])((const char *)input_ptr
+ (vertex_idx
* input_vertex_stride
));
241 for (slot
= 0, vs_slot
= 0; slot
< shader
->info
.num_inputs
; ++slot
) {
242 vs_slot
= draw_tes_get_input_index(
243 shader
->info
.input_semantic_name
[slot
],
244 shader
->info
.input_semantic_index
[slot
],
247 debug_printf("TCS/TES signature mismatch!\n");
248 (*input_data
)[i
][slot
][0] = 0;
249 (*input_data
)[i
][slot
][1] = 0;
250 (*input_data
)[i
][slot
][2] = 0;
251 (*input_data
)[i
][slot
][3] = 0;
253 (*input_data
)[i
][slot
][0] = input
[vs_slot
][0];
254 (*input_data
)[i
][slot
][1] = input
[vs_slot
][1];
255 (*input_data
)[i
][slot
][2] = input
[vs_slot
][2];
256 (*input_data
)[i
][slot
][3] = input
[vs_slot
][3];
258 debug_printf("\t\t%p = %f %f %f %f\n",
260 (*input_data
)[i
][slot
][0],
261 (*input_data
)[i
][slot
][1],
262 (*input_data
)[i
][slot
][2],
263 (*input_data
)[i
][slot
][3]);
272 llvm_fetch_tess_factors(struct draw_tess_eval_shader
*shader
,
274 unsigned num_vertices
,
275 struct pipe_tessellation_factors
*factors
)
277 int outer_slot
= draw_tes_get_input_index(
278 TGSI_SEMANTIC_TESSOUTER
, 0, shader
->input_info
);
279 int inner_slot
= draw_tes_get_input_index(
280 TGSI_SEMANTIC_TESSINNER
, 0, shader
->input_info
);
281 const float (*input_ptr
)[4];
282 const float (*input
)[4];
283 input_ptr
= shader
->input
;
284 input
= (const float (*)[4])((const char *)input_ptr
+ ((patch_id
* num_vertices
) * shader
->input_vertex_stride
));
286 if (outer_slot
!= -1) {
287 for (unsigned i
= 0; i
< 4; i
++)
288 factors
->outer_tf
[i
] = input
[outer_slot
][i
];
290 for (unsigned i
= 0; i
< 4; i
++)
291 factors
->outer_tf
[i
] = shader
->draw
->default_outer_tess_level
[i
];
293 if (inner_slot
!= -1) {
294 for (unsigned i
= 0; i
< 2; i
++)
295 factors
->inner_tf
[i
] = input
[inner_slot
][i
];
297 for (unsigned i
= 0; i
< 2; i
++)
298 factors
->inner_tf
[i
] = shader
->draw
->default_inner_tess_level
[i
];
303 llvm_tes_run(struct draw_tess_eval_shader
*shader
,
305 uint32_t patch_vertices_in
,
306 struct pipe_tessellator_data
*tess_data
,
307 struct pipe_tessellation_factors
*tess_factors
,
308 struct vertex_header
*output
)
310 shader
->current_variant
->jit_func(shader
->jit_context
, shader
->tes_input
->data
, output
, prim_id
,
311 tess_data
->num_domain_points
, tess_data
->domain_points_u
, tess_data
->domain_points_v
,
312 tess_factors
->outer_tf
, tess_factors
->inner_tf
, patch_vertices_in
);
317 * Execute tess eval shader.
319 int draw_tess_eval_shader_run(struct draw_tess_eval_shader
*shader
,
320 const void *constants
[PIPE_MAX_CONSTANT_BUFFERS
],
321 const unsigned constants_size
[PIPE_MAX_CONSTANT_BUFFERS
],
322 unsigned num_input_vertices_per_patch
,
323 const struct draw_vertex_info
*input_verts
,
324 const struct draw_prim_info
*input_prim
,
325 const struct tgsi_shader_info
*input_info
,
326 struct draw_vertex_info
*output_verts
,
327 struct draw_prim_info
*output_prims
,
330 const float (*input
)[4] = (const float (*)[4])input_verts
->verts
->data
;
331 unsigned num_outputs
= draw_total_tes_outputs(shader
->draw
);
332 unsigned input_stride
= input_verts
->vertex_size
;
333 unsigned vertex_size
= sizeof(struct vertex_header
) + num_outputs
* 4 * sizeof(float);
335 output_verts
->vertex_size
= vertex_size
;
336 output_verts
->stride
= output_verts
->vertex_size
;
337 output_verts
->count
= 0;
338 output_verts
->verts
= NULL
;
340 output_prims
->linear
= FALSE
;
341 output_prims
->start
= 0;
342 output_prims
->elts
= NULL
;
343 output_prims
->count
= 0;
344 output_prims
->prim
= get_tes_output_prim(shader
);
345 output_prims
->flags
= 0;
346 output_prims
->primitive_lengths
= NULL
;
347 output_prims
->primitive_count
= 0;
349 shader
->input
= input
;
350 shader
->input_vertex_stride
= input_stride
;
351 shader
->input_info
= input_info
;
353 if (shader
->draw
->collect_statistics
) {
354 shader
->draw
->statistics
.ds_invocations
+= input_prim
->primitive_count
;
356 #ifdef LLVM_AVAILABLE
357 struct pipe_tessellation_factors factors
;
358 struct pipe_tessellator_data data
= { 0 };
359 struct pipe_tessellator
*ptess
= p_tess_init(shader
->prim_mode
,
361 !shader
->vertex_order_cw
,
363 for (unsigned i
= 0; i
< input_prim
->primitive_count
; i
++) {
364 uint32_t vert_start
= output_verts
->count
;
365 uint32_t prim_start
= output_prims
->primitive_count
;
366 uint32_t elt_start
= output_prims
->count
;
368 llvm_fetch_tess_factors(shader
, i
, num_input_vertices_per_patch
, &factors
);
370 /* tessellate with the factors for this primitive */
371 p_tessellate(ptess
, &factors
, &data
);
373 if (data
.num_domain_points
== 0)
376 uint32_t old_verts
= vert_start
;
377 uint32_t new_verts
= vert_start
+ util_align_npot(data
.num_domain_points
, 4);
378 uint32_t old_size
= output_verts
->vertex_size
* old_verts
;
379 uint32_t new_size
= output_verts
->vertex_size
* new_verts
;
380 output_verts
->verts
= REALLOC(output_verts
->verts
, old_size
, new_size
);
382 output_verts
->count
+= data
.num_domain_points
;
384 output_prims
->count
+= data
.num_indices
;
385 elts
= REALLOC(elts
, elt_start
* sizeof(uint16_t),
386 output_prims
->count
* sizeof(uint16_t));
388 for (unsigned i
= 0; i
< data
.num_indices
; i
++)
389 elts
[elt_start
+ i
] = vert_start
+ data
.indices
[i
];
391 llvm_fetch_tes_input(shader
, input_prim
, i
, num_input_vertices_per_patch
);
392 /* run once per primitive? */
393 char *output
= (char *)output_verts
->verts
;
394 output
+= vert_start
* vertex_size
;
395 llvm_tes_run(shader
, i
, num_input_vertices_per_patch
, &data
, &factors
, (struct vertex_header
*)output
);
397 uint32_t prim_len
= u_prim_vertex_count(output_prims
->prim
)->min
;
398 output_prims
->primitive_count
+= data
.num_indices
/ prim_len
;
399 output_prims
->primitive_lengths
= REALLOC(output_prims
->primitive_lengths
, prim_start
* sizeof(uint32_t),
400 output_prims
->primitive_count
* sizeof(uint32_t));
401 for (unsigned i
= prim_start
; i
< output_prims
->primitive_count
; i
++) {
402 output_prims
->primitive_lengths
[i
] = prim_len
;
405 p_tess_destroy(ptess
);
409 output_prims
->elts
= elts
;
413 struct draw_tess_ctrl_shader
*
414 draw_create_tess_ctrl_shader(struct draw_context
*draw
,
415 const struct pipe_shader_state
*state
)
417 #ifdef LLVM_AVAILABLE
418 boolean use_llvm
= draw
->llvm
!= NULL
;
419 struct llvm_tess_ctrl_shader
*llvm_tcs
= NULL
;
421 struct draw_tess_ctrl_shader
*tcs
;
423 #ifdef LLVM_AVAILABLE
425 llvm_tcs
= CALLOC_STRUCT(llvm_tess_ctrl_shader
);
430 tcs
= &llvm_tcs
->base
;
432 make_empty_list(&llvm_tcs
->variants
);
436 tcs
= CALLOC_STRUCT(draw_tess_ctrl_shader
);
445 nir_tgsi_scan_shader(state
->ir
.nir
, &tcs
->info
, true);
447 tcs
->vector_length
= 4;
448 tcs
->vertices_out
= tcs
->info
.properties
[TGSI_PROPERTY_TCS_VERTICES_OUT
];
449 #ifdef LLVM_AVAILABLE
452 tcs
->tcs_input
= align_malloc(sizeof(struct draw_tcs_inputs
), 16);
453 memset(tcs
->tcs_input
, 0, sizeof(struct draw_tcs_inputs
));
455 tcs
->tcs_output
= align_malloc(sizeof(struct draw_tcs_outputs
), 16);
456 memset(tcs
->tcs_output
, 0, sizeof(struct draw_tcs_outputs
));
458 tcs
->jit_context
= &draw
->llvm
->tcs_jit_context
;
459 llvm_tcs
->variant_key_size
=
460 draw_tcs_llvm_variant_key_size(
461 MAX2(tcs
->info
.file_max
[TGSI_FILE_SAMPLER
]+1,
462 tcs
->info
.file_max
[TGSI_FILE_SAMPLER_VIEW
]+1),
463 tcs
->info
.file_max
[TGSI_FILE_IMAGE
]+1);
469 void draw_bind_tess_ctrl_shader(struct draw_context
*draw
,
470 struct draw_tess_ctrl_shader
*dtcs
)
472 draw_do_flush(draw
, DRAW_FLUSH_STATE_CHANGE
);
474 draw
->tcs
.tess_ctrl_shader
= dtcs
;
476 draw
->tcs
.tess_ctrl_shader
= NULL
;
480 void draw_delete_tess_ctrl_shader(struct draw_context
*draw
,
481 struct draw_tess_ctrl_shader
*dtcs
)
486 #ifdef LLVM_AVAILABLE
488 struct llvm_tess_ctrl_shader
*shader
= llvm_tess_ctrl_shader(dtcs
);
490 struct draw_tcs_llvm_variant_list_item
*li
;
492 li
= first_elem(&shader
->variants
);
493 while(!at_end(&shader
->variants
, li
)) {
494 struct draw_tcs_llvm_variant_list_item
*next
= next_elem(li
);
495 draw_tcs_llvm_destroy_variant(li
->base
);
499 assert(shader
->variants_cached
== 0);
500 align_free(dtcs
->tcs_input
);
501 align_free(dtcs
->tcs_output
);
505 if (dtcs
->state
.ir
.nir
)
506 ralloc_free(dtcs
->state
.ir
.nir
);
510 #ifdef LLVM_AVAILABLE
511 void draw_tcs_set_current_variant(struct draw_tess_ctrl_shader
*shader
,
512 struct draw_tcs_llvm_variant
*variant
)
514 shader
->current_variant
= variant
;
518 struct draw_tess_eval_shader
*
519 draw_create_tess_eval_shader(struct draw_context
*draw
,
520 const struct pipe_shader_state
*state
)
522 #ifdef LLVM_AVAILABLE
523 boolean use_llvm
= draw
->llvm
!= NULL
;
524 struct llvm_tess_eval_shader
*llvm_tes
= NULL
;
526 struct draw_tess_eval_shader
*tes
;
528 #ifdef LLVM_AVAILABLE
530 llvm_tes
= CALLOC_STRUCT(llvm_tess_eval_shader
);
535 tes
= &llvm_tes
->base
;
536 make_empty_list(&llvm_tes
->variants
);
540 tes
= CALLOC_STRUCT(draw_tess_eval_shader
);
549 nir_tgsi_scan_shader(state
->ir
.nir
, &tes
->info
, true);
551 tes
->prim_mode
= tes
->info
.properties
[TGSI_PROPERTY_TES_PRIM_MODE
];
552 tes
->spacing
= tes
->info
.properties
[TGSI_PROPERTY_TES_SPACING
];
553 tes
->vertex_order_cw
= tes
->info
.properties
[TGSI_PROPERTY_TES_VERTEX_ORDER_CW
];
554 tes
->point_mode
= tes
->info
.properties
[TGSI_PROPERTY_TES_POINT_MODE
];
556 tes
->vector_length
= 4;
558 tes
->position_output
= -1;
559 for (unsigned i
= 0; i
< tes
->info
.num_outputs
; i
++) {
560 if (tes
->info
.output_semantic_name
[i
] == TGSI_SEMANTIC_POSITION
&&
561 tes
->info
.output_semantic_index
[i
] == 0)
562 tes
->position_output
= i
;
563 if (tes
->info
.output_semantic_name
[i
] == TGSI_SEMANTIC_VIEWPORT_INDEX
)
564 tes
->viewport_index_output
= i
;
565 if (tes
->info
.output_semantic_name
[i
] == TGSI_SEMANTIC_CLIPDIST
) {
566 debug_assert(tes
->info
.output_semantic_index
[i
] <
567 PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT
);
568 tes
->ccdistance_output
[tes
->info
.output_semantic_index
[i
]] = i
;
572 #ifdef LLVM_AVAILABLE
575 tes
->tes_input
= align_malloc(sizeof(struct draw_tes_inputs
), 16);
576 memset(tes
->tes_input
, 0, sizeof(struct draw_tes_inputs
));
578 tes
->jit_context
= &draw
->llvm
->tes_jit_context
;
579 llvm_tes
->variant_key_size
=
580 draw_tes_llvm_variant_key_size(
581 MAX2(tes
->info
.file_max
[TGSI_FILE_SAMPLER
]+1,
582 tes
->info
.file_max
[TGSI_FILE_SAMPLER_VIEW
]+1),
583 tes
->info
.file_max
[TGSI_FILE_IMAGE
]+1);
589 void draw_bind_tess_eval_shader(struct draw_context
*draw
,
590 struct draw_tess_eval_shader
*dtes
)
592 draw_do_flush(draw
, DRAW_FLUSH_STATE_CHANGE
);
594 draw
->tes
.tess_eval_shader
= dtes
;
595 draw
->tes
.position_output
= dtes
->position_output
;
597 draw
->tes
.tess_eval_shader
= NULL
;
601 void draw_delete_tess_eval_shader(struct draw_context
*draw
,
602 struct draw_tess_eval_shader
*dtes
)
607 #ifdef LLVM_AVAILABLE
609 struct llvm_tess_eval_shader
*shader
= llvm_tess_eval_shader(dtes
);
610 struct draw_tes_llvm_variant_list_item
*li
;
612 li
= first_elem(&shader
->variants
);
613 while(!at_end(&shader
->variants
, li
)) {
614 struct draw_tes_llvm_variant_list_item
*next
= next_elem(li
);
615 draw_tes_llvm_destroy_variant(li
->base
);
619 assert(shader
->variants_cached
== 0);
620 align_free(dtes
->tes_input
);
623 if (dtes
->state
.ir
.nir
)
624 ralloc_free(dtes
->state
.ir
.nir
);
628 #ifdef LLVM_AVAILABLE
629 void draw_tes_set_current_variant(struct draw_tess_eval_shader
*shader
,
630 struct draw_tes_llvm_variant
*variant
)
632 shader
->current_variant
= variant
;
636 enum pipe_prim_type
get_tes_output_prim(struct draw_tess_eval_shader
*shader
)
638 if (shader
->point_mode
)
639 return PIPE_PRIM_POINTS
;
640 else if (shader
->prim_mode
== PIPE_PRIM_LINES
)
641 return PIPE_PRIM_LINES
;
643 return PIPE_PRIM_TRIANGLES
;