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:
parent
a2239c64e0
commit
4f154a839d
|
@ -1035,7 +1035,7 @@ class ProgramBuilder {
|
||||||
ast::VariableList params,
|
ast::VariableList params,
|
||||||
type::Type* type,
|
type::Type* type,
|
||||||
ast::StatementList body,
|
ast::StatementList body,
|
||||||
ast::DecorationList decorations,
|
ast::DecorationList decorations = {},
|
||||||
ast::DecorationList return_type_decorations = {}) {
|
ast::DecorationList return_type_decorations = {}) {
|
||||||
auto* func = create<ast::Function>(source, Symbols().Register(name), params,
|
auto* func = create<ast::Function>(source, Symbols().Register(name), params,
|
||||||
type, create<ast::BlockStatement>(body),
|
type, create<ast::BlockStatement>(body),
|
||||||
|
@ -1056,7 +1056,7 @@ class ProgramBuilder {
|
||||||
ast::VariableList params,
|
ast::VariableList params,
|
||||||
type::Type* type,
|
type::Type* type,
|
||||||
ast::StatementList body,
|
ast::StatementList body,
|
||||||
ast::DecorationList decorations,
|
ast::DecorationList decorations = {},
|
||||||
ast::DecorationList return_type_decorations = {}) {
|
ast::DecorationList return_type_decorations = {}) {
|
||||||
auto* func = create<ast::Function>(Symbols().Register(name), params, type,
|
auto* func = create<ast::Function>(Symbols().Register(name), params, type,
|
||||||
create<ast::BlockStatement>(body),
|
create<ast::BlockStatement>(body),
|
||||||
|
|
|
@ -141,7 +141,6 @@ static constexpr Params from_arithmetic_expression_cases[] = {
|
||||||
// Params{ty_alias<ty_f32>},
|
// Params{ty_alias<ty_f32>},
|
||||||
// Params{ty_alias<ty_vec3<f32>>},
|
// Params{ty_alias<ty_vec3<f32>>},
|
||||||
// Params{ty_alias<ty_mat3x3<f32>>},
|
// Params{ty_alias<ty_mat3x3<f32>>},
|
||||||
|
|
||||||
};
|
};
|
||||||
INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest,
|
INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest,
|
||||||
InferTypeTest_FromArithmeticExpression,
|
InferTypeTest_FromArithmeticExpression,
|
||||||
|
@ -198,7 +197,6 @@ static constexpr Params from_call_expression_cases[] = {
|
||||||
Params{ty_alias<ty_mat3x3<i32>>},
|
Params{ty_alias<ty_mat3x3<i32>>},
|
||||||
Params{ty_alias<ty_mat3x3<u32>>},
|
Params{ty_alias<ty_mat3x3<u32>>},
|
||||||
Params{ty_alias<ty_mat3x3<f32>>},
|
Params{ty_alias<ty_mat3x3<f32>>},
|
||||||
|
|
||||||
};
|
};
|
||||||
INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest,
|
INSTANTIATE_TEST_SUITE_P(ResolverTypeConstructorValidationTest,
|
||||||
InferTypeTest_FromCallExpression,
|
InferTypeTest_FromCallExpression,
|
||||||
|
|
|
@ -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,
|
TEST_F(HlslGeneratorImplTest_Function,
|
||||||
|
@ -877,8 +878,6 @@ TEST_F(HlslGeneratorImplTest_Function,
|
||||||
}
|
}
|
||||||
|
|
||||||
)");
|
)");
|
||||||
|
|
||||||
Validate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Function, Emit_Decoration_EntryPoint_Compute) {
|
TEST_F(HlslGeneratorImplTest_Function, Emit_Decoration_EntryPoint_Compute) {
|
||||||
|
@ -934,8 +933,7 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) {
|
||||||
ty.void_(),
|
ty.void_(),
|
||||||
ast::StatementList{
|
ast::StatementList{
|
||||||
create<ast::ReturnStatement>(),
|
create<ast::ReturnStatement>(),
|
||||||
},
|
});
|
||||||
ast::DecorationList{});
|
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
|
@ -947,8 +945,6 @@ TEST_F(HlslGeneratorImplTest_Function, Emit_Function_WithArrayParams) {
|
||||||
}
|
}
|
||||||
|
|
||||||
)");
|
)");
|
||||||
|
|
||||||
Validate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://crbug.com/tint/297
|
// https://crbug.com/tint/297
|
||||||
|
|
|
@ -80,7 +80,8 @@ CompileResult Compile(Program* program, GeneratorImpl* generator) {
|
||||||
break;
|
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 (!res.out.empty()) {
|
||||||
if (!result.output.empty()) {
|
if (!result.output.empty()) {
|
||||||
result.output += "\n";
|
result.output += "\n";
|
||||||
|
|
Loading…
Reference in New Issue