6 Copyright (c) 2019 The Khronos Group Inc.
7 Use of this source code is governed by an MIT-style license that can be
8 found in the LICENSE.txt file.
10 <link rel=
"stylesheet" type=
"text/css" href=
"../unit.css" />
11 <script type=
"application/javascript" src=
"../unit.js"></script>
12 <script type=
"application/javascript" src=
"../util.js"></script>
13 <script type=
"application/javascript">
15 Tests.startUnit = function () {
16 var canvas = document.getElementById('gl');
17 var gl = wrapGLContext(getGLContext(canvas));
21 Tests.setup = function(gl) {
22 var tex = gl.createTexture();
23 gl.bindTexture(gl.TEXTURE_2D, tex);
24 var texCubeMap = gl.createTexture();
25 gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCubeMap);
29 Tests.teardown = function(gl,tex,texCubeMap) {
30 gl.bindTexture(gl.TEXTURE_2D, null);
31 gl.deleteTexture(tex);
32 gl.bindTexture(gl.TEXTURE_CUBE_MAP, null);
33 gl.deleteTexture(texCubeMap);
36 Tests.testTexSubImage2D = function(gl) {
37 gl.texImage2D(gl.TEXTURE_2D,
0, gl.RGBA,
2,
2,
0,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0]));
38 gl.texSubImage2D(gl.TEXTURE_2D,
0,
0,
0,
1,
1,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0]));
39 gl.texSubImage2D(gl.TEXTURE_2D,
0,
0,
0,
2,
1,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0,
0,
0,
0,
0]));
40 gl.texSubImage2D(gl.TEXTURE_2D,
0,
0,
0,
1,
2,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0,
0,
0,
0,
0]));
41 gl.texSubImage2D(gl.TEXTURE_2D,
0,
1,
0,
1,
1,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0]));
42 gl.texSubImage2D(gl.TEXTURE_2D,
0,
0,
1,
1,
1,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0]));
43 gl.texSubImage2D(gl.TEXTURE_2D,
0,
1,
1,
1,
1,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0]));
44 gl.texImage2D(gl.TEXTURE_2D,
1,gl.RGBA,
1,
1,
0,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0]));
45 gl.texSubImage2D(gl.TEXTURE_2D,
1,
0,
0,
1,
1,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0]));
48 gl.TEXTURE_CUBE_MAP_POSITIVE_X,
49 gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
50 gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
51 gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
52 gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
53 gl.TEXTURE_CUBE_MAP_NEGATIVE_Z
55 valid_targets.forEach(function(t) {
57 gl.texImage2D(t,
0, gl.RGBA,
1,
1,
0,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0]));
58 gl.texSubImage2D(t,
0,
0,
0,
1,
1,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array([
0,
0,
0,
0]));
63 Tests.endUnit = function(gl) {
67 <style>canvas{ position:absolute; }
</style>
69 <canvas id=
"gl" width=
"16" height=
"16"></canvas>