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 <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
parent
ea3542d8a5
commit
3b5415f53a
|
@ -444,38 +444,28 @@ namespace {
|
|||
Field{"mat3x4<f32>", /* align */ 16, /* size */ 48}.PaddedSize(128),
|
||||
Field{"mat4x4<f32>", /* 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<u32, 1>", /* align */ 4, /* size */ 4}.StorageBufferOnly(),
|
||||
Field{"array<u32, 2>", /* align */ 4, /* size */ 8}.StorageBufferOnly(),
|
||||
Field{"array<u32, 3>", /* align */ 4, /* size */ 12}.StorageBufferOnly(),
|
||||
Field{"array<u32, 4>", /* align */ 4, /* size */ 16}.StorageBufferOnly(),
|
||||
Field{"@stride(16) array<u32, 1>", /* align */ 4, /* size */ 16}
|
||||
.StorageBufferOnly()
|
||||
.Strided<4, 12>(),
|
||||
Field{"@stride(16) array<u32, 2>", /* align */ 4, /* size */ 32}
|
||||
.StorageBufferOnly()
|
||||
.Strided<4, 12>(),
|
||||
Field{"@stride(16) array<u32, 3>", /* align */ 4, /* size */ 48}
|
||||
.StorageBufferOnly()
|
||||
.Strided<4, 12>(),
|
||||
Field{"@stride(16) array<u32, 4>", /* align */ 4, /* size */ 64}
|
||||
.StorageBufferOnly()
|
||||
.Strided<4, 12>(),
|
||||
Field{"array<vec4<u32>, 1>", /* align */ 16, /* size */ 16},
|
||||
Field{"array<vec4<u32>, 2>", /* align */ 16, /* size */ 32},
|
||||
Field{"array<vec4<u32>, 3>", /* align */ 16, /* size */ 48},
|
||||
Field{"array<vec4<u32>, 4>", /* align */ 16, /* size */ 64},
|
||||
Field{"array<vec3<u32>, 4>", /* align */ 16, /* size */ 64}.Strided<12, 4>(),
|
||||
Field{"@stride(32) array<vec3<u32>, 4>", /* align */ 16, /* size */ 128}
|
||||
.Strided<12, 20>(),
|
||||
|
||||
// Array types with custom alignment
|
||||
Field{"array<u32, 1>", /* align */ 32, /* size */ 4}.StorageBufferOnly(),
|
||||
Field{"array<u32, 2>", /* align */ 32, /* size */ 8}.StorageBufferOnly(),
|
||||
Field{"array<u32, 3>", /* align */ 32, /* size */ 12}.StorageBufferOnly(),
|
||||
Field{"array<u32, 4>", /* align */ 32, /* size */ 16}.StorageBufferOnly(),
|
||||
Field{"@stride(16) array<u32, 1>", /* align */ 32, /* size */ 16}.Strided<4, 12>(),
|
||||
Field{"@stride(16) array<u32, 2>", /* align */ 32, /* size */ 32}.Strided<4, 12>(),
|
||||
Field{"@stride(16) array<u32, 3>", /* align */ 32, /* size */ 48}.Strided<4, 12>(),
|
||||
Field{"@stride(16) array<u32, 4>", /* align */ 32, /* size */ 64}.Strided<4, 12>(),
|
||||
Field{"array<vec4<u32>, 1>", /* align */ 32, /* size */ 16},
|
||||
Field{"array<vec4<u32>, 2>", /* align */ 32, /* size */ 32},
|
||||
Field{"array<vec4<u32>, 3>", /* align */ 32, /* size */ 48},
|
||||
Field{"array<vec4<u32>, 4>", /* align */ 32, /* size */ 64},
|
||||
Field{"array<vec3<u32>, 4>", /* align */ 32, /* size */ 64}.Strided<12, 4>(),
|
||||
|
||||
// Array types with custom size
|
||||
|
|
|
@ -54,7 +54,7 @@ class OpArrayLengthTest : public DawnTest {
|
|||
// 0.
|
||||
mShaderInterface = R"(
|
||||
struct DataBuffer {
|
||||
data : @stride(4) array<f32>;
|
||||
data : array<f32>;
|
||||
};
|
||||
|
||||
// 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<f32>;
|
||||
data : @stride(8) array<Buffer3Data>;
|
||||
data : array<Buffer3Data>;
|
||||
};
|
||||
@group(0) @binding(2) var<storage, read> 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<u32, 3>;
|
||||
data : array<u32, 3>;
|
||||
};
|
||||
@group(1) @binding(0) var<storage, read_write> result : ResultBuffer;
|
||||
)" + mShaderInterface + R"(
|
||||
|
|
|
@ -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, 3>;", "u32", "d[0]", 120},
|
||||
{0, 3, "e : @stride(40) array<u32>;", "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<array<u32, 10>, 3>;", "u32", "d[0][0]", 120},
|
||||
{0, 3, "e : array<array<u32, 10>>;", "u32", "e[0][0]", 40}}});
|
||||
}
|
||||
|
||||
// Minimum size should be the max requirement of both vertex and fragment stages.
|
||||
|
|
Loading…
Reference in New Issue