radv: do not add extra SGPR when push constants are not used
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 18 Dec 2017 18:38:58 +0000 (19:38 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 19 Dec 2017 20:22:18 +0000 (21:22 +0100)
This is not because the vertex stage needs some push constants
that other stages need them too. This should reduce the number
of loaded SGPRs in some situations.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_shader_info.c

index 6aadb5032e27a2fa2eb8417e0848e851614bf2a1..ab5388fb53f588f7eed591ac858dae2c00bfc7a2 100644 (file)
@@ -149,7 +149,8 @@ ac_nir_shader_info_pass(struct nir_shader *nir,
        struct nir_function *func = (struct nir_function *)exec_list_get_head(&nir->functions);
 
        info->needs_push_constants = false;
-       if (options->layout->push_constant_size ||
+       if ((options->layout->push_constant_size &&
+            options->layout->push_constant_stages & (1 << nir->info.stage)) ||
            options->layout->dynamic_offset_count)
                info->needs_push_constants = true;