mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
124 lines
4.2 KiB
HTML
124 lines
4.2 KiB
HTML
<!--
|
|
Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are
|
|
met:
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
* Redistributions in binary form must reproduce the above
|
|
copyright notice, this list of conditions and the following disclaimer
|
|
in the documentation and/or other materials provided with the
|
|
distribution.
|
|
* Neither the name of Google Inc. nor the names of its
|
|
contributors may be used to endorse or promote products derived from
|
|
this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
-->
|
|
<html>
|
|
<head>
|
|
<link rel="stylesheet" href="../resources/js-test-style.css"/>
|
|
<script src="../resources/js-test-pre.js"></script>
|
|
<script src="resources/webgl-test.js"></script>
|
|
<script src="resources/webgl-test-utils.js"></script>
|
|
<script>
|
|
var wtu = WebGLTestUtils;
|
|
var gl = null;
|
|
var textureLoc = null;
|
|
var successfullyParsed = false;
|
|
|
|
function init()
|
|
{
|
|
if (window.initNonKhronosFramework) {
|
|
window.initNonKhronosFramework(true);
|
|
}
|
|
|
|
description('Tests there is no garbage in transparent regions of images uploaded as textures');
|
|
|
|
wtu = WebGLTestUtils;
|
|
var canvas = document.getElementById("example");
|
|
gl = wtu.create3DContext(canvas);
|
|
var program = wtu.setupTexturedQuad(gl);
|
|
gl.clearColor(0.5,0.5,0.5,1);
|
|
gl.clearDepth(1);
|
|
|
|
textureLoc = gl.getUniformLocation(program, "tex");
|
|
|
|
// The input texture has 8 characters; take the leftmost one
|
|
var coeff = 1.0 / 8.0;
|
|
var texCoords = new Float32Array([
|
|
coeff, 1.0,
|
|
0.0, 1.0,
|
|
0.0, 0.0,
|
|
coeff, 1.0,
|
|
0.0, 0.0,
|
|
coeff, 0.0]);
|
|
|
|
var vbo = gl.createBuffer();
|
|
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
|
|
gl.bufferData(gl.ARRAY_BUFFER, texCoords, gl.STATIC_DRAW);
|
|
gl.enableVertexAttribArray(1);
|
|
gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 0, 0);
|
|
|
|
texture = wtu.loadTexture(gl, "resources/bug-32888-texture.png", runTest);
|
|
}
|
|
|
|
// These two declarations need to be global for "shouldBe" to see them
|
|
var buf = null;
|
|
var idx = 0;
|
|
|
|
function runTest()
|
|
{
|
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
gl.enable(gl.BLEND);
|
|
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
// Bind the texture to texture unit 0
|
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
// Point the uniform sampler to texture unit 0
|
|
gl.uniform1i(textureLoc, 0);
|
|
// Draw the triangles
|
|
wtu.drawQuad(gl, [0, 0, 0, 255]);
|
|
|
|
// Spot check a couple of 2x2 regions in the upper and lower left
|
|
// corners; they should be the rgb values in the texture.
|
|
color = [0, 0, 0];
|
|
debug("Checking lower left corner");
|
|
wtu.checkCanvasRect(gl, 1, gl.canvas.height - 3, 2, 2, color,
|
|
"shouldBe " + color);
|
|
debug("Checking upper left corner");
|
|
wtu.checkCanvasRect(gl, 1, 1, 2, 2, color,
|
|
"shouldBe " + color);
|
|
|
|
successfullyParsed = true;
|
|
var epilogue = document.createElement("script");
|
|
epilogue.onload = finish;
|
|
epilogue.src = "../resources/js-test-post.js";
|
|
document.body.appendChild(epilogue);
|
|
}
|
|
|
|
function finish() {
|
|
if (window.nonKhronosFrameworkNotifyDone) {
|
|
window.nonKhronosFrameworkNotifyDone();
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="init()">
|
|
<canvas id="example" width="32px" height="32px"></canvas>
|
|
<div id="description"></div>
|
|
<div id="console"></div>
|
|
</body>
|
|
</html>
|