radv: move ac_fill_shader_info() to radv_nir_shader_info_pass()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Samuel Pitoiset 2019-09-03 17:48:07 +02:00
parent 83499ac765
commit b16cf6c4c6
2 changed files with 38 additions and 45 deletions

View File

@ -4498,48 +4498,6 @@ static void ac_compile_llvm_module(struct ac_llvm_compiler *ac_llvm,
free(elf_buffer);
}
static void
ac_fill_shader_info(struct radv_shader_info *shader_info, struct nir_shader *nir, const struct radv_nir_compiler_options *options)
{
switch (nir->info.stage) {
case MESA_SHADER_COMPUTE:
for (int i = 0; i < 3; ++i)
shader_info->cs.block_size[i] = nir->info.cs.local_size[i];
break;
case MESA_SHADER_FRAGMENT:
shader_info->ps.can_discard = nir->info.fs.uses_discard;
shader_info->ps.early_fragment_test = nir->info.fs.early_fragment_tests;
shader_info->ps.post_depth_coverage = nir->info.fs.post_depth_coverage;
break;
case MESA_SHADER_GEOMETRY:
shader_info->gs.vertices_in = nir->info.gs.vertices_in;
shader_info->gs.vertices_out = nir->info.gs.vertices_out;
shader_info->gs.output_prim = nir->info.gs.output_primitive;
shader_info->gs.invocations = nir->info.gs.invocations;
break;
case MESA_SHADER_TESS_EVAL:
shader_info->tes.primitive_mode = nir->info.tess.primitive_mode;
shader_info->tes.spacing = nir->info.tess.spacing;
shader_info->tes.ccw = nir->info.tess.ccw;
shader_info->tes.point_mode = nir->info.tess.point_mode;
shader_info->tes.as_es = options->key.vs_common_out.as_es;
shader_info->tes.export_prim_id = options->key.vs_common_out.export_prim_id;
shader_info->is_ngg = options->key.vs_common_out.as_ngg;
break;
case MESA_SHADER_TESS_CTRL:
shader_info->tcs.tcs_vertices_out = nir->info.tess.tcs_vertices_out;
break;
case MESA_SHADER_VERTEX:
shader_info->vs.as_es = options->key.vs_common_out.as_es;
shader_info->vs.as_ls = options->key.vs_common_out.as_ls;
shader_info->vs.export_prim_id = options->key.vs_common_out.export_prim_id;
shader_info->is_ngg = options->key.vs_common_out.as_ngg;
break;
default:
break;
}
}
void
radv_compile_nir_shader(struct ac_llvm_compiler *ac_llvm,
struct radv_shader_binary **rbinary,
@ -4560,9 +4518,6 @@ radv_compile_nir_shader(struct ac_llvm_compiler *ac_llvm,
nir[nir_count - 1]->info.stage),
options);
for (int i = 0; i < nir_count; ++i)
ac_fill_shader_info(shader_info, nir[i], options);
/* Determine the ES type (VS or TES) for the GS on GFX9. */
if (options->chip_class >= GFX9) {
if (nir_count == 2 &&

View File

@ -638,4 +638,42 @@ radv_nir_shader_info_pass(const struct nir_shader *nir,
if (nir->info.stage == MESA_SHADER_FRAGMENT)
info->ps.num_interp = nir->num_inputs;
switch (nir->info.stage) {
case MESA_SHADER_COMPUTE:
for (int i = 0; i < 3; ++i)
info->cs.block_size[i] = nir->info.cs.local_size[i];
break;
case MESA_SHADER_FRAGMENT:
info->ps.can_discard = nir->info.fs.uses_discard;
info->ps.early_fragment_test = nir->info.fs.early_fragment_tests;
info->ps.post_depth_coverage = nir->info.fs.post_depth_coverage;
break;
case MESA_SHADER_GEOMETRY:
info->gs.vertices_in = nir->info.gs.vertices_in;
info->gs.vertices_out = nir->info.gs.vertices_out;
info->gs.output_prim = nir->info.gs.output_primitive;
info->gs.invocations = nir->info.gs.invocations;
break;
case MESA_SHADER_TESS_EVAL:
info->tes.primitive_mode = nir->info.tess.primitive_mode;
info->tes.spacing = nir->info.tess.spacing;
info->tes.ccw = nir->info.tess.ccw;
info->tes.point_mode = nir->info.tess.point_mode;
info->tes.as_es = options->key.vs_common_out.as_es;
info->tes.export_prim_id = options->key.vs_common_out.export_prim_id;
info->is_ngg = options->key.vs_common_out.as_ngg;
break;
case MESA_SHADER_TESS_CTRL:
info->tcs.tcs_vertices_out = nir->info.tess.tcs_vertices_out;
break;
case MESA_SHADER_VERTEX:
info->vs.as_es = options->key.vs_common_out.as_es;
info->vs.as_ls = options->key.vs_common_out.as_ls;
info->vs.export_prim_id = options->key.vs_common_out.export_prim_id;
info->is_ngg = options->key.vs_common_out.as_ngg;
break;
default:
break;
}
}