[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] WebGL spec modifications for D3D

On Fri, Apr 23, 2010 at 1:33 AM, Tim Johansson <timj@opera.com> wrote:
On 2010-04-23 00:53, Chris Marrin wrote:
On Apr 22, 2010, at 12:18 PM, Vangelis Kokkevis wrote:

...4. Conflicting constant color usage. In D3D we can't directly support alpha blending for the cases where the source blend function is set to GL_CONSTANT_ALPHA (or GL_ONE_MINUS_CONSTANT_ALPHA), and the destination blend function is set to GL_CONSTANT_COLOR, or vice versa. That's because GL_CONSTANT_ALPHA has no D3D9 equivalent and if we replicate the alpha to the RGB components we can no longer use the RGB components for the other blend function.  Spec change:
  a) completely remove support for GL_CONSTANT_ALPHA and ONE_MINUS_CONSTANT_ALPHA (ie return GL_INVALID_VALUE), -or-
  b) glBlendFunc/Separate sets GL_INVALID_OPERATION if a source function is GL_CONSTANT_ALPHA or GL_ONE_MINUS_CONSTANT_ALPHA and the corresponding destination function is GL_CONSTANT_COLOR or or GL_ONE_MINUS_CONSTANT_COLOR, or vice versa.
I haven't thought about this one enough, but it makes me a little concerned. If I want to fade out an object by turning constant alpha down to 0, I can't do that? I suppose I can do the same thing by passing an alpha value to the shader. But couldn't there be alpha blending optimizations we could be missing by doing that? Like I said, I haven't thought about this enough, so maybe these concerns are nothing to worry about.

The limitation would be that you cannot use constant alpha and color at the same time. So the ones you cannot use would be:


You would still be able to use for example


Dropping constant alpha would not limit what you can do more than dropping constant alpha and constant color at the same time, you would just have to set blendColor(a, a, a, a) and use constant color.

Just to clarify, the situation is identical for both blendFunc and blendFuncSeparate, in that we cannot allow _both_ CONSTANT_ALPHA and CONSTANT_COLOR to be used as argument values in a single call.  This is not a major limitation but definitely something a developer needs to watch out for. In fact ANGLE has already implemented option (b):


Unless there are any objections, I'd like to move forward with stating in the WebGL spec that using both CONSTANT_ALPHA and CONSTANT_COLOR in a single call to blendFunc and blendFuncSeperate is not allowed and will set a GL_INVALID_OPERATION error.

Option (a), which eliminates CONSTANT_ALPHA all together, seems more heavy handed.



You are currently subscribe to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: