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

Side by Side Diff: third_party/webgl/sdk/tests/extra/out-of-bounds-uniform-array-access.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 <title>WebGL ouf of bounds uniform array access.</title>
33 <link rel="stylesheet" href="../resources/js-test-style.css"/>
34 <script src="../resources/js-test-pre.js"></script>
35 <script src="../conformance/resources/webgl-test-utils.js"> </script>
36 </head>
37 <body style="background: #666;">
38 <div id="description"></div>
39 <div id="console"></div>
40 <div>elem mult: <span id="elemMultDisplay"></span></div>
41 <input type="range" id="elemMult" value="4" min="0" max="2048" style="width: 100 %;"/>
42 <div>line width: <span id="lineWidthDisplay"></span></div>
43 <input type="range" id="lineWidth" value="512" min="0" max="2540" style="width: 100%;"/>
44 <canvas id="example" width="256" height="256" style="background: black;">
45 </canvas>
46 <script id="vshader" type="x-shader/x-vertex">
47 attribute vec4 vPosition;
48 varying vec4 v_color;
49 uniform float lineWidth;
50 uniform int elemMult;
51 uniform vec4 someArray[2];
52 void main()
53 {
54 vec2 texcoord = vec2(vPosition.xy * 0.5 + vec2(0.5, 0.5));
55 int index = int(texcoord.x + texcoord.y * lineWidth) * elemMult;
56 v_color = someArray[index];
57 gl_Position = vPosition;
58 }
59 </script>
60
61 <script id="fshader" type="x-shader/x-fragment">
62 precision mediump float;
63 varying vec4 v_color;
64 void main()
65 {
66 gl_FragColor = v_color * vec4(1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256 .0) + vec4(0,0,0,0.5);
67 }
68 </script>
69 <script>
70 window.onload = main;
71 debug("Tests a WebGL program that accesses out of bounds uniform array elements" );
72
73 function main() {
74 var wtu = WebGLTestUtils;
75 var gl = wtu.create3DContext("example");
76 var program = wtu.setupProgram(
77 gl,
78 ['vshader', 'fshader'],
79 ['vPosition'], [0]);
80 var gridRes = 255;
81 wtu.setupQuad(gl, gridRes, 0);
82 var lineWidthLoc = gl.getUniformLocation(program, "lineWidth");
83 var elemMultLoc = gl.getUniformLocation(program, "elemMult");
84 assertMsg(gl.getError() == gl.NO_ERROR, "Should be no errors from setup.");
85
86 var lineWidth = 512;
87 var lineWidthElem = document.getElementById("lineWidth");
88 var lineWidthDisplayElem = document.getElementById("lineWidthDisplay");
89
90 lineWidthElem.value = lineWidth;
91
92 lineWidthElem.addEventListener('change', function(event) {
93 //console.log(event.target.value);
94 lineWidth = event.target.value;
95 draw();
96 }, false);
97
98 var elemMult = 4;
99 var elemMultElem = document.getElementById("elemMult");
100 var elemMultDisplayElem = document.getElementById("elemMultDisplay");
101
102 elemMultElem.value = elemMult;
103
104 elemMultElem.addEventListener('change', function(event) {
105 //console.log(event.target.value);
106 elemMult = event.target.value;
107 draw();
108 }, false);
109
110 draw();
111
112 function draw() {
113 lineWidthDisplayElem.innerText = lineWidth;
114 elemMultDisplayElem.innerText = elemMult;
115 gl.uniform1f(lineWidthLoc, lineWidth);
116 gl.uniform1i(elemMultLoc, elemMult);
117 gl.drawElements(gl.TRIANGLES, gridRes * gridRes * 6, gl.UNSIGNED_SHORT, 0);
118 }
119
120 successfullyParsed = true;
121 }
122
123 </script>
124 </body>
125 </html>
126
127
OLDNEW
« no previous file with comments | « third_party/webgl/sdk/tests/extra/offscreen-issue.html ('k') | third_party/webgl/sdk/tests/extra/out-of-memory.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698