Skip to content

Commit

Permalink
Update mipmapped NPOT compressed texture expectations. (KhronosGroup#…
Browse files Browse the repository at this point in the history
…3307)

WebGL 1.0's NPOT texture support is limited to textures without any
mip levels. Expect that the newly added RGTC and BPTC NPOT test from
PR KhronosGroup#3304 generates an error on WebGL 1.0, and no error on WebGL 2.0.

Also change the expectation of an S3TC and S3TC-sRGB subtest which was
not following the new constraints that the size of the implied base
mip level must be a multiple of the block size.

Associated with ANGLE bug https://crbug.com/angleproject/6245 and
Issue KhronosGroup#3117.
  • Loading branch information
kenrussell authored Aug 6, 2021
1 parent 6e9256f commit 25667dd
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@
// Test TexImage validation on level dimensions combinations.
// When level equals 0, width and height must be a multiple of 4.
// When level is larger than 0, this constraint doesn't apply.

let npotExpectation, npotMessage;
if (contextVersion >= 2) {
npotExpectation = gl.NO_ERROR;
npotMessage = "valid";
} else {
npotExpectation = gl.INVALID_VALUE;
npotMessage = "invalid";
}

ctu.testTexImageLevelDimensions(gl, ext, validFormats, expectedByteLength, getBlockDimensions,
[
{ level: 0, width: 4, height: 3,
Expand All @@ -96,7 +106,7 @@
{ level: 1, width: 2, height: 2,
expectation: gl.NO_ERROR, message: "implied base mip 4x4 is valid" },
{ level: 2, width: 1, height: 3,
expectation: gl.NO_ERROR, message: "implied base mip 4x12 is valid" },
expectation: npotExpectation, message: "implied base mip 4x12 is " + npotMessage },
]);

// Test that BPTC enums are not accepted by texImage2D
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@
// Test TexImage validation on level dimensions combinations.
// When level equals 0, width and height must be a multiple of 4.
// When level is larger than 0, this constraint doesn't apply.

let npotExpectation, npotMessage;
if (contextVersion >= 2) {
npotExpectation = gl.NO_ERROR;
npotMessage = "valid";
} else {
npotExpectation = gl.INVALID_VALUE;
npotMessage = "invalid";
}

ctu.testTexImageLevelDimensions(gl, ext, validFormats, expectedByteLength, getBlockDimensions,
[
{ level: 0, width: 4, height: 3,
Expand All @@ -101,7 +111,7 @@
{ level: 1, width: 2, height: 2,
expectation: gl.NO_ERROR, message: "implied base mip 4x4 is valid" },
{ level: 2, width: 1, height: 3,
expectation: gl.NO_ERROR, message: "implied base mip 4x12 is valid" },
expectation: npotExpectation, message: "implied base mip 4x12 is " + npotMessage },
]);

// Test that RGTC enums are not accepted by texImage2D
Expand Down
6 changes: 4 additions & 2 deletions sdk/tests/conformance/extensions/s3tc-and-rgtc.html
Original file line number Diff line number Diff line change
Expand Up @@ -833,14 +833,16 @@
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "invalid dimensions");

if (width == 4) {
// The width/height of the implied base level must be a multiple of the block size.
gl.compressedTexImage2D(gl.TEXTURE_2D, 1, format, 1, height, 0, data);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "valid dimensions for level > 0");
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "invalid dimensions for level > 0");
gl.compressedTexImage2D(gl.TEXTURE_2D, 1, format, 2, height, 0, data);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "valid dimensions for level > 0");
}
if (height == 4) {
// The width/height of the implied base level must be a multiple of the block size.
gl.compressedTexImage2D(gl.TEXTURE_2D, 1, format, width, 1, 0, data);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "valid dimensions for level > 0");
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "invalid dimensions for level > 0");
gl.compressedTexImage2D(gl.TEXTURE_2D, 1, format, width, 2, 0, data);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "valid dimensions for level > 0");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,14 +683,16 @@
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "invalid dimensions");

if (width == 4) {
// The width/height of the implied base level must be a multiple of the block size.
gl.compressedTexImage2D(gl.TEXTURE_2D, 1, format, 1, height, 0, data);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "valid dimensions for level > 0");
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "invalid dimensions for level > 0");
gl.compressedTexImage2D(gl.TEXTURE_2D, 1, format, 2, height, 0, data);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "valid dimensions for level > 0");
}
if (height == 4) {
// The width/height of the implied base level must be a multiple of the block size.
gl.compressedTexImage2D(gl.TEXTURE_2D, 1, format, width, 1, 0, data);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "valid dimensions for level > 0");
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION, "invalid dimensions for level > 0");
gl.compressedTexImage2D(gl.TEXTURE_2D, 1, format, width, 2, 0, data);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "valid dimensions for level > 0");
}
Expand Down

0 comments on commit 25667dd

Please sign in to comment.