From 0ec9aa65af06cb9e548d1e3b24f52bb788b46184 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 30 Jan 2024 00:47:07 -0800 Subject: [PATCH 1/7] Refactor deprecated .copyDst/.renderable in texture_zero_init_test.ts --- .../check_texture/texture_zero_init_test.ts | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/webgpu/api/operation/resource_init/check_texture/texture_zero_init_test.ts b/src/webgpu/api/operation/resource_init/check_texture/texture_zero_init_test.ts index 22ffe0a3e518..9a9d74880e30 100644 --- a/src/webgpu/api/operation/resource_init/check_texture/texture_zero_init_test.ts +++ b/src/webgpu/api/operation/resource_init/check_texture/texture_zero_init_test.ts @@ -115,6 +115,14 @@ const initializedStateAsStencil = { [InitializedState.Canary]: 42, }; +function allAspectsCopyDst(info: (typeof kTextureFormatInfo)[UncompressedTextureFormat]) { + return ( + (!info.color || info.color.copyDst) && + (!info.depth || info.depth.copyDst) && + (!info.stencil || info.stencil.copyDst) + ); +} + export function getRequiredTextureUsage( format: UncompressedTextureFormat, sampleCount: number, @@ -159,10 +167,11 @@ export function getRequiredTextureUsage( usage |= GPUConst.TextureUsage.RENDER_ATTACHMENT; } - if (!kTextureFormatInfo[format].copyDst) { + const info = kTextureFormatInfo[format]; + if (!allAspectsCopyDst(info)) { // Copies are not possible. We need OutputAttachment to initialize // canary data. - assert(kTextureFormatInfo[format].renderable); + if (info.color) assert(!!info.colorRender, 'not implemented for non-renderable color'); usage |= GPUConst.TextureUsage.RENDER_ATTACHMENT; } @@ -388,10 +397,11 @@ export class TextureZeroInitTest extends GPUTest { state: InitializedState, subresourceRange: SubresourceRange ): void { - if (this.p.sampleCount > 1 || !kTextureFormatInfo[this.p.format].copyDst) { + const info = kTextureFormatInfo[this.p.format]; + if (this.p.sampleCount > 1 || !allAspectsCopyDst(info)) { // Copies to multisampled textures not yet specified. // Use a storeOp for now. - assert(kTextureFormatInfo[this.p.format].renderable); + if (info.color) assert(!!info.colorRender, 'not implemented for non-renderable color'); this.initializeWithStoreOp(state, texture, subresourceRange); } else { this.initializeWithCopy(texture, state, subresourceRange); @@ -517,7 +527,9 @@ export const kTestParams = kUnitCaseParamsBuilder const info = kTextureFormatInfo[format]; return ( - ((usage & GPUConst.TextureUsage.RENDER_ATTACHMENT) !== 0 && !info.renderable) || + ((usage & GPUConst.TextureUsage.RENDER_ATTACHMENT) !== 0 && + info.color && + !info.colorRender) || ((usage & GPUConst.TextureUsage.STORAGE_BINDING) !== 0 && !info.color?.storage) || (sampleCount > 1 && !info.multisample) ); From 8b8d0642c7a75b0b99200b6ebd262a133def41c3 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 30 Jan 2024 01:15:41 -0800 Subject: [PATCH 2/7] Remove no-op use of .renderable in texture_zero_init_test.ts --- .../check_texture/texture_zero_init_test.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/webgpu/api/operation/resource_init/check_texture/texture_zero_init_test.ts b/src/webgpu/api/operation/resource_init/check_texture/texture_zero_init_test.ts index 9a9d74880e30..6ff3ab4c9b41 100644 --- a/src/webgpu/api/operation/resource_init/check_texture/texture_zero_init_test.ts +++ b/src/webgpu/api/operation/resource_init/check_texture/texture_zero_init_test.ts @@ -535,14 +535,7 @@ export const kTestParams = kUnitCaseParamsBuilder ); }) .combine('nonPowerOfTwo', [false, true]) - .combine('canaryOnCreation', [false, true]) - .filter(({ canaryOnCreation, format }) => { - // We can only initialize the texture if it's encodable or renderable. - const canInitialize = format in kTextureFormatInfo || kTextureFormatInfo[format].renderable; - - // Filter out cases where we want canary values but can't initialize. - return !canaryOnCreation || canInitialize; - }); + .combine('canaryOnCreation', [false, true]); type TextureZeroParams = ParamTypeOf; From 3a10398185df409a308e6bdf333907d55ce20881 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Thu, 7 Mar 2024 21:51:42 -0800 Subject: [PATCH 3/7] Refactor deprecated .renderable in createTexture.spec.ts --- .../api/validation/createTexture.spec.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/webgpu/api/validation/createTexture.spec.ts b/src/webgpu/api/validation/createTexture.spec.ts index 04c029d78f1d..fc1c8b86b26b 100644 --- a/src/webgpu/api/validation/createTexture.spec.ts +++ b/src/webgpu/api/validation/createTexture.spec.ts @@ -299,7 +299,7 @@ g.test('sampleCount,various_sampleCount_with_all_formats') usage, }; - const success = sampleCount === 1 || (sampleCount === 4 && info.multisample && info.renderable); + const success = sampleCount === 1 || (sampleCount === 4 && info.multisample); t.expectValidationError(() => { t.device.createTexture(descriptor); @@ -1066,16 +1066,13 @@ g.test('texture_usage') // Note that we unconditionally test copy usages for all formats. We don't check copySrc/copyDst in kTextureFormatInfo in capability_info.js // if (!info.copySrc && (usage & GPUTextureUsage.COPY_SRC) !== 0) success = false; // if (!info.copyDst && (usage & GPUTextureUsage.COPY_DST) !== 0) success = false; - if ( - (usage & GPUTextureUsage.STORAGE_BINDING) !== 0 && - !isTextureFormatUsableAsStorageFormat(format, t.isCompatibility) - ) - success = false; - if ( - (!info.renderable || (appliedDimension !== '2d' && appliedDimension !== '3d')) && - (usage & GPUTextureUsage.RENDER_ATTACHMENT) !== 0 - ) - success = false; + if (usage & GPUTextureUsage.STORAGE_BINDING) { + if (!isTextureFormatUsableAsStorageFormat(format, t.isCompatibility)) success = false; + } + if (usage & GPUTextureUsage.RENDER_ATTACHMENT) { + if (appliedDimension === '1d') success = false; + if (info.color && !info.colorRender) success = false; + } t.expectValidationError(() => { t.device.createTexture(descriptor); From f3a7656ffca346aa8b5a65a529667e77ee0aa2d3 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Thu, 7 Mar 2024 21:50:10 -0800 Subject: [PATCH 4/7] Remove deprecated .copyDst --- src/webgpu/format_info.ts | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/webgpu/format_info.ts b/src/webgpu/format_info.ts index 8ed39cdf3d22..72b8d86b895c 100644 --- a/src/webgpu/format_info.ts +++ b/src/webgpu/format_info.ts @@ -31,8 +31,6 @@ const kFormatUniversalDefaults = { /** The base format for srgb formats. Specified on both srgb and equivalent non-srgb formats. */ baseFormat: undefined, - /** @deprecated */ - copyDst: undefined, /** @deprecated Use `.color.bytes`, `.depth.bytes`, or `.stencil.bytes`. */ bytesPerBlock: undefined, /** @deprecated */ @@ -76,7 +74,7 @@ function formatTableWithDefaults Date: Tue, 30 Jan 2024 01:16:34 -0800 Subject: [PATCH 5/7] Remove deprecated .renderable --- src/webgpu/format_info.ts | 40 +-------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/src/webgpu/format_info.ts b/src/webgpu/format_info.ts index 72b8d86b895c..62b2a7be8466 100644 --- a/src/webgpu/format_info.ts +++ b/src/webgpu/format_info.ts @@ -34,8 +34,6 @@ const kFormatUniversalDefaults = { /** @deprecated Use `.color.bytes`, `.depth.bytes`, or `.stencil.bytes`. */ bytesPerBlock: undefined, /** @deprecated */ - renderable: false, - /** @deprecated */ renderTargetPixelByteCost: undefined, /** @deprecated */ renderTargetComponentAlignment: undefined, @@ -88,7 +86,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 1, }, colorRender: { blend: true, resolve: true, byteCost: 1, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -116,7 +113,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 1, }, colorRender: { blend: false, resolve: false, byteCost: 1, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -132,7 +128,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 1, }, colorRender: { blend: false, resolve: false, byteCost: 1, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -149,7 +144,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: true, resolve: true, byteCost: 2, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -177,7 +171,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: false, resolve: false, byteCost: 2, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -193,7 +186,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: false, resolve: false, byteCost: 2, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -210,7 +202,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -227,7 +218,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -256,7 +246,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -272,7 +261,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -288,7 +276,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -305,7 +292,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 1 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -325,7 +311,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: false, resolve: false, byteCost: 2, alignment: 2 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -341,7 +326,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: false, resolve: false, byteCost: 2, alignment: 2 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -357,7 +341,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: true, resolve: true, byteCost: 2, alignment: 2 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -374,7 +357,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 2 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -390,7 +372,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 2 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -406,7 +387,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 4, alignment: 2 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -423,7 +403,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 2 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -439,7 +418,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 2 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -455,7 +433,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 2 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -474,7 +451,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, @@ -490,7 +466,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, @@ -506,7 +481,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -523,7 +497,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, @@ -539,7 +512,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, @@ -555,7 +527,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, @@ -572,7 +543,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 16, }, colorRender: { blend: false, resolve: false, byteCost: 16, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, @@ -588,7 +558,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 16, }, colorRender: { blend: false, resolve: false, byteCost: 16, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, @@ -604,7 +573,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 16, }, colorRender: { blend: false, resolve: false, byteCost: 16, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, @@ -623,7 +591,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -639,7 +606,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 4 }, - renderable: true, /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, @@ -681,7 +647,7 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ // because one aspect can be sized and one can be unsized. This should be cleaned up, but is kept // this way during a migration phase. const kSizedDepthStencilFormatInfo = formatTableWithDefaults({ - defaults: { blockWidth: 1, blockHeight: 1, multisample: true, renderable: true }, + defaults: { blockWidth: 1, blockHeight: 1, multisample: true }, table: { stencil8: { stencil: { @@ -730,7 +696,6 @@ const kUnsizedDepthStencilFormatInfo = formatTableWithDefaults({ readWriteStorage: false, bytes: undefined, }, - renderable: true, }, 'depth24plus-stencil8': { depth: { @@ -749,7 +714,6 @@ const kUnsizedDepthStencilFormatInfo = formatTableWithDefaults({ readWriteStorage: false, bytes: 1, }, - renderable: true, }, 'depth32float-stencil8': { depth: { @@ -769,7 +733,6 @@ const kUnsizedDepthStencilFormatInfo = formatTableWithDefaults({ bytes: 1, }, feature: 'depth32float-stencil8', - renderable: true, }, }, } as const); @@ -1598,7 +1561,6 @@ type TextureFormatInfo_TypeCheck = { feature: GPUFeatureName | undefined; bytesPerBlock: number | undefined; - renderable: boolean; renderTargetPixelByteCost: number | undefined; renderTargetComponentAlignment: number | undefined; From fb77f4bff04c1e851c1d1bde6aad02d4c4fe68d8 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 30 Jan 2024 01:24:58 -0800 Subject: [PATCH 6/7] Remove unused .renderTarget{ComponentAlignment,PixelByteCost} .renderTargetComponentAlignment = .colorRender.alignment .renderTargetPixelByteCost = .colorRender.byteCost The one exception to this is rg11b10ufloat, which is not renderable in core, but has an extension for renderability. kTextureFormatInfo currently only expresses core capabilities. The alignment and byteCost for this format will need to be added back when the refactor is done to make a table for "static" properties of texture formats (which never vary based on capabilities) - shape of that refactor is TBD. --- src/webgpu/format_info.ts | 79 --------------------------------------- 1 file changed, 79 deletions(-) diff --git a/src/webgpu/format_info.ts b/src/webgpu/format_info.ts index 62b2a7be8466..be1320d3cdad 100644 --- a/src/webgpu/format_info.ts +++ b/src/webgpu/format_info.ts @@ -33,10 +33,6 @@ const kFormatUniversalDefaults = { /** @deprecated Use `.color.bytes`, `.depth.bytes`, or `.stencil.bytes`. */ bytesPerBlock: undefined, - /** @deprecated */ - renderTargetPixelByteCost: undefined, - /** @deprecated */ - renderTargetComponentAlignment: undefined, // IMPORTANT: // Add new top-level keys both here and in TextureFormatInfo_TypeCheck. @@ -86,8 +82,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 1, }, colorRender: { blend: true, resolve: true, byteCost: 1, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -113,8 +107,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 1, }, colorRender: { blend: false, resolve: false, byteCost: 1, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -128,8 +120,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 1, }, colorRender: { blend: false, resolve: false, byteCost: 1, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -144,8 +134,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: true, resolve: true, byteCost: 2, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -171,8 +159,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: false, resolve: false, byteCost: 2, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -186,8 +172,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: false, resolve: false, byteCost: 2, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -202,8 +186,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, baseFormat: 'rgba8unorm', /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, @@ -218,8 +200,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, baseFormat: 'rgba8unorm', /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, @@ -246,8 +226,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -261,8 +239,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -276,8 +252,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, baseFormat: 'bgra8unorm', /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, @@ -292,8 +266,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 1 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, baseFormat: 'bgra8unorm', /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, @@ -311,8 +283,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: false, resolve: false, byteCost: 2, alignment: 2 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -326,8 +296,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: false, resolve: false, byteCost: 2, alignment: 2 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -341,8 +309,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 2, }, colorRender: { blend: true, resolve: true, byteCost: 2, alignment: 2 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -357,8 +323,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 2 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -372,8 +336,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 2 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -387,8 +349,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 4, alignment: 2 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -403,8 +363,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 2 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -418,8 +376,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 2 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -433,8 +389,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 2 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -451,8 +405,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -466,8 +418,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -481,8 +431,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 4, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -497,8 +445,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -512,8 +458,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -527,8 +471,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 8, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -543,8 +485,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 16, }, colorRender: { blend: false, resolve: false, byteCost: 16, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -558,8 +498,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 16, }, colorRender: { blend: false, resolve: false, byteCost: 16, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -573,8 +511,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 16, }, colorRender: { blend: false, resolve: false, byteCost: 16, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: false, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -591,8 +527,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: false, resolve: false, byteCost: 8, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -606,8 +540,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ bytes: 4, }, colorRender: { blend: true, resolve: true, byteCost: 8, alignment: 4 }, - /*prettier-ignore*/ get renderTargetComponentAlignment() { return this.colorRender.alignment; }, - /*prettier-ignore*/ get renderTargetPixelByteCost() { return this.colorRender.byteCost; }, multisample: true, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, }, @@ -622,8 +554,6 @@ const kRegularTextureFormatInfo = formatTableWithDefaults({ }, multisample: false, /*prettier-ignore*/ get bytesPerBlock() { return this.color.bytes; }, - renderTargetPixelByteCost: 8, - renderTargetComponentAlignment: 4, }, // packed @@ -1509,13 +1439,6 @@ const kASTCTextureFormatInfo = formatTableWithDefaults({ export const kRenderableColorTextureFormats = kRegularTextureFormats.filter( v => kColorTextureFormatInfo[v].colorRender ); -assert( - kRenderableColorTextureFormats.every( - f => - kAllTextureFormatInfo[f].renderTargetComponentAlignment !== undefined && - kAllTextureFormatInfo[f].renderTargetPixelByteCost !== undefined - ) -); /** Per-GPUTextureFormat-per-aspect info. */ interface TextureFormatAspectInfo { @@ -1561,8 +1484,6 @@ type TextureFormatInfo_TypeCheck = { feature: GPUFeatureName | undefined; bytesPerBlock: number | undefined; - renderTargetPixelByteCost: number | undefined; - renderTargetComponentAlignment: number | undefined; // IMPORTANT: // Add new top-level keys both here and in kUniversalDefaults. From c4ff423c06da800bb159efcd5b835dbaaf39d4c2 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Thu, 7 Mar 2024 22:21:43 -0800 Subject: [PATCH 7/7] Refactor trivial uses of deprecated .bytesPerBlock --- .../api/operation/command_buffer/image_copy.spec.ts | 2 +- .../api/operation/rendering/depth_clip_clamp.spec.ts | 10 ++++++---- .../api/operation/storage_texture/read_only.spec.ts | 2 +- .../api/validation/image_copy/texture_related.spec.ts | 2 +- .../encoding/cmds/copyTextureToBuffer.spec.ts | 9 +++++---- 5 files changed, 14 insertions(+), 11 deletions(-) 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 9927bfb89872..cff2bd50d575 100644 --- a/src/webgpu/api/operation/command_buffer/image_copy.spec.ts +++ b/src/webgpu/api/operation/command_buffer/image_copy.spec.ts @@ -1595,7 +1595,7 @@ works for every format with 2d and 2d-array textures. }; let textureHeight = 4 * info.blockHeight; let rowsPerImage = rowsPerImageEqualsCopyHeight ? copyHeight : copyHeight + 1; - const bytesPerRow = align(copyWidth * info.bytesPerBlock, 256); + const bytesPerRow = align(copyWidth * info.color.bytes, 256); if (dimension === '1d') { copySize.height = 1; diff --git a/src/webgpu/api/operation/rendering/depth_clip_clamp.spec.ts b/src/webgpu/api/operation/rendering/depth_clip_clamp.spec.ts index 65e2e8af1f21..5e8357114107 100644 --- a/src/webgpu/api/operation/rendering/depth_clip_clamp.spec.ts +++ b/src/webgpu/api/operation/rendering/depth_clip_clamp.spec.ts @@ -4,6 +4,7 @@ depth ranges as well. `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; +import { assert } from '../../../../common/util/util.js'; import { kDepthStencilFormats, kTextureFormatInfo } from '../../../format_info.js'; import { GPUTest } from '../../../gpu_test.js'; import { @@ -52,6 +53,7 @@ have unexpected values then get drawn to the color buffer, which is later checke .fn(async t => { const { format, unclippedDepth, writeDepth, multisampled } = t.params; const info = kTextureFormatInfo[format]; + assert(!!info.depth); /** Number of depth values to test for both vertex output and frag_depth output. */ const kNumDepthValues = 8; @@ -222,16 +224,16 @@ have unexpected values then get drawn to the color buffer, which is later checke : undefined; const dsActual = - !multisampled && info.bytesPerBlock + !multisampled && info.depth.bytes ? t.device.createBuffer({ - size: kNumTestPoints * info.bytesPerBlock, + size: kNumTestPoints * info.depth.bytes, usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ, }) : undefined; const dsExpected = - !multisampled && info.bytesPerBlock + !multisampled && info.depth.bytes ? t.device.createBuffer({ - size: kNumTestPoints * info.bytesPerBlock, + size: kNumTestPoints * info.depth.bytes, usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ, }) : undefined; diff --git a/src/webgpu/api/operation/storage_texture/read_only.spec.ts b/src/webgpu/api/operation/storage_texture/read_only.spec.ts index 9a479eee9d15..978924aabd67 100644 --- a/src/webgpu/api/operation/storage_texture/read_only.spec.ts +++ b/src/webgpu/api/operation/storage_texture/read_only.spec.ts @@ -51,7 +51,7 @@ class F extends GPUTest { storageTexture: GPUTexture, format: ColorTextureFormat ): ArrayBuffer { - const bytesPerBlock = kTextureFormatInfo[format].bytesPerBlock; + const bytesPerBlock = kTextureFormatInfo[format].color.bytes; assert(bytesPerBlock !== undefined); const width = storageTexture.width; diff --git a/src/webgpu/api/validation/image_copy/texture_related.spec.ts b/src/webgpu/api/validation/image_copy/texture_related.spec.ts index a0fe38e8e313..cbc36b1431ba 100644 --- a/src/webgpu/api/validation/image_copy/texture_related.spec.ts +++ b/src/webgpu/api/validation/image_copy/texture_related.spec.ts @@ -440,7 +440,7 @@ Test that the copy size must be aligned to the texture's format's block size. const texture = t.createAlignedTexture(format, size, origin, dimension); const bytesPerRow = align( - Math.max(1, Math.ceil(size.width / info.blockWidth)) * info.bytesPerBlock, + Math.max(1, Math.ceil(size.width / info.blockWidth)) * info.color.bytes, 256 ); const rowsPerImage = Math.ceil(size.height / info.blockHeight); diff --git a/src/webgpu/compat/api/validation/encoding/cmds/copyTextureToBuffer.spec.ts b/src/webgpu/compat/api/validation/encoding/cmds/copyTextureToBuffer.spec.ts index a9af7795b3c4..e7d5164c4539 100644 --- a/src/webgpu/compat/api/validation/encoding/cmds/copyTextureToBuffer.spec.ts +++ b/src/webgpu/compat/api/validation/encoding/cmds/copyTextureToBuffer.spec.ts @@ -19,16 +19,17 @@ g.test('compressed') .fn(t => { const { format } = t.params; - const { blockWidth, blockHeight, bytesPerBlock } = kTextureFormatInfo[format]; + const info = kTextureFormatInfo[format]; + const textureSize = [info.blockWidth, info.blockHeight, 1]; const texture = t.device.createTexture({ - size: [blockWidth, blockHeight, 1], + size: textureSize, format, usage: GPUTextureUsage.COPY_SRC, }); t.trackForCleanup(texture); - const bytesPerRow = align(bytesPerBlock, 256); + const bytesPerRow = align(info.color.bytes, 256); const buffer = t.device.createBuffer({ size: bytesPerRow, @@ -37,7 +38,7 @@ g.test('compressed') t.trackForCleanup(buffer); const encoder = t.device.createCommandEncoder(); - encoder.copyTextureToBuffer({ texture }, { buffer, bytesPerRow }, [blockWidth, blockHeight, 1]); + encoder.copyTextureToBuffer({ texture }, { buffer, bytesPerRow }, textureSize); t.expectGPUError('validation', () => { encoder.finish(); });