Mesh Shader example.
{
class TriangleDemoApp : public RenderApplication
{
{
createPass(
mRenderer.get(),
"Mesh Task", RHIDeviceQueueType::Graphics,
[=](PassHandle self, Renderer* r)
{
r->BindBackbufferRTV(self);
r->BindShader(self, RHIShaderStageBits::Task, "taskMain", "data/shaders/MeshShaderTask.spv");
r->BindShader(self, RHIShaderStageBits::Mesh, "meshMain", "data/shaders/MeshShaderMesh.spv");
r->BindShader(self, RHIShaderStageBits::Fragment, "fragMain", "data/shaders/MeshShaderFrag.spv");
r->BindPushConstant(self, RHIShaderStageBits::Task, 0, sizeof(float));
},
[=, this](PassHandle self, Renderer* r, RHICommandList* cmd)
{
auto const& img_wh = r->GetSwapchainExtent();
r->CmdBeginGraphics(self, cmd, img_wh);
r->CmdSetPipeline(self, cmd);
r->CmdSetPushConstant(self, cmd, RHIShaderStageBits::Task, 0, GetApplicationTime());
cmd->SetViewport(0, 0, img_wh.x, img_wh.y)
.SetScissor(0, 0, img_wh.x, img_wh.y)
.DrawMeshTasks(1, 1, 1)
.EndGraphics();
});
}
};
}
int main(
int argc,
char** argv)
{
app.
Initialize<VulkanApplication>({.windowTitle =
"Mesh Shader"});
}
int main(int argc, char **argv)
Definition ImGui.cpp:26
Definition MeshShader.cpp:11
void OnRendererSetup() override
Set up the renderer by creating passes, resources, and other configurations.
Definition MeshShader.cpp:12
void Initialize(ApplicationInitDesc const &desc={}, Args &&... args)
Initialize the application with the specified RHI backend.
Definition Application.hpp:205
UniquePtr< Renderer > mRenderer
Definition Application.hpp:102
void RunForever()
Start the Render thread and run the application loop indefinitely, until the window is closed or the ...
Definition Application.cpp:127
For a complete list of examples, see the Examples Page.
Definition Examples.hpp:12