diff --git a/src/webgpu/api/operation/render_pass/storeOp.spec.ts b/src/webgpu/api/operation/render_pass/storeOp.spec.ts index d2c5c8b45c0..0e030f17be4 100644 --- a/src/webgpu/api/operation/render_pass/storeOp.spec.ts +++ b/src/webgpu/api/operation/render_pass/storeOp.spec.ts @@ -152,7 +152,7 @@ g.test('render_pass_store_op,color_attachment_only') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.colorFormat); - t.skipIfFloatTextureFormatNotColorRenderable(t.params.colorFormat); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.colorFormat); }) .fn(t => { const colorAttachment = t.createTextureTracked({ diff --git a/src/webgpu/api/operation/render_pipeline/overrides.spec.ts b/src/webgpu/api/operation/render_pipeline/overrides.spec.ts index d42796e95b6..b0ec9881dd6 100644 --- a/src/webgpu/api/operation/render_pipeline/overrides.spec.ts +++ b/src/webgpu/api/operation/render_pipeline/overrides.spec.ts @@ -192,7 +192,7 @@ g.test('precision') ]) ) .beforeAllSubcases(t => { - t.skipIfFloatTextureFormatNotColorRenderable(kPrecisionTestFormat); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(kPrecisionTestFormat); }) .fn(async t => { const format = kPrecisionTestFormat; diff --git a/src/webgpu/api/operation/render_pipeline/pipeline_output_targets.spec.ts b/src/webgpu/api/operation/render_pipeline/pipeline_output_targets.spec.ts index 7e4c40ec5e2..9fc0f1640e6 100644 --- a/src/webgpu/api/operation/render_pipeline/pipeline_output_targets.spec.ts +++ b/src/webgpu/api/operation/render_pipeline/pipeline_output_targets.spec.ts @@ -58,7 +58,7 @@ g.test('color,attachments') .beforeAllSubcases(t => { const info = kTextureFormatInfo[t.params.format]; t.skipIfTextureFormatNotSupported(t.params.format); - t.skipIfFloatTextureFormatNotColorRenderable(t.params.format); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); t.selectDeviceOrSkipTestCase(info.feature); }) .fn(t => { diff --git a/src/webgpu/api/operation/rendering/color_target_state.spec.ts b/src/webgpu/api/operation/rendering/color_target_state.spec.ts index e95d9c7937d..6a88d0fea19 100644 --- a/src/webgpu/api/operation/rendering/color_target_state.spec.ts +++ b/src/webgpu/api/operation/rendering/color_target_state.spec.ts @@ -203,18 +203,13 @@ g.test('blending,GPUBlendComponent') }) ) .beforeAllSubcases(t => { - const requiredFeatures = t.getFloatTextureFormatColorRenderableFeatures( - kBlendingGPUBlendComponentFormat - ); if ( IsDualSourceBlendingFactor(t.params.srcFactor) || IsDualSourceBlendingFactor(t.params.dstFactor) ) { - requiredFeatures.push('dual-source-blending'); - } - if (requiredFeatures.length > 0) { - t.selectDeviceOrSkipTestCase(requiredFeatures); + t.selectDeviceOrSkipTestCase('dual-source-blending'); } + t.selectDeviceForRenderableColorFormatOrSkipTestCase(kBlendingGPUBlendComponentFormat); }) .fn(t => { const textureFormat: GPUTextureFormat = kBlendingGPUBlendComponentFormat; @@ -400,7 +395,7 @@ g.test('blending,formats') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.skipIfFloatTextureFormatNotColorRenderable(t.params.format); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); }) .fn(t => { const { format } = t.params; @@ -806,7 +801,7 @@ g.test('blending,clamping') .combine('dstValue', [0.2, 0.4]) ) .beforeAllSubcases(t => { - t.skipIfFloatTextureFormatNotColorRenderable(t.params.format); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); }) .fn(t => { const { format, srcValue, dstValue } = t.params; diff --git a/src/webgpu/api/operation/resource_init/texture_zero.spec.ts b/src/webgpu/api/operation/resource_init/texture_zero.spec.ts index 6cb3bbfdb1d..66aadcbf034 100644 --- a/src/webgpu/api/operation/resource_init/texture_zero.spec.ts +++ b/src/webgpu/api/operation/resource_init/texture_zero.spec.ts @@ -43,11 +43,8 @@ g.test('uninitialized_texture_is_zero') .params(kTestParams) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - const requiredFeatures = [ - ...t.getFloatTextureFormatColorRenderableFeatures(t.params.format), - ...(kTextureFormatInfo[t.params.format].feature ?? []), - ] as GPUFeatureName[]; - t.selectDeviceOrSkipTestCase(requiredFeatures); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.selectDeviceOrSkipTestCase(kTextureFormatInfo[t.params.format].feature); }) .fn(t => { const usage = getRequiredTextureUsage( diff --git a/src/webgpu/api/operation/sampling/filter_mode.spec.ts b/src/webgpu/api/operation/sampling/filter_mode.spec.ts index 1efc2c4a378..ba9cb7d17a1 100644 --- a/src/webgpu/api/operation/sampling/filter_mode.spec.ts +++ b/src/webgpu/api/operation/sampling/filter_mode.spec.ts @@ -481,7 +481,7 @@ g.test('magFilter,nearest') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.skipIfFloatTextureFormatNotColorRenderable(t.params.format); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); if (kTextureFormatInfo[t.params.format].color.type === 'unfilterable-float') { t.selectDeviceOrSkipTestCase('float32-filterable'); } @@ -605,7 +605,7 @@ g.test('magFilter,linear') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.skipIfFloatTextureFormatNotColorRenderable(t.params.format); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); if (kTextureFormatInfo[t.params.format].color.type === 'unfilterable-float') { t.selectDeviceOrSkipTestCase('float32-filterable'); } @@ -741,7 +741,7 @@ g.test('minFilter,nearest') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.skipIfFloatTextureFormatNotColorRenderable(t.params.format); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); if (kTextureFormatInfo[t.params.format].color.type === 'unfilterable-float') { t.selectDeviceOrSkipTestCase('float32-filterable'); } @@ -875,7 +875,7 @@ g.test('minFilter,linear') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.skipIfFloatTextureFormatNotColorRenderable(t.params.format); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); if (kTextureFormatInfo[t.params.format].color.type === 'unfilterable-float') { t.selectDeviceOrSkipTestCase('float32-filterable'); } @@ -972,7 +972,7 @@ g.test('mipmapFilter') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.skipIfFloatTextureFormatNotColorRenderable(t.params.format); + t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); if (kTextureFormatInfo[t.params.format].color.type === 'unfilterable-float') { t.selectDeviceOrSkipTestCase('float32-filterable'); } diff --git a/src/webgpu/gpu_test.ts b/src/webgpu/gpu_test.ts index 867ea653359..27a5b40321f 100644 --- a/src/webgpu/gpu_test.ts +++ b/src/webgpu/gpu_test.ts @@ -229,6 +229,13 @@ export class GPUTestSubcaseBatchState extends SubcaseBatchState { this.selectDeviceOrSkipTestCase(features); } + /** Skips test if format is float16 or float32 and not color renderable based on device feature availability. */ + selectDeviceForRenderableColorFormatOrSkipTestCase(...formats: (GPUTextureFormat | undefined)[]) { + this.selectDeviceOrSkipTestCase({ + requiredFeatures: this.getFloatTextureFormatColorRenderableFeatures(...formats), + }); + } + /** @internal MAINTENANCE_TODO: Make this not visible to test code? */ acquireMismatchedProvider(): Promise | undefined { return this.mismatchedProvider; @@ -296,15 +303,6 @@ export class GPUTestSubcaseBatchState extends SubcaseBatchState { return requiredFeatures; } - /** Skips test if format is float16 or float32 and not color renderable based on device feature availability. */ - skipIfFloatTextureFormatNotColorRenderable(...formats: (GPUTextureFormat | undefined)[]) { - if (this.isCompatibility) { - this.selectDeviceOrSkipTestCase({ - requiredFeatures: this.getFloatTextureFormatColorRenderableFeatures(...formats), - }); - } - } - skipIfCopyTextureToTextureNotSupportedForFormat(...formats: (GPUTextureFormat | undefined)[]) { if (this.isCompatibility) { for (const format of formats) {