ir3/a7xx: Fix FS consts corruption when other FS has zero constlen

Having zero consts in one FS may corrupt consts in follow up FSs,
on such GPUs blob never has zero consts in FS. The mechanism of
corruption is unknown.

Fixes geometry flickering in a number of games, including:
 Baldur's Gate 3
 Assasin's Creed Rogue

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29357>
This commit is contained in:
Danylo Piliaiev 2024-05-23 20:01:03 +02:00 committed by Marge Bot
parent 98e3b1bc5f
commit 59937f62a6
5 changed files with 18 additions and 0 deletions

View file

@ -254,6 +254,12 @@ struct fd_dev_info {
* parallel with "forcebin". It is exacerbated by using "syncdraw".
*/
bool no_gs_hw_binning_quirk;
/* Having zero consts in one FS may corrupt consts in follow up FSs,
* on such GPUs blob never has zero consts in FS. The mechanism of
* corruption is unknown.
*/
bool fs_must_have_non_zero_constlen_quirk;
} a7xx;
};

View file

@ -799,10 +799,12 @@ a7xx_base = A6XXProps(
a7xx_725 = A7XXProps(
cmdbuf_start_a725_quirk = True,
supports_ibo_ubwc = True,
fs_must_have_non_zero_constlen_quirk = True,
)
a7xx_730 = A7XXProps(
supports_ibo_ubwc = True,
fs_must_have_non_zero_constlen_quirk = True,
)
a7xx_740 = A7XXProps(
@ -810,6 +812,7 @@ a7xx_740 = A7XXProps(
has_event_write_sample_count = True,
ubwc_unorm_snorm_int_compatible = True,
supports_ibo_ubwc = True,
fs_must_have_non_zero_constlen_quirk = True,
)
a7xx_740_a32 = A7XXProps(
@ -818,6 +821,7 @@ a7xx_740_a32 = A7XXProps(
has_event_write_sample_count = True,
ubwc_unorm_snorm_int_compatible = True,
supports_ibo_ubwc = True,
fs_must_have_non_zero_constlen_quirk = True,
)
a7xx_750 = A7XXProps(

View file

@ -224,6 +224,7 @@ ir3_compiler_create(struct fd_device *dev, const struct fd_dev_id *dev_id,
compiler->has_branch_and_or = true;
compiler->has_predication = true;
compiler->has_scalar_alu = dev_info->a6xx.has_scalar_alu;
compiler->fs_must_have_non_zero_constlen_quirk = dev_info->a7xx.fs_must_have_non_zero_constlen_quirk;
} else {
compiler->max_const_pipeline = 512;
compiler->max_const_geom = 512;

View file

@ -276,6 +276,8 @@ struct ir3_compiler {
* register.
*/
bool has_scalar_alu;
bool fs_must_have_non_zero_constlen_quirk;
};
void ir3_compiler_destroy(struct ir3_compiler *compiler);

View file

@ -5479,6 +5479,11 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
ctx->so->per_samp = ctx->s->info.fs.uses_sample_shading;
if (ctx->so->type == MESA_SHADER_FRAGMENT &&
compiler->fs_must_have_non_zero_constlen_quirk) {
so->constlen = MAX2(so->constlen, 4);
}
out:
if (ret) {
if (so->ir)