Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | <!-- |
michael@0 | 2 | Copyright (c) 2011 The Chromium Authors. All rights reserved. |
michael@0 | 3 | Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | found in the LICENSE file. |
michael@0 | 5 | --> |
michael@0 | 6 | <!DOCTYPE html> |
michael@0 | 7 | <html> |
michael@0 | 8 | <head> |
michael@0 | 9 | <meta charset="utf-8"> |
michael@0 | 10 | <title>WebGL getActiveAttrib conformance test.</title> |
michael@0 | 11 | <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
michael@0 | 12 | <script src="../../resources/js-test-pre.js"></script> |
michael@0 | 13 | <script src="../resources/webgl-test.js"> </script> |
michael@0 | 14 | <script src="../resources/webgl-test-utils.js"> </script> |
michael@0 | 15 | </head> |
michael@0 | 16 | <body> |
michael@0 | 17 | <canvas id="example" width="16" height="16"></canvas> |
michael@0 | 18 | <div id="description"></div> |
michael@0 | 19 | <div id="console"></div> |
michael@0 | 20 | <script id="vshader" type="x-shader/x-vertex"> |
michael@0 | 21 | attribute $type attr0; |
michael@0 | 22 | void main() |
michael@0 | 23 | { |
michael@0 | 24 | gl_Position = vec4(0, 0, 0, attr0$access); |
michael@0 | 25 | } |
michael@0 | 26 | </script> |
michael@0 | 27 | <script id="fshader" type="x-shader/x-fragment"> |
michael@0 | 28 | void main() |
michael@0 | 29 | { |
michael@0 | 30 | gl_FragColor = vec4(0,1,0,1); |
michael@0 | 31 | } |
michael@0 | 32 | </script> |
michael@0 | 33 | <script> |
michael@0 | 34 | description("Tests getActiveAttrib for various types"); |
michael@0 | 35 | |
michael@0 | 36 | var wtu = WebGLTestUtils; |
michael@0 | 37 | var gl = wtu.create3DContext("example"); |
michael@0 | 38 | |
michael@0 | 39 | var tests = [ |
michael@0 | 40 | { glType: gl.FLOAT, size: 1, type: 'float', access: ''}, |
michael@0 | 41 | { glType: gl.FLOAT_VEC2, size: 1, type: 'vec2', access: '[1]'}, |
michael@0 | 42 | { glType: gl.FLOAT_VEC3, size: 1, type: 'vec3', access: '[2]'}, |
michael@0 | 43 | { glType: gl.FLOAT_VEC4, size: 1, type: 'vec4', access: '[3]'}, |
michael@0 | 44 | { glType: gl.FLOAT_MAT2, size: 1, type: 'mat2', access: '[1][1]'}, |
michael@0 | 45 | { glType: gl.FLOAT_MAT3, size: 1, type: 'mat3', access: '[2][2]'}, |
michael@0 | 46 | { glType: gl.FLOAT_MAT4, size: 1, type: 'mat4', access: '[3][3]'}, |
michael@0 | 47 | ]; |
michael@0 | 48 | |
michael@0 | 49 | var source = document.getElementById('vshader').text; |
michael@0 | 50 | var fs = wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER); |
michael@0 | 51 | for (var tt = 0; tt < tests.length; ++tt) { |
michael@0 | 52 | var t = tests[tt]; |
michael@0 | 53 | var vs = wtu.loadShader( |
michael@0 | 54 | gl, |
michael@0 | 55 | source.replace('$type', t.type).replace('$access', t.access), |
michael@0 | 56 | gl.VERTEX_SHADER); |
michael@0 | 57 | var program = wtu.setupProgram(gl, [vs, fs]); |
michael@0 | 58 | glErrorShouldBe(gl, gl.NO_ERROR, "no errors from setup"); |
michael@0 | 59 | var numAttribs = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); |
michael@0 | 60 | var found = false; |
michael@0 | 61 | for (var ii = 0; ii < numAttribs; ++ii) { |
michael@0 | 62 | var info = gl.getActiveAttrib(program, ii); |
michael@0 | 63 | if (info.name == 'attr0') { |
michael@0 | 64 | found = true; |
michael@0 | 65 | assertMsg(info.type == t.glType, |
michael@0 | 66 | "type must be " + wtu.glEnumToString(gl, t.glType) + " was " + |
michael@0 | 67 | wtu.glEnumToString(gl, info.type)); |
michael@0 | 68 | assertMsg(info.size == t.size, |
michael@0 | 69 | "size must be " + t.size + ' was ' + info.size); |
michael@0 | 70 | } |
michael@0 | 71 | } |
michael@0 | 72 | if (!found) { |
michael@0 | 73 | testFailed("attrib 'attr0' not found"); |
michael@0 | 74 | } |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | successfullyParsed = true; |
michael@0 | 78 | </script> |
michael@0 | 79 | <script>finishTest();</script> |
michael@0 | 80 | |
michael@0 | 81 | </body> |
michael@0 | 82 | </html> |
michael@0 | 83 | |
michael@0 | 84 |