4#ifndef GREM_GRAPHICS_RENDER_PASS_HPP
5#define GREM_GRAPHICS_RENDER_PASS_HPP
32struct RenderPassImplementation;
206 :
RenderPass(device,
Span{&renderTarget, 1}, clearMode, viewport) {}
283 :
RenderPass(device, resolveTarget, resolveMode,
Span{&renderTarget, 1}, clearMode, viewport) {}
409 template <
typename Vertex,
typename Index,
typename Parameters,
typename Instance,
typename... Buffers>
411 const Buffers&... buffers) {
415 sortBufferHandles(bufferHandles);
416 return draw(drawCommandBuffer.lock(), instanceBuffer.lock(), bufferHandles);
438 template <
typename Vertex,
typename Index,
typename Parameters,
typename... Buffers>
443 sortBufferHandles(bufferHandles);
477 return drawShaded({}, std::move(drawCommandBufferHandle), std::move(instanceBufferHandle), bufferHandles);
504 template <
typename Vertex,
typename Index,
typename Parameters,
typename Instance,
typename... Buffers>
510 sortBufferHandles(bufferHandles);
511 return drawShaded(shaderPipelineOverride.lock(), drawCommandBuffer.lock(), instanceBuffer.lock(), bufferHandles);
534 template <
typename Vertex,
typename Index,
typename Parameters,
typename... Buffers>
540 sortBufferHandles(bufferHandles);
602 template <typename Vertex, typename Index, typename Parameters, typename Instance, typename... Buffers>
604 const Buffers&... buffers) {
608 sortBufferHandles(bufferHandles);
609 return drawUnordered(drawCommandBuffer.lock(), instanceBuffer.lock(), bufferHandles);
631 template <
typename Vertex,
typename Index,
typename Parameters,
typename... Buffers>
636 sortBufferHandles(bufferHandles);
670 return drawShadedUnordered({}, std::move(drawCommandBufferHandle), std::move(instanceBufferHandle), bufferHandles);
697 template <
typename Vertex,
typename Index,
typename Parameters,
typename Instance,
typename... Buffers>
703 sortBufferHandles(bufferHandles);
704 return drawShadedUnordered(shaderPipelineOverride.lock(), drawCommandBuffer.lock(), instanceBuffer.lock(), bufferHandles);
727 template <
typename Vertex,
typename Index,
typename Parameters,
typename... Buffers>
733 sortBufferHandles(bufferHandles);
770 SharedPointer<UnorderedDrawCommandBufferImplementation> drawCommandBufferHandle,
SharedPointer<InstanceBufferImplementation> instanceBufferHandle,
787 return implementation;
798 [[nodiscard]] RenderPassImplementation*
get() noexcept {
799 return implementation.get();
810 [[nodiscard]]
const RenderPassImplementation*
get() const noexcept {
811 return implementation.get();
#define GREM_ALWAYS_INLINE
Definition attributes.hpp:10
Optional value type that holds either a value or no value.
Definition Optional.hpp:58
Definition SharedPointer.hpp:65
Persistent system managing the rendering context of a Window.
Definition Device.hpp:68
Resource handle with shared ownership of a GPU memory buffer with copy-on-write value semantics conta...
Definition buffers.hpp:883
Resource handle with shared ownership of a GPU memory buffer with copy-on-write value semantics conta...
Definition buffers.hpp:825
Generic abstraction of a GPU vertex array object and its associated buffers.
Definition Mesh.hpp:209
Backend-specific implementation of RenderPass.
Definition RenderPass.hpp:38
GREM_ALWAYS_INLINE RenderPass(Device &device, TextureSubresourceReference renderTarget, const ClearMode &clearMode, Optional< Viewport > viewport={})
Construct a render pass.
Definition RenderPass.hpp:205
RenderPass & fill(const ClearValues &values)
Record a command to fill the full contents of the render targets.
Definition RenderPass.hpp:382
RenderPass & drawShaded(const ShaderPipeline< Mesh< Vertex, Index, Parameters, Instance > > &shaderPipelineOverride, const DrawCommandBuffer< Mesh< Vertex, Index, Parameters, Instance > > &drawCommandBuffer, const InstanceBuffer< Instance > &instanceBuffer, const Buffers &... buffers)
Record the commands to draw the contents of a draw command buffer with specific shaders using a set o...
Definition RenderPass.hpp:505
RenderPass(RenderPass &&)=delete
Moving a render pass is not allowed.
RenderPass & draw(SharedPointer< DrawCommandBufferImplementation > drawCommandBufferHandle, SharedPointer< InstanceBufferImplementation > instanceBufferHandle, Span< const Pair< BufferLayoutReference, SharedPointer< void > > > bufferHandles)
Record the commands to draw the contents of a draw command buffer using a set of shader buffers to th...
Definition RenderPass.hpp:475
RenderPass & operator=(const RenderPass &)=delete
Copying a render pass is not allowed.
Statistics getStatistics() const
Get the current statistics of the render pass.
RenderPass & drawUnordered(const UnorderedDrawCommandBuffer< Mesh< Vertex, Index, Parameters, Instance > > &drawCommandBuffer, const InstanceBuffer< Instance > &instanceBuffer, const Buffers &... buffers)
Record the commands to draw the contents of an unordered draw command buffer using a set of shader bu...
Definition RenderPass.hpp:603
RenderPass & operator=(RenderPass &&)=delete
Moving a render pass is not allowed.
RenderPass & draw(const DrawCommandBuffer< Mesh< Vertex, Index, Parameters, NoInstance > > &drawCommandBuffer, const Buffers &... buffers)
Record the commands to draw the contents of a draw command buffer using a set of shader buffers to th...
Definition RenderPass.hpp:439
RenderPass & drawShadedUnordered(const ShaderPipeline< Mesh< Vertex, Index, Parameters, Instance > > &shaderPipelineOverride, const UnorderedDrawCommandBuffer< Mesh< Vertex, Index, Parameters, Instance > > &drawCommandBuffer, const InstanceBuffer< Instance > &instanceBuffer, const Buffers &... buffers)
Record the commands to draw the contents of an unordered draw command buffer with specific shaders us...
Definition RenderPass.hpp:698
RenderPass & setViewport(const Viewport &viewport)
Set the viewport and scissor area to use for subsequently recorded draw commands.
const RenderPassImplementation * get() const noexcept
Get a pointer to the underlying resource implementation.
Definition RenderPass.hpp:810
RenderPass & drawShaded(const ShaderPipeline< Mesh< Vertex, Index, Parameters, NoInstance > > &shaderPipelineOverride, const DrawCommandBuffer< Mesh< Vertex, Index, Parameters, NoInstance > > &drawCommandBuffer, const Buffers &... buffers)
Record the commands to draw the contents of a draw command buffer with specific shaders using a set o...
Definition RenderPass.hpp:535
Extent2D getFramebufferSize()
Get the size of the framebuffer that the render pass will be rendering through.
RenderPass & draw(const DrawCommandBuffer< Mesh< Vertex, Index, Parameters, Instance > > &drawCommandBuffer, const InstanceBuffer< Instance > &instanceBuffer, const Buffers &... buffers)
Record the commands to draw the contents of a draw command buffer using a set of shader buffers to th...
Definition RenderPass.hpp:410
RenderPass & fill(const Region2D &targetRegion, const ClearValues &values)
Record a command to fill the contents of a rectangular region of the render targets.
GREM_ALWAYS_INLINE RenderPass(Device &device, TextureSubresourceReference resolveTarget, const ResolveMode &resolveMode, TextureSubresourceReference renderTarget, const ClearMode &clearMode, Optional< Viewport > viewport={})
Construct a multisampled render pass that resolves to a resolve target at the end of the render.
Definition RenderPass.hpp:281
SharedPointer< RenderPassImplementation > lock() const
Get a lock for the underlying resource implementation.
Definition RenderPass.hpp:786
const Viewport & getViewport()
Get the viewport that will be used for subsequently recorded draw commands.
RenderPassImplementation * get() noexcept
Get a pointer to the underlying resource implementation.
Definition RenderPass.hpp:798
RenderPass(Device &device, Span< const TextureSubresourceReference > renderTargets, const ClearMode &clearMode, Optional< Viewport > viewport={})
Construct a render pass.
RenderPass & setViewportScissor(const Optional< Region2D > &scissor)
Set the scissor area to use for subsequently recoreded draw commands.
RenderPass(const RenderPass &)=delete
Copying a render pass is not allowed.
RenderPass & drawShadedUnordered(const ShaderPipeline< Mesh< Vertex, Index, Parameters, NoInstance > > &shaderPipelineOverride, const UnorderedDrawCommandBuffer< Mesh< Vertex, Index, Parameters, NoInstance > > &drawCommandBuffer, const Buffers &... buffers)
Record the commands to draw the contents of an unordered draw command buffer with specific shaders us...
Definition RenderPass.hpp:728
RenderPass & drawUnordered(const UnorderedDrawCommandBuffer< Mesh< Vertex, Index, Parameters, NoInstance > > &drawCommandBuffer, const Buffers &... buffers)
Record the commands to draw the contents of an unordered draw command buffer using a set of shader bu...
Definition RenderPass.hpp:632
RenderPass & drawUnordered(SharedPointer< UnorderedDrawCommandBufferImplementation > drawCommandBufferHandle, SharedPointer< InstanceBufferImplementation > instanceBufferHandle, Span< const Pair< BufferLayoutReference, SharedPointer< void > > > bufferHandles)
Record the commands to draw the contents of an unordered draw command buffer using a set of shader bu...
Definition RenderPass.hpp:668
Linked GPU shader pipeline.
Definition shaders.hpp:1508
Resource handle with shared ownership of a GPU memory buffer with copy-on-write value semantics conta...
Definition buffers.hpp:1176
Region of a render target.
Definition Viewport.hpp:18
Definition buffer_layouts.hpp:20
constexpr void sortByAscending(random_access_range auto &&range)
Definition algorithms.hpp:514
Extent< 2 > Extent2D
Size of a 2D data region.
Definition extents.hpp:31
Region< 2 > Region2D
Rectangular region of 2D data.
Definition extents.hpp:819
Generic type-erased read-only reference to a buffer or buffer set layout.
Definition buffer_layouts.hpp:43
Specification of how a texture should either be left untouched, be cleared to specific values or be c...
Definition Texture.hpp:444
Specification of values that a texture should be cleared to.
Definition Texture.hpp:426
Performance-related statistics of a render pass.
Definition RenderPass.hpp:43
size_t totalDrawCallCount
Total number of draw calls to the underlying graphics API required by the render pass for the current...
Definition RenderPass.hpp:68
friend constexpr Statistics operator+(const Statistics &a, const Statistics &b) noexcept
Add two sets of render pass statistics together.
Definition RenderPass.hpp:119
constexpr Statistics & operator+=(const Statistics &other) noexcept
Add another set of render pass statistics to this one.
Definition RenderPass.hpp:87
size_t totalDrawnIndexCount
Total number of vertex indices processed in the render pass, including the duplicated indices produce...
Definition RenderPass.hpp:57
size_t totalDrawnVertexCount
Total number of vertices processed in the render pass, including the duplicated vertices produced by ...
Definition RenderPass.hpp:48
size_t totalDrawnInstanceCount
Total number of mesh instances processed in the render pass.
Definition RenderPass.hpp:62
friend constexpr Statistics operator-(const Statistics &a, const Statistics &b) noexcept
Subtract two sets of render pass statistics to produce the difference between them,...
Definition RenderPass.hpp:134
constexpr Statistics & operator-=(const Statistics &other) noexcept
Subtract another set of render pass statistics from this one, using unsigned modular arithmetic.
Definition RenderPass.hpp:103
constexpr bool operator==(const Statistics &other) const noexcept=default
Compare this set of render pass statistics against another for equality.
Specification of how an intermediate render texture should either store or discard its values after b...
Definition Texture.hpp:466
Reference to a subresource of a texture.
Definition Texture.hpp:372