From 3b5415f53a28e403bf20c413cd5eac0c162de6b0 Mon Sep 17 00:00:00 2001 From: James Price Date: Mon, 21 Mar 2022 16:48:23 +0000 Subject: [PATCH] Remove usages of the @stride attribute in tests Support for @stride is about to removed from Tint. Bug: tint:1381 Change-Id: I6e30ed67d61ab82fd50843caf14216274b1e05fe Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/83960 Reviewed-by: Ben Clayton Commit-Queue: James Price --- .../ComputeLayoutMemoryBufferTests.cpp | 28 ++++++------------- src/dawn/tests/end2end/OpArrayLengthTests.cpp | 6 ++-- .../MinimumBufferSizeValidationTests.cpp | 11 ++++---- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp index e7037ea1fc..e59d3faed2 100644 --- a/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp +++ b/src/dawn/tests/end2end/ComputeLayoutMemoryBufferTests.cpp @@ -444,38 +444,28 @@ namespace { Field{"mat3x4", /* align */ 16, /* size */ 48}.PaddedSize(128), Field{"mat4x4", /* align */ 16, /* size */ 64}.PaddedSize(128), - // Array types with no custom alignment, size or stride + // Array types with no custom alignment or size. // Note: The use of StorageBufferOnly() is due to UBOs requiring 16 byte alignment // of array elements. See https://www.w3.org/TR/WGSL/#storage-class-constraints Field{"array", /* align */ 4, /* size */ 4}.StorageBufferOnly(), Field{"array", /* align */ 4, /* size */ 8}.StorageBufferOnly(), Field{"array", /* align */ 4, /* size */ 12}.StorageBufferOnly(), Field{"array", /* align */ 4, /* size */ 16}.StorageBufferOnly(), - Field{"@stride(16) array", /* align */ 4, /* size */ 16} - .StorageBufferOnly() - .Strided<4, 12>(), - Field{"@stride(16) array", /* align */ 4, /* size */ 32} - .StorageBufferOnly() - .Strided<4, 12>(), - Field{"@stride(16) array", /* align */ 4, /* size */ 48} - .StorageBufferOnly() - .Strided<4, 12>(), - Field{"@stride(16) array", /* align */ 4, /* size */ 64} - .StorageBufferOnly() - .Strided<4, 12>(), + Field{"array, 1>", /* align */ 16, /* size */ 16}, + Field{"array, 2>", /* align */ 16, /* size */ 32}, + Field{"array, 3>", /* align */ 16, /* size */ 48}, + Field{"array, 4>", /* align */ 16, /* size */ 64}, Field{"array, 4>", /* align */ 16, /* size */ 64}.Strided<12, 4>(), - Field{"@stride(32) array, 4>", /* align */ 16, /* size */ 128} - .Strided<12, 20>(), // Array types with custom alignment Field{"array", /* align */ 32, /* size */ 4}.StorageBufferOnly(), Field{"array", /* align */ 32, /* size */ 8}.StorageBufferOnly(), Field{"array", /* align */ 32, /* size */ 12}.StorageBufferOnly(), Field{"array", /* align */ 32, /* size */ 16}.StorageBufferOnly(), - Field{"@stride(16) array", /* align */ 32, /* size */ 16}.Strided<4, 12>(), - Field{"@stride(16) array", /* align */ 32, /* size */ 32}.Strided<4, 12>(), - Field{"@stride(16) array", /* align */ 32, /* size */ 48}.Strided<4, 12>(), - Field{"@stride(16) array", /* align */ 32, /* size */ 64}.Strided<4, 12>(), + Field{"array, 1>", /* align */ 32, /* size */ 16}, + Field{"array, 2>", /* align */ 32, /* size */ 32}, + Field{"array, 3>", /* align */ 32, /* size */ 48}, + Field{"array, 4>", /* align */ 32, /* size */ 64}, Field{"array, 4>", /* align */ 32, /* size */ 64}.Strided<12, 4>(), // Array types with custom size diff --git a/src/dawn/tests/end2end/OpArrayLengthTests.cpp b/src/dawn/tests/end2end/OpArrayLengthTests.cpp index 393e3435fe..b1fcb857c9 100644 --- a/src/dawn/tests/end2end/OpArrayLengthTests.cpp +++ b/src/dawn/tests/end2end/OpArrayLengthTests.cpp @@ -54,7 +54,7 @@ class OpArrayLengthTest : public DawnTest { // 0. mShaderInterface = R"( struct DataBuffer { - data : @stride(4) array; + data : array; }; // The length should be 1 because the buffer is 4-byte long. @@ -72,7 +72,7 @@ class OpArrayLengthTest : public DawnTest { struct Buffer3 { @size(64) garbage : mat4x4; - data : @stride(8) array; + data : array; }; @group(0) @binding(2) var buffer3 : Buffer3; )"; @@ -125,7 +125,7 @@ TEST_P(OpArrayLengthTest, Compute) { pipelineDesc.compute.entryPoint = "main"; pipelineDesc.compute.module = utils::CreateShaderModule(device, (R"( struct ResultBuffer { - data : @stride(4) array; + data : array; }; @group(1) @binding(0) var result : ResultBuffer; )" + mShaderInterface + R"( diff --git a/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp b/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp index 0b5f7f3c01..e851f4ee4f 100644 --- a/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/MinimumBufferSizeValidationTests.cpp @@ -563,12 +563,13 @@ TEST_F(MinBufferSizeDefaultLayoutTests, MultipleBindGroups) { wgpu::BufferBindingType::ReadOnlyStorage}}}); } -// Test the minimum size computations with manual size/align/stride decorations. +// Test the minimum size computations with manual size/align attributes. TEST_F(MinBufferSizeDefaultLayoutTests, NonDefaultLayout) { - CheckShaderBindingSizeReflection({{{0, 0, "@size(256) a : u32; b : u32;", "u32", "a", 260}, - {0, 1, "c : u32; @align(16) d : u32;", "u32", "c", 20}, - {0, 2, "d : @stride(40) array;", "u32", "d[0]", 120}, - {0, 3, "e : @stride(40) array;", "u32", "e[0]", 40}}}); + CheckShaderBindingSizeReflection( + {{{0, 0, "@size(256) a : u32; b : u32;", "u32", "a", 260}, + {0, 1, "c : u32; @align(16) d : u32;", "u32", "c", 20}, + {0, 2, "d : array, 3>;", "u32", "d[0][0]", 120}, + {0, 3, "e : array>;", "u32", "e[0][0]", 40}}}); } // Minimum size should be the max requirement of both vertex and fragment stages.