4 using namespace RenderCore;
11 template<
typename FSetup,
typename FRecord>
18 return r->
CreatePass(name, RHIDeviceQueueType::Graphics, 0u,
30 {RHIAttachmentLoadOp::DontCare});
31 cmd->SetViewport(0, 0, img_wh.x, img_wh.y)
32 .SetScissor(0, 0, img_wh.x, img_wh.y);
37 template<
typename FSetup>
54 template<
typename FSetup,
typename FRecord>
64 return r->
CreatePass(name, RHIDeviceQueueType::Graphics, 0u,
73 if (img_wh.x == 0u || img_wh.y == 0u)
76 img_wh = {rtv->
mDesc.
extent.x, rtv->mDesc.extent.y};
81 {RHIAttachmentLoadOp::DontCare});
82 cmd->SetViewport(0, 0, img_wh.x, img_wh.y)
83 .SetScissor(0, 0, img_wh.x, img_wh.y);
88 template<
typename FSetup>
115 r->
BindTextureSRV(self, copy_source,
"srcTexture", RHIPipelineStageBits::FragmentShader, {
130 name, RHIDeviceQueueType::Graphics, 0u,
133 r->
BindShader(self, RHIShaderStageBits::Vertex,
"vertMain",
135 r->
BindShader(self, RHIShaderStageBits::Fragment,
"fragMain",
137 r->
BindTextureSRV(self, srcDepth,
"srcDepth", RHIPipelineStageBits::FragmentShader,
140 RHITextureAspectFlagBits::Color)});
144 RHITextureAspectFlagBits::Depth)});
154 r->
CmdBeginGraphics(self, cmd, extent, {}, {RHIAttachmentLoadOp::DontCare});
155 cmd->SetViewport(0, 0, extent.x, extent.y).SetScissor(0, 0, extent.x, extent.y);
virtual String ResolveRelativePathBase(StringView path="") const =0
Retrives path relative to the application executable.
Definition Command.hpp:42
Definition Resource.hpp:216
const RHITextureDesc mDesc
Definition Resource.hpp:221
Renderer implementing a Frame Graph system with automatic resource tracking and synchronization.
Definition Renderer.hpp:377
PassHandle CreatePass(StringView name, RHIDeviceQueueType queue, size_t priority, FSetup &&setup, FRecord &&record)
Create a render pass from a Setup(Renderer*, PassHandle) and Record(Renderer*, PassHandle,...
Definition Renderer.hpp:680
Variant< RHIBuffer *, RHITexture *, RHIAccelerationStructure * > DerefResource(const ResourceHandle handle) const
Dereference a resource handle to its underlying RHI resource.
Definition Renderer.hpp:1068
void BindTextureRTV(PassHandle pass, ResourceHandle texture, RHITextureViewDesc const &desc, RHIPipelineState::PipelineStateDesc::Attachment::Blending const &blending={}) const
Binds a texture as a Render Target View (color attachment) for a graphics pass.
Definition Renderer.cpp:388
void PassSetRasterizerFlags(PassHandle pass, RHIPipelineState::PipelineStateDesc::Rasterizer const &rasterizer={}, RHIPipelineState::PipelineStateDesc::DepthStencil const &depth_stencil={}) const
Sets the rasterizer and depth-stencil state for a graphics pass.
Definition Renderer.cpp:504
void BindTextureSRV(PassHandle pass, ResourceHandle texture, StringView bind_point, RHIPipelineStage stage, RHITextureViewDesc const &desc) const
Binds a texture as a Shader Resource View (read-only sampling / fetch).
Definition Renderer.cpp:351
void BindTextureSampler(PassHandle pass, ResourceHandle sampler, StringView bind_point) const
Binds a sampler to the shader.
Definition Renderer.cpp:303
const RHIApplication * GetApplication() const
Get the RHIApplication this Renderer was constructed with.
Definition Renderer.hpp:1034
void BindBackbufferRTV(PassHandle pass, RHIPipelineState::PipelineStateDesc::Attachment::Blending const &blending={}) const
Definition Renderer.cpp:430
void CmdSetPipeline(PassHandle pass, RHICommandList *cmd) const
Helper that sets the current pass's PSO and descriptor sets to the current command list.
Definition Renderer.cpp:2174
void CmdBeginGraphics(PassHandle pass, RHICommandList *cmd, RHIExtent2D const &extent, Span< const RHIColorAttachmentLoad > rtv_loads={}, RHIDepthAttachmentLoad dsv_load={RHIAttachmentLoadOp::Clear, {0.0f, 0u}})
Helper that pushes correct descriptor sets and PSO to the current command list, and pushes correct Be...
Definition Renderer.cpp:2209
void BindTextureDSV(PassHandle pass, ResourceHandle texture, RHITextureViewDesc const &desc, bool readOnly=false) const
Binds a texture as a Depth-Stencil View for a graphics pass.
Definition Renderer.cpp:408
RHIExtent2D GetSwapchainExtent() const
Get the current swapchain extents.
Definition Renderer.hpp:1039
void BindShader(PassHandle pass, RHIShaderStage stage, StringView entry_point, StringView shader_path, Span< const char > specializationData={}, uint32_t rtHitGroupIndex=0, RHIPipelineState::PipelineStateDesc::RayTracingHitGroupType rtHitGroupType=RHIPipelineState::PipelineStateDesc::RayTracingHitGroupType::Triangles) const
Binds shader file path to a certain pass at a certain stage.
Definition Renderer.cpp:221
std::basic_string_view< char > StringView
Alias for std::basic_string_view<char>
Definition Container.hpp:56
RHIResourceFormat
Definition Common.hpp:34
glm::vec< 2, uint32_t > RHIExtent2D
Definition Common.hpp:10
Handle ResourceHandle
Definition Renderer.hpp:22
Handle PassHandle
Definition Renderer.hpp:21
Definition CSClearBuffer.hpp:5
PassHandle createPSFullscreenPass(Renderer *r, StringView name, FSetup &&setup, FRecord &&record)
Creates a full-screen triangle pass that writes to the current backbuffer.
Definition PSFullscreen.hpp:12
PassHandle createPSDepthCopyPass(Renderer *r, StringView name, ResourceHandle srcDepth, ResourceHandle dstDepth, RHIExtent2D extent, RHIResourceFormat srcFormat=RHIResourceFormat::R32SignedFloat)
Definition PSFullscreen.hpp:125
PassHandle createPSBackbufferBlitPass(Renderer *r, StringView name, ResourceHandle copy_sampler, ResourceHandle copy_source, RHIResourceFormat srcFormat=RHIResourceFormat::R8G8B8A8Unorm)
Creates a full-screen triangle pass that renders a texture to the current backbuffer.
Definition PSFullscreen.hpp:103
PassHandle createPSFullscreenPassRTV(Renderer *r, StringView name, ResourceHandle rtvTexture, RHITextureViewDesc const &rtvViewDesc, RHIExtent2D extent, FSetup &&setup, FRecord &&record)
Creates a full-screen triangle pass that writes to an arbitrary texture RTV instead of the backbuffer...
Definition PSFullscreen.hpp:55
@ Always
Definition PipelineState.hpp:130
@ CullNone
Definition PipelineState.hpp:99
RHIExtent3D extent
Definition Resource.hpp:146
static RHITextureSubresourceRange Create(RHITextureAspectFlag aspect=RHITextureAspectFlagBits::Color, uint32_t base_mip_level=0, uint32_t mip_count=1, uint32_t base_array_layer=0, uint32_t layer_count=1)
Helper function to create a Subresource Range with default parameters.
Definition Resource.hpp:191
Definition Resource.hpp:210
RHIResourceFormat format
Definition Resource.hpp:211
Default "no-op" functor for Record()
Definition Renderer.hpp:247