[ast] Add the result_type into the AST dump

This CL adds the result_type type_name into the AST dump if available.

Bug: tint:310, tint:308
Change-Id: Iea678fd4f7a2dadbfca86f29043c75459c421cb3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32780
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2020-11-16 14:46:27 +00:00 committed by Commit Bot service account
parent 112314b73d
commit 80598edf78
43 changed files with 2373 additions and 2326 deletions

View File

@ -482,15 +482,7 @@ int main(int argc, const char** argv) {
tint::diag::Formatter().format(reader->diagnostics(), printer.get()); tint::diag::Formatter().format(reader->diagnostics(), printer.get());
return 1; return 1;
} }
auto mod = reader->module(); auto mod = reader->module();
if (options.dump_ast) {
std::cout << std::endl << mod.to_str() << std::endl;
}
if (options.parse_only) {
return 1;
}
if (!mod.IsValid()) { if (!mod.IsValid()) {
std::cerr << "Invalid module generated..." << std::endl; std::cerr << "Invalid module generated..." << std::endl;
return 1; return 1;
@ -502,6 +494,13 @@ int main(int argc, const char** argv) {
return 1; return 1;
} }
if (options.dump_ast) {
std::cout << std::endl << mod.to_str() << std::endl;
}
if (options.parse_only) {
return 1;
}
tint::Validator v; tint::Validator v;
if (!v.Validate(&mod)) { if (!v.Validate(&mod)) {
std::cerr << "Validation: " << v.error() << std::endl; std::cerr << "Validation: " << v.error() << std::endl;

View File

@ -52,7 +52,7 @@ bool ArrayAccessorExpression::IsValid() const {
void ArrayAccessorExpression::to_str(std::ostream& out, size_t indent) const { void ArrayAccessorExpression::to_str(std::ostream& out, size_t indent) const {
make_indent(out, indent); make_indent(out, indent);
out << "ArrayAccessor{" << std::endl; out << "ArrayAccessor[" << result_type_str() << "]{" << std::endl;
array_->to_str(out, indent + 2); array_->to_str(out, indent + 2);
idx_expr_->to_str(out, indent + 2); idx_expr_->to_str(out, indent + 2);
make_indent(out, indent); make_indent(out, indent);

View File

@ -96,9 +96,9 @@ TEST_F(ArrayAccessorExpressionTest, ToStr) {
std::ostringstream out; std::ostringstream out;
exp.to_str(out, 2); exp.to_str(out, 2);
EXPECT_EQ(out.str(), R"( ArrayAccessor{ EXPECT_EQ(out.str(), R"( ArrayAccessor[not set]{
Identifier{ary} Identifier[not set]{ary}
Identifier{idx} Identifier[not set]{idx}
} }
)"); )");
} }

View File

@ -101,8 +101,8 @@ TEST_F(AssignmentStatementTest, ToStr) {
stmt.to_str(out, 2); stmt.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Assignment{ EXPECT_EQ(out.str(), R"( Assignment{
Identifier{lhs} Identifier[not set]{lhs}
Identifier{rhs} Identifier[not set]{rhs}
} }
)"); )");
} }

View File

@ -50,7 +50,7 @@ bool BinaryExpression::IsValid() const {
void BinaryExpression::to_str(std::ostream& out, size_t indent) const { void BinaryExpression::to_str(std::ostream& out, size_t indent) const {
make_indent(out, indent); make_indent(out, indent);
out << "Binary{" << std::endl; out << "Binary[" << result_type_str() << "]{" << std::endl;
lhs_->to_str(out, indent + 2); lhs_->to_str(out, indent + 2);
make_indent(out, indent + 2); make_indent(out, indent + 2);

View File

@ -111,10 +111,10 @@ TEST_F(BinaryExpressionTest, ToStr) {
BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs)); BinaryExpression r(BinaryOp::kEqual, std::move(lhs), std::move(rhs));
std::ostringstream out; std::ostringstream out;
r.to_str(out, 2); r.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Binary{ EXPECT_EQ(out.str(), R"( Binary[not set]{
Identifier{lhs} Identifier[not set]{lhs}
equal equal
Identifier{rhs} Identifier[not set]{rhs}
} }
)"); )");
} }

View File

@ -43,7 +43,8 @@ bool BitcastExpression::IsValid() const {
void BitcastExpression::to_str(std::ostream& out, size_t indent) const { void BitcastExpression::to_str(std::ostream& out, size_t indent) const {
make_indent(out, indent); make_indent(out, indent);
out << "Bitcast<" << type_->type_name() << ">{" << std::endl; out << "Bitcast[" << result_type_str() << "]<" << type_->type_name() << ">{"
<< std::endl;
expr_->to_str(out, indent + 2); expr_->to_str(out, indent + 2);
make_indent(out, indent); make_indent(out, indent);
out << "}" << std::endl; out << "}" << std::endl;

View File

@ -89,8 +89,8 @@ TEST_F(BitcastExpressionTest, ToStr) {
std::ostringstream out; std::ostringstream out;
exp.to_str(out, 2); exp.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Bitcast<__f32>{ EXPECT_EQ(out.str(), R"( Bitcast[not set]<__f32>{
Identifier{expr} Identifier[not set]{expr}
} }
)"); )");
} }

View File

