![]() |
LLGL 0.05 Beta
|
Swap-chain interface. More...
#include <SwapChain.h>
Public Member Functions | |
| ~SwapChain () | |
| Release the internal data. | |
| Extent2D | GetResolution () const final |
| Returns the resolution of the current video mode. | |
| std::uint32_t | GetNumColorAttachments () const final |
| Returns 1, since each swap-chain has always a single color attachment. | |
| bool | HasDepthAttachment () const final |
| Returns true if this swap-chain has a depth format. | |
| bool | HasStencilAttachment () const final |
| Returns true if this swap-chain has a stencil format. | |
| virtual bool | IsPresentable () const =0 |
| Returns true if this swap-chain is ready for rendering and presenting. Otherwise, the native surface or back buffer are not available. | |
| virtual void | Present ()=0 |
| Swaps the current back buffer with the front buffer to present it on the screen. | |
| virtual std::uint32_t | GetCurrentSwapIndex () const =0 |
| Returns the current swap-buffer index. | |
| virtual std::uint32_t | GetNumSwapBuffers () const =0 |
| Returns the actual number of swap-buffers in this swap-chain. | |
| virtual Format | GetColorFormat () const =0 |
| Returns the color format of this swap-chain. | |
| virtual Format | GetDepthStencilFormat () const =0 |
| Returns the depth-stencil format of this swap-chain. | |
| bool | ResizeBuffers (const Extent2D &resolution, long flags=0) |
| Resizes all swap buffers of this swap-chain. | |
| virtual bool | SetVsyncInterval (std::uint32_t vsyncInterval)=0 |
| Sets the new vertical synchronization (V-sync) interval for this swap chain. | |
| bool | SwitchFullscreen (bool enable) |
| Puts the display, the swap-chain's surface is resident in, into fullscreen mode or puts it back into normal mode. | |
| Surface & | GetSurface () const |
| Returns the surface which is used to present the content on the screen. | |
| Public Member Functions inherited from LLGL::RenderTarget | |
| virtual std::uint32_t | GetSamples () const =0 |
| Returns the number of samples this render target was created with. | |
| virtual const RenderPass * | GetRenderPass () const =0 |
| Returns the RenderPass object this render target is associated with, or null if render passes are optional for the the render system. | |
| Public Member Functions inherited from LLGL::RenderSystemChild | |
| virtual void | SetDebugName (const char *name) |
| Sets the name of this class instance for debugging purposes. | |
| Public Member Functions inherited from LLGL::Interface | |
| virtual bool | IsInstanceOf (int id) const |
| Returns true if this object is an instance of the specified interface. | |
| Public Member Functions inherited from LLGL::NonCopyable | |
| NonCopyable (const NonCopyable &)=delete | |
| NonCopyable & | operator= (const NonCopyable &)=delete |
| virtual | ~NonCopyable ()=default |
Protected Member Functions | |
| virtual Extent2D | ResizeBuffersPrimary (const Extent2D &resolution)=0 |
| Primary function to resize all swap buffers. | |
| SwapChain () | |
| Allocates the internal data. | |
| SwapChain (const SwapChainDescriptor &desc) | |
| Constructor to initialize the swap-chain with the specified video mode and V-sync. | |
| void | SetOrCreateSurface (const std::shared_ptr< Surface > &surface, const UTF8String &title, const SwapChainDescriptor &swapChainDesc, const void *windowContext=nullptr, std::size_t windowContextSize=0) |
| Sets the swap-chain surface or creates one if 'surface' is null, and switches to fullscreen mode if enabled. | |
| void | ShowSurface () |
| Shows the swap-chain surface if it's not the same as the input surface. | |
| void | ShareSurfaceAndConfig (SwapChain &other) |
| Shares the surface and resolution with another swap-chain. | |
| bool | SetDisplayFullscreenMode (const Extent2D &resolution) |
| Puts the display the swap-chain's surface is resident in into fullscreen mode. | |
| bool | ResetDisplayFullscreenMode () |
| Puts the display the swap-chain's surface is resident in back into normal mode. | |
| void | SetResolution (const Extent2D &resolution) |
| Overrides the reported swap-chain resolution with the one that was actually allocated. | |
| Protected Member Functions inherited from LLGL::RenderTarget | |
| void | ValidateResolution (const Extent2D &attachmentResolution) |
| Validates the specified attachment resolution for this render target. | |
| void | ValidateMipResolution (const Texture &texture, std::uint32_t mipLevel) |
| Applies the resolution of the texture MIP level. | |
| Protected Member Functions inherited from LLGL::NonCopyable | |
| NonCopyable ()=default | |
Static Protected Member Functions | |
| static UTF8String | BuildDefaultSurfaceTitle (const RendererInfo &info) |
| Builds a default title for the swap-chain surface when no custom surface is specified. | |
Swap-chain interface.
| LLGL::SwapChain::~SwapChain | ( | ) |
Release the internal data.
|
protected |
Allocates the internal data.
|
protected |
Constructor to initialize the swap-chain with the specified video mode and V-sync.
|
staticprotected |
Builds a default title for the swap-chain surface when no custom surface is specified.
"LLGL SURFACE NUMBER ( RENDERER )":SURFACE is either "Window" on desktop platforms or "Canvas" on mobile platforms.NUMBER denotes the number of the swap-chain starting at 1.RENDERER denotes the renderer name (see RendererInfo::rendererName).
|
pure virtual |
Returns the color format of this swap-chain.
|
pure virtual |
Returns the current swap-buffer index.
|
pure virtual |
Returns the depth-stencil format of this swap-chain.
|
finalvirtual |
Returns 1, since each swap-chain has always a single color attachment.
Implements LLGL::RenderTarget.
|
pure virtual |
Returns the actual number of swap-buffers in this swap-chain.
|
finalvirtual |
Returns the resolution of the current video mode.
Implements LLGL::RenderTarget.
| Surface & LLGL::SwapChain::GetSurface | ( | ) | const |
Returns the surface which is used to present the content on the screen.
|
finalvirtual |
Returns true if this swap-chain has a depth format.
Implements LLGL::RenderTarget.
|
finalvirtual |
Returns true if this swap-chain has a stencil format.
Implements LLGL::RenderTarget.
|
pure virtual |
Returns true if this swap-chain is ready for rendering and presenting. Otherwise, the native surface or back buffer are not available.
|
pure virtual |
Swaps the current back buffer with the front buffer to present it on the screen.
|
protected |
Puts the display the swap-chain's surface is resident in back into normal mode.
| bool LLGL::SwapChain::ResizeBuffers | ( | const Extent2D & | resolution, |
| long | flags = 0 ) |
Resizes all swap buffers of this swap-chain.
| [in] | resolution | Specifies the new resolution. This is only a hint: the platform may clamp it to what the surface permits. |
| [in] | flags | Optional flags to specify whether the swap-chain's surface is to be adjusted as well and to toggle fullscreen mode. |
|
protectedpure virtual |
Primary function to resize all swap buffers.
| [in] | resolution | Specifies the requested resolution. This is only a hint: the platform may clamp it to what the surface permits. |
Extent2D{ 0, 0 }) to indicate failure, in which case the previously reported resolution remains unchanged.
|
protected |
Puts the display the swap-chain's surface is resident in into fullscreen mode.
|
protected |
Sets the swap-chain surface or creates one if 'surface' is null, and switches to fullscreen mode if enabled.
| [in] | surface | Optional shared pointer to a surface which will be used as main render target. If this is null, a new surface is created for this swap-chain. |
| [in] | title | Specifies the surface title. This is only used if surface is null. |
| [in] | swapChainDesc | Specifies the swap-chain descriptor. Use the resolution for the surface content size, fullscreen, and resiable flags. |
| [in] | windowContext | Optional pointer to a NativeHandle structure. This is only used for desktop platforms. |
| [in] | windowContextSize | Size (in bytes) of the native handle windowContext points to. This must be equal to sizeof(LLGL::NativeHandle). |
|
protected |
Overrides the reported swap-chain resolution with the one that was actually allocated.
VkSurfaceCapabilitiesKHR::minImageExtent and maxImageExtent, which on most windowing systems both equal the window's current client area. GetResolution() must describe the buffers that exist rather than the ones that were asked for; reporting the request instead leaves callers deriving viewports, scissors and projection matrices from a resolution the backbuffer does not have. During ResizeBuffers() this is handled by the return value of ResizeBuffersPrimary(); backends that (re-)allocate their swap buffers outside of that function - e.g. at creation time or when recreating an out-of-date swap-chain - should call this function from wherever the allocation happens.
|
pure virtual |
Sets the new vertical synchronization (V-sync) interval for this swap chain.
| [in] | vsyncInterval | Specifies the new V-sync interface. |
|
protected |
Shares the surface and resolution with another swap-chain.
|
protected |
Shows the swap-chain surface if it's not the same as the input surface.
| bool LLGL::SwapChain::SwitchFullscreen | ( | bool | enable | ) |
Puts the display, the swap-chain's surface is resident in, into fullscreen mode or puts it back into normal mode.
| [in] | enable | If true, puts the display into fullscreen mode (Display::SetDisplayMode). Otherwise, puts the display back into normal mode (Display::ResetDisplayMode). |