![]() |
CUGL 4.0
Cornell University Game Library
|
#include <CURenderPass.h>
Public Member Functions | |
| RenderPass () | |
| ~RenderPass () | |
| void | dispose () |
| bool | init (bool depthStencil=true) |
| bool | init (size_t attachments, bool depthStencil=true) |
| bool | initWithFormats (const std::vector< TexelFormat > &formats, bool depthStencil=true) |
| bool | initWithFormats (const TexelFormat *formats, size_t size, bool depthStencil=true) |
| RenderPassData * | getImplementation () |
| size_t | getColorAttachments () const |
| const std::vector< TexelFormat > & | getColorFormats () const |
| TexelFormat | getColorFormat (size_t pos) const |
| bool | hasDepthStencil () const |
| TexelFormat | getDepthStencilFormat () const |
| bool | isCompatible (const std::shared_ptr< RenderPass > &pass) |
| bool | isDefaultCompatible () |
| const std::vector< Color4f > & | getClearColors () const |
| Color4f | getClearColor (size_t pos) const |
| void | setClearColor (size_t pos, const Color4f &color) |
| float | getClearDepth () const |
| void | setClearDepth (float value) |
| Uint32 | getClearStencil () const |
| void | setClearStencil (Uint32 value) |
Static Public Member Functions | |
| static std::shared_ptr< RenderPass > | alloc (bool depthStencil=true) |
| static std::shared_ptr< RenderPass > | alloc (size_t attachments, bool depthStencil=true) |
| static std::shared_ptr< RenderPass > | allocWithFormats (const std::vector< TexelFormat > &formats, bool depthStencil=true) |
| static std::shared_ptr< RenderPass > | allocWithFormats (const TexelFormat *formats, size_t size, bool depthStencil=true) |
| static std::shared_ptr< RenderPass > | getDisplay () |
This is a class representing a render pass.
A render pass defines the basic structure of a drawing pass. This includes the layout of the color attachment(s), whether there is a depth buffer, and the clear values. Note that this is not the same as FrameBuffer. It does not define the framebuffers. Instead, it provides type information about what kinds of framebuffers are supported by a given render pass.
This class is necesary for Vulkan, and implements a Vulkan render pass behind the scenes. In OpenGL, this class primarily works as a form of type checking to ensure that our choice of target for the GraphicsShader is valid.
|
inline |
Creates an uninitialized render pass.
You must initialize the render pass to use it.
|
inline |
Deletes this render pass, disposing all resources.
|
inlinestatic |
Returns a newly allocated render pass with a single COLOR_RGBA attachment.
The color attachment will be assigned to location 0. If depthStencil is true, a depth/stencil attachment will be added to position 1.
| depthStencil | Whether to include a depth/stencil attachment |
|
inlinestatic |
Returns a newly allocated render pass with multiple COLOR_RGBA attachments.
The attachments will be assigned locations 0..attachments-1. If depthStencil is true, a depth/stencil attachment will be added to position attachments. If attachments is larger than the number of possible shader outputs for this platform, this method will fail.
| attachments | The number of color attachments |
| depthStencil | Whether to include a depth/stencil attachment |
|
inlinestatic |
Returns a newly allocated pass with color attachments for the given formats.
The attachments will be assigned locations 0..#formats-1, with each attachment assigned the given format. If depthStencil is true, a depth/stencil attachment will be added to position #formats.
If the size of the formats parameter is larger than the number of possible shader outputs for this platform, this method will fail.
| formats | The list of desired image formats |
| depthStencil | Whether to include a depth/stencil attachment |
|
inlinestatic |
Returns a newly allocated pass with color attachments for the given formats.
The attachments will be assigned locations 0..size-1, with each attachment assigned the given format. If depthStencil is true, a depth/stencil attachment will be added to position size.
If the size of the formats parameter is larger than the number of possible shader outputs for this platform, this method will fail.
| formats | The list of desired image formats |
| size | The number color attachments |
| depthStencil | Whether to include a depth/stencil attachment |
| void cugl::graphics::RenderPass::dispose | ( | ) |
Deletes the render pass and resets all attributes.
You must reinitialize the render pass to use it.
| Color4f cugl::graphics::RenderPass::getClearColor | ( | size_t | pos | ) | const |
Returns the clear color for the given attachment.
This value used to clear the appropriate color attachments when the method FrameBuffer#clear is called.
| pos | The attachment location |
| const std::vector< Color4f > & cugl::graphics::RenderPass::getClearColors | ( | ) | const |
Returns the clear color(s) for this render pass.
These values are used to clear the color attachments when the method FrameBuffer#clear is called.
| float cugl::graphics::RenderPass::getClearDepth | ( | ) | const |
Returns the clear value for the depth buffer
This value is used to clear the depth buffer when the method FrameBuffer#clear is called.
| Uint32 cugl::graphics::RenderPass::getClearStencil | ( | ) | const |
Returns the clear value for the stencil buffer
This value is used to clear the stencil buffer when the method FrameBuffer#clear is called.
|
inline |
Returns the number of color attachments for this render pass
This number does not include optional depth/stencil attachment or resolve attachment for MSAA.
| TexelFormat cugl::graphics::RenderPass::getColorFormat | ( | size_t | pos | ) | const |
Returns the color attachment format at the given position
| pos | The attachment position |
|
inline |
Returns the color attachment formats for this render pass
This vector does not include the format for optional depth/stencil attachment or resolve attachment for MSAA.
|
inline |
Returns the format for the depth/stencil attachment to this render pass
This will return VK_FORMAT_UNDEFINED if this render pass does not support a depth/stencil attachment.
|
static |
Returns the render pass for the primary display.
This render pass is guaranteed to have a color attachment at location 0 and a depthStencil attachment at location 1.
|
inline |
Returns the platform-specific implementation for this render pass
The value returned is an opaque type encapsulating the information for either OpenGL or Vulkan.
|
inline |
Returns true if this render pass supports a depth/stencil attachment
|
inline |
Initializes this pass with a single COLOR_RGBA attachment.
The color attachment will be assigned to location 0. If depthStencil is true, a depth/stencil attachment will be added to position 1.
If depthStencil is true, this render pass is guaranteed to be compatible with the default render pass.
| depthStencil | Whether to include a depth/stencil attachment |
| bool cugl::graphics::RenderPass::init | ( | size_t | attachments, |
| bool | depthStencil = true |
||
| ) |
Initializes this pass with multiple COLOR_RGBA attachments.
The attachments will be assigned locations 0..attachments-1. If depthStencil is true, a depth/stencil attachment will be added to position attachments. If attachments is larger than the number of possible shader outputs for this platform, this method will fail.
| attachments | The number of color attachments |
| depthStencil | Whether to include a depth/stencil attachment |
|
inline |
Initializes this pass with color attachments for the given formats.
The attachments will be assigned locations 0..#formats-1, with each attachment assigned the given format. If depthStencil is true, a depth/stencil attachment will be added to position #formats.
If the size of the formats parameter is larger than the number of possible shader outputs for this platform, this method will fail.
| formats | The list of desired image formats |
| depthStencil | Whether to include a depth/stencil attachment |
| bool cugl::graphics::RenderPass::initWithFormats | ( | const TexelFormat * | formats, |
| size_t | size, | ||
| bool | depthStencil = true |
||
| ) |
Initializes this pass with color attachments for the given formats.
The attachments will be assigned locations 0..size-1, with each attachment assigned the given format. If depthStencil is true, a depth/stencil attachment will be added to position size.
If the size of the formats parameter is larger than the number of possible shader outputs for this platform, this method will fail.
| formats | The list of desired image formats |
| size | The number color attachments |
| depthStencil | Whether to include a depth/stencil attachment |
|
inline |
Returns true if this render pass is compatible with the given one.
Compatible render passes can be swapped in a GraphicsShader on demand. Two render passes are compatible if they have the same number of color attachments (even though formats may change) and both agree on the presence of a depth buffer.
| pass | The render pass to compare |
Returns true if this render pass is compatible with the given one.
|
inline |
Returns true if this is compatible with the default render pass.
Default renderpasses can be used on the display.
Returns true if this is compatible with the default render pass.
| void cugl::graphics::RenderPass::setClearColor | ( | size_t | pos, |
| const Color4f & | color | ||
| ) |
Sets the clear color for the given attachment.
This value used to clear the appropriate color attachments when the method FrameBuffer#clear is called. If this value is changed after a render pass has started, it will not be applied until the next render pass.
| pos | The attachment location |
| color | The clear color for the given attachment. |
| void cugl::graphics::RenderPass::setClearDepth | ( | float | value | ) |
Sets the clear value for the depth buffer
This value is used to clear the depth buffer when the method FrameBuffer#clear is called. If this value is changed after a render pass has started, it will not be applied until the next render pass.
| value | The clear value for the depth buffer |
| void cugl::graphics::RenderPass::setClearStencil | ( | Uint32 | value | ) |
Sets the clear value for the stencil buffer
This value is used to clear the stencil buffer when the method FrameBuffer#clear is called. If this value is changed after a render pass has started, it will not be applied until the next render pass.
| value | The clear value for the stencil buffer |