Bug 48674 - blendFunc should generate INVALID_OPERATION if constant color and constant alpha are together as source and destination factors
Summary: blendFunc should generate INVALID_OPERATION if constant color and constant al...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Zhenyao Mo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-29 14:15 PDT by Zhenyao Mo
Modified: 2010-11-02 16:25 PDT (History)
3 users (show)

See Also:


Attachments
patch (12.52 KB, patch)
2010-11-01 16:35 PDT, Zhenyao Mo
kbr: review-
zmo: commit-queue-
Details | Formatted Diff | Diff
revised patch: responding to kbr's review (13.10 KB, patch)
2010-11-02 16:05 PDT, Zhenyao Mo
kbr: review+
zmo: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zhenyao Mo 2010-10-29 14:15:56 PDT
WebGL spec:

6.8 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.
Comment 1 Zhenyao Mo 2010-11-01 16:35:49 PDT
Created attachment 72595 [details]
patch

test synched with khronos and I commented out the still failing parts.
Comment 2 Kenneth Russell 2010-11-02 12:09:30 PDT
Comment on attachment 72595 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=72595&action=review

> WebCore/html/canvas/WebGLRenderingContext.cpp:372
> +            && (srcRGB == GraphicsContext3D::CONSTANT_ALPHA || srcRGB == GraphicsContext3D::ONE_MINUS_CONSTANT_ALPHA))) {

Please factor out this logic into a helper function or method and call it from both blendFunc and blendFuncSeparate.
Comment 3 Zhenyao Mo 2010-11-02 16:05:43 PDT
Created attachment 72759 [details]
revised patch: responding to kbr's review
Comment 4 Kenneth Russell 2010-11-02 16:12:18 PDT
Comment on attachment 72759 [details]
revised patch: responding to kbr's review

Looks good.
Comment 5 Zhenyao Mo 2010-11-02 16:25:21 PDT
Committed r71185: <http://trac.webkit.org/changeset/71185>