Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test for the creation of RGBA16UI textures with UNPACK_PREMULTIPLY_ALPHA_WEBGL enabled for chromium issue 40929470 #3660

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,48 @@
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}

function runPremultiplyAlphaForRGBA16UITest() {
debug("");
debug("Test texImage2D RGBA16UI with premultiply_alpha = true for chromium issue 40929470");

var width = 16, height = 16;

// Restore default values except for UNPACK_PREMULTIPLY_ALPHA_WEBGL which is set to true
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
gl.pixelStorei(gl.UNPACK_ROW_LENGTH, 0);
gl.pixelStorei(gl.UNPACK_IMAGE_HEIGHT, 0);
gl.pixelStorei(gl.UNPACK_SKIP_PIXELS, 0);
gl.pixelStorei(gl.UNPACK_SKIP_ROWS, 0);
gl.pixelStorei(gl.UNPACK_SKIP_IMAGES, 0);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

var data = new Uint16Array(width * height * 4);

var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16UI, width, height, 0, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, data);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "texImage2D RGBA16UI works with PREMULTIPLY_ALPHA = true");

// Restore default values.
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
gl.pixelStorei(gl.UNPACK_ROW_LENGTH, 0);
gl.pixelStorei(gl.UNPACK_IMAGE_HEIGHT, 0);
gl.pixelStorei(gl.UNPACK_SKIP_PIXELS, 0);
gl.pixelStorei(gl.UNPACK_SKIP_ROWS, 0);
gl.pixelStorei(gl.UNPACK_SKIP_IMAGES, 0);
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
}

var gl = wtu.create3DContext("example", undefined, 2);
if (!gl) {
testFailed("Fail to get a WebGL context");
} else {
runTests(gl);
runNegativeTests(gl);
runRegressionTests(gl);
runPremultiplyAlphaForRGBA16UITest(gl);
}

debug("");
Expand Down
Loading