summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2016-11-28 03:15:30 +0000
committerDave Airlie <[email protected]>2016-12-07 23:26:19 +0000
commitc7dc1b010ae581f532240b661cb3d1c82e117e7e (patch)
tree82bee407dee2c4ed525fbc6bea404fe392ecb87a /src/amd
parentdfef9c7c1fcf0070784d1a19386d885bb1b3f511 (diff)
radv: make push constants optional
We don't set the push constants slot up unless something will cause us to need it. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 5c59d472b20..f6449805c0d 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -461,6 +461,14 @@ static void create_function(struct nir_to_llvm_context *ctx,
unsigned i;
unsigned num_sets = ctx->options->layout ? ctx->options->layout->num_sets : 0;
unsigned user_sgpr_idx;
+ bool need_push_constants;
+
+ need_push_constants = true;
+ if (!ctx->options->layout)
+ need_push_constants = false;
+ else if (!ctx->options->layout->push_constant_size &&
+ !ctx->options->layout->dynamic_offset_count)
+ need_push_constants = false;
/* 1 for each descriptor set */
for (unsigned i = 0; i < num_sets; ++i) {
@@ -469,8 +477,10 @@ static void create_function(struct nir_to_llvm_context *ctx,
}
}
- /* 1 for push constants and dynamic descriptors */
- arg_types[arg_idx++] = const_array(ctx->i8, 1024 * 1024);
+ if (need_push_constants) {
+ /* 1 for push constants and dynamic descriptors */
+ arg_types[arg_idx++] = const_array(ctx->i8, 1024 * 1024);
+ }
array_count = arg_idx;
switch (nir->stage) {
@@ -551,9 +561,11 @@ static void create_function(struct nir_to_llvm_context *ctx,
ctx->descriptor_sets[i] = NULL;
}
- ctx->push_constants = LLVMGetParam(ctx->main_function, arg_idx++);
- set_userdata_location_shader(ctx, AC_UD_PUSH_CONSTANTS, user_sgpr_idx, 2);
- user_sgpr_idx += 2;
+ if (need_push_constants) {
+ ctx->push_constants = LLVMGetParam(ctx->main_function, arg_idx++);
+ set_userdata_location_shader(ctx, AC_UD_PUSH_CONSTANTS, user_sgpr_idx, 2);
+ user_sgpr_idx += 2;
+ }
switch (nir->stage) {
case MESA_SHADER_COMPUTE: