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 <link rel=
"stylesheet" href=
"../../../resources/js-test-style.css"/>
11 <script src=
"../../../js/js-test-pre.js"></script>
12 <script src=
"../../../js/webgl-test-utils.js"></script>
15 <canvas id=
"c" width=
"16" height=
"16"></canvas>
16 <div id=
"description"></div>
17 <div id=
"console"></div>
20 description('Tests texImage2D with invalid internalformat/format/type combinations');
21 debug("This includes a regression test for <a href='https://bugs.chromium.org/p/chromium/issues/detail?id=656889'>Chromium Issue 656889</a>");
23 var wtu
= WebGLTestUtils
;
24 var gl
= wtu
.create3DContext("c", null, 2);
27 testFailed("WebGL context does not exist");
29 testPassed("WebGL context exists");
32 var doTexImage = function(test
) {
33 var tex
= gl
.createTexture();
34 gl
.bindTexture(gl
.TEXTURE_2D
, tex
);
35 gl
.texImage2D(gl
.TEXTURE_2D
, 0, test
.internalformat
, 64, 64, 0, test
.format
, test
.type
, null);
36 wtu
.glErrorShouldBe(gl
, test
.errors
, "TexImage2D taking " + wtu
.glEnumToString(gl
, test
.internalformat
) + "/" +
37 wtu
.glEnumToString(gl
, test
.format
) + "/" + wtu
.glEnumToString(gl
, test
.type
));
38 gl
.deleteTexture(tex
);
42 { internalformat
: gl
.RGBA
, format
: gl
.RGBA
, type
: gl
.UNSIGNED_BYTE
, errors
: [gl
.NO_ERROR
] },
43 { internalformat
: gl
.RGBA
, format
: gl
.RGBA
, type
: gl
.FLOAT
, errors
: [gl
.INVALID_OPERATION
] },
44 { internalformat
: gl
.RGBA
, format
: gl
.RGBA
, type
: gl
.HALF_FLOAT
, errors
: [gl
.INVALID_OPERATION
] },
45 { internalformat
: gl
.LUMINANCE
, format
: gl
.LUMINANCE
, type
: gl
.FLOAT
, errors
: [gl
.INVALID_OPERATION
] },
46 { internalformat
: gl
.LUMINANCE_ALPHA
, format
: gl
.LUMINANCE_ALPHA
, type
: gl
.HALF_FLOAT
, errors
: [gl
.INVALID_OPERATION
] },
47 { internalformat
: 0x822A /*GL_R16_EXT*/ , format
: gl
.RED
, type
: gl
.UNSIGNED_SHORT
, errors
: [gl
.INVALID_VALUE
, gl
.INVALID_OPERATION
] },
48 { internalformat
: gl
.RED
, format
: gl
.RED
, type
: gl
.UNSIGNED_SHORT
, errors
: [gl
.INVALID_VALUE
, gl
.INVALID_OPERATION
] },
51 tests
.forEach(doTexImage
);
53 var successfullyParsed
= true;
55 <script src=
"../../../js/js-test-post.js"></script>