Module: Mesa Branch: main Commit: bec8f8fde84e3b6d474da4b0153e8c95a99e337e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bec8f8fde84e3b6d474da4b0153e8c95a99e337e
Author: Kenneth Graunke <[email protected]> Date: Mon Sep 13 15:47:47 2021 -0700 i965: Only call lower_blend_equation_advanced for fragment shaders i965 called this pass unconditionally, while st/mesa only calls it for fragment shaders. It only makes sense to run for fragment shaders, and the first thing the pass does is read a FS-specific field out of a union. This isn't safe for other stages. Fixes about 20,630 test failures on i965 since 91dc863921a, which moved the advanced_blend_modes field. The field had previously been in a union with no other fields, so it never aliased anything, and thus worked, even if it was wrong. That commit moved it to a union that had fields for other stages, so it started reading garbage and trying to lower advanced blending for other stages on i965. Fixes: 91dc863921a ("mesa: Move the advanced blend bitmask to shader_info.") Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12839> --- src/mesa/drivers/dri/i965/brw_link.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index 77b4c140037..396ee4d3c0d 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -102,8 +102,10 @@ process_glsl_ir(struct brw_context *brw, ralloc_adopt(mem_ctx, shader->ir); - lower_blend_equation_advanced( - shader, ctx->Extensions.KHR_blend_equation_advanced_coherent); + if (shader->Stage == MESA_SHADER_FRAGMENT) { + lower_blend_equation_advanced( + shader, ctx->Extensions.KHR_blend_equation_advanced_coherent); + } /* lower_packing_builtins() inserts arithmetic instructions, so it * must precede lower_instructions().
