Rename Index and Member builder helpers.

This CL renames Index to IndexAccessor and Member to MemberAccessor.
This keeps the naming consistent and makes room to use Member for
StructMember.

Change-Id: Icbba3a39ed5e079cd83d8f512fff69494dfac10d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35824
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
dan sinclair
2020-12-16 11:49:10 +00:00
committed by Commit Bot service account
parent 523b2193e3
commit 8b40a67cf7
8 changed files with 120 additions and 90 deletions

View File

@@ -119,7 +119,8 @@ TEST_F(BoundArrayAccessorsTest, Ptrs_Clamp) {
Var("a", ast::StorageClass::kFunction, ty.array<f32, 3>());
Const("c", ast::StorageClass::kFunction, ty.u32);
Const("b", ast::StorageClass::kFunction,
ty.pointer<f32>(ast::StorageClass::kFunction), Index("a", "c"), {});
ty.pointer<f32>(ast::StorageClass::kFunction),
IndexAccessor("a", "c"), {});
}
};
@@ -168,7 +169,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Nested_Scalar) {
Var("b", ast::StorageClass::kFunction, ty.array<f32, 5>());
Var("i", ast::StorageClass::kFunction, ty.u32);
Const("c", ast::StorageClass::kFunction, ty.f32,
Index("a", Index("b", "i")), {});
IndexAccessor("a", IndexAccessor("b", "i")), {});
}
};
@@ -237,7 +238,8 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Scalar) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.array(ty.f32, 3));
Var("b", ast::StorageClass::kFunction, ty.f32, Index("a", 1u), {});
Var("b", ast::StorageClass::kFunction, ty.f32, IndexAccessor("a", 1u),
{});
}
};
@@ -270,7 +272,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Expr) {
Var("a", ast::StorageClass::kFunction, ty.array<f32, 3>());
Var("c", ast::StorageClass::kFunction, ty.u32);
Var("b", ast::StorageClass::kFunction, ty.f32,
Index("a", Add("c", Sub(2u, 3u))), {});
IndexAccessor("a", Add("c", Sub(2u, 3u))), {});
}
};
@@ -335,7 +337,8 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Negative) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.array<f32, 3>());
Var("b", ast::StorageClass::kFunction, ty.f32, Index("a", -1), {});
Var("b", ast::StorageClass::kFunction, ty.f32, IndexAccessor("a", -1),
{});
}
};
@@ -365,7 +368,8 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_OutOfBounds) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.array<f32, 3>());
Var("b", ast::StorageClass::kFunction, ty.f32, Index("a", 3u), {});
Var("b", ast::StorageClass::kFunction, ty.f32, IndexAccessor("a", 3u),
{});
}
};
@@ -395,7 +399,8 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Scalar) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.vec3<f32>());
Var("b", ast::StorageClass::kFunction, ty.f32, Index("a", 1u), {});
Var("b", ast::StorageClass::kFunction, ty.f32, IndexAccessor("a", 1u),
{});
}
};
@@ -428,7 +433,7 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Expr) {
Var("a", ast::StorageClass::kFunction, ty.vec3<f32>());
Var("c", ast::StorageClass::kFunction, ty.u32);
Var("b", ast::StorageClass::kFunction, ty.f32,
Index("a", Add("c", Sub(2u, 3u))), {});
IndexAccessor("a", Add("c", Sub(2u, 3u))), {});
}
};
@@ -491,7 +496,8 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Negative) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.vec3<f32>());
Var("b", ast::StorageClass::kFunction, ty.f32, Index("a", -1), {});
Var("b", ast::StorageClass::kFunction, ty.f32, IndexAccessor("a", -1),
{});
}
};
@@ -521,7 +527,8 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_OutOfBounds) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.vec3<f32>());
Var("b", ast::StorageClass::kFunction, ty.f32, Index("a", 3u), {});
Var("b", ast::StorageClass::kFunction, ty.f32, IndexAccessor("a", 3u),
{});
}
};
@@ -551,8 +558,8 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Scalar) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.mat3x2<f32>());
Var("b", ast::StorageClass::kFunction, ty.f32, Index(Index("a", 2u), 1u),
{});
Var("b", ast::StorageClass::kFunction, ty.f32,
IndexAccessor(IndexAccessor("a", 2u), 1u), {});
}
};
@@ -598,7 +605,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Column) {
Var("a", ast::StorageClass::kFunction, ty.mat3x2<f32>());
Var("c", ast::StorageClass::kFunction, ty.u32);
Var("b", ast::StorageClass::kFunction, ty.f32,
Index(Index("a", Add("c", Sub(2u, 3u))), 1u), {});
IndexAccessor(IndexAccessor("a", Add("c", Sub(2u, 3u))), 1u), {});
}
};
@@ -678,7 +685,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Row) {
Var("a", ast::StorageClass::kFunction, ty.mat3x2<f32>());
Var("c", ast::StorageClass::kFunction, ty.u32);
Var("b", ast::StorageClass::kFunction, ty.f32,
Index(Index("a", 1u), Add("c", Sub(2u, 3u))), {});
IndexAccessor(IndexAccessor("a", 1u), Add("c", Sub(2u, 3u))), {});
}
};
@@ -755,8 +762,8 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Column) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.mat3x2<f32>());
Var("b", ast::StorageClass::kFunction, ty.f32, Index(Index("a", -1), 1),
{});
Var("b", ast::StorageClass::kFunction, ty.f32,
IndexAccessor(IndexAccessor("a", -1), 1), {});
}
};
@@ -799,8 +806,8 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Row) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.mat3x2<f32>());
Var("b", ast::StorageClass::kFunction, ty.f32, Index(Index("a", 2), -1),
{});
Var("b", ast::StorageClass::kFunction, ty.f32,
IndexAccessor(IndexAccessor("a", 2), -1), {});
}
};
@@ -843,8 +850,8 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Column) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.mat3x2<f32>());
Var("b", ast::StorageClass::kFunction, ty.f32, Index(Index("a", 5u), 1u),
{});
Var("b", ast::StorageClass::kFunction, ty.f32,
IndexAccessor(IndexAccessor("a", 5u), 1u), {});
}
};
@@ -887,8 +894,8 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Row) {
struct Builder : ModuleBuilder {
void Build() override {
Var("a", ast::StorageClass::kFunction, ty.mat3x2<f32>());
Var("b", ast::StorageClass::kFunction, ty.f32, Index(Index("a", 2u), 5u),
{});
Var("b", ast::StorageClass::kFunction, ty.f32,
IndexAccessor(IndexAccessor("a", 2u), 5u), {});
}
};