Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r177165 - InstancedArray crashes attempting to draw out of bounds
https://bugs.webkit.org/show_bug.cgi?id=139521 Source/WebCore: Reviewed by Simon Fraser. We were not doing index validation correctly for instancing. Test: fast/canvas/webgl/angle-instanced-arrays-out-of-bounds.html * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::validateVertexAttributes): We need to check the number of instances drawn against the amount of instance data that has been provided, taking into account the number of repeats (the divisor). (WebCore::WebGLRenderingContext::drawArrays): Added some whitespace to make it more clear. (WebCore::WebGLRenderingContext::validateDrawElements): This needs to take a primcount parameter so that it can correctly validate the call (when used from drawElementsInstanced). (WebCore::WebGLRenderingContext::drawElements): New signature to validate. (WebCore::WebGLRenderingContext::drawArraysInstanced): Rearrange this a bit. The primcount validation is already being done by the validateDrawArrays call. Also, there was a bogus UNUSED_PARAM hanging around. (WebCore::WebGLRenderingContext::drawElementsInstanced): Similar rearrangement. Use the primcount parameter. * html/canvas/WebGLRenderingContext.h: LayoutTests: <rdar://problem/17540398> Reviewed by Simon Fraser. This is a copy of the official webgl/1.0.3 test. * platform/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-out-of-bounds-expected.txt: Added. This extension is not available on Mountain Lion. * fast/canvas/webgl/angle-instanced-arrays-out-of-bounds-expected.txt: Added. * fast/canvas/webgl/angle-instanced-arrays-out-of-bounds.html: Added. * fast/canvas/webgl/resources/out-of-bounds-test.js: Added. (OutOfBoundsTest): Canonical link: https://commits.webkit.org/154760.281@webkitgtk/2.6 git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@178351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
28da89d
commit e4b5df0
Showing
8 changed files
with
892 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
386 changes: 386 additions & 0 deletions
386
LayoutTests/fast/canvas/webgl/angle-instanced-arrays-out-of-bounds-expected.txt
Large diffs are not rendered by default.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
LayoutTests/fast/canvas/webgl/angle-instanced-arrays-out-of-bounds.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<!-- | ||
/* | ||
** Copyright (c) 2014 The Khronos Group Inc. | ||
** | ||
** Permission is hereby granted, free of charge, to any person obtaining a | ||
** copy of this software and/or associated documentation files (the | ||
** "Materials"), to deal in the Materials without restriction, including | ||
** without limitation the rights to use, copy, modify, merge, publish, | ||
** distribute, sublicense, and/or sell copies of the Materials, and to | ||
** permit persons to whom the Materials are furnished to do so, subject to | ||
** the following conditions: | ||
** | ||
** The above copyright notice and this permission notice shall be included | ||
** in all copies or substantial portions of the Materials. | ||
** | ||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. | ||
*/ | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link rel="stylesheet" href="../../../resources/js-test-style.css"/> | ||
<script src="resources/desktop-gl-constants.js" type="text/javascript"></script> | ||
<script src="../../../resources/js-test-pre.js"></script> | ||
<script src="resources/webgl-test.js"> </script> | ||
<script src="resources/webgl-test-utils.js"></script> | ||
<script src="resources/out-of-bounds-test.js"></script> | ||
</head> | ||
<body> | ||
<div id="description"></div> | ||
<canvas id="canvas" style="width: 50px; height: 50px;"></canvas> | ||
<div id="console"></div> | ||
|
||
<script> | ||
"use strict"; | ||
description("Test of drawArraysInstancedANGLE and drawElementsInstancedANGLE with out-of-bounds parameters"); | ||
|
||
var wtu = WebGLTestUtils; | ||
var canvas = document.getElementById("canvas"); | ||
var gl = wtu.create3DContext(canvas); | ||
var ext = wtu.getExtensionWithKnownPrefixes(gl, "ANGLE_instanced_arrays"); | ||
if (!ext) { | ||
testPassed("No ANGLE_instanced_arrays support -- this is legal"); | ||
} else { | ||
testPassed("Successfully enabled ANGLE_instanced_arrays extension"); | ||
debug(""); | ||
debug("Test with 1 instance without instanced attributes"); | ||
debug(""); | ||
OutOfBoundsTest.runDrawArraysTest("ext.drawArraysInstancedANGLE(gl.TRIANGLES, $(offset), $(count), 1)", gl, wtu, ext); | ||
debug(""); | ||
OutOfBoundsTest.runDrawElementsTest("ext.drawElementsInstancedANGLE(gl.TRIANGLES, $(count), $(type), $(offset), 1)", gl, wtu, ext); | ||
debug(""); | ||
debug("Test with 2 instances without instanced attributes"); | ||
debug(""); | ||
OutOfBoundsTest.runDrawArraysTest("ext.drawArraysInstancedANGLE(gl.TRIANGLES, $(offset), $(count), 2)", gl, wtu, ext); | ||
debug(""); | ||
OutOfBoundsTest.runDrawElementsTest("ext.drawElementsInstancedANGLE(gl.TRIANGLES, $(count), $(type), $(offset), 2)", gl, wtu, ext); | ||
debug(""); | ||
OutOfBoundsTest.runDrawArraysInstancedTest("ext.drawArraysInstancedANGLE(gl.TRIANGLES, $(offset), $(count), $(primcount))", gl, wtu, ext); | ||
debug(""); | ||
OutOfBoundsTest.runDrawElementsInstancedTest("ext.drawElementsInstancedANGLE(gl.TRIANGLES, $(count), $(type), $(offset), $(primcount))", gl, wtu, ext); | ||
debug(""); | ||
} | ||
|
||
var successfullyParsed = true; | ||
</script> | ||
|
||
<script src="../../../resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
329 changes: 329 additions & 0 deletions
329
LayoutTests/fast/canvas/webgl/resources/out-of-bounds-test.js
Large diffs are not rendered by default.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
...form/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-out-of-bounds-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Test of drawArraysInstancedANGLE and drawElementsInstancedANGLE with out-of-bounds parameters | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
PASS No ANGLE_instanced_arrays support -- this is legal | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters