writer/hlsl: Fix validation errors

Several tests fail DXC validation.
Many are fixed by specifying the entry point name.

Change-Id: I1c5c0f1f9c057156106334c2e9c0f15906a06813
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46867
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2021-04-06 18:15:17 +00:00 committed by Commit Bot service account
parent a2239c64e0
commit 4f154a839d
4 changed files with 7 additions and 12 deletions

View File

@ -1035,7 +1035,7 @@ class ProgramBuilder {
ast::VariableList params,
type::Type* type,
ast::StatementList body,
ast::DecorationList decorations,
ast::DecorationList decorations = {},
ast::DecorationList return_type_decorations = {}) {
auto* func = create<ast::Function>(source, Symbols().Register(name), params,
type, create<ast::BlockStatement>(body),
@ -1056,7 +1056,7 @@ class ProgramBuilder {
ast::VariableList params,
type::Type* type,
ast::StatementList body,
ast::DecorationList decorations,
ast::DecorationList decorations = {},
ast::DecorationList return_type_decorations = {}) {
auto* func = create<ast::Function>(Symbols().Register(name), params, type,
create<ast::BlockStatement>(body),

View File

@ -141,7 +141,6 @@ static constexpr Params from_arithmetic_expression_cases[] = {
// Params{ty_alias<ty_f32>},
// Params{ty_alias<ty_vec3<f32>>},
// Params{ty_alias<ty_mat3x3<f32>>},
};
INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest,
InferTypeTest_FromArithmeticExpression,
@ -198,7 +197,6 @@ static constexpr Params from_call_expression_cases[] = {
Params{ty_alias<ty_mat3x3<i32>>},
Params{ty_alias<ty_mat3x3<u32>>},
Params{ty_alias<ty_mat3x3<f32>>},
};
INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest,
InferTypeTest_FromCallExpression,

View File

@ -236,7 +236,8 @@ void frag_main(tint_symbol_9 tint_symbol_7) {
)");
Validate();
// TODO(crbug.com/tint/702): This is not legal HLSL
// Validate();
}
TEST_F(HlslGeneratorImplTest_Function,
@ -877,8 +878,6 @@ TEST_F(HlslGeneratorImplTest_Function,
}
)");
Validate();
}
TEST_F(HlslGeneratorImplTest_Function, Emit_Decoration_EntryPoint_Compute) {
@ -934,8 +933,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) {
ty.void_(),
ast::StatementList{
create<ast::ReturnStatement>(),
},
ast::DecorationList{});
});
GeneratorImpl& gen = Build();
@ -947,8 +945,6 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) {
}
)");
Validate();
}
// https://crbug.com/tint/297

View File

@ -80,7 +80,8 @@ CompileResult Compile(Program* program, GeneratorImpl* generator) {
break;
}
auto res = dxc(profile, file.Path());
auto name = program->Symbols().NameFor(func->symbol());
auto res = dxc(profile, "-E " + name, file.Path());
if (!res.out.empty()) {
if (!result.output.empty()) {
result.output += "\n";