Skip to content

Commit

Permalink
Compat: Check that copyTextureToTexture fails for compressed textures
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Nov 9, 2023
1 parent afc627f commit b0244b9
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
export const description = `
Tests limitations of copyTextureToTextures in compat mode.
`;

import { makeTestGroup } from '../../../../../../common/framework/test_group.js';
import { 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.`
)
.params(u => u.combine('format', kCompressedTextureFormats))
.beforeAllSubcases(t => {
const { format } = t.params;
t.selectDeviceOrSkipTestCase([kTextureFormatInfo[format].feature]);
})
.fn(t => {
const { format } = t.params;

const { blockWidth, blockHeight } = kTextureFormatInfo[format];

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

const dstTexture = t.device.createTexture({
size: [blockWidth, blockHeight, 1],
format,
usage: GPUTextureUsage.COPY_SRC,
});
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 @@ -830,6 +830,7 @@
"webgpu:api,validation,texture,rg11b10ufloat_renderable:create_texture:*": { "subcaseMS": 12.700 },
"webgpu:compat,api,validation,createBindGroup:viewDimension_matches_textureBindingViewDimension:*": { "subcaseMS": 6.523 },
"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,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 b0244b9

Please sign in to comment.