@ -50,7 +50,7 @@ bool CallExpression::IsValid() const {
void CallExpression::to_str(std::ostream& out, size_t indent) const { void CallExpression::to_str(std::ostream& out, size_t indent) const {
make_indent(out, indent); make_indent(out, indent);
out << "Call{" << std::endl; out << "Call[" << result_type_str() << "]{" << std::endl;
func_->to_str(out, indent + 2); func_->to_str(out, indent + 2);
make_indent(out, indent + 2); make_indent(out, indent + 2);

View File

@ -101,8 +101,8 @@ TEST_F(CallExpressionTest, ToStr_NoParams) {
CallExpression stmt(std::move(func), {}); CallExpression stmt(std::move(func), {});
std::ostringstream out; std::ostringstream out;
stmt.to_str(out, 2); stmt.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Call{ EXPECT_EQ(out.str(), R"( Call[not set]{
Identifier{func} Identifier[not set]{func}
( (
) )
} }
@ -118,11 +118,11 @@ TEST_F(CallExpressionTest, ToStr_WithParams) {
CallExpression stmt(std::move(func), std::move(params)); CallExpression stmt(std::move(func), std::move(params));
std::ostringstream out; std::ostringstream out;
stmt.to_str(out, 2); stmt.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Call{ EXPECT_EQ(out.str(), R"( Call[not set]{
Identifier{func} Identifier[not set]{func}
( (
Identifier{param1} Identifier[not set]{param1}
Identifier{param2} Identifier[not set]{param2}
) )
} }
)"); )");

View File

@ -60,8 +60,8 @@ TEST_F(CallStatementTest, ToStr) {
std::ostringstream out; std::ostringstream out;
c.to_str(out, 2); c.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Call{ EXPECT_EQ(out.str(), R"( Call[not set]{
Identifier{func} Identifier[not set]{func}
( (
) )
} }

View File

@ -133,7 +133,7 @@ TEST_F(DecoratedVariableTest, to_str) {
function function
__f32 __f32
{ {
Identifier{expr} Identifier[not set]{expr}
} }
} }
)"); )");

View File

@ -116,7 +116,7 @@ TEST_F(ElseStatementTest, ToStr) {
e.to_str(out, 2); e.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Else{ EXPECT_EQ(out.str(), R"( Else{
( (
ScalarConstructor{true} ScalarConstructor[not set]{true}
) )
{ {
Discard{} Discard{}

View File

@ -16,6 +16,7 @@
#define SRC_AST_EXPRESSION_H_ #define SRC_AST_EXPRESSION_H_
#include <memory> #include <memory>
#include <string>
#include <vector> #include <vector>
#include "src/ast/node.h" #include "src/ast/node.h"
@ -44,6 +45,12 @@ class Expression : public Node {
/// @returns the resulting type from this expression /// @returns the resulting type from this expression
type::Type* result_type() const { return result_type_; } type::Type* result_type() const { return result_type_; }
/// @returns a string representation of the result type or 'not set' if no
/// result type present
std::string result_type_str() const {
return result_type_ ? result_type_->type_name() : "not set";
}
/// @returns true if this is an array accessor expression /// @returns true if this is an array accessor expression
virtual bool IsArrayAccessor() const; virtual bool IsArrayAccessor() const;
/// @returns true if this is a bitcast expression /// @returns true if this is a bitcast expression

View File

@ -38,7 +38,8 @@ bool IdentifierExpression::IsValid() const {
void IdentifierExpression::to_str(std::ostream& out, size_t indent) const { void IdentifierExpression::to_str(std::ostream& out, size_t indent) const {
make_indent(out, indent); make_indent(out, indent);
out << "Identifier{" << name_ << "}" << std::endl; out << "Identifier[" << result_type_str() << "]{" << name_ << "}"
<< std::endl;
} }
} // namespace ast } // namespace ast

View File

@ -55,7 +55,7 @@ TEST_F(IdentifierExpressionTest, ToStr) {
IdentifierExpression i("ident"); IdentifierExpression i("ident");
std::ostringstream out; std::ostringstream out;
i.to_str(out, 2); i.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Identifier{ident} EXPECT_EQ(out.str(), R"( Identifier[not set]{ident}
)"); )");
} }

View File

@ -186,7 +186,7 @@ TEST_F(IfStatementTest, ToStr) {
stmt.to_str(out, 2); stmt.to_str(out, 2);
EXPECT_EQ(out.str(), R"( If{ EXPECT_EQ(out.str(), R"( If{
( (
Identifier{cond} Identifier[not set]{cond}
) )
{ {
Discard{} Discard{}
@ -221,7 +221,7 @@ TEST_F(IfStatementTest, ToStr_WithElseStatements) {
stmt.to_str(out, 2); stmt.to_str(out, 2);
EXPECT_EQ(out.str(), R"( If{ EXPECT_EQ(out.str(), R"( If{
( (
Identifier{cond} Identifier[not set]{cond}
) )
{ {
Discard{} Discard{}
@ -229,7 +229,7 @@ TEST_F(IfStatementTest, ToStr_WithElseStatements) {
} }
Else{ Else{
( (
Identifier{ident} Identifier[not set]{ident}
) )
{ {
Discard{} Discard{}

View File

@ -53,7 +53,7 @@ bool MemberAccessorExpression::IsValid() const {
void MemberAccessorExpression::to_str(std::ostream& out, size_t indent) const { void MemberAccessorExpression::to_str(std::ostream& out, size_t indent) const {
make_indent(out, indent); make_indent(out, indent);
out << "MemberAccessor{" << std::endl; out << "MemberAccessor[" << result_type_str() << "]{" << std::endl;
struct_->to_str(out, indent + 2); struct_->to_str(out, indent + 2);
member_->to_str(out, indent + 2); member_->to_str(out, indent + 2);
make_indent(out, indent); make_indent(out, indent);

View File

@ -100,9 +100,9 @@ TEST_F(MemberAccessorExpressionTest, ToStr) {
MemberAccessorExpression stmt(std::move(str), std::move(mem)); MemberAccessorExpression stmt(std::move(str), std::move(mem));
std::ostringstream out; std::ostringstream out;
stmt.to_str(out, 2); stmt.to_str(out, 2);
EXPECT_EQ(out.str(), R"( MemberAccessor{ EXPECT_EQ(out.str(), R"( MemberAccessor[not set]{
Identifier{structure} Identifier[not set]{structure}
Identifier{member} Identifier[not set]{member}
} }
)"); )");
} }

View File

@ -40,9 +40,7 @@ class Node {
/// Writes a representation of the node to the output stream /// Writes a representation of the node to the output stream
/// @param out the stream to write to /// @param out the stream to write to
/// @param indent number of spaces to indent the node when writing /// @param indent number of spaces to indent the node when writing
//! @cond Doxygen_Suppress
virtual void to_str(std::ostream& out, size_t indent) const = 0; virtual void to_str(std::ostream& out, size_t indent) const = 0;
//! @endcond
/// Convenience wrapper around the |to_str| method. /// Convenience wrapper around the |to_str| method.
/// @returns the node as a string /// @returns the node as a string

View File

@ -80,7 +80,7 @@ TEST_F(ReturnStatementTest, ToStr_WithValue) {
r.to_str(out, 2); r.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Return{ EXPECT_EQ(out.str(), R"( Return{
{ {
Identifier{expr} Identifier[not set]{expr}
} }
} }
)"); )");

View File

@ -45,7 +45,8 @@ bool ScalarConstructorExpression::IsValid() const {
void ScalarConstructorExpression::to_str(std::ostream& out, void ScalarConstructorExpression::to_str(std::ostream& out,
size_t indent) const { size_t indent) const {
make_indent(out, indent); make_indent(out, indent);
out << "ScalarConstructor{" << literal_->to_str() << "}" << std::endl; out << "ScalarConstructor[" << result_type_str() << "]{" << literal_->to_str()
<< "}" << std::endl;
} }
} // namespace ast } // namespace ast

View File

@ -59,7 +59,7 @@ TEST_F(ScalarConstructorExpressionTest, ToStr) {
ScalarConstructorExpression c(std::move(b)); ScalarConstructorExpression c(std::move(b));
std::ostringstream out; std::ostringstream out;
c.to_str(out, 2); c.to_str(out, 2);
EXPECT_EQ(out.str(), R"( ScalarConstructor{true} EXPECT_EQ(out.str(), R"( ScalarConstructor[not set]{true}
)"); )");
} }

View File

@ -145,7 +145,7 @@ TEST_F(SwitchStatementTest, ToStr_Empty) {
std::ostringstream out; std::ostringstream out;
stmt.to_str(out, 2); stmt.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Switch{ EXPECT_EQ(out.str(), R"( Switch{
Identifier{ident} Identifier[not set]{ident}
{ {
} }
} }
@ -167,7 +167,7 @@ TEST_F(SwitchStatementTest, ToStr) {
std::ostringstream out; std::ostringstream out;
stmt.to_str(out, 2); stmt.to_str(out, 2);
EXPECT_EQ(out.str(), R"( Switch{ EXPECT_EQ(out.str(), R"( Switch{
Identifier{ident} Identifier[not set]{ident}
{ {
Case 2{ Case 2{
} }

View File

@ -55,7 +55,7 @@ bool TypeConstructorExpression::IsValid() const {
void TypeConstructorExpression::to_str(std::ostream& out, size_t indent) const { void TypeConstructorExpression::to_str(std::ostream& out, size_t indent) const {
make_indent(out, indent); make_indent(out, indent);
out << "TypeConstructor{" << std::endl; out << "TypeConstructor[" << result_type_str() << "]{" << std::endl;
make_indent(out, indent + 2); make_indent(out, indent + 2);
out << type_->type_name() << std::endl; out << type_->type_name() << std::endl;

View File

@ -114,11 +114,11 @@ TEST_F(TypeConstructorExpressionTest, ToStr) {
TypeConstructorExpression t(&vec, std::move(expr)); TypeConstructorExpression t(&vec, std::move(expr));
std::ostringstream out; std::ostringstream out;
t.to_str(out, 2); t.to_str(out, 2);
EXPECT_EQ(out.str(), R"( TypeConstructor{ EXPECT_EQ(out.str(), R"( TypeConstructor[not set]{
__vec_3__f32 __vec_3__f32
Identifier{expr_1} Identifier[not set]{expr_1}
Identifier{expr_2} Identifier[not set]{expr_2}
Identifier{expr_3} Identifier[not set]{expr_3}
} }
)"); )");
} }

View File

@ -42,7 +42,7 @@ bool UnaryOpExpression::IsValid() const {
void UnaryOpExpression::to_str(std::ostream& out, size_t indent) const { void UnaryOpExpression::to_str(std::ostream& out, size_t indent) const {
make_indent(out, indent); make_indent(out, indent);
out << "UnaryOp{" << std::endl; out << "UnaryOp[" << result_type_str() << "]{" << std::endl;
make_indent(out, indent + 2); make_indent(out, indent + 2);
out << op_ << std::endl; out << op_ << std::endl;
expr_->to_str(out, indent + 2); expr_->to_str(out, indent + 2);

View File

@ -71,9 +71,9 @@ TEST_F(UnaryOpExpressionTest, ToStr) {
UnaryOpExpression u(UnaryOp::kNot, std::move(ident)); UnaryOpExpression u(UnaryOp::kNot, std::move(ident));
std::ostringstream out; std::ostringstream out;
u.to_str(out, 2); u.to_str(out, 2);
EXPECT_EQ(out.str(), R"( UnaryOp{ EXPECT_EQ(out.str(), R"( UnaryOp[not set]{
not not
Identifier{ident} Identifier[not set]{ident}
} }
)"); )");
} }

View File

@ -68,54 +68,54 @@ std::string CommonTypes() {
// Returns the AST dump for a given SPIR-V assembly constant. // Returns the AST dump for a given SPIR-V assembly constant.
std::string AstFor(std::string assembly) { std::string AstFor(std::string assembly) {
if (assembly == "v2uint_10_20") { if (assembly == "v2uint_10_20") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
})"; })";
} }
if (assembly == "v2uint_20_10") { if (assembly == "v2uint_20_10") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{20} ScalarConstructor[not set]{20}
ScalarConstructor{10} ScalarConstructor[not set]{10}
})"; })";
} }
if (assembly == "v2int_30_40") { if (assembly == "v2int_30_40") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{30} ScalarConstructor[not set]{30}
ScalarConstructor{40} ScalarConstructor[not set]{40}
})"; })";
} }
if (assembly == "v2int_40_30") { if (assembly == "v2int_40_30") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{40} ScalarConstructor[not set]{40}
ScalarConstructor{30} ScalarConstructor[not set]{30}
})"; })";
} }
if (assembly == "cast_int_v2uint_10_20") { if (assembly == "cast_int_v2uint_10_20") {
return R"(Bitcast<__vec_2__i32>{ return R"(Bitcast[not set]<__vec_2__i32>{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
} }
})"; })";
} }
if (assembly == "v2float_50_60") { if (assembly == "v2float_50_60") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
})"; })";
} }
if (assembly == "v2float_60_50") { if (assembly == "v2float_60_50") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
})"; })";
} }
return "bad case"; return "bad case";
@ -141,9 +141,9 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Int) {
none none
__i32 __i32
{ {
UnaryOp{ UnaryOp[not set]{
negation negation
ScalarConstructor{30} ScalarConstructor[not set]{30}
} }
} }
})")) })"))
@ -168,10 +168,10 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) {
none none
__i32 __i32
{ {
UnaryOp{ UnaryOp[not set]{
negation negation
Bitcast<__i32>{ Bitcast[not set]<__i32>{
ScalarConstructor{10} ScalarConstructor[not set]{10}
} }
} }
} }
@ -197,10 +197,10 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) {
none none
__u32 __u32
{ {
Bitcast<__u32>{ Bitcast[not set]<__u32>{
UnaryOp{ UnaryOp[not set]{
negation negation
ScalarConstructor{30} ScalarConstructor[not set]{30}
} }
} }
} }
@ -226,11 +226,11 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) {
none none
__u32 __u32
{ {
Bitcast<__u32>{ Bitcast[not set]<__u32>{
UnaryOp{ UnaryOp[not set]{
negation negation
Bitcast<__i32>{ Bitcast[not set]<__i32>{
ScalarConstructor{10} ScalarConstructor[not set]{10}
} }
} }
} }
@ -257,12 +257,12 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) {
none none
__vec_2__i32 __vec_2__i32
{ {
UnaryOp{ UnaryOp[not set]{
negation negation
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{30} ScalarConstructor[not set]{30}
ScalarConstructor{40} ScalarConstructor[not set]{40}
} }
} }
} }
@ -288,13 +288,13 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) {
none none
__vec_2__i32 __vec_2__i32
{ {
UnaryOp{ UnaryOp[not set]{
negation negation
Bitcast<__vec_2__i32>{ Bitcast[not set]<__vec_2__i32>{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
} }
} }
} }
@ -321,13 +321,13 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) {
none none
__vec_2__u32 __vec_2__u32
{ {
Bitcast<__vec_2__u32>{ Bitcast[not set]<__vec_2__u32>{
UnaryOp{ UnaryOp[not set]{
negation negation
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{30} ScalarConstructor[not set]{30}
ScalarConstructor{40} ScalarConstructor[not set]{40}
} }
} }
} }
@ -354,14 +354,14 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) {
none none
__vec_2__u32 __vec_2__u32
{ {
Bitcast<__vec_2__u32>{ Bitcast[not set]<__vec_2__u32>{
UnaryOp{ UnaryOp[not set]{
negation negation
Bitcast<__vec_2__i32>{ Bitcast[not set]<__vec_2__i32>{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
} }
} }
} }
@ -389,9 +389,9 @@ TEST_F(SpvUnaryArithTest, FNegate_Scalar) {
none none
__f32 __f32
{ {
UnaryOp{ UnaryOp[not set]{
negation negation
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
} }
} }
})")) })"))
@ -416,12 +416,12 @@ TEST_F(SpvUnaryArithTest, FNegate_Vector) {
none none
__vec_2__f32 __vec_2__f32
{ {
UnaryOp{ UnaryOp[not set]{
negation negation
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
} }
} }
} }
@ -471,7 +471,7 @@ TEST_P(SpvBinaryArithTest, EmitExpression) {
x_1 x_1
none none
)" )"
<< GetParam().ast_type << "\n {\n Binary{" << GetParam().ast_type << "\n {\n Binary[not set]{"
<< "\n " << GetParam().ast_lhs << "\n " << GetParam().ast_op << "\n " << GetParam().ast_lhs << "\n " << GetParam().ast_op
<< "\n " << GetParam().ast_rhs; << "\n " << GetParam().ast_rhs;
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(ss.str())) << assembly; EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(ss.str())) << assembly;
@ -483,16 +483,20 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpIAdd", "uint_20", "__u32", BinaryData{"uint", "uint_10", "OpIAdd", "uint_20", "__u32",
"ScalarConstructor{10}", "add", "ScalarConstructor{20}"}, "ScalarConstructor[not set]{10}", "add",
"ScalarConstructor[not set]{20}"},
// Both int // Both int
BinaryData{"int", "int_30", "OpIAdd", "int_40", "__i32", BinaryData{"int", "int_30", "OpIAdd", "int_40", "__i32",
"ScalarConstructor{30}", "add", "ScalarConstructor{40}"}, "ScalarConstructor[not set]{30}", "add",
"ScalarConstructor[not set]{40}"},
// Mixed, returning uint // Mixed, returning uint
BinaryData{"uint", "int_30", "OpIAdd", "uint_10", "__u32", BinaryData{"uint", "int_30", "OpIAdd", "uint_10", "__u32",
"ScalarConstructor{30}", "add", "ScalarConstructor{10}"}, "ScalarConstructor[not set]{30}", "add",
"ScalarConstructor[not set]{10}"},
// Mixed, returning int // Mixed, returning int
BinaryData{"int", "int_30", "OpIAdd", "uint_10", "__i32", BinaryData{"int", "int_30", "OpIAdd", "uint_10", "__i32",
"ScalarConstructor{30}", "add", "ScalarConstructor{10}"}, "ScalarConstructor[not set]{30}", "add",
"ScalarConstructor[not set]{10}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpIAdd", "v2uint_20_10", BinaryData{"v2uint", "v2uint_10_20", "OpIAdd", "v2uint_20_10",
"__vec_2__u32", AstFor("v2uint_10_20"), "add", "__vec_2__u32", AstFor("v2uint_10_20"), "add",
@ -516,8 +520,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Scalar float // Scalar float
BinaryData{"float", "float_50", "OpFAdd", "float_60", "__f32", BinaryData{"float", "float_50", "OpFAdd", "float_60", "__f32",
"ScalarConstructor{50.000000}", "add", "ScalarConstructor[not set]{50.000000}", "add",
"ScalarConstructor{60.000000}"}, "ScalarConstructor[not set]{60.000000}"},
// Vector float // Vector float
BinaryData{"v2float", "v2float_50_60", "OpFAdd", "v2float_60_50", BinaryData{"v2float", "v2float_50_60", "OpFAdd", "v2float_60_50",
"__vec_2__f32", AstFor("v2float_50_60"), "add", "__vec_2__f32", AstFor("v2float_50_60"), "add",
@ -529,20 +533,20 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpISub", "uint_20", "__u32", BinaryData{"uint", "uint_10", "OpISub", "uint_20", "__u32",
"ScalarConstructor{10}", "subtract", "ScalarConstructor[not set]{10}", "subtract",
"ScalarConstructor{20}"}, "ScalarConstructor[not set]{20}"},
// Both int // Both int
BinaryData{"int", "int_30", "OpISub", "int_40", "__i32", BinaryData{"int", "int_30", "OpISub", "int_40", "__i32",
"ScalarConstructor{30}", "subtract", "ScalarConstructor[not set]{30}", "subtract",
"ScalarConstructor{40}"}, "ScalarConstructor[not set]{40}"},
// Mixed, returning uint // Mixed, returning uint
BinaryData{"uint", "int_30", "OpISub", "uint_10", "__u32", BinaryData{"uint", "int_30", "OpISub", "uint_10", "__u32",
"ScalarConstructor{30}", "subtract", "ScalarConstructor[not set]{30}", "subtract",
"ScalarConstructor{10}"}, "ScalarConstructor[not set]{10}"},
// Mixed, returning int // Mixed, returning int
BinaryData{"int", "int_30", "OpISub", "uint_10", "__i32", BinaryData{"int", "int_30", "OpISub", "uint_10", "__i32",
"ScalarConstructor{30}", "subtract", "ScalarConstructor[not set]{30}", "subtract",
"ScalarConstructor{10}"}, "ScalarConstructor[not set]{10}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpISub", "v2uint_20_10", BinaryData{"v2uint", "v2uint_10_20", "OpISub", "v2uint_20_10",
"__vec_2__u32", AstFor("v2uint_10_20"), "subtract", "__vec_2__u32", AstFor("v2uint_10_20"), "subtract",
@ -566,8 +570,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Scalar float // Scalar float
BinaryData{"float", "float_50", "OpFSub", "float_60", "__f32", BinaryData{"float", "float_50", "OpFSub", "float_60", "__f32",
"ScalarConstructor{50.000000}", "subtract", "ScalarConstructor[not set]{50.000000}", "subtract",
"ScalarConstructor{60.000000}"}, "ScalarConstructor[not set]{60.000000}"},
// Vector float // Vector float
BinaryData{"v2float", "v2float_50_60", "OpFSub", "v2float_60_50", BinaryData{"v2float", "v2float_50_60", "OpFSub", "v2float_60_50",
"__vec_2__f32", AstFor("v2float_50_60"), "subtract", "__vec_2__f32", AstFor("v2float_50_60"), "subtract",
@ -579,20 +583,20 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpIMul", "uint_20", "__u32", BinaryData{"uint", "uint_10", "OpIMul", "uint_20", "__u32",
"ScalarConstructor{10}", "multiply", "ScalarConstructor[not set]{10}", "multiply",
"ScalarConstructor{20}"}, "ScalarConstructor[not set]{20}"},
// Both int // Both int
BinaryData{"int", "int_30", "OpIMul", "int_40", "__i32", BinaryData{"int", "int_30", "OpIMul", "int_40", "__i32",
"ScalarConstructor{30}", "multiply", "ScalarConstructor[not set]{30}", "multiply",
"ScalarConstructor{40}"}, "ScalarConstructor[not set]{40}"},
// Mixed, returning uint // Mixed, returning uint
BinaryData{"uint", "int_30", "OpIMul", "uint_10", "__u32", BinaryData{"uint", "int_30", "OpIMul", "uint_10", "__u32",
"ScalarConstructor{30}", "multiply", "ScalarConstructor[not set]{30}", "multiply",
"ScalarConstructor{10}"}, "ScalarConstructor[not set]{10}"},
// Mixed, returning int // Mixed, returning int
BinaryData{"int", "int_30", "OpIMul", "uint_10", "__i32", BinaryData{"int", "int_30", "OpIMul", "uint_10", "__i32",
"ScalarConstructor{30}", "multiply", "ScalarConstructor[not set]{30}", "multiply",
"ScalarConstructor{10}"}, "ScalarConstructor[not set]{10}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpIMul", "v2uint_20_10", BinaryData{"v2uint", "v2uint_10_20", "OpIMul", "v2uint_20_10",
"__vec_2__u32", AstFor("v2uint_10_20"), "multiply", "__vec_2__u32", AstFor("v2uint_10_20"), "multiply",
@ -616,8 +620,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Scalar float // Scalar float
BinaryData{"float", "float_50", "OpFMul", "float_60", "__f32", BinaryData{"float", "float_50", "OpFMul", "float_60", "__f32",
"ScalarConstructor{50.000000}", "multiply", "ScalarConstructor[not set]{50.000000}", "multiply",
"ScalarConstructor{60.000000}"}, "ScalarConstructor[not set]{60.000000}"},
// Vector float // Vector float
BinaryData{"v2float", "v2float_50_60", "OpFMul", "v2float_60_50", BinaryData{"v2float", "v2float_50_60", "OpFMul", "v2float_60_50",
"__vec_2__f32", AstFor("v2float_50_60"), "multiply", "__vec_2__f32", AstFor("v2float_50_60"), "multiply",
@ -629,7 +633,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpUDiv", "uint_20", "__u32", BinaryData{"uint", "uint_10", "OpUDiv", "uint_20", "__u32",
"ScalarConstructor{10}", "divide", "ScalarConstructor{20}"}, "ScalarConstructor[not set]{10}", "divide",
"ScalarConstructor[not set]{20}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpUDiv", "v2uint_20_10", BinaryData{"v2uint", "v2uint_10_20", "OpUDiv", "v2uint_20_10",
"__vec_2__u32", AstFor("v2uint_10_20"), "divide", "__vec_2__u32", AstFor("v2uint_10_20"), "divide",
@ -641,7 +646,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both int // Both int
BinaryData{"int", "int_30", "OpSDiv", "int_40", "__i32", BinaryData{"int", "int_30", "OpSDiv", "int_40", "__i32",
"ScalarConstructor{30}", "divide", "ScalarConstructor{40}"}, "ScalarConstructor[not set]{30}", "divide",
"ScalarConstructor[not set]{40}"},
// Both v2int // Both v2int
BinaryData{"v2int", "v2int_30_40", "OpSDiv", "v2int_40_30", BinaryData{"v2int", "v2int_30_40", "OpSDiv", "v2int_40_30",
"__vec_2__i32", AstFor("v2int_30_40"), "divide", "__vec_2__i32", AstFor("v2int_30_40"), "divide",
@ -653,16 +659,16 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Mixed, returning int, second arg uint // Mixed, returning int, second arg uint
BinaryData{"int", "int_30", "OpSDiv", "uint_10", "__i32", BinaryData{"int", "int_30", "OpSDiv", "uint_10", "__i32",
"ScalarConstructor{30}", "divide", "ScalarConstructor[not set]{30}", "divide",
R"(Bitcast<__i32>{ R"(Bitcast[not set]<__i32>{
ScalarConstructor{10} ScalarConstructor[not set]{10}
})"}, })"},
// Mixed, returning int, first arg uint // Mixed, returning int, first arg uint
BinaryData{"int", "uint_10", "OpSDiv", "int_30", "__i32", BinaryData{"int", "uint_10", "OpSDiv", "int_30", "__i32",
R"(Bitcast<__i32>{ R"(Bitcast[not set]<__i32>{
ScalarConstructor{10} ScalarConstructor[not set]{10}
})", })",
"divide", "ScalarConstructor{30}"}, "divide", "ScalarConstructor[not set]{30}"},
// Mixed, returning v2int, first arg v2uint // Mixed, returning v2int, first arg v2uint
BinaryData{"v2int", "v2uint_10_20", "OpSDiv", "v2int_30_40", BinaryData{"v2int", "v2uint_10_20", "OpSDiv", "v2int_30_40",
"__vec_2__i32", AstFor("cast_int_v2uint_10_20"), "divide", "__vec_2__i32", AstFor("cast_int_v2uint_10_20"), "divide",
@ -696,11 +702,11 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Scalar_UnsignedResult) {
none none
__u32 __u32
{ {
Bitcast<__u32>{ Bitcast[not set]<__u32>{
Binary{ Binary[not set]{
ScalarConstructor{30} ScalarConstructor[not set]{30}
divide divide
ScalarConstructor{40} ScalarConstructor[not set]{40}
} }
} }
} }
@ -731,18 +737,18 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Vector_UnsignedResult) {
none none
__vec_2__u32 __vec_2__u32
{ {
Bitcast<__vec_2__u32>{ Bitcast[not set]<__vec_2__u32>{
Binary{ Binary[not set]{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{30} ScalarConstructor[not set]{30}
ScalarConstructor{40} ScalarConstructor[not set]{40}
} }
divide divide
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{40} ScalarConstructor[not set]{40}
ScalarConstructor{30} ScalarConstructor[not set]{30}
} }
} }
} }
@ -757,8 +763,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Scalar float // Scalar float
BinaryData{"float", "float_50", "OpFDiv", "float_60", "__f32", BinaryData{"float", "float_50", "OpFDiv", "float_60", "__f32",
"ScalarConstructor{50.000000}", "divide", "ScalarConstructor[not set]{50.000000}", "divide",
"ScalarConstructor{60.000000}"}, "ScalarConstructor[not set]{60.000000}"},
// Vector float // Vector float
BinaryData{"v2float", "v2float_50_60", "OpFDiv", "v2float_60_50", BinaryData{"v2float", "v2float_50_60", "OpFDiv", "v2float_60_50",
"__vec_2__f32", AstFor("v2float_50_60"), "divide", "__vec_2__f32", AstFor("v2float_50_60"), "divide",
@ -770,7 +776,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpUMod", "uint_20", "__u32", BinaryData{"uint", "uint_10", "OpUMod", "uint_20", "__u32",
"ScalarConstructor{10}", "modulo", "ScalarConstructor{20}"}, "ScalarConstructor[not set]{10}", "modulo",
"ScalarConstructor[not set]{20}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpUMod", "v2uint_20_10", BinaryData{"v2uint", "v2uint_10_20", "OpUMod", "v2uint_20_10",
"__vec_2__u32", AstFor("v2uint_10_20"), "modulo", "__vec_2__u32", AstFor("v2uint_10_20"), "modulo",
@ -785,7 +792,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both int // Both int
BinaryData{"int", "int_30", "OpSMod", "int_40", "__i32", BinaryData{"int", "int_30", "OpSMod", "int_40", "__i32",
"ScalarConstructor{30}", "modulo", "ScalarConstructor{40}"}, "ScalarConstructor[not set]{30}", "modulo",
"ScalarConstructor[not set]{40}"},
// Both v2int // Both v2int
BinaryData{"v2int", "v2int_30_40", "OpSMod", "v2int_40_30", BinaryData{"v2int", "v2int_30_40", "OpSMod", "v2int_40_30",
"__vec_2__i32", AstFor("v2int_30_40"), "modulo", "__vec_2__i32", AstFor("v2int_30_40"), "modulo",
@ -797,16 +805,16 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Mixed, returning int, second arg uint // Mixed, returning int, second arg uint
BinaryData{"int", "int_30", "OpSMod", "uint_10", "__i32", BinaryData{"int", "int_30", "OpSMod", "uint_10", "__i32",
"ScalarConstructor{30}", "modulo", "ScalarConstructor[not set]{30}", "modulo",
R"(Bitcast<__i32>{ R"(Bitcast[not set]<__i32>{
ScalarConstructor{10} ScalarConstructor[not set]{10}
})"}, })"},
// Mixed, returning int, first arg uint // Mixed, returning int, first arg uint
BinaryData{"int", "uint_10", "OpSMod", "int_30", "__i32", BinaryData{"int", "uint_10", "OpSMod", "int_30", "__i32",
R"(Bitcast<__i32>{ R"(Bitcast[not set]<__i32>{
ScalarConstructor{10} ScalarConstructor[not set]{10}
})", })",
"modulo", "ScalarConstructor{30}"}, "modulo", "ScalarConstructor[not set]{30}"},
// Mixed, returning v2int, first arg v2uint // Mixed, returning v2int, first arg v2uint
BinaryData{"v2int", "v2uint_10_20", "OpSMod", "v2int_30_40", BinaryData{"v2int", "v2uint_10_20", "OpSMod", "v2int_30_40",
"__vec_2__i32", AstFor("cast_int_v2uint_10_20"), "modulo", "__vec_2__i32", AstFor("cast_int_v2uint_10_20"), "modulo",
@ -840,11 +848,11 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Scalar_UnsignedResult) {
none none
__u32 __u32
{ {
Bitcast<__u32>{ Bitcast[not set]<__u32>{
Binary{ Binary[not set]{
ScalarConstructor{30} ScalarConstructor[not set]{30}
modulo modulo
ScalarConstructor{40} ScalarConstructor[not set]{40}
} }
} }
} }
@ -875,18 +883,18 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Vector_UnsignedResult) {
none none
__vec_2__u32 __vec_2__u32
{ {
Bitcast<__vec_2__u32>{ Bitcast[not set]<__vec_2__u32>{
Binary{ Binary[not set]{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{30} ScalarConstructor[not set]{30}
ScalarConstructor{40} ScalarConstructor[not set]{40}
} }
modulo modulo
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{40} ScalarConstructor[not set]{40}
ScalarConstructor{30} ScalarConstructor[not set]{30}
} }
} }
} }
@ -901,8 +909,8 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Scalar float // Scalar float
BinaryData{"float", "float_50", "OpFMod", "float_60", "__f32", BinaryData{"float", "float_50", "OpFMod", "float_60", "__f32",
"ScalarConstructor{50.000000}", "modulo", "ScalarConstructor[not set]{50.000000}", "modulo",
"ScalarConstructor{60.000000}"}, "ScalarConstructor[not set]{60.000000}"},
// Vector float // Vector float
BinaryData{"v2float", "v2float_50_60", "OpFMod", "v2float_60_50", BinaryData{"v2float", "v2float_50_60", "OpFMod", "v2float_60_50",
"__vec_2__f32", AstFor("v2float_50_60"), "modulo", "__vec_2__f32", AstFor("v2float_50_60"), "modulo",
@ -927,10 +935,10 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesScalar) {
none none
__vec_2__f32 __vec_2__f32
{ {
Binary{ Binary[not set]{
Identifier{x_1} Identifier[not set]{x_1}
multiply multiply
Identifier{x_2} Identifier[not set]{x_2}
} }
} }
})")) })"))
@ -956,10 +964,10 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesScalar) {
none none
__mat_2_2__f32 __mat_2_2__f32
{ {
Binary{ Binary[not set]{
Identifier{x_1} Identifier[not set]{x_1}
multiply multiply
Identifier{x_2} Identifier[not set]{x_2}
} }
} }
})")) })"))
@ -985,10 +993,10 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesMatrix) {
none none
__mat_2_2__f32 __mat_2_2__f32
{ {
Binary{ Binary[not set]{
Identifier{x_1} Identifier[not set]{x_1}
multiply multiply
Identifier{x_2} Identifier[not set]{x_2}
} }
} }
})")) })"))
@ -1014,10 +1022,10 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesVector) {
none none
__mat_2_2__f32 __mat_2_2__f32
{ {
Binary{ Binary[not set]{
Identifier{x_1} Identifier[not set]{x_1}
multiply multiply
Identifier{x_2} Identifier[not set]{x_2}
} }
} }
})")) })"))
@ -1043,10 +1051,10 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesMatrix) {
none none
__mat_2_2__f32 __mat_2_2__f32
{ {
Binary{ Binary[not set]{
Identifier{x_1} Identifier[not set]{x_1}
multiply multiply
Identifier{x_2} Identifier[not set]{x_2}
} }
} }
})")) })"))
@ -1072,11 +1080,11 @@ TEST_F(SpvBinaryArithTestBasic, Dot) {
none none
__f32 __f32
{ {
Call{ Call[not set]{
Identifier{dot} Identifier[not set]{dot}
( (
Identifier{x_1} Identifier[not set]{x_1}
Identifier{x_2} Identifier[not set]{x_2}
) )
} }
} }
@ -1103,11 +1111,11 @@ TEST_F(SpvBinaryArithTestBasic, OuterProduct) {
none none
__mat_2_2__f32 __mat_2_2__f32
{ {
Call{ Call[not set]{
Identifier{outerProduct} Identifier[not set]{outerProduct}
( (
Identifier{x_1} Identifier[not set]{x_1}
Identifier{x_2} Identifier[not set]{x_2}
) )
} }
} }

View File

@ -63,54 +63,54 @@ std::string CommonTypes() {
// Returns the AST dump for a given SPIR-V assembly constant. // Returns the AST dump for a given SPIR-V assembly constant.
std::string AstFor(std::string assembly) { std::string AstFor(std::string assembly) {
if (assembly == "v2uint_10_20") { if (assembly == "v2uint_10_20") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
})"; })";
} }
if (assembly == "v2uint_20_10") { if (assembly == "v2uint_20_10") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{20} ScalarConstructor[not set]{20}
ScalarConstructor{10} ScalarConstructor[not set]{10}
})"; })";
} }
if (assembly == "v2int_30_40") { if (assembly == "v2int_30_40") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{30} ScalarConstructor[not set]{30}
ScalarConstructor{40} ScalarConstructor[not set]{40}
})"; })";
} }
if (assembly == "v2int_40_30") { if (assembly == "v2int_40_30") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{40} ScalarConstructor[not set]{40}
ScalarConstructor{30} ScalarConstructor[not set]{30}
})"; })";
} }
if (assembly == "cast_int_v2uint_10_20") { if (assembly == "cast_int_v2uint_10_20") {
return R"(Bitcast<__vec_2__i32>{ return R"(Bitcast[not set]<__vec_2__i32>{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
} }
})"; })";
} }
if (assembly == "v2float_50_60") { if (assembly == "v2float_50_60") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
})"; })";
} }
if (assembly == "v2float_60_50") { if (assembly == "v2float_60_50") {
return R"(TypeConstructor{ return R"(TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
})"; })";
} }
return "bad case"; return "bad case";
@ -160,7 +160,7 @@ TEST_P(SpvBinaryBitTest, EmitExpression) {
x_1 x_1
none none
)" )"
<< GetParam().ast_type << "\n {\n Binary{" << GetParam().ast_type << "\n {\n Binary[not set]{"
<< "\n " << GetParam().ast_lhs << "\n " << GetParam().ast_op << "\n " << GetParam().ast_lhs << "\n " << GetParam().ast_op
<< "\n " << GetParam().ast_rhs; << "\n " << GetParam().ast_rhs;
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(ss.str())) << assembly; EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(ss.str())) << assembly;
@ -172,20 +172,20 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpShiftLeftLogical", "uint_20", "__u32", BinaryData{"uint", "uint_10", "OpShiftLeftLogical", "uint_20", "__u32",
"ScalarConstructor{10}", "shift_left", "ScalarConstructor[not set]{10}", "shift_left",
"ScalarConstructor{20}"}, "ScalarConstructor[not set]{20}"},
// Both int // Both int
BinaryData{"int", "int_30", "OpShiftLeftLogical", "int_40", "__i32", BinaryData{"int", "int_30", "OpShiftLeftLogical", "int_40", "__i32",
"ScalarConstructor{30}", "shift_left", "ScalarConstructor[not set]{30}", "shift_left",
"ScalarConstructor{40}"}, "ScalarConstructor[not set]{40}"},
// Mixed, returning uint // Mixed, returning uint
BinaryData{"uint", "int_30", "OpShiftLeftLogical", "uint_10", "__u32", BinaryData{"uint", "int_30", "OpShiftLeftLogical", "uint_10", "__u32",
"ScalarConstructor{30}", "shift_left", "ScalarConstructor[not set]{30}", "shift_left",
"ScalarConstructor{10}"}, "ScalarConstructor[not set]{10}"},
// Mixed, returning int // Mixed, returning int
BinaryData{"int", "int_30", "OpShiftLeftLogical", "uint_10", "__i32", BinaryData{"int", "int_30", "OpShiftLeftLogical", "uint_10", "__i32",
"ScalarConstructor{30}", "shift_left", "ScalarConstructor[not set]{30}", "shift_left",
"ScalarConstructor{10}"}, "ScalarConstructor[not set]{10}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpShiftLeftLogical", BinaryData{"v2uint", "v2uint_10_20", "OpShiftLeftLogical",
"v2uint_20_10", "__vec_2__u32", AstFor("v2uint_10_20"), "v2uint_20_10", "__vec_2__u32", AstFor("v2uint_10_20"),
@ -209,20 +209,20 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpShiftRightLogical", "uint_20", "__u32", BinaryData{"uint", "uint_10", "OpShiftRightLogical", "uint_20", "__u32",
"ScalarConstructor{10}", "shift_right", "ScalarConstructor[not set]{10}", "shift_right",
"ScalarConstructor{20}"}, "ScalarConstructor[not set]{20}"},
// Both int // Both int
BinaryData{"int", "int_30", "OpShiftRightLogical", "int_40", "__i32", BinaryData{"int", "int_30", "OpShiftRightLogical", "int_40", "__i32",
"ScalarConstructor{30}", "shift_right", "ScalarConstructor[not set]{30}", "shift_right",
"ScalarConstructor{40}"}, "ScalarConstructor[not set]{40}"},
// Mixed, returning uint // Mixed, returning uint
BinaryData{"uint", "int_30", "OpShiftRightLogical", "uint_10", "__u32", BinaryData{"uint", "int_30", "OpShiftRightLogical", "uint_10", "__u32",
"ScalarConstructor{30}", "shift_right", "ScalarConstructor[not set]{30}", "shift_right",
"ScalarConstructor{10}"}, "ScalarConstructor[not set]{10}"},
// Mixed, returning int // Mixed, returning int
BinaryData{"int", "int_30", "OpShiftRightLogical", "uint_10", "__i32", BinaryData{"int", "int_30", "OpShiftRightLogical", "uint_10", "__i32",
"ScalarConstructor{30}", "shift_right", "ScalarConstructor[not set]{30}", "shift_right",
"ScalarConstructor{10}"}, "ScalarConstructor[not set]{10}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpShiftRightLogical", BinaryData{"v2uint", "v2uint_10_20", "OpShiftRightLogical",
"v2uint_20_10", "__vec_2__u32", AstFor("v2uint_10_20"), "v2uint_20_10", "__vec_2__u32", AstFor("v2uint_10_20"),
@ -246,20 +246,20 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpShiftRightArithmetic", "uint_20", BinaryData{"uint", "uint_10", "OpShiftRightArithmetic", "uint_20",
"__u32", "ScalarConstructor{10}", "shift_right", "__u32", "ScalarConstructor[not set]{10}", "shift_right",
"ScalarConstructor{20}"}, "ScalarConstructor[not set]{20}"},
// Both int // Both int
BinaryData{"int", "int_30", "OpShiftRightArithmetic", "int_40", "__i32", BinaryData{"int", "int_30", "OpShiftRightArithmetic", "int_40", "__i32",
"ScalarConstructor{30}", "shift_right", "ScalarConstructor[not set]{30}", "shift_right",
"ScalarConstructor{40}"}, "ScalarConstructor[not set]{40}"},
// Mixed, returning uint // Mixed, returning uint
BinaryData{"uint", "int_30", "OpShiftRightArithmetic", "uint_10", BinaryData{"uint", "int_30", "OpShiftRightArithmetic", "uint_10",
"__u32", "ScalarConstructor{30}", "shift_right", "__u32", "ScalarConstructor[not set]{30}", "shift_right",
"ScalarConstructor{10}"}, "ScalarConstructor[not set]{10}"},
// Mixed, returning int // Mixed, returning int
BinaryData{"int", "int_30", "OpShiftRightArithmetic", "uint_10", BinaryData{"int", "int_30", "OpShiftRightArithmetic", "uint_10",
"__i32", "ScalarConstructor{30}", "shift_right", "__i32", "ScalarConstructor[not set]{30}", "shift_right",
"ScalarConstructor{10}"}, "ScalarConstructor[not set]{10}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpShiftRightArithmetic", BinaryData{"v2uint", "v2uint_10_20", "OpShiftRightArithmetic",
"v2uint_20_10", "__vec_2__u32", AstFor("v2uint_10_20"), "v2uint_20_10", "__vec_2__u32", AstFor("v2uint_10_20"),
@ -283,16 +283,20 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpBitwiseAnd", "uint_20", "__u32", BinaryData{"uint", "uint_10", "OpBitwiseAnd", "uint_20", "__u32",
"ScalarConstructor{10}", "and", "ScalarConstructor{20}"}, "ScalarConstructor[not set]{10}", "and",
"ScalarConstructor[not set]{20}"},
// Both int // Both int
BinaryData{"int", "int_30", "OpBitwiseAnd", "int_40", "__i32", BinaryData{"int", "int_30", "OpBitwiseAnd", "int_40", "__i32",
"ScalarConstructor{30}", "and", "ScalarConstructor{40}"}, "ScalarConstructor[not set]{30}", "and",
"ScalarConstructor[not set]{40}"},
// Mixed, returning uint // Mixed, returning uint
BinaryData{"uint", "int_30", "OpBitwiseAnd", "uint_10", "__u32", BinaryData{"uint", "int_30", "OpBitwiseAnd", "uint_10", "__u32",
"ScalarConstructor{30}", "and", "ScalarConstructor{10}"}, "ScalarConstructor[not set]{30}", "and",
"ScalarConstructor[not set]{10}"},
// Mixed, returning int // Mixed, returning int
BinaryData{"int", "int_30", "OpBitwiseAnd", "uint_10", "__i32", BinaryData{"int", "int_30", "OpBitwiseAnd", "uint_10", "__i32",
"ScalarConstructor{30}", "and", "ScalarConstructor{10}"}, "ScalarConstructor[not set]{30}", "and",
"ScalarConstructor[not set]{10}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpBitwiseAnd", "v2uint_20_10", BinaryData{"v2uint", "v2uint_10_20", "OpBitwiseAnd", "v2uint_20_10",
"__vec_2__u32", AstFor("v2uint_10_20"), "and", "__vec_2__u32", AstFor("v2uint_10_20"), "and",
@ -316,16 +320,20 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpBitwiseOr", "uint_20", "__u32", BinaryData{"uint", "uint_10", "OpBitwiseOr", "uint_20", "__u32",
"ScalarConstructor{10}", "or", "ScalarConstructor{20}"}, "ScalarConstructor[not set]{10}", "or",
"ScalarConstructor[not set]{20}"},
// Both int // Both int
BinaryData{"int", "int_30", "OpBitwiseOr", "int_40", "__i32", BinaryData{"int", "int_30", "OpBitwiseOr", "int_40", "__i32",
"ScalarConstructor{30}", "or", "ScalarConstructor{40}"}, "ScalarConstructor[not set]{30}", "or",
"ScalarConstructor[not set]{40}"},
// Mixed, returning uint // Mixed, returning uint
BinaryData{"uint", "int_30", "OpBitwiseOr", "uint_10", "__u32", BinaryData{"uint", "int_30", "OpBitwiseOr", "uint_10", "__u32",
"ScalarConstructor{30}", "or", "ScalarConstructor{10}"}, "ScalarConstructor[not set]{30}", "or",
"ScalarConstructor[not set]{10}"},
// Mixed, returning int // Mixed, returning int
BinaryData{"int", "int_30", "OpBitwiseOr", "uint_10", "__i32", BinaryData{"int", "int_30", "OpBitwiseOr", "uint_10", "__i32",
"ScalarConstructor{30}", "or", "ScalarConstructor{10}"}, "ScalarConstructor[not set]{30}", "or",
"ScalarConstructor[not set]{10}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpBitwiseOr", "v2uint_20_10", BinaryData{"v2uint", "v2uint_10_20", "OpBitwiseOr", "v2uint_20_10",
"__vec_2__u32", AstFor("v2uint_10_20"), "or", "__vec_2__u32", AstFor("v2uint_10_20"), "or",
@ -349,16 +357,20 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values( ::testing::Values(
// Both uint // Both uint
BinaryData{"uint", "uint_10", "OpBitwiseXor", "uint_20", "__u32", BinaryData{"uint", "uint_10", "OpBitwiseXor", "uint_20", "__u32",
"ScalarConstructor{10}", "xor", "ScalarConstructor{20}"}, "ScalarConstructor[not set]{10}", "xor",
"ScalarConstructor[not set]{20}"},
// Both int // Both int
BinaryData{"int", "int_30", "OpBitwiseXor", "int_40", "__i32", BinaryData{"int", "int_30", "OpBitwiseXor", "int_40", "__i32",
"ScalarConstructor{30}", "xor", "ScalarConstructor{40}"}, "ScalarConstructor[not set]{30}", "xor",
"ScalarConstructor[not set]{40}"},
// Mixed, returning uint // Mixed, returning uint
BinaryData{"uint", "int_30", "OpBitwiseXor", "uint_10", "__u32", BinaryData{"uint", "int_30", "OpBitwiseXor", "uint_10", "__u32",
"ScalarConstructor{30}", "xor", "ScalarConstructor{10}"}, "ScalarConstructor[not set]{30}", "xor",
"ScalarConstructor[not set]{10}"},
// Mixed, returning int // Mixed, returning int
BinaryData{"int", "int_30", "OpBitwiseXor", "uint_10", "__i32", BinaryData{"int", "int_30", "OpBitwiseXor", "uint_10", "__i32",
"ScalarConstructor{30}", "xor", "ScalarConstructor{10}"}, "ScalarConstructor[not set]{30}", "xor",
"ScalarConstructor[not set]{10}"},
// Both v2uint // Both v2uint
BinaryData{"v2uint", "v2uint_10_20", "OpBitwiseXor", "v2uint_20_10", BinaryData{"v2uint", "v2uint_10_20", "OpBitwiseXor", "v2uint_20_10",
"__vec_2__u32", AstFor("v2uint_10_20"), "xor", "__vec_2__u32", AstFor("v2uint_10_20"), "xor",
@ -394,9 +406,9 @@ TEST_F(SpvUnaryBitTest, Not_Int_Int) {
none none
__i32 __i32
{ {
UnaryOp{ UnaryOp[not set]{
not not
ScalarConstructor{30} ScalarConstructor[not set]{30}
} }
} }
})")) })"))
@ -421,10 +433,10 @@ TEST_F(SpvUnaryBitTest, Not_Int_Uint) {
none none
__i32 __i32
{ {
Bitcast<__i32>{ Bitcast[not set]<__i32>{
UnaryOp{ UnaryOp[not set]{
not not
ScalarConstructor{10} ScalarConstructor[not set]{10}
} }
} }
} }
@ -450,10 +462,10 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Int) {
none none
__u32 __u32
{ {
Bitcast<__u32>{ Bitcast[not set]<__u32>{
UnaryOp{ UnaryOp[not set]{
not not
ScalarConstructor{30} ScalarConstructor[not set]{30}
} }
} }
} }
@ -479,9 +491,9 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Uint) {
none none
__u32 __u32
{ {
UnaryOp{ UnaryOp[not set]{
not not
ScalarConstructor{10} ScalarConstructor[not set]{10}
} }
} }
})")) })"))
@ -506,12 +518,12 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) {
none none
__vec_2__i32 __vec_2__i32
{ {
UnaryOp{ UnaryOp[not set]{
not not
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{30} ScalarConstructor[not set]{30}
ScalarConstructor{40} ScalarConstructor[not set]{40}
} }
} }
} }
@ -537,13 +549,13 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) {
none none
__vec_2__i32 __vec_2__i32
{ {
Bitcast<__vec_2__i32>{ Bitcast[not set]<__vec_2__i32>{
UnaryOp{ UnaryOp[not set]{
not not
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
} }
} }
} }
@ -570,13 +582,13 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) {
none none
__vec_2__u32 __vec_2__u32
{ {
Bitcast<__vec_2__u32>{ Bitcast[not set]<__vec_2__u32>{
UnaryOp{ UnaryOp[not set]{
not not
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{30} ScalarConstructor[not set]{30}
ScalarConstructor{40} ScalarConstructor[not set]{40}
} }
} }
} }
@ -602,12 +614,12 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) {
none none
__vec_2__u32 __vec_2__u32
{ {
UnaryOp{ UnaryOp[not set]{
not not
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
} }
} }
} }

