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>
This commit is contained in:
James Price 2021-12-09 15:45:03 +00:00
parent ebdfa5d303
commit 3530c6bf06
10 changed files with 9 additions and 42 deletions

View File

@ -952,7 +952,6 @@ TEST_F(SpvParserMemoryTest, RemapStorageBuffer_TypesAndVarDeclarations) {
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;

View File

@ -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 Type* ParserImpl::ConvertType(
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 @@ const Type* ParserImpl::ConvertType(
// 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);
}

View File

@ -1413,7 +1413,6 @@ TEST_F(SpvModuleScopeVarParserTest,
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 @@ TEST_F(SpvModuleScopeVarParserTest, ColMajorDecoration_Dropped) {
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 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration_Natural_Dropped) {
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 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration) {
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 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_AllMembers) {
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 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_NotAllMembers) {
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 @@ TEST_F(
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;
};

View File

@ -2,7 +2,6 @@ type Arr = [[stride(64)]] array<mat4x4<f32>, 2u>;
type Arr_1 = [[stride(16)]] array<f32, 4u>;
[[block]]
struct LeftOver {
worldViewProjection : mat4x4<f32>;
time : f32;

View File

@ -2,7 +2,6 @@ struct QuicksortObject {
numbers : array<i32, 10u>;
};
[[block]]
struct buf0 {
resolution : vec2<f32>;
};

View File

@ -7,7 +7,6 @@ struct sspp962805860buildInformationS {
orientation : Arr;
};
[[block]]
struct x_B4_BuildInformation {
passthru : sspp962805860buildInformationS;
};

View File

@ -1,4 +1,3 @@
[[block]]
struct Uniforms {
NAN : f32;
[[size(12)]]
@ -19,19 +18,16 @@ type RTArr = [[stride(4)]] array<f32>;
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;
};

View File

@ -2,17 +2,14 @@ type RTArr = [[stride(4)]] array<f32>;
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;

View File

@ -2,24 +2,20 @@ type RTArr = [[stride(4)]] array<f32>;
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;

View File

@ -1,4 +1,3 @@
[[block]]
struct SSBO {
m : [[stride(16)]] array<vec2<f32>, 2u>;
};