summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-07-04 11:09:50 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2017-07-05 12:34:00 +0200
commit161f051715e7914906c84055cbc9a2e301edfd70 (patch)
tree8ee728840cca90c1600417c90d444acd87107eff
parent256a1849c750df658a805fd236645a15dce23ecf (diff)
radeonsi/nir: lower uniforms to UBO loads
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_nir.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 10b3630e86..7de8b10784 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -32,6 +32,12 @@
#include "compiler/nir_types.h"
+static int
+type_size(const struct glsl_type *type)
+{
+ return glsl_count_attribute_slots(type, false);
+}
+
static void scan_instruction(struct tgsi_shader_info *info,
nir_instr *instr)
{
@@ -345,6 +351,10 @@ si_lower_nir(struct si_shader_selector* sel)
* - ensure constant offsets for texture instructions are folded
* and copy-propagated
*/
+ NIR_PASS_V(sel->nir, nir_lower_io, nir_var_uniform, type_size,
+ (nir_lower_io_options)0);
+ NIR_PASS_V(sel->nir, nir_lower_uniforms_to_ubo);
+
NIR_PASS_V(sel->nir, nir_lower_returns);
NIR_PASS_V(sel->nir, nir_lower_vars_to_ssa);
NIR_PASS_V(sel->nir, nir_lower_alu_to_scalar);