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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/gl-vertex-attrib-zero-issues.html

Issue 1601093008: Remove duplicated WebGL layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>WebGL Enable Vertex Attrib Zero Test</title>
5 <script src="../../../resources/js-test.js"></script>
6 <script src="resources/webgl-test.js"> </script>
7 <script src="resources/webgl-test-utils.js"> </script>
8 </head>
9 <body>
10 <canvas id="example" width="50" height="50">
11 </canvas>
12 <div id="description"></div>
13 <div id="console"></div>
14 <script id="vshader" type="x-shader/x-vertex">
15 attribute vec4 vPosition;
16 void main()
17 {
18 gl_Position = vPosition;
19 }
20 </script>
21
22 <script id="fshader" type="x-shader/x-fragment">
23 void main()
24 {
25 gl_FragColor = vec4(0.0,0.0,0.0,0.0);
26 }
27 </script>
28
29 <script>
30 description("Test some of the issues of the difference between attrib 0 on OpenG L vs WebGL");
31 debug("");
32 var wtu = WebGLTestUtils;
33 var canvas = document.getElementById("example");
34 var gl = wtu.create3DContext(canvas);
35
36 function setup(numVerts, attribIndex) {
37 var program = wtu.setupProgram(
38 gl,
39 [wtu.loadShaderFromScript(gl, 'vshader', gl.VERTEX_SHADER),
40 wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER)],
41 ['vPosition'], [attribIndex]);
42 // draw with something on attrib zero with a small number of vertices
43 var vertexObject = gl.createBuffer();
44 g_program = program;
45 g_attribLocation = attribIndex;
46 shouldBe("g_attribLocation", "gl.getAttribLocation(g_program, 'vPosition')");
47 gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
48 gl.bufferData(
49 gl.ARRAY_BUFFER, new Float32Array(numVerts * 3), gl.STATIC_DRAW);
50 gl.vertexAttribPointer(attribIndex, 3, gl.FLOAT, false, 0, 0);
51 var indices = new Uint16Array(numVerts);
52 for (var ii = 0; ii < numVerts; ++ii) {
53 indices[ii] = ii;
54 }
55 var indexBuffer = gl.createBuffer();
56 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
57 gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);
58 return program;
59 }
60
61 var p1 = setup(3, 0);
62 var p2 = setup(60000, 3);
63
64 for (var ii = 0; ii < 5; ++ii) {
65 gl.useProgram(p1);
66 gl.enableVertexAttribArray(0);
67 gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_SHORT, 0);
68 glErrorShouldBe(
69 gl, gl.NO_ERROR,
70 "drawing using attrib 0 with 3 verts");
71
72 gl.useProgram(p2);
73 gl.enableVertexAttribArray(3);
74 gl.drawArrays(gl.LINES, 0, 60000);
75 glErrorShouldBe(
76 gl, gl.NO_ERROR,
77 "drawing using attrib 3 with 60000 verts");
78 }
79
80 wtu.checkCanvas(gl, [0, 0, 0, 0], "canvas should be 0, 0, 0, 0");
81 </script>
82
83 <script>
84 </script>
85
86 </body>
87 </html>
88
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698