From d2bd876e5bf5c0ec518c798315e33a5379aafbc7 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Mon, 4 Nov 2024 22:58:13 +0100 Subject: [PATCH] Update webgpu/types to 0.1.50 (#4029) This makes toneMapping optional which required updating a few tests to use the nullish coalescing operator when accessing it. New vertex formats are added that require updating capability_info.ts (and tests for unorm8x4-bgra is added at the same time). Finally dictionary types for copies are renamed throughout the CTS even if deprecated aliases are available. --- package-lock.json | 17 +++--- package.json | 2 +- .../command_buffer/image_copy.spec.ts | 22 +++---- .../vertex_state/correctness.spec.ts | 60 +++++++++++++------ .../limits/maxTextureDimension2D.spec.ts | 4 +- .../cmds/copyTextureToTexture.spec.ts | 6 +- .../image_copy/buffer_texture_copies.spec.ts | 12 ++-- .../api/validation/image_copy/image_copy.ts | 6 +- .../CopyExternalImageToTexture.spec.ts | 4 +- src/webgpu/capability_info.ts | 14 ++++- src/webgpu/gpu_test.ts | 14 ++--- src/webgpu/listing_meta.json | 11 ++++ .../call/builtin/textureSample.spec.ts | 2 +- .../call/builtin/textureSampleBias.spec.ts | 2 +- .../call/builtin/textureSampleGrad.spec.ts | 2 +- .../shader_io/fragment_builtins.spec.ts | 2 +- .../call/builtin/const_override_validation.ts | 6 +- src/webgpu/util/copy_to_texture.ts | 4 +- src/webgpu/util/texture.ts | 4 +- src/webgpu/util/texture/layout.ts | 2 +- src/webgpu/util/texture/texel_data.ts | 2 +- src/webgpu/util/texture/texture_ok.ts | 4 +- .../web_platform/canvas/configure.spec.ts | 6 +- .../copyToTexture/ImageBitmap.spec.ts | 24 ++++---- .../copyToTexture/ImageData.spec.ts | 12 ++-- .../web_platform/copyToTexture/canvas.spec.ts | 30 +++++----- .../web_platform/copyToTexture/image.spec.ts | 12 ++-- .../web_platform/copyToTexture/video.spec.ts | 4 +- 28 files changed, 169 insertions(+), 121 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc4e97a2ce64..5768ae3b5761 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "@types/w3c-image-capture": "^1.0.10", "@typescript-eslint/eslint-plugin": "^6.9.1", "@typescript-eslint/parser": "^6.9.1", - "@webgpu/types": "^0.1.49", + "@webgpu/types": "^0.1.50", "ansi-colors": "4.1.3", "babel-plugin-add-header-comment": "^1.0.3", "babel-plugin-const-enum": "^1.2.0", @@ -1539,10 +1539,11 @@ "dev": true }, "node_modules/@webgpu/types": { - "version": "0.1.49", - "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.49.tgz", - "integrity": "sha512-NMmS8/DofhH/IFeW+876XrHVWel+J/vdcFCHLDqeJgkH9x0DeiwjVd8LcBdaxdG/T7Rf8VUAYsA8X1efMzLjRQ==", - "dev": true + "version": "0.1.50", + "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.50.tgz", + "integrity": "sha512-GjG3CQV7SyWk/lEXqFPuKchRPHIBbD317Gj8NUqqB+UOnQlOYtjGLCTRIWzO9Ta698LVzlBCSE9XKqBSWpIDmg==", + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/abbrev": { "version": "1.1.1", @@ -10076,9 +10077,9 @@ "dev": true }, "@webgpu/types": { - "version": "0.1.49", - "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.49.tgz", - "integrity": "sha512-NMmS8/DofhH/IFeW+876XrHVWel+J/vdcFCHLDqeJgkH9x0DeiwjVd8LcBdaxdG/T7Rf8VUAYsA8X1efMzLjRQ==", + "version": "0.1.50", + "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.50.tgz", + "integrity": "sha512-GjG3CQV7SyWk/lEXqFPuKchRPHIBbD317Gj8NUqqB+UOnQlOYtjGLCTRIWzO9Ta698LVzlBCSE9XKqBSWpIDmg==", "dev": true }, "abbrev": { diff --git a/package.json b/package.json index 3ef62315db25..c7331d241d12 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "@types/w3c-image-capture": "^1.0.10", "@typescript-eslint/eslint-plugin": "^6.9.1", "@typescript-eslint/parser": "^6.9.1", - "@webgpu/types": "^0.1.49", + "@webgpu/types": "^0.1.50", "ansi-colors": "4.1.3", "babel-plugin-add-header-comment": "^1.0.3", "babel-plugin-const-enum": "^1.2.0", diff --git a/src/webgpu/api/operation/command_buffer/image_copy.spec.ts b/src/webgpu/api/operation/command_buffer/image_copy.spec.ts index b27ecbbb91d0..73f1ff751b4c 100644 --- a/src/webgpu/api/operation/command_buffer/image_copy.spec.ts +++ b/src/webgpu/api/operation/command_buffer/image_copy.spec.ts @@ -126,7 +126,7 @@ const altDataGenerator = new DataArrayGenerator(); class ImageCopyTest extends TextureTestMixin(GPUTest) { /** - * This is used for testing passing undefined members of `GPUImageDataLayout` instead of actual + * This is used for testing passing undefined members of `GPUTexelCopyBufferLayout` instead of actual * values where possible. Passing arguments as values and not as objects so that they are passed * by copy and not by reference. */ @@ -135,7 +135,7 @@ class ImageCopyTest extends TextureTestMixin(GPUTest) { rowsPerImage: number | undefined, bytesPerRow: number | undefined, changeBeforePass: ChangeBeforePass - ): GPUImageDataLayout { + ): GPUTexelCopyBufferLayout { if (changeBeforePass === 'undefined') { if (offset === 0) { offset = undefined; @@ -151,7 +151,7 @@ class ImageCopyTest extends TextureTestMixin(GPUTest) { } /** - * This is used for testing passing undefined members of `GPUImageCopyTexture` instead of actual + * This is used for testing passing undefined members of `GPUTexelCopyTextureInfo` instead of actual * values where possible and also for testing passing the origin as `[number, number, number]`. * Passing arguments as values and not as objects so that they are passed by copy and not by * reference. @@ -163,7 +163,7 @@ class ImageCopyTest extends TextureTestMixin(GPUTest) { origin_z: number | undefined, mipLevel: number | undefined, changeBeforePass: ChangeBeforePass - ): GPUImageCopyTexture { + ): GPUTexelCopyTextureInfo { let origin: GPUOrigin3D | undefined = { x: origin_x, y: origin_y, z: origin_z }; if (changeBeforePass === 'undefined') { @@ -225,7 +225,7 @@ class ImageCopyTest extends TextureTestMixin(GPUTest) { buffer: GPUBuffer, format: ColorTextureFormat, size: Required, - dataLayout: Required + dataLayout: Required ) { if (isCompressedTextureFormat(format)) { this.expectGPUBufferValuesEqual(buffer, expected); @@ -323,7 +323,7 @@ class ImageCopyTest extends TextureTestMixin(GPUTest) { /** Run a CopyT2B command with appropriate arguments corresponding to `ChangeBeforePass` */ copyTextureToBufferWithAppliedArguments( buffer: GPUBuffer, - { offset, rowsPerImage, bytesPerRow }: Required, + { offset, rowsPerImage, bytesPerRow }: Required, { width, height, depthOrArrayLayers }: Required, { texture, mipLevel, origin }: TextureCopyViewWithRequiredOrigin, changeBeforePass: ChangeBeforePass @@ -363,7 +363,7 @@ class ImageCopyTest extends TextureTestMixin(GPUTest) { /** Put data into a part of the texture with an appropriate method. */ uploadLinearTextureDataToTextureSubBox( textureCopyView: TextureCopyViewWithRequiredOrigin, - textureDataLayout: GPUImageDataLayout & { bytesPerRow: number }, + textureDataLayout: GPUTexelCopyBufferLayout & { bytesPerRow: number }, copySize: Required, partialData: Uint8Array, method: InitMethod, @@ -432,7 +432,7 @@ class ImageCopyTest extends TextureTestMixin(GPUTest) { copySize: Required, format: ColorTextureFormat, expected: Uint8Array, - expectedDataLayout: Required + expectedDataLayout: Required ): void { const size = [ actualTexture.width, @@ -507,7 +507,7 @@ class ImageCopyTest extends TextureTestMixin(GPUTest) { checkSize: Required, format: ColorTextureFormat, expected: Uint8Array, - expectedDataLayout: Required, + expectedDataLayout: Required, changeBeforePass: ChangeBeforePass = 'none' ): void { // The alignment is necessary because we need to copy and map data from this buffer. @@ -573,7 +573,7 @@ class ImageCopyTest extends TextureTestMixin(GPUTest) { copyWholeTextureToBufferAndCheckContentsWithUpdatedData( { texture, mipLevel, origin }: TextureCopyViewWithRequiredOrigin, fullTextureCopyLayout: TextureCopyLayout, - texturePartialDataLayout: Required, + texturePartialDataLayout: Required, copySize: Required, format: ColorTextureFormat, fullData: GPUBuffer, @@ -632,7 +632,7 @@ class ImageCopyTest extends TextureTestMixin(GPUTest) { checkMethod, changeBeforePass = 'none', }: { - textureDataLayout: Required; + textureDataLayout: Required; copySize: Required; dataSize: number; mipLevel?: number; diff --git a/src/webgpu/api/operation/vertex_state/correctness.spec.ts b/src/webgpu/api/operation/vertex_state/correctness.spec.ts index 7af06e150616..1e023b09fb62 100644 --- a/src/webgpu/api/operation/vertex_state/correctness.spec.ts +++ b/src/webgpu/api/operation/vertex_state/correctness.spec.ts @@ -427,25 +427,51 @@ struct VSOutputs { case 'unorm': { if (formatInfo.bytesPerComponent === 'packed') { - assert(format === 'unorm10-10-10-2'); // This is the only packed format for now. assert(bitSize === 0); - /* prettier-ignore */ - const data = [ - [ 0, 0, 0, 0], - [1023, 1023, 1023, 3], - [ 243, 567, 765, 2], - ]; - const vertexData = new Uint32Array(data.map(makeRgb10a2)).buffer; - const expectedData = new Float32Array(data.flat().map(normalizeRgb10a2)).buffer; - - return { - shaderBaseType: 'f32', - testComponentCount: data.flat().length, - expectedData, - vertexData, - floatTolerance: 0.1 / 1023, - }; + switch (format) { + case 'unorm10-10-10-2': { + /* prettier-ignore */ + const data = [ + [ 0, 0, 0, 0], + [1023, 1023, 1023, 3], + [ 243, 567, 765, 2], + ]; + const vertexData = new Uint32Array(data.map(makeRgb10a2)).buffer; + const expectedData = new Float32Array(data.flat().map(normalizeRgb10a2)).buffer; + + return { + shaderBaseType: 'f32', + testComponentCount: data.flat().length, + expectedData, + vertexData, + floatTolerance: 0.1 / 1023, + }; + } + + case 'unorm8x4-bgra': { + const data = [42, 0, 1, 2, 3, 4, 128, 255]; + const vertexData = new Uint8Array(data).buffer; + const expectedData = new Float32Array( + data.map(v => normalizedIntegerAsFloat(v, 8, false)) + ); + + for (let i = 0; i + 2 < expectedData.length; i += 4) { + const r = expectedData[i + 0]; + const b = expectedData[i + 2]; + expectedData[i + 0] = b; + expectedData[i + 2] = r; + } + + return { + shaderBaseType: 'f32', + testComponentCount: data.length, + expectedData: expectedData.buffer, + vertexData, + floatTolerance: 0.1 / 255, + }; + } + } } /* prettier-ignore */ diff --git a/src/webgpu/api/validation/capability_checks/limits/maxTextureDimension2D.spec.ts b/src/webgpu/api/validation/capability_checks/limits/maxTextureDimension2D.spec.ts index d67b165a0fd0..cfe9fe18a4a9 100644 --- a/src/webgpu/api/validation/capability_checks/limits/maxTextureDimension2D.spec.ts +++ b/src/webgpu/api/validation/capability_checks/limits/maxTextureDimension2D.spec.ts @@ -59,7 +59,7 @@ g.test('configure,at_over') // This should not fail, even if the size is too large but it might fail // if we're in a worker and HTMLCanvasElement does not exist. - const canvas = createCanvas(t, canvasType, size[0], size[1])!; + const canvas = createCanvas(t, canvasType, size[0], size[1]); if (canvas) { const context = canvas.getContext('webgpu') as GPUCanvasContext; t.expect(!!context, 'should not fail to create context even if size is too large'); @@ -96,7 +96,7 @@ g.test('getCurrentTexture,at_over') // Start with a small size so configure will succeed. // This should not fail, even if the size is too large but it might fail // if we're in a worker and HTMLCanvasElement does not exist. - const canvas = createCanvas(t, canvasType, 1, 1)!; + const canvas = createCanvas(t, canvasType, 1, 1); if (canvas) { const context = canvas.getContext('webgpu') as GPUCanvasContext; t.expect(!!context, 'should not fail to create context even if size is too large'); diff --git a/src/webgpu/api/validation/encoding/cmds/copyTextureToTexture.spec.ts b/src/webgpu/api/validation/encoding/cmds/copyTextureToTexture.spec.ts index c49261c0a055..f29ca3d9057c 100644 --- a/src/webgpu/api/validation/encoding/cmds/copyTextureToTexture.spec.ts +++ b/src/webgpu/api/validation/encoding/cmds/copyTextureToTexture.spec.ts @@ -19,8 +19,8 @@ import { ValidationTest } from '../../validation_test.js'; class F extends ValidationTest { TestCopyTextureToTexture( - source: GPUImageCopyTexture, - destination: GPUImageCopyTexture, + source: GPUTexelCopyTextureInfo, + destination: GPUTexelCopyTextureInfo, copySize: GPUExtent3D, expectation: 'Success' | 'FinishError' | 'SubmitError' ): void { @@ -691,7 +691,7 @@ TODO: Extend to 1D and 3D textures.` g.test('copy_aspects') .desc( ` -Test the validations on the member 'aspect' of GPUImageCopyTexture in CopyTextureToTexture(). +Test the validations on the member 'aspect' of GPUTexelCopyTextureInfo in CopyTextureToTexture(). - for all the color and depth-stencil formats: the texture copy aspects must be both 'all'. - for all the depth-only formats: the texture copy aspects must be either 'all' or 'depth-only'. - for all the stencil-only formats: the texture copy aspects must be either 'all' or 'stencil-only'. diff --git a/src/webgpu/api/validation/image_copy/buffer_texture_copies.spec.ts b/src/webgpu/api/validation/image_copy/buffer_texture_copies.spec.ts index 937861cea03e..d417f23137fa 100644 --- a/src/webgpu/api/validation/image_copy/buffer_texture_copies.spec.ts +++ b/src/webgpu/api/validation/image_copy/buffer_texture_copies.spec.ts @@ -18,8 +18,8 @@ import { ValidationTest } from '../validation_test.js'; class ImageCopyTest extends ValidationTest { testCopyBufferToTexture( - source: GPUImageCopyBuffer, - destination: GPUImageCopyTexture, + source: GPUTexelCopyBufferInfo, + destination: GPUTexelCopyTextureInfo, copySize: GPUExtent3DStrict, isSuccess: boolean ): void { @@ -29,8 +29,8 @@ class ImageCopyTest extends ValidationTest { } testCopyTextureToBuffer( - source: GPUImageCopyTexture, - destination: GPUImageCopyBuffer, + source: GPUTexelCopyTextureInfo, + destination: GPUTexelCopyBufferInfo, copySize: GPUExtent3DStrict, isSuccess: boolean ): void { @@ -40,9 +40,9 @@ class ImageCopyTest extends ValidationTest { } testWriteTexture( - destination: GPUImageCopyTexture, + destination: GPUTexelCopyTextureInfo, uploadData: Uint8Array, - dataLayout: GPUImageDataLayout, + dataLayout: GPUTexelCopyBufferLayout, copySize: GPUExtent3DStrict, isSuccess: boolean ): void { diff --git a/src/webgpu/api/validation/image_copy/image_copy.ts b/src/webgpu/api/validation/image_copy/image_copy.ts index 1a86fac68794..42c40c42c536 100644 --- a/src/webgpu/api/validation/image_copy/image_copy.ts +++ b/src/webgpu/api/validation/image_copy/image_copy.ts @@ -11,8 +11,8 @@ import { ValidationTest } from '../validation_test.js'; export class ImageCopyTest extends ValidationTest { testRun( - textureCopyView: GPUImageCopyTexture, - textureDataLayout: GPUImageDataLayout, + textureCopyView: GPUTexelCopyTextureInfo, + textureDataLayout: GPUTexelCopyBufferLayout, size: GPUExtent3D, { method, @@ -122,7 +122,7 @@ export class ImageCopyTest extends ValidationTest { testBuffer( buffer: GPUBuffer, texture: GPUTexture, - textureDataLayout: GPUImageDataLayout, + textureDataLayout: GPUTexelCopyBufferLayout, size: GPUExtent3D, { method, diff --git a/src/webgpu/api/validation/queue/copyToTexture/CopyExternalImageToTexture.spec.ts b/src/webgpu/api/validation/queue/copyToTexture/CopyExternalImageToTexture.spec.ts index 5677a81cc03c..622133721bed 100644 --- a/src/webgpu/api/validation/queue/copyToTexture/CopyExternalImageToTexture.spec.ts +++ b/src/webgpu/api/validation/queue/copyToTexture/CopyExternalImageToTexture.spec.ts @@ -178,8 +178,8 @@ class CopyExternalImageToTextureTest extends ValidationTest { } runTest( - imageBitmapCopyView: GPUImageCopyExternalImage, - textureCopyView: GPUImageCopyTextureTagged, + imageBitmapCopyView: GPUCopyExternalImageSourceInfo, + textureCopyView: GPUCopyExternalImageDestInfo, copySize: GPUExtent3D, validationScopeSuccess: boolean, exceptionName?: string diff --git a/src/webgpu/capability_info.ts b/src/webgpu/capability_info.ts index 5af80c45fa4c..7fcab69d1b97 100644 --- a/src/webgpu/capability_info.ts +++ b/src/webgpu/capability_info.ts @@ -248,7 +248,7 @@ export type VertexFormatInfo = { /** Number of components. */ readonly componentCount: 1 | 2 | 3 | 4; /** Size in bytes. */ - readonly byteSize: 2 | 4 | 8 | 12 | 16; + readonly byteSize: 1 | 2 | 4 | 8 | 12 | 16; /** The completely matching WGSL type for vertex format */ readonly wgslType: | 'f32' @@ -273,23 +273,32 @@ export const kVertexFormatInfo: { ['bytesPerComponent', 'type', 'componentCount', 'byteSize', 'wgslType'] as const, [ , , , , ] as const, { // 8 bit components + 'uint8': [ 1, 'uint', 1, 1, 'u32'], 'uint8x2': [ 1, 'uint', 2, 2, 'vec2'], 'uint8x4': [ 1, 'uint', 4, 4, 'vec4'], + 'sint8': [ 1, 'sint', 1, 1, 'i32'], 'sint8x2': [ 1, 'sint', 2, 2, 'vec2'], 'sint8x4': [ 1, 'sint', 4, 4, 'vec4'], + 'unorm8': [ 1, 'unorm', 1, 1, 'f32'], 'unorm8x2': [ 1, 'unorm', 2, 2, 'vec2'], 'unorm8x4': [ 1, 'unorm', 4, 4, 'vec4'], + 'snorm8': [ 1, 'snorm', 1, 1, 'f32'], 'snorm8x2': [ 1, 'snorm', 2, 2, 'vec2'], 'snorm8x4': [ 1, 'snorm', 4, 4, 'vec4'], // 16 bit components + 'uint16': [ 2, 'uint', 1, 2, 'u32'], 'uint16x2': [ 2, 'uint', 2, 4, 'vec2'], 'uint16x4': [ 2, 'uint', 4, 8, 'vec4'], + 'sint16': [ 2, 'sint', 1, 2, 'i32'], 'sint16x2': [ 2, 'sint', 2, 4, 'vec2'], 'sint16x4': [ 2, 'sint', 4, 8, 'vec4'], + 'unorm16': [ 2, 'unorm', 1, 2, 'f32'], 'unorm16x2': [ 2, 'unorm', 2, 4, 'vec2'], 'unorm16x4': [ 2, 'unorm', 4, 8, 'vec4'], + 'snorm16': [ 2, 'snorm', 1, 2, 'f32'], 'snorm16x2': [ 2, 'snorm', 2, 4, 'vec2'], 'snorm16x4': [ 2, 'snorm', 4, 8, 'vec4'], + 'float16': [ 2, 'float', 1, 2, 'f32'], 'float16x2': [ 2, 'float', 2, 4, 'vec2'], 'float16x4': [ 2, 'float', 4, 8, 'vec4'], // 32 bit components @@ -306,7 +315,8 @@ export const kVertexFormatInfo: { 'sint32x3': [ 4, 'sint', 3, 12, 'vec3'], 'sint32x4': [ 4, 'sint', 4, 16, 'vec4'], // 32 bit packed - 'unorm10-10-10-2': [ 'packed', 'unorm', 4, 4, 'vec4'] + 'unorm10-10-10-2': [ 'packed', 'unorm', 4, 4, 'vec4'], + 'unorm8x4-bgra': [ 'packed', 'unorm', 4, 4, 'vec4'], } as const); /** List of all GPUVertexFormat values. */ export const kVertexFormats = keysOf(kVertexFormatInfo); diff --git a/src/webgpu/gpu_test.ts b/src/webgpu/gpu_test.ts index ef210712feed..b9ee2b776db5 100644 --- a/src/webgpu/gpu_test.ts +++ b/src/webgpu/gpu_test.ts @@ -1296,7 +1296,7 @@ export interface TextureTestMixinType { * to the expected TexelView passes without error. */ expectTexelViewComparisonIsOkInTexture( - src: GPUImageCopyTexture, + src: GPUTexelCopyTextureInfo, exp: TexelView, size: GPUExtent3D, comparisonOptions?: TexelCompareOptions @@ -1307,7 +1307,7 @@ export interface TextureTestMixinType { * their expected colors without error. */ expectSinglePixelComparisonsAreOkInTexture( - src: GPUImageCopyTexture, + src: GPUTexelCopyTextureInfo, exp: PerPixelComparison[], comparisonOptions?: TexelCompareOptions ): void; @@ -1383,7 +1383,7 @@ export interface TextureTestMixinType { * Gets a byte offset to a texel */ getTexelOffsetInBytes( - textureDataLayout: Required, + textureDataLayout: Required, format: ColorTextureFormat, texel: Required, origin?: Required @@ -1481,7 +1481,7 @@ function getPipelineToRenderTextureToRGB8UnormTexture( } type LinearCopyParameters = { - dataLayout: Required; + dataLayout: Required; origin: Required; data: Uint8Array; }; @@ -1511,7 +1511,7 @@ export function TextureTestMixin>( } expectTexelViewComparisonIsOkInTexture( - src: GPUImageCopyTexture, + src: GPUTexelCopyTextureInfo, exp: TexelView, size: GPUExtent3D, comparisonOptions = { @@ -1526,7 +1526,7 @@ export function TextureTestMixin>( } expectSinglePixelComparisonsAreOkInTexture( - src: GPUImageCopyTexture, + src: GPUTexelCopyTextureInfo, exp: PerPixelComparison[], comparisonOptions = { maxIntDiff: 0, @@ -1836,7 +1836,7 @@ export function TextureTestMixin>( /** Offset for a particular texel in the linear texture data */ getTexelOffsetInBytes( - textureDataLayout: Required, + textureDataLayout: Required, format: ColorTextureFormat, texel: Required, origin: Required = { x: 0, y: 0, z: 0 } diff --git a/src/webgpu/listing_meta.json b/src/webgpu/listing_meta.json index c455224da996..237f04e74681 100644 --- a/src/webgpu/listing_meta.json +++ b/src/webgpu/listing_meta.json @@ -274,6 +274,7 @@ "webgpu:api,validation,buffer,mapping:unmap,state,mappingPending:*": { "subcaseMS": 22.951 }, "webgpu:api,validation,buffer,mapping:unmap,state,unmapped:*": { "subcaseMS": 74.200 }, "webgpu:api,validation,capability_checks,features,clip_distances:createRenderPipeline,at_over:*": { "subcaseMS": 13.700 }, + "webgpu:api,validation,capability_checks,features,clip_distances:createRenderPipeline,max_vertex_output_location:*": { "subcaseMS": 267.295 }, "webgpu:api,validation,capability_checks,features,query_types:createQuerySet:*": { "subcaseMS": 10.451 }, "webgpu:api,validation,capability_checks,features,query_types:timestamp:*": { "subcaseMS": 1.200 }, "webgpu:api,validation,capability_checks,features,texture_formats:canvas_configuration:*": { "subcaseMS": 4.339 }, @@ -434,6 +435,7 @@ "webgpu:api,validation,createView:format:*": { "subcaseMS": 0.742 }, "webgpu:api,validation,createView:mip_levels:*": { "subcaseMS": 0.436 }, "webgpu:api,validation,createView:texture_state:*": { "subcaseMS": 0.400 }, + "webgpu:api,validation,createView:texture_view_usage:*": { "subcaseMS": 3106.634 }, "webgpu:api,validation,debugMarker:push_pop_call_count_unbalance,command_encoder:*": { "subcaseMS": 1.522 }, "webgpu:api,validation,debugMarker:push_pop_call_count_unbalance,render_compute_pass:*": { "subcaseMS": 0.601 }, "webgpu:api,validation,encoding,beginComputePass:timestampWrites,invalid_query_set:*": { "subcaseMS": 0.201 }, @@ -652,6 +654,9 @@ "webgpu:api,validation,queue,destroyed,texture:setBindGroup:*": { "subcaseMS": 5.783 }, "webgpu:api,validation,queue,destroyed,texture:writeTexture:*": { "subcaseMS": 16.601 }, "webgpu:api,validation,queue,submit:command_buffer,device_mismatch:*": { "subcaseMS": 0.467 }, + "webgpu:api,validation,queue,submit:command_buffer,duplicate_buffers:*": { "subcaseMS": 0.981 }, + "webgpu:api,validation,queue,submit:command_buffer,invalid_submit_invalidates:*": { "subcaseMS": 0.820 }, + "webgpu:api,validation,queue,submit:command_buffer,submit_invalidates:*": { "subcaseMS": 1.120 }, "webgpu:api,validation,queue,writeBuffer:buffer,device_mismatch:*": { "subcaseMS": 16.000 }, "webgpu:api,validation,queue,writeBuffer:buffer_state:*": { "subcaseMS": 6.201 }, "webgpu:api,validation,queue,writeBuffer:ranges:*": { "subcaseMS": 17.600 }, @@ -706,13 +711,17 @@ "webgpu:api,validation,render_pass,resolve:resolve_attachment:*": { "subcaseMS": 6.205 }, "webgpu:api,validation,render_pipeline,depth_stencil_state:depthCompare_optional:*": { "subcaseMS": 21.401 }, "webgpu:api,validation,render_pipeline,depth_stencil_state:depthWriteEnabled_optional:*": { "subcaseMS": 16.950 }, + "webgpu:api,validation,render_pipeline,depth_stencil_state:depth_bias:*": { "subcaseMS": 45.563 }, "webgpu:api,validation,render_pipeline,depth_stencil_state:depth_test:*": { "subcaseMS": 3.407 }, "webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write,frag_depth:*": { "subcaseMS": 6.465 }, "webgpu:api,validation,render_pipeline,depth_stencil_state:depth_write:*": { "subcaseMS": 4.113 }, "webgpu:api,validation,render_pipeline,depth_stencil_state:format:*": { "subcaseMS": 3.521 }, "webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_test:*": { "subcaseMS": 3.124 }, "webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:*": { "subcaseMS": 3.183 }, + "webgpu:api,validation,render_pipeline,float32_blendable:create_render_pipeline:*": { "subcaseMS": 78.452 }, "webgpu:api,validation,render_pipeline,fragment_state:color_target_exists:*": { "subcaseMS": 29.150 }, + "webgpu:api,validation,render_pipeline,fragment_state:dual_source_blending,color_target_count:*": { "subcaseMS": 38.712 }, + "webgpu:api,validation,render_pipeline,fragment_state:dual_source_blending,use_blend_src:*": { "subcaseMS": 316.418 }, "webgpu:api,validation,render_pipeline,fragment_state:limits,maxColorAttachmentBytesPerSample,aligned:*": { "subcaseMS": 0.991 }, "webgpu:api,validation,render_pipeline,fragment_state:limits,maxColorAttachmentBytesPerSample,unaligned:*": { "subcaseMS": 14.750 }, "webgpu:api,validation,render_pipeline,fragment_state:limits,maxColorAttachments:*": { "subcaseMS": 9.351 }, @@ -734,6 +743,7 @@ "webgpu:api,validation,render_pipeline,inter_stage:type:*": { "subcaseMS": 6.170 }, "webgpu:api,validation,render_pipeline,misc:basic:*": { "subcaseMS": 0.901 }, "webgpu:api,validation,render_pipeline,misc:external_texture:*": { "subcaseMS": 35.189 }, + "webgpu:api,validation,render_pipeline,misc:no_attachment:*": { "subcaseMS": 2.264 }, "webgpu:api,validation,render_pipeline,misc:pipeline_layout,device_mismatch:*": { "subcaseMS": 8.700 }, "webgpu:api,validation,render_pipeline,misc:vertex_state_only:*": { "subcaseMS": 1.125 }, "webgpu:api,validation,render_pipeline,multisample_state:alpha_to_coverage,count:*": { "subcaseMS": 3.200 }, @@ -796,6 +806,7 @@ "webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_bind_group_on_same_index_depth_stencil_texture:*": { "subcaseMS": 0.925 }, "webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,set_unused_bind_group:*": { "subcaseMS": 6.200 }, "webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_usages_in_copy_and_render_pass:*": { "subcaseMS": 4.763 }, + "webgpu:api,validation,resource_usages,texture,in_render_misc:subresources,texture_view_usages:*": { "subcaseMS": 24.999 }, "webgpu:api,validation,shader_module,entry_point:compute:*": { "subcaseMS": 4.439 }, "webgpu:api,validation,shader_module,entry_point:compute_undefined_entry_point_and_extra_stage:*": { "subcaseMS": 17.075 }, "webgpu:api,validation,shader_module,entry_point:fragment:*": { "subcaseMS": 5.865 }, diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureSample.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureSample.spec.ts index 567bfb65360f..1aa84583ee55 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureSample.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureSample.spec.ts @@ -336,7 +336,7 @@ Parameters: const viewDescriptor = { dimension: viewDimension, }; - const textureType = getTextureTypeForTextureViewDimension(viewDimension)!; + const textureType = getTextureTypeForTextureViewDimension(viewDimension); const results = await doTextureCalls( t, texture, diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureSampleBias.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureSampleBias.spec.ts index af2fb41348a1..209602508550 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureSampleBias.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureSampleBias.spec.ts @@ -248,7 +248,7 @@ Parameters: const viewDescriptor = { dimension: viewDimension, }; - const textureType = getTextureTypeForTextureViewDimension(viewDimension)!; + const textureType = getTextureTypeForTextureViewDimension(viewDimension); const results = await doTextureCalls( t, texture, diff --git a/src/webgpu/shader/execution/expression/call/builtin/textureSampleGrad.spec.ts b/src/webgpu/shader/execution/expression/call/builtin/textureSampleGrad.spec.ts index f93df120f7a3..2019cd3600b2 100644 --- a/src/webgpu/shader/execution/expression/call/builtin/textureSampleGrad.spec.ts +++ b/src/webgpu/shader/execution/expression/call/builtin/textureSampleGrad.spec.ts @@ -251,7 +251,7 @@ Parameters: const viewDescriptor = { dimension: viewDimension, }; - const textureType = getTextureTypeForTextureViewDimension(viewDimension)!; + const textureType = getTextureTypeForTextureViewDimension(viewDimension); const results = await doTextureCalls( t, texture, diff --git a/src/webgpu/shader/execution/shader_io/fragment_builtins.spec.ts b/src/webgpu/shader/execution/shader_io/fragment_builtins.spec.ts index 6431092d478f..6a06fa62d62e 100644 --- a/src/webgpu/shader/execution/shader_io/fragment_builtins.spec.ts +++ b/src/webgpu/shader/execution/shader_io/fragment_builtins.spec.ts @@ -345,7 +345,7 @@ function generateFragmentInputs({ const cw = isTriangleClockwise(windowPoints2D); const frontFacing = frontFace === 'cw' ? cw : !cw; - const fragmentOffsets = getMultisampleFragmentOffsets(sampleCount)!; + const fragmentOffsets = getMultisampleFragmentOffsets(sampleCount); for (let y = 0; y < height; ++y) { for (let x = 0; x < width; ++x) { diff --git a/src/webgpu/shader/validation/expression/call/builtin/const_override_validation.ts b/src/webgpu/shader/validation/expression/call/builtin/const_override_validation.ts index 6ea2caf3c694..83cc1c76f8a0 100644 --- a/src/webgpu/shader/validation/expression/call/builtin/const_override_validation.ts +++ b/src/webgpu/shader/validation/expression/call/builtin/const_override_validation.ts @@ -137,7 +137,7 @@ export type ExecutionStage = 'constant' | 'override' | 'runtime'; * @returns true if evaluation stage `stage` supports expressions of type @p. */ export function stageSupportsType(stage: ConstantOrOverrideStage, type: Type) { - if (stage === 'override' && isAbstractType(elementTypeOf(type)!)) { + if (stage === 'override' && isAbstractType(elementTypeOf(type))) { // Abstract numerics are concretized before being used in an override expression. return false; } @@ -162,7 +162,7 @@ export function validateConstOrOverrideBuiltinEval( stage: ConstantOrOverrideStage, returnType?: Type ) { - const elTys = args.map(arg => elementTypeOf(arg.type)!); + const elTys = args.map(arg => elementTypeOf(arg.type)); const enables = elTys.some(ty => ty === Type.f16) ? 'enable f16;' : ''; const optionalVarType = returnType ? `: ${returnType.toString()}` : ''; @@ -225,7 +225,7 @@ export function validateConstOrOverrideBinaryOpEval( right: Value ) { const allArgs = [left, right]; - const elTys = allArgs.map(arg => elementTypeOf(arg.type)!); + const elTys = allArgs.map(arg => elementTypeOf(arg.type)); const enables = elTys.some(ty => ty === Type.f16) ? 'enable f16;' : ''; const codeLines = [enables]; diff --git a/src/webgpu/util/copy_to_texture.ts b/src/webgpu/util/copy_to_texture.ts index a96ee8d77e79..fdbc5259724f 100644 --- a/src/webgpu/util/copy_to_texture.ts +++ b/src/webgpu/util/copy_to_texture.ts @@ -169,8 +169,8 @@ export class TextureUploadingUtils extends TextureTestMixin(GPUTest) { } doTestAndCheckResult( - imageCopyExternalImage: GPUImageCopyExternalImage, - dstTextureCopyView: GPUImageCopyTextureTagged, + imageCopyExternalImage: GPUCopyExternalImageSourceInfo, + dstTextureCopyView: GPUCopyExternalImageDestInfo, expTexelView: TexelView, copySize: Required, texelCompareOptions: TexelCompareOptions diff --git a/src/webgpu/util/texture.ts b/src/webgpu/util/texture.ts index 745190d3331a..dde53ff765dc 100644 --- a/src/webgpu/util/texture.ts +++ b/src/webgpu/util/texture.ts @@ -318,9 +318,9 @@ const s_copyBufferToTextureViaRenderPipelines = new WeakMap< function copyBufferToTextureViaRender( t: GPUTest, encoder: GPUCommandEncoder, - source: GPUImageCopyBuffer, + source: GPUTexelCopyBufferInfo, sourceFormat: GPUTextureFormat, - dest: GPUImageCopyTexture, + dest: GPUTexelCopyTextureInfo, size: GPUExtent3D ) { const { format: textureFormat, sampleCount } = dest.texture; diff --git a/src/webgpu/util/texture/layout.ts b/src/webgpu/util/texture/layout.ts index 24a0cdf0040e..8c6c101ae014 100644 --- a/src/webgpu/util/texture/layout.ts +++ b/src/webgpu/util/texture/layout.ts @@ -291,7 +291,7 @@ function validateRowsPerImage({ } interface DataBytesForCopyArgs { - layout: GPUImageDataLayout; + layout: GPUTexelCopyBufferLayout; format: SizedTextureFormat; copySize: Readonly | readonly number[]; method: ImageCopyType; diff --git a/src/webgpu/util/texture/texel_data.ts b/src/webgpu/util/texture/texel_data.ts index 4c88d9c2182a..734cfc00eef7 100644 --- a/src/webgpu/util/texture/texel_data.ts +++ b/src/webgpu/util/texture/texel_data.ts @@ -1001,7 +1001,7 @@ export function getSingleDataType(format: UncompressedTextureFormat): ComponentD assert(cur !== undefined); assert(acc === undefined || acc === cur.dataType); return cur.dataType; - }, infos[0]!.dataType); + }, infos[0].dataType); } /** diff --git a/src/webgpu/util/texture/texture_ok.ts b/src/webgpu/util/texture/texture_ok.ts index abfec1f1d7c2..3eb94c2deea0 100644 --- a/src/webgpu/util/texture/texture_ok.ts +++ b/src/webgpu/util/texture/texture_ok.ts @@ -167,7 +167,7 @@ function comparePerComponent( /** Create a new mappable GPUBuffer, and copy a subrectangle of GPUTexture data into it. */ function createTextureCopyForMapRead( t: GPUTest, - source: GPUImageCopyTexture, + source: GPUTexelCopyTextureInfo, copySize: GPUExtent3D, { format }: { format: EncodableTextureFormat } ): { buffer: GPUBuffer; bytesPerRow: number; rowsPerImage: number } { @@ -298,7 +298,7 @@ ${generatePrettyTable(opts, [ */ export async function textureContentIsOKByT2B( t: GPUTest, - source: GPUImageCopyTexture, + source: GPUTexelCopyTextureInfo, copySize_: GPUExtent3D, { expTexelView }: { expTexelView: TexelView }, texelCompareOptions: TexelCompareOptions, diff --git a/src/webgpu/web_platform/canvas/configure.spec.ts b/src/webgpu/web_platform/canvas/configure.spec.ts index 06e590751b33..3e9905dd5bd8 100644 --- a/src/webgpu/web_platform/canvas/configure.spec.ts +++ b/src/webgpu/web_platform/canvas/configure.spec.ts @@ -49,7 +49,7 @@ g.test('defaults') t.expect(configuration.usage === GPUTextureUsage.RENDER_ATTACHMENT); t.expect(configuration.viewFormats.length === 0); t.expect(configuration.colorSpace === 'srgb'); - t.expect(configuration.toneMapping.mode === 'standard'); + t.expect(configuration.toneMapping?.mode === 'standard'); t.expect(configuration.alphaMode === 'opaque'); const currentTexture = ctx.getCurrentTexture(); @@ -109,7 +109,7 @@ g.test('device') t.expect(configuration.usage === GPUTextureUsage.RENDER_ATTACHMENT); t.expect(configuration.viewFormats.length === 0); t.expect(configuration.colorSpace === 'srgb'); - t.expect(configuration.toneMapping.mode === 'standard'); + t.expect(configuration.toneMapping?.mode === 'standard'); t.expect(configuration.alphaMode === 'opaque'); // getCurrentTexture will succeed with a valid device. @@ -140,7 +140,7 @@ g.test('device') t.expect(newConfiguration.usage === GPUTextureUsage.RENDER_ATTACHMENT); t.expect(newConfiguration.viewFormats.length === 0); t.expect(newConfiguration.colorSpace === 'srgb'); - t.expect(newConfiguration.toneMapping.mode === 'standard'); + t.expect(newConfiguration.toneMapping?.mode === 'standard'); t.expect(newConfiguration.alphaMode === 'premultiplied'); }); diff --git a/src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts b/src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts index b7638cd08b02..5036c8ef20bc 100644 --- a/src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts @@ -31,17 +31,17 @@ g.test('from_ImageData') Then call copyExternalImageToTexture() to do a full copy to the 0 mipLevel of dst texture, and read the contents out to compare with the ImageBitmap contents. - Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and do unpremultiply alpha if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped. The tests covers: - Valid dstFormat of copyExternalImageToTexture() - Valid source image alphaMode - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcFlipYInCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcFlipYInCopy' in cases) And the expected results are all passed. ` @@ -151,10 +151,10 @@ g.test('from_canvas') Then call copyExternalImageToTexture() to do a full copy to the 0 mipLevel of dst texture, and read the contents out to compare with the ImageBitmap contents. - Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and do unpremultiply alpha if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped. The tests covers: @@ -162,7 +162,7 @@ g.test('from_canvas') - Valid dstFormat of copyExternalImageToTexture() - Valid source image alphaMode - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcFlipYInCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcFlipYInCopy' in cases) And the expected results are all passed. ` @@ -299,10 +299,10 @@ g.test('copy_subrect_from_ImageData') rect info list, to the 0 mipLevel of dst texture, and read the contents out to compare with the ImageBitmap contents. - Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and do unpremultiply alpha if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped, and origin is top-left consistantly. The tests covers: @@ -310,7 +310,7 @@ g.test('copy_subrect_from_ImageData') - Valid dstFormat of copyExternalImageToTexture() - Valid source image alphaMode - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcFlipYInCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcFlipYInCopy' in cases) - Valid subrect copies. And the expected results are all passed. @@ -416,10 +416,10 @@ g.test('copy_subrect_from_2D_Canvas') rect info list, to the 0 mipLevel of dst texture, and read the contents out to compare with the ImageBitmap contents. - Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and do unpremultiply alpha if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped, and origin is top-left consistantly. The tests covers: @@ -427,7 +427,7 @@ g.test('copy_subrect_from_2D_Canvas') - Valid dstFormat of copyExternalImageToTexture() - Valid source image alphaMode - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcFlipYInCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcFlipYInCopy' in cases) - Valid subrect copies. And the expected results are all passed. diff --git a/src/webgpu/web_platform/copyToTexture/ImageData.spec.ts b/src/webgpu/web_platform/copyToTexture/ImageData.spec.ts index 03e8f9a893b3..a9a0a441653a 100644 --- a/src/webgpu/web_platform/copyToTexture/ImageData.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/ImageData.spec.ts @@ -24,15 +24,15 @@ g.test('from_ImageData') of dst texture, and read the contents out to compare with the ImageData contents. Expect alpha to get premultiplied in the copy if, and only if, 'premultipliedAlpha' - in 'GPUImageCopyTextureTagged' is set to 'true'. + in 'GPUCopyExternalImageDestInfo' is set to 'true'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped. The tests covers: - Valid dstColorFormat of copyExternalImageToTexture() - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcDoFlipYDuringCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcDoFlipYDuringCopy' in cases) And the expected results are all passed. ` @@ -130,16 +130,16 @@ g.test('copy_subrect_from_ImageData') with the ImageBitmap contents. Expect alpha to get premultiplied in the copy if, and only if, 'premultipliedAlpha' - in 'GPUImageCopyTextureTagged' is set to 'true'. + in 'GPUCopyExternalImageDestInfo' is set to 'true'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped, and origin is top-left consistantly. The tests covers: - Source WebGPU Canvas lives in the same GPUDevice or different GPUDevice as test - Valid dstColorFormat of copyExternalImageToTexture() - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcDoFlipYDuringCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcDoFlipYDuringCopy' in cases) - Valid subrect copies. And the expected results are all passed. diff --git a/src/webgpu/web_platform/copyToTexture/canvas.spec.ts b/src/webgpu/web_platform/copyToTexture/canvas.spec.ts index 210a63abaff9..84334df603e3 100644 --- a/src/webgpu/web_platform/copyToTexture/canvas.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/canvas.spec.ts @@ -466,10 +466,10 @@ g.test('copy_contents_from_2d_context_canvas') Then call copyExternalImageToTexture() to do a full copy to the 0 mipLevel of dst texture, and read the contents out to compare with the canvas contents. - Provide premultiplied input if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Provide premultiplied input if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and unpremultiplied input if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped. The tests covers: @@ -477,7 +477,7 @@ g.test('copy_contents_from_2d_context_canvas') - Valid 2d context type - Valid dstColorFormat of copyExternalImageToTexture() - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcDoFlipYDuringCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcDoFlipYDuringCopy' in cases) - TODO(#913): color space tests need to be added And the expected results are all passed. @@ -527,10 +527,10 @@ g.test('copy_contents_from_gl_context_canvas') Then call copyExternalImageToTexture() to do a full copy to the 0 mipLevel of dst texture, and read the contents out to compare with the canvas contents. - Provide premultiplied input if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Provide premultiplied input if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and unpremultiplied input if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped. The tests covers: @@ -539,7 +539,7 @@ g.test('copy_contents_from_gl_context_canvas') - Valid dstColorFormat of copyExternalImageToTexture() - Valid source image alphaMode - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage'(named 'srcDoFlipYDuringCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo'(named 'srcDoFlipYDuringCopy' in cases) - TODO: color space tests need to be added And the expected results are all passed. @@ -595,10 +595,10 @@ g.test('copy_contents_from_gpu_context_canvas') Then call copyExternalImageToTexture() to do a full copy to the 0 mipLevel of dst texture, and read the contents out to compare with the canvas contents. - Provide premultiplied input if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Provide premultiplied input if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and unpremultiplied input if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped. The tests covers: @@ -607,7 +607,7 @@ g.test('copy_contents_from_gpu_context_canvas') - Valid dstColorFormat of copyExternalImageToTexture() - TODO: test more source image alphaMode - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage'(named 'srcDoFlipYDuringCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo'(named 'srcDoFlipYDuringCopy' in cases) - TODO: color space tests need to be added And the expected results are all passed. @@ -665,10 +665,10 @@ g.test('copy_contents_from_bitmaprenderer_context_canvas') Then call copyExternalImageToTexture() to do a full copy to the 0 mipLevel of dst texture, and read the contents out to compare with the canvas contents. - Provide premultiplied input if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Provide premultiplied input if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and unpremultiplied input if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped. The tests covers: @@ -676,7 +676,7 @@ g.test('copy_contents_from_bitmaprenderer_context_canvas') - Valid ImageBitmapRendering context type - Valid dstColorFormat of copyExternalImageToTexture() - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcDoFlipYDuringCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcDoFlipYDuringCopy' in cases) - TODO(#913): color space tests need to be added And the expected results are all passed. @@ -736,10 +736,10 @@ g.test('color_space_conversion') Then call copyExternalImageToTexture() to do a full copy to the 0 mipLevel of dst texture, and read the contents out to compare with the canvas contents. - Provide premultiplied input if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Provide premultiplied input if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and unpremultiplied input if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped. If color space from source input and user defined dstTexture color space are different, the @@ -748,7 +748,7 @@ g.test('color_space_conversion') The tests covers: - Valid dstColorFormat of copyExternalImageToTexture() - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcDoFlipYDuringCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcDoFlipYDuringCopy' in cases) - Valid 'colorSpace' config in 'dstColorSpace' And the expected results are all passed. diff --git a/src/webgpu/web_platform/copyToTexture/image.spec.ts b/src/webgpu/web_platform/copyToTexture/image.spec.ts index 2bb6eab8f176..7bb577ae5d07 100644 --- a/src/webgpu/web_platform/copyToTexture/image.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/image.spec.ts @@ -35,10 +35,10 @@ g.test('from_image') Then call copyExternalImageToTexture() to do a full copy to the 0 mipLevel of dst texture, and read the contents out to compare with the HTMLImageElement contents. - Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and do unpremultiply alpha if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped. The tests covers: @@ -46,7 +46,7 @@ g.test('from_image') - Valid dstColorFormat of copyExternalImageToTexture() - Valid source image alphaMode - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcDoFlipYDuringCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcDoFlipYDuringCopy' in cases) And the expected results are all passed. ` @@ -229,10 +229,10 @@ g.test('copy_subrect_from_2D_Canvas') rect info list, to the 0 mipLevel of dst texture, and read the contents out to compare with the HTMLImageElement contents. - Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUImageCopyTextureTagged' + Do premultiply alpha during copy if 'premultipliedAlpha' in 'GPUCopyExternalImageDestInfo' is set to 'true' and do unpremultiply alpha if it is set to 'false'. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped, and origin is top-left consistantly. The tests covers: @@ -240,7 +240,7 @@ g.test('copy_subrect_from_2D_Canvas') - Valid dstColorFormat of copyExternalImageToTexture() - Valid source image alphaMode - Valid dest alphaMode - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcDoFlipYDuringCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcDoFlipYDuringCopy' in cases) - Valid subrect copies. And the expected results are all passed. diff --git a/src/webgpu/web_platform/copyToTexture/video.spec.ts b/src/webgpu/web_platform/copyToTexture/video.spec.ts index e6e641d982e3..c5e2695f79a9 100644 --- a/src/webgpu/web_platform/copyToTexture/video.spec.ts +++ b/src/webgpu/web_platform/copyToTexture/video.spec.ts @@ -34,12 +34,12 @@ It creates HTMLVideoElement with videos under Resource folder. Then call copyExternalImageToTexture() to do a full copy to the 0 mipLevel of dst texture, and read the contents out to compare with the ImageBitmap contents. - If 'flipY' in 'GPUImageCopyExternalImage' is set to 'true', copy will ensure the result + If 'flipY' in 'GPUCopyExternalImageSourceInfo' is set to 'true', copy will ensure the result is flipped. The tests covers: - Video comes from different color spaces. - - Valid 'flipY' config in 'GPUImageCopyExternalImage' (named 'srcDoFlipYDuringCopy' in cases) + - Valid 'flipY' config in 'GPUCopyExternalImageSourceInfo' (named 'srcDoFlipYDuringCopy' in cases) - TODO: partial copy tests should be added - TODO: all valid dstColorFormat tests should be added. `