Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Dual Source Blending #1955

Merged
merged 1 commit into from Aug 10, 2021
Merged

Add support for Dual Source Blending #1955

merged 1 commit into from Aug 10, 2021

Commits on Aug 10, 2021

  1. Add support for Dual Source Blending

    I'm no expert, but this seems to allow using dual source blending ala:
    
    ```
    let alpha_blending = glium::DrawParameters {
        blend: glium::Blend {
            color: BlendingFunction::Addition {
                source: LinearBlendingFactor::SourceOneColor,
                destination: LinearBlendingFactor::OneMinusSourceOneColor,
            },
            alpha: BlendingFunction::Addition {
                source: LinearBlendingFactor::SourceOneColor,
                destination: LinearBlendingFactor::OneMinusSourceOneColor,
            },
            constant_value: (0.0, 0.0, 0.0, 0.0),
        },
    
        ..Default::default()
    };
    ```
    
    and this in the shader:
    
    ```
    // The color + alpha
    layout(location=0, index=0) out vec4 color;
    // Individual alpha channels for RGBA in color, used for subpixel
    // antialiasing blending
    layout(location=0, index=1) out vec4 colorMask;
    ```
    
    based on my reading of:
    https://stackoverflow.com/questions/48491340/use-rgb-texture-as-alpha-values-subpixel-font-rendering-in-opengl
    https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_blend_func_extended.txt
    
    refs: wez/wezterm#932
    wez committed Aug 10, 2021
    Copy the full SHA
    aed9527 View commit details
    Browse the repository at this point in the history