Skip to content

Commit

Permalink
Fix after #4150
Browse files Browse the repository at this point in the history
  • Loading branch information
shrekshao committed Jan 17, 2025
1 parent 149a20b commit c02fc90
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/webgpu/api/operation/render_pass/storeOp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/webgpu/api/operation/render_pipeline/overrides.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ g.test('precision')
])
)
.beforeAllSubcases(t => {
t.skipIfFloatTextureFormatNotColorRenderable(kPrecisionTestFormat);
t.selectDeviceForRenderableColorFormatOrSkipTestCase(kPrecisionTestFormat);
})
.fn(async t => {
const format = kPrecisionTestFormat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
13 changes: 4 additions & 9 deletions src/webgpu/api/operation/rendering/color_target_state.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 2 additions & 5 deletions src/webgpu/api/operation/resource_init/texture_zero.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 5 additions & 5 deletions src/webgpu/api/operation/sampling/filter_mode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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');
}
Expand Down
16 changes: 7 additions & 9 deletions src/webgpu/gpu_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<DeviceProvider> | undefined {
return this.mismatchedProvider;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit c02fc90

Please sign in to comment.