Fix alpha blending in WebGL backends #650
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes alpha blending in the WebGL backends by first blending everything in a linear framebuffer, before converting the result to sRGB in a second shader.
The results of the color test are now identical to the egui_glium backend when using the WebGL2 backend.
The WebGL1 backend suffers from reduced precision in dark colors without the
SRGB8_ALPHA8
format and still doesn't have correct texture interpolation.Color test with the change (I have since removed the warning):
![WebGL2](https://user-images.githubusercontent.com/26281282/130811655-1f91258f-6e93-4652-8617-388cfb208475.png)
![WebGL1](https://user-images.githubusercontent.com/26281282/130811661-406d05e1-e874-4e61-a6b3-76bfb511eca8.png)
WebGL2
WebGL1
(Sorry for not following the contributing guidelines exactly ("First file an issue" and all that). This was a spontaneous test as I didn't know whether it was even possible and I didn't wan't to file an issue the same minute as closing it (Should I?).)