Changeset 71282 in webkit
- Timestamp:
- Nov 3, 2010 4:53:19 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r71280 r71282 1 2010-11-02 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Kenneth Russell. 4 5 A different mask or reference value in stencil operations should generate INVALID_OPERATION 6 https://bugs.webkit.org/show_bug.cgi?id=48669 7 8 * fast/canvas/webgl/webgl-specific-expected.txt: 9 * fast/canvas/webgl/webgl-specific.html: Uncomment the test cases for the bug. 10 1 11 2010-11-03 Oliver Hunt <oliver@apple.com> 2 12 -
trunk/LayoutTests/fast/canvas/webgl/webgl-specific-expected.txt
r71185 r71282 19 19 PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function 20 20 PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function 21 PASS getError was expected value: NO_ERROR : stencilMask should generate no error 22 PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal 23 PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal 24 PASS getError was expected value: NO_ERROR : stencilFunc should generate no error 25 PASS getError was expected value: INVALID_OPERATION : a different reference value for front and back facing is illegal 26 PASS getError was expected value: INVALID_OPERATION : a different reference value for front and back facing is illegal 27 PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal 28 PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal 21 29 PASS successfullyParsed is true 22 30 -
trunk/LayoutTests/fast/canvas/webgl/webgl-specific.html
r71185 r71282 73 73 glErrorShouldBe(gl, gl.INVALID_OPERATION, 74 74 "depthRange should generate INVALID_OPERATION if zNear is greater than zFar"); 75 */ 75 76 76 77 gl.stencilMask(255); … … 99 100 glErrorShouldBe(gl, gl.INVALID_OPERATION, 100 101 "a different mask value for front and back facing is illegal"); 101 */102 102 103 103 successfullyParsed = true; -
trunk/WebCore/ChangeLog
r71278 r71282 1 2010-11-02 Zhenyao Mo <zmo@google.com> 2 3 Reviewed by Kenneth Russell. 4 5 A different mask or reference value in stencil operations should generate INVALID_OPERATION 6 https://bugs.webkit.org/show_bug.cgi?id=48669 7 8 * html/canvas/WebGLRenderingContext.cpp: 9 (WebCore::WebGLRenderingContext::WebGLRenderingContext): Init stencil func ref/mask and stencil mask to default. 10 (WebCore::WebGLRenderingContext::stencilFunc): Cache ref/mask value. 11 (WebCore::WebGLRenderingContext::stencilFuncSeparate): Generate error if front/back values differ. 12 (WebCore::WebGLRenderingContext::stencilMask): Cache mask value. 13 (WebCore::WebGLRenderingContext::stencilMaskSeparate): Generate error if front/back values differ. 14 (WebCore::WebGLRenderingContext::validateFace): Validate face parameter. 15 (WebCore::WebGLRenderingContext::validateStencilFunc): Validate stencil func parameter. 16 * html/canvas/WebGLRenderingContext.h: Add members to track stencil func ref/mask and stencil mask. 17 1 18 2010-11-03 Dimitri Glazkov <dglazkov@chromium.org> 2 19 -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r71274 r71282 105 105 , m_videoCache(4) 106 106 , m_contextLost(false) 107 , m_stencilMask(0xFFFFFFFF) 108 , m_stencilFuncRef(0) 109 , m_stencilFuncMask(0xFFFFFFFF) 107 110 { 108 111 ASSERT(m_context); … … 2218 2221 if (isContextLost()) 2219 2222 return; 2223 if (!validateStencilFunc(func)) 2224 return; 2225 m_stencilFuncRef = ref; 2226 m_stencilFuncMask = mask; 2220 2227 m_context->stencilFunc(func, ref, mask); 2221 2228 cleanupAfterGraphicsCall(false); … … 2226 2233 if (isContextLost()) 2227 2234 return; 2235 if (!validateFace(face) || !validateStencilFunc(func)) 2236 return; 2237 if (face == GraphicsContext3D::FRONT_AND_BACK) { 2238 m_stencilFuncRef = ref; 2239 m_stencilFuncMask = mask; 2240 } else if (m_stencilFuncRef != ref || m_stencilFuncMask != mask) { 2241 // for ref value, we generate an error if user specify a different value 2242 // for front/back faces even if they clamp to the same value internally. 2243 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 2244 return; 2245 } 2228 2246 m_context->stencilFuncSeparate(face, func, ref, mask); 2229 2247 cleanupAfterGraphicsCall(false); … … 2234 2252 if (isContextLost()) 2235 2253 return; 2254 m_stencilMask = mask; 2236 2255 m_context->stencilMask(mask); 2237 2256 cleanupAfterGraphicsCall(false); … … 2242 2261 if (isContextLost()) 2243 2262 return; 2263 if (!validateFace(face)) 2264 return; 2265 if (face == GraphicsContext3D::FRONT_AND_BACK) 2266 m_stencilMask = mask; 2267 else if (m_stencilMask != mask) { 2268 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 2269 return; 2270 } 2244 2271 m_context->stencilMaskSeparate(face, mask); 2245 2272 cleanupAfterGraphicsCall(false); … … 3556 3583 } 3557 3584 3585 bool WebGLRenderingContext::validateFace(unsigned long face) 3586 { 3587 switch (face) { 3588 case GraphicsContext3D::FRONT: 3589 case GraphicsContext3D::BACK: 3590 case GraphicsContext3D::FRONT_AND_BACK: 3591 return true; 3592 default: 3593 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); 3594 return false; 3595 } 3596 } 3597 3598 bool WebGLRenderingContext::validateStencilFunc(unsigned long func) 3599 { 3600 switch (func) { 3601 case GraphicsContext3D::NEVER: 3602 case GraphicsContext3D::LESS: 3603 case GraphicsContext3D::LEQUAL: 3604 case GraphicsContext3D::GREATER: 3605 case GraphicsContext3D::GEQUAL: 3606 case GraphicsContext3D::EQUAL: 3607 case GraphicsContext3D::NOTEQUAL: 3608 case GraphicsContext3D::ALWAYS: 3609 return true; 3610 default: 3611 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); 3612 return false; 3613 } 3614 } 3615 3558 3616 void WebGLRenderingContext::printWarningToConsole(const String& message) 3559 3617 { -
trunk/WebCore/html/canvas/WebGLRenderingContext.h
r71274 r71282 427 427 bool m_contextLost; 428 428 429 long m_stencilBits; 430 unsigned long m_stencilMask; 431 long m_stencilFuncRef; // Note that this is the user specified value, not the internal clamped value. 432 unsigned long m_stencilFuncMask; 433 429 434 // Helpers for getParameter and others 430 435 WebGLGetInfo getBooleanParameter(unsigned long pname); … … 486 491 bool validateDrawMode(unsigned long); 487 492 493 // Helper function to validate face. 494 bool validateFace(unsigned long); 495 496 // Helper function to validate stencil func. 497 bool validateStencilFunc(unsigned long); 498 488 499 // Helper function for texParameterf and texParameteri. 489 500 void texParameter(unsigned long target, unsigned long pname, float parami, int paramf, bool isFloat);
Note: See TracChangeset
for help on using the changeset viewer.