Skip to content

Commit f555996

Browse files
authored
Refactor api/validation/queue/* (#4279)
Issue #4178 Issue #4181
1 parent 42ec18a commit f555996

File tree

8 files changed

+23
-39
lines changed

8 files changed

+23
-39
lines changed

src/webgpu/api/validation/queue/buffer_mapped.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ operations to ensure the mapping state is only considered when a command buffer
2020
`;
2121

2222
import { makeTestGroup } from '../../../../common/framework/test_group.js';
23-
import { ValidationTest } from '../validation_test.js';
23+
import { AllFeaturesMaxLimitsValidationTest } from '../validation_test.js';
2424

25-
class F extends ValidationTest {
25+
class F extends AllFeaturesMaxLimitsValidationTest {
2626
async runBufferDependencyTest(usage: number, callback: Function): Promise<void> {
2727
const bufferDesc = {
2828
size: 8,

src/webgpu/api/validation/queue/copyToTexture/CopyExternalImageToTexture.spec.ts

+5-15
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@ import {
1212
import { makeTestGroup } from '../../../../../common/framework/test_group.js';
1313
import { raceWithRejectOnTimeout, unreachable, assert } from '../../../../../common/util/util.js';
1414
import { kTextureUsages } from '../../../../capability_info.js';
15-
import {
16-
kTextureFormatInfo,
17-
kAllTextureFormats,
18-
kValidTextureFormatsForCopyE2T,
19-
} from '../../../../format_info.js';
15+
import { kAllTextureFormats, kValidTextureFormatsForCopyE2T } from '../../../../format_info.js';
2016
import { kResourceStates } from '../../../../gpu_test.js';
2117
import {
2218
CanvasType,
2319
createCanvas,
2420
createOnscreenCanvas,
2521
createOffscreenCanvas,
2622
} from '../../../../util/create_elements.js';
27-
import { ValidationTest } from '../../validation_test.js';
23+
import { AllFeaturesMaxLimitsValidationTest } from '../../validation_test.js';
2824

2925
const kDefaultBytesPerPixel = 4; // using 'bgra8unorm' or 'rgba8unorm'
3026
const kDefaultWidth = 32;
@@ -136,7 +132,7 @@ function generateCopySizeForDstOOB({ mipLevel, dstOrigin }: WithDstOriginMipLeve
136132
];
137133
}
138134

139-
class CopyExternalImageToTextureTest extends ValidationTest {
135+
class CopyExternalImageToTextureTest extends AllFeaturesMaxLimitsValidationTest {
140136
onlineCrossOriginUrl = 'https://raw.githubusercontent.com/gpuweb/gpuweb/main/logo/webgpu.png';
141137

142138
getImageData(width: number, height: number): ImageData {
@@ -541,9 +537,7 @@ g.test('destination_texture,device_mismatch')
541537
'Tests copyExternalImageToTexture cannot be called with a destination texture created from another device'
542538
)
543539
.paramsSubcasesOnly(u => u.combine('mismatched', [true, false]))
544-
.beforeAllSubcases(t => {
545-
t.selectMismatchedDeviceOrSkipTestCase(undefined);
546-
})
540+
.beforeAllSubcases(t => t.usesMismatchedDevice())
547541
.fn(async t => {
548542
const { mismatched } = t.params;
549543
const sourceDevice = mismatched ? t.mismatchedDevice : t.device;
@@ -678,13 +672,9 @@ g.test('destination_texture,format')
678672
{ width: 1, height: 1, depthOrArrayLayers: 1 },
679673
])
680674
)
681-
.beforeAllSubcases(t => {
682-
const { format } = t.params;
683-
t.skipIfTextureFormatNotSupportedDeprecated(format);
684-
t.selectDeviceOrSkipTestCase(kTextureFormatInfo[format].feature);
685-
})
686675
.fn(async t => {
687676
const { format, copySize } = t.params;
677+
t.skipIfTextureFormatNotSupported(format);
688678

689679
const imageBitmap = await t.createImageBitmap(t.getImageData(1, 1));
690680

src/webgpu/api/validation/queue/destroyed/buffer.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Tests using a destroyed buffer on a queue.
33
`;
44

55
import { makeTestGroup } from '../../../../../common/framework/test_group.js';
6-
import { ValidationTest } from '../../validation_test.js';
6+
import { AllFeaturesMaxLimitsValidationTest } from '../../validation_test.js';
77

8-
export const g = makeTestGroup(ValidationTest);
8+
export const g = makeTestGroup(AllFeaturesMaxLimitsValidationTest);
99

1010
g.test('writeBuffer')
1111
.desc(

src/webgpu/api/validation/queue/destroyed/query_set.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Tests using a destroyed query set on a queue.
33
`;
44

55
import { makeTestGroup } from '../../../../../common/framework/test_group.js';
6-
import { ValidationTest } from '../../validation_test.js';
6+
import { AllFeaturesMaxLimitsValidationTest } from '../../validation_test.js';
77

8-
export const g = makeTestGroup(ValidationTest);
8+
export const g = makeTestGroup(AllFeaturesMaxLimitsValidationTest);
99

1010
g.test('beginOcclusionQuery')
1111
.desc(
@@ -34,8 +34,8 @@ Tests that use a destroyed query set in timestamp query on {non-pass, compute, r
3434
`
3535
)
3636
.params(u => u.beginSubcases().combine('querySetState', ['valid', 'destroyed'] as const))
37-
.beforeAllSubcases(t => t.selectDeviceOrSkipTestCase('timestamp-query'))
3837
.fn(t => {
38+
t.skipIfDeviceDoesNotSupportQueryType('timestamp');
3939
const querySet = t.createQuerySetWithState(t.params.querySetState, {
4040
type: 'timestamp',
4141
count: 2,

src/webgpu/api/validation/queue/destroyed/texture.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Tests using a destroyed texture on a queue.
44

55
import { makeTestGroup } from '../../../../../common/framework/test_group.js';
66
import { unreachable } from '../../../../../common/util/util.js';
7-
import { ValidationTest } from '../../validation_test.js';
7+
import { AllFeaturesMaxLimitsValidationTest } from '../../validation_test.js';
88

9-
export const g = makeTestGroup(ValidationTest);
9+
export const g = makeTestGroup(AllFeaturesMaxLimitsValidationTest);
1010

1111
g.test('writeTexture')
1212
.desc(

src/webgpu/api/validation/queue/submit.spec.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ Note: buffer map state is tested in ./buffer_mapped.spec.ts.
66
`;
77

88
import { makeTestGroup } from '../../../../common/framework/test_group.js';
9-
import { ValidationTest } from '../validation_test.js';
9+
import { AllFeaturesMaxLimitsValidationTest } from '../validation_test.js';
1010

1111
interface CommandBufferOptions {
1212
device?: GPUDevice;
1313
valid?: boolean;
1414
}
1515

16-
class F extends ValidationTest {
16+
class F extends AllFeaturesMaxLimitsValidationTest {
1717
createCommandBuffer(options: CommandBufferOptions = {}): GPUCommandBuffer {
1818
const device = options.device ?? this.device;
1919

@@ -48,9 +48,7 @@ g.test('command_buffer,device_mismatch')
4848
{ cb0Mismatched: true, cb1Mismatched: false },
4949
{ cb0Mismatched: false, cb1Mismatched: true },
5050
])
51-
.beforeAllSubcases(t => {
52-
t.selectMismatchedDeviceOrSkipTestCase(undefined);
53-
})
51+
.beforeAllSubcases(t => t.usesMismatchedDevice())
5452
.fn(t => {
5553
const { cb0Mismatched, cb1Mismatched } = t.params;
5654
const mismatched = cb0Mismatched || cb1Mismatched;

src/webgpu/api/validation/queue/writeBuffer.spec.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import {
1313
import { Float16Array } from '../../../../external/petamoriken/float16/float16.js';
1414
import { GPUConst } from '../../../constants.js';
1515
import { kResourceStates } from '../../../gpu_test.js';
16-
import { ValidationTest } from '../validation_test.js';
16+
import { AllFeaturesMaxLimitsValidationTest } from '../validation_test.js';
1717

18-
export const g = makeTestGroup(ValidationTest);
18+
export const g = makeTestGroup(AllFeaturesMaxLimitsValidationTest);
1919

2020
g.test('buffer_state')
2121
.desc(
@@ -179,9 +179,7 @@ g.test('usages')
179179
g.test('buffer,device_mismatch')
180180
.desc('Tests writeBuffer cannot be called with a buffer created from another device.')
181181
.paramsSubcasesOnly(u => u.combine('mismatched', [true, false]))
182-
.beforeAllSubcases(t => {
183-
t.selectMismatchedDeviceOrSkipTestCase(undefined);
184-
})
182+
.beforeAllSubcases(t => t.usesMismatchedDevice())
185183
.fn(t => {
186184
const { mismatched } = t.params;
187185
const sourceDevice = mismatched ? t.mismatchedDevice : t.device;

src/webgpu/api/validation/queue/writeTexture.spec.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ export const description = `Tests writeTexture validation.`;
33
import { makeTestGroup } from '../../../../common/framework/test_group.js';
44
import { GPUConst } from '../../../constants.js';
55
import { kResourceStates } from '../../../gpu_test.js';
6-
import { ValidationTest } from '../validation_test.js';
6+
import { AllFeaturesMaxLimitsValidationTest } from '../validation_test.js';
77

8-
export const g = makeTestGroup(ValidationTest);
8+
export const g = makeTestGroup(AllFeaturesMaxLimitsValidationTest);
99

1010
g.test('texture_state')
1111
.desc(
@@ -87,9 +87,7 @@ g.test('sample_count')
8787
g.test('texture,device_mismatch')
8888
.desc('Tests writeTexture cannot be called with a texture created from another device.')
8989
.paramsSubcasesOnly(u => u.combine('mismatched', [true, false]))
90-
.beforeAllSubcases(t => {
91-
t.selectMismatchedDeviceOrSkipTestCase(undefined);
92-
})
90+
.beforeAllSubcases(t => t.usesMismatchedDevice())
9391
.fn(t => {
9492
const { mismatched } = t.params;
9593
const sourceDevice = mismatched ? t.mismatchedDevice : t.device;

0 commit comments

Comments
 (0)