[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

zmo at google.com zmo at google.com
Fri Jan 21 14:49:11 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 13daaddac34e72fd82c2092bcd4d1dcc6514a2e4
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 31 01:30:03 2010 +0000

    2010-12-29  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            Update validation of stencil mask and ref values
            https://bugs.webkit.org/show_bug.cgi?id=50716
    
            * html/canvas/WebGLRenderingContext.cpp:
            (WebCore::WebGLRenderingContext::initializeNewContext): Initialize cached stencil settings.
            (WebCore::WebGLRenderingContext::drawArrays): Validate stencil settings.
            (WebCore::WebGLRenderingContext::drawElements): Ditto.
            (WebCore::WebGLRenderingContext::stencilFunc): Cache stencil settings, but generate no error.
            (WebCore::WebGLRenderingContext::stencilFuncSeparate): Ditto.
            (WebCore::WebGLRenderingContext::stencilMask): Ditto.
            (WebCore::WebGLRenderingContext::stencilMaskSeparate): Ditto.
            (WebCore::WebGLRenderingContext::validateStencilSettings): Helper function to validate stencil settings.
            * html/canvas/WebGLRenderingContext.h: Declare stencil setting members.
    2010-12-29  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            Update validation of stencil mask and ref values
            https://bugs.webkit.org/show_bug.cgi?id=50716
    
            * fast/canvas/webgl/webgl-specific-expected.txt: Sync with khronos: refactor the test, also update the stencil setting test due to spec change.
            * fast/canvas/webgl/webgl-specific.html: Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74818 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index fe23ae7..5d051cd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-12-29  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        Update validation of stencil mask and ref values
+        https://bugs.webkit.org/show_bug.cgi?id=50716
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::initializeNewContext): Initialize cached stencil settings.
+        (WebCore::WebGLRenderingContext::drawArrays): Validate stencil settings.
+        (WebCore::WebGLRenderingContext::drawElements): Ditto.
+        (WebCore::WebGLRenderingContext::stencilFunc): Cache stencil settings, but generate no error.
+        (WebCore::WebGLRenderingContext::stencilFuncSeparate): Ditto.
+        (WebCore::WebGLRenderingContext::stencilMask): Ditto.
+        (WebCore::WebGLRenderingContext::stencilMaskSeparate): Ditto.
+        (WebCore::WebGLRenderingContext::validateStencilSettings): Helper function to validate stencil settings.
+        * html/canvas/WebGLRenderingContext.h: Declare stencil setting members.
+
 2010-12-30  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index f138ca5..d0c5397 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -173,8 +173,11 @@ void WebGLRenderingContext::initializeNewContext()
     m_framebufferBinding = 0;
     m_renderbufferBinding = 0;
     m_stencilMask = 0xFFFFFFFF;
+    m_stencilMaskBack = 0xFFFFFFFF;
     m_stencilFuncRef = 0;
+    m_stencilFuncRefBack = 0;
     m_stencilFuncMask = 0xFFFFFFFF;
+    m_stencilFuncMaskBack = 0xFFFFFFFF;
     m_vertexAttribState.clear();
 
     int numCombinedTextureImageUnits = 0;
