[Mesa-dev] [PATCH] radeonsi: don't overwrite the scratch offset in shader prologs

Marek Olšák maraeo at gmail.com
Wed Apr 13 15:59:24 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

Prologs only look at num_input_sgprs.
---
 src/gallium/drivers/radeonsi/si_shader.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index e180fc8..c26960b 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5839,6 +5839,10 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
 
 	radeon_llvm_dispose(&ctx.radeon_bld);
 
+	/* Add the scratch offset to input SGPRs. */
+	if (shader->config.scratch_bytes_per_wave)
+		shader->info.num_input_sgprs += 1; /* scratch byte offset */
+
 	/* Calculate the number of fragment input VGPRs. */
 	if (ctx.type == TGSI_PROCESSOR_FRAGMENT) {
 		shader->info.num_input_vgprs = 0;
@@ -6765,9 +6769,6 @@ 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);
 }
 
-- 
2.5.0



More information about the mesa-dev mailing list