2 Copyright (c) 2019 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
10 <meta charset=
"utf-8">
11 <title>WebGL Draw With Integer Texture Base Level Tests
</title>
12 <link rel=
"stylesheet" href=
"../../resources/js-test-style.css"/>
13 <script src=
"../../js/js-test-pre.js"></script>
14 <script src=
"../../js/webgl-test-utils.js"></script>
15 <script src=
"../../js/tests/tex-image-and-sub-image-utils.js"></script>
18 <canvas id=
"example" width=
"24" height=
"24"></canvas>
19 <div id=
"description"></div>
20 <div id=
"console"></div>
25 var wtu
= WebGLTestUtils
;
26 canvas
= document
.getElementById("example");
27 var gl
= wtu
.create3DContext(canvas
, undefined, 2);
28 var tiu
= TexImageUtils
;
30 // Both Chrome and Firefox fail on this test on NVIDIA Windows, see crbug.com/679639.
31 function testDrawIntegerTextureBaseLevel()
33 description("This test verifies the functionality of rendering with integer texture non-zero base level.");
35 var green
= [0, 255, 0, 255];
40 canvas
.height
= height
;
41 gl
.viewport(0, 0, width
, height
);
43 var texture
= gl
.createTexture();
45 gl
.bindTexture(gl
.TEXTURE_2D
, texture
);
46 gl
.texParameteri(gl
.TEXTURE_2D
, gl
.TEXTURE_MIN_FILTER
, gl
.NEAREST
);
47 gl
.texParameteri(gl
.TEXTURE_2D
, gl
.TEXTURE_MAG_FILTER
, gl
.NEAREST
);
48 gl
.texParameteri(gl
.TEXTURE_2D
, gl
.TEXTURE_BASE_LEVEL
, level
);
49 wtu
.fillTexture(gl
, texture
, width
, height
, green
, level
, gl
.RGBA_INTEGER
, gl
.UNSIGNED_BYTE
, gl
.RGBA8UI
);
50 wtu
.glErrorShouldBe(gl
, gl
.NO_ERROR
);
52 var program
= tiu
.setupTexturedQuad(gl
, "RGBA8UI");
53 gl
.drawArrays(gl
.TRIANGLES
, 0, 6);
54 wtu
.glErrorShouldBe(gl
, gl
.NO_ERROR
);
55 wtu
.checkCanvas(gl
, green
);
58 testDrawIntegerTextureBaseLevel();
59 var successfullyParsed
= true;
61 <script src=
"../../js/js-test-post.js"></script>