From e1a5ecff073ad3188df2f4df679b22fe7e3df50a Mon Sep 17 00:00:00 2001 From: ShrekShao <5031596+shrekshao@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:27:24 -0800 Subject: [PATCH 1/2] Compat: fix float16(32)-renderable tests (web_platform) (#4161) --- src/webgpu/web_platform/canvas/configure.spec.ts | 2 ++ .../canvas/readbackFromWebGPUCanvas.spec.ts | 16 ++++++++++++++++ .../copyToTexture/ImageBitmap.spec.ts | 2 ++ .../web_platform/copyToTexture/ImageData.spec.ts | 1 + .../web_platform/copyToTexture/canvas.spec.ts | 5 +++++ .../web_platform/copyToTexture/image.spec.ts | 1 + 6 files changed, 27 insertions(+) diff --git a/src/webgpu/web_platform/canvas/configure.spec.ts b/src/webgpu/web_platform/canvas/configure.spec.ts index 69e058d8d1a3..9d3967117840 100644 --- a/src/webgpu/web_platform/canvas/configure.spec.ts +++ b/src/webgpu/web_platform/canvas/configure.spec.ts @@ -157,6 +157,7 @@ g.test('format') ) .beforeAllSubcases(t => { t.selectDeviceForTextureFormatOrSkipTestCase(t.params.format); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); }) .fn(t => { const { canvasType, format } = t.params; @@ -446,6 +447,7 @@ g.test('viewFormats') ) ) .beforeAllSubcases(t => { + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); t.selectDeviceOrSkipTestCase([t.params.viewFormatFeature]); }) .fn(t => { diff --git a/src/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.ts b/src/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.ts index 2131540de6cf..2109d8306b36 100644 --- a/src/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.ts +++ b/src/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.ts @@ -261,6 +261,10 @@ g.test('onscreenCanvas,snapshot') .combine('colorSpace', kCanvasColorSpaces) .combine('snapshotType', ['toDataURL', 'toBlob', 'imageBitmap']) ) + .beforeAllSubcases(t => { + // rgba16float may not be color-renderable in compat mode + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + }) .fn(async t => { const canvas = initWebGPUCanvasContent( t, @@ -323,6 +327,10 @@ g.test('offscreenCanvas,snapshot') .combine('colorSpace', kCanvasColorSpaces) .combine('snapshotType', ['convertToBlob', 'transferToImageBitmap', 'imageBitmap'] as const) ) + .beforeAllSubcases(t => { + // rgba16float may not be color-renderable in compat mode + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + }) .fn(async t => { const offscreenCanvas = initWebGPUCanvasContent( t, @@ -378,6 +386,10 @@ g.test('onscreenCanvas,uploadToWebGL') .combine('webgl', ['webgl', 'webgl2']) .combine('upload', ['texImage2D', 'texSubImage2D']) ) + .beforeAllSubcases(t => { + // rgba16float may not be color-renderable in compat mode + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + }) .fn(t => { const { format, webgl, upload } = t.params; const canvas = initWebGPUCanvasContent(t, format, t.params.alphaMode, 'srgb', 'onscreen'); @@ -459,6 +471,10 @@ g.test('drawTo2DCanvas') .combine('webgpuCanvasType', kAllCanvasTypes) .combine('canvas2DType', kAllCanvasTypes) ) + .beforeAllSubcases(t => { + // rgba16float may not be color-renderable in compat mode + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + }) .fn(t => { const { format, webgpuCanvasType, alphaMode, colorSpace, canvas2DType } = t.params; diff --git a/src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts b/src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts index 86ed37ef9e67..e59a0c646541 100644 --- a/src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts @@ -61,6 +61,7 @@ g.test('from_ImageData') .beforeAllSubcases(t => { t.skipIf(typeof ImageData === 'undefined', 'ImageData does not exist in this environment'); t.skipIfTextureFormatNotSupported(t.params.dstFormat); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstFormat); }) .fn(async t => { const { @@ -182,6 +183,7 @@ g.test('from_canvas') .beforeAllSubcases(t => { t.skipIf(typeof ImageData === 'undefined', 'ImageData does not exist in this environment'); t.skipIfTextureFormatNotSupported(t.params.dstFormat); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstFormat); }) .fn(async t => { const { diff --git a/src/webgpu/web_platform/copyToTexture/ImageData.spec.ts b/src/webgpu/web_platform/copyToTexture/ImageData.spec.ts index 912c5f69d7f8..2e0369956f71 100644 --- a/src/webgpu/web_platform/copyToTexture/ImageData.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/ImageData.spec.ts @@ -49,6 +49,7 @@ g.test('from_ImageData') .beforeAllSubcases(t => { t.skipIf(typeof ImageData === 'undefined', 'ImageData does not exist in this environment'); t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); }) .fn(t => { const { width, height, dstColorFormat, dstPremultiplied, srcDoFlipYDuringCopy } = t.params; diff --git a/src/webgpu/web_platform/copyToTexture/canvas.spec.ts b/src/webgpu/web_platform/copyToTexture/canvas.spec.ts index 84334df603e3..d3758e04ddd3 100644 --- a/src/webgpu/web_platform/copyToTexture/canvas.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/canvas.spec.ts @@ -495,6 +495,7 @@ g.test('copy_contents_from_2d_context_canvas') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); }) .fn(t => { const { width, height, canvasType, dstAlphaMode } = t.params; @@ -559,6 +560,7 @@ g.test('copy_contents_from_gl_context_canvas') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); }) .fn(t => { const { width, height, canvasType, contextName, srcPremultiplied, dstAlphaMode } = t.params; @@ -628,6 +630,7 @@ g.test('copy_contents_from_gpu_context_canvas') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); t.selectMismatchedDeviceOrSkipTestCase(undefined); }) .fn(t => { @@ -694,6 +697,7 @@ g.test('copy_contents_from_bitmaprenderer_context_canvas') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); }) .fn(async t => { const { width, height, canvasType, dstAlphaMode } = t.params; @@ -770,6 +774,7 @@ g.test('color_space_conversion') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); }) .fn(t => { const { diff --git a/src/webgpu/web_platform/copyToTexture/image.spec.ts b/src/webgpu/web_platform/copyToTexture/image.spec.ts index 7bb577ae5d07..12ea2fa8e8b2 100644 --- a/src/webgpu/web_platform/copyToTexture/image.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/image.spec.ts @@ -63,6 +63,7 @@ g.test('from_image') .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); if (typeof HTMLImageElement === 'undefined') t.skip('HTMLImageElement not available'); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); }) .fn(async t => { const { width, height, dstColorFormat, dstPremultiplied, srcDoFlipYDuringCopy } = t.params; From 84c6cd81397a2c1b196425716027224c7f1aad9b Mon Sep 17 00:00:00 2001 From: ShrekShao <5031596+shrekshao@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:55:12 -0800 Subject: [PATCH 2/2] Compat: fix float16(32)-renderable tests (compat) (#4162) --- .../validation/encoding/cmds/copyTextureToTexture.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/webgpu/compat/api/validation/encoding/cmds/copyTextureToTexture.spec.ts b/src/webgpu/compat/api/validation/encoding/cmds/copyTextureToTexture.spec.ts index aac5aaa941d1..e930b5dc7cec 100644 --- a/src/webgpu/compat/api/validation/encoding/cmds/copyTextureToTexture.spec.ts +++ b/src/webgpu/compat/api/validation/encoding/cmds/copyTextureToTexture.spec.ts @@ -51,13 +51,16 @@ g.test('multisample') .desc(`Test that you can not call copyTextureToTexture with multisample textures in compat mode.`) .params(u => u - .beginSubcases() .combine('format', kAllTextureFormats) + .beginSubcases() .filter(({ format }) => { const info = kTextureFormatInfo[format]; return info.multisample && !info.feature; }) ) + .beforeAllSubcases(t => { + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + }) .fn(t => { const { format } = t.params; const { blockWidth, blockHeight } = kTextureFormatInfo[format];