mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
Add helper for function creation.
This CL adds a Func helper to the ast builder class. The helper is then used through the various files to simplify function creation. Change-Id: Ie93777586e9311d82cff5932dfba2c4ca763ae08 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35823 Commit-Queue: dan sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
5e5e36e7d2
commit
181d8baf8f
@@ -46,12 +46,10 @@ class VertexPullingHelper : public ast::BuilderWithModule {
|
||||
|
||||
// Create basic module with an entry point and vertex function
|
||||
void InitBasicModule() {
|
||||
auto* func = create<ast::Function>(
|
||||
mod->RegisterSymbol("main"), "main", ast::VariableList{},
|
||||
mod->create<ast::type::Void>(),
|
||||
create<ast::BlockStatement>(ast::StatementList{}),
|
||||
ast::FunctionDecorationList{
|
||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex)});
|
||||
auto* func =
|
||||
Func("main", ast::VariableList{}, ty.void_, ast::StatementList{},
|
||||
ast::FunctionDecorationList{
|
||||
create<ast::StageDecoration>(ast::PipelineStage::kVertex)});
|
||||
mod->AddFunction(func);
|
||||
}
|
||||
|
||||
@@ -115,13 +113,11 @@ TEST_F(VertexPullingTest, Error_InvalidEntryPoint) {
|
||||
}
|
||||
|
||||
TEST_F(VertexPullingTest, Error_EntryPointWrongStage) {
|
||||
auto* func = create<ast::Function>(
|
||||
mod->RegisterSymbol("main"), "main", ast::VariableList{},
|
||||
mod->create<ast::type::Void>(),
|
||||
create<ast::BlockStatement>(ast::StatementList{}),
|
||||
ast::FunctionDecorationList{
|
||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||
});
|
||||
auto* func =
|
||||
Func("main", ast::VariableList{}, ty.void_, ast::StatementList{},
|
||||
ast::FunctionDecorationList{
|
||||
create<ast::StageDecoration>(ast::PipelineStage::kFragment),
|
||||
});
|
||||
mod->AddFunction(func);
|
||||
|
||||
InitTransform({});
|
||||
|
||||
Reference in New Issue
Block a user