-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Hello Khronos OpenGL Working Group,
I started out looking for blend modes and blend operators that give equal on-screen results for GtkGLArea widgets and CSS styled widgets. To that end I wrote a C program that pre-computes blender output colors for certain input colors, sorts them and places them into blender groups with equal output colors.
In doing so, I took the glBlendFunc() and glBlendEquation() functions for two separate blending stages, and implemented the glBlendEquation() part, with the source and destination blend factors as arguments to the min and max functions, by accident. That resulted in a glitch on the screen, when sliding over the different blend modes, so I started looking for the problem.
After inspection of the MesaGL source codes and all the different AMD Radeon Register Reference Guides, found out that arguments to glBlendFunc() and glBlendFuncSeparate() are being replaced by other arguments, when the blend operator is set to GL_MIN or GL_MAX. So I removed that couple of lines of code, and gone was the glitch.
After submitting a merge request, the owners / maintainers made me aware of the 'Notes' section of the glBlendEquation reference page. Then it became clear to me, that OpenGL had implemented blending in such a way, that though the underlying hardware supports them, the vast majority of all possible blender input combinations does not even reach the graphics adapter. NVidia (NV_blend_minmax_factor) and AMD (AMD_blend_minmax_factor), seem to be aware of this, but their proposals to extend functionality have never been implemented. From the NVidia extension it can be seen, that they agree with AMD on at least the naming convention of the additional tokens:
FACTOR_MIN_AMD 0x901C
FACTOR_MAX_AMD 0x901D
This means that the chance that there even ever were adapters around that did do the last stage of blending without using the source and destination blend factors for blend operators GL_MIN and GL_MAX is virtually zero, and that the OpenGL interpretation of how this stage should be implemented has most probably been flawed from the start.
I would like to propose that the OpenGL Core Specification is modified (OpenGL 6.1 (Core) Specification, Table 17.1, p. 509), such that the source and destination blend factors are by default arguments to the second stage of blending, i.e. such that glBlendEquation() purely specifies the operator that is to be applied to the first stage of blending.
Kind regards,
Ir. Michael J. Baars, Long 4 Core, the Netherlands.