Skip to content

Commit 02f6385

Browse files
authored
Add test for GPUTextureFormats' resolve capability with tier1 (#4446)
Texture-formats-tier1 supports resolve capability on below formats: r8snorm, rg8snorm, rgba8snorm, rg11b10ufloat. This commit adds test for these formats to be consistent with the spec.
1 parent 8201672 commit 02f6385

File tree

1 file changed

+47
-4
lines changed

1 file changed

+47
-4
lines changed

src/webgpu/api/validation/capability_checks/features/texture_formats_tier1.spec.ts

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
kTextureFormatTier1AllowsRenderAttachmentBlendableMultisample,
1818
kTextureFormatTier1ThrowsWhenNotEnabled,
1919
kTextureFormatsTier1EnablesStorageReadOnlyWriteOnly,
20+
kTextureFormatTier1AllowsResolve,
2021
} from '../../../../format_info.js';
2122
import { UniqueFeaturesOrLimitsGPUTest } from '../../../../gpu_test.js';
2223
import * as vtu from '../../validation_test_utils.js';
@@ -217,13 +218,55 @@ g.test('render_pass,resolvable')
217218
.desc(
218219
`
219220
Test creating a render pass with resolve with a color target format enabled by
220-
'texture-formats-tier1' fails if the feature is not enabled.
221+
'texture-formats-tier1' success if the feature is enabled.
221222
222-
It's not clear this can be tested because you won't be able to create a render pipeline
223-
that passes validation which you need before you can create a render pass that resolves.
223+
Note: It's not possible to test the failure case (feature disabled).
224+
Because you won't be able to create a render pipeline that passes validation which
225+
you need before you can create a render pass that resolves.
224226
`
225227
)
226-
.unimplemented();
228+
.params(u =>
229+
u.combine('format', kTextureFormatTier1AllowsResolve).combine('enable_feature', [true])
230+
)
231+
.beforeAllSubcases(t => {
232+
const { enable_feature } = t.params;
233+
if (enable_feature) {
234+
t.selectDeviceOrSkipTestCase('texture-formats-tier1');
235+
}
236+
})
237+
.fn(t => {
238+
const { format } = t.params;
239+
240+
const size = [1, 1, 1];
241+
const sampleCount = 4;
242+
243+
const msaaTexture = t.createTextureTracked({
244+
format,
245+
size,
246+
sampleCount,
247+
usage: GPUTextureUsage.RENDER_ATTACHMENT,
248+
});
249+
250+
const resolveTexture = t.createTextureTracked({
251+
format,
252+
size,
253+
usage: GPUTextureUsage.RENDER_ATTACHMENT,
254+
});
255+
256+
const descriptor: GPURenderPassDescriptor = {
257+
colorAttachments: [
258+
{
259+
view: msaaTexture.createView(),
260+
resolveTarget: resolveTexture.createView(),
261+
loadOp: 'clear',
262+
storeOp: 'store',
263+
},
264+
],
265+
};
266+
267+
const encoder = t.device.createCommandEncoder();
268+
encoder.beginRenderPass(descriptor);
269+
});
227270

228271
g.test('bind_group_layout,storage_texture')
229272
.desc(

0 commit comments

Comments
 (0)