mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Add a symbol to the Identifier AST node
This CL adds a Symbol to the identifier to represent the name. The name still exists but will be removed in a future CL when the namers are in place. Change-Id: Ic3cc8ad0d99e3bea6eb1ff1ce212e7de67991aec Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35460 Commit-Queue: dan sinclair <dsinclair@chromium.org> Auto-Submit: dan sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
5b3c9f1c62
commit
6b59bf45aa
@@ -689,7 +689,8 @@ void FunctionEmitter::PushGuard(const std::string& guard_name,
|
||||
// as the statement block at the top of the stack.
|
||||
const auto& top = statements_stack_.back();
|
||||
|
||||
auto* cond = create<ast::IdentifierExpression>(guard_name);
|
||||
auto* cond = create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(guard_name), guard_name);
|
||||
auto* body = create<ast::BlockStatement>();
|
||||
AddStatement(
|
||||
create<ast::IfStatement>(Source{}, cond, body, ast::ElseStatementList{}));
|
||||
@@ -1891,9 +1892,11 @@ TypedExpression FunctionEmitter::MakeExpression(uint32_t id) {
|
||||
return {};
|
||||
}
|
||||
if (identifier_values_.count(id) || parser_impl_.IsScalarSpecConstant(id)) {
|
||||
auto name = namer_.Name(id);
|
||||
return TypedExpression{
|
||||
parser_impl_.ConvertType(def_use_mgr_->GetDef(id)->type_id()),
|
||||
create<ast::IdentifierExpression>(namer_.Name(id))};
|
||||
create<ast::IdentifierExpression>(ast_module_.RegisterSymbol(name),
|
||||
name)};
|
||||
}
|
||||
if (singly_used_values_.count(id)) {
|
||||
auto expr = std::move(singly_used_values_[id]);
|
||||
@@ -1910,11 +1913,13 @@ TypedExpression FunctionEmitter::MakeExpression(uint32_t id) {
|
||||
return {};
|
||||
}
|
||||
switch (inst->opcode()) {
|
||||
case SpvOpVariable:
|
||||
case SpvOpVariable: {
|
||||
// This occurs for module-scope variables.
|
||||
return TypedExpression{
|
||||
parser_impl_.ConvertType(inst->type_id()),
|
||||
create<ast::IdentifierExpression>(namer_.Name(inst->result_id()))};
|
||||
auto name = namer_.Name(inst->result_id());
|
||||
return TypedExpression{parser_impl_.ConvertType(inst->type_id()),
|
||||
create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(name), name)};
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2579,7 +2584,9 @@ ast::Statement* FunctionEmitter::MakeBranchDetailed(
|
||||
}
|
||||
// Signal an exit from the branch.
|
||||
return create<ast::AssignmentStatement>(
|
||||
create<ast::IdentifierExpression>(flow_guard), MakeFalse());
|
||||
create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(flow_guard), flow_guard),
|
||||
MakeFalse());
|
||||
}
|
||||
|
||||
// For an unconditional branch, the break out to an if-selection
|
||||
@@ -2733,7 +2740,9 @@ bool FunctionEmitter::EmitStatementsInBasicBlock(const BlockInfo& block_info,
|
||||
const auto var_name = GetDefInfo(assignment.phi_id)->phi_var;
|
||||
auto expr = MakeExpression(assignment.value);
|
||||
AddStatement(create<ast::AssignmentStatement>(
|
||||
create<ast::IdentifierExpression>(var_name), expr.expr));
|
||||
create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(var_name), var_name),
|
||||
expr.expr));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2766,12 +2775,13 @@ bool FunctionEmitter::EmitConstDefOrWriteToHoistedVar(
|
||||
const auto result_id = inst.result_id();
|
||||
const auto* def_info = GetDefInfo(result_id);
|
||||
if (def_info && def_info->requires_hoisted_def) {
|
||||
auto name = namer_.Name(result_id);
|
||||
// Emit an assignment of the expression to the hoisted variable.
|
||||
AddStatementForInstruction(
|
||||
create<ast::AssignmentStatement>(
|
||||
create<ast::IdentifierExpression>(namer_.Name(result_id)),
|
||||
ast_expr.expr),
|
||||
inst);
|
||||
AddStatementForInstruction(create<ast::AssignmentStatement>(
|
||||
create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(name), name),
|
||||
ast_expr.expr),
|
||||
inst);
|
||||
return true;
|
||||
}
|
||||
return EmitConstDefinition(inst, ast_expr);
|
||||
@@ -2861,9 +2871,10 @@ bool FunctionEmitter::EmitStatement(const spvtools::opt::Instruction& inst) {
|
||||
}
|
||||
case SpvOpPhi: {
|
||||
// Emit a read from the associated state variable.
|
||||
TypedExpression expr{
|
||||
parser_impl_.ConvertType(inst.type_id()),
|
||||
create<ast::IdentifierExpression>(def_info->phi_var)};
|
||||
TypedExpression expr{parser_impl_.ConvertType(inst.type_id()),
|
||||
create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(def_info->phi_var),
|
||||
def_info->phi_var)};
|
||||
return EmitConstDefOrWriteToHoistedVar(inst, expr);
|
||||
}
|
||||
case SpvOpFunctionCall:
|
||||
@@ -2916,7 +2927,9 @@ TypedExpression FunctionEmitter::MaybeEmitCombinatorialValue(
|
||||
ast::ExpressionList params;
|
||||
params.emplace_back(MakeOperand(inst, 0).expr);
|
||||
return {ast_type, create<ast::CallExpression>(
|
||||
create<ast::IdentifierExpression>(unary_builtin_name),
|
||||
create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(unary_builtin_name),
|
||||
unary_builtin_name),
|
||||
std::move(params))};
|
||||
}
|
||||
|
||||
@@ -3017,7 +3030,8 @@ TypedExpression FunctionEmitter::EmitGlslStd450ExtInst(
|
||||
return {};
|
||||
}
|
||||
|
||||
auto* func = create<ast::IdentifierExpression>(name);
|
||||
auto* func =
|
||||
create<ast::IdentifierExpression>(ast_module_.RegisterSymbol(name), name);
|
||||
ast::ExpressionList operands;
|
||||
ast::type::Type* first_operand_type = nullptr;
|
||||
// All parameters to GLSL.std.450 extended instructions are IDs.
|
||||
@@ -3042,17 +3056,21 @@ ast::IdentifierExpression* FunctionEmitter::Swizzle(uint32_t i) {
|
||||
return nullptr;
|
||||
}
|
||||
const char* names[] = {"x", "y", "z", "w"};
|
||||
return create<ast::IdentifierExpression>(names[i & 3]);
|
||||
return create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(names[i & 3]), names[i & 3]);
|
||||
}
|
||||
|
||||
ast::IdentifierExpression* FunctionEmitter::PrefixSwizzle(uint32_t n) {
|
||||
switch (n) {
|
||||
case 1:
|
||||
return create<ast::IdentifierExpression>("x");
|
||||
return create<ast::IdentifierExpression>(ast_module_.RegisterSymbol("x"),
|
||||
"x");
|
||||
case 2:
|
||||
return create<ast::IdentifierExpression>("xy");
|
||||
return create<ast::IdentifierExpression>(ast_module_.RegisterSymbol("xy"),
|
||||
"xy");
|
||||
case 3:
|
||||
return create<ast::IdentifierExpression>("xyz");
|
||||
return create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol("xyz"), "xyz");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -3121,8 +3139,10 @@ TypedExpression FunctionEmitter::MakeAccessChain(
|
||||
first_index = first_index + 1;
|
||||
// Replace the gl_PerVertex reference with the gl_Position reference
|
||||
ptr_ty_id = builtin_position_info.member_pointer_type_id;
|
||||
current_expr.expr =
|
||||
create<ast::IdentifierExpression>(namer_.Name(base_id));
|
||||
|
||||
auto name = namer_.Name(base_id);
|
||||
current_expr.expr = create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(name), name);
|
||||
current_expr.type = parser_impl_.ConvertType(ptr_ty_id);
|
||||
}
|
||||
}
|
||||
@@ -3212,8 +3232,10 @@ TypedExpression FunctionEmitter::MakeAccessChain(
|
||||
<< pointee_type_id << " having " << num_members << " members";
|
||||
return {};
|
||||
}
|
||||
auto name =
|
||||
namer_.GetMemberName(pointee_type_id, uint32_t(index_const_val));
|
||||
auto* member_access = create<ast::IdentifierExpression>(
|
||||
namer_.GetMemberName(pointee_type_id, uint32_t(index_const_val)));
|
||||
ast_module_.RegisterSymbol(name), name);
|
||||
|
||||
next_expr = create<ast::MemberAccessorExpression>(current_expr.expr,
|
||||
member_access);
|
||||
@@ -3331,8 +3353,9 @@ TypedExpression FunctionEmitter::MakeCompositeExtract(
|
||||
<< current_type_id << " having " << num_members << " members";
|
||||
return {};
|
||||
}
|
||||
auto name = namer_.GetMemberName(current_type_id, uint32_t(index_val));
|
||||
auto* member_access = create<ast::IdentifierExpression>(
|
||||
namer_.GetMemberName(current_type_id, uint32_t(index_val)));
|
||||
ast_module_.RegisterSymbol(name), name);
|
||||
|
||||
next_expr = create<ast::MemberAccessorExpression>(current_expr.expr,
|
||||
member_access);
|
||||
@@ -3712,8 +3735,9 @@ TypedExpression FunctionEmitter::MakeNumericConversion(
|
||||
|
||||
bool FunctionEmitter::EmitFunctionCall(const spvtools::opt::Instruction& inst) {
|
||||
// We ignore function attributes such as Inline, DontInline, Pure, Const.
|
||||
auto* function = create<ast::IdentifierExpression>(
|
||||
namer_.Name(inst.GetSingleWordInOperand(0)));
|
||||
auto name = namer_.Name(inst.GetSingleWordInOperand(0));
|
||||
auto* function =
|
||||
create<ast::IdentifierExpression>(ast_module_.RegisterSymbol(name), name);
|
||||
|
||||
ast::ExpressionList params;
|
||||
for (uint32_t iarg = 1; iarg < inst.NumInOperands(); ++iarg) {
|
||||
@@ -3739,7 +3763,9 @@ TypedExpression FunctionEmitter::MakeIntrinsicCall(
|
||||
const auto intrinsic = GetIntrinsic(inst.opcode());
|
||||
std::ostringstream ss;
|
||||
ss << intrinsic;
|
||||
auto* ident = create<ast::IdentifierExpression>(ss.str());
|
||||
auto name = ss.str();
|
||||
auto* ident =
|
||||
create<ast::IdentifierExpression>(ast_module_.RegisterSymbol(name), name);
|
||||
ident->set_intrinsic(intrinsic);
|
||||
|
||||
ast::ExpressionList params;
|
||||
@@ -3781,9 +3807,11 @@ TypedExpression FunctionEmitter::MakeSimpleSelect(
|
||||
params.push_back(operand2.expr);
|
||||
// The condition goes last.
|
||||
params.push_back(condition.expr);
|
||||
return {operand1.type, create<ast::CallExpression>(
|
||||
create<ast::IdentifierExpression>("select"),
|
||||
std::move(params))};
|
||||
return {operand1.type,
|
||||
create<ast::CallExpression>(
|
||||
create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol("select"), "select"),
|
||||
std::move(params))};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@@ -3813,8 +3841,9 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) {
|
||||
return Fail() << "internal error: couldn't find image for "
|
||||
<< inst.PrettyPrint();
|
||||
}
|
||||
params.push_back(
|
||||
create<ast::IdentifierExpression>(namer_.Name(image->result_id())));
|
||||
auto name = namer_.Name(image->result_id());
|
||||
params.push_back(create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(name), name));
|
||||
|
||||
if (IsSampledImageAccess(inst.opcode())) {
|
||||
// Form the sampler operand.
|
||||
@@ -3824,8 +3853,9 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) {
|
||||
return Fail() << "internal error: couldn't find sampler for "
|
||||
<< inst.PrettyPrint();
|
||||
}
|
||||
params.push_back(
|
||||
create<ast::IdentifierExpression>(namer_.Name(sampler->result_id())));
|
||||
auto param_name = namer_.Name(sampler->result_id());
|
||||
params.push_back(create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(param_name), param_name));
|
||||
}
|
||||
|
||||
ast::type::Pointer* texture_ptr_type =
|
||||
@@ -3964,7 +3994,8 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) {
|
||||
<< "): " << inst.PrettyPrint();
|
||||
}
|
||||
|
||||
auto* ident = create<ast::IdentifierExpression>(builtin_name);
|
||||
auto* ident = create<ast::IdentifierExpression>(
|
||||
ast_module_.RegisterSymbol(builtin_name), builtin_name);
|
||||
auto* call_expr = create<ast::CallExpression>(ident, std::move(params));
|
||||
|
||||
if (inst.type_id() != 0) {
|
||||
|
||||
@@ -135,7 +135,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Int) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -147,7 +147,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Int) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) {
|
||||
@@ -162,7 +162,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -176,7 +176,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) {
|
||||
@@ -191,7 +191,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -205,7 +205,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) {
|
||||
@@ -220,7 +220,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -236,7 +236,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) {
|
||||
@@ -251,7 +251,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -267,7 +267,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) {
|
||||
@@ -282,7 +282,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -300,7 +300,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) {
|
||||
@@ -315,7 +315,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -333,7 +333,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) {
|
||||
@@ -348,7 +348,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -368,7 +368,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryArithTest, FNegate_Scalar) {
|
||||
@@ -383,7 +383,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -395,7 +395,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryArithTest, FNegate_Vector) {
|
||||
@@ -410,7 +410,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -426,7 +426,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
struct BinaryData {
|
||||
@@ -474,7 +474,8 @@ TEST_P(SpvBinaryArithTest, EmitExpression) {
|
||||
<< GetParam().ast_type << "\n {\n Binary[not set]{"
|
||||
<< "\n " << GetParam().ast_lhs << "\n " << GetParam().ast_op
|
||||
<< "\n " << GetParam().ast_rhs;
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(ss.str())) << assembly;
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(ss.str()))
|
||||
<< assembly;
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
@@ -696,7 +697,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Scalar_UnsignedResult) {
|
||||
<< assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -731,7 +732,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Vector_UnsignedResult) {
|
||||
<< assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -754,7 +755,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Vector_UnsignedResult) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
@@ -842,7 +843,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Scalar_UnsignedResult) {
|
||||
<< assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -877,7 +878,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Vector_UnsignedResult) {
|
||||
<< assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -900,7 +901,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Vector_UnsignedResult) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
@@ -930,7 +931,8 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesScalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_10
|
||||
none
|
||||
__vec_2__f32
|
||||
@@ -942,7 +944,7 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesScalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvBinaryArithTestBasic, MatrixTimesScalar) {
|
||||
@@ -959,7 +961,8 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesScalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_10
|
||||
none
|
||||
__mat_2_2__f32
|
||||
@@ -971,7 +974,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesScalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvBinaryArithTestBasic, VectorTimesMatrix) {
|
||||
@@ -988,7 +991,8 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesMatrix) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_10
|
||||
none
|
||||
__mat_2_2__f32
|
||||
@@ -1000,7 +1004,7 @@ TEST_F(SpvBinaryArithTestBasic, VectorTimesMatrix) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvBinaryArithTestBasic, MatrixTimesVector) {
|
||||
@@ -1017,7 +1021,8 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesVector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_10
|
||||
none
|
||||
__mat_2_2__f32
|
||||
@@ -1029,7 +1034,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesVector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvBinaryArithTestBasic, MatrixTimesMatrix) {
|
||||
@@ -1046,7 +1051,8 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesMatrix) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_10
|
||||
none
|
||||
__mat_2_2__f32
|
||||
@@ -1058,7 +1064,7 @@ TEST_F(SpvBinaryArithTestBasic, MatrixTimesMatrix) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvBinaryArithTestBasic, Dot) {
|
||||
@@ -1075,7 +1081,8 @@ TEST_F(SpvBinaryArithTestBasic, Dot) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_3
|
||||
none
|
||||
__f32
|
||||
@@ -1089,7 +1096,7 @@ TEST_F(SpvBinaryArithTestBasic, Dot) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvBinaryArithTestBasic, OuterProduct) {
|
||||
@@ -1106,7 +1113,8 @@ TEST_F(SpvBinaryArithTestBasic, OuterProduct) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_3
|
||||
none
|
||||
__mat_2_2__f32
|
||||
@@ -1120,7 +1128,7 @@ TEST_F(SpvBinaryArithTestBasic, OuterProduct) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
// TODO(dneto): OpSRem. Missing from WGSL
|
||||
|
||||
@@ -163,7 +163,8 @@ TEST_P(SpvBinaryBitTest, EmitExpression) {
|
||||
<< GetParam().ast_type << "\n {\n Binary[not set]{"
|
||||
<< "\n " << GetParam().ast_lhs << "\n " << GetParam().ast_op
|
||||
<< "\n " << GetParam().ast_rhs;
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(ss.str())) << assembly;
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(ss.str()))
|
||||
<< assembly;
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
@@ -400,7 +401,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Int) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -412,7 +413,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Int) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryBitTest, Not_Int_Uint) {
|
||||
@@ -427,7 +428,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Uint) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -441,7 +442,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Uint) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryBitTest, Not_Uint_Int) {
|
||||
@@ -456,7 +457,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Int) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -470,7 +471,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Int) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryBitTest, Not_Uint_Uint) {
|
||||
@@ -485,7 +486,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Uint) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -497,7 +498,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Uint) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) {
|
||||
@@ -512,7 +513,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -528,7 +529,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) {
|
||||
@@ -543,7 +544,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -561,7 +562,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) {
|
||||
@@ -576,7 +577,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -594,7 +595,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) {
|
||||
const auto assembly = CommonTypes() + R"(
|
||||
@@ -608,7 +609,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -624,7 +625,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
std::string BitTestPreamble() {
|
||||
@@ -663,7 +664,7 @@ TEST_F(SpvUnaryBitTest, BitCount_Uint_Uint) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -691,7 +692,7 @@ TEST_F(SpvUnaryBitTest, BitCount_Uint_Int) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -721,7 +722,7 @@ TEST_F(SpvUnaryBitTest, BitCount_Int_Uint) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -751,7 +752,7 @@ TEST_F(SpvUnaryBitTest, BitCount_Int_Int) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -779,7 +780,7 @@ TEST_F(SpvUnaryBitTest, BitCount_UintVector_UintVector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -807,7 +808,7 @@ TEST_F(SpvUnaryBitTest, BitCount_UintVector_IntVector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -837,7 +838,7 @@ TEST_F(SpvUnaryBitTest, BitCount_IntVector_UintVector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -867,7 +868,7 @@ TEST_F(SpvUnaryBitTest, BitCount_IntVector_IntVector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -895,7 +896,7 @@ TEST_F(SpvUnaryBitTest, BitReverse_Uint_Uint) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -923,7 +924,7 @@ TEST_F(SpvUnaryBitTest, BitReverse_Uint_Int) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -953,7 +954,7 @@ TEST_F(SpvUnaryBitTest, BitReverse_Int_Uint) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -983,7 +984,7 @@ TEST_F(SpvUnaryBitTest, BitReverse_Int_Int) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -1011,7 +1012,7 @@ TEST_F(SpvUnaryBitTest, BitReverse_UintVector_UintVector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -1039,7 +1040,7 @@ TEST_F(SpvUnaryBitTest, BitReverse_UintVector_IntVector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -1069,7 +1070,7 @@ TEST_F(SpvUnaryBitTest, BitReverse_IntVector_UintVector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -1099,7 +1100,7 @@ TEST_F(SpvUnaryBitTest, BitReverse_IntVector_IntVector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
const auto body = ToString(fe.ast_body());
|
||||
const auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
|
||||
@@ -48,18 +48,16 @@ TEST_F(SpvParserTest, EmitStatement_VoidCallNoParams) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error();
|
||||
const auto module_ast_str = p->get_module().to_str();
|
||||
EXPECT_THAT(module_ast_str, Eq(R"(Module{
|
||||
Function )" + p->get_module().GetSymbol("x_50").to_str() +
|
||||
R"( -> __void
|
||||
Function tint_symbol_1 -> __void
|
||||
()
|
||||
{
|
||||
Return{}
|
||||
}
|
||||
Function )" + p->get_module().GetSymbol("x_100").to_str() +
|
||||
R"( -> __void
|
||||
Function tint_symbol_2 -> __void
|
||||
()
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{x_50}
|
||||
Identifier[not set]{tint_symbol_1}
|
||||
(
|
||||
)
|
||||
}
|
||||
@@ -92,7 +90,8 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParams) {
|
||||
{
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -107,17 +106,17 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParams) {
|
||||
}
|
||||
}
|
||||
Return{})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
{
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 50));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Return{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Return{
|
||||
{
|
||||
ScalarConstructor[not set]{42}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +147,8 @@ TEST_F(SpvParserTest, EmitStatement_ScalarCallNoParamsUsedTwice) {
|
||||
{
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_10
|
||||
function
|
||||
@@ -178,16 +178,16 @@ Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
}
|
||||
Return{})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
{
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 50));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Return{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Return{
|
||||
{
|
||||
ScalarConstructor[not set]{42}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,8 +218,7 @@ TEST_F(SpvParserTest, EmitStatement_CallWithParams) {
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_ast_str = p->get_module().to_str();
|
||||
EXPECT_THAT(module_ast_str, HasSubstr(R"(Module{
|
||||
Function )" + p->get_module().GetSymbol("x_50").to_str() +
|
||||
R"( -> __u32
|
||||
Function tint_symbol_3 -> __u32
|
||||
(
|
||||
VariableConst{
|
||||
x_51
|
||||
@@ -236,9 +235,9 @@ TEST_F(SpvParserTest, EmitStatement_CallWithParams) {
|
||||
Return{
|
||||
{
|
||||
Binary[not set]{
|
||||
Identifier[not set]{x_51}
|
||||
Identifier[not set]{tint_symbol_1}
|
||||
add
|
||||
Identifier[not set]{x_52}
|
||||
Identifier[not set]{tint_symbol_2}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -254,7 +253,7 @@ TEST_F(SpvParserTest, EmitStatement_CallWithParams) {
|
||||
__u32
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{x_50}
|
||||
Identifier[not set]{tint_symbol_3}
|
||||
(
|
||||
ScalarConstructor[not set]{42}
|
||||
ScalarConstructor[not set]{84}
|
||||
|
||||
@@ -7361,7 +7361,7 @@ TEST_F(SpvParserTest, EmitBody_IfBreak_FromThen_ForwardWithinThen) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -7473,7 +7473,7 @@ TEST_F(SpvParserTest, EmitBody_IfBreak_FromElse_ForwardWithinElse) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -7600,7 +7600,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error() << assembly;
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -7791,7 +7791,7 @@ TEST_F(SpvParserTest, EmitBody_If_Empty) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(If{
|
||||
(
|
||||
ScalarConstructor[not set]{false}
|
||||
@@ -7827,7 +7827,7 @@ TEST_F(SpvParserTest, EmitBody_If_Then_NoElse) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -7875,7 +7875,7 @@ TEST_F(SpvParserTest, EmitBody_If_NoThen_Else) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -7931,7 +7931,7 @@ TEST_F(SpvParserTest, EmitBody_If_Then_Else) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -7998,7 +7998,7 @@ TEST_F(SpvParserTest, EmitBody_If_Then_Else_Premerge) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8070,7 +8070,7 @@ TEST_F(SpvParserTest, EmitBody_If_Then_Premerge) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8134,7 +8134,7 @@ TEST_F(SpvParserTest, EmitBody_If_Else_Premerge) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8219,7 +8219,7 @@ TEST_F(SpvParserTest, EmitBody_If_Nest_If) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8309,7 +8309,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_TrueBackedge) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8364,7 +8364,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_FalseBackedge) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8415,7 +8415,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_BothBackedge) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8458,7 +8458,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_SingleBlock_UnconditionalBackege) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8509,7 +8509,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_Unconditional_Body_SingleBlockContinue) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8574,7 +8574,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_Unconditional_Body_MultiBlockContinue) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8648,7 +8648,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_Unconditional_Body_ContinueNestIf) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8720,7 +8720,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_MultiBlockContinueIsEntireLoop) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -8778,7 +8778,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_Never) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -8838,7 +8838,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_TrueToBody_FalseBreaks) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -8905,7 +8905,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_FalseToBody_TrueBreaks) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -8979,7 +8979,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_NestedIfContinue) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
If{
|
||||
(
|
||||
@@ -9037,7 +9037,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_BodyAlwaysBreaks) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -9086,7 +9086,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromTrue) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -9142,7 +9142,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromFalse) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -9204,7 +9204,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromTrue_Early) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -9266,7 +9266,7 @@ TEST_F(SpvParserTest, EmitBody_Loop_BodyConditionallyBreaks_FromFalse_Early) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -9319,7 +9319,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_NoCases) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -9364,7 +9364,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_OneCase) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -9418,7 +9418,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_TwoCases) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -9478,7 +9478,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsMerge_CasesWithDup) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -9544,7 +9544,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsCase_NoDupCases) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -9615,7 +9615,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_DefaultIsCase_WithDupCase) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -9687,7 +9687,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_Case_SintValue) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -9757,7 +9757,7 @@ TEST_F(SpvParserTest, EmitBody_Switch_Case_UintValue) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -9809,7 +9809,7 @@ TEST_F(SpvParserTest, EmitBody_Return_TopLevel) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Return{}
|
||||
)";
|
||||
ASSERT_EQ(expect, got);
|
||||
@@ -9835,7 +9835,7 @@ TEST_F(SpvParserTest, EmitBody_Return_InsideIf) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(If{
|
||||
(
|
||||
ScalarConstructor[not set]{false}
|
||||
@@ -9875,7 +9875,7 @@ TEST_F(SpvParserTest, EmitBody_Return_InsideLoop) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Return{}
|
||||
}
|
||||
@@ -9905,7 +9905,7 @@ TEST_F(SpvParserTest, EmitBody_ReturnValue_TopLevel) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 200));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Return{
|
||||
{
|
||||
ScalarConstructor[not set]{2}
|
||||
@@ -9944,7 +9944,7 @@ TEST_F(SpvParserTest, EmitBody_ReturnValue_InsideIf) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 200));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(If{
|
||||
(
|
||||
ScalarConstructor[not set]{false}
|
||||
@@ -10001,7 +10001,7 @@ TEST_F(SpvParserTest, EmitBody_ReturnValue_Loop) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 200));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Return{
|
||||
{
|
||||
@@ -10031,7 +10031,7 @@ TEST_F(SpvParserTest, EmitBody_Kill_TopLevel) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Discard{}
|
||||
)";
|
||||
ASSERT_EQ(expect, got);
|
||||
@@ -10057,7 +10057,7 @@ TEST_F(SpvParserTest, EmitBody_Kill_InsideIf) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(If{
|
||||
(
|
||||
ScalarConstructor[not set]{false}
|
||||
@@ -10097,7 +10097,7 @@ TEST_F(SpvParserTest, EmitBody_Kill_InsideLoop) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Discard{}
|
||||
}
|
||||
@@ -10119,7 +10119,7 @@ TEST_F(SpvParserTest, EmitBody_Unreachable_TopLevel) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Return{}
|
||||
)";
|
||||
ASSERT_EQ(expect, got);
|
||||
@@ -10145,7 +10145,7 @@ TEST_F(SpvParserTest, EmitBody_Unreachable_InsideIf) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(If{
|
||||
(
|
||||
ScalarConstructor[not set]{false}
|
||||
@@ -10185,7 +10185,7 @@ TEST_F(SpvParserTest, EmitBody_Unreachable_InsideLoop) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Return{}
|
||||
}
|
||||
@@ -10215,7 +10215,7 @@ TEST_F(SpvParserTest, EmitBody_Unreachable_InNonVoidFunction) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 200));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Return{
|
||||
{
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -10249,7 +10249,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_BackEdge_MultiBlockLoop) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
continuing {
|
||||
Assignment{
|
||||
@@ -10284,7 +10284,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_BackEdge_SingleBlockLoop) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -10321,7 +10321,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_SwitchBreak_LastInCase) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -10381,7 +10381,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_SwitchBreak_NotLastInCase) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -10452,7 +10452,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_LoopBreak_MultiBlockLoop_FromBody) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -10534,7 +10534,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
continuing {
|
||||
Assignment{
|
||||
@@ -10576,7 +10576,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_LoopContinue_LastInLoopConstruct) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
@@ -10630,7 +10630,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_LoopContinue_BeforeLast) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Loop{
|
||||
If{
|
||||
(
|
||||
@@ -10699,7 +10699,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_LoopContinue_FromSwitch) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -10769,7 +10769,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_IfBreak_FromThen) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(If{
|
||||
(
|
||||
ScalarConstructor[not set]{false}
|
||||
@@ -10812,7 +10812,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_IfBreak_FromElse) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(If{
|
||||
(
|
||||
ScalarConstructor[not set]{false}
|
||||
@@ -10864,7 +10864,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_Fallthrough) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -10915,7 +10915,7 @@ TEST_F(SpvParserTest, EmitBody_Branch_Forward) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -11019,7 +11019,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Back_SingleBlock_Back) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -11062,7 +11062,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -11113,7 +11113,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -11171,7 +11171,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -11227,7 +11227,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -11287,7 +11287,7 @@ TEST_F(SpvParserTest,
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -11348,7 +11348,7 @@ TEST_F(SpvParserTest,
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -11431,7 +11431,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Continue_OnTrue) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -11526,7 +11526,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Continue_OnFalse) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -11611,7 +11611,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Forward_OnTrue) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -11680,7 +11680,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_SwitchBreak_Forward_OnFalse) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -11747,7 +11747,7 @@ TEST_F(SpvParserTest,
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -11821,7 +11821,7 @@ TEST_F(SpvParserTest,
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -11890,7 +11890,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -11948,7 +11948,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12021,7 +12021,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Continue_OnTrue) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12117,7 +12117,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Continue_OnFalse) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12256,7 +12256,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Forward_OnTrue) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12337,7 +12337,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopBreak_Forward_OnFalse) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12405,7 +12405,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Continue_FromHeader) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12462,7 +12462,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12534,7 +12534,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12622,7 +12622,7 @@ TEST_F(
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12701,7 +12701,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_LoopContinue_FromSwitch) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -12789,7 +12789,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_IfBreak_OnTrue) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12886,7 +12886,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_IfBreak_OnFalse) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -12982,7 +12982,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Fallthrough_OnTrue) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -13091,7 +13091,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Fallthrough_OnFalse) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -13188,7 +13188,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Forward_OnTrue) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -13269,7 +13269,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Continue_Forward_OnFalse) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -13333,7 +13333,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_IfBreak_IfBreak_Same) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
@@ -13418,7 +13418,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Fallthrough_Fallthrough_Same) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -13509,7 +13509,7 @@ TEST_F(SpvParserTest, EmitBody_BranchConditional_Forward_Forward_Same) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = R"(Assignment{
|
||||
Identifier[not set]{var_1}
|
||||
ScalarConstructor[not set]{1}
|
||||
@@ -13578,7 +13578,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = "unhandled case";
|
||||
ASSERT_EQ(expect, got);
|
||||
}
|
||||
@@ -13613,7 +13613,7 @@ TEST_F(SpvParserTest,
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto got = ToString(fe.ast_body());
|
||||
auto got = ToString(p->get_module(), fe.ast_body());
|
||||
auto* expect = "unhandled case";
|
||||
ASSERT_EQ(expect, got);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,8 @@ TEST_F(SpvParserTest_Composite_Construct, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -127,7 +128,7 @@ VariableDeclStatement{
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_Composite_Construct, Matrix) {
|
||||
@@ -142,7 +143,7 @@ TEST_F(SpvParserTest_Composite_Construct, Matrix) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -168,7 +169,7 @@ TEST_F(SpvParserTest_Composite_Construct, Matrix) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_Composite_Construct, Array) {
|
||||
@@ -183,7 +184,7 @@ TEST_F(SpvParserTest_Composite_Construct, Array) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -199,7 +200,7 @@ TEST_F(SpvParserTest_Composite_Construct, Array) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_Composite_Construct, Struct) {
|
||||
@@ -214,7 +215,7 @@ TEST_F(SpvParserTest_Composite_Construct, Struct) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -232,7 +233,7 @@ TEST_F(SpvParserTest_Composite_Construct, Struct) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
using SpvParserTest_CompositeExtract = SpvParserTest;
|
||||
@@ -249,7 +250,7 @@ TEST_F(SpvParserTest_CompositeExtract, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -265,7 +266,7 @@ TEST_F(SpvParserTest_CompositeExtract, Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_CompositeExtract, Vector_IndexTooBigError) {
|
||||
@@ -300,7 +301,7 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_2
|
||||
none
|
||||
@@ -312,7 +313,7 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_CompositeExtract, Matrix_IndexTooBigError) {
|
||||
@@ -351,7 +352,7 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_2
|
||||
none
|
||||
@@ -366,7 +367,7 @@ TEST_F(SpvParserTest_CompositeExtract, Matrix_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_CompositeExtract, Array) {
|
||||
@@ -385,7 +386,7 @@ TEST_F(SpvParserTest_CompositeExtract, Array) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_2
|
||||
none
|
||||
@@ -397,7 +398,7 @@ TEST_F(SpvParserTest_CompositeExtract, Array) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_CompositeExtract, RuntimeArray_IsError) {
|
||||
@@ -436,7 +437,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_2
|
||||
none
|
||||
@@ -448,7 +449,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_CompositeExtract, Struct_DifferOnlyInMemberName) {
|
||||
@@ -478,7 +479,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_DifferOnlyInMemberName) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_2
|
||||
none
|
||||
@@ -490,8 +491,8 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_DifferOnlyInMemberName) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_4
|
||||
none
|
||||
@@ -503,7 +504,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_DifferOnlyInMemberName) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_CompositeExtract, Struct_IndexTooBigError) {
|
||||
@@ -544,7 +545,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_Array_Matrix_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_2
|
||||
none
|
||||
@@ -565,7 +566,7 @@ TEST_F(SpvParserTest_CompositeExtract, Struct_Array_Matrix_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
using SpvParserTest_CopyObject = SpvParserTest;
|
||||
@@ -583,7 +584,8 @@ TEST_F(SpvParserTest_CopyObject, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -602,7 +604,7 @@ VariableDeclStatement{
|
||||
Identifier[not set]{x_1}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_CopyObject, Pointer) {
|
||||
@@ -621,7 +623,8 @@ TEST_F(SpvParserTest_CopyObject, Pointer) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -640,7 +643,7 @@ VariableDeclStatement{
|
||||
Identifier[not set]{x_1}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
using SpvParserTest_VectorShuffle = SpvParserTest;
|
||||
@@ -661,7 +664,8 @@ TEST_F(SpvParserTest_VectorShuffle, FunctionScopeOperands_UseBoth) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_10
|
||||
none
|
||||
__vec_4__u32
|
||||
@@ -687,7 +691,7 @@ TEST_F(SpvParserTest_VectorShuffle, FunctionScopeOperands_UseBoth) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_UseBoth) {
|
||||
@@ -703,7 +707,8 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_UseBoth) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_10
|
||||
none
|
||||
__vec_4__u32
|
||||
@@ -745,7 +750,7 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_UseBoth) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_AllOnesMapToNull) {
|
||||
@@ -762,7 +767,8 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_AllOnesMapToNull) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_10
|
||||
none
|
||||
__vec_2__u32
|
||||
@@ -777,7 +783,7 @@ TEST_F(SpvParserTest_VectorShuffle, ConstantOperands_AllOnesMapToNull) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest_VectorShuffle, IndexTooBig_IsError) {
|
||||
|
||||
@@ -82,7 +82,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -93,7 +93,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, Bitcast_Vector) {
|
||||
@@ -108,7 +108,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -123,7 +123,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertSToF_BadArg) {
|
||||
@@ -238,7 +238,8 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromSigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__f32
|
||||
@@ -249,7 +250,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromSigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromUnsigned) {
|
||||
@@ -265,7 +266,8 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromUnsigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__f32
|
||||
@@ -278,7 +280,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Scalar_FromUnsigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromSigned) {
|
||||
@@ -294,7 +296,8 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromSigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__vec_2__f32
|
||||
@@ -305,7 +308,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromSigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromUnsigned) {
|
||||
@@ -321,7 +324,8 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromUnsigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__vec_2__f32
|
||||
@@ -334,7 +338,7 @@ TEST_F(SpvUnaryConversionTest, ConvertSToF_Vector_FromUnsigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_BadArgType) {
|
||||
@@ -383,7 +387,8 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromSigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__f32
|
||||
@@ -396,7 +401,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromSigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromUnsigned) {
|
||||
@@ -412,7 +417,8 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromUnsigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__f32
|
||||
@@ -423,7 +429,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Scalar_FromUnsigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromSigned) {
|
||||
@@ -439,7 +445,8 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromSigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__vec_2__f32
|
||||
@@ -452,7 +459,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromSigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromUnsigned) {
|
||||
@@ -468,7 +475,8 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromUnsigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__vec_2__f32
|
||||
@@ -479,7 +487,7 @@ TEST_F(SpvUnaryConversionTest, ConvertUToF_Vector_FromUnsigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_BadArgType) {
|
||||
@@ -529,7 +537,8 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToSigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__i32
|
||||
@@ -540,7 +549,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToSigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToUnsigned) {
|
||||
@@ -556,7 +565,8 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToUnsigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__u32
|
||||
@@ -569,7 +579,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Scalar_ToUnsigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToSigned) {
|
||||
@@ -585,7 +595,8 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToSigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__vec_2__i32
|
||||
@@ -596,7 +607,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToSigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToUnsigned) {
|
||||
@@ -612,7 +623,8 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToUnsigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__vec_2__u32
|
||||
@@ -625,7 +637,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToS_Vector_ToUnsigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_BadArgType) {
|
||||
@@ -675,7 +687,8 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToSigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__i32
|
||||
@@ -688,7 +701,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToSigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToUnsigned) {
|
||||
@@ -704,7 +717,8 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToUnsigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__u32
|
||||
@@ -715,7 +729,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Scalar_ToUnsigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToSigned) {
|
||||
@@ -731,7 +745,8 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToSigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__vec_2__i32
|
||||
@@ -744,7 +759,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToSigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToUnsigned) {
|
||||
@@ -760,7 +775,8 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToUnsigned) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableConst{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableConst{
|
||||
x_1
|
||||
none
|
||||
__vec_2__u32
|
||||
@@ -771,7 +787,7 @@ TEST_F(SpvUnaryConversionTest, ConvertFToU_Vector_ToUnsigned) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
// TODO(dneto): OpSConvert // only if multiple widths
|
||||
|
||||
@@ -183,7 +183,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_Floating, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -191,14 +191,14 @@ TEST_P(SpvParserTest_GlslStd450_Float_Floating, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{f1}
|
||||
)
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Float_Floating, Vector) {
|
||||
@@ -212,7 +212,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_Floating, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -220,14 +220,14 @@ TEST_P(SpvParserTest_GlslStd450_Float_Floating, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2f1}
|
||||
)
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Scalar) {
|
||||
@@ -241,7 +241,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -249,7 +249,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{f1}
|
||||
Identifier[not set]{f2}
|
||||
@@ -257,7 +257,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Vector) {
|
||||
@@ -271,7 +271,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -279,7 +279,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2f1}
|
||||
Identifier[not set]{v2f2}
|
||||
@@ -287,7 +287,7 @@ TEST_P(SpvParserTest_GlslStd450_Float_FloatingFloating, Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Scalar) {
|
||||
@@ -301,7 +301,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -309,14 +309,14 @@ TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{f1}
|
||||
)
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Vector) {
|
||||
@@ -330,7 +330,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -338,14 +338,14 @@ TEST_P(SpvParserTest_GlslStd450_Floating_Floating, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2f1}
|
||||
)
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Scalar) {
|
||||
@@ -359,7 +359,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -367,7 +367,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{f1}
|
||||
Identifier[not set]{f2}
|
||||
@@ -375,7 +375,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Vector) {
|
||||
@@ -389,7 +389,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -397,7 +397,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2f1}
|
||||
Identifier[not set]{v2f2}
|
||||
@@ -405,7 +405,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloating, Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Scalar) {
|
||||
@@ -419,7 +419,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -427,7 +427,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{f1}
|
||||
Identifier[not set]{f2}
|
||||
@@ -436,7 +436,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Vector) {
|
||||
@@ -451,7 +451,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -459,7 +459,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2f1}
|
||||
Identifier[not set]{v2f2}
|
||||
@@ -468,7 +468,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Floating_FloatingUinting, Scalar) {
|
||||
@@ -482,7 +482,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingUinting, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -490,7 +490,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingUinting, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{f1}
|
||||
Identifier[not set]{u1}
|
||||
@@ -498,7 +498,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingUinting, Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Floating_FloatingUinting, Vector) {
|
||||
@@ -513,7 +513,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingUinting, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -521,7 +521,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingUinting, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2f1}
|
||||
Identifier[not set]{v2u1}
|
||||
@@ -529,7 +529,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingUinting, Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Floating_FloatingInting, Scalar) {
|
||||
@@ -543,7 +543,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingInting, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -551,7 +551,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingInting, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{f1}
|
||||
Identifier[not set]{i1}
|
||||
@@ -559,7 +559,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingInting, Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Floating_FloatingInting, Vector) {
|
||||
@@ -574,7 +574,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingInting, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -582,7 +582,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingInting, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2f1}
|
||||
Identifier[not set]{v2i1}
|
||||
@@ -590,7 +590,7 @@ TEST_P(SpvParserTest_GlslStd450_Floating_FloatingInting, Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Float3_Float3Float3, Samples) {
|
||||
@@ -605,7 +605,7 @@ TEST_P(SpvParserTest_GlslStd450_Float3_Float3Float3, Samples) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -613,7 +613,7 @@ TEST_P(SpvParserTest_GlslStd450_Float3_Float3Float3, Samples) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v3f1}
|
||||
Identifier[not set]{v3f2}
|
||||
@@ -621,7 +621,7 @@ TEST_P(SpvParserTest_GlslStd450_Float3_Float3Float3, Samples) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(Samples,
|
||||
@@ -709,7 +709,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_Inting, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -717,14 +717,14 @@ TEST_P(SpvParserTest_GlslStd450_Inting_Inting, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{i1}
|
||||
)
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Inting_Inting, Vector) {
|
||||
@@ -739,7 +739,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_Inting, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -747,14 +747,14 @@ TEST_P(SpvParserTest_GlslStd450_Inting_Inting, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2i1}
|
||||
)
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Inting_IntingInting, Scalar) {
|
||||
@@ -769,7 +769,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingInting, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -777,7 +777,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingInting, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{i1}
|
||||
Identifier[not set]{i2}
|
||||
@@ -785,7 +785,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingInting, Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Inting_IntingInting, Vector) {
|
||||
@@ -800,7 +800,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingInting, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -808,7 +808,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingInting, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2i1}
|
||||
Identifier[not set]{v2i2}
|
||||
@@ -816,7 +816,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingInting, Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Inting_IntingIntingInting, Scalar) {
|
||||
@@ -831,7 +831,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingIntingInting, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -839,7 +839,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingIntingInting, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{i1}
|
||||
Identifier[not set]{i2}
|
||||
@@ -848,7 +848,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingIntingInting, Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Inting_IntingIntingInting, Vector) {
|
||||
@@ -863,7 +863,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingIntingInting, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -871,7 +871,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingIntingInting, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2i1}
|
||||
Identifier[not set]{v2i2}
|
||||
@@ -880,7 +880,7 @@ TEST_P(SpvParserTest_GlslStd450_Inting_IntingIntingInting, Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(Samples,
|
||||
@@ -907,7 +907,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUinting, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -915,7 +915,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUinting, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{u1}
|
||||
Identifier[not set]{u2}
|
||||
@@ -923,7 +923,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUinting, Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUinting, Vector) {
|
||||
@@ -938,7 +938,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUinting, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -946,7 +946,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUinting, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2u1}
|
||||
Identifier[not set]{v2u2}
|
||||
@@ -954,7 +954,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUinting, Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUintingUinting, Scalar) {
|
||||
@@ -968,7 +968,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUintingUinting, Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -976,7 +976,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUintingUinting, Scalar) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{u1}
|
||||
Identifier[not set]{u2}
|
||||
@@ -985,7 +985,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUintingUinting, Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUintingUinting, Vector) {
|
||||
@@ -1000,7 +1000,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUintingUinting, Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1008,7 +1008,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUintingUinting, Vector) {
|
||||
{
|
||||
Call[not set]{
|
||||
Identifier[not set]{)" + GetParam().wgsl_func +
|
||||
R"(}
|
||||
R"(}
|
||||
(
|
||||
Identifier[not set]{v2u1}
|
||||
Identifier[not set]{v2u2}
|
||||
@@ -1017,7 +1017,7 @@ TEST_P(SpvParserTest_GlslStd450_Uinting_UintingUintingUinting, Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(Samples,
|
||||
@@ -1043,7 +1043,7 @@ TEST_F(SpvParserTest, RectifyOperandsAndResult_SAbs) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto body = ToString(fe.ast_body());
|
||||
auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -1095,7 +1095,7 @@ TEST_F(SpvParserTest, RectifyOperandsAndResult_SMax) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto body = ToString(fe.ast_body());
|
||||
auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -1153,7 +1153,7 @@ TEST_F(SpvParserTest, RectifyOperandsAndResult_SMin) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto body = ToString(fe.ast_body());
|
||||
auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -1211,7 +1211,7 @@ TEST_F(SpvParserTest, RectifyOperandsAndResult_SClamp) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto body = ToString(fe.ast_body());
|
||||
auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -1271,7 +1271,7 @@ TEST_F(SpvParserTest, RectifyOperandsAndResult_UMax) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto body = ToString(fe.ast_body());
|
||||
auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -1329,7 +1329,7 @@ TEST_F(SpvParserTest, RectifyOperandsAndResult_UMin) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto body = ToString(fe.ast_body());
|
||||
auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
@@ -1387,7 +1387,7 @@ TEST_F(SpvParserTest, RectifyOperandsAndResult_UClamp) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
auto body = ToString(fe.ast_body());
|
||||
auto body = ToString(p->get_module(), fe.ast_body());
|
||||
EXPECT_THAT(body, HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
|
||||
@@ -206,7 +206,7 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -218,7 +218,7 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvUnaryLogicalTest, LogicalNot_Vector) {
|
||||
@@ -233,7 +233,7 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -249,7 +249,7 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
struct BinaryData {
|
||||
@@ -296,7 +296,8 @@ TEST_P(SpvBinaryLogicalTest, EmitExpression) {
|
||||
<< GetParam().ast_type << "\n {\n Binary[not set]{"
|
||||
<< "\n " << GetParam().ast_lhs << "\n " << GetParam().ast_op
|
||||
<< "\n " << GetParam().ast_rhs;
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(ss.str())) << assembly;
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(ss.str()))
|
||||
<< assembly;
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
@@ -701,7 +702,7 @@ TEST_F(SpvFUnordTest, FUnordEqual_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -717,7 +718,7 @@ TEST_F(SpvFUnordTest, FUnordEqual_Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordEqual_Vector) {
|
||||
@@ -732,7 +733,7 @@ TEST_F(SpvFUnordTest, FUnordEqual_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -756,7 +757,7 @@ TEST_F(SpvFUnordTest, FUnordEqual_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordNotEqual_Scalar) {
|
||||
@@ -771,7 +772,7 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -787,7 +788,7 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordNotEqual_Vector) {
|
||||
@@ -802,7 +803,7 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -826,7 +827,7 @@ TEST_F(SpvFUnordTest, FUnordNotEqual_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordLessThan_Scalar) {
|
||||
@@ -841,7 +842,7 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -857,7 +858,7 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordLessThan_Vector) {
|
||||
@@ -872,7 +873,7 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -896,7 +897,7 @@ TEST_F(SpvFUnordTest, FUnordLessThan_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordLessThanEqual_Scalar) {
|
||||
@@ -911,7 +912,7 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -927,7 +928,7 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordLessThanEqual_Vector) {
|
||||
@@ -942,7 +943,7 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -966,7 +967,7 @@ TEST_F(SpvFUnordTest, FUnordLessThanEqual_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordGreaterThan_Scalar) {
|
||||
@@ -981,7 +982,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -997,7 +998,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordGreaterThan_Vector) {
|
||||
@@ -1012,7 +1013,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1036,7 +1037,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThan_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Scalar) {
|
||||
@@ -1051,7 +1052,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1067,7 +1068,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Scalar) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Vector) {
|
||||
@@ -1082,7 +1083,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1106,7 +1107,7 @@ TEST_F(SpvFUnordTest, FUnordGreaterThanEqual_Vector) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, Select_BoolCond_BoolParams) {
|
||||
@@ -1121,7 +1122,8 @@ TEST_F(SpvFUnordTest, Select_BoolCond_BoolParams) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1137,7 +1139,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_BoolParams) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, Select_BoolCond_IntScalarParams) {
|
||||
@@ -1152,7 +1154,8 @@ TEST_F(SpvFUnordTest, Select_BoolCond_IntScalarParams) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1168,7 +1171,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_IntScalarParams) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, Select_BoolCond_FloatScalarParams) {
|
||||
@@ -1183,7 +1186,8 @@ TEST_F(SpvFUnordTest, Select_BoolCond_FloatScalarParams) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1199,7 +1203,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_FloatScalarParams) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, Select_BoolCond_VectorParams) {
|
||||
@@ -1214,7 +1218,8 @@ TEST_F(SpvFUnordTest, Select_BoolCond_VectorParams) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1238,7 +1243,7 @@ TEST_F(SpvFUnordTest, Select_BoolCond_VectorParams) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvFUnordTest, Select_VecBoolCond_VectorParams) {
|
||||
@@ -1253,7 +1258,8 @@ TEST_F(SpvFUnordTest, Select_VecBoolCond_VectorParams) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1281,7 +1287,7 @@ TEST_F(SpvFUnordTest, Select_VecBoolCond_VectorParams) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
using SpvLogicalTest = SpvParserTestBase<::testing::Test>;
|
||||
@@ -1298,7 +1304,8 @@ TEST_F(SpvLogicalTest, Any) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1316,7 +1323,7 @@ TEST_F(SpvLogicalTest, Any) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvLogicalTest, All) {
|
||||
@@ -1331,7 +1338,8 @@ TEST_F(SpvLogicalTest, All) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1349,7 +1357,7 @@ TEST_F(SpvLogicalTest, All) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvLogicalTest, IsNan_Scalar) {
|
||||
@@ -1364,7 +1372,8 @@ TEST_F(SpvLogicalTest, IsNan_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1378,7 +1387,7 @@ TEST_F(SpvLogicalTest, IsNan_Scalar) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvLogicalTest, IsNan_Vector) {
|
||||
@@ -1393,7 +1402,8 @@ TEST_F(SpvLogicalTest, IsNan_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1411,7 +1421,7 @@ TEST_F(SpvLogicalTest, IsNan_Vector) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvLogicalTest, IsInf_Scalar) {
|
||||
@@ -1426,7 +1436,8 @@ TEST_F(SpvLogicalTest, IsInf_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1440,7 +1451,7 @@ TEST_F(SpvLogicalTest, IsInf_Scalar) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvLogicalTest, IsInf_Vector) {
|
||||
@@ -1455,7 +1466,8 @@ TEST_F(SpvLogicalTest, IsInf_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1473,7 +1485,7 @@ TEST_F(SpvLogicalTest, IsInf_Vector) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
// TODO(dneto): Kernel-guarded instructions.
|
||||
|
||||
@@ -50,7 +50,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreBoolConst) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{true}
|
||||
}
|
||||
@@ -82,7 +82,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreUintConst) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{42}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreIntConst) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{42}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreFloatConst) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{42.000000}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ TEST_F(SpvParserTest, EmitStatement_LoadBool) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_2
|
||||
none
|
||||
@@ -196,7 +196,8 @@ TEST_F(SpvParserTest, EmitStatement_LoadScalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_2
|
||||
none
|
||||
@@ -237,7 +238,8 @@ TEST_F(SpvParserTest, EmitStatement_UseLoadedScalarTwice) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_2
|
||||
none
|
||||
@@ -274,7 +276,7 @@ TEST_F(SpvParserTest, EmitStatement_StoreToModuleScopeVar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{42}
|
||||
})"));
|
||||
@@ -341,13 +343,13 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorSwizzle) {
|
||||
<< assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
MemberAccessor[not set]{
|
||||
Identifier[not set]{myvar}
|
||||
Identifier[not set]{z}
|
||||
}
|
||||
ScalarConstructor[not set]{42}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorConstOutOfBounds) {
|
||||
@@ -404,7 +406,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_VectorNonConstIndex) {
|
||||
<< assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
ArrayAccessor[not set]{
|
||||
Identifier[not set]{myvar}
|
||||
Identifier[not set]{x_11}
|
||||
@@ -441,7 +443,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Matrix) {
|
||||
<< assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
ArrayAccessor[not set]{
|
||||
Identifier[not set]{myvar}
|
||||
ScalarConstructor[not set]{2}
|
||||
@@ -484,7 +486,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Array) {
|
||||
<< assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
ArrayAccessor[not set]{
|
||||
Identifier[not set]{myvar}
|
||||
ScalarConstructor[not set]{2}
|
||||
@@ -526,7 +528,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Struct) {
|
||||
<< assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
MemberAccessor[not set]{
|
||||
Identifier[not set]{myvar}
|
||||
Identifier[not set]{age}
|
||||
@@ -574,7 +576,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Struct_DifferOnlyMemberName) {
|
||||
<< assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
MemberAccessor[not set]{
|
||||
Identifier[not set]{myvar}
|
||||
Identifier[not set]{age}
|
||||
@@ -587,7 +589,7 @@ Assignment{
|
||||
Identifier[not set]{ancientness}
|
||||
}
|
||||
ScalarConstructor[not set]{420.000000}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitStatement_AccessChain_StructNonConstIndex) {
|
||||
@@ -684,7 +686,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Struct_RuntimeArray) {
|
||||
<< assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
ArrayAccessor[not set]{
|
||||
MemberAccessor[not set]{
|
||||
Identifier[not set]{myvar}
|
||||
@@ -724,7 +726,7 @@ TEST_F(SpvParserTest, EmitStatement_AccessChain_Compound_Matrix_Vector) {
|
||||
<< assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
MemberAccessor[not set]{
|
||||
ArrayAccessor[not set]{
|
||||
Identifier[not set]{myvar}
|
||||
@@ -832,7 +834,7 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughAccessChain_NonCascaded) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
MemberAccessor[not set]{
|
||||
Identifier[not set]{myvar}
|
||||
Identifier[not set]{field0}
|
||||
@@ -848,7 +850,7 @@ Assignment{
|
||||
ScalarConstructor[not set]{1}
|
||||
}
|
||||
ScalarConstructor[not set]{0}
|
||||
})")) << ToString(fe.ast_body())
|
||||
})")) << ToString(p->get_module(), fe.ast_body())
|
||||
<< p->error();
|
||||
}
|
||||
|
||||
@@ -871,7 +873,7 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughAccessChain_Cascaded) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(Assignment{
|
||||
ArrayAccessor[not set]{
|
||||
MemberAccessor[not set]{
|
||||
Identifier[not set]{myvar}
|
||||
@@ -880,7 +882,7 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughAccessChain_Cascaded) {
|
||||
ScalarConstructor[not set]{1}
|
||||
}
|
||||
ScalarConstructor[not set]{0}
|
||||
})")) << ToString(fe.ast_body())
|
||||
})")) << ToString(p->get_module(), fe.ast_body())
|
||||
<< p->error();
|
||||
}
|
||||
|
||||
@@ -904,7 +906,8 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithoutHoisting) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_2
|
||||
none
|
||||
@@ -923,7 +926,7 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithoutHoisting) {
|
||||
Assignment{
|
||||
Identifier[not set]{x_2}
|
||||
ScalarConstructor[not set]{0}
|
||||
})")) << ToString(fe.ast_body())
|
||||
})")) << ToString(p->get_module(), fe.ast_body())
|
||||
<< p->error();
|
||||
}
|
||||
|
||||
@@ -959,7 +962,8 @@ TEST_F(SpvParserTest, RemapStorageBuffer_ThroughCopyObject_WithHoisting) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << assembly << p->error();
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
Eq(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_2
|
||||
function
|
||||
@@ -993,7 +997,7 @@ Assignment{
|
||||
ScalarConstructor[not set]{0}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body())
|
||||
)")) << ToString(p->get_module(), fe.ast_body())
|
||||
<< p->error();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,8 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Scalar) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_11
|
||||
none
|
||||
@@ -107,7 +108,7 @@ VariableDeclStatement{
|
||||
ScalarConstructor[not set]{0.000000}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Vector) {
|
||||
@@ -128,7 +129,8 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Vector) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_11
|
||||
none
|
||||
@@ -169,7 +171,7 @@ VariableDeclStatement{
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Matrix) {
|
||||
@@ -188,7 +190,8 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Matrix) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_11
|
||||
none
|
||||
@@ -209,7 +212,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Matrix) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) {
|
||||
@@ -229,7 +232,8 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_11
|
||||
none
|
||||
@@ -242,7 +246,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Array) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) {
|
||||
@@ -261,7 +265,8 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) {
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_11
|
||||
none
|
||||
@@ -276,7 +281,7 @@ TEST_F(SpvParserTestMiscInstruction, OpUndef_InFunction_Struct) {
|
||||
}
|
||||
}
|
||||
}
|
||||
})")) << ToString(fe.ast_body());
|
||||
})")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTestMiscInstruction, OpNop) {
|
||||
@@ -292,8 +297,8 @@ TEST_F(SpvParserTestMiscInstruction, OpNop) {
|
||||
<< p->error() << assembly;
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), Eq(R"(Return{}
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
// Test swizzle generation.
|
||||
@@ -324,7 +329,8 @@ TEST_P(SpvParserSwizzleTest, Sample) {
|
||||
ASSERT_NE(result, nullptr);
|
||||
std::ostringstream ss;
|
||||
result->to_str(ss, 0);
|
||||
EXPECT_THAT(ss.str(), Eq(GetParam().expected_expr));
|
||||
auto str = Demangler().Demangle(p->get_module(), ss.str());
|
||||
EXPECT_THAT(str, Eq(GetParam().expected_expr));
|
||||
} else {
|
||||
EXPECT_EQ(result, nullptr);
|
||||
EXPECT_FALSE(fe.success());
|
||||
|
||||
@@ -91,7 +91,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_AnonymousVars) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_1
|
||||
function
|
||||
@@ -129,7 +130,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_NamedVars) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
a
|
||||
function
|
||||
@@ -167,7 +169,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_MixedTypes) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
a
|
||||
function
|
||||
@@ -208,7 +211,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ScalarInitializers) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
a
|
||||
function
|
||||
@@ -281,7 +285,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ScalarNullInitializers) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
a
|
||||
function
|
||||
@@ -340,7 +345,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_VectorInitializer) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_200
|
||||
function
|
||||
@@ -354,7 +360,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_VectorInitializer) {
|
||||
}
|
||||
}
|
||||
}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitFunctionVariables_MatrixInitializer) {
|
||||
@@ -378,7 +384,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_MatrixInitializer) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_200
|
||||
function
|
||||
@@ -424,7 +431,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_200
|
||||
function
|
||||
@@ -438,7 +446,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer) {
|
||||
}
|
||||
}
|
||||
}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias) {
|
||||
@@ -458,7 +466,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_200
|
||||
function
|
||||
@@ -472,7 +481,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias) {
|
||||
}
|
||||
}
|
||||
}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Null) {
|
||||
@@ -491,7 +500,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Null) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_200
|
||||
function
|
||||
@@ -505,7 +515,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias_Null) {
|
||||
@@ -525,7 +535,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias_Null) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_200
|
||||
function
|
||||
@@ -539,7 +550,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_ArrayInitializer_Alias_Null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) {
|
||||
@@ -559,7 +570,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_200
|
||||
function
|
||||
@@ -578,7 +590,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer) {
|
||||
}
|
||||
}
|
||||
}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer_Null) {
|
||||
@@ -598,7 +610,8 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer_Null) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitFunctionVariables());
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
HasSubstr(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_200
|
||||
function
|
||||
@@ -617,7 +630,7 @@ TEST_F(SpvParserTest, EmitFunctionVariables_StructInitializer_Null) {
|
||||
}
|
||||
}
|
||||
}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest,
|
||||
@@ -642,7 +655,8 @@ TEST_F(SpvParserTest,
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
Eq(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_25
|
||||
function
|
||||
@@ -662,7 +676,7 @@ Assignment{
|
||||
}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitStatement_CombinatorialValue_Immediate_UsedTwice) {
|
||||
@@ -687,7 +701,8 @@ TEST_F(SpvParserTest, EmitStatement_CombinatorialValue_Immediate_UsedTwice) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
Eq(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_25
|
||||
function
|
||||
@@ -721,7 +736,7 @@ Assignment{
|
||||
Identifier[not set]{x_2}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest,
|
||||
@@ -757,7 +772,8 @@ TEST_F(SpvParserTest,
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
Eq(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_25
|
||||
function
|
||||
@@ -795,7 +811,7 @@ Assignment{
|
||||
ScalarConstructor[not set]{2}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
@@ -854,7 +870,7 @@ TEST_F(
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Assignment{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), Eq(R"(Assignment{
|
||||
Identifier[not set]{x_1}
|
||||
ScalarConstructor[not set]{0}
|
||||
}
|
||||
@@ -926,7 +942,7 @@ Assignment{
|
||||
ScalarConstructor[not set]{5}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
@@ -970,7 +986,8 @@ TEST_F(
|
||||
|
||||
// We don't hoist x_1 into its own mutable variable. It is emitted as
|
||||
// a const definition.
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
Eq(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1002,7 +1019,7 @@ Assignment{
|
||||
Identifier[not set]{x_3}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest,
|
||||
@@ -1053,7 +1070,7 @@ TEST_F(SpvParserTest,
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), Eq(R"(If{
|
||||
(
|
||||
ScalarConstructor[not set]{true}
|
||||
)
|
||||
@@ -1092,7 +1109,7 @@ TEST_F(SpvParserTest,
|
||||
}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
@@ -1138,7 +1155,7 @@ TEST_F(
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(If{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), Eq(R"(If{
|
||||
(
|
||||
ScalarConstructor[not set]{true}
|
||||
)
|
||||
@@ -1179,7 +1196,7 @@ TEST_F(
|
||||
}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest,
|
||||
@@ -1219,7 +1236,8 @@ TEST_F(SpvParserTest,
|
||||
|
||||
// We don't hoist x_1 into its own mutable variable. It is emitted as
|
||||
// a const definition.
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
Eq(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1247,7 +1265,7 @@ If{
|
||||
}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) {
|
||||
@@ -1291,7 +1309,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), Eq(R"(Loop{
|
||||
VariableDeclStatement{
|
||||
Variable{
|
||||
x_2_phi
|
||||
@@ -1386,7 +1404,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_SingleBlockLoopIndex) {
|
||||
}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) {
|
||||
@@ -1433,7 +1451,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(Loop{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), Eq(R"(Loop{
|
||||
VariableDeclStatement{
|
||||
Variable{
|
||||
x_2_phi
|
||||
@@ -1541,7 +1559,7 @@ TEST_F(SpvParserTest, EmitStatement_Phi_MultiBlockLoopIndex) {
|
||||
}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitStatement_Phi_ValueFromLoopBodyAndContinuing) {
|
||||
@@ -1589,7 +1607,8 @@ TEST_F(SpvParserTest, EmitStatement_Phi_ValueFromLoopBodyAndContinuing) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
Eq(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_101
|
||||
none
|
||||
@@ -1707,7 +1726,7 @@ Loop{
|
||||
}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body())
|
||||
)")) << ToString(p->get_module(), fe.ast_body())
|
||||
<< assembly;
|
||||
}
|
||||
|
||||
@@ -1757,7 +1776,8 @@ TEST_F(SpvParserTest, EmitStatement_Phi_FromElseAndThen) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
Eq(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_101
|
||||
none
|
||||
@@ -1831,7 +1851,7 @@ Loop{
|
||||
}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitStatement_Phi_FromHeaderAndThen) {
|
||||
@@ -1877,7 +1897,8 @@ TEST_F(SpvParserTest, EmitStatement_Phi_FromHeaderAndThen) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
Eq(R"(VariableDeclStatement{
|
||||
VariableConst{
|
||||
x_101
|
||||
none
|
||||
@@ -1946,7 +1967,7 @@ Loop{
|
||||
}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
TEST_F(SpvParserTest, EmitStatement_UseInPhiCountsAsUse) {
|
||||
@@ -1983,7 +2004,8 @@ TEST_F(SpvParserTest, EmitStatement_UseInPhiCountsAsUse) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
EXPECT_THAT(ToString(fe.ast_body()), Eq(R"(VariableDeclStatement{
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()),
|
||||
Eq(R"(VariableDeclStatement{
|
||||
Variable{
|
||||
x_101_phi
|
||||
function
|
||||
@@ -2043,7 +2065,7 @@ VariableDeclStatement{
|
||||
}
|
||||
}
|
||||
Return{}
|
||||
)")) << ToString(fe.ast_body());
|
||||
)")) << ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -199,10 +199,10 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
|
||||
)"));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_ast = p->get_module().to_str();
|
||||
const auto module_ast =
|
||||
Demangler().Demangle(p->get_module(), p->get_module().to_str());
|
||||
EXPECT_THAT(module_ast, HasSubstr(R"(
|
||||
Function )" + p->get_module().GetSymbol("leaf").to_str() +
|
||||
R"( -> __u32
|
||||
Function leaf -> __u32
|
||||
()
|
||||
{
|
||||
Return{
|
||||
@@ -211,8 +211,7 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Function )" + p->get_module().GetSymbol("branch").to_str() +
|
||||
R"( -> __u32
|
||||
Function branch -> __u32
|
||||
()
|
||||
{
|
||||
VariableDeclStatement{
|
||||
@@ -235,8 +234,7 @@ TEST_F(SpvParserTest, EmitFunctions_CalleePrecedesCaller) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Function )" + p->get_module().GetSymbol("root").to_str() +
|
||||
R"( -> __void
|
||||
Function root -> __void
|
||||
()
|
||||
{
|
||||
VariableDeclStatement{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "src/demangler.h"
|
||||
#include "src/reader/spirv/function.h"
|
||||
#include "src/reader/spirv/parser_impl.h"
|
||||
#include "src/reader/spirv/parser_impl_test_helper.h"
|
||||
@@ -1128,7 +1129,8 @@ TEST_P(SpvParserTest_DeclUnderspecifiedHandle, Variable) {
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly;
|
||||
EXPECT_TRUE(p->error().empty()) << p->error();
|
||||
const auto module = p->module().to_str();
|
||||
const auto module =
|
||||
Demangler().Demangle(p->get_module(), p->get_module().to_str());
|
||||
EXPECT_THAT(module, HasSubstr(GetParam().var_decl)) << module;
|
||||
}
|
||||
|
||||
@@ -1300,7 +1302,8 @@ TEST_P(SpvParserTest_SampledImageAccessTest, Variable) {
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly;
|
||||
EXPECT_TRUE(p->error().empty()) << p->error();
|
||||
const auto module = p->module().to_str();
|
||||
const auto module =
|
||||
Demangler().Demangle(p->get_module(), p->get_module().to_str());
|
||||
EXPECT_THAT(module, HasSubstr(GetParam().var_decl))
|
||||
<< "DECLARATIONS ARE BAD " << module;
|
||||
EXPECT_THAT(module, HasSubstr(GetParam().texture_builtin))
|
||||
@@ -2373,7 +2376,8 @@ TEST_P(SpvParserTest_ImageAccessTest, Variable) {
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModule()) << p->error() << assembly;
|
||||
EXPECT_TRUE(p->error().empty()) << p->error();
|
||||
const auto module = p->module().to_str();
|
||||
const auto module =
|
||||
Demangler().Demangle(p->get_module(), p->get_module().to_str());
|
||||
EXPECT_THAT(module, HasSubstr(GetParam().var_decl))
|
||||
<< "DECLARATIONS ARE BAD " << module;
|
||||
EXPECT_THAT(module, HasSubstr(GetParam().texture_builtin))
|
||||
@@ -3670,7 +3674,8 @@ TEST_P(SpvParserTest_ImageCoordsTest, MakeCoordinateOperandsForImageAccess) {
|
||||
std::vector<std::string> result_strings;
|
||||
for (auto* expr : result) {
|
||||
ASSERT_NE(expr, nullptr);
|
||||
result_strings.push_back(expr->str());
|
||||
result_strings.push_back(
|
||||
Demangler().Demangle(p->get_module(), expr->str()));
|
||||
}
|
||||
EXPECT_THAT(result_strings,
|
||||
::testing::ContainerEq(GetParam().expected_expressions));
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "src/demangler.h"
|
||||
#include "src/reader/spirv/function.h"
|
||||
#include "src/reader/spirv/parser_impl.h"
|
||||
#include "src/reader/spirv/parser_impl_test_helper.h"
|
||||
@@ -326,7 +327,8 @@ TEST_F(SpvParserTest, ModuleScopeVar_BuiltinPosition_StorePosition) {
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = p->module().to_str();
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_module(), p->get_module().to_str());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Assignment{
|
||||
Identifier[not set]{gl_Position}
|
||||
@@ -357,7 +359,8 @@ TEST_F(SpvParserTest,
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = p->module().to_str();
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_module(), p->get_module().to_str());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
Assignment{
|
||||
MemberAccessor[not set]{
|
||||
@@ -388,7 +391,8 @@ TEST_F(SpvParserTest,
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
EXPECT_TRUE(p->BuildAndParseInternalModule());
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
const auto module_str = p->module().to_str();
|
||||
const auto module_str =
|
||||
Demangler().Demangle(p->get_module(), p->get_module().to_str());
|
||||
EXPECT_THAT(module_str, HasSubstr(R"(
|
||||
{
|
||||
Assignment{
|
||||
@@ -1654,7 +1658,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_UsedInFunction) {
|
||||
FunctionEmitter fe(p.get(), *spirv_function(p.get(), 100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
EXPECT_TRUE(p->error().empty());
|
||||
EXPECT_THAT(ToString(fe.ast_body()), HasSubstr(R"(
|
||||
EXPECT_THAT(ToString(p->get_module(), fe.ast_body()), HasSubstr(R"(
|
||||
VariableConst{
|
||||
x_1
|
||||
none
|
||||
@@ -1667,7 +1671,7 @@ TEST_F(SpvParserTest, ModuleScopeVar_ScalarSpecConstant_UsedInFunction) {
|
||||
}
|
||||
}
|
||||
})"))
|
||||
<< ToString(fe.ast_body());
|
||||
<< ToString(p->get_module(), fe.ast_body());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "source/opt/ir_context.h"
|
||||
#include "src/demangler.h"
|
||||
#include "src/reader/spirv/parser_impl.h"
|
||||
|
||||
namespace tint {
|
||||
@@ -59,12 +60,13 @@ using SpvParserTest = SpvParserTestBase<::testing::Test>;
|
||||
/// Returns the string dump of a function body.
|
||||
/// @param body the statement in the body
|
||||
/// @returnss the string dump of a function body.
|
||||
inline std::string ToString(const ast::BlockStatement* body) {
|
||||
inline std::string ToString(const ast::Module& mod,
|
||||
const ast::BlockStatement* body) {
|
||||
std::ostringstream outs;
|
||||
for (const auto* stmt : *body) {
|
||||
stmt->to_str(outs, 0);
|
||||
}
|
||||
return outs.str();
|
||||
return Demangler().Demangle(mod, outs.str());
|
||||
}
|
||||
|
||||
} // namespace spirv
|
||||
|
||||
@@ -2026,7 +2026,9 @@ Maybe<ast::CallStatement*> ParserImpl::func_call_stmt() {
|
||||
return Failure::kErrored;
|
||||
|
||||
return create<ast::CallStatement>(create<ast::CallExpression>(
|
||||
source, create<ast::IdentifierExpression>(name), std::move(params)));
|
||||
source,
|
||||
create<ast::IdentifierExpression>(module_.RegisterSymbol(name), name),
|
||||
std::move(params)));
|
||||
}
|
||||
|
||||
// break_stmt
|
||||
@@ -2097,7 +2099,8 @@ Maybe<ast::Expression*> ParserImpl::primary_expression() {
|
||||
}
|
||||
|
||||
if (match(Token::Type::kIdentifier))
|
||||
return create<ast::IdentifierExpression>(t.source(), t.to_str());
|
||||
return create<ast::IdentifierExpression>(
|
||||
t.source(), module_.RegisterSymbol(t.to_str()), t.to_str());
|
||||
|
||||
auto type = type_decl();
|
||||
if (type.errored)
|
||||
@@ -2172,7 +2175,8 @@ Maybe<ast::Expression*> ParserImpl::postfix_expr(ast::Expression* prefix) {
|
||||
|
||||
return postfix_expr(create<ast::MemberAccessorExpression>(
|
||||
ident.source, prefix,
|
||||
create<ast::IdentifierExpression>(ident.source, ident.value)));
|
||||
create<ast::IdentifierExpression>(
|
||||
ident.source, module_.RegisterSymbol(ident.value), ident.value)));
|
||||
}
|
||||
|
||||
return prefix;
|
||||
|
||||
Reference in New Issue
Block a user