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

[EXT_draw_buffers_indexed] Constant Alpha Blend Factors #2938

Closed
lexaknyazev opened this issue Sep 30, 2019 · 4 comments · Fixed by #3033
Closed

[EXT_draw_buffers_indexed] Constant Alpha Blend Factors #2938

lexaknyazev opened this issue Sep 30, 2019 · 4 comments · Fixed by #3033

Comments

@lexaknyazev
Copy link
Member

D3D11 supports only "constant color" blending factors, so ANGLE emulates "constant alpha" factors by rewriting the constant color to aaaa. See StateManager11::syncBlendState.

This is reflected in the WebGL spec, Blending With Constant Color:

In the WebGL API, constant color and constant alpha cannot be used together as source and destination factors in the blend function. A call to blendFunc will generate an INVALID_OPERATION error if one of the two factors is set to CONSTANT_COLOR or ONE_MINUS_CONSTANT_COLOR and the other to CONSTANT_ALPHA or ONE_MINUS_CONSTANT_ALPHA. A call to blendFuncSeparate will generate an INVALID_OPERATION error if srcRGB is set to CONSTANT_COLOR or ONE_MINUS_CONSTANT_COLOR and dstRGB is set to CONSTANT_ALPHA or ONE_MINUS_CONSTANT_ALPHA or vice versa.

The OpenGL ES EXT_draw_buffers_indexed extension (and the corresponding OpenGL 4.0 feature) enables separate blend factors per each color output, but the constant color remains the same for all of them. This means that the WebGL EXT_draw_buffers_indexed extension has to have an additional restriction to work on D3D11.

There are two options.

  • Disallow use of CONSTANT_ALPHA and ONE_MINUS_CONSTANT_ALPHA factors with indexed blend state completely (easier to implement).
  • Extend existing WebGL restriction to indexed blend states. That would require more runtime validation on D3D11.
@kdashg
Copy link
Contributor

kdashg commented Nov 7, 2019

I think we should just extend our existing restrictions.

@jdarpinian
Copy link
Contributor

That sounds reasonable to me. We'll discuss in the meeting tomorrow.

@lexaknyazev
Copy link
Member Author

With this WebGL-specific behavior driven by D3D11 limitations, should we change the prefix to ANGLE_ or WEBGL_?

@kenrussell
Copy link
Member

I think it's fine to just leave it as EXT_draw_buffers_indexed and describe the WebGL-specific limitations in the extension - there's a space for this in https://www.khronos.org/registry/webgl/extensions/EXT_draw_buffers_indexed/ which isn't filled out.

We still need help implementing this as an enable-able extension in ANGLE. If that were done then hooking it up to WebGL would be easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants