mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 01:15:39 +00:00
Migrate all tests over to using Default Struct Layout
The WGSL spec has been updated with 'Default Struct Layouts': https://github.com/gpuweb/gpuweb/pull/1447 This removes the `[[offset(n)]]` decoration, and replaces it with two optional decorations: `[[size(n)]]` and `[[align(n)]]`, and a sensible set of sizes and alignments for each type. Most `[[stride(n)]]` decorations have also been removed from arrays. Bug: tint:626 Bug: tint:629 Change-Id: Ib0d2741f61ea943e6fb99d00cbb5cab2f97ae7be Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/44280 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
0008432827
commit
c56868420d
@@ -1089,7 +1089,7 @@ class SetBindGroupValidationTest : public ValidationTest {
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] value : vec2<f32>;
|
||||
value : vec2<f32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> uBufferDynamic : S;
|
||||
@@ -1112,7 +1112,7 @@ class SetBindGroupValidationTest : public ValidationTest {
|
||||
wgpu::ComputePipeline CreateComputePipeline() {
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] value : vec2<f32>;
|
||||
value : vec2<f32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> uBufferDynamic : S;
|
||||
@@ -1532,7 +1532,7 @@ class SetBindGroupPersistenceValidationTest : public ValidationTest {
|
||||
device.CreatePipelineLayout(&pipelineLayoutDescriptor);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "[[block]] struct S { [[offset(0)]] value : vec2<f32>; };";
|
||||
ss << "[[block]] struct S { value : vec2<f32>; };";
|
||||
|
||||
// Build a shader which has bindings that match the pipeline layout.
|
||||
for (uint32_t l = 0; l < layouts.size(); ++l) {
|
||||
@@ -1708,7 +1708,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
|
||||
wgpu::RenderPipeline CreateRenderPipeline(std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
|
||||
return CreateFSRenderPipeline(R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] value : vec2<f32>;
|
||||
value : vec2<f32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<storage_buffer> sBufferDynamic : [[access(read_write)]] S;
|
||||
@@ -1741,7 +1741,7 @@ class BindGroupLayoutCompatibilityTest : public ValidationTest {
|
||||
std::vector<wgpu::BindGroupLayout> bindGroupLayouts) {
|
||||
return CreateComputePipeline(R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] value : vec2<f32>;
|
||||
value : vec2<f32>;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<storage_buffer> sBufferDynamic : [[access(read_write)]] S;
|
||||
|
||||
@@ -45,7 +45,7 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniform0 : S;
|
||||
[[group(1), binding(0)]] var<uniform> uniform1 : S;
|
||||
@@ -55,12 +55,12 @@ TEST_F(GetBindGroupLayoutTests, SameObject) {
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S2 {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(2), binding(0)]] var<uniform> uniform2 : S2;
|
||||
|
||||
[[block]] struct S3 {
|
||||
[[offset(0)]] pos : mat4x4<f32>;
|
||||
pos : mat4x4<f32>;
|
||||
};
|
||||
[[group(3), binding(0)]] var<storage_buffer> storage3 : S3;
|
||||
|
||||
@@ -98,7 +98,7 @@ TEST_F(GetBindGroupLayoutTests, DefaultShaderStageAndDynamicOffsets) {
|
||||
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -141,7 +141,7 @@ TEST_F(GetBindGroupLayoutTests, ComputePipeline) {
|
||||
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -192,7 +192,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
||||
binding.buffer.type = wgpu::BufferBindingType::Storage;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage_buffer> ssbo : S;
|
||||
|
||||
@@ -204,7 +204,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
||||
binding.buffer.type = wgpu::BufferBindingType::Uniform;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -217,7 +217,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
||||
binding.buffer.type = wgpu::BufferBindingType::ReadOnlyStorage;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage_buffer> ssbo : [[access(read)]] S;
|
||||
|
||||
@@ -404,7 +404,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
||||
binding.binding = 0;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -417,7 +417,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
||||
binding.binding = 1;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -430,7 +430,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
||||
binding.binding = 2;
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(1)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -444,7 +444,7 @@ TEST_F(GetBindGroupLayoutTests, BindingIndices) {
|
||||
TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniform0 : S;
|
||||
[[group(1), binding(0)]] var<uniform> uniform1 : S;
|
||||
@@ -454,7 +454,7 @@ TEST_F(GetBindGroupLayoutTests, DuplicateBinding) {
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(1), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -478,7 +478,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
||||
|
||||
wgpu::ShaderModule vsModule4 = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : f32;
|
||||
pos : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -487,7 +487,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
||||
|
||||
wgpu::ShaderModule vsModule64 = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : mat4x4<f32>;
|
||||
pos : mat4x4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -496,7 +496,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
||||
|
||||
wgpu::ShaderModule fsModule4 = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : f32;
|
||||
pos : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -505,7 +505,7 @@ TEST_F(GetBindGroupLayoutTests, MinBufferSize) {
|
||||
|
||||
wgpu::ShaderModule fsModule64 = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : mat4x4<f32>;
|
||||
pos : mat4x4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -627,7 +627,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
||||
TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> ubo : S;
|
||||
|
||||
@@ -636,7 +636,7 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage_buffer> ssbo : S;
|
||||
|
||||
@@ -739,7 +739,7 @@ TEST_F(GetBindGroupLayoutTests, UnusedIndex) {
|
||||
|
||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms0 : S;
|
||||
[[group(2), binding(0)]] var<uniform> uniforms2 : S;
|
||||
@@ -786,7 +786,7 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] pos : vec4<f32>;
|
||||
pos : vec4<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -825,7 +825,7 @@ TEST_F(GetBindGroupLayoutTests, Reflection) {
|
||||
TEST_F(GetBindGroupLayoutTests, DISABLED_FromCorrectEntryPoint) {
|
||||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct Data {
|
||||
[[offset 0]] data : f32;
|
||||
data : f32;
|
||||
};
|
||||
[[binding 0, set 0]] var<storage_buffer> data0 : Data;
|
||||
[[binding 1, set 0]] var<storage_buffer> data1 : Data;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace {
|
||||
[[location(0)]] var<in> pos : vec2<f32>;
|
||||
|
||||
[[block]] struct S {
|
||||
[[offset(0)]] transform : mat2x2<f32>;
|
||||
transform : mat2x2<f32>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<uniform> uniforms : S;
|
||||
|
||||
@@ -40,12 +40,12 @@ namespace {
|
||||
|
||||
fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct Uniforms {
|
||||
[[offset(0)]] color : vec4<f32>;
|
||||
color : vec4<f32>;
|
||||
};
|
||||
[[group(1), binding(0)]] var<uniform> uniforms : Uniforms;
|
||||
|
||||
[[block]] struct Storage {
|
||||
[[offset(0)]] dummy : [[stride(4)]] array<f32>;
|
||||
dummy : array<f32>;
|
||||
};
|
||||
[[group(1), binding(1)]] var<storage_buffer> ssbo : [[access(read_write)]] Storage;
|
||||
|
||||
|
||||
@@ -486,7 +486,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
||||
TEST_F(RenderPipelineValidationTest, StorageBufferInVertexShaderNoLayout) {
|
||||
wgpu::ShaderModule vsModuleWithStorageBuffer = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct Dst {
|
||||
[[offset(0)]] data : [[stride(4)]] array<u32, 100>;
|
||||
data : array<u32, 100>;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage_buffer> dst : [[access(read_write)]] Dst;
|
||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
||||
@@ -703,7 +703,7 @@ TEST_F(RenderPipelineValidationTest, DISABLED_BindingsFromCorrectEntryPoint) {
|
||||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct Uniforms {
|
||||
[[offset 0]] data : vec4<f32>;
|
||||
data : vec4<f32>;
|
||||
};
|
||||
[[binding 0, set 0]] var<uniform> var0 : Uniforms;
|
||||
[[binding 1, set 0]] var<uniform> var1 : Uniforms;
|
||||
|
||||
@@ -777,7 +777,7 @@ namespace {
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct RBuffer {
|
||||
[[offset(0)]] value : f32;
|
||||
value : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage_buffer> rBuffer : [[access(read)]] RBuffer;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
@@ -817,7 +817,7 @@ namespace {
|
||||
// Create a passthrough compute pipeline with a readonly buffer
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[block]] struct RBuffer {
|
||||
[[offset(0)]] value : f32;
|
||||
value : f32;
|
||||
};
|
||||
[[group(0), binding(0)]] var<storage_buffer> rBuffer : [[access(read)]] RBuffer;
|
||||
[[stage(compute)]] fn main() -> void {
|
||||
|
||||
@@ -195,7 +195,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
|
||||
[[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>;
|
||||
|
||||
[[block]] struct Buf {
|
||||
[[offset(0)]] data : f32;
|
||||
data : f32;
|
||||
};
|
||||
[[group(0), binding(1)]] var<storage_buffer> buf : [[access(read_write)]] Buf;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user