radeonsi: remove redundant GS variables in si_shader_selector
[mesa.git] / src / gallium / drivers / radeonsi / si_shader_llvm_gs.c
index f9cfbbba7bc2d1ae1f2fc978ae2e1f06c3896ec6..3bbb18019f3c5c3d4a47cf63dc923853528509b4 100644 (file)
@@ -49,12 +49,10 @@ static LLVMValueRef si_llvm_load_input_gs(struct ac_shader_abi *abi, unsigned in
    struct si_shader *shader = ctx->shader;
    LLVMValueRef vtx_offset, soffset;
    struct si_shader_info *info = &shader->selector->info;
-   unsigned semantic_name = info->input_semantic_name[input_index];
-   unsigned semantic_index = info->input_semantic_index[input_index];
    unsigned param;
    LLVMValueRef value;
 
-   param = si_shader_io_get_unique_index(semantic_name, semantic_index, false);
+   param = si_shader_io_get_unique_index(info->input_semantic[input_index], false);
 
    /* GFX9 has the ESGS ring in LDS. */
    if (ctx->screen->info.chip_class >= GFX9) {
@@ -200,12 +198,11 @@ void si_llvm_emit_es_epilogue(struct ac_shader_abi *abi, unsigned max_outputs, L
    for (i = 0; i < info->num_outputs; i++) {
       int param;
 
-      if (info->output_semantic_name[i] == TGSI_SEMANTIC_VIEWPORT_INDEX ||
-          info->output_semantic_name[i] == TGSI_SEMANTIC_LAYER)
+      if (info->output_semantic[i] == VARYING_SLOT_VIEWPORT ||
+          info->output_semantic[i] == VARYING_SLOT_LAYER)
          continue;
 
-      param = si_shader_io_get_unique_index(info->output_semantic_name[i],
-                                            info->output_semantic_index[i], false);
+      param = si_shader_io_get_unique_index(info->output_semantic[i], false);
 
       for (chan = 0; chan < 4; chan++) {
          if (!(info->output_usagemask[i] & (1 << chan)))
@@ -298,9 +295,9 @@ static void si_llvm_emit_vertex(struct ac_shader_abi *abi, unsigned stream, LLVM
     */
    can_emit =
       LLVMBuildICmp(ctx->ac.builder, LLVMIntULT, gs_next_vertex,
-                    LLVMConstInt(ctx->ac.i32, shader->selector->gs_max_out_vertices, 0), "");
+                    LLVMConstInt(ctx->ac.i32, shader->selector->info.base.gs.vertices_out, 0), "");
 
-   bool use_kill = !info->writes_memory;
+   bool use_kill = !info->base.writes_memory;
    if (use_kill) {
       ac_build_kill_if_false(&ctx->ac, can_emit);
    } else {
@@ -316,7 +313,7 @@ static void si_llvm_emit_vertex(struct ac_shader_abi *abi, unsigned stream, LLVM
 
          LLVMValueRef out_val = LLVMBuildLoad(ctx->ac.builder, addrs[4 * i + chan], "");
          LLVMValueRef voffset =
-            LLVMConstInt(ctx->ac.i32, offset * shader->selector->gs_max_out_vertices, 0);
+            LLVMConstInt(ctx->ac.i32, offset * shader->selector->info.base.gs.vertices_out, 0);
          offset++;
 
          voffset = LLVMBuildAdd(ctx->ac.builder, voffset, gs_next_vertex, "");
@@ -405,7 +402,7 @@ void si_preload_gs_rings(struct si_shader_context *ctx)
       if (!num_components)
          continue;
 
-      stride = 4 * num_components * sel->gs_max_out_vertices;
+      stride = 4 * num_components * sel->info.base.gs.vertices_out;
 
       /* Limit on the stride field for <= GFX7. */
       assert(stride < (1 << 14));
@@ -477,7 +474,6 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
                         si_get_wave_size(sscreen, MESA_SHADER_VERTEX,
                                          false, false, false, false));
    ctx.shader = shader;
-   ctx.type = PIPE_SHADER_VERTEX;
    ctx.stage = MESA_SHADER_VERTEX;
 
    builder = ctx.ac.builder;
@@ -501,8 +497,7 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
 
    /* Fill in output information. */
    for (i = 0; i < gsinfo->num_outputs; ++i) {
-      outputs[i].semantic_name = gsinfo->output_semantic_name[i];
-      outputs[i].semantic_index = gsinfo->output_semantic_index[i];
+      outputs[i].semantic = gsinfo->output_semantic[i];
 
       for (int chan = 0; chan < 4; chan++) {
          outputs[i].vertex_stream[chan] = (gsinfo->output_streams[i] >> (2 * chan)) & 3;
@@ -540,7 +535,7 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
             }
 
             LLVMValueRef soffset =
-               LLVMConstInt(ctx.ac.i32, offset * gs_selector->gs_max_out_vertices * 16 * 4, 0);
+               LLVMConstInt(ctx.ac.i32, offset * gs_selector->info.base.gs.vertices_out * 16 * 4, 0);
             offset++;
 
             outputs[i].values[chan] =
@@ -564,7 +559,6 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
 
    LLVMBuildRetVoid(ctx.ac.builder);
 
-   ctx.type = PIPE_SHADER_GEOMETRY; /* override for shader dumping */
    ctx.stage = MESA_SHADER_GEOMETRY; /* override for shader dumping */
    si_llvm_optimize_module(&ctx);