From 536f0c955e3cf1346e63900e02b5ed4264859606 Mon Sep 17 00:00:00 2001 From: Alexey Knyazev <3479527+lexaknyazev@users.noreply.github.com> Date: Thu, 30 Jul 2026 00:00:00 +0000 Subject: [PATCH] WEBGL_shader_pixel_local_storage: Update tests --- .../webgl-shader-pixel-local-storage.html | 336 +++++++++++++----- 1 file changed, 240 insertions(+), 96 deletions(-) diff --git a/sdk/tests/conformance2/extensions/webgl-shader-pixel-local-storage.html b/sdk/tests/conformance2/extensions/webgl-shader-pixel-local-storage.html index fe22f3468..dc6ca666f 100644 --- a/sdk/tests/conformance2/extensions/webgl-shader-pixel-local-storage.html +++ b/sdk/tests/conformance2/extensions/webgl-shader-pixel-local-storage.html @@ -35,7 +35,7 @@ }`; function arraysEqual(a, b) { - if (typeof a !== typeof b) + if (a.constructor !== b.constructor) return false; if (a.length != b.length) return false; @@ -68,6 +68,7 @@ checkEnums(); checkImplementationDependentLimits(); checkInitialValues(); + checkFrontendValidation(); checkWebGLNonNormativeBehavior(); await checkRendering(gl); @@ -87,7 +88,7 @@ shouldBeNull( "gl.getParameter(0x96E2 /*PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL*/)"); wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "parameter unknown without enabling the extension"); - wtu.glErrorShouldBe(gl, gl.NONE); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); } function checkDependencyExtensionsEnabled(enabled) { @@ -95,7 +96,7 @@ (enabled ? "enabled" : "disabled")); if (wtu.getSupportedExtensionWithKnownPrefixes(gl, "OES_draw_buffers_indexed") !== undefined) { gl.getIndexedParameter(gl.BLEND_EQUATION_RGB, 1); - wtu.glErrorShouldBe(gl, enabled ? gl.NONE : gl.INVALID_ENUM, + wtu.glErrorShouldBe(gl, enabled ? gl.NO_ERROR : gl.INVALID_ENUM, "OES_draw_buffers_indexed not enabled or disabled as expected"); } { @@ -138,77 +139,220 @@ gl.getParameter(pls.MAX_PIXEL_LOCAL_STORAGE_PLANES_WEBGL); window.MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES = gl.getParameter(pls.MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES_WEBGL); - wtu.glErrorShouldBe(gl, gl.NONE, "Pixel local storage queries should be supported."); + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Pixel local storage queries should be supported."); window.MAX_COLOR_ATTACHMENTS = gl.getParameter(gl.MAX_COLOR_ATTACHMENTS); window.MAX_DRAW_BUFFERS = gl.getParameter(gl.MAX_DRAW_BUFFERS); - // Table 6.X: Impementation Dependent Pixel Local Storage Limits. - shouldBeTrue("MAX_PIXEL_LOCAL_STORAGE_PLANES >= 4"); - shouldBeTrue("MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES >= 4"); + // Table 6.X: Implementation Dependent Pixel Local Storage Limits. + shouldBeGreaterThanOrEqual("MAX_PIXEL_LOCAL_STORAGE_PLANES", "4"); + shouldBeGreaterThanOrEqual("MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES", "4"); // Logical deductions based on 6.X. - shouldBeTrue(`MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES >= - MAX_PIXEL_LOCAL_STORAGE_PLANES`); - shouldBeTrue(`MAX_COLOR_ATTACHMENTS + MAX_PIXEL_LOCAL_STORAGE_PLANES >= - MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES`); - shouldBeTrue(`MAX_DRAW_BUFFERS + MAX_PIXEL_LOCAL_STORAGE_PLANES >= - MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES`); + shouldBeGreaterThanOrEqual("MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES", + "MAX_PIXEL_LOCAL_STORAGE_PLANES"); + shouldBeGreaterThanOrEqual("MAX_COLOR_ATTACHMENTS + MAX_PIXEL_LOCAL_STORAGE_PLANES", + "MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES"); + shouldBeGreaterThanOrEqual("MAX_DRAW_BUFFERS + MAX_PIXEL_LOCAL_STORAGE_PLANES", + "MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES"); } function checkInitialValues() { debug("\nCheck that PLS state has the correct initial values."); - shouldBeTrue("gl.getParameter(pls.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL) == 0"); + shouldBe("gl.getParameter(pls.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL)", "0"); wtu.glErrorShouldBe( - gl, gl.NONE, + gl, gl.NO_ERROR, "It's valid to query GL_PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL even when fbo 0 is bound."); // Table 6.Y: Pixel Local Storage State gl.bindFramebuffer(gl.FRAMEBUFFER, gl.createFramebuffer()); - shouldBeTrue("gl.getParameter(pls.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL) == 0"); + shouldBe("gl.getParameter(pls.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL)", "0"); debug("Check the initial clear values for each plane."); const MAX_PIXEL_LOCAL_STORAGE_PLANES = gl.getParameter(pls.MAX_PIXEL_LOCAL_STORAGE_PLANES_WEBGL); for (let i = 0; i < MAX_PIXEL_LOCAL_STORAGE_PLANES; ++i) { - expectTrue(pls.getFramebufferPixelLocalStorageParameterWEBGL( - i, pls.PIXEL_LOCAL_INTERNAL_FORMAT_WEBGL) == gl.NONE); - expectTrue(pls.getFramebufferPixelLocalStorageParameterWEBGL( - i, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL) == null); - expectTrue(pls.getFramebufferPixelLocalStorageParameterWEBGL( - i, pls.PIXEL_LOCAL_TEXTURE_LEVEL_WEBGL) == 0); - expectTrue(pls.getFramebufferPixelLocalStorageParameterWEBGL( - i, pls.PIXEL_LOCAL_TEXTURE_LAYER_WEBGL) == 0); - expectTrue(pls.getFramebufferPixelLocalStorageParameterWEBGL( - i, pls.PIXEL_LOCAL_USAGE_WEBGL) == 0); - expectTrue(arraysEqual( - pls.getFramebufferPixelLocalStorageParameterWEBGL( - i, pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL), - new Float32Array([0, 0, 0, 0]))); - expectTrue(arraysEqual( - pls.getFramebufferPixelLocalStorageParameterWEBGL( - i, pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL), - new Int32Array([0, 0, 0, 0]))); - expectTrue(arraysEqual( - pls.getFramebufferPixelLocalStorageParameterWEBGL( - i, pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL), - new Uint32Array([0, 0, 0, 0]))); + shouldBe(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${i}, pls.PIXEL_LOCAL_INTERNAL_FORMAT_WEBGL)`, + "gl.NONE"); + shouldBeNull(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${i}, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL)`); + shouldBe(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${i}, pls.PIXEL_LOCAL_TEXTURE_LEVEL_WEBGL)`, + "0"); + shouldBe(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${i}, pls.PIXEL_LOCAL_TEXTURE_LAYER_WEBGL)`, + "0"); + shouldBe(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${i}, pls.PIXEL_LOCAL_USAGE_WEBGL)`, + "0"); + shouldBeTrue(`arraysEqual( + pls.getFramebufferPixelLocalStorageParameterWEBGL(${i}, pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL), + new Float32Array([0, 0, 0, 0]))`); + shouldBeTrue(`arraysEqual( + pls.getFramebufferPixelLocalStorageParameterWEBGL(${i}, pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL), + new Int32Array([0, 0, 0, 0]))`); + shouldBeTrue(`arraysEqual( + pls.getFramebufferPixelLocalStorageParameterWEBGL(${i}, pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL), + new Uint32Array([0, 0, 0, 0]))`); } - wtu.glErrorShouldBe(gl, gl.NONE); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); gl.bindFramebuffer(gl.FRAMEBUFFER, null); } +function checkFrontendValidation() { + debug("\nCheck standard PLS validation that may be implemented in the WebGL layer."); + + debug("\nBeginning PLS on the default framebuffer must be rejected."); + { + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + pls.beginPixelLocalStorageWEBGL([pls.LOAD_OP_ZERO_WEBGL]); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + } + + debug("\nEnding PLS on the default framebuffer must be rejected."); + { + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + pls.endPixelLocalStorageWEBGL([pls.STORE_OP_STORE_WEBGL]); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + } + + debug("\nEmitting a PLS barrier on the default framebuffer must be rejected."); + { + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + pls.pixelLocalStorageBarrierWEBGL(); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + } + + debug("\nAttaching a PLS plane to the default framebuffer must be rejected."); + { + const tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, 1, 1); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + pls.framebufferTexturePixelLocalStorageWEBGL(0, tex, 0, 0, 0); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + gl.bindTexture(gl.TEXTURE_2D, null); + } + + debug("\nAttaching a PLS plane with a wrong plane index must be rejected."); + { + const tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, 1, 1); + gl.bindFramebuffer(gl.FRAMEBUFFER, gl.createFramebuffer()); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + pls.framebufferTexturePixelLocalStorageWEBGL(-1, tex, 0, 0, 0); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + pls.framebufferTexturePixelLocalStorageWEBGL(MAX_PIXEL_LOCAL_STORAGE_PLANES, tex, 0, 0, 0); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + gl.bindTexture(gl.TEXTURE_2D, null); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + + debug("\nQuerying a PLS plane parameter on the default framebuffer must be rejected."); + { + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_INTERNAL_FORMAT_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_TEXTURE_LEVEL_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_TEXTURE_LAYER_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_USAGE_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + } + + debug("\nQuerying a PLS plane parameter with a wrong index must be rejected."); + { + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + gl.bindFramebuffer(gl.FRAMEBUFFER, gl.createFramebuffer()); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(-1, pls.PIXEL_LOCAL_INTERNAL_FORMAT_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(-1, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(-1, pls.PIXEL_LOCAL_TEXTURE_LEVEL_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(-1, pls.PIXEL_LOCAL_TEXTURE_LAYER_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(-1, pls.PIXEL_LOCAL_USAGE_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(-1, pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(-1, pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(-1, pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL)"); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${MAX_PIXEL_LOCAL_STORAGE_PLANES}, pls.PIXEL_LOCAL_INTERNAL_FORMAT_WEBGL)`); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${MAX_PIXEL_LOCAL_STORAGE_PLANES}, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL)`); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${MAX_PIXEL_LOCAL_STORAGE_PLANES}, pls.PIXEL_LOCAL_TEXTURE_LEVEL_WEBGL)`); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${MAX_PIXEL_LOCAL_STORAGE_PLANES}, pls.PIXEL_LOCAL_TEXTURE_LAYER_WEBGL)`); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${MAX_PIXEL_LOCAL_STORAGE_PLANES}, pls.PIXEL_LOCAL_USAGE_WEBGL)`); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${MAX_PIXEL_LOCAL_STORAGE_PLANES}, pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL)`); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${MAX_PIXEL_LOCAL_STORAGE_PLANES}, pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL)`); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + shouldBeNull(`pls.getFramebufferPixelLocalStorageParameterWEBGL(${MAX_PIXEL_LOCAL_STORAGE_PLANES}, pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL)`); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + + debug("\nSetting a PLS plane clear value on the default framebuffer must be rejected."); + { + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + pls.framebufferPixelLocalClearValuefvWEBGL(0, [0, 0, 0, 0]); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + pls.framebufferPixelLocalClearValueivWEBGL(0, [0, 0, 0, 0]); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + pls.framebufferPixelLocalClearValueuivWEBGL(0, [0, 0, 0, 0]); + wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); + } + + debug("\nSetting a PLS plane clear value with a wrong index must be rejected."); + { + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + gl.bindFramebuffer(gl.FRAMEBUFFER, gl.createFramebuffer()); + pls.framebufferPixelLocalClearValuefvWEBGL(-1, [0, 0, 0, 0]); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + pls.framebufferPixelLocalClearValueivWEBGL(-1, [0, 0, 0, 0]); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + pls.framebufferPixelLocalClearValueuivWEBGL(-1, [0, 0, 0, 0]); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + pls.framebufferPixelLocalClearValuefvWEBGL(MAX_PIXEL_LOCAL_STORAGE_PLANES, [0, 0, 0, 0]); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + pls.framebufferPixelLocalClearValueivWEBGL(MAX_PIXEL_LOCAL_STORAGE_PLANES, [0, 0, 0, 0]); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + pls.framebufferPixelLocalClearValueuivWEBGL(MAX_PIXEL_LOCAL_STORAGE_PLANES, [0, 0, 0, 0]); + wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } +} + function checkWebGLNonNormativeBehavior() { debug("\nCheck the WebGL-specific behavior not found in the " + "ANGLE_shader_pixel_local_storage specification."); gl.bindFramebuffer(gl.FRAMEBUFFER, gl.createFramebuffer()); debug("If 'texture' has been deleted, generates an INVALID_OPERATION error."); - wtu.glErrorShouldBe(gl, gl.NONE); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); const tex = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, tex); gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, 1, 1); - wtu.glErrorShouldBe(gl, gl.NONE); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); gl.deleteTexture(tex); pls.framebufferTexturePixelLocalStorageWEBGL(0, tex, 0, 0, 0); wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); @@ -220,11 +364,11 @@ gl2.bindTexture(gl2.TEXTURE_2D, tex2); gl2.texStorage2D(gl2.TEXTURE_2D, 1, gl2.RGBA8, 1, 1); pls.framebufferTexturePixelLocalStorageWEBGL(0, tex2, 0, 0, 0); - wtu.glErrorShouldBe(gl2, gl2.NONE); + wtu.glErrorShouldBe(gl2, gl2.NO_ERROR); wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION); debug("\nIf value has less than srcOffset + 4 elements, generates an INVALID_VALUE error."); - wtu.glErrorShouldBe(gl, gl.NONE); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); pls.framebufferPixelLocalClearValuefvWEBGL(0, new Float32Array(3)); wtu.glErrorShouldBe(gl, gl.INVALID_VALUE); pls.framebufferPixelLocalClearValuefvWEBGL(1, [0, 0, 0]); @@ -255,52 +399,50 @@ debug("\nCheck that srcOffset works properly."); const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; pls.framebufferPixelLocalClearValuefvWEBGL(0, new Float32Array(arr), 1); - wtu.glErrorShouldBe(gl, gl.NONE); - shouldBeTrue(`arraysEqual(pls.getFramebufferPixelLocalStorageParameterWEBGL( - 0, pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL), - new Float32Array([1, 2, 3, 4]))`); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + shouldBeTrue(`arraysEqual( + pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL), + new Float32Array([1, 2, 3, 4]))`); pls.framebufferPixelLocalClearValuefvWEBGL(1, arr, 2); - wtu.glErrorShouldBe(gl, gl.NONE); - shouldBeTrue(`arraysEqual(pls.getFramebufferPixelLocalStorageParameterWEBGL( - 1, pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL), - [2, 3, 4, 5])`); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + shouldBeTrue(`arraysEqual( + pls.getFramebufferPixelLocalStorageParameterWEBGL(1, pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL), + new Float32Array([2, 3, 4, 5]))`); pls.framebufferPixelLocalClearValueivWEBGL(2, new Int32Array(arr), 3); - wtu.glErrorShouldBe(gl, gl.NONE); - shouldBeTrue(`arraysEqual(pls.getFramebufferPixelLocalStorageParameterWEBGL( - 2, pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL), - new Float32Array([3, 4, 5, 6]))`); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + shouldBeTrue(`arraysEqual( + pls.getFramebufferPixelLocalStorageParameterWEBGL(2, pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL), + new Int32Array([3, 4, 5, 6]))`); pls.framebufferPixelLocalClearValueivWEBGL(3, arr, 4); - wtu.glErrorShouldBe(gl, gl.NONE); - shouldBeTrue(`arraysEqual(pls.getFramebufferPixelLocalStorageParameterWEBGL( - 3, pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL), - [4, 5, 6, 7])`); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + shouldBeTrue(`arraysEqual( + pls.getFramebufferPixelLocalStorageParameterWEBGL(3, pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL), + new Int32Array([4, 5, 6, 7]))`); pls.framebufferPixelLocalClearValueuivWEBGL(2, new Uint32Array(arr), 5); - wtu.glErrorShouldBe(gl, gl.NONE); - shouldBeTrue(`arraysEqual(pls.getFramebufferPixelLocalStorageParameterWEBGL( - 2, pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL), - new Uint32Array([5, 6, 7, 8]))`); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + shouldBeTrue(`arraysEqual( + pls.getFramebufferPixelLocalStorageParameterWEBGL(2, pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL), + new Uint32Array([5, 6, 7, 8]))`); pls.framebufferPixelLocalClearValueuivWEBGL(1, arr, 6); - wtu.glErrorShouldBe(gl, gl.NONE); - shouldBeTrue(`arraysEqual(pls.getFramebufferPixelLocalStorageParameterWEBGL( - 1, pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL), - [6, 7, 8, 9])`); - wtu.glErrorShouldBe(gl, gl.NONE); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); + shouldBeTrue(`arraysEqual( + pls.getFramebufferPixelLocalStorageParameterWEBGL(1, pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL), + new Uint32Array([6, 7, 8, 9]))`); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); debug("\nCheck that PIXEL_LOCAL_TEXTURE_NAME_WEBGL returns a WebGLTexture."); - shouldBeTrue(`pls.getFramebufferPixelLocalStorageParameterWEBGL( - 0, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL) === null`); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL)"); window.validTex = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, validTex); gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, 1, 1); - wtu.glErrorShouldBe(gl, gl.NONE); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); pls.framebufferTexturePixelLocalStorageWEBGL(0, validTex, 0, 0, 0); - shouldBeTrue(`pls.getFramebufferPixelLocalStorageParameterWEBGL( - 0, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL) === validTex`); + shouldBe("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL)", + "validTex"); pls.framebufferTexturePixelLocalStorageWEBGL(0, null, 0, 0, 0); - shouldBeTrue(`pls.getFramebufferPixelLocalStorageParameterWEBGL( - 0, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL) === null`); + shouldBeNull("pls.getFramebufferPixelLocalStorageParameterWEBGL(0, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL)"); - wtu.glErrorShouldBe(gl, gl.NONE); + wtu.glErrorShouldBe(gl, gl.NO_ERROR); gl.bindFramebuffer(gl.FRAMEBUFFER, null); } @@ -318,12 +460,12 @@ const tex = localGL.createTexture(); localGL.bindTexture(localGL.TEXTURE_2D, tex); localGL.texStorage2D(localGL.TEXTURE_2D, 1, localGL.RGBA8, localCanvas.width, localCanvas.height); - wtu.glErrorShouldBe(localGL, localGL.NONE); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); const plsFBO = localGL.createFramebuffer(); localGL.bindFramebuffer(localGL.FRAMEBUFFER, plsFBO); localPLS.framebufferTexturePixelLocalStorageWEBGL(0, tex, 0, 0, 0); - wtu.glErrorShouldBe(localGL, localGL.NONE); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); localGL.viewport(0, 0, localCanvas.width, localCanvas.height); @@ -346,20 +488,20 @@ localGL.useProgram(program); const colorUniLocation = localGL.getUniformLocation(program, "color"); - wtu.glErrorShouldBe(localGL, localGL.NONE); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); // Disable color mask to ensure PLS and canvas manage their own color masks properly. localGL.colorMask(false, true, false, true); - // Set global variables for shouldBeTrue(). + // Set global variables for shouldBe*(). window.localGL = localGL; window.localPLS = localPLS; debug("\nCheck that pixel local storage works properly"); localGL.disable(localGL.DITHER); localPLS.beginPixelLocalStorageWEBGL([localPLS.LOAD_OP_ZERO_WEBGL]); - wtu.glErrorShouldBe(localGL, localGL.NONE); - shouldBeTrue("localGL.getParameter(localPLS.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL) == 1"); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); + shouldBe("localGL.getParameter(localPLS.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL)", "1"); localGL.uniform4f(colorUniLocation, 0, 1, 0, 0); localGL.drawArrays(localGL.TRIANGLE_STRIP, 0, 4); @@ -370,14 +512,14 @@ localGL.drawArrays(localGL.TRIANGLE_STRIP, 0, 4); localPLS.endPixelLocalStorageWEBGL([localPLS.STORE_OP_STORE_WEBGL]); - wtu.glErrorShouldBe(localGL, localGL.NONE); - shouldBeTrue("localGL.getParameter(localPLS.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL) == 0"); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); + shouldBe("localGL.getParameter(localPLS.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL)", "0"); const readFBO = localGL.createFramebuffer(); localGL.bindFramebuffer(localGL.READ_FRAMEBUFFER, readFBO); localGL.framebufferTexture2D(localGL.READ_FRAMEBUFFER, localGL.COLOR_ATTACHMENT0, localGL.TEXTURE_2D, tex, 0); - wtu.glErrorShouldBe(localGL, localGL.NONE); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); wtu.checkCanvas(localGL, [255, 255, 0, 0]); debug("\nCheck that alpha is properly handled in the main canvas."); @@ -385,13 +527,13 @@ localGL.blitFramebuffer(0, 0, localCanvas.width, localCanvas.height, 0, 0, localCanvas.width, localCanvas.height, localGL.COLOR_BUFFER_BIT, localGL.NEAREST); localGL.bindFramebuffer(localGL.FRAMEBUFFER, null); - wtu.glErrorShouldBe(localGL, localGL.NONE); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); wtu.checkCanvas(localGL, [255, 255, 0, alpha ? 0 : 255]); localGL.bindFramebuffer(localGL.FRAMEBUFFER, plsFBO); localPLS.beginPixelLocalStorageWEBGL([localPLS.LOAD_OP_LOAD_WEBGL]); - wtu.glErrorShouldBe(localGL, localGL.NONE); - shouldBeTrue("localGL.getParameter(localPLS.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL) == 1"); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); + shouldBe("localGL.getParameter(localPLS.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL)", "1"); debug("\nGoing down from composite."); @@ -399,21 +541,21 @@ // disabled. await new Promise(resolve => wtu.waitForComposite(resolve)); - // Reset global variables for shouldBeTrue() after await. + // Reset global variables for shouldBe*() after await. window.localGL = localGL; window.localPLS = localPLS; debug("\nBack from composite!"); debug("\nPLS should still be active on plsFBO even after being interrupted for compositing."); - wtu.glErrorShouldBe(localGL, localGL.NONE); - shouldBeTrue("localGL.getParameter(localPLS.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL) == 1"); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); + shouldBe("localGL.getParameter(localPLS.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL)", "1"); localGL.uniform4f(colorUniLocation, 0, 0, 1, 0); localGL.drawArrays(localGL.TRIANGLE_STRIP, 0, 4); localPLS.endPixelLocalStorageWEBGL([localPLS.STORE_OP_STORE_WEBGL]); - wtu.glErrorShouldBe(localGL, localGL.NONE); - shouldBeTrue("localGL.getParameter(localPLS.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL) == 0"); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); + shouldBe("localGL.getParameter(localPLS.PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_WEBGL)", "0"); debug("\nThe canvas should have gotten cleared while PLS was active."); localGL.bindFramebuffer(localGL.FRAMEBUFFER, null); @@ -423,7 +565,7 @@ "for compositing."); localGL.bindFramebuffer(localGL.READ_FRAMEBUFFER, readFBO); wtu.checkCanvas(localGL, [255, 255, 255, 0]); - wtu.glErrorShouldBe(localGL, localGL.NONE); + wtu.glErrorShouldBe(localGL, localGL.NO_ERROR); // Draws 'tex' to the canvas. const fs2 = `#version 300 es @@ -449,8 +591,10 @@ wtu.checkCanvas(localGL, [0, 255, 0, alpha ? 0 : 255]); debug("\nThe client's color mask should have been preserved."); - shouldBeTrue(`arraysEqual(localGL.getParameter(localGL.COLOR_WRITEMASK), - [false, true, false, true])`); + shouldBeFalse("localGL.getParameter(localGL.COLOR_WRITEMASK)[0]"); + shouldBeTrue("localGL.getParameter(localGL.COLOR_WRITEMASK)[1]"); + shouldBeFalse("localGL.getParameter(localGL.COLOR_WRITEMASK)[2]"); + shouldBeTrue("localGL.getParameter(localGL.COLOR_WRITEMASK)[3]"); } runTest();