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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/uniforms/uniform-samplers-test.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 sampler uniforms conformance test.</title>
33 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
34 <script src="../../resources/js-test-pre.js"></script>
35 <script src="../resources/webgl-test.js"> </script>
36 <script src="../resources/webgl-test-utils.js"></script>
37 </head>
38 <body>
39 <canvas id="example" width="2" height="2" style="width: 40px; height: 40px;"></c anvas>
40 <div id="description"></div>
41 <div id="console"></div>
42
43 <script>
44 function init()
45 {
46 if (window.initNonKhronosFramework) {
47 window.initNonKhronosFramework(false);
48 }
49
50 description(
51 "Tests that only Uniform1i and Uniform1iv can be used to set" +
52 "sampler uniforms.");
53
54 var canvas2d = document.getElementById("canvas2d");
55
56 var wtu = WebGLTestUtils;
57 gl = wtu.create3DContext("example");
58 var program = wtu.setupTexturedQuad(gl);
59
60 var textureLoc = gl.getUniformLocation(program, "tex");
61
62 gl.uniform1i(textureLoc, 1);
63 glErrorShouldBe(gl, gl.NO_ERROR,
64 "uniform1i can set a sampler uniform");
65 gl.uniform1iv(textureLoc, [1]);
66 glErrorShouldBe(gl, gl.NO_ERROR,
67 "uniform1iv can set a sampler uniform");
68 gl.uniform1f(textureLoc, 1);
69 glErrorShouldBe(gl, gl.INVALID_OPERATION,
70 "uniform1f returns INVALID_OPERATION if attempting to set a sampler uniform");
71 gl.uniform1fv(textureLoc, [1]);
72 glErrorShouldBe(gl, gl.INVALID_OPERATION,
73 "uniform1fv returns INVALID_OPERATION if attempting to set a sampler uniform");
74
75 var maxTextureUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
76
77 var success = true;
78 for (var ii = 0; ii < maxTextureUnits; ++ii) {
79 gl.uniform1i(textureLoc, ii);
80 success = success && (gl.getError() == gl.NO_ERROR);
81 }
82 expectTrue(success, "uniform1i works for any valid texture unit");
83
84 var success = true;
85 for (var ii = 0; ii < maxTextureUnits; ++ii) {
86 gl.uniform1iv(textureLoc, [ii]);
87 success = success && (gl.getError() == gl.NO_ERROR);
88 }
89 expectTrue(success, "uniform1iv works for any valid texture unit");
90
91 var success = true;
92 for (var ii = maxTextureUnits; ii < 0x10000; ++ii) {
93 gl.uniform1i(textureLoc, ii);
94 success = success && (gl.getError() == gl.INVALID_VALUE);
95 }
96 expectTrue(success, "uniform1i generates INVALID_VALUE for invalid texture uni ts");
97
98 var success = true;
99 for (var ii = maxTextureUnits; ii < 0x10000; ++ii) {
100 gl.uniform1iv(textureLoc, [ii]);
101 success = success && (gl.getError() == gl.INVALID_VALUE);
102 }
103 expectTrue(success, "uniform1iv generates INVALID_VALUE for invalid texture un its");
104
105 }
106
107 init();
108 successfullyParsed = true;
109 </script>
110 <script src="../../resources/js-test-post.js"></script>
111 </body>
112 </html>
113
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698