From: Samuel Pitoiset Date: Tue, 3 Sep 2019 15:55:02 +0000 (+0200) Subject: radv: gather clip/cull distances in the shader info pass X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a99d2d5564fbb817d8a3fc4c5f6a551c8659b453;p=mesa.git radv: gather clip/cull distances in the shader info pass Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index dd31b848961..9574330a4da 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -2277,27 +2277,6 @@ scan_shader_output_decl(struct radv_shader_context *ctx, } mask_attribs = ((1ull << attrib_count) - 1) << idx; - if (stage == MESA_SHADER_VERTEX || - stage == MESA_SHADER_TESS_EVAL || - stage == MESA_SHADER_GEOMETRY) { - if (idx == VARYING_SLOT_CLIP_DIST0) { - if (stage == MESA_SHADER_VERTEX) { - ctx->shader_info->vs.outinfo.clip_dist_mask = (1 << shader->info.clip_distance_array_size) - 1; - ctx->shader_info->vs.outinfo.cull_dist_mask = (1 << shader->info.cull_distance_array_size) - 1; - ctx->shader_info->vs.outinfo.cull_dist_mask <<= shader->info.clip_distance_array_size; - } - if (stage == MESA_SHADER_TESS_EVAL) { - ctx->shader_info->tes.outinfo.clip_dist_mask = (1 << shader->info.clip_distance_array_size) - 1; - ctx->shader_info->tes.outinfo.cull_dist_mask = (1 << shader->info.cull_distance_array_size) - 1; - ctx->shader_info->tes.outinfo.cull_dist_mask <<= shader->info.clip_distance_array_size; - } - if (stage == MESA_SHADER_GEOMETRY) { - ctx->shader_info->vs.outinfo.clip_dist_mask = (1 << shader->info.clip_distance_array_size) - 1; - ctx->shader_info->vs.outinfo.cull_dist_mask = (1 << shader->info.cull_distance_array_size) - 1; - ctx->shader_info->vs.outinfo.cull_dist_mask <<= shader->info.clip_distance_array_size; - } - } - } ctx->output_mask |= mask_attribs; } diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index 33ee0727373..d639980e56a 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -533,20 +533,45 @@ gather_info_output_decl(const nir_shader *nir, const nir_variable *var, struct radv_shader_info *info, const struct radv_nir_compiler_options *options) { + struct radv_vs_output_info *vs_info = NULL; + switch (nir->info.stage) { case MESA_SHADER_FRAGMENT: gather_info_output_decl_ps(nir, var, info); break; case MESA_SHADER_VERTEX: + if (!options->key.vs_common_out.as_ls && + !options->key.vs_common_out.as_es) + vs_info = &info->vs.outinfo; + if (options->key.vs_common_out.as_ls) gather_info_output_decl_ls(nir, var, info); break; case MESA_SHADER_GEOMETRY: + vs_info = &info->vs.outinfo; gather_info_output_decl_gs(nir, var, info); break; + case MESA_SHADER_TESS_EVAL: + if (!options->key.vs_common_out.as_es) + vs_info = &info->tes.outinfo; + break; default: break; } + + if (vs_info) { + switch (var->data.location) { + case VARYING_SLOT_CLIP_DIST0: + vs_info->clip_dist_mask = + (1 << nir->info.clip_distance_array_size) - 1; + vs_info->cull_dist_mask = + (1 << nir->info.cull_distance_array_size) - 1; + vs_info->cull_dist_mask <<= nir->info.clip_distance_array_size; + break; + default: + break; + } + } } static void