Skip to content

Commit 20c8e55

Browse files
Bug 2004624 - test(webgpu): update CTS to f7d27f91423683338da291a4a8bdb10dabebb42d r=webgpu-reviewers,nical
Notable "regressions": - The immediate data API proposal has been added to CTS. This shouldn't be failing, and will receive some follow-up (see [`gpuweb`#5480](gpuweb/gpuweb#5480)), but actually implementing this feature is tracked in <https://bugzilla.mozilla.org/show_bug.cgi?id=2005059>. - In similar fashion, the transient textures proposal has been added to CTS, and shouldn't be failing. Follow-up to implement it is being tracked in <https://bugzilla.mozilla.org/show_bug.cgi?id=2005061>. Differential Revision: https://phabricator.services.mozilla.com/D275409
1 parent e7ac05a commit 20c8e55

File tree

46 files changed

+2271
-694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2271
-694
lines changed

dom/webgpu/tests/cts/checkout/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dom/webgpu/tests/cts/checkout/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@types/w3c-image-capture": "^1.0.10",
5151
"@typescript-eslint/eslint-plugin": "^6.9.1",
5252
"@typescript-eslint/parser": "^6.9.1",
53-
"@webgpu/types": "^0.1.66",
53+
"@webgpu/types": "^0.1.67",
5454
"ansi-colors": "4.1.3",
5555
"babel-plugin-add-header-comment": "^1.0.3",
5656
"babel-plugin-const-enum": "^1.2.0",
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
export const description = `
2+
Test for shader uniformity code snippet generation.
3+
`;
4+
5+
import { makeTestGroup } from '../common/framework/test_group.js';
6+
import { specToCode } from '../webgpu/shader/validation/uniformity/snippet.js';
7+
8+
import { UnitTest } from './unit_test.js';
9+
10+
class F extends UnitTest {
11+
test(spec: string, expect: string): void {
12+
const got = specToCode(spec);
13+
this.expect(
14+
expect === got,
15+
`
16+
expected: ${expect}
17+
got: ${got}`
18+
);
19+
}
20+
}
21+
22+
export const g = makeTestGroup(F);
23+
24+
g.test('strings').fn(t => {
25+
t.test(
26+
'loop-end',
27+
` loop {
28+
}
29+
`
30+
),
31+
t.test(
32+
'loop-cond-break-op',
33+
` loop {
34+
if <cond> {break;}
35+
<op>
36+
}
37+
`
38+
),
39+
t.test(
40+
'for-unif-always-return-op',
41+
` for (;<uniform_cond>;) {
42+
return;
43+
<op>
44+
}
45+
`
46+
),
47+
t.test(
48+
'loop-op-continuing-cond-break',
49+
` loop {
50+
<op>
51+
continuing {
52+
break if <cond>;
53+
}
54+
}
55+
`
56+
),
57+
t.test(
58+
// This is the case suggested in https://github.com/gpuweb/cts/pull/4477#issuecomment-3408419425
59+
'loop-always-return-continuing-cond-break-end-op',
60+
` loop {
61+
return;
62+
continuing {
63+
break if <cond>;
64+
}
65+
}
66+
<op>
67+
`
68+
);
69+
});

dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/createBindGroup.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
kTextureViewDimensions,
2424
sampledAndStorageBindingEntries,
2525
texBindingTypeInfo,
26+
IsValidTransientAttachmentUsage,
2627
} from '../../capability_info.js';
2728
import { GPUConst } from '../../constants.js';
2829
import { kPossibleStorageTextureFormats, kRegularTextureFormats } from '../../format_info.js';
@@ -199,6 +200,13 @@ g.test('texture_binding_must_have_correct_usage')
199200
.combine('usage', kTextureUsages)
200201
.unless(({ entry, usage }) => {
201202
const info = texBindingTypeInfo(entry);
203+
// TRANSIENT_ATTACHMENT is only valid when combined with RENDER_ATTACHMENT, so skip.
204+
if (
205+
usage === GPUConst.TextureUsage.TRANSIENT_ATTACHMENT &&
206+
info.resource !== 'sampledTexMS'
207+
) {
208+
return true;
209+
}
202210
// Can't create the texture for this (usage=STORAGE_BINDING and sampleCount=4), so skip.
203211
return usage === GPUConst.TextureUsage.STORAGE_BINDING && info.resource === 'sampledTexMS';
204212
})
@@ -781,6 +789,13 @@ g.test('storage_texture,usage')
781789
// a combined usage.
782790
.combine('usage0', kTextureUsages)
783791
.combine('usage1', kTextureUsages)
792+
.unless(({ usage0, usage1 }) => {
793+
const usage = usage0 | usage1;
794+
return (
795+
(usage & GPUConst.TextureUsage.TRANSIENT_ATTACHMENT) !== 0 &&
796+
!IsValidTransientAttachmentUsage(usage)
797+
);
798+
})
784799
)
785800
.fn(t => {
786801
const { usage0, usage1 } = t.params;
@@ -1212,6 +1227,13 @@ g.test('external_texture,texture_view,usage')
12121227
// a combined usage.
12131228
.combine('usage0', kTextureUsages)
12141229
.combine('usage1', kTextureUsages)
1230+
.unless(({ usage0, usage1 }) => {
1231+
const usage = usage0 | usage1;
1232+
return (
1233+
(usage & GPUConst.TextureUsage.TRANSIENT_ATTACHMENT) !== 0 &&
1234+
!IsValidTransientAttachmentUsage(usage)
1235+
);
1236+
})
12151237
)
12161238
.fn(t => {
12171239
const { usage0, usage1 } = t.params;

dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/createTexture.spec.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ export const description = `createTexture validation tests.`;
33
import { AllFeaturesMaxLimitsGPUTest } from '../.././gpu_test.js';
44
import { makeTestGroup } from '../../../common/framework/test_group.js';
55
import { assert, makeValueTestVariant } from '../../../common/util/util.js';
6-
import { kTextureDimensions, kTextureUsages } from '../../capability_info.js';
6+
import {
7+
kTextureDimensions,
8+
kTextureUsages,
9+
IsValidTransientAttachmentUsage,
10+
} from '../../capability_info.js';
711
import { GPUConst } from '../../constants.js';
812
import {
913
kAllTextureFormats,
@@ -343,7 +347,11 @@ g.test('sampleCount,valid_sampleCount_with_other_parameter_varies')
343347
dimension !== '2d')) ||
344348
((usage & GPUConst.TextureUsage.STORAGE_BINDING) !== 0 &&
345349
!isTextureFormatPossiblyStorageReadable(format)) ||
346-
(mipLevelCount !== 1 && dimension === '1d')
350+
(mipLevelCount !== 1 && dimension === '1d') ||
351+
((usage & GPUConst.TextureUsage.TRANSIENT_ATTACHMENT) !== 0 &&
352+
usage !==
353+
(GPUConst.TextureUsage.RENDER_ATTACHMENT |
354+
GPUConst.TextureUsage.TRANSIENT_ATTACHMENT))
347355
);
348356
})
349357
)
@@ -1008,6 +1016,13 @@ g.test('texture_usage')
10081016
.filter(({ dimension, format }) =>
10091017
textureFormatAndDimensionPossiblyCompatible(dimension, format)
10101018
)
1019+
.unless(({ usage0, usage1 }) => {
1020+
const usage = usage0 | usage1;
1021+
return (
1022+
(usage & GPUConst.TextureUsage.TRANSIENT_ATTACHMENT) !== 0 &&
1023+
!IsValidTransientAttachmentUsage(usage)
1024+
);
1025+
})
10111026
)
10121027
.fn(t => {
10131028
const { dimension, format, usage0, usage1 } = t.params;
@@ -1037,6 +1052,11 @@ g.test('texture_usage')
10371052
if (isColorTextureFormat(format) && !isTextureFormatColorRenderable(t.device, format))
10381053
success = false;
10391054
}
1055+
if (usage & GPUTextureUsage.TRANSIENT_ATTACHMENT) {
1056+
if (usage !== (GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TRANSIENT_ATTACHMENT)) {
1057+
success = false;
1058+
}
1059+
}
10401060

10411061
t.expectValidationError(() => {
10421062
t.createTextureTracked(descriptor);

dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/createView.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,13 @@ g.test('texture_view_usage')
357357
})
358358
.beginSubcases()
359359
.combine('textureViewUsage', [0, ...kTextureUsages])
360+
.unless(({ textureUsage, textureViewUsage }) => {
361+
// TRANSIENT_ATTACHMENT is only valid when combined with RENDER_ATTACHMENT.
362+
return (
363+
textureUsage === GPUConst.TextureUsage.TRANSIENT_ATTACHMENT ||
364+
textureViewUsage === GPUConst.TextureUsage.TRANSIENT_ATTACHMENT
365+
);
366+
})
360367
)
361368
.fn(t => {
362369
const { format, textureUsage, textureViewUsage } = t.params;
@@ -394,6 +401,10 @@ g.test('texture_view_usage_with_view_format')
394401
.combine('usage', kTextureUsages)
395402
.beginSubcases()
396403
.combine('viewFormat', kAllTextureFormats)
404+
.unless(({ usage }) => {
405+
// TRANSIENT_ATTACHMENT is only valid when combined with RENDER_ATTACHMENT.
406+
return usage === GPUConst.TextureUsage.TRANSIENT_ATTACHMENT;
407+
})
397408
)
398409
.fn(t => {
399410
const { textureFormat, viewFormat, usage } = t.params;

dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/encoding/encoder_open_state.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ const kRenderPassEncoderCommandInfo: {
9898
setScissorRect: {},
9999
setBlendConstant: {},
100100
setStencilReference: {},
101+
setImmediates: {},
101102
beginOcclusionQuery: {},
102103
endOcclusionQuery: {},
103104
executeBundles: {},
@@ -122,6 +123,7 @@ const kRenderBundleEncoderCommandInfo: {
122123
setBindGroup: {},
123124
setIndexBuffer: {},
124125
setVertexBuffer: {},
126+
setImmediates: {},
125127
pushDebugGroup: {},
126128
popDebugGroup: {},
127129
insertDebugMarker: {},
@@ -141,6 +143,7 @@ const kComputePassEncoderCommandInfo: {
141143
setPipeline: {},
142144
dispatchWorkgroups: {},
143145
dispatchWorkgroupsIndirect: {},
146+
setImmediates: {},
144147
pushDebugGroup: {},
145148
popDebugGroup: {},
146149
insertDebugMarker: {},
@@ -391,6 +394,12 @@ g.test('render_pass_commands')
391394
renderPass.setStencilReference(0);
392395
}
393396
break;
397+
case 'setImmediates':
398+
{
399+
const data = new Uint32Array(1);
400+
renderPass.setImmediates(0, data, 0, 1);
401+
}
402+
break;
394403
case 'beginOcclusionQuery':
395404
{
396405
renderPass.beginOcclusionQuery(0);
@@ -502,6 +511,12 @@ g.test('render_bundle_commands')
502511
bundleEncoder.setVertexBuffer(1, buffer);
503512
}
504513
break;
514+
case 'setImmediates':
515+
{
516+
const data = new Uint32Array(1);
517+
bundleEncoder.setImmediates(0, data, 0, 1);
518+
}
519+
break;
505520
case 'pushDebugGroup':
506521
{
507522
bundleEncoder.pushDebugGroup('group');
@@ -584,6 +599,12 @@ g.test('compute_pass_commands')
584599
computePass.dispatchWorkgroupsIndirect(indirectBuffer, 0);
585600
}
586601
break;
602+
case 'setImmediates':
603+
{
604+
const data = new Uint32Array(1);
605+
computePass.setImmediates(0, data, 0, 1);
606+
}
607+
break;
587608
case 'pushDebugGroup':
588609
{
589610
computePass.pushDebugGroup('group');

0 commit comments

Comments
 (0)