Use a helper function for checked arithmetic in WebGL validation
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jan 2018 00:30:02 +0000 (00:30 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jan 2018 00:30:02 +0000 (00:30 +0000)
commit62d6d510a524585416ab478745d313b53c2ba181
tree81ca81af79d4ed243b60655eb74207f0d70d3980
parent686346d485b9b917def1760759447a24821310ba
Use a helper function for checked arithmetic in WebGL validation
https://bugs.webkit.org/show_bug.cgi?id=181620
<rdar://problem/36485879>

Reviewed by Eric Carlson.

Eric recommended using a templated helper function to do
a common arithmetic check in WebGL validation.

* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::validateIndexArrayConservative):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
(WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
(WebCore::WebGLRenderingContextBase::validateDrawArrays):
(WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
(WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
* html/canvas/WebGLRenderingContextBase.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226927 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Source/WebCore/html/canvas/WebGLRenderingContextBase.h