mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 615013 - Implement section 6.8 on mutually incompatible blend factors - r=vlad
This commit is contained in:
parent
16619827b3
commit
04ac270a3a
@ -422,9 +422,10 @@ protected:
|
||||
PRBool InitAndValidateGL();
|
||||
PRBool ValidateBuffers(PRUint32 count);
|
||||
PRBool ValidateCapabilityEnum(WebGLenum cap, const char *info);
|
||||
PRBool ValidateBlendEquationEnum(WebGLuint cap, const char *info);
|
||||
PRBool ValidateBlendFuncDstEnum(WebGLuint mode, const char *info);
|
||||
PRBool ValidateBlendFuncSrcEnum(WebGLuint mode, const char *info);
|
||||
PRBool ValidateBlendEquationEnum(WebGLenum cap, const char *info);
|
||||
PRBool ValidateBlendFuncDstEnum(WebGLenum mode, const char *info);
|
||||
PRBool ValidateBlendFuncSrcEnum(WebGLenum mode, const char *info);
|
||||
PRBool ValidateBlendFuncEnumsCompatibility(WebGLenum sfactor, WebGLenum dfactor, const char *info);
|
||||
PRBool ValidateTextureTargetEnum(WebGLenum target, const char *info);
|
||||
PRBool ValidateComparisonEnum(WebGLenum target, const char *info);
|
||||
PRBool ValidateStencilOpEnum(WebGLenum action, const char *info);
|
||||
|
@ -324,6 +324,9 @@ NS_IMETHODIMP WebGLContext::BlendFunc(WebGLenum sfactor, WebGLenum dfactor)
|
||||
!ValidateBlendFuncDstEnum(dfactor, "blendFunc: dfactor"))
|
||||
return NS_OK;
|
||||
|
||||
if (!ValidateBlendFuncEnumsCompatibility(sfactor, dfactor, "blendFuncSeparate: srcRGB and dstRGB"))
|
||||
return NS_OK;
|
||||
|
||||
MakeContextCurrent();
|
||||
gl->fBlendFunc(sfactor, dfactor);
|
||||
return NS_OK;
|
||||
@ -339,6 +342,11 @@ WebGLContext::BlendFuncSeparate(WebGLenum srcRGB, WebGLenum dstRGB,
|
||||
!ValidateBlendFuncDstEnum(dstAlpha, "blendFuncSeparate: dstAlpha"))
|
||||
return NS_OK;
|
||||
|
||||
// note that we only check compatibity for the RGB enums, no need to for the Alpha enums, see
|
||||
// "Section 6.8 forgetting to mention alpha factors?" thread on the public_webgl mailing list
|
||||
if (!ValidateBlendFuncEnumsCompatibility(srcRGB, dstRGB, "blendFuncSeparate: srcRGB and dstRGB"))
|
||||
return NS_OK;
|
||||
|
||||
MakeContextCurrent();
|
||||
gl->fBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
return NS_OK;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user