[Mesa-dev] [PATCH 4/7] radeonsi: preload PS inputs only if KILL is used
Marek Olšák
maraeo at gmail.com
Fri Jan 20 19:07:09 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
so that most shaders can get lower VGPR usage thanks to lazy input loading.
I think this is a more accurate constraint that prevents the black transitions
in Witcher 2.
Affected shaders (7758):
Max Waves: 57437 -> 58231 (1.38 %)
---
src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 8d19a4e..4f355e5 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -630,25 +630,29 @@ store_value_to_array(struct lp_build_tgsi_context *bld_base,
}
value = LLVMBuildExtractElement(builder, array,
lp_build_const_int32(gallivm, i), "");
LLVMBuildStore(builder, value, temp_ptr);
}
}
}
/* If this is true, preload FS inputs at the beginning of shaders. Otherwise,
* reload them at each use. This must be true if the shader is using
- * derivatives, because all inputs should be loaded in the WQM mode.
+ * derivatives and KILL, because KILL can leave the WQM and then a lazy
+ * input load isn't in the WQM anymore.
*/
static bool si_preload_fs_inputs(struct si_shader_context *ctx)
{
- return ctx->shader->selector->info.uses_derivatives;
+ struct si_shader_selector *sel = ctx->shader->selector;
+
+ return sel->info.uses_derivatives &&
+ sel->info.uses_kill;
}
static LLVMValueRef
get_output_ptr(struct lp_build_tgsi_context *bld_base, unsigned index,
unsigned chan)
{
struct si_shader_context *ctx = si_shader_context(bld_base);
assert(index <= ctx->bld_base.info->file_max[TGSI_FILE_OUTPUT]);
return ctx->outputs[index][chan];
--
2.7.4
More information about the mesa-dev
mailing list