diff options
author | Grazvydas Ignotas <[email protected]> | 2017-06-07 01:55:26 +0300 |
---|---|---|
committer | Grazvydas Ignotas <[email protected]> | 2017-06-08 00:02:26 +0300 |
commit | 7dfa54399cd42715f29821bb0c2ac3b58394e37c (patch) | |
tree | 45dc394fd8e7c4dbe5ed3bc2bb894afe54e7c21c /src/amd | |
parent | ae3262c1f2a287f59d654d44161177d15c2ceb3c (diff) |
ac/nir: convert several ifs to a switch
Also solve "outinfo may be used uninitialized" warning by putting in an
unreachable().
Signed-off-by: Grazvydas Ignotas <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 02281904f80..42be6de99c9 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -5760,23 +5760,25 @@ ac_nir_eliminate_const_vs_outputs(struct nir_to_llvm_context *ctx) { struct ac_vs_output_info *outinfo; - if (ctx->stage == MESA_SHADER_FRAGMENT || - ctx->stage == MESA_SHADER_COMPUTE || - ctx->stage == MESA_SHADER_TESS_CTRL || - ctx->stage == MESA_SHADER_GEOMETRY) + switch (ctx->stage) { + case MESA_SHADER_FRAGMENT: + case MESA_SHADER_COMPUTE: + case MESA_SHADER_TESS_CTRL: + case MESA_SHADER_GEOMETRY: return; - - if (ctx->stage == MESA_SHADER_VERTEX) { + case MESA_SHADER_VERTEX: if (ctx->options->key.vs.as_ls || ctx->options->key.vs.as_es) return; outinfo = &ctx->shader_info->vs.outinfo; - } - - if (ctx->stage == MESA_SHADER_TESS_EVAL) { + break; + case MESA_SHADER_TESS_EVAL: if (ctx->options->key.vs.as_es) return; outinfo = &ctx->shader_info->tes.outinfo; + break; + default: + unreachable("Unhandled shader type"); } ac_optimize_vs_outputs(&ctx->ac, |