Skip to content

Commit

Permalink
rename extension->feature in capability_info
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed Apr 15, 2021
1 parent 0d21f75 commit 46b40ad
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const description = `copyTexturetoTexture operation tests
TODO([email protected]): support all WebGPU texture formats.
`;
TODO([email protected]): support all WebGPU texture formats.
`;

import { poptions, params } from '../../../../common/framework/params_builder.js';
import { makeTestGroup } from '../../../../common/framework/test_group.js';
Expand Down Expand Up @@ -415,7 +415,7 @@ g.test('color_textures,compressed,non_array')
)
.fn(async t => {
const { textureSize, format, copyBoxOffsets, srcCopyLevel, dstCopyLevel } = t.params;
await t.selectDeviceOrSkipTestCase(kCompressedTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kCompressedTextureFormatInfo[format].feature);

t.DoCopyTextureToTextureTest(
textureSize.srcTextureSize,
Expand Down Expand Up @@ -498,7 +498,7 @@ g.test('color_textures,compressed,array')
)
.fn(async t => {
const { textureSize, format, copyBoxOffsets, srcCopyLevel, dstCopyLevel } = t.params;
await t.selectDeviceOrSkipTestCase(kCompressedTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kCompressedTextureFormatInfo[format].feature);

t.DoCopyTextureToTextureTest(
textureSize.srcTextureSize,
Expand Down
8 changes: 4 additions & 4 deletions src/webgpu/api/operation/command_buffer/image_copy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ bytes in copy works for every format.
checkMethod,
} = t.params;
const info = kSizedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

// For CopyB2T and CopyT2B we need to have bytesPerRow 256-aligned,
// to make this happen we align the bytesInACompleteRow value and multiply
Expand Down Expand Up @@ -779,7 +779,7 @@ works for every format with 2d and 2d-array textures.
checkMethod,
} = t.params;
const info = kSizedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const offset = offsetInBlocks * info.bytesPerBlock;
const copySize = {
Expand Down Expand Up @@ -844,7 +844,7 @@ for all formats. We pass origin and copyExtent as [number, number, number].`
checkMethod,
} = t.params;
const info = kSizedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const originBlocks = [1, 1, 1];
const copySizeBlocks = [2, 2, 2];
Expand Down Expand Up @@ -1032,7 +1032,7 @@ g.test('mip_levels')
checkMethod,
} = t.params;
const info = kSizedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const origin = {
x: originInBlocks.x * info.blockWidth,
Expand Down
3 changes: 1 addition & 2 deletions src/webgpu/api/operation/resource_init/texture_zero.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,7 @@ export const g = makeTestGroup(TextureZeroInitTest);
g.test('uninitialized_texture_is_zero')
.params(paramsBuilder)
.fn(async t => {
const extension = kUncompressedTextureFormatInfo[t.params.format].extension;
await t.selectDeviceOrSkipTestCase(extension);
await t.selectDeviceOrSkipTestCase(kUncompressedTextureFormatInfo[t.params.format].feature);

const usage = getRequiredTextureUsage(
t.params.format,
Expand Down
2 changes: 1 addition & 1 deletion src/webgpu/api/validation/createBindGroupLayout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ g.test('bindingTypeSpecific_optional_members')
} = t.params;

if (storageTextureFormat !== undefined) {
await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[storageTextureFormat].extension);
await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[storageTextureFormat].feature);
}

let success = true;
Expand Down
3 changes: 1 addition & 2 deletions src/webgpu/api/validation/createRenderPipeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ g.test('color_formats_must_be_renderable')
.fn(async t => {
const format: GPUTextureFormat = t.params.format;
const info = kAllTextureFormatInfo[format];

await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const descriptor = t.getDescriptor({ targets: [{ format }] });

Expand Down
47 changes: 16 additions & 31 deletions src/webgpu/api/validation/createTexture.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ g.test('zero_size')
)
.fn(async t => {
const { dimension, zeroArgument, format } = t.params;

const info = kAllTextureFormatInfo[format];

await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const size = [info.blockWidth, info.blockHeight, 1];
let mipLevelCount = 1;
Expand Down Expand Up @@ -99,9 +97,8 @@ g.test('dimension_type_and_format_compatibility')
.subcases(() => params().combine(poptions('format', kAllTextureFormats)))
.fn(async t => {
const { dimension, format } = t.params;

const info = kAllTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const descriptor: GPUTextureDescriptor = {
size: [info.blockWidth, info.blockHeight, 1],
Expand Down Expand Up @@ -130,9 +127,8 @@ g.test('mipLevelCount,format')
)
.fn(async t => {
const { dimension, format, mipLevelCount } = t.params;

const info = kAllTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

// Note that compressed formats are not valid for 1D. They have already been filtered out for 1D in this test.
// So there is no dilemma about size.width equals 1 vs size.width % info.blockHeight equals 0 for 1D compressed formats.
Expand Down Expand Up @@ -191,8 +187,7 @@ g.test('mipLevelCount,bound_check')
)
.fn(async t => {
const { format, size, dimension } = t.params;

await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].feature);

const descriptor = {
size,
Expand Down Expand Up @@ -239,8 +234,7 @@ g.test('sampleCount,various_sampleCount_with_all_formats')
)
.fn(async t => {
const { dimension, sampleCount, format } = t.params;

await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].feature);

const descriptor = {
size: [32, 32, 1],
Expand Down Expand Up @@ -288,8 +282,7 @@ g.test('sampleCount,valid_sampleCount_with_other_parameter_varies')
)
.fn(async t => {
const { dimension, sampleCount, format, mipLevelCount, arrayLayerCount, usage } = t.params;

await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].feature);

const size =
dimension === '1d'
Expand Down Expand Up @@ -335,8 +328,7 @@ g.test('texture_size,default_value_and_smallest_size,uncompressed_format')
)
.fn(async t => {
const { dimension, format, size } = t.params;

await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].feature);

const descriptor: GPUTextureDescriptor = {
size,
Expand Down Expand Up @@ -372,10 +364,8 @@ g.test('texture_size,default_value_and_smallest_size,compressed_format')
)
.fn(async t => {
const { dimension, format, size, _success } = t.params;

const info = kCompressedTextureFormatInfo[format];

await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const descriptor: GPUTextureDescriptor = {
size,
Expand Down Expand Up @@ -407,8 +397,7 @@ g.test('texture_size,1d_texture')
)
.fn(async t => {
const { format, width, height, depthOrArrayLayers } = t.params;

await t.selectDeviceOrSkipTestCase(kUncompressedTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kUncompressedTextureFormatInfo[format].feature);

const descriptor: GPUTextureDescriptor = {
size: [width, height, depthOrArrayLayers],
Expand Down Expand Up @@ -450,8 +439,7 @@ g.test('texture_size,2d_texture,uncompressed_format')
)
.fn(async t => {
const { dimension, format, size } = t.params;

await t.selectDeviceOrSkipTestCase(kUncompressedTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kUncompressedTextureFormatInfo[format].feature);

const descriptor: GPUTextureDescriptor = {
size,
Expand Down Expand Up @@ -515,15 +503,14 @@ g.test('texture_size,2d_texture,compressed_format')
)
.fn(async t => {
const { dimension, format, size } = t.params;

const info = kCompressedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.feature);

assert(
DefaultLimits.maxTextureDimension2D % info.blockWidth === 0 &&
DefaultLimits.maxTextureDimension2D % info.blockHeight === 0
);

await t.selectDeviceOrSkipTestCase(info.extension);

const descriptor: GPUTextureDescriptor = {
size,
dimension,
Expand Down Expand Up @@ -567,8 +554,7 @@ g.test('texture_size,3d_texture,uncompressed_format')
)
.fn(async t => {
const { format, size } = t.params;

await t.selectDeviceOrSkipTestCase(kUncompressedTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kUncompressedTextureFormatInfo[format].feature);

const descriptor: GPUTextureDescriptor = {
size,
Expand Down Expand Up @@ -636,13 +622,13 @@ g.test('texture_size,3d_texture,compressed_format')
t.skip('Compressed 3D texture is not supported');

const info = kCompressedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.feature);

assert(
DefaultLimits.maxTextureDimension3D % info.blockWidth === 0 &&
DefaultLimits.maxTextureDimension3D % info.blockHeight === 0
);

await t.selectDeviceOrSkipTestCase(info.extension);

const descriptor: GPUTextureDescriptor = {
size,
dimension: '3d' as const,
Expand Down Expand Up @@ -679,8 +665,7 @@ g.test('texture_usage')
.fn(async t => {
const { dimension, format, usage0, usage1 } = t.params;
const info = kAllTextureFormatInfo[format];

await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const size = [info.blockWidth, info.blockHeight, 1];
const usage = usage0 | usage1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Test Plan: (TODO([email protected]): add tests on 1D/3D textures)

import { poptions, params } from '../../../../../common/framework/params_builder.js';
import { makeTestGroup } from '../../../../../common/framework/test_group.js';
import { assert } from '../../../../../common/framework/util/util.js';
import {
kAllTextureFormatInfo,
kAllTextureFormats,
Expand Down Expand Up @@ -272,7 +271,7 @@ g.test('texture_format_equality')
const { srcFormat, dstFormat } = t.params;
const srcFormatInfo = kAllTextureFormatInfo[srcFormat];
const dstFormatInfo = kAllTextureFormatInfo[dstFormat];
await t.selectDeviceOrSkipTestCase([srcFormatInfo.extension, dstFormatInfo.extension]);
await t.selectDeviceOrSkipTestCase([srcFormatInfo.feature, dstFormatInfo.feature]);

const kTextureSize = { width: 16, height: 16, depthOrArrayLayers: 1 };

Expand Down Expand Up @@ -336,8 +335,7 @@ g.test('depth_stencil_copy_restrictions')
srcCopyLevel,
dstCopyLevel,
} = t.params;

await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].feature);

const kMipLevelCount = 3;

Expand Down Expand Up @@ -524,11 +522,10 @@ Test the validations on the member 'aspect' of GPUImageCopyTexture in CopyTextur
)
.fn(async t => {
const { format, sourceAspect, destinationAspect } = t.params;
await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].feature);

const kTextureSize = { width: 16, height: 8, depthOrArrayLayers: 1 };

await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].extension);

const srcTexture = t.device.createTexture({
size: kTextureSize,
format,
Expand Down Expand Up @@ -591,10 +588,7 @@ g.test('copy_ranges_with_compressed_texture_formats')
)
.fn(async t => {
const { format, copyBoxOffsets, srcCopyLevel, dstCopyLevel } = t.params;

const feature = kAllTextureFormatInfo[format].extension;
assert(feature !== undefined);
await t.selectDeviceOrSkipTestCase(feature);
await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].feature);

const kTextureSize = { width: 60, height: 48, depthOrArrayLayers: 3 };
const kMipLevelCount = 4;
Expand Down
8 changes: 4 additions & 4 deletions src/webgpu/api/validation/image_copy/layout_related.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ g.test('required_bytes_in_copy')
method,
} = t.params;
const info = kSizedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

// In the CopyB2T and CopyT2B cases we need to have bytesPerRow 256-aligned,
// to make this happen we align the bytesInACompleteRow value and multiply
Expand Down Expand Up @@ -183,7 +183,7 @@ g.test('rows_per_image_alignment')
.fn(async t => {
const { rowsPerImage, format, method } = t.params;
const info = kSizedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const size = { width: 0, height: 0, depthOrArrayLayers: 0 };

Expand All @@ -207,7 +207,7 @@ g.test('texel_block_alignment_on_offset')
.fn(async t => {
const { format, offset, method } = t.params;
const info = kSizedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const size = { width: 0, height: 0, depthOrArrayLayers: 0 };

Expand Down Expand Up @@ -252,7 +252,7 @@ g.test('bound_on_bytes_per_row')
method,
} = t.params;
const info = kSizedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

// In the CopyB2T and CopyT2B cases we need to have bytesPerRow 256-aligned.
const bytesPerRowAlignment = method === 'WriteTexture' ? 1 : 256;
Expand Down
4 changes: 2 additions & 2 deletions src/webgpu/api/validation/image_copy/texture_related.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ g.test('origin_alignment')
.fn(async t => {
const { valueToCoordinate, coordinateToTest, format, method } = t.params;
const info = kSizedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const origin = { x: 0, y: 0, z: 0 };
const size = { width: 0, height: 0, depthOrArrayLayers: 0 };
Expand Down Expand Up @@ -238,7 +238,7 @@ g.test('size_alignment')
.fn(async t => {
const { valueToCoordinate, coordinateToTest, format, method } = t.params;
const info = kSizedTextureFormatInfo[format];
await t.selectDeviceOrSkipTestCase(info.extension);
await t.selectDeviceOrSkipTestCase(info.feature);

const origin = { x: 0, y: 0, z: 0 };
const size = { width: 0, height: 0, depthOrArrayLayers: 0 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ g.test('destination_texture,format')
)
.fn(async t => {
const { format, copySize } = t.params;

await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kAllTextureFormatInfo[format].feature);

const imageBitmap = await createImageBitmap(t.getImageData(1, 1));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,7 @@ g.test('subresources_and_binding_types_combination_for_aspect')
_resourceSuccess,
_usageSuccess,
} = t.params;

await t.selectDeviceOrSkipTestCase(kDepthStencilFormatInfo[format].extension);
await t.selectDeviceOrSkipTestCase(kDepthStencilFormatInfo[format].feature);

const texture = t.createTexture({
arrayLayerCount: TOTAL_LAYERS,
Expand Down
Loading

0 comments on commit 46b40ad

Please sign in to comment.