I noticed your drivers are advertising support for blend_advanced and blend_advanced_coherent, but couldn't understand why it still didn't work. I traced it down to you enforcing that fragment shaders needs to enable which advanced blend equation they work with, something the NVidia driver does not. I think it would be in your best interest to only warn on that and not abort the operation. If you can't do it correctly without that hint, that is of course acceptable, it is there for a reason, but it seems you are only doing the validation for the sake of strictness, and that is hurting your drivers compatibility.
I traced the issue to this commit: commit acf57fcf7ff7e60c3550da7b6dda7ad8b69195bd Author: Kenneth Graunke <kenneth@whitecape.org> Date: Sat Aug 20 12:51:03 2016 -0700 mesa: Add draw time validation for advanced blending modes. v2: Add null checks (requested by Curro). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Note. I have been unable to get it to work at all in compatibility-mode desktop OpenGL. The following code only works in core mode: #ifdef GL_KHR_blend_equation_advanced #extension GL_KHR_blend_equation_advanced : require layout(blend_support_all_equations) out; #endif because layout is not identified in basic OpenGL 2.0, and while #ifdef GL_KHR_blend_equation_advanced #extension GL_ARB_explicit_attrib_location : enable #extension GL_KHR_blend_equation_advanced : require layout(blend_support_all_equations) out; #endif parses, it doesn't actually change anything. Mesa still reports: Mesa: User error: GL_INVALID_OPERATION in fragment shader does not allow advanced blending mode (GL_MULTIPLY) With NVidia drivers, I don't need any changes to fragment shaders.
The specification is available at https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_blend_equation_advanced.txt If you find the NVIDIA drivers doing something different than what's written there, feel free to report the bug to them. If you find mesa drivers doing something different, please do let us know. If either implementation has a bug, it would also make sense to request a VK-GL-CTS test that enforces the correct behavior (https://github.com/KhronosGroup/VK-GL-CTS/issues).
Specifically, the ext spec says, """ A draw-time error will be generated in the OpenGL API if an application attempts to render using an advanced blending equation without having a matching layout qualifier specified in the active fragment shader. """ So pretty sure mesa is in the right here, and NVIDIA is buggy. (And as an aside, the mesa implementation relies on the options being supplied properly, since code is inserted conditionally into the shader. I'm guessing NVIDIA just has a global library and doesn't care.)
Yep, the error is correct and required by the spec. That's a bug in the NVIDIA drivers, and it would be good to have a VK-GL-CTS test to enforce it. The fact that layout qualifiers don't parse correctly in legacy shading language versions is our bug. I'll send a patch shortly.
Right. I think NVidia can get away with it because this requirement is new in the KHR version, they also implement the original NV version which doesnt have it (and like is OpenGL norm, they share the same GL defines). Anyway since you are actually using the declaration and it has significant impact in compile time of the shader, I withdraw my complaint and suggestion.
layout qualifier parsing in legacy shaders should be fixed with: commit 183ce5e629ee973d72a3e8b3361aa2de196cc203 Author: Kenneth Graunke <kenneth@whitecape.org> Date: Mon Feb 19 09:35:46 2018 -0800 glsl: Parse 'layout' as a token with advanced blending or bindless Both KHR_blend_equation_advanced and ARB_bindless_texture provide layout qualifiers, and are exposed in compatibility contexts. We need to parse the layout qualifier as a token in order for those to work, but forgot to extend this check. ARB_shader_image_load_store would need a similar treatment, but we don't expose that in legacy OpenGL contexts. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105161 Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
That would fix the parsing in compatibility shaders. It doesn't make it work. I found after digging into mesa code that I needed: #extension GL_ARB_fragment_coord_conventions : enable Otherwise the layout qualifiers are only passed, but not passed on. I am not sure if that is a bug, but there was nothing in the spec that suggested you need to manually activate that extension as well to get it the layout qualifier to work.
The problem is the check in linker.cpp (link_fs_inout_layout_qualifiers): if (linked_shader->Stage != MESA_SHADER_FRAGMENT || (prog->data->Version < 150 && !prog->ARB_fragment_coord_conventions_enable)) return;
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1022.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.