From abfb31acdb673083296d010dfc6920992369989c Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 16 May 2019 11:34:13 -0700 Subject: [PATCH] freedreno/a6xx: make sure binning pass constlen is large enough Since we use same constant state for both binning pass program state and draw pass state, and it is possible for binning pass shader to use fewer consts, we need to make sure we program a large enough constlen. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a6xx/fd6_program.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c index 9888e51f86e..3603d800f04 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c @@ -285,6 +285,19 @@ setup_stages(struct fd6_program_state *state, struct stage *s, bool binning_pass s[i].instrlen = 0; } } + + /* since we share the constant state w/ VS we need to make sure + * constlen is sufficiently large for full VS, even if the binning + * pass shader doesn't use them all + */ + if (binning_pass) { + s[VS].constlen = MAX2(s[VS].constlen, align(state->bs->constlen, 4)); + } else { + /* It should be impossible for VS to have smaller constlen than BS + * since BS is just a subset of VS. + */ + debug_assert(s[VS].constlen >= state->bs->constlen); + } } static inline uint32_t -- 2.30.2