diff --git a/src/webgpu/api/operation/render_pass/storeOp.spec.ts b/src/webgpu/api/operation/render_pass/storeOp.spec.ts index 0e030f17be4..9fdfbca6abc 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.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.colorFormat); + t.skipIfColorRenderableNotSupportedForFormat(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 b0ec9881dd6..7317b624d98 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.selectDeviceForRenderableColorFormatOrSkipTestCase(kPrecisionTestFormat); + t.skipIfColorRenderableNotSupportedForFormat(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 9f7db3d5416..22e790e2116 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.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); t.selectDeviceOrSkipTestCase(info.feature); }) .fn(t => { @@ -161,7 +161,7 @@ g.test('color,component_count') .beforeAllSubcases(t => { const info = kTextureFormatInfo[t.params.format]; t.skipIfTextureFormatNotSupported(t.params.format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(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 6a88d0fea19..c1cbb3fe120 100644 --- a/src/webgpu/api/operation/rendering/color_target_state.spec.ts +++ b/src/webgpu/api/operation/rendering/color_target_state.spec.ts @@ -209,7 +209,7 @@ g.test('blending,GPUBlendComponent') ) { t.selectDeviceOrSkipTestCase('dual-source-blending'); } - t.selectDeviceForRenderableColorFormatOrSkipTestCase(kBlendingGPUBlendComponentFormat); + t.skipIfColorRenderableNotSupportedForFormat(kBlendingGPUBlendComponentFormat); }) .fn(t => { const textureFormat: GPUTextureFormat = kBlendingGPUBlendComponentFormat; @@ -395,7 +395,7 @@ g.test('blending,formats') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); }) .fn(t => { const { format } = t.params; @@ -801,7 +801,7 @@ g.test('blending,clamping') .combine('dstValue', [0.2, 0.4]) ) .beforeAllSubcases(t => { - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(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 66aadcbf034..6e18fbfea82 100644 --- a/src/webgpu/api/operation/resource_init/texture_zero.spec.ts +++ b/src/webgpu/api/operation/resource_init/texture_zero.spec.ts @@ -43,7 +43,7 @@ g.test('uninitialized_texture_is_zero') .params(kTestParams) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); t.selectDeviceOrSkipTestCase(kTextureFormatInfo[t.params.format].feature); }) .fn(t => { diff --git a/src/webgpu/api/operation/sampling/filter_mode.spec.ts b/src/webgpu/api/operation/sampling/filter_mode.spec.ts index ba9cb7d17a1..9c0c19e5a5e 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.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(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.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(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.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(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.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(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.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); if (kTextureFormatInfo[t.params.format].color.type === 'unfilterable-float') { t.selectDeviceOrSkipTestCase('float32-filterable'); } diff --git a/src/webgpu/api/operation/texture_view/write.spec.ts b/src/webgpu/api/operation/texture_view/write.spec.ts index 9de136080f0..0719dac6452 100644 --- a/src/webgpu/api/operation/texture_view/write.spec.ts +++ b/src/webgpu/api/operation/texture_view/write.spec.ts @@ -350,13 +350,13 @@ TODO: Test rgb10a2uint when TexelRepresentation.numericRange is made per-compone // Still need to filter again for compat mode. t.skipIfTextureFormatNotUsableAsStorageTexture(format); if (sampleCount > 1) { - t.skipIfMultisampleNotSupportedForFormatOrSelectDevice(format); + t.skipIfMultisampleNotSupportedForFormat(format); } break; case 'render-pass-resolve': case 'render-pass-store': // Requires multisample in `writeTextureAndGetExpectedTexelView` - t.skipIfMultisampleNotSupportedForFormatOrSelectDevice(format); + t.skipIfMultisampleNotSupportedForFormat(format); break; } }) diff --git a/src/webgpu/api/validation/createBindGroup.spec.ts b/src/webgpu/api/validation/createBindGroup.spec.ts index ecbd118240d..68bb5514a6e 100644 --- a/src/webgpu/api/validation/createBindGroup.spec.ts +++ b/src/webgpu/api/validation/createBindGroup.spec.ts @@ -206,7 +206,7 @@ g.test('texture_binding_must_have_correct_usage') }) ) .beforeAllSubcases(t => { - t.selectDeviceForRenderableColorFormatOrSkipTestCase(kTestFormat); + t.skipIfColorRenderableNotSupportedForFormat(kTestFormat); }) .fn(t => { const { entry, usage } = t.params; diff --git a/src/webgpu/api/validation/createTexture.spec.ts b/src/webgpu/api/validation/createTexture.spec.ts index 958faae4009..8a3006a7cb2 100644 --- a/src/webgpu/api/validation/createTexture.spec.ts +++ b/src/webgpu/api/validation/createTexture.spec.ts @@ -282,7 +282,7 @@ g.test('sampleCount,various_sampleCount_with_all_formats') const { format } = t.params; const info = kTextureFormatInfo[format]; t.skipIfTextureFormatNotSupported(format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(format); + t.skipIfColorRenderableNotSupportedForFormat(format); t.selectDeviceOrSkipTestCase(info.feature); }) .fn(t => { @@ -359,7 +359,7 @@ g.test('sampleCount,valid_sampleCount_with_other_parameter_varies') const info = kTextureFormatInfo[format]; t.skipIfTextureFormatNotSupported(format); t.selectDeviceOrSkipTestCase(info.feature); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(format); + t.skipIfColorRenderableNotSupportedForFormat(format); }) .fn(t => { const { dimension, sampleCount, format, mipLevelCount, arrayLayerCount, usage } = t.params; @@ -1053,7 +1053,7 @@ g.test('texture_usage') const info = kTextureFormatInfo[format]; t.skipIfTextureFormatNotSupported(format); t.selectDeviceOrSkipTestCase(info.feature); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(format); + t.skipIfColorRenderableNotSupportedForFormat(format); }) .fn(t => { const { dimension, format, usage0, usage1 } = t.params; diff --git a/src/webgpu/api/validation/createView.spec.ts b/src/webgpu/api/validation/createView.spec.ts index 7f649012833..f257fa39461 100644 --- a/src/webgpu/api/validation/createView.spec.ts +++ b/src/webgpu/api/validation/createView.spec.ts @@ -379,7 +379,7 @@ g.test('texture_view_usage') t.skipIfTextureFormatNotUsableAsStorageTexture(format); } if (textureUsage & GPUTextureUsage.RENDER_ATTACHMENT) { - t.selectDeviceForRenderableColorFormatOrSkipTestCase(format); + t.skipIfColorRenderableNotSupportedForFormat(format); } }) .fn(t => { diff --git a/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts b/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts index 4167ba6db31..dade5b13b20 100644 --- a/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts +++ b/src/webgpu/api/validation/encoding/createRenderBundleEncoder.spec.ts @@ -63,7 +63,7 @@ g.test('attachment_state,limits,maxColorAttachmentBytesPerSample,aligned') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); }) .fn(t => { const { format, colorFormatCount } = t.params; @@ -120,7 +120,7 @@ g.test('attachment_state,limits,maxColorAttachmentBytesPerSample,unaligned') ]) ) .beforeAllSubcases(t => { - t.selectDeviceForRenderableColorFormatOrSkipTestCase('r32float'); + t.skipIfColorRenderableNotSupportedForFormat('r32float'); }) .fn(t => { const { formats } = t.params; @@ -172,7 +172,7 @@ g.test('valid_texture_formats') .beforeAllSubcases(t => { const { format } = t.params; t.selectDeviceForTextureFormatOrSkipTestCase(format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(format); + t.skipIfColorRenderableNotSupportedForFormat(format); }) .fn(t => { const { format, attachment } = t.params; diff --git a/src/webgpu/api/validation/queue/copyToTexture/CopyExternalImageToTexture.spec.ts b/src/webgpu/api/validation/queue/copyToTexture/CopyExternalImageToTexture.spec.ts index d0082a6abef..e88b1487205 100644 --- a/src/webgpu/api/validation/queue/copyToTexture/CopyExternalImageToTexture.spec.ts +++ b/src/webgpu/api/validation/queue/copyToTexture/CopyExternalImageToTexture.spec.ts @@ -682,7 +682,7 @@ g.test('destination_texture,format') const { format } = t.params; t.skipIfTextureFormatNotSupported(format); t.selectDeviceOrSkipTestCase(kTextureFormatInfo[format].feature); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(format); + t.skipIfColorRenderableNotSupportedForFormat(format); }) .fn(async t => { const { format, copySize } = t.params; diff --git a/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts b/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts index 468f719bdbf..e8770ffa936 100644 --- a/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts +++ b/src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts @@ -211,7 +211,7 @@ g.test('color_attachments,limits,maxColorAttachmentBytesPerSample,aligned') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); }) .fn(t => { const { format, attachmentCount } = t.params; @@ -269,7 +269,7 @@ g.test('color_attachments,limits,maxColorAttachmentBytesPerSample,unaligned') ]) ) .beforeAllSubcases(t => { - t.selectDeviceForRenderableColorFormatOrSkipTestCase('r32float'); + t.skipIfColorRenderableNotSupportedForFormat('r32float'); }) .fn(t => { const { formats } = t.params; @@ -1174,7 +1174,7 @@ g.test('resolveTarget,format_supports_resolve') .beforeAllSubcases(t => { const { format } = t.params; t.skipIfTextureFormatNotSupported(format); - t.skipIfMultisampleNotSupportedForFormatOrSelectDevice(format); + t.skipIfMultisampleNotSupportedForFormat(format); }) .fn(t => { const { format } = t.params; diff --git a/src/webgpu/api/validation/render_pipeline/float32_blendable.spec.ts b/src/webgpu/api/validation/render_pipeline/float32_blendable.spec.ts index a6ea65a137b..a386dc72919 100644 --- a/src/webgpu/api/validation/render_pipeline/float32_blendable.spec.ts +++ b/src/webgpu/api/validation/render_pipeline/float32_blendable.spec.ts @@ -30,7 +30,7 @@ pipeline that uses blending with any float32-format attachment. if (t.params.enabled) { t.selectDeviceOrSkipTestCase('float32-blendable'); } - t.selectDeviceForRenderableColorFormatOrSkipTestCase('r32float'); + t.skipIfColorRenderableNotSupportedForFormat('r32float'); }) .fn(t => { const { isAsync, enabled, hasBlend, format } = t.params; diff --git a/src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts b/src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts index cbaaae15214..37528a7067b 100644 --- a/src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts +++ b/src/webgpu/api/validation/render_pipeline/fragment_state.spec.ts @@ -181,7 +181,7 @@ g.test('limits,maxColorAttachmentBytesPerSample,aligned') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); }) .fn(t => { const { format, attachmentCount, isAsync } = t.params; @@ -230,7 +230,7 @@ g.test('limits,maxColorAttachmentBytesPerSample,unaligned') .combine('isAsync', [false, true]) ) .beforeAllSubcases(t => { - t.selectDeviceForRenderableColorFormatOrSkipTestCase('r32float'); + t.skipIfColorRenderableNotSupportedForFormat('r32float'); }) .fn(t => { const { formats, isAsync } = t.params; @@ -269,7 +269,7 @@ g.test('targets_format_filterable') const { format } = t.params; const info = kTextureFormatInfo[format]; t.skipIfTextureFormatNotSupported(format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(format); + t.skipIfColorRenderableNotSupportedForFormat(format); t.selectDeviceOrSkipTestCase(info.feature); }) .fn(t => { @@ -399,7 +399,7 @@ g.test('pipeline_output_targets') ) .beforeAllSubcases(t => { t.selectDeviceForTextureFormatOrSkipTestCase(t.params.format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); }) .fn(t => { const { isAsync, format, writeMask, shaderOutput } = t.params; diff --git a/src/webgpu/api/validation/resource_usages/texture/in_render_common.spec.ts b/src/webgpu/api/validation/resource_usages/texture/in_render_common.spec.ts index 80bb9788442..d6624cb9695 100644 --- a/src/webgpu/api/validation/resource_usages/texture/in_render_common.spec.ts +++ b/src/webgpu/api/validation/resource_usages/texture/in_render_common.spec.ts @@ -116,7 +116,7 @@ g.test('subresources,color_attachments') .unless(t => t.inSamePass && t.level0 !== t.level1) ) .beforeAllSubcases(t => { - t.selectDeviceForRenderableColorFormatOrSkipTestCase('r32float'); + t.skipIfColorRenderableNotSupportedForFormat('r32float'); }) .fn(t => { const { layer0, level0, layer1, level1, inSamePass } = t.params; @@ -197,7 +197,7 @@ g.test('subresources,color_attachment_and_bind_group') t.params.bgLayerCount !== kTextureLayers, 'view array layers must equal texture array layers in compatibility mode' ); - t.selectDeviceForRenderableColorFormatOrSkipTestCase('r32float'); + t.skipIfColorRenderableNotSupportedForFormat('r32float'); } }) .fn(t => { @@ -476,7 +476,7 @@ g.test('subresources,multiple_bind_groups') t.params.bg0Layers.count !== kTextureLayers || t.params.bg1Layers.count !== kTextureLayers, 'view array layers must equal texture array layers in compatibility mode' ); - t.selectDeviceForRenderableColorFormatOrSkipTestCase('r32float'); + t.skipIfColorRenderableNotSupportedForFormat('r32float'); } }) .fn(t => { diff --git a/src/webgpu/api/validation/resource_usages/texture/in_render_misc.spec.ts b/src/webgpu/api/validation/resource_usages/texture/in_render_misc.spec.ts index e140fc749c9..61a1f823b18 100644 --- a/src/webgpu/api/validation/resource_usages/texture/in_render_misc.spec.ts +++ b/src/webgpu/api/validation/resource_usages/texture/in_render_misc.spec.ts @@ -521,7 +521,7 @@ g.test('subresources,texture_usages_in_copy_and_render_pass') ) ) .beforeAllSubcases(t => { - t.selectDeviceForRenderableColorFormatOrSkipTestCase('r32float'); + t.skipIfColorRenderableNotSupportedForFormat('r32float'); }) .fn(t => { const { usage0, usage1 } = t.params; @@ -620,7 +620,7 @@ g.test('subresources,texture_view_usages') ) .beforeAllSubcases(t => { if (t.params.bindingType === 'color-attachment') { - t.selectDeviceForRenderableColorFormatOrSkipTestCase('r32float'); + t.skipIfColorRenderableNotSupportedForFormat('r32float'); } }) .fn(t => { 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 e930b5dc7ce..9044d0a7b32 100644 --- a/src/webgpu/compat/api/validation/encoding/cmds/copyTextureToTexture.spec.ts +++ b/src/webgpu/compat/api/validation/encoding/cmds/copyTextureToTexture.spec.ts @@ -59,7 +59,7 @@ g.test('multisample') }) ) .beforeAllSubcases(t => { - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfMultisampleNotSupportedForFormat(t.params.format); }) .fn(t => { const { format } = t.params; diff --git a/src/webgpu/gpu_test.ts b/src/webgpu/gpu_test.ts index 2c859ee9b26..9185ea5b837 100644 --- a/src/webgpu/gpu_test.ts +++ b/src/webgpu/gpu_test.ts @@ -32,8 +32,6 @@ import { isCompressedTextureFormat, ColorTextureFormat, isTextureFormatUsableAsStorageFormat, - is32Float, - is16Float, isMultisampledTextureFormat, } from './format_info.js'; import { checkElementsEqual, checkElementsBetween } from './util/check_contents.js'; @@ -230,13 +228,6 @@ 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; @@ -289,34 +280,24 @@ export class GPUTestSubcaseBatchState extends SubcaseBatchState { } } - skipIfMultisampleNotSupportedForFormatOrSelectDevice( - ...formats: (GPUTextureFormat | undefined)[] - ) { + skipIfMultisampleNotSupportedForFormat(...formats: (GPUTextureFormat | undefined)[]) { for (const format of formats) { if (format === undefined) continue; if (!isMultisampledTextureFormat(format, this.isCompatibility)) { this.skip(`texture format '${format}' is not supported to be multisampled`); } - // float16 and float32 format need to be color renderable first to support multisampled in compat mode - if (is16Float(format) || is32Float(format)) { - this.selectDeviceForRenderableColorFormatOrSkipTestCase(format); - } } + + this.skipIfColorRenderableNotSupportedForFormat(...formats); } - getFloatTextureFormatColorRenderableFeatures(...formats: (GPUTextureFormat | undefined)[]) { - const requiredFeatures: GPUFeatureName[] = []; - if (this.isCompatibility) { - for (const format of formats) { - if (format === undefined) continue; - if (is32Float(format)) { - requiredFeatures.push('float32-renderable' as GPUFeatureName); - } else if (is16Float(format)) { - requiredFeatures.push('float16-renderable' as GPUFeatureName); - } + skipIfColorRenderableNotSupportedForFormat(...formats: (GPUTextureFormat | undefined)[]) { + for (const format of formats) { + if (format === undefined) continue; + if (!kTextureFormatInfo[format].color) { + this.skip(`texture format '${format} is not color renderable`); } } - return requiredFeatures; } skipIfCopyTextureToTextureNotSupportedForFormat(...formats: (GPUTextureFormat | undefined)[]) { @@ -560,20 +541,6 @@ export class GPUTestBase extends Fixture { } skipIfColorRenderableNotSupportedForFormat(...formats: (GPUTextureFormat | undefined)[]) { - if (this.isCompatibility) { - const is16FloatRenderable = this.device.features.has('float16-renderable'); - const is32FloatRenderable = this.device.features.has('float32-renderable'); - for (const format of formats) { - if (format === undefined) continue; - if ( - (is16Float(format) && !is16FloatRenderable) || - (is32Float(format) && !is32FloatRenderable) - ) { - this.skip(`texture format '${format} is not color renderable in compat mode`); - } - } - } - for (const format of formats) { if (format === undefined) continue; if (!kTextureFormatInfo[format].color) { diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureDimensions.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureDimensions.spec.ts index 1f26b0ee275..983b7b8988d 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureDimensions.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureDimensions.spec.ts @@ -302,7 +302,7 @@ Parameters: t.skipIfTextureFormatNotSupported(t.params.format); if (t.params.samples > 1) { // multisampled texture requires GPUTextureUsage.RENDER_ATTACHMENT usage - t.skipIfMultisampleNotSupportedForFormatOrSelectDevice(t.params.format); + t.skipIfMultisampleNotSupportedForFormat(t.params.format); } t.selectDeviceOrSkipTestCase(info.feature); }) 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 588ea5820e7..62f91606664 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureLoad.spec.ts @@ -375,7 +375,7 @@ Parameters: const { format, texture_type } = t.params; t.skipIfTextureFormatNotSupported(format); t.skipIfTextureLoadNotSupportedForTextureType(texture_type); - t.skipIfMultisampleNotSupportedForFormatOrSelectDevice(format); + t.skipIfMultisampleNotSupportedForFormat(format); }) .fn(async t => { const { texture_type, format, stage, samplePoints, C, S } = t.params; diff --git a/src/webgpu/shader/execution/expression/call/builtin/texture_utils.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/texture_utils.spec.ts index e2eed0e4bba..6f4bf2a59cb 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/texture_utils.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/texture_utils.spec.ts @@ -96,7 +96,7 @@ g.test('readTextureToTexelViews') .beforeAllSubcases(t => { t.skipIfTextureViewDimensionNotSupported(t.params.viewDimension); // recheck if multisampled is supported with compat mode flag - t.skipIfMultisampleNotSupportedForFormatOrSelectDevice(t.params.srcFormat); + t.skipIfMultisampleNotSupportedForFormat(t.params.srcFormat); }) .fn(async t => { const { srcFormat, texelViewFormat, viewDimension, sampleCount } = t.params; diff --git a/src/webgpu/web_platform/canvas/configure.spec.ts b/src/webgpu/web_platform/canvas/configure.spec.ts index 9d396711784..ed68a9aa8be 100644 --- a/src/webgpu/web_platform/canvas/configure.spec.ts +++ b/src/webgpu/web_platform/canvas/configure.spec.ts @@ -157,7 +157,7 @@ g.test('format') ) .beforeAllSubcases(t => { t.selectDeviceForTextureFormatOrSkipTestCase(t.params.format); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); }) .fn(t => { const { canvasType, format } = t.params; @@ -447,7 +447,7 @@ g.test('viewFormats') ) ) .beforeAllSubcases(t => { - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(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 2109d8306b3..b04f5aa41ac 100644 --- a/src/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.ts +++ b/src/webgpu/web_platform/canvas/readbackFromWebGPUCanvas.spec.ts @@ -263,7 +263,7 @@ g.test('onscreenCanvas,snapshot') ) .beforeAllSubcases(t => { // rgba16float may not be color-renderable in compat mode - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); }) .fn(async t => { const canvas = initWebGPUCanvasContent( @@ -329,7 +329,7 @@ g.test('offscreenCanvas,snapshot') ) .beforeAllSubcases(t => { // rgba16float may not be color-renderable in compat mode - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); }) .fn(async t => { const offscreenCanvas = initWebGPUCanvasContent( @@ -388,7 +388,7 @@ g.test('onscreenCanvas,uploadToWebGL') ) .beforeAllSubcases(t => { // rgba16float may not be color-renderable in compat mode - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(t.params.format); }) .fn(t => { const { format, webgl, upload } = t.params; @@ -473,7 +473,7 @@ g.test('drawTo2DCanvas') ) .beforeAllSubcases(t => { // rgba16float may not be color-renderable in compat mode - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.format); + t.skipIfColorRenderableNotSupportedForFormat(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 e59a0c64654..690db0188a1 100644 --- a/src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts @@ -61,7 +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); + t.skipIfColorRenderableNotSupportedForFormat(t.params.dstFormat); }) .fn(async t => { const { @@ -183,7 +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); + t.skipIfColorRenderableNotSupportedForFormat(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 2e0369956f7..2345d00046f 100644 --- a/src/webgpu/web_platform/copyToTexture/ImageData.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/ImageData.spec.ts @@ -49,7 +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); + t.skipIfColorRenderableNotSupportedForFormat(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 d3758e04ddd..648448b84c9 100644 --- a/src/webgpu/web_platform/copyToTexture/canvas.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/canvas.spec.ts @@ -495,7 +495,7 @@ g.test('copy_contents_from_2d_context_canvas') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); + t.skipIfColorRenderableNotSupportedForFormat(t.params.dstColorFormat); }) .fn(t => { const { width, height, canvasType, dstAlphaMode } = t.params; @@ -560,7 +560,7 @@ g.test('copy_contents_from_gl_context_canvas') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); + t.skipIfColorRenderableNotSupportedForFormat(t.params.dstColorFormat); }) .fn(t => { const { width, height, canvasType, contextName, srcPremultiplied, dstAlphaMode } = t.params; @@ -630,7 +630,7 @@ g.test('copy_contents_from_gpu_context_canvas') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); + t.skipIfColorRenderableNotSupportedForFormat(t.params.dstColorFormat); t.selectMismatchedDeviceOrSkipTestCase(undefined); }) .fn(t => { @@ -697,7 +697,7 @@ g.test('copy_contents_from_bitmaprenderer_context_canvas') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); + t.skipIfColorRenderableNotSupportedForFormat(t.params.dstColorFormat); }) .fn(async t => { const { width, height, canvasType, dstAlphaMode } = t.params; @@ -774,7 +774,7 @@ g.test('color_space_conversion') ) .beforeAllSubcases(t => { t.skipIfTextureFormatNotSupported(t.params.dstColorFormat); - t.selectDeviceForRenderableColorFormatOrSkipTestCase(t.params.dstColorFormat); + t.skipIfColorRenderableNotSupportedForFormat(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 12ea2fa8e8b..2b6b89218a9 100644 --- a/src/webgpu/web_platform/copyToTexture/image.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/image.spec.ts @@ -63,7 +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); + t.skipIfColorRenderableNotSupportedForFormat(t.params.dstColorFormat); }) .fn(async t => { const { width, height, dstColorFormat, dstPremultiplied, srcDoFlipYDuringCopy } = t.params;