anv: disable dual source blending state if not used in shader

Fixing some simulation issues on Gfx9/11 with zink on anv running dual
source blending piglit tests like :

   ./bin/arb_blend_func_extended-dual-src-blending-discard-without-src1 -auto -fbo

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28901>
(cherry picked from commit 68dfe17abc)
This commit is contained in:
Lionel Landwerlin 2024-04-24 15:29:29 +03:00 committed by Eric Engestrom
parent 5d0c48b817
commit 0b1d5f32f8
2 changed files with 20 additions and 1 deletions

View file

@ -2504,7 +2504,7 @@
"description": "anv: disable dual source blending state if not used in shader",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -292,6 +292,15 @@ genX(rasterization_mode)(VkPolygonMode raster_mode,
}
}
static bool
is_src1_blend_factor(enum GENX(3D_Color_Buffer_Blend_Factor) factor)
{
return factor == BLENDFACTOR_SRC1_COLOR ||
factor == BLENDFACTOR_SRC1_ALPHA ||
factor == BLENDFACTOR_INV_SRC1_COLOR ||
factor == BLENDFACTOR_INV_SRC1_ALPHA;
}
#if GFX_VERx10 == 125
/**
* Return the dimensions of the current rendering area, defined as the
@ -998,6 +1007,16 @@ genX(cmd_buffer_flush_gfx_runtime_state)(struct anv_cmd_buffer *cmd_buffer)
dyn->cb.attachments[i].dst_alpha_blend_factor];
}
/* Replace and Src1 value by 1.0 if dual source blending is not
* enabled.
*/
if (wm_prog_data && !wm_prog_data->dual_src_blend) {
if (is_src1_blend_factor(SourceBlendFactor))
SourceBlendFactor = BLENDFACTOR_ONE;
if (is_src1_blend_factor(DestinationBlendFactor))
DestinationBlendFactor = BLENDFACTOR_ONE;
}
if (instance->intel_enable_wa_14018912822 &&
intel_needs_workaround(cmd_buffer->device->info, 14018912822) &&
pipeline->rasterization_samples > 1) {