Foundation
Loading...
Searching...
No Matches
ManyPass.cpp

Example using 2 graphics passes with alpha blending on the RenderTarget backbuffer.

#include "Examples.hpp"
namespace Examples {
class ManyPassDemoApp : public RenderApplication {
void OnRendererSetup() override {
createPSFullscreenPass(
mRenderer.get(), "ManyPass 1",
[=](PassHandle self, Renderer* r) {
r->BindShader(self, RHIShaderStageBits::Fragment, "pass1", "data/shaders/ManyPass.spv");
r->BindPushConstant(self, RHIShaderStageBits::Fragment, 0, sizeof(float));
r->BindBackbufferRTV(self);
},
[=, this](PassHandle self, Renderer* r, RHICommandList* cmd) {
r->CmdSetPushConstant(self, cmd, RHIShaderStageBits::Fragment, 0, GetApplicationTime());
}
);
createPSFullscreenPass(
mRenderer.get(), "ManyPass 2",
[=](PassHandle self, Renderer* r)
{
r->BindShader(self, RHIShaderStageBits::Fragment, "pass2", "data/shaders/ManyPass.spv");
r->BindPushConstant(self, RHIShaderStageBits::Fragment, 0, sizeof(float));
r->BindBackbufferRTV(self,
RHIPipelineState::PipelineStateDesc::Attachment::Blending::GetAlphaBlending());
},
[=, this](PassHandle self, Renderer* r, RHICommandList* cmd)
{ r->CmdSetPushConstant(self, cmd, RHIShaderStageBits::Fragment, 0, GetApplicationTime()); });
}
};
}
int main(int argc, char** argv) {
app.Initialize<VulkanApplication>({ .windowTitle = "ManyPass" });
app.RunForever();
}
int main(int argc, char **argv)
Definition ImGui.cpp:26
Definition ManyPass.cpp:7
void OnRendererSetup() override
Set up the renderer by creating passes, resources, and other configurations.
Definition ManyPass.cpp:8
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