View File

@ -56,8 +56,8 @@ TEST_F(SpvParserTest, EmitStatement_VoidCallNoParams) {
Function x_100 -> __void Function x_100 -> __void
() ()
{ {
Call{ Call[not set]{
Identifier{x_50} Identifier[not set]{x_50}
( (
) )
} }
@ -96,8 +96,8 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParams) {
none none
__u32 __u32
{ {
Call{ Call[not set]{
Identifier{x_50} Identifier[not set]{x_50}
( (
) )
} }
@ -113,7 +113,7 @@ Return{})"))
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Return{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Return{
{ {
ScalarConstructor{42} ScalarConstructor[not set]{42}
} }
})")) << ToString(fe.ast_body()); })")) << ToString(fe.ast_body());
} }
@ -159,8 +159,8 @@ VariableDeclStatement{
none none
__u32 __u32
{ {
Call{ Call[not set]{
Identifier{x_50} Identifier[not set]{x_50}
( (
) )
} }
@ -168,12 +168,12 @@ VariableDeclStatement{
} }
} }
Assignment{ Assignment{
Identifier{x_10} Identifier[not set]{x_10}
Identifier{x_1} Identifier[not set]{x_1}
} }
Assignment{ Assignment{
Identifier{x_10} Identifier[not set]{x_10}
Identifier{x_1} Identifier[not set]{x_1}
} }
Return{})")) Return{})"))
<< ToString(fe.ast_body()); << ToString(fe.ast_body());
@ -183,7 +183,7 @@ Return{})"))
EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_TRUE(fe.EmitBody()) << p->error();
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Return{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Return{
{ {
ScalarConstructor{42} ScalarConstructor[not set]{42}
} }
})")) << ToString(fe.ast_body()); })")) << ToString(fe.ast_body());
} }
@ -232,10 +232,10 @@ TEST_F(SpvParserTest, EmitStatement_CallWithParams) {
{ {
Return{ Return{
{ {
Binary{ Binary[not set]{
Identifier{x_51} Identifier[not set]{x_51}
add add
Identifier{x_52} Identifier[not set]{x_52}
} }
} }
} }
@ -249,11 +249,11 @@ TEST_F(SpvParserTest, EmitStatement_CallWithParams) {
none none
__u32 __u32
{ {
Call{ Call[not set]{
Identifier{x_50} Identifier[not set]{x_50}
( (
ScalarConstructor{42} ScalarConstructor[not set]{42}
ScalarConstructor{84} ScalarConstructor[not set]{84}
) )
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -92,10 +92,10 @@ TEST_F(SpvParserTest_Composite_Construct, Vector) {
none none
__vec_2__u32 __vec_2__u32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
} }
} }
} }
@ -106,10 +106,10 @@ VariableDeclStatement{
none none
__vec_2__i32 __vec_2__i32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{30} ScalarConstructor[not set]{30}
ScalarConstructor{40} ScalarConstructor[not set]{40}
} }
} }
} }
@ -120,10 +120,10 @@ VariableDeclStatement{
none none
__vec_2__f32 __vec_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
} }
} }
} }
@ -148,22 +148,22 @@ TEST_F(SpvParserTest_Composite_Construct, Matrix) {
none none
__mat_2_3__f32 __mat_2_3__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__mat_2_3__f32 __mat_2_3__f32
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{70.000000} ScalarConstructor[not set]{70.000000}
ScalarConstructor{70.000000} ScalarConstructor[not set]{70.000000}
} }
} }
} }
@ -189,13 +189,13 @@ TEST_F(SpvParserTest_Composite_Construct, Array) {
none none
__array__u32_5 __array__u32_5
{ {
TypeConstructor{ TypeConstructor[not set]{
__array__u32_5 __array__u32_5
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
ScalarConstructor{3} ScalarConstructor[not set]{3}
ScalarConstructor{4} ScalarConstructor[not set]{4}
ScalarConstructor{5} ScalarConstructor[not set]{5}
} }
} }
})")) })"))
@ -220,15 +220,15 @@ TEST_F(SpvParserTest_Composite_Construct, Struct) {
none none
__struct_S __struct_S
{ {
TypeConstructor{ TypeConstructor[not set]{
__struct_S __struct_S
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
} }
ScalarConstructor{5} ScalarConstructor[not set]{5}
ScalarConstructor{30} ScalarConstructor[not set]{30}
} }
} }
})")) })"))
@ -255,13 +255,13 @@ TEST_F(SpvParserTest_CompositeExtract, Vector) {
none none
__f32 __f32
{ {
MemberAccessor{ MemberAccessor[not set]{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
} }
Identifier{y} Identifier[not set]{y}
} }
} }
})")) })"))
@ -306,9 +306,9 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix) {
none none
__vec_2__f32 __vec_2__f32
{ {
ArrayAccessor{ ArrayAccessor[not set]{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
} }
})")) })"))
@ -357,12 +357,12 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix_Vector) {
none none
__f32 __f32
{ {
MemberAccessor{ MemberAccessor[not set]{
ArrayAccessor{ ArrayAccessor[not set]{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
Identifier{y} Identifier[not set]{y}
} }
} }
})")) })"))
@ -391,9 +391,9 @@ TEST_F(SpvParserTest_CompositeExtract, Array) {
none none
__u32 __u32
{ {
ArrayAccessor{ ArrayAccessor[not set]{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{3} ScalarConstructor[not set]{3}
} }
} }
})")) })"))
@ -442,9 +442,9 @@ TEST_F(SpvParserTest_CompositeExtract, Struct) {
none none
__i32 __i32
{ {
MemberAccessor{ MemberAccessor[not set]{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{field2} Identifier[not set]{field2}
} }
} }
})")) })"))
@ -484,9 +484,9 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_DifferOnlyInMemberName) {
none none
__u32 __u32
{ {
MemberAccessor{ MemberAccessor[not set]{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{algo} Identifier[not set]{algo}
} }
} }
})")) })"))
@ -497,9 +497,9 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_DifferOnlyInMemberName) {
none none
__u32 __u32
{ {
MemberAccessor{ MemberAccessor[not set]{
Identifier{x_3} Identifier[not set]{x_3}
Identifier{rithm} Identifier[not set]{rithm}
} }
} }
})")) })"))
@ -550,18 +550,18 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_Array_Matrix_Vector) {
none none
__f32 __f32
{ {
MemberAccessor{ MemberAccessor[not set]{
ArrayAccessor{ ArrayAccessor[not set]{
ArrayAccessor{ ArrayAccessor[not set]{
MemberAccessor{ MemberAccessor[not set]{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{field1} Identifier[not set]{field1}
} }
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
Identifier{y} Identifier[not set]{y}
} }
} }
})")) })"))
@ -589,7 +589,7 @@ TEST_F(SpvParserTest_CopyObject, Scalar) {
none none
__u32 __u32
{ {
ScalarConstructor{3} ScalarConstructor[not set]{3}
} }
} }
} }
@ -599,7 +599,7 @@ VariableDeclStatement{
none none
__u32 __u32
{ {
Identifier{x_1} Identifier[not set]{x_1}
} }
} }
})")) << ToString(fe.ast_body()); })")) << ToString(fe.ast_body());
@ -627,7 +627,7 @@ TEST_F(SpvParserTest_CopyObject, Pointer) {
none none
__ptr_function__u32 __ptr_function__u32
{ {
Identifier{x_10} Identifier[not set]{x_10}
} }
} }
} }
@ -637,7 +637,7 @@ VariableDeclStatement{
none none
__ptr_function__u32 __ptr_function__u32
{ {
Identifier{x_1} Identifier[not set]{x_1}
} }
} }
})")) << ToString(fe.ast_body()); })")) << ToString(fe.ast_body());
@ -666,23 +666,23 @@ TEST_F(SpvParserTest_VectorShuffle, FunctionScopeOperands_UseBoth) {
none none
__vec_4__u32 __vec_4__u32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_4__u32 __vec_4__u32
MemberAccessor{ MemberAccessor[not set]{
Identifier{x_2} Identifier[not set]{x_2}
Identifier{y} Identifier[not set]{y}
} }
MemberAccessor{ MemberAccessor[not set]{
Identifier{x_2} Identifier[not set]{x_2}
Identifier{x} Identifier[not set]{x}
} }
MemberAccessor{ MemberAccessor[not set]{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{y} Identifier[not set]{y}
} }
MemberAccessor{ MemberAccessor[not set]{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{x} Identifier[not set]{x}
} }
} }
} }
@ -708,39 +708,39 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_UseBoth) {
none none
__vec_4__u32 __vec_4__u32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_4__u32 __vec_4__u32
MemberAccessor{ MemberAccessor[not set]{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{4} ScalarConstructor[not set]{4}
ScalarConstructor{3} ScalarConstructor[not set]{3}
} }
Identifier{y} Identifier[not set]{y}
} }
MemberAccessor{ MemberAccessor[not set]{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{4} ScalarConstructor[not set]{4}
ScalarConstructor{3} ScalarConstructor[not set]{3}
} }
Identifier{x} Identifier[not set]{x}
} }
MemberAccessor{ MemberAccessor[not set]{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{3} ScalarConstructor[not set]{3}
ScalarConstructor{4} ScalarConstructor[not set]{4}
} }
Identifier{y} Identifier[not set]{y}
} }
MemberAccessor{ MemberAccessor[not set]{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{3} ScalarConstructor[not set]{3}
ScalarConstructor{4} ScalarConstructor[not set]{4}
} }
Identifier{x} Identifier[not set]{x}
} }
} }
} }
@ -767,12 +767,12 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_AllOnesMapToNull) {
none none
__vec_2__u32 __vec_2__u32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{0} ScalarConstructor[not set]{0}
MemberAccessor{ MemberAccessor[not set]{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{y} Identifier[not set]{y}
} }
} }
} }

