pan/bi: Preload r60/r61 for MSAA + blend shader

This is the sort of leakiness I hate about blend shaders. MSAA + blend shader is
somewhat obscure but gets hit in the CTS.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15586>
This commit is contained in:
Alyssa Rosenzweig 2022-03-23 17:19:36 -04:00 committed by Marge Bot
parent 913a7ed41a
commit 5b056971a3

View file

@ -4304,6 +4304,20 @@ bi_compile_variant(nir_shader *nir,
bi_block *first_block = list_first_entry(&ctx->blocks, bi_block, link);
uint64_t preload = first_block->reg_live_in;
/* If multisampling is used with a blend shader, the blend shader needs
* to access the sample coverage mask in r60 and the sample ID in r61.
* Blend shaders run in the same context as fragment shaders, so if a
* blend shader could run, we need to preload these registers
* conservatively. There is believed to be little cost to doing so, so
* do so always to avoid variants of the preload descriptor.
*
* We only do this on Valhall, as Bifrost has to update the RSD for
* multisampling w/ blend shader anyway, so this is handled in the
* driver. We could unify the paths if the cost is acceptable.
*/
if (nir->info.stage == MESA_SHADER_FRAGMENT && ctx->arch >= 9)
preload |= BITFIELD64_BIT(60) | BITFIELD64_BIT(61);
info->ubo_mask |= ctx->ubo_mask;
info->tls_size = MAX2(info->tls_size, ctx->info.tls_size);