#include <Framebuffer.h>
Public Types | |
| enum | BufferMask |
Public Member Functions | |
| void | removeRenderBuffers () |
| Removes all render buffers from the current framebuffer. | |
| uint32 | getNumRenderBuffers () const |
| const TextureViews & | getRenderBuffers () const |
| int32 | setRenderBuffer (uint32 slot, const TexturePointer &texture, uint32 subresource=0) |
| Sets a given render buffer slot in the framebuffer. More... | |
| const TexturePointer & | getRenderBuffer (uint32 slot) const |
| Returns render buffer from particular slot. More... | |
| uint32 | getRenderBufferSubresource (uint32 slot) const |
| Get subresource index for a give slot. More... | |
| bool | setDepthBuffer (const TexturePointer &texture, const Format &format, uint32 subresource=0) |
| Sets depth render buffer. More... | |
| bool | setStencilBuffer (const TexturePointer &texture, const Format &format, uint32 subresource=0) |
| Sets stencil render buffer. More... | |
| bool | setDepthStencilBuffer (const TexturePointer &texture, const Format &format, uint32 subresource=0) |
| Sets the combined depth stencil render buffer. More... | |
| const TexturePointer & | getDepthStencilBuffer () const |
| uint32 | getDepthStencilBufferSubresource () const |
| Format | getDepthStencilBufferFormat () const |
| Masks | getBufferMask () const |
| bool | isEmpty () const |
| bool | hasColor () const |
| bool | hasDepthStencil () const |
| bool | hasDepth () const |
| bool | hasStencil () const |
| bool | validateTargetCompatibility (const Texture &texture, uint32 subresource=0) const |
| Checks if a texture is compatible with being a render attachment. More... | |
| Vec2u | getSize () const |
| uint16 | getWidth () const |
| uint16 | getHeight () const |
| uint16 | getNumSamples () const |
| const std::string & | getName () const |
| void | setName (const std::string &name) |
| Sets the framebuffer name. More... | |
| float | getAspectRatio () const |
| Stamp | getDepthStamp () const |
| const std::vector< Stamp > & | getColorStamps () const |
Static Public Member Functions | |
| static Framebuffer * | create (const std::string &name) |
| Creates a framebuffer with a given name. Does not create any render buffers. More... | |
| static Framebuffer * | create (const std::string &name, const Format &colorBufferFormat, uint16 width, uint16 height) |
| Creates a framebuffer with a color render buffer. More... | |
| static Framebuffer * | create (const std::string &name, const Format &colorBufferFormat, const Format &depthStencilBufferFormat, uint16 width, uint16 height) |
| Creates a framebuffer with a color and depth stencil render buffers. More... | |
| static uint32 | getMaxNumRenderBuffers () |
| static glm::vec4 | evalSubregionTexcoordTransformCoefficients (const glm::ivec2 &sourceSurface, const glm::ivec2 &destRegionSize, const glm::ivec2 &destRegionOffset=glm::ivec2(0)) |
| Used to get coefficients for mapping one surface to an area on the other surface. More... | |
| static glm::vec4 | evalSubregionTexcoordTransformCoefficients (const glm::ivec2 &sourceSurface, const glm::ivec4 &destViewport) |
| Used to get coefficients for mapping one surface to an area on the other surface. More... | |
| static Transform | evalSubregionTexcoordTransform (const glm::ivec2 &sourceSurface, const glm::ivec2 &destRegionSize, const glm::ivec2 &destRegionOffset=glm::ivec2(0)) |
| Used to get transform for mapping one surface to an area on the other surface. More... | |
| static Transform | evalSubregionTexcoordTransform (const glm::ivec2 &sourceSurface, const glm::ivec4 &destViewport) |
| Used to get transform for mapping one surface to an area on the other surface. More... | |
Public Attributes | |
| const GPUObjectPointer | gpuObject {} |
Protected Member Functions | |
| void | updateSize (const TexturePointer &texture) |
| Copy width, height and sample count from a texture. More... | |
| bool | assignDepthStencilBuffer (const TexturePointer &texture, const Format &format, uint32 subresource) |
| Sets depth stencil buffer. More... | |
Protected Attributes | |
| std::string | _name |
| Framebuffer name. | |
| Stamp | _depthStamp { 0 } |
| std::vector< Stamp > | _colorStamps |
| TextureViews | _renderBuffers |
| Color render buffers. | |
| TextureView | _depthStencilBuffer |
| Depth, stencil, or combined depth stencil rneder buffer. | |
| Masks | _bufferMask = 0 |
Bit sum of BufferMask enums. Used to check which buffers are populated. | |
| uint16 | _width = 0 |
| Framebuffer width in pixels. | |
| uint16 | _height = 0 |
| Framebuffer height in pixels. | |
| uint16 | _numSamples = 0 |
| Number of samples per pixel. Greater than 1 when MSAA is used. | |
API-independent class representing a framebuffer.
DOCTODO
|
protected |
Sets depth stencil buffer.
| texture | Shared pointer to a texture. Can be nullptr. |
| format | Depth stencil format. |
| subresource | Subresource index. Used when texture has multiple subresources, for example with shadow cascades. |
true if depth stencil render buffer was assigned successfully.
|
static |
Creates a framebuffer with a given name. Does not create any render buffers.
| name | Name of the framebuffer. |
|
static |
Creates a framebuffer with a color and depth stencil render buffers.
| name | Name of the framebuffer. |
| colorBufferFormat | Format of the color render buffer to be created. |
| depthStencilBufferFormat | Format of the depth stencil render buffer to be created. |
| width | With of the framebuffer. |
| height | Height of the framebuffer. |
|
static |
Creates a framebuffer with a color render buffer.
| name | Name of the framebuffer. |
| colorBufferFormat | Format of the color render buffer to be created. |
| width | With of the framebuffer. |
| height | Height of the framebuffer. |
|
static |
Used to get transform for mapping one surface to an area on the other surface.
| sourceSurface | Size of the source surface in pixels. |
| destRegionSize | Size of the destination region in pixels. |
| destRegionOffset | Start position of the destination region in pixels. |
|
static |
Used to get transform for mapping one surface to an area on the other surface.
| sourceSurface | Size of the source surface in pixels. |
| destViewport | x,y - destination region offset, z, w - destination region size. |
|
static |
Used to get coefficients for mapping one surface to an area on the other surface.
| sourceSurface | Size of the source surface in pixels. |
| destRegionSize | Size of the destination region in pixels. |
| destRegionOffset | Start position of the destination region in pixels. |
vec4 where x - x start coefficient, y - y start coefficient, z - width coefficient, w - height coefficient.
|
static |
Used to get coefficients for mapping one surface to an area on the other surface.
| sourceSurface | Size of the source surface in pixels. |
| destViewport | x,y - destination region offset, z, w - destination region size. |
vec4 where x - x start coefficient, y - y start coefficient, z - width coefficient, w - height coefficient.
|
inline |
|
inline |
|
inline |
Stamp is a counter that is incremented on changes and then compared with the stamp on backend-specific object side to determine if backend-specific object needs to be updated.
|
inline |
Stamp is a counter that is incremented on changes and then compared with the stamp on backend-specific object side to determine if backend-specific object needs to be updated.
| const TexturePointer & Framebuffer::getDepthStencilBuffer | ( | ) | const |
nullptr if the render buffer does not exist. | Format Framebuffer::getDepthStencilBufferFormat | ( | ) | const |
| uint32 Framebuffer::getDepthStencilBufferSubresource | ( | ) | const |
| uint16 Framebuffer::getHeight | ( | ) | const |
|
inlinestatic |
|
inline |
| uint32 Framebuffer::getNumRenderBuffers | ( | ) | const |
| uint16 Framebuffer::getNumSamples | ( | ) | const |
| const TexturePointer & Framebuffer::getRenderBuffer | ( | uint32 | slot | ) | const |
Returns render buffer from particular slot.
| slot | Slot index. |
|
inline |
| uint32 Framebuffer::getRenderBufferSubresource | ( | uint32 | slot | ) | const |
Get subresource index for a give slot.
| slot | Slot index. |
|
inline |
| uint16 Framebuffer::getWidth | ( | ) | const |
|
inline |
true if the framebuffer has one or more color render buffers.
|
inline |
true if render buffer has a depth render buffer.
|
inline |
true if render buffer has a depth stencil render buffer.
|
inline |
true if render buffer has a stencil render buffer.
|
inline |
true if there's no render buffers in the current framebuffer. | bool Framebuffer::setDepthBuffer | ( | const TexturePointer & | texture, |
| const Format & | format, | ||
| uint32 | subresource = 0 |
||
| ) |
Sets depth render buffer.
| texture | Texture to be set as render buffer. |
| format | Depth format for the render buffer. |
| subresource | Subresource index, used when texture has several subresources, for example for shadow cascades. |
true if render buffer was set successfully. | bool Framebuffer::setDepthStencilBuffer | ( | const TexturePointer & | texture, |
| const Format & | format, | ||
| uint32 | subresource = 0 |
||
| ) |
Sets the combined depth stencil render buffer.
| texture | Texture to be set as render buffer. |
| format | Depth stencil format for the render buffer. |
| subresource | Subresource index, used when texture has several subresources. |
true if render buffer was set successfully.
|
inline |
Sets the framebuffer name.
| name | New name. |
| int Framebuffer::setRenderBuffer | ( | uint32 | slot, |
| const TexturePointer & | texture, | ||
| uint32 | subresource = 0 |
||
| ) |
Sets a given render buffer slot in the framebuffer.
| slot | Index of the slot to set. |
| texture | Texture to set it to. |
| subresource | Subresource index for when texture has several subresources. Used for shadow cascades and SSAO. |
| bool Framebuffer::setStencilBuffer | ( | const TexturePointer & | texture, |
| const Format & | format, | ||
| uint32 | subresource = 0 |
||
| ) |
Sets stencil render buffer.
| texture | Texture to be set as render buffer. |
| format | Stencil format for the render buffer. |
| subresource | Subresource index, used when texture has several subresources. |
true if render buffer was set successfully.
|
protected |
Copy width, height and sample count from a texture.
If texture is nullptr, then width, height and sample count are set to 0.
| texture | Shared pointer to a texture to copy width, height and sample count from. Can be nullptr. |
| bool Framebuffer::validateTargetCompatibility | ( | const Texture & | texture, |
| uint32 | subresource = 0 |
||
| ) | const |
Checks if a texture is compatible with being a render attachment.
Checks if texture size and number of samples is the same as for the framebuffer.
| texture | Texture to check. |
| subresource | Index of the subresource to check. Currently not used. |
true if texture passed the check.
|
protected |
Counters that are incremented on changes and then compared with the stamps on backend-specific objects to determine if backend-specific objects for color render buffers needs to be updated.
|
protected |
A counter that is incremented on changes and then compared with the stamp on backend-specific object to determine if backend-specific object for depth render buffer needs to be updated.
| const GPUObjectPointer gpu::Framebuffer::gpuObject {} |
Graphics API-specific object representing this framebuffer on the backend side.