View File

@ -88,8 +88,8 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Scalar) {
none none
__u32 __u32
{ {
Bitcast<__u32>{ Bitcast[not set]<__u32>{
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
} }
} }
})")) })"))
@ -114,11 +114,11 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Vector) {
none none
__vec_2__f32 __vec_2__f32
{ {
Bitcast<__vec_2__f32>{ Bitcast[not set]<__vec_2__f32>{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{10} ScalarConstructor[not set]{10}
ScalarConstructor{20} ScalarConstructor[not set]{20}
} }
} }
} }
@ -243,9 +243,9 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromSigned) {
none none
__f32 __f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__f32 __f32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
})")) })"))
@ -270,10 +270,10 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromUnsigned) {
none none
__f32 __f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__f32 __f32
Bitcast<__i32>{ Bitcast[not set]<__i32>{
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
} }
@ -299,9 +299,9 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromSigned) {
none none
__vec_2__f32 __vec_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
})")) })"))
@ -326,10 +326,10 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromUnsigned) {
none none
__vec_2__f32 __vec_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
Bitcast<__vec_2__i32>{ Bitcast[not set]<__vec_2__i32>{
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
} }
@ -388,10 +388,10 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromSigned) {
none none
__f32 __f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__f32 __f32
Bitcast<__u32>{ Bitcast[not set]<__u32>{
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
} }
@ -417,9 +417,9 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromUnsigned) {
none none
__f32 __f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__f32 __f32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
})")) })"))
@ -444,10 +444,10 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromSigned) {
none none
__vec_2__f32 __vec_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
Bitcast<__vec_2__u32>{ Bitcast[not set]<__vec_2__u32>{
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
} }
@ -473,9 +473,9 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromUnsigned) {
none none
__vec_2__f32 __vec_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
})")) })"))
@ -534,9 +534,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToSigned) {
none none
__i32 __i32
{ {
TypeConstructor{ TypeConstructor[not set]{
__i32 __i32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
})")) })"))
@ -561,10 +561,10 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToUnsigned) {
none none
__u32 __u32
{ {
Bitcast<__u32>{ Bitcast[not set]<__u32>{
TypeConstructor{ TypeConstructor[not set]{
__i32 __i32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
} }
@ -590,9 +590,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToSigned) {
none none
__vec_2__i32 __vec_2__i32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
})")) })"))
@ -617,10 +617,10 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToUnsigned) {
none none
__vec_2__u32 __vec_2__u32
{ {
Bitcast<__vec_2__u32>{ Bitcast[not set]<__vec_2__u32>{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
} }
@ -680,10 +680,10 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToSigned) {
none none
__i32 __i32
{ {
Bitcast<__i32>{ Bitcast[not set]<__i32>{
TypeConstructor{ TypeConstructor[not set]{
__u32 __u32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
} }
@ -709,9 +709,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToUnsigned) {
none none
__u32 __u32
{ {
TypeConstructor{ TypeConstructor[not set]{
__u32 __u32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
})")) })"))
@ -736,10 +736,10 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToSigned) {
none none
__vec_2__i32 __vec_2__i32
{ {
Bitcast<__vec_2__i32>{ Bitcast[not set]<__vec_2__i32>{
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
} }
@ -765,9 +765,9 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToUnsigned) {
none none
__vec_2__u32 __vec_2__u32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
Identifier{x_30} Identifier[not set]{x_30}
} }
} }
})")) })"))

View File

@ -106,10 +106,11 @@ TEST_P(SpvParserTest_GlslStd450_Float_Floating, Scalar) {
none none
__f32 __f32
{ {
Call{ Call[not set]{
Identifier{)" + GetParam().wgsl_func + R"(} Identifier[not set]{)" + GetParam().wgsl_func +
R"(}
( (
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
) )
} }
} }
@ -136,13 +137,14 @@ TEST_P(SpvParserTest_GlslStd450_Float_Floating, Vector) {
none none
__f32 __f32
{ {
Call{ Call[not set]{
Identifier{)" + GetParam().wgsl_func + R"(} Identifier[not set]{)" + GetParam().wgsl_func +
R"(}
( (
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
} }
) )
} }
@ -170,11 +172,12 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Scalar) {
none none
__f32 __f32
{ {
Call{ Call[not set]{
Identifier{)" + GetParam().wgsl_func + R"(} Identifier[not set]{)" + GetParam().wgsl_func +
R"(}
( (
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
) )
} }
} }
@ -201,18 +204,19 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Vector) {
none none
__f32 __f32
{ {
Call{ Call[not set]{
Identifier{)" + GetParam().wgsl_func + R"(} Identifier[not set]{)" + GetParam().wgsl_func +
R"(}
( (
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
} }
) )
} }
@ -240,10 +244,11 @@ TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Scalar) {
none none
__f32 __f32
{ {
Call{ Call[not set]{
Identifier{)" + GetParam().wgsl_func + R"(} Identifier[not set]{)" + GetParam().wgsl_func +
R"(}
( (
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
) )
} }
} }
@ -270,13 +275,14 @@ TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Vector) {
none none
__vec_2__f32 __vec_2__f32
{ {
Call{ Call[not set]{
Identifier{)" + GetParam().wgsl_func + R"(} Identifier[not set]{)" + GetParam().wgsl_func +
R"(}
( (
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
} }
) )
} }
@ -304,11 +310,12 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Scalar) {
none none
__f32 __f32
{ {
Call{ Call[not set]{
Identifier{)" + GetParam().wgsl_func + R"(} Identifier[not set]{)" + GetParam().wgsl_func +
R"(}
( (
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
) )
} }
} }
@ -335,18 +342,19 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Vector) {
none none
__vec_2__f32 __vec_2__f32
{ {
Call{ Call[not set]{
Identifier{)" + GetParam().wgsl_func + R"(} Identifier[not set]{)" + GetParam().wgsl_func +
R"(}
( (
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
} }
) )
} }
@ -374,12 +382,13 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Scalar) {
none none
__f32 __f32
{ {
Call{ Call[not set]{
Identifier{)" + GetParam().wgsl_func + R"(} Identifier[not set]{)" + GetParam().wgsl_func +
R"(}
( (
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
ScalarConstructor{70.000000} ScalarConstructor[not set]{70.000000}
) )
} }
} }
@ -407,23 +416,24 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Vector) {
none none
__vec_2__f32 __vec_2__f32
{ {
Call{ Call[not set]{
Identifier{)" + GetParam().wgsl_func + R"(} Identifier[not set]{)" + GetParam().wgsl_func +
R"(}
( (
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{60.000000} ScalarConstructor[not set]{60.000000}
ScalarConstructor{50.000000} ScalarConstructor[not set]{50.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{70.000000} ScalarConstructor[not set]{70.000000}
ScalarConstructor{70.000000} ScalarConstructor[not set]{70.000000}
} }
) )
} }

File diff suppressed because it is too large Load Diff

View File

@ -51,16 +51,16 @@ TEST_F(SpvParserTest, EmitStatement_StoreBoolConst) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_TRUE(fe.EmitBody()) << p->error();
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{true} ScalarConstructor[not set]{true}
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{false} ScalarConstructor[not set]{false}
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{false} ScalarConstructor[not set]{false}
})")); })"));
} }
@ -83,12 +83,12 @@ TEST_F(SpvParserTest, EmitStatement_StoreUintConst) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{42} ScalarConstructor[not set]{42}
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{0} ScalarConstructor[not set]{0}
})")); })"));
} }
@ -111,12 +111,12 @@ TEST_F(SpvParserTest, EmitStatement_StoreIntConst) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{42} ScalarConstructor[not set]{42}
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{0} ScalarConstructor[not set]{0}
})")); })"));
} }
@ -139,12 +139,12 @@ TEST_F(SpvParserTest, EmitStatement_StoreFloatConst) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
})")); })"));
} }
@ -173,7 +173,7 @@ TEST_F(SpvParserTest, EmitStatement_LoadBool) {
none none
__bool __bool
{ {
Identifier{x_1} Identifier[not set]{x_1}
} }
})")); })"));
} }
@ -202,7 +202,7 @@ TEST_F(SpvParserTest, EmitStatement_LoadScalar) {
none none
__u32 __u32
{ {
Identifier{x_1} Identifier[not set]{x_1}
} }
} }
} }
@ -212,7 +212,7 @@ VariableDeclStatement{
none none
__u32 __u32
{ {
Identifier{x_1} Identifier[not set]{x_1}
} }
} }
})")); })"));
@ -243,17 +243,17 @@ TEST_F(SpvParserTest, EmitStatement_UseLoadedScalarTwice) {
none none
__u32 __u32
{ {
Identifier{x_1} Identifier[not set]{x_1}
} }
} }
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{x_2} Identifier[not set]{x_2}
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{x_2} Identifier[not set]{x_2}
} }
)")); )"));
} }
@ -275,8 +275,8 @@ TEST_F(SpvParserTest, EmitStatement_StoreToModuleScopeVar) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{42} ScalarConstructor[not set]{42}
})")); })"));
} }
@ -342,11 +342,11 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorSwizzle) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
MemberAccessor{ MemberAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
Identifier{z} Identifier[not set]{z}
} }
ScalarConstructor{42} ScalarConstructor[not set]{42}
})")) << ToString(fe.ast_body()); })")) << ToString(fe.ast_body());
} }
@ -405,11 +405,11 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorNonConstIndex) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
ArrayAccessor{ ArrayAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
Identifier{x_11} Identifier[not set]{x_11}
} }
ScalarConstructor{42} ScalarConstructor[not set]{42}
})")); })"));
} }
@ -442,16 +442,16 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Matrix) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
ArrayAccessor{ ArrayAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_4__f32 __vec_4__f32
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
} }
})")); })"));
} }
@ -485,16 +485,16 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Array) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
ArrayAccessor{ ArrayAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_4__f32 __vec_4__f32
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
} }
})")); })"));
} }
@ -527,11 +527,11 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Struct) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
MemberAccessor{ MemberAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
Identifier{age} Identifier[not set]{age}
} }
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
})")); })"));
} }
@ -575,18 +575,18 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Struct_DifferOnlyMemberName) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
MemberAccessor{ MemberAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
Identifier{age} Identifier[not set]{age}
} }
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
} }
Assignment{ Assignment{
MemberAccessor{ MemberAccessor[not set]{
Identifier{myvar2} Identifier[not set]{myvar2}
Identifier{ancientness} Identifier[not set]{ancientness}
} }
ScalarConstructor{420.000000} ScalarConstructor[not set]{420.000000}
})")) << ToString(fe.ast_body()); })")) << ToString(fe.ast_body());
} }
@ -685,14 +685,14 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Struct_RuntimeArray) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
ArrayAccessor{ ArrayAccessor[not set]{
MemberAccessor{ MemberAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
Identifier{age} Identifier[not set]{age}
} }
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
})")); })"));
} }
@ -725,14 +725,14 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Compound_Matrix_Vector) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()); EXPECT_TRUE(fe.EmitBody());
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
MemberAccessor{ MemberAccessor[not set]{
ArrayAccessor{ ArrayAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
Identifier{w} Identifier[not set]{w}
} }
ScalarConstructor{42.000000} ScalarConstructor[not set]{42.000000}
})")); })"));
} }
@ -833,21 +833,21 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughAccessChain_NonCascaded) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_TRUE(fe.EmitBody()) << p->error();
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
MemberAccessor{ MemberAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
Identifier{field0} Identifier[not set]{field0}
} }
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
Assignment{ Assignment{
ArrayAccessor{ ArrayAccessor[not set]{
MemberAccessor{ MemberAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
Identifier{field1} Identifier[not set]{field1}
} }
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
ScalarConstructor{0} ScalarConstructor[not set]{0}
})")) << ToString(fe.ast_body()) })")) << ToString(fe.ast_body())
<< p->error(); << p->error();
} }
@ -872,14 +872,14 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughAccessChain_Cascaded) {
FunctionEmitter fe(p, *spirv_function(100)); FunctionEmitter fe(p, *spirv_function(100));
EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_TRUE(fe.EmitBody()) << p->error();
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
ArrayAccessor{ ArrayAccessor[not set]{
MemberAccessor{ MemberAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
Identifier{field1} Identifier[not set]{field1}
} }
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
ScalarConstructor{0} ScalarConstructor[not set]{0}
})")) << ToString(fe.ast_body()) })")) << ToString(fe.ast_body())
<< p->error(); << p->error();
} }
@ -910,19 +910,19 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithoutHoisting) {
none none
__ptr_storage_buffer__u32 __ptr_storage_buffer__u32
{ {
ArrayAccessor{ ArrayAccessor[not set]{
MemberAccessor{ MemberAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
Identifier{field1} Identifier[not set]{field1}
} }
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
} }
Assignment{ Assignment{
Identifier{x_2} Identifier[not set]{x_2}
ScalarConstructor{0} ScalarConstructor[not set]{0}
})")) << ToString(fe.ast_body()) })")) << ToString(fe.ast_body())
<< p->error(); << p->error();
} }
@ -968,17 +968,17 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithHoisting) {
} }
If{ If{
( (
ScalarConstructor{true} ScalarConstructor[not set]{true}
) )
{ {
Assignment{ Assignment{
Identifier{x_2} Identifier[not set]{x_2}
ArrayAccessor{ ArrayAccessor[not set]{
MemberAccessor{ MemberAccessor[not set]{
Identifier{myvar} Identifier[not set]{myvar}
Identifier{field1} Identifier[not set]{field1}
} }
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
@ -989,8 +989,8 @@ Else{
} }
} }
Assignment{ Assignment{
Identifier{x_2} Identifier[not set]{x_2}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
Return{} Return{}
)")) << ToString(fe.ast_body()) )")) << ToString(fe.ast_body())

View File

@ -73,7 +73,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Scalar) {
none none
__bool __bool
{ {
ScalarConstructor{false} ScalarConstructor[not set]{false}
} }
} }
} }
@ -83,7 +83,7 @@ VariableDeclStatement{
none none
__u32 __u32
{ {
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -93,7 +93,7 @@ VariableDeclStatement{
none none
__i32 __i32
{ {
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -103,7 +103,7 @@ VariableDeclStatement{
none none
__f32 __f32
{ {
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
} }
})")) << ToString(fe.ast_body()); })")) << ToString(fe.ast_body());
@ -133,10 +133,10 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Vector) {
none none
__vec_2__u32 __vec_2__u32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -147,10 +147,10 @@ VariableDeclStatement{
none none
__vec_2__i32 __vec_2__i32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -161,10 +161,10 @@ VariableDeclStatement{
none none
__vec_2__f32 __vec_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
} }
} }
@ -193,17 +193,17 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Matrix) {
none none
__mat_2_2__f32 __mat_2_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__mat_2_2__f32 __mat_2_2__f32
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
} }
} }
@ -234,10 +234,10 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) {
none none
__array__u32_2 __array__u32_2
{ {
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -266,12 +266,12 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) {
none none
__struct_S __struct_S
{ {
TypeConstructor{ TypeConstructor[not set]{
__struct_S __struct_S
ScalarConstructor{false} ScalarConstructor[not set]{false}
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
} }
} }

View File

@ -214,7 +214,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ScalarInitializers) {
function function
__bool __bool
{ {
ScalarConstructor{true} ScalarConstructor[not set]{true}
} }
} }
} }
@ -224,7 +224,7 @@ VariableDeclStatement{
function function
__bool __bool
{ {
ScalarConstructor{false} ScalarConstructor[not set]{false}
} }
} }
} }
@ -234,7 +234,7 @@ VariableDeclStatement{
function function
__i32 __i32
{ {
ScalarConstructor{-1} ScalarConstructor[not set]{-1}
} }
} }
} }
@ -244,7 +244,7 @@ VariableDeclStatement{
function function
__u32 __u32
{ {
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
@ -254,7 +254,7 @@ VariableDeclStatement{
function function
__f32 __f32
{ {
ScalarConstructor{1.500000} ScalarConstructor[not set]{1.500000}
} }
} }
} }
@ -287,7 +287,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ScalarNullInitializers) {
function function
__bool __bool
{ {
ScalarConstructor{false} ScalarConstructor[not set]{false}
} }
} }
} }
@ -297,7 +297,7 @@ VariableDeclStatement{
function function
__i32 __i32
{ {
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -307,7 +307,7 @@ VariableDeclStatement{
function function
__u32 __u32
{ {
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -317,7 +317,7 @@ VariableDeclStatement{
function function
__f32 __f32
{ {
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
} }
} }
@ -346,10 +346,10 @@ TEST_F(SpvParserTest, EmitFunctionVariables_VectorInitializer) {
function function
__vec_2__f32 __vec_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{1.500000} ScalarConstructor[not set]{1.500000}
ScalarConstructor{2.000000} ScalarConstructor[not set]{2.000000}
} }
} }
} }
@ -384,22 +384,22 @@ TEST_F(SpvParserTest, EmitFunctionVariables_MatrixInitializer) {
function function
__mat_2_3__f32 __mat_2_3__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__mat_2_3__f32 __mat_2_3__f32
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{1.500000} ScalarConstructor[not set]{1.500000}
ScalarConstructor{2.000000} ScalarConstructor[not set]{2.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{2.000000} ScalarConstructor[not set]{2.000000}
ScalarConstructor{3.000000} ScalarConstructor[not set]{3.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{3.000000} ScalarConstructor[not set]{3.000000}
ScalarConstructor{4.000000} ScalarConstructor[not set]{4.000000}
} }
} }
} }
@ -430,10 +430,10 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer) {
function function
__array__u32_2 __array__u32_2
{ {
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{1} ScalarConstructor[not set]{1}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
} }
} }
@ -464,10 +464,10 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_AliasType) {
function function
__alias_Arr__array__u32_2_stride_16 __alias_Arr__array__u32_2_stride_16
{ {
TypeConstructor{ TypeConstructor[not set]{
__alias_Arr__array__u32_2_stride_16 __alias_Arr__array__u32_2_stride_16
ScalarConstructor{1} ScalarConstructor[not set]{1}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
} }
} }
@ -497,10 +497,10 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Null) {
function function
__array__u32_2 __array__u32_2
{ {
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -531,10 +531,10 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_AliasType_Null) {
function function
__alias_Arr__array__u32_2_stride_16 __alias_Arr__array__u32_2_stride_16
{ {
TypeConstructor{ TypeConstructor[not set]{
__alias_Arr__array__u32_2_stride_16 __alias_Arr__array__u32_2_stride_16
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -565,14 +565,14 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) {
function function
__struct_S __struct_S
{ {
TypeConstructor{ TypeConstructor[not set]{
__struct_S __struct_S
ScalarConstructor{1} ScalarConstructor[not set]{1}
ScalarConstructor{1.500000} ScalarConstructor[not set]{1.500000}
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{1} ScalarConstructor[not set]{1}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
} }
} }
@ -604,14 +604,14 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer_Null) {
function function
__struct_S __struct_S
{ {
TypeConstructor{ TypeConstructor[not set]{
__struct_S __struct_S
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -650,15 +650,15 @@ TEST_F(SpvParserTest,
} }
} }
Assignment{ Assignment{
Identifier{x_25} Identifier[not set]{x_25}
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
Assignment{ Assignment{
Identifier{x_25} Identifier[not set]{x_25}
Binary{ Binary[not set]{
ScalarConstructor{1} ScalarConstructor[not set]{1}
add add
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
Return{} Return{}
@ -700,25 +700,25 @@ VariableDeclStatement{
none none
__u32 __u32
{ {
Binary{ Binary[not set]{
ScalarConstructor{1} ScalarConstructor[not set]{1}
add add
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
} }
Assignment{ Assignment{
Identifier{x_25} Identifier[not set]{x_25}
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
Assignment{ Assignment{
Identifier{x_25} Identifier[not set]{x_25}
Identifier{x_2} Identifier[not set]{x_2}
} }
Assignment{ Assignment{
Identifier{x_25} Identifier[not set]{x_25}
Identifier{x_2} Identifier[not set]{x_2}
} }
Return{} Return{}
)")) << ToString(fe.ast_body()); )")) << ToString(fe.ast_body());
@ -770,29 +770,29 @@ VariableDeclStatement{
none none
__u32 __u32
{ {
Binary{ Binary[not set]{
ScalarConstructor{1} ScalarConstructor[not set]{1}
add add
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
} }
Assignment{ Assignment{
Identifier{x_25} Identifier[not set]{x_25}
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
Loop{ Loop{
continuing { continuing {
Assignment{ Assignment{
Identifier{x_25} Identifier[not set]{x_25}
Identifier{x_2} Identifier[not set]{x_2}
} }
} }
} }
Assignment{ Assignment{
Identifier{x_25} Identifier[not set]{x_25}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
Return{} Return{}
)")) << ToString(fe.ast_body()); )")) << ToString(fe.ast_body());
@ -855,8 +855,8 @@ TEST_F(
EXPECT_TRUE(fe.EmitBody()) << p->error(); EXPECT_TRUE(fe.EmitBody()) << p->error();
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{ EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
Loop{ Loop{
VariableDeclStatement{ VariableDeclStatement{
@ -867,32 +867,32 @@ Loop{
} }
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
If{ If{
( (
ScalarConstructor{false} ScalarConstructor[not set]{false}
) )
{ {
Break{} Break{}
} }
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{3} ScalarConstructor[not set]{3}
} }
If{ If{
( (
ScalarConstructor{true} ScalarConstructor[not set]{true}
) )
{ {
Assignment{ Assignment{
Identifier{x_2} Identifier[not set]{x_2}
Binary{ Binary[not set]{
ScalarConstructor{1} ScalarConstructor[not set]{1}
add add
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
@ -903,17 +903,17 @@ Loop{
} }
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{x_2} Identifier[not set]{x_2}
} }
continuing { continuing {
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{4} ScalarConstructor[not set]{4}
} }
If{ If{
( (
ScalarConstructor{false} ScalarConstructor[not set]{false}
) )
{ {
Break{} Break{}
@ -922,8 +922,8 @@ Loop{
} }
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
ScalarConstructor{5} ScalarConstructor[not set]{5}
} }
Return{} Return{}
)")) << ToString(fe.ast_body()); )")) << ToString(fe.ast_body());
@ -976,13 +976,13 @@ TEST_F(
none none
__u32 __u32
{ {
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
If{ If{
( (
ScalarConstructor{true} ScalarConstructor[not set]{true}
) )
{ {
} }
@ -993,13 +993,13 @@ VariableDeclStatement{
none none
__u32 __u32
{ {
Identifier{x_1} Identifier[not set]{x_1}
} }
} }
} }
Assignment{ Assignment{
Identifier{x_200} Identifier[not set]{x_200}
Identifier{x_3} Identifier[not set]{x_3}
} }
Return{} Return{}
)")) << ToString(fe.ast_body()); )")) << ToString(fe.ast_body());
@ -1055,7 +1055,7 @@ TEST_F(SpvParserTest,
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{
( (
ScalarConstructor{true} ScalarConstructor[not set]{true}
) )
{ {
VariableDeclStatement{ VariableDeclStatement{
@ -1064,13 +1064,13 @@ TEST_F(SpvParserTest,
none none
__u32 __u32
{ {
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
If{ If{
( (
ScalarConstructor{true} ScalarConstructor[not set]{true}
) )
{ {
} }
@ -1081,13 +1081,13 @@ TEST_F(SpvParserTest,
none none
__u32 __u32
{ {
Identifier{x_1} Identifier[not set]{x_1}
} }
} }
} }
Assignment{ Assignment{
Identifier{x_200} Identifier[not set]{x_200}
Identifier{x_3} Identifier[not set]{x_3}
} }
} }
} }
@ -1140,7 +1140,7 @@ TEST_F(
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{ EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{
( (
ScalarConstructor{true} ScalarConstructor[not set]{true}
) )
{ {
VariableDeclStatement{ VariableDeclStatement{
@ -1149,12 +1149,12 @@ TEST_F(
none none
__u32 __u32
{ {
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
Switch{ Switch{
ScalarConstructor{1} ScalarConstructor[not set]{1}
{ {
Case 0{ Case 0{
} }
@ -1168,13 +1168,13 @@ TEST_F(
none none
__u32 __u32
{ {
Identifier{x_1} Identifier[not set]{x_1}
} }
} }
} }
Assignment{ Assignment{
Identifier{x_200} Identifier[not set]{x_200}
Identifier{x_3} Identifier[not set]{x_3}
} }
} }
} }
@ -1225,7 +1225,7 @@ TEST_F(SpvParserTest,
none none
__u32 __u32
{ {
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
@ -1235,13 +1235,13 @@ VariableDeclStatement{
none none
__u32 __u32
{ {
Identifier{x_1} Identifier[not set]{x_1}
} }
} }
} }
If{ If{
( (
ScalarConstructor{true} ScalarConstructor[not set]{true}
) )
{ {
} }
@ -1312,7 +1312,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) {
none none
__bool __bool
{ {
Identifier{x_7} Identifier[not set]{x_7}
} }
} }
} }
@ -1322,21 +1322,21 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) {
none none
__bool __bool
{ {
Identifier{x_8} Identifier[not set]{x_8}
} }
} }
} }
Assignment{ Assignment{
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
Assignment{ Assignment{
Identifier{x_3_phi} Identifier[not set]{x_3_phi}
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
If{ If{
( (
Identifier{x_101} Identifier[not set]{x_101}
) )
{ {
Break{} Break{}
@ -1349,7 +1349,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) {
none none
__u32 __u32
{ {
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
} }
} }
} }
@ -1359,25 +1359,25 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) {
none none
__u32 __u32
{ {
Identifier{x_3_phi} Identifier[not set]{x_3_phi}
} }
} }
} }
Assignment{ Assignment{
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
Binary{ Binary[not set]{
Identifier{x_2} Identifier[not set]{x_2}
add add
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
Assignment{ Assignment{
Identifier{x_3_phi} Identifier[not set]{x_3_phi}
Identifier{x_3} Identifier[not set]{x_3}
} }
If{ If{
( (
Identifier{x_102} Identifier[not set]{x_102}
) )
{ {
Break{} Break{}
@ -1454,7 +1454,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) {
none none
__bool __bool
{ {
Identifier{x_7} Identifier[not set]{x_7}
} }
} }
} }
@ -1464,21 +1464,21 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) {
none none
__bool __bool
{ {
Identifier{x_8} Identifier[not set]{x_8}
} }
} }
} }
Assignment{ Assignment{
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
Assignment{ Assignment{
Identifier{x_3_phi} Identifier[not set]{x_3_phi}
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
If{ If{
( (
Identifier{x_101} Identifier[not set]{x_101}
) )
{ {
Break{} Break{}
@ -1498,7 +1498,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) {
none none
__u32 __u32
{ {
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
} }
} }
} }
@ -1508,13 +1508,13 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) {
none none
__u32 __u32
{ {
Identifier{x_3_phi} Identifier[not set]{x_3_phi}
} }
} }
} }
If{ If{
( (
Identifier{x_102} Identifier[not set]{x_102}
) )
{ {
Break{} Break{}
@ -1522,20 +1522,20 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) {
} }
continuing { continuing {
Assignment{ Assignment{
Identifier{x_4} Identifier[not set]{x_4}
Binary{ Binary[not set]{
Identifier{x_2} Identifier[not set]{x_2}
add add
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
Assignment{ Assignment{
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
Identifier{x_4} Identifier[not set]{x_4}
} }
Assignment{ Assignment{
Identifier{x_3_phi} Identifier[not set]{x_3_phi}
Identifier{x_3} Identifier[not set]{x_3}
} }
} }
} }
@ -1595,7 +1595,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_ValueFromLoopBodyAndContinuing) {
none none
__bool __bool
{ {
Identifier{x_17} Identifier[not set]{x_17}
} }
} }
} }
@ -1615,12 +1615,12 @@ Loop{
} }
} }
Assignment{ Assignment{
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
Assignment{ Assignment{
Identifier{x_5_phi} Identifier[not set]{x_5_phi}
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
Loop{ Loop{
VariableDeclStatement{ VariableDeclStatement{
@ -1636,7 +1636,7 @@ Loop{
none none
__u32 __u32
{ {
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
} }
} }
} }
@ -1646,7 +1646,7 @@ Loop{
none none
__u32 __u32
{ {
Identifier{x_5_phi} Identifier[not set]{x_5_phi}
} }
} }
} }
@ -1656,10 +1656,10 @@ Loop{
none none
__u32 __u32
{ {
Binary{ Binary[not set]{
Identifier{x_2} Identifier[not set]{x_2}
add add
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
@ -1670,17 +1670,17 @@ Loop{
none none
__u32 __u32
{ {
Binary{ Binary[not set]{
Identifier{x_4} Identifier[not set]{x_4}
add add
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
} }
If{ If{
( (
Identifier{x_101} Identifier[not set]{x_101}
) )
{ {
Break{} Break{}
@ -1688,20 +1688,20 @@ Loop{
} }
continuing { continuing {
Assignment{ Assignment{
Identifier{x_7} Identifier[not set]{x_7}
Binary{ Binary[not set]{
Identifier{x_4} Identifier[not set]{x_4}
add add
Identifier{x_6} Identifier[not set]{x_6}
} }
} }
Assignment{ Assignment{
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
Identifier{x_4} Identifier[not set]{x_4}
} }
Assignment{ Assignment{
Identifier{x_5_phi} Identifier[not set]{x_5_phi}
Identifier{x_7} Identifier[not set]{x_7}
} }
} }
} }
@ -1763,7 +1763,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_FromElseAndThen) {
none none
__bool __bool
{ {
Identifier{x_7} Identifier[not set]{x_7}
} }
} }
} }
@ -1773,14 +1773,14 @@ VariableDeclStatement{
none none
__bool __bool
{ {
Identifier{x_8} Identifier[not set]{x_8}
} }
} }
} }
Loop{ Loop{
If{ If{
( (
Identifier{x_101} Identifier[not set]{x_101}
) )
{ {
Break{} Break{}
@ -1795,12 +1795,12 @@ Loop{
} }
If{ If{
( (
Identifier{x_102} Identifier[not set]{x_102}
) )
{ {
Assignment{ Assignment{
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
Continue{} Continue{}
} }
@ -1808,8 +1808,8 @@ Loop{
Else{ Else{
{ {
Assignment{ Assignment{
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
@ -1820,13 +1820,13 @@ Loop{
none none
__u32 __u32
{ {
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
} }
} }
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{x_2} Identifier[not set]{x_2}
} }
} }
} }
@ -1883,7 +1883,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_FromHeaderAndThen) {
none none
__bool __bool
{ {
Identifier{x_7} Identifier[not set]{x_7}
} }
} }
} }
@ -1893,14 +1893,14 @@ VariableDeclStatement{
none none
__bool __bool
{ {
Identifier{x_8} Identifier[not set]{x_8}
} }
} }
} }
Loop{ Loop{
If{ If{
( (
Identifier{x_101} Identifier[not set]{x_101}
) )
{ {
Break{} Break{}
@ -1914,17 +1914,17 @@ Loop{
} }
} }
Assignment{ Assignment{
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
If{ If{
( (
Identifier{x_102} Identifier[not set]{x_102}
) )
{ {
Assignment{ Assignment{
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
} }
@ -1935,13 +1935,13 @@ Loop{
none none
__u32 __u32
{ {
Identifier{x_2_phi} Identifier[not set]{x_2_phi}
} }
} }
} }
Assignment{ Assignment{
Identifier{x_1} Identifier[not set]{x_1}
Identifier{x_2} Identifier[not set]{x_2}
} }
} }
} }
@ -1996,10 +1996,10 @@ VariableDeclStatement{
none none
__bool __bool
{ {
Binary{ Binary[not set]{
ScalarConstructor{true} ScalarConstructor[not set]{true}
logical_and logical_and
ScalarConstructor{true} ScalarConstructor[not set]{true}
} }
} }
} }
@ -2010,25 +2010,25 @@ VariableDeclStatement{
none none
__bool __bool
{ {
UnaryOp{ UnaryOp[not set]{
not not
Identifier{x_11} Identifier[not set]{x_11}
} }
} }
} }
} }
Assignment{ Assignment{
Identifier{x_101_phi} Identifier[not set]{x_101_phi}
Identifier{x_11} Identifier[not set]{x_11}
} }
If{ If{
( (
ScalarConstructor{true} ScalarConstructor[not set]{true}
) )
{ {
Assignment{ Assignment{
Identifier{x_101_phi} Identifier[not set]{x_101_phi}
Identifier{x_12} Identifier[not set]{x_12}
} }
} }
} }
@ -2038,7 +2038,7 @@ VariableDeclStatement{
none none
__bool __bool
{ {
Identifier{x_101_phi} Identifier[not set]{x_101_phi}
} }
} }
} }

View File

@ -200,7 +200,7 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
{ {
Return{ Return{
{ {
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -213,8 +213,8 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
none none
__u32 __u32
{ {
Call{ Call[not set]{
Identifier{leaf} Identifier[not set]{leaf}
( (
) )
} }
@ -223,7 +223,7 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
} }
Return{ Return{
{ {
Identifier{leaf_result} Identifier[not set]{leaf_result}
} }
} }
} }
@ -236,8 +236,8 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
none none
__u32 __u32
{ {
Call{ Call[not set]{
Identifier{branch} Identifier[not set]{branch}
( (
) )
} }
@ -267,7 +267,7 @@ TEST_F(SpvParserTest, EmitFunctions_NonVoidResultType) {
{ {
Return{ Return{
{ {
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
} }
})")) })"))

View File

@ -329,13 +329,13 @@ TEST_F(SpvParserTest, ModuleScopeVar_BuiltinPosition_StorePosition) {
const auto module_str = p->module().to_str(); const auto module_str = p->module().to_str();
EXPECT_THAT(module_str, HasSubstr(R"( EXPECT_THAT(module_str, HasSubstr(R"(
Assignment{ Assignment{
Identifier{gl_Position} Identifier[not set]{gl_Position}
TypeConstructor{ TypeConstructor[not set]{
__vec_4__f32 __vec_4__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
})")) })"))
<< module_str; << module_str;
@ -360,11 +360,11 @@ TEST_F(SpvParserTest,
const auto module_str = p->module().to_str(); const auto module_str = p->module().to_str();
EXPECT_THAT(module_str, HasSubstr(R"( EXPECT_THAT(module_str, HasSubstr(R"(
Assignment{ Assignment{
MemberAccessor{ MemberAccessor[not set]{
Identifier{gl_Position} Identifier[not set]{gl_Position}
Identifier{y} Identifier[not set]{y}
} }
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
})")) })"))
<< module_str; << module_str;
} }
@ -392,11 +392,11 @@ TEST_F(SpvParserTest,
EXPECT_THAT(module_str, HasSubstr(R"( EXPECT_THAT(module_str, HasSubstr(R"(
{ {
Assignment{ Assignment{
MemberAccessor{ MemberAccessor[not set]{
Identifier{gl_Position} Identifier[not set]{gl_Position}
Identifier{y} Identifier[not set]{y}
} }
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
Return{} Return{}
})")) })"))
@ -518,7 +518,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarInitializers) {
private private
__bool __bool
{ {
ScalarConstructor{true} ScalarConstructor[not set]{true}
} }
} }
Variable{ Variable{
@ -526,7 +526,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarInitializers) {
private private
__bool __bool
{ {
ScalarConstructor{false} ScalarConstructor[not set]{false}
} }
} }
Variable{ Variable{
@ -534,7 +534,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarInitializers) {
private private
__i32 __i32
{ {
ScalarConstructor{-1} ScalarConstructor[not set]{-1}
} }
} }
Variable{ Variable{
@ -542,7 +542,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarInitializers) {
private private
__u32 __u32
{ {
ScalarConstructor{1} ScalarConstructor[not set]{1}
} }
} }
Variable{ Variable{
@ -550,7 +550,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarInitializers) {
private private
__f32 __f32
{ {
ScalarConstructor{1.500000} ScalarConstructor[not set]{1.500000}
} }
})")); })"));
} }
@ -575,7 +575,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarNullInitializers) {
private private
__bool __bool
{ {
ScalarConstructor{false} ScalarConstructor[not set]{false}
} }
} }
Variable{ Variable{
@ -583,7 +583,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarNullInitializers) {
private private
__i32 __i32
{ {
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
Variable{ Variable{
@ -591,7 +591,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarNullInitializers) {
private private
__u32 __u32
{ {
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
Variable{ Variable{
@ -599,7 +599,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarNullInitializers) {
private private
__f32 __f32
{ {
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
})")); })"));
} }
@ -624,7 +624,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarUndefInitializers) {
private private
__bool __bool
{ {
ScalarConstructor{false} ScalarConstructor[not set]{false}
} }
} }
Variable{ Variable{
@ -632,7 +632,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarUndefInitializers) {
private private
__i32 __i32
{ {
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
Variable{ Variable{
@ -640,7 +640,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarUndefInitializers) {
private private
__u32 __u32
{ {
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
Variable{ Variable{
@ -648,7 +648,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarUndefInitializers) {
private private
__f32 __f32
{ {
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
})")); })"));
} }
@ -668,10 +668,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorInitializer) {
private private
__vec_2__f32 __vec_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{1.500000} ScalarConstructor[not set]{1.500000}
ScalarConstructor{2.000000} ScalarConstructor[not set]{2.000000}
} }
} }
})")); })"));
@ -691,10 +691,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorBoolNullInitializer) {
private private
__vec_2__bool __vec_2__bool
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__bool __vec_2__bool
ScalarConstructor{false} ScalarConstructor[not set]{false}
ScalarConstructor{false} ScalarConstructor[not set]{false}
} }
} }
})")); })"));
@ -714,10 +714,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorBoolUndefInitializer) {
private private
__vec_2__bool __vec_2__bool
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__bool __vec_2__bool
ScalarConstructor{false} ScalarConstructor[not set]{false}
ScalarConstructor{false} ScalarConstructor[not set]{false}
} }
} }
})")); })"));
@ -737,10 +737,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorUintNullInitializer) {
private private
__vec_2__u32 __vec_2__u32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
})")); })"));
@ -760,10 +760,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorUintUndefInitializer) {
private private
__vec_2__u32 __vec_2__u32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__u32 __vec_2__u32
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
})")); })"));
@ -783,10 +783,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorIntNullInitializer) {
private private
__vec_2__i32 __vec_2__i32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
})")); })"));
@ -806,10 +806,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorIntUndefInitializer) {
private private
__vec_2__i32 __vec_2__i32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__i32 __vec_2__i32
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
})")); })"));
@ -829,10 +829,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorFloatNullInitializer) {
private private
__vec_2__f32 __vec_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
} }
})")); })"));
@ -852,10 +852,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_VectorFloatUndefInitializer) {
private private
__vec_2__f32 __vec_2__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
} }
})")); })"));
@ -881,22 +881,22 @@ TEST_F(SpvParserTest, ModuleScopeVar_MatrixInitializer) {
private private
__mat_2_3__f32 __mat_2_3__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__mat_2_3__f32 __mat_2_3__f32
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{1.500000} ScalarConstructor[not set]{1.500000}
ScalarConstructor{2.000000} ScalarConstructor[not set]{2.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{2.000000} ScalarConstructor[not set]{2.000000}
ScalarConstructor{3.000000} ScalarConstructor[not set]{3.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{3.000000} ScalarConstructor[not set]{3.000000}
ScalarConstructor{4.000000} ScalarConstructor[not set]{4.000000}
} }
} }
} }
@ -917,22 +917,22 @@ TEST_F(SpvParserTest, ModuleScopeVar_MatrixNullInitializer) {
private private
__mat_2_3__f32 __mat_2_3__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__mat_2_3__f32 __mat_2_3__f32
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
} }
} }
@ -953,22 +953,22 @@ TEST_F(SpvParserTest, ModuleScopeVar_MatrixUndefInitializer) {
private private
__mat_2_3__f32 __mat_2_3__f32
{ {
TypeConstructor{ TypeConstructor[not set]{
__mat_2_3__f32 __mat_2_3__f32
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
TypeConstructor{ TypeConstructor[not set]{
__vec_2__f32 __vec_2__f32
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
} }
} }
} }
@ -990,10 +990,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_ArrayInitializer) {
private private
__array__u32_2 __array__u32_2
{ {
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{1} ScalarConstructor[not set]{1}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
} }
})")); })"));
@ -1013,10 +1013,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_ArrayNullInitializer) {
private private
__array__u32_2 __array__u32_2
{ {
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
})")); })"));
@ -1036,10 +1036,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_ArrayUndefInitializer) {
private private
__array__u32_2 __array__u32_2
{ {
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
})")); })"));
@ -1061,14 +1061,14 @@ TEST_F(SpvParserTest, ModuleScopeVar_StructInitializer) {
private private
__struct_S __struct_S
{ {
TypeConstructor{ TypeConstructor[not set]{
__struct_S __struct_S
ScalarConstructor{1} ScalarConstructor[not set]{1}
ScalarConstructor{1.500000} ScalarConstructor[not set]{1.500000}
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{1} ScalarConstructor[not set]{1}
ScalarConstructor{2} ScalarConstructor[not set]{2}
} }
} }
} }
@ -1090,14 +1090,14 @@ TEST_F(SpvParserTest, ModuleScopeVar_StructNullInitializer) {
private private
__struct_S __struct_S
{ {
TypeConstructor{ TypeConstructor[not set]{
__struct_S __struct_S
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -1119,14 +1119,14 @@ TEST_F(SpvParserTest, ModuleScopeVar_StructUndefInitializer) {
private private
__struct_S __struct_S
{ {
TypeConstructor{ TypeConstructor[not set]{
__struct_S __struct_S
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0.000000} ScalarConstructor[not set]{0.000000}
TypeConstructor{ TypeConstructor[not set]{
__array__u32_2 __array__u32_2
ScalarConstructor{0} ScalarConstructor[not set]{0}
ScalarConstructor{0} ScalarConstructor[not set]{0}
} }
} }
} }
@ -1509,7 +1509,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_True) {
none none
__bool __bool
{ {
ScalarConstructor{true} ScalarConstructor[not set]{true}
} }
} }
})")) << module_str; })")) << module_str;
@ -1534,7 +1534,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_False) {
none none
__bool __bool
{ {
ScalarConstructor{false} ScalarConstructor[not set]{false}
} }
} }
})")) << module_str; })")) << module_str;
@ -1559,7 +1559,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_U32) {
none none
__u32 __u32
{ {
ScalarConstructor{42} ScalarConstructor[not set]{42}
} }
} }
})")) << module_str; })")) << module_str;
@ -1584,7 +1584,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_I32) {
none none
__i32 __i32
{ {
ScalarConstructor{42} ScalarConstructor[not set]{42}
} }
} }
})")) << module_str; })")) << module_str;
@ -1609,7 +1609,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_DeclareConst_F32) {
none none
__f32 __f32
{ {
ScalarConstructor{2.500000} ScalarConstructor[not set]{2.500000}
} }
} }
})")) << module_str; })")) << module_str;
@ -1632,7 +1632,7 @@ TEST_F(SpvParserTest,
none none
__f32 __f32
{ {
ScalarConstructor{2.500000} ScalarConstructor[not set]{2.500000}
} }
} }
})")) << module_str; })")) << module_str;
@ -1660,10 +1660,10 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_UsedInFunction) {
none none
__f32 __f32
{ {
Binary{ Binary[not set]{
Identifier{myconst} Identifier[not set]{myconst}
add add
Identifier{myconst} Identifier[not set]{myconst}
} }
} }
})")) })"))

