mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 19:01:24 +00:00
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:
parent
ebdfa5d303
commit
3530c6bf06
@ -952,7 +952,6 @@ TEST_F(SpvParserMemoryTest, RemapStorageBuffer_TypesAndVarDeclarations) {
|
|||||||
const auto module_str = test::ToString(p->program());
|
const auto module_str = test::ToString(p->program());
|
||||||
EXPECT_THAT(module_str, HasSubstr(R"(type RTArr = [[stride(4)]] array<u32>;
|
EXPECT_THAT(module_str, HasSubstr(R"(type RTArr = [[stride(4)]] array<u32>;
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct S {
|
struct S {
|
||||||
field0 : u32;
|
field0 : u32;
|
||||||
field1 : RTArr;
|
field1 : RTArr;
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "src/ast/disable_validation_decoration.h"
|
#include "src/ast/disable_validation_decoration.h"
|
||||||
#include "src/ast/interpolate_decoration.h"
|
#include "src/ast/interpolate_decoration.h"
|
||||||
#include "src/ast/override_decoration.h"
|
#include "src/ast/override_decoration.h"
|
||||||
#include "src/ast/struct_block_decoration.h"
|
|
||||||
#include "src/ast/type_name.h"
|
#include "src/ast/type_name.h"
|
||||||
#include "src/ast/unary_op_expression.h"
|
#include "src/ast/unary_op_expression.h"
|
||||||
#include "src/reader/spirv/function.h"
|
#include "src/reader/spirv/function.h"
|
||||||
@ -1072,15 +1071,11 @@ const Type* ParserImpl::ConvertType(
|
|||||||
const spvtools::opt::analysis::Struct* struct_ty) {
|
const spvtools::opt::analysis::Struct* struct_ty) {
|
||||||
// Compute the struct decoration.
|
// Compute the struct decoration.
|
||||||
auto struct_decorations = this->GetDecorationsFor(type_id);
|
auto struct_decorations = this->GetDecorationsFor(type_id);
|
||||||
bool is_block_decorated = false;
|
|
||||||
if (struct_decorations.size() == 1) {
|
if (struct_decorations.size() == 1) {
|
||||||
const auto decoration = struct_decorations[0][0];
|
const auto decoration = struct_decorations[0][0];
|
||||||
if (decoration == SpvDecorationBlock) {
|
if (decoration == SpvDecorationBufferBlock) {
|
||||||
is_block_decorated = true;
|
|
||||||
} else if (decoration == SpvDecorationBufferBlock) {
|
|
||||||
is_block_decorated = true;
|
|
||||||
remap_buffer_block_type_.insert(type_id);
|
remap_buffer_block_type_.insert(type_id);
|
||||||
} else {
|
} else if (decoration != SpvDecorationBlock) {
|
||||||
Fail() << "struct with ID " << type_id
|
Fail() << "struct with ID " << type_id
|
||||||
<< " has unrecognized decoration: " << int(decoration);
|
<< " has unrecognized decoration: " << int(decoration);
|
||||||
}
|
}
|
||||||
@ -1193,13 +1188,8 @@ const Type* ParserImpl::ConvertType(
|
|||||||
|
|
||||||
// Now make the struct.
|
// Now make the struct.
|
||||||
auto sym = builder_.Symbols().Register(name);
|
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),
|
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()) {
|
if (num_non_writable_members == members.size()) {
|
||||||
read_only_struct_types_.insert(ast_struct->name);
|
read_only_struct_types_.insert(ast_struct->name);
|
||||||
}
|
}
|
||||||
|
@ -1413,7 +1413,6 @@ TEST_F(SpvModuleScopeVarParserTest,
|
|||||||
const auto module_str = test::ToString(p->program());
|
const auto module_str = test::ToString(p->program());
|
||||||
EXPECT_THAT(module_str, HasSubstr(R"(type Arr = [[stride(4)]] array<u32, 2u>;
|
EXPECT_THAT(module_str, HasSubstr(R"(type Arr = [[stride(4)]] array<u32, 2u>;
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct S {
|
struct S {
|
||||||
field0 : u32;
|
field0 : u32;
|
||||||
field1 : f32;
|
field1 : f32;
|
||||||
@ -1446,8 +1445,7 @@ TEST_F(SpvModuleScopeVarParserTest, ColMajorDecoration_Dropped) {
|
|||||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||||
EXPECT_TRUE(p->error().empty());
|
EXPECT_TRUE(p->error().empty());
|
||||||
const auto module_str = test::ToString(p->program());
|
const auto module_str = test::ToString(p->program());
|
||||||
EXPECT_THAT(module_str, HasSubstr(R"([[block]]
|
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||||
struct S {
|
|
||||||
field0 : mat3x2<f32>;
|
field0 : mat3x2<f32>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1476,8 +1474,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration_Natural_Dropped) {
|
|||||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||||
EXPECT_TRUE(p->error().empty());
|
EXPECT_TRUE(p->error().empty());
|
||||||
const auto module_str = test::ToString(p->program());
|
const auto module_str = test::ToString(p->program());
|
||||||
EXPECT_THAT(module_str, HasSubstr(R"([[block]]
|
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||||
struct S {
|
|
||||||
field0 : mat3x2<f32>;
|
field0 : mat3x2<f32>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1506,8 +1503,7 @@ TEST_F(SpvModuleScopeVarParserTest, MatrixStrideDecoration) {
|
|||||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||||
EXPECT_TRUE(p->error().empty());
|
EXPECT_TRUE(p->error().empty());
|
||||||
const auto module_str = test::ToString(p->program());
|
const auto module_str = test::ToString(p->program());
|
||||||
EXPECT_THAT(module_str, HasSubstr(R"([[block]]
|
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||||
struct S {
|
|
||||||
[[stride(64), internal(disable_validation__ignore_stride)]]
|
[[stride(64), internal(disable_validation__ignore_stride)]]
|
||||||
field0 : mat3x2<f32>;
|
field0 : mat3x2<f32>;
|
||||||
};
|
};
|
||||||
@ -1560,8 +1556,7 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_AllMembers) {
|
|||||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||||
EXPECT_TRUE(p->error().empty());
|
EXPECT_TRUE(p->error().empty());
|
||||||
const auto module_str = test::ToString(p->program());
|
const auto module_str = test::ToString(p->program());
|
||||||
EXPECT_THAT(module_str, HasSubstr(R"([[block]]
|
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||||
struct S {
|
|
||||||
field0 : f32;
|
field0 : f32;
|
||||||
field1 : f32;
|
field1 : f32;
|
||||||
};
|
};
|
||||||
@ -1590,8 +1585,7 @@ TEST_F(SpvModuleScopeVarParserTest, StorageBuffer_NonWritable_NotAllMembers) {
|
|||||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||||
EXPECT_TRUE(p->error().empty());
|
EXPECT_TRUE(p->error().empty());
|
||||||
const auto module_str = test::ToString(p->program());
|
const auto module_str = test::ToString(p->program());
|
||||||
EXPECT_THAT(module_str, HasSubstr(R"([[block]]
|
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||||
struct S {
|
|
||||||
field0 : f32;
|
field0 : f32;
|
||||||
field1 : f32;
|
field1 : f32;
|
||||||
};
|
};
|
||||||
@ -1623,8 +1617,7 @@ TEST_F(
|
|||||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||||
EXPECT_TRUE(p->error().empty());
|
EXPECT_TRUE(p->error().empty());
|
||||||
const auto module_str = test::ToString(p->program());
|
const auto module_str = test::ToString(p->program());
|
||||||
EXPECT_THAT(module_str, HasSubstr(R"([[block]]
|
EXPECT_THAT(module_str, HasSubstr(R"(struct S {
|
||||||
struct S {
|
|
||||||
field0 : f32;
|
field0 : f32;
|
||||||
field1 : f32;
|
field1 : f32;
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,6 @@ type Arr = [[stride(64)]] array<mat4x4<f32>, 2u>;
|
|||||||
|
|
||||||
type Arr_1 = [[stride(16)]] array<f32, 4u>;
|
type Arr_1 = [[stride(16)]] array<f32, 4u>;
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct LeftOver {
|
struct LeftOver {
|
||||||
worldViewProjection : mat4x4<f32>;
|
worldViewProjection : mat4x4<f32>;
|
||||||
time : f32;
|
time : f32;
|
||||||
|
@ -2,7 +2,6 @@ struct QuicksortObject {
|
|||||||
numbers : array<i32, 10u>;
|
numbers : array<i32, 10u>;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct buf0 {
|
struct buf0 {
|
||||||
resolution : vec2<f32>;
|
resolution : vec2<f32>;
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,6 @@ struct sspp962805860buildInformationS {
|
|||||||
orientation : Arr;
|
orientation : Arr;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct x_B4_BuildInformation {
|
struct x_B4_BuildInformation {
|
||||||
passthru : sspp962805860buildInformationS;
|
passthru : sspp962805860buildInformationS;
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
[[block]]
|
|
||||||
struct Uniforms {
|
struct Uniforms {
|
||||||
NAN : f32;
|
NAN : f32;
|
||||||
[[size(12)]]
|
[[size(12)]]
|
||||||
@ -19,19 +18,16 @@ type RTArr = [[stride(4)]] array<f32>;
|
|||||||
|
|
||||||
type RTArr_1 = [[stride(4)]] array<f32>;
|
type RTArr_1 = [[stride(4)]] array<f32>;
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct ssbOut {
|
struct ssbOut {
|
||||||
result : RTArr_1;
|
result : RTArr_1;
|
||||||
};
|
};
|
||||||
|
|
||||||
type RTArr_2 = [[stride(4)]] array<f32>;
|
type RTArr_2 = [[stride(4)]] array<f32>;
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct ssbA {
|
struct ssbA {
|
||||||
A : RTArr_1;
|
A : RTArr_1;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct ssbB {
|
struct ssbB {
|
||||||
B : RTArr_1;
|
B : RTArr_1;
|
||||||
};
|
};
|
||||||
|
@ -2,17 +2,14 @@ type RTArr = [[stride(4)]] array<f32>;
|
|||||||
|
|
||||||
type RTArr_1 = [[stride(4)]] array<f32>;
|
type RTArr_1 = [[stride(4)]] array<f32>;
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct ssbOut {
|
struct ssbOut {
|
||||||
result : RTArr_1;
|
result : RTArr_1;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct ssbA {
|
struct ssbA {
|
||||||
A : RTArr_1;
|
A : RTArr_1;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct Uniforms {
|
struct Uniforms {
|
||||||
NAN : f32;
|
NAN : f32;
|
||||||
aShape : i32;
|
aShape : i32;
|
||||||
|
@ -2,24 +2,20 @@ type RTArr = [[stride(4)]] array<f32>;
|
|||||||
|
|
||||||
type RTArr_1 = [[stride(4)]] array<f32>;
|
type RTArr_1 = [[stride(4)]] array<f32>;
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct ResultMatrix {
|
struct ResultMatrix {
|
||||||
numbers : RTArr_1;
|
numbers : RTArr_1;
|
||||||
};
|
};
|
||||||
|
|
||||||
type RTArr_2 = [[stride(4)]] array<f32>;
|
type RTArr_2 = [[stride(4)]] array<f32>;
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct FirstMatrix {
|
struct FirstMatrix {
|
||||||
numbers : RTArr_1;
|
numbers : RTArr_1;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct SecondMatrix {
|
struct SecondMatrix {
|
||||||
numbers : RTArr_1;
|
numbers : RTArr_1;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[block]]
|
|
||||||
struct Uniforms {
|
struct Uniforms {
|
||||||
NAN : f32;
|
NAN : f32;
|
||||||
sizeA : i32;
|
sizeA : i32;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
[[block]]
|
|
||||||
struct SSBO {
|
struct SSBO {
|
||||||
m : [[stride(16)]] array<vec2<f32>, 2u>;
|
m : [[stride(16)]] array<vec2<f32>, 2u>;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user