Module: Mesa Branch: main Commit: d3b72d49cba15fd3fad8072f528ff5e1854f6000 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3b72d49cba15fd3fad8072f528ff5e1854f6000
Author: Kenneth Graunke <[email protected]> Date: Mon Sep 13 15:05:09 2021 -0700 glsl: Assert that lower_blend_equation_advanced is only called for FS It only makes sense to call this pass for fragment shaders, and the first thing the pass does is read a FS-specific field out of a union, so it isn't safe to call it for other shader stages. We could make it early return, but instead we just assert, so that drivers know to only call it when appropriate. (A previous version of this patch, which early returned instead of asserting, was Reviewed-by: Emma Anholt <[email protected]> as well.) Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12839> --- src/compiler/glsl/lower_blend_equation_advanced.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/glsl/lower_blend_equation_advanced.cpp b/src/compiler/glsl/lower_blend_equation_advanced.cpp index cd2a83f5cc6..9060e83cdf3 100644 --- a/src/compiler/glsl/lower_blend_equation_advanced.cpp +++ b/src/compiler/glsl/lower_blend_equation_advanced.cpp @@ -463,6 +463,8 @@ get_main(gl_linked_shader *sh) bool lower_blend_equation_advanced(struct gl_linked_shader *sh, bool coherent) { + assert(sh->Stage == MESA_SHADER_FRAGMENT); + if (sh->Program->info.fs.advanced_blend_modes == 0) return false;