View File

@ -38,6 +38,7 @@
#include "src/ast/type_constructor_expression.h" #include "src/ast/type_constructor_expression.h"
#include "src/ast/uint_literal.h" #include "src/ast/uint_literal.h"
#include "src/ast/variable_decl_statement.h" #include "src/ast/variable_decl_statement.h"
#include "src/type_determiner.h"
namespace tint { namespace tint {
namespace transform { namespace transform {
@ -100,7 +101,11 @@ bool VertexPullingTransform::Run() {
AddVertexStorageBuffers(); AddVertexStorageBuffers();
AddVertexPullingPreamble(vertex_func); AddVertexPullingPreamble(vertex_func);
return true; // We've potentially inserted nodes into the AST so we have to make sure to
// re-run type determination else those nodes will be missing their
// result_type
TypeDeterminer td(ctx_, mod_);
return td.Determine();
} }
std::string VertexPullingTransform::GetVertexBufferName(uint32_t index) { std::string VertexPullingTransform::GetVertexBufferName(uint32_t index) {

View File

@ -186,29 +186,29 @@ TEST_F(VertexPullingTransformTest, OneAttribute) {
} }
} }
Assignment{ Assignment{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_vertex_index} Identifier[__ptr_in__i32]{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
} }
Assignment{ Assignment{
Identifier{var_a} Identifier[__ptr_private__f32]{var_a}
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
@ -271,29 +271,29 @@ TEST_F(VertexPullingTransformTest, OneInstancedAttribute) {
} }
} }
Assignment{ Assignment{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_instance_index} Identifier[__ptr_in__i32]{_tint_pulling_instance_index}
multiply multiply
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
} }
Assignment{ Assignment{
Identifier{var_a} Identifier[__ptr_private__f32]{var_a}
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
@ -356,29 +356,29 @@ TEST_F(VertexPullingTransformTest, OneAttributeDifferentOutputSet) {
} }
} }
Assignment{ Assignment{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_vertex_index} Identifier[__ptr_in__i32]{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
} }
Assignment{ Assignment{
Identifier{var_a} Identifier[__ptr_private__f32]{var_a}
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
@ -493,57 +493,57 @@ TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) {
} }
} }
Assignment{ Assignment{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{custom_vertex_index} Identifier[__ptr_in__i32]{custom_vertex_index}
multiply multiply
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
} }
Assignment{ Assignment{
Identifier{var_a} Identifier[__ptr_private__f32]{var_a}
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
} }
Assignment{ Assignment{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{custom_instance_index} Identifier[__ptr_in__i32]{custom_instance_index}
multiply multiply
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
} }
Assignment{ Assignment{
Identifier{var_b} Identifier[__ptr_private__f32]{var_b}
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_1} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_1}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
@ -616,114 +616,114 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
} }
} }
Assignment{ Assignment{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_vertex_index} Identifier[__ptr_in__i32]{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{16} ScalarConstructor[__u32]{16}
} }
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
} }
Assignment{ Assignment{
Identifier{var_a} Identifier[__ptr_private__f32]{var_a}
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
} }
Assignment{ Assignment{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_vertex_index} Identifier[__ptr_in__i32]{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{16} ScalarConstructor[__u32]{16}
} }
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
} }
Assignment{ Assignment{
Identifier{var_b} Identifier[__ptr_private__array__f32_4]{var_b}
TypeConstructor{ TypeConstructor[__vec_4__f32]{
__vec_4__f32 __vec_4__f32
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{8} ScalarConstructor[__u32]{8}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{12} ScalarConstructor[__u32]{12}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
@ -824,207 +824,207 @@ TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
} }
} }
Assignment{ Assignment{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_vertex_index} Identifier[__ptr_in__i32]{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{8} ScalarConstructor[__u32]{8}
} }
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
} }
Assignment{ Assignment{
Identifier{var_a} Identifier[__ptr_private__array__f32_2]{var_a}
TypeConstructor{ TypeConstructor[__vec_2__f32]{
__vec_2__f32 __vec_2__f32
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_0} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_0}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
} }
} }
Assignment{ Assignment{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_vertex_index} Identifier[__ptr_in__i32]{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{12} ScalarConstructor[__u32]{12}
} }
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
} }
Assignment{ Assignment{
Identifier{var_b} Identifier[__ptr_private__array__f32_3]{var_b}
TypeConstructor{ TypeConstructor[__vec_3__f32]{
__vec_3__f32 __vec_3__f32
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_1} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_1}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_1} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_1}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_1} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_1}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{8} ScalarConstructor[__u32]{8}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
} }
} }
Assignment{ Assignment{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_vertex_index} Identifier[__ptr_in__i32]{_tint_pulling_vertex_index}
multiply multiply
ScalarConstructor{16} ScalarConstructor[__u32]{16}
} }
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
} }
Assignment{ Assignment{
Identifier{var_c} Identifier[__ptr_private__array__f32_4]{var_c}
TypeConstructor{ TypeConstructor[__vec_4__f32]{
__vec_4__f32 __vec_4__f32
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_2} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_2}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{0} ScalarConstructor[__u32]{0}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_2} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_2}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_2} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_2}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{8} ScalarConstructor[__u32]{8}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }
Bitcast<__f32>{ Bitcast[__f32]<__f32>{
ArrayAccessor{ ArrayAccessor[__ptr_storage_buffer__u32]{
MemberAccessor{ MemberAccessor[__ptr_storage_buffer__array__u32_stride_4]{
Identifier{_tint_pulling_vertex_buffer_2} Identifier[__ptr_storage_buffer__struct_TintVertexData]{_tint_pulling_vertex_buffer_2}
Identifier{_tint_vertex_data} Identifier[not set]{_tint_vertex_data}
} }
Binary{ Binary[__i32]{
Binary{ Binary[__i32]{
Identifier{_tint_pulling_pos} Identifier[__ptr_function__i32]{_tint_pulling_pos}
add add
ScalarConstructor{12} ScalarConstructor[__u32]{12}
} }
divide divide
ScalarConstructor{4} ScalarConstructor[__u32]{4}
} }
} }
} }