diff options
author | Marek Olšák <[email protected]> | 2016-04-13 13:50:04 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-04-14 17:00:14 +0200 |
commit | 51c4034f9b344919839cd0bfaa50624a17b61ae5 (patch) | |
tree | 080e23ac9c680f47db98d3f67d43635eba5d40bb /src/gallium/drivers/radeonsi/si_shader.c | |
parent | aaf5be4a29b4537b7e298c3ddf889180f3b4d855 (diff) |
radeonsi: fix SGPRS calculation once more
This fixes GS piglit failures after adding SI_PARAM_SHADER_BUFFERS,
which bumped NUM_USER_SGPRS and uncovered this bug on SI.
If this was fixed in LLVM, these workarounds wouldn't be needed.
LLVM would have to look at the calling convention to know how many SGPR
inputs are declared, and add VCC and the scratch wave offset (which is
enabled even if we spill SGPRs but not VGPRs, oh well).
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_shader.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index c58467ddcb0..e180fc89d51 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -6761,6 +6761,16 @@ static bool si_shader_select_ps_parts(struct si_screen *sscreen, return true; } +static void si_fix_num_sgprs(struct si_shader *shader) +{ + unsigned min_sgprs = shader->info.num_input_sgprs + 2; /* VCC */ + + if (shader->config.scratch_bytes_per_wave) + min_sgprs += 1; /* scratch wave offset */ + + shader->config.num_sgprs = MAX2(shader->config.num_sgprs, min_sgprs); +} + int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm, struct si_shader *shader, struct pipe_debug_callback *debug) @@ -6850,6 +6860,7 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm, } } + si_fix_num_sgprs(shader); si_shader_dump(sscreen, shader, debug, shader->selector->info.processor, stderr); |