From 7ffa9be2e5077261a75b0c77c9aa8d90a842fddd Mon Sep 17 00:00:00 2001 From: Kelsey Gilbert Date: Mon, 29 Jul 2024 13:46:45 -0700 Subject: [PATCH] Also test webgl2-only objects in context-lost.html. (#3678) This is to prevent bugs like: https://bugzilla.mozilla.org/show_bug.cgi?id=1908380 --- sdk/tests/conformance/context/context-lost.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sdk/tests/conformance/context/context-lost.html b/sdk/tests/conformance/context/context-lost.html index e9ef6bdb2..cfec08434 100644 --- a/sdk/tests/conformance/context/context-lost.html +++ b/sdk/tests/conformance/context/context-lost.html @@ -330,14 +330,25 @@ ]; testFunctionsThatReturnNULL(nullTests); - [ + + const nonNullTests = [ [() => gl.createBuffer(), x => gl.bindBuffer(gl.ARRAY_BUFFER, x), x => gl.isBuffer(x)], [() => gl.createFramebuffer(), x => gl.bindFramebuffer(gl.FRAMEBUFFER, x), x => gl.isFramebuffer(x)], [() => gl.createProgram(), x => undefined, x => gl.isProgram(x)], [() => gl.createRenderbuffer(), x => gl.bindRenderbuffer(gl.RENDERBUFFER, x), x => gl.isRenderbuffer(x)], [() => gl.createShader(gl.VERTEX_SHADER), x => undefined, x => gl.isShader(x)], [() => gl.createTexture(), x => gl.bindTexture(gl.TEXTURE_2D, x), x => gl.isTexture(x)], - ].forEach(([fn_create, fn_bind, fn_is]) => { + ]; + if (gl.createVertexArray) { // webgl2 + nonNullTests.push( + // Translate bind(T?) to T ? begin(T) : end(T) for Queries: + [() => gl.createQuery(), x => x ? gl.beginQuery(gl.ANY_SAMPLES_PASSED, x) : gl.endQuery(gl.ANY_SAMPLES_PASSED), x => gl.isQuery(x)], + [() => gl.createSampler(), x => gl.bindSampler(0, x), x => gl.isSampler(x)], + [() => gl.createTransformFeedback(), x => gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, x), x => gl.isTransformFeedback(x)], + [() => gl.createVertexArray(), x => gl.bindVertexArray(x), x => gl.isVertexArray(x)], + ); + } + nonNullTests.forEach(([fn_create, fn_bind, fn_is]) => { const x = fn_create(); assertMsg(x, `${fn_create.toString()} -> non-null`); assertMsg(fn_is(x) === false, `[before bind] ${fn_is.toString()} -> false`);