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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/textures/texture-transparent-pixels-initialized.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 ** Copyright (c) 2012 The Khronos Group Inc.
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a
6 ** copy of this software and/or associated documentation files (the
7 ** "Materials"), to deal in the Materials without restriction, including
8 ** without limitation the rights to use, copy, modify, merge, publish,
9 ** distribute, sublicense, and/or sell copies of the Materials, and to
10 ** permit persons to whom the Materials are furnished to do so, subject to
11 ** the following conditions:
12 **
13 ** The above copyright notice and this permission notice shall be included
14 ** in all copies or substantial portions of the Materials.
15 **
16 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
23 */
24 -->
25 <!DOCTYPE html>
26 <html>
27 <head>
28 <meta charset="utf-8">
29 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
30 <script src="../../resources/js-test-pre.js"></script>
31 <script src="../resources/webgl-test.js"></script>
32 <script src="../resources/webgl-test-utils.js"></script>
33 <script>
34 var wtu = WebGLTestUtils;
35 var gl = null;
36 var textureLoc = null;
37 var successfullyParsed = false;
38
39 function init()
40 {
41 if (window.initNonKhronosFramework) {
42 window.initNonKhronosFramework(true);
43 }
44
45 description('Tests there is no garbage in transparent regions of images uplo aded as textures');
46
47 wtu = WebGLTestUtils;
48 gl = wtu.create3DContext("example");
49 var program = wtu.setupTexturedQuad(gl);
50 gl.clearColor(0.5,0.5,0.5,1);
51 gl.clearDepth(1);
52
53 textureLoc = gl.getUniformLocation(program, "tex");
54
55 // The input texture has 8 characters; take the leftmost one
56 var coeff = 1.0 / 8.0;
57 var texCoords = new Float32Array([
58 coeff, 1.0,
59 0.0, 1.0,
60 0.0, 0.0,
61 coeff, 1.0,
62 0.0, 0.0,
63 coeff, 0.0]);
64
65 var vbo = gl.createBuffer();
66 gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
67 gl.bufferData(gl.ARRAY_BUFFER, texCoords, gl.STATIC_DRAW);
68 gl.enableVertexAttribArray(1);
69 gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 0, 0);
70
71 texture = wtu.loadTexture(gl, "../resources/bug-32888-texture.png", runTest) ;
72 }
73
74 // These two declarations need to be global for "shouldBe" to see them
75 var buf = null;
76 var idx = 0;
77
78 function runTest()
79 {
80 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
81 gl.enable(gl.BLEND);
82 gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
83 // Bind the texture to texture unit 0
84 gl.bindTexture(gl.TEXTURE_2D, texture);
85 // Point the uniform sampler to texture unit 0
86 gl.uniform1i(textureLoc, 0);
87 // Draw the triangles
88 wtu.drawQuad(gl, [0, 0, 0, 255]);
89
90 // Spot check a couple of 2x2 regions in the upper and lower left
91 // corners; they should be the rgb values in the texture.
92 color = [0, 0, 0];
93 debug("Checking lower left corner");
94 wtu.checkCanvasRect(gl, 1, gl.canvas.height - 3, 2, 2, color,
95 "shouldBe " + color);
96 debug("Checking upper left corner");
97 wtu.checkCanvasRect(gl, 1, 1, 2, 2, color,
98 "shouldBe " + color);
99
100 finishTest();
101 }
102 </script>
103 </head>
104 <body onload="init()">
105 <canvas id="example" width="32px" height="32px"></canvas>
106 <div id="description"></div>
107 <div id="console"></div>
108 </body>
109 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698