gallivm: support avx512 (16x32) in interleave2_half
[mesa.git] / src / gallium / auxiliary / draw / draw_vs.c
index eb7f4e0967c32ffa8c3d773ca646df7027679794..415c4fa949aacb6d9080ce2782e952994d7bea36 100644 (file)
@@ -85,14 +85,12 @@ draw_create_vertex_shader(struct draw_context *draw,
                   vs->info.output_semantic_index[i] == 0) {
             found_clipvertex = TRUE;
             vs->clipvertex_output = i;
-         } else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
+         } else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_VIEWPORT_INDEX)
+            vs->viewport_index_output = i;
+         else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_CLIPDIST) {
             debug_assert(vs->info.output_semantic_index[i] <
                          PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
-            vs->clipdistance_output[vs->info.output_semantic_index[i]] = i;
-         } else if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_CULLDIST) {
-            debug_assert(vs->info.output_semantic_index[i] <
-                         PIPE_MAX_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT);
-            vs->culldistance_output[vs->info.output_semantic_index[i]] = i;
+            vs->ccdistance_output[vs->info.output_semantic_index[i]] = i;
          }
       }
       if (!found_clipvertex)
@@ -117,9 +115,11 @@ draw_bind_vertex_shader(struct draw_context *draw,
       draw->vs.position_output = dvs->position_output;
       draw->vs.edgeflag_output = dvs->edgeflag_output;
       draw->vs.clipvertex_output = dvs->clipvertex_output;
-      draw->vs.clipdistance_output[0] = dvs->clipdistance_output[0];
-      draw->vs.clipdistance_output[1] = dvs->clipdistance_output[1];
+      draw->vs.ccdistance_output[0] = dvs->ccdistance_output[0];
+      draw->vs.ccdistance_output[1] = dvs->ccdistance_output[1];
       dvs->prepare( dvs, draw );
+      draw_update_clip_flags(draw);
+      draw_update_viewport_flags(draw);
    }
    else {
       draw->vs.vertex_shader = NULL;
@@ -149,8 +149,8 @@ draw_vs_init( struct draw_context *draw )
 {
    draw->dump_vs = debug_get_option_gallium_dump_vs();
 
-   if (!draw_get_option_use_llvm()) {
-      draw->vs.tgsi.machine = tgsi_exec_machine_create();
+   if (!draw->llvm) {
+      draw->vs.tgsi.machine = tgsi_exec_machine_create(PIPE_SHADER_VERTEX);
       if (!draw->vs.tgsi.machine)
          return FALSE;
    }
@@ -175,7 +175,7 @@ draw_vs_destroy( struct draw_context *draw )
    if (draw->vs.emit_cache)
       translate_cache_destroy(draw->vs.emit_cache);
 
-   if (!draw_get_option_use_llvm())
+   if (!draw->llvm)
       tgsi_exec_machine_destroy(draw->vs.tgsi.machine);
 }
 
@@ -196,17 +196,17 @@ draw_vs_lookup_variant( struct draw_vertex_shader *vs,
    /* Else have to create a new one: 
     */
    variant = vs->create_variant( vs, key );
-   if (variant == NULL)
+   if (!variant)
       return NULL;
 
    /* Add it to our list, could be smarter: 
     */
-   if (vs->nr_variants < Elements(vs->variant)) {
+   if (vs->nr_variants < ARRAY_SIZE(vs->variant)) {
       vs->variant[vs->nr_variants++] = variant;
    }
    else {
       vs->last_variant++;
-      vs->last_variant %= Elements(vs->variant);
+      vs->last_variant %= ARRAY_SIZE(vs->variant);
       vs->variant[vs->last_variant]->destroy(vs->variant[vs->last_variant]);
       vs->variant[vs->last_variant] = variant;
    }