| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 3 Use of this source code is governed by a BSD-style license that can be | |
| 4 found in the LICENSE file. | |
| 5 --> | |
| 6 <!DOCTYPE html> | |
| 7 <html> | |
| 8 <head> | |
| 9 <meta charset="utf-8"> | |
| 10 <title>WebGL sampler uniforms conformance test.</title> | |
| 11 <link rel="stylesheet" href="../resources/js-test-style.css"/> | |
| 12 <script src="../resources/js-test-pre.js"></script> | |
| 13 <script src="resources/webgl-test.js"> </script> | |
| 14 <script src="resources/webgl-test-utils.js"></script> | |
| 15 </head> | |
| 16 <body> | |
| 17 <canvas id="example" width="2" height="2" style="width: 40px; height: 40px;"></c
anvas> | |
| 18 <div id="description"></div> | |
| 19 <div id="console"></div> | |
| 20 | |
| 21 <script> | |
| 22 function init() | |
| 23 { | |
| 24 if (window.initNonKhronosFramework) { | |
| 25 window.initNonKhronosFramework(false); | |
| 26 } | |
| 27 | |
| 28 debug("Tests that only Uniform1i and Uniform1iv can be used to set"); | |
| 29 debug("sampler uniforms."); | |
| 30 debug(""); | |
| 31 | |
| 32 var canvas2d = document.getElementById("canvas2d"); | |
| 33 | |
| 34 var wtu = WebGLTestUtils; | |
| 35 var canvas = document.getElementById("example"); | |
| 36 gl = wtu.create3DContext(canvas); | |
| 37 var program = wtu.setupTexturedQuad(gl); | |
| 38 | |
| 39 var textureLoc = gl.getUniformLocation(program, "tex"); | |
| 40 | |
| 41 gl.uniform1i(textureLoc, 1); | |
| 42 glErrorShouldBe(gl, gl.NO_ERROR, | |
| 43 "uniform1i can set a sampler uniform"); | |
| 44 gl.uniform1iv(textureLoc, [1]); | |
| 45 glErrorShouldBe(gl, gl.NO_ERROR, | |
| 46 "uniform1iv can set a sampler uniform"); | |
| 47 gl.uniform1f(textureLoc, 1); | |
| 48 glErrorShouldBe(gl, gl.INVALID_OPERATION, | |
| 49 "uniform1f returns INVALID_OPERATION if attempting to set a sampler
uniform"); | |
| 50 gl.uniform1fv(textureLoc, [1]); | |
| 51 glErrorShouldBe(gl, gl.INVALID_OPERATION, | |
| 52 "uniform1fv returns INVALID_OPERATION if attempting to set a sampler
uniform"); | |
| 53 } | |
| 54 | |
| 55 init(); | |
| 56 successfullyParsed = true; | |
| 57 </script> | |
| 58 <script src="../resources/js-test-post.js"></script> | |
| 59 </body> | |
| 60 </html> | |
| 61 | |
| OLD | NEW |