radv/ac: switch an if to switch
authorDave Airlie <airlied@redhat.com>
Mon, 16 Jan 2017 22:38:14 +0000 (08:38 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 17 Jan 2017 20:20:48 +0000 (06:20 +1000)
makes it easier to add other shader stages.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_nir_to_llvm.c

index 3173aa5..6d98fde 100644 (file)
@@ -4626,11 +4626,16 @@ void ac_compile_nir_shader(LLVMTargetMachineRef tm,
        /* +3 for scratch wave offset and VCC */
        config->num_sgprs = MAX2(config->num_sgprs,
                                 shader_info->num_input_sgprs + 3);
-       if (nir->stage == MESA_SHADER_COMPUTE) {
+
+       switch (nir->stage) {
+       case MESA_SHADER_COMPUTE:
                for (int i = 0; i < 3; ++i)
                        shader_info->cs.block_size[i] = nir->info->cs.local_size[i];
-       }
-
-       if (nir->stage == MESA_SHADER_FRAGMENT)
+               break;
+       case MESA_SHADER_FRAGMENT:
                shader_info->fs.early_fragment_test = nir->info->fs.early_fragment_tests;
+               break;
+       default:
+               break;
+       }
 }