Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: third_party/webgl/sdk/tests/conformance/rendering/draw-arrays-out-of-bounds.html

Issue 10399113: Roll webgl conformance tests to r17874: part 2, adding r17874 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!--
2
3 /*
4 ** Copyright (c) 2012 The Khronos Group Inc.
5 **
6 ** Permission is hereby granted, free of charge, to any person obtaining a
7 ** copy of this software and/or associated documentation files (the
8 ** "Materials"), to deal in the Materials without restriction, including
9 ** without limitation the rights to use, copy, modify, merge, publish,
10 ** distribute, sublicense, and/or sell copies of the Materials, and to
11 ** permit persons to whom the Materials are furnished to do so, subject to
12 ** the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included
15 ** in all copies or substantial portions of the Materials.
16 **
17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
24 */
25
26 -->
27
28 <!DOCTYPE html>
29 <html>
30 <head>
31 <meta charset="utf-8">
32 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
33 <script src="../../resources/js-test-pre.js"></script>
34 <script src="../resources/webgl-test.js"></script>
35 </head>
36 <body>
37 <div id="description"></div>
38 <div id="console"></div>
39
40 <script>
41 description("Test of drawArrays with out-of-bounds parameters");
42
43 var context = create3DContext();
44 var program = loadStandardProgram(context);
45
46 context.useProgram(program);
47 var vertexObject = context.createBuffer();
48 context.bindBuffer(context.ARRAY_BUFFER, vertexObject);
49 context.enableVertexAttribArray(0);
50
51 debug("Test empty buffer")
52 context.bufferData(context.ARRAY_BUFFER, new Float32Array([ ]), context.STATIC_ DRAW);
53 context.vertexAttribPointer(0, 3, context.FLOAT, false, 0, 0);
54 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawArrays(co ntext.TRIANGLES, 0, 1)");
55 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawArrays(co ntext.TRIANGLES, 0, 10000)");
56 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawArrays(co ntext.TRIANGLES, 0, 10000000000000)");
57 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, 0, -1)");
58 shouldGenerateGLError(context, context.NO_ERROR, "context.drawArrays(context.TRI ANGLES, 1, 0)");
59 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, -1, 0)");
60 shouldGenerateGLError(context, context.NO_ERROR, "context.drawArrays(context.TRI ANGLES, 0, 0)");
61 shouldGenerateGLError(context, context.NO_ERROR, "context.drawArrays(context.TRI ANGLES, 100, 0)");
62 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, 1, -1)");
63 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, -1, 1)");
64
65 debug("")
66 debug("Test buffer with 3 float vectors")
67 context.bufferData(context.ARRAY_BUFFER, new Float32Array([ 0,0.5,0, -0.5,-0.5,0 , 0.5,-0.5,0 ]), context.STATIC_DRAW);
68 context.vertexAttribPointer(0, 3, context.FLOAT, false, 0, 0);
69 shouldGenerateGLError(context, context.NO_ERROR, "context.drawArrays(context.TRI ANGLES, 0, 3)");
70 shouldGenerateGLError(context, context.INVALID_ENUM, "context.drawArrays(0x0009, 0, 3)"); // GL_POLYGON
71 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawArrays(co ntext.TRIANGLES, 3, 2)");
72 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawArrays(co ntext.TRIANGLES, 0, 10000)");
73 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawArrays(co ntext.TRIANGLES, 0, 10000000000000)");
74 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, 0, -1)");
75 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, -1, 0)");
76 shouldGenerateGLError(context, context.NO_ERROR, "context.drawArrays(context.TRI ANGLES, 0, 0)");
77 shouldGenerateGLError(context, context.NO_ERROR, "context.drawArrays(context.TRI ANGLES, 100, 0)");
78 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, 1, -1)");
79 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, -1, 1)");
80
81 debug("")
82 debug("Test buffer with interleaved (3+2) float vectors")
83
84 var program2 = createProgram(context,
85 "attribute vec3 aOne;" +
86 "attribute vec2 aTwo;" +
87 "void main() { gl_Position = vec4(aOne, 1.0) + vec4 (aTwo, 0.0, 1.0); }",
88 "void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1 .0); }",
89 [ "aOne", "aTwo" ]);
90 if (!program2) {
91 testFailed("failed to create test program");
92 }
93
94 context.useProgram(program2);
95
96 var vbo = context.createBuffer();
97 context.bindBuffer(context.ARRAY_BUFFER, vbo);
98 // enough for 9 vertices, so 3 triangles
99 context.bufferData(context.ARRAY_BUFFER, new Float32Array(9*5), context.STATIC_D RAW);
100
101 // bind first 3 elements, with a stride of 5 float elements
102 context.vertexAttribPointer(0, 3, context.FLOAT, false, 5*4, 0);
103 // bind 2 elements, starting after the first 3; same stride of 5 float elements
104 context.vertexAttribPointer(1, 2, context.FLOAT, false, 5*4, 3*4);
105
106 context.enableVertexAttribArray(0);
107 context.enableVertexAttribArray(1);
108
109 shouldGenerateGLError(context, context.NO_ERROR, "context.drawArrays(context.TRI ANGLES, 0, 9)");
110
111 // negative values must generate INVALID_VALUE; they can never be valid
112 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, 0, -500)");
113 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, -200, 1)");
114 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, -200, -500)");
115
116 // 0xffffffff needs to convert to a 'long' IDL argument as -1, as per
117 // WebIDL 4.1.7. JS ToInt32(0xffffffff) == -1, which is the first step
118 // of the conversion. Thus INVALID_VALUE.
119 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, 0, 0xffffffff)");
120 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, 0xffffffff, 1)");
121 shouldGenerateGLError(context, context.INVALID_VALUE, "context.drawArrays(contex t.TRIANGLES, 0xffffffff, 0xffffffff)");
122
123 // values that could otherwise be valid but aren't due to bindings generate
124 // INVALID_OPERATION
125 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawArrays(co ntext.TRIANGLES, 0, 200)");
126 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawArrays(co ntext.TRIANGLES, 0, 0x7fffffff)");
127 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawArrays(co ntext.TRIANGLES, 0x7fffffff, 1)");
128 shouldGenerateGLError(context, context.INVALID_OPERATION, "context.drawArrays(co ntext.TRIANGLES, 0x7fffffff, 0x7fffffff)");
129
130 debug("")
131 successfullyParsed = true;
132 </script>
133
134 <script src="../../resources/js-test-post.js"></script>
135 </body>
136 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698