@@ -1109,6 +1112,9 @@ void WebGLRenderingContext::drawArrays(unsigned long mode, long first, long coun
     if (isContextLost() || !validateDrawMode(mode))
         return;
 
+    if (!validateStencilSettings())
+        return;
+
     if (first < 0 || count < 0) {
         m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
         return;
@@ -1158,6 +1164,9 @@ void WebGLRenderingContext::drawElements(unsigned long mode, long count, unsigne
     if (isContextLost() || !validateDrawMode(mode))
         return;
 
+    if (!validateStencilSettings())
+        return;
+
     switch (type) {
     case GraphicsContext3D::UNSIGNED_BYTE:
     case GraphicsContext3D::UNSIGNED_SHORT:
@@ -2471,7 +2480,9 @@ void WebGLRenderingContext::stencilFunc(unsigned long func, long ref, unsigned l
     if (!validateStencilFunc(func))
         return;
     m_stencilFuncRef = ref;
+    m_stencilFuncRefBack = ref;
     m_stencilFuncMask = mask;
+    m_stencilFuncMaskBack = mask;
     m_context->stencilFunc(func, ref, mask);
     cleanupAfterGraphicsCall(false);
 }
@@ -2480,15 +2491,25 @@ void WebGLRenderingContext::stencilFuncSeparate(unsigned long face, unsigned lon
 {
     if (isContextLost())
         return;
-    if (!validateFace(face) || !validateStencilFunc(func))
+    if (!validateStencilFunc(func))
         return;
-    if (face == GraphicsContext3D::FRONT_AND_BACK) {
+    switch (face) {
+    case GraphicsContext3D::FRONT_AND_BACK:
         m_stencilFuncRef = ref;
+        m_stencilFuncRefBack = ref;
         m_stencilFuncMask = mask;
-    } else if (m_stencilFuncRef != ref || m_stencilFuncMask != mask) {
-        // for ref value, we generate an error if user specify a different value
-        // for front/back faces even if they clamp to the same value internally.
-        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+        m_stencilFuncMaskBack = mask;
+        break;
+    case GraphicsContext3D::FRONT:
+        m_stencilFuncRef = ref;
+        m_stencilFuncMask = mask;
+        break;
+    case GraphicsContext3D::BACK:
+        m_stencilFuncRefBack = ref;
+        m_stencilFuncMaskBack = mask;
+        break;
+    default:
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
         return;
     }
     m_context->stencilFuncSeparate(face, func, ref, mask);
@@ -2500,6 +2521,7 @@ void WebGLRenderingContext::stencilMask(unsigned long mask)
     if (isContextLost())
         return;
     m_stencilMask = mask;
+    m_stencilMaskBack = mask;
     m_context->stencilMask(mask);
     cleanupAfterGraphicsCall(false);
 }
@@ -2508,12 +2530,19 @@ void WebGLRenderingContext::stencilMaskSeparate(unsigned long face, unsigned lon
 {
     if (isContextLost())
         return;
-    if (!validateFace(face))
-        return;
-    if (face == GraphicsContext3D::FRONT_AND_BACK)
+    switch (face) {
+    case GraphicsContext3D::FRONT_AND_BACK:
         m_stencilMask = mask;
-    else if (m_stencilMask != mask) {
-        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+        m_stencilMaskBack = mask;
+        break;
+    case GraphicsContext3D::FRONT:
+        m_stencilMask = mask;
+        break;
+    case GraphicsContext3D::BACK:
+        m_stencilMaskBack = mask;
+        break;
+    default:
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
         return;
     }
     m_context->stencilMaskSeparate(face, mask);
@@ -3865,17 +3894,13 @@ bool WebGLRenderingContext::validateDrawMode(unsigned long mode)
     }
 }
 
-bool WebGLRenderingContext::validateFace(unsigned long face)
+bool WebGLRenderingContext::validateStencilSettings()
 {
-    switch (face) {
-    case GraphicsContext3D::FRONT:
-    case GraphicsContext3D::BACK:
-    case GraphicsContext3D::FRONT_AND_BACK:
-        return true;
-    default:
-        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
+    if (m_stencilMask != m_stencilMaskBack || m_stencilFuncRef != m_stencilFuncRefBack || m_stencilFuncMask != m_stencilFuncMaskBack) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
         return false;
     }
+    return true;
 }
 
 bool WebGLRenderingContext::validateStencilFunc(unsigned long func)
diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h
index 959d818..1e867d6 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/WebCore/html/canvas/WebGLRenderingContext.h
@@ -456,9 +456,9 @@ public:
     GraphicsContext3D::Attributes m_attributes;
 
     long m_stencilBits;
-    unsigned long m_stencilMask;
-    long m_stencilFuncRef; // Note that this is the user specified value, not the internal clamped value.
-    unsigned long m_stencilFuncMask;
+    unsigned long m_stencilMask, m_stencilMaskBack;
+    long m_stencilFuncRef, m_stencilFuncRefBack; // Note that these are the user specified values, not the internal clamped value.
+    unsigned long m_stencilFuncMask, m_stencilFuncMaskBack;
 
     bool m_isGLES2Compliant;
     bool m_isGLES2NPOTStrict;
@@ -541,8 +541,8 @@ public:
     // Helper function to validate mode for draw{Arrays/Elements}.
     bool validateDrawMode(unsigned long);
 
-    // Helper function to validate face.
-    bool validateFace(unsigned long);
+    // Helper function to validate if front/back stencilMask and stencilFunc settings are the same.
+    bool validateStencilSettings();
 
     // Helper function to validate stencil func.
     bool validateStencilFunc(unsigned long);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list