Skip to content

Commit

Permalink
Compat: Test that multisample copyT2T is validated out
Browse files Browse the repository at this point in the history
GLES 3.1 can't copy multisample textures
  • Loading branch information
greggman committed Feb 3, 2024
1 parent 0a086e0 commit ad066ef
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ Tests limitations of copyTextureToTextures in compat mode.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import { kCompressedTextureFormats, kTextureFormatInfo } from '../../../../../format_info.js';
import {
kAllTextureFormats,
kCompressedTextureFormats,
kTextureFormatInfo,
} from '../../../../../format_info.js';
import { CompatibilityTest } from '../../../../compatibility_test.js';

export const g = makeTestGroup(CompatibilityTest);

g.test('compressed')
.desc(
`Tests that you can not call copyTextureToTextures with compressed textures in compat mode.`
)
.desc(`Tests that you can not call copyTextureToTexture with compressed textures in compat mode.`)
.params(u => u.combine('format', kCompressedTextureFormats))
.beforeAllSubcases(t => {
const { format } = t.params;
Expand Down Expand Up @@ -46,3 +48,47 @@ g.test('compressed')
encoder.finish();
});
});

g.test('multisample')
.desc(`Test that you can not call copyTextureToTexture with multisample textures in compat mode.`)
.params(u =>
u
.beginSubcases()
.combine('format', kAllTextureFormats)
.filter(({ format }) => {
const info = kTextureFormatInfo[format];
return info.multisample && !info.feature;
})
)
.fn(t => {
const { format } = t.params;
const { blockWidth, blockHeight } = kTextureFormatInfo[format];

t.skipIfTextureFormatNotSupported(format as GPUTextureFormat);

const srcTexture = t.device.createTexture({
size: [blockWidth, blockHeight, 1],
format,
sampleCount: 4,
usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,
});
t.trackForCleanup(srcTexture);

const dstTexture = t.device.createTexture({
size: [blockWidth, blockHeight, 1],
format,
sampleCount: 4,
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT,
});
t.trackForCleanup(dstTexture);

const encoder = t.device.createCommandEncoder();
encoder.copyTextureToTexture({ texture: srcTexture }, { texture: dstTexture }, [
blockWidth,
blockHeight,
1,
]);
t.expectGPUError('validation', () => {
encoder.finish();
});
});
1 change: 1 addition & 0 deletions src/webgpu/listing_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@
"webgpu:compat,api,validation,createBindGroupLayout:unsupportedStorageTextureFormats:*": { "subcaseMS": 0.601 },
"webgpu:compat,api,validation,encoding,cmds,copyTextureToBuffer:compressed:*": { "subcaseMS": 202.929 },
"webgpu:compat,api,validation,encoding,cmds,copyTextureToTexture:compressed:*": { "subcaseMS": 0.600 },
"webgpu:compat,api,validation,encoding,cmds,copyTextureToTexture:multisample:*": { "subcaseMS": 0.600 },
"webgpu:compat,api,validation,encoding,programmable,pipeline_bind_group_compat:twoDifferentTextureViews,compute_pass,unused:*": { "subcaseMS": 1.501 },
"webgpu:compat,api,validation,encoding,programmable,pipeline_bind_group_compat:twoDifferentTextureViews,compute_pass,used:*": { "subcaseMS": 49.405 },
"webgpu:compat,api,validation,encoding,programmable,pipeline_bind_group_compat:twoDifferentTextureViews,render_pass,unused:*": { "subcaseMS": 16.002 },
Expand Down

0 comments on commit ad066ef

Please sign in to comment.