From 5f26401a355c5ed0380b30fa06e2d5fd4fff2cef Mon Sep 17 00:00:00 2001 From: Greggman Date: Thu, 23 Jan 2025 11:38:18 -0800 Subject: [PATCH 1/3] Test reading mip levels with textureLoad and 2d textures. (#4157) This line is only missing from the 2d version. Without it only level 0 is read. --- .../shader/execution/expression/call/builtin/textureLoad.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts index 1e64e23b9ad..abbd55a41c2 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts @@ -215,6 +215,7 @@ Parameters: const calls: TextureCall[] = generateTextureBuiltinInputs2D(50, { method: samplePoints, descriptor, + mipLevel: { num: texture.mipLevelCount, type: L }, hashInputs: [stage, format, samplePoints, C, L], }).map(({ coords, mipLevel }) => { return { From 1e8a3781e7f7bd00cc6dd1533ed6e1941465357e Mon Sep 17 00:00:00 2001 From: ShrekShao <5031596+shrekshao@users.noreply.github.com> Date: Thu, 23 Jan 2025 12:41:14 -0800 Subject: [PATCH 2/3] Fix bug: fragment output type mismatch (#4158) --- .../limits/maxColorAttachmentBytesPerSample.spec.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/webgpu/api/validation/capability_checks/limits/maxColorAttachmentBytesPerSample.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxColorAttachmentBytesPerSample.spec.ts index 5fc21daf5aa..d1b8eb0701b 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxColorAttachmentBytesPerSample.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxColorAttachmentBytesPerSample.spec.ts @@ -95,14 +95,16 @@ function getPipelineDescriptor( return; } + const typedVec = interleaveFormat.includes('uint') ? 'vec4u' : 'vec4f'; + const code = ` ${getDescription(testValue, actualLimit, sampleCount, targets)} @vertex fn vs() -> @builtin(position) vec4f { return vec4f(0); } - @fragment fn fs() -> @location(0) vec4f { - return vec4f(0); + @fragment fn fs() -> @location(0) ${typedVec} { + return ${typedVec}(0); } `; const module = device.createShaderModule({ code }); 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 3/3] 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 69e058d8d1a..9d396711784 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 2131540de6c..2109d8306b3 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 86ed37ef9e6..e59a0c64654 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 912c5f69d7f..2e0369956f7 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 84334df603e..d3758e04ddd 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 7bb577ae5d0..12ea2fa8e8b 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;