From e65d266529f1e95252bacd529a830b9d4d50000f Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Mon, 7 Nov 2022 16:12:52 +0100 Subject: [PATCH] etnaviv: fix shader register control with MSAA Apparently MSAA doesn't only add another input, but it also increases required temporaries by one. Simple programs where the register demand is given by the number of inputs did work fine, while more complex ones, where register demand is given by the number of temporaries exhibit rendering issues without this fix. Cc: 22.3 mesa-stable Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Part-of: --- src/gallium/drivers/etnaviv/etnaviv_shader.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c index e24c3f1..8a8cf53 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_shader.c +++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c @@ -215,11 +215,13 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs, /* Precompute PS_INPUT_COUNT and TEMP_REGISTER_CONTROL in the case of MSAA * mode, avoids some fumbling in sync_context. */ + /* MSAA adds another input */ cs->PS_INPUT_COUNT_MSAA = - VIVS_PS_INPUT_COUNT_COUNT(link.num_varyings + 2) | /* MSAA adds another input */ + VIVS_PS_INPUT_COUNT_COUNT(link.num_varyings + 2) | VIVS_PS_INPUT_COUNT_UNK8(fs->input_count_unk8); + /* MSAA adds another temp */ cs->PS_TEMP_REGISTER_CONTROL_MSAA = - VIVS_PS_TEMP_REGISTER_CONTROL_NUM_TEMPS(MAX2(fs->num_temps, link.num_varyings + 2)); + VIVS_PS_TEMP_REGISTER_CONTROL_NUM_TEMPS(MAX2(fs->num_temps + 1, link.num_varyings + 2)); uint32_t total_components = 0; DEFINE_ETNA_BITARRAY(num_components, ETNA_NUM_VARYINGS, 4) = {0}; -- 2.7.4