Bug 615013 - Implement section 6.8 on mutually incompatible blend factors - r=vlad
This commit is contained in:
@@ -204,6 +204,25 @@ PRBool WebGLContext::ValidateBlendFuncSrcEnum(WebGLenum factor, const char *info
|
||||
return ValidateBlendFuncDstEnum(factor, info);
|
||||
}
|
||||
|
||||
PRBool WebGLContext::ValidateBlendFuncEnumsCompatibility(WebGLenum sfactor, WebGLenum dfactor, const char *info)
|
||||
{
|
||||
PRBool sfactorIsConstantColor = sfactor == LOCAL_GL_CONSTANT_COLOR ||
|
||||
sfactor == LOCAL_GL_ONE_MINUS_CONSTANT_COLOR;
|
||||
PRBool sfactorIsConstantAlpha = sfactor == LOCAL_GL_CONSTANT_ALPHA ||
|
||||
sfactor == LOCAL_GL_ONE_MINUS_CONSTANT_ALPHA;
|
||||
PRBool dfactorIsConstantColor = dfactor == LOCAL_GL_CONSTANT_COLOR ||
|
||||
dfactor == LOCAL_GL_ONE_MINUS_CONSTANT_COLOR;
|
||||
PRBool dfactorIsConstantAlpha = dfactor == LOCAL_GL_CONSTANT_ALPHA ||
|
||||
dfactor == LOCAL_GL_ONE_MINUS_CONSTANT_ALPHA;
|
||||
if ( (sfactorIsConstantColor && dfactorIsConstantAlpha) ||
|
||||
(dfactorIsConstantColor && sfactorIsConstantAlpha) ) {
|
||||
ErrorInvalidOperation("%s are mutually incompatible, see section 6.8 in the WebGL 1.0 spec", info);
|
||||
return PR_FALSE;
|
||||
} else {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool WebGLContext::ValidateTextureTargetEnum(WebGLenum target, const char *info)
|
||||
{
|
||||
switch (target) {
|
||||
|
||||
Reference in New Issue
Block a user