1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/**
* AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
**/import { assert } from '../../../../../common/util/util.js';import { kTextureFormatInfo } from '../../../../format_info.js';import { virtualMipSize } from '../../../../util/texture/base.js';
export const checkContentsByBufferCopy = (
t,
params,
texture,
state,
subresourceRange) =>
{
for (const { level: mipLevel, layer } of subresourceRange.each()) {
assert(params.format in kTextureFormatInfo);
const format = params.format;
t.expectSingleColor(texture, format, {
size: [t.textureWidth, t.textureHeight, t.textureDepth],
dimension: params.dimension,
slice: params.dimension === '2d' ? layer : 0,
layout: { mipLevel, aspect: params.aspect },
exp: t.stateToTexelComponents[state]
});
}
};
export const checkContentsByTextureCopy = (
t,
params,
texture,
state,
subresourceRange) =>
{
for (const { level, layer } of subresourceRange.each()) {
assert(params.format in kTextureFormatInfo);
const format = params.format;
const [width, height, depth] = virtualMipSize(
params.dimension,
[t.textureWidth, t.textureHeight, t.textureDepth],
level
);
const dst = t.device.createTexture({
dimension: params.dimension,
size: [width, height, depth],
format: params.format,
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC
});
t.trackForCleanup(dst);
const commandEncoder = t.device.createCommandEncoder();
commandEncoder.copyTextureToTexture(
{ texture, mipLevel: level, origin: { x: 0, y: 0, z: layer } },
{ texture: dst, mipLevel: 0 },
{ width, height, depthOrArrayLayers: depth }
);
t.queue.submit([commandEncoder.finish()]);
t.expectSingleColor(dst, format, {
size: [width, height, depth],
exp: t.stateToTexelComponents[state],
layout: { mipLevel: 0, aspect: params.aspect }
});
}
};
|