reader/spirv: Do not generate block attributes
These are no longer necessary and will soon be deprecated and removed.
Bug: tint:1324
Change-Id: I3fa076e7ce5eb36466d24c80fd1c83658c28c5ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/72086
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/reader/spirv/function_memory_test.cc b/src/reader/spirv/function_memory_test.cc
index 21687ce..f8c8c98 100644
--- a/src/reader/spirv/function_memory_test.cc
+++ b/src/reader/spirv/function_memory_test.cc
@@ -952,7 +952,6 @@
const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, HasSubstr(R"(type RTArr = [[stride(4)]] array<u32>;
-[[block]]
struct S {
field0 : u32;
field1 : RTArr;
diff --git a/src/reader/spirv/parser_impl.cc b/src/reader/spirv/parser_impl.cc
index a6fc0f4..6e92c3e 100644
--- a/src/reader/spirv/parser_impl.cc
+++ b/src/reader/spirv/parser_impl.cc
@@ -24,7 +24,6 @@
#include "src/ast/disable_validation_decoration.h"
#include "src/ast/interpolate_decoration.h"
#include "src/ast/override_decoration.h"
-#include "src/ast/struct_block_decoration.h"
#include "src/ast/type_name.h"
#include "src/ast/unary_op_expression.h"
#include "src/reader/spirv/function.h"
@@ -1072,15 +1071,11 @@
const spvtools::opt::analysis::Struct* struct_ty) {
// Compute the struct decoration.
auto struct_decorations = this->GetDecorationsFor(type_id);
- bool is_block_decorated = false;
if (struct_decorations.size() == 1) {
const auto decoration = struct_decorations[0][0];
- if (decoration == SpvDecorationBlock) {
- is_block_decorated = true;
- } else if (decoration == SpvDecorationBufferBlock) {
- is_block_decorated = true;
+ if (decoration == SpvDecorationBufferBlock) {
remap_buffer_block_type_.insert(type_id);
- } else {
+ } else if (decoration != SpvDecorationBlock) {
Fail() << "struct with ID " << type_id
<< " has unrecognized decoration: " << int(decoration);
}
@@ -1193,13 +1188,8 @@
// Now make the struct.
auto sym = builder_.Symbols().Register(name);
- ast::DecorationList ast_struct_decorations;
- if (is_block_decorated && struct_types_for_buffers_.count(type_id)) {
- ast_struct_decorations.emplace_back(
- create<ast::StructBlockDecoration>(Source{}));
- }
auto* ast_struct = create<ast::Struct>(Source{}, sym, std::move(ast_members),
- std::move(ast_struct_decorations));
+ ast::DecorationList());
if (num_non_writable_members == members.size()) {
read_only_struct_types_.insert(ast_struct->name);
}
diff --git a/src/reader/spirv/parser_impl_module_var_test.cc b/src/reader/spirv/parser_impl_module_var_test.cc
index 9347c77..0b4bec4 100644
--- a/src/reader/spirv/parser_impl_module_var_test.cc
+++ b/src/reader/spirv/parser_impl_module_var_test.cc
@@ -1413,7 +1413,6 @@
const auto module_str = test::ToString(p->program());
EXPECT_THAT(module_str, HasSubstr(R"(type Arr = [[stride(4)]] array<u32, 2u>;
-[[block]]
struct S {
field0 : u32;
field1 : f32;
@@ -1446,8 +1445,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str, HasSubstr(R"([[block]]
-struct S {
+ EXPECT_THAT(module_str, HasSubstr(R"(struct S {
field0 : mat3x2<f32>;
};
@@ -1476,8 +1474,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str, HasSubstr(R"([[block]]
-struct S {
+ EXPECT_THAT(module_str, HasSubstr(R"(struct S {
field0 : mat3x2<f32>;
};
@@ -1506,8 +1503,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str, HasSubstr(R"([[block]]
-struct S {
+ EXPECT_THAT(module_str, HasSubstr(R"(struct S {
[[stride(64), internal(disable_validation__ignore_stride)]]
field0 : mat3x2<f32>;
};
@@ -1560,8 +1556,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str, HasSubstr(R"([[block]]
-struct S {
+ EXPECT_THAT(module_str, HasSubstr(R"(struct S {
field0 : f32;
field1 : f32;
};
@@ -1590,8 +1585,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str, HasSubstr(R"([[block]]
-struct S {
+ EXPECT_THAT(module_str, HasSubstr(R"(struct S {
field0 : f32;
field1 : f32;
};
@@ -1623,8 +1617,7 @@
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
EXPECT_TRUE(p->error().empty());
const auto module_str = test::ToString(p->program());
- EXPECT_THAT(module_str, HasSubstr(R"([[block]]
-struct S {
+ EXPECT_THAT(module_str, HasSubstr(R"(struct S {
field0 : f32;
field1 : f32;
};
diff --git a/test/bug/tint/1088.spvasm.expected.wgsl b/test/bug/tint/1088.spvasm.expected.wgsl
index ae16bd3..d5d5076 100644
--- a/test/bug/tint/1088.spvasm.expected.wgsl
+++ b/test/bug/tint/1088.spvasm.expected.wgsl
@@ -2,7 +2,6 @@
type Arr_1 = [[stride(16)]] array<f32, 4u>;
-[[block]]
struct LeftOver {
worldViewProjection : mat4x4<f32>;
time : f32;
diff --git a/test/bug/tint/749.spvasm.expected.wgsl b/test/bug/tint/749.spvasm.expected.wgsl
index 0f1392a..9839d72 100644
--- a/test/bug/tint/749.spvasm.expected.wgsl
+++ b/test/bug/tint/749.spvasm.expected.wgsl
@@ -2,7 +2,6 @@
numbers : array<i32, 10u>;
};
-[[block]]
struct buf0 {
resolution : vec2<f32>;
};
diff --git a/test/bug/tint/870.spvasm.expected.wgsl b/test/bug/tint/870.spvasm.expected.wgsl
index ea20633..9d03c58 100644
--- a/test/bug/tint/870.spvasm.expected.wgsl
+++ b/test/bug/tint/870.spvasm.expected.wgsl
@@ -7,7 +7,6 @@
orientation : Arr;
};
-[[block]]
struct x_B4_BuildInformation {
passthru : sspp962805860buildInformationS;
};
diff --git a/test/bug/tint/943.spvasm.expected.wgsl b/test/bug/tint/943.spvasm.expected.wgsl
index a30c20f..ab6b376 100644
--- a/test/bug/tint/943.spvasm.expected.wgsl
+++ b/test/bug/tint/943.spvasm.expected.wgsl
@@ -1,4 +1,3 @@
-[[block]]
struct Uniforms {
NAN : f32;
[[size(12)]]
@@ -19,19 +18,16 @@
type RTArr_1 = [[stride(4)]] array<f32>;
-[[block]]
struct ssbOut {
result : RTArr_1;
};
type RTArr_2 = [[stride(4)]] array<f32>;
-[[block]]
struct ssbA {
A : RTArr_1;
};
-[[block]]
struct ssbB {
B : RTArr_1;
};
diff --git a/test/bug/tint/951.spvasm.expected.wgsl b/test/bug/tint/951.spvasm.expected.wgsl
index b6f5fdd..2440aa7 100644
--- a/test/bug/tint/951.spvasm.expected.wgsl
+++ b/test/bug/tint/951.spvasm.expected.wgsl
@@ -2,17 +2,14 @@
type RTArr_1 = [[stride(4)]] array<f32>;
-[[block]]
struct ssbOut {
result : RTArr_1;
};
-[[block]]
struct ssbA {
A : RTArr_1;
};
-[[block]]
struct Uniforms {
NAN : f32;
aShape : i32;
diff --git a/test/bug/tint/977.spvasm.expected.wgsl b/test/bug/tint/977.spvasm.expected.wgsl
index 98ba008..711260b 100644
--- a/test/bug/tint/977.spvasm.expected.wgsl
+++ b/test/bug/tint/977.spvasm.expected.wgsl
@@ -2,24 +2,20 @@
type RTArr_1 = [[stride(4)]] array<f32>;
-[[block]]
struct ResultMatrix {
numbers : RTArr_1;
};
type RTArr_2 = [[stride(4)]] array<f32>;
-[[block]]
struct FirstMatrix {
numbers : RTArr_1;
};
-[[block]]
struct SecondMatrix {
numbers : RTArr_1;
};
-[[block]]
struct Uniforms {
NAN : f32;
sizeA : i32;
diff --git a/test/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl b/test/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl
index ee03dbc..d2d8b02 100644
--- a/test/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl
+++ b/test/layout/storage/mat2x2/stride/16.spvasm.expected.wgsl
@@ -1,4 +1,3 @@
-[[block]]
struct SSBO {
m : [[stride(16)]] array<vec2<f32>, 2u